From 51281095088379236e1f2e45e466db5bb2cd3f16 Mon Sep 17 00:00:00 2001 From: Yi Luo Date: Mon, 26 Jun 2017 16:36:15 -0700 Subject: [PATCH] Fix inv txfm low/high bitdepth selection logic We are going to have several commits to setup new low/high bitdepth data path selection logic. This patch is for inverse transform. Let me summarize the ideas as following. - For low/high bitdepth selection, encoder depends on input configuration, e.g., video sequence bitdepth, profile. Decoder depends on input bitstream. This has nothing to do with compiler/build configuration. - Typical encoder usage for sampling format 4:2:0. 1) 8-bit video sequence: a) --profile=0 Fastest encoding/decoding pipeline on speedup. b) --profile=2 --bit-depth=10 Image pixels are left shifted by 2 bits. It employs 16-bit reference frame buffer and has high calculation precision. It usually enjoys higher compression performance. 2) 10/12-bit video sequence (HDR): --profile=2 --bit-depth=10/12 - Transform coefficient type: Lowbitdepth: int16_t Highbitdepth: int32_t - The type, tran_low_t is still used in codebase, Which is int32_t, defining the data path capacity. Naturally, it is high bitdepth. Eventually we shall remove the configuration flags, CONFIG_HIGHBITDEPTH/CONFIG_LOWBITDEPTH, and seperate low and high bitdepth data path. Two data paths co-exist in the same build environment. Change-Id: I35c06d4d4f19ebf80d909168fdddbae57c3cc884 --- aom_dsp/aom_dsp_rtcd_defs.pl | 2 +- aom_dsp/inv_txfm.c | 2 - aom_dsp/inv_txfm.h | 2 - aom_dsp/x86/inv_txfm_sse2.c | 2 - av1/av1_common.mk | 3 +- av1/common/av1_rtcd_defs.pl | 34 +++++++------- av1/common/blockd.h | 4 ++ av1/common/idct.c | 88 +++++++++++++++++++----------------- av1/common/idct.h | 6 +-- 9 files changed, 70 insertions(+), 73 deletions(-) diff --git a/aom_dsp/aom_dsp_rtcd_defs.pl b/aom_dsp/aom_dsp_rtcd_defs.pl index 6b0a46e3b..9d8028e43 100755 --- a/aom_dsp/aom_dsp_rtcd_defs.pl +++ b/aom_dsp/aom_dsp_rtcd_defs.pl @@ -390,7 +390,6 @@ if ((aom_config("CONFIG_AV1_ENCODER") eq "yes") || (aom_config("CONFIG_PVQ") eq # # Inverse transform if (aom_config("CONFIG_AV1") eq "yes") { -if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { add_proto qw/void aom_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride"; add_proto qw/void aom_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride"; @@ -457,6 +456,7 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { add_proto qw/void aom_highbd_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd"; specialize qw/aom_highbd_idct4x4_16_add sse2/; } +if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { } else { { add_proto qw/void aom_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride"; diff --git a/aom_dsp/inv_txfm.c b/aom_dsp/inv_txfm.c index 2d1f9abc4..8b2c6a3b7 100644 --- a/aom_dsp/inv_txfm.c +++ b/aom_dsp/inv_txfm.c @@ -1314,7 +1314,6 @@ void aom_idct32x32_1_add_c(const tran_low_t *input, uint8_t *dest, int stride) { } } -#if CONFIG_HIGHBITDEPTH void aom_highbd_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8, int stride, int bd) { /* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, @@ -1474,4 +1473,3 @@ void aom_highbd_idct4x4_1_add_c(const tran_low_t *input, uint8_t *dest8, dest += dest_stride; } } -#endif // CONFIG_HIGHBITDEPTH diff --git a/aom_dsp/inv_txfm.h b/aom_dsp/inv_txfm.h index 5a29bdef7..bd3e63d55 100644 --- a/aom_dsp/inv_txfm.h +++ b/aom_dsp/inv_txfm.h @@ -66,7 +66,6 @@ void aom_iadst4_c(const tran_low_t *input, tran_low_t *output); void aom_iadst8_c(const tran_low_t *input, tran_low_t *output); void aom_iadst16_c(const tran_low_t *input, tran_low_t *output); -#if CONFIG_HIGHBITDEPTH void aom_highbd_idct4_c(const tran_low_t *input, tran_low_t *output, int bd); void aom_highbd_idct8_c(const tran_low_t *input, tran_low_t *output, int bd); void aom_highbd_idct16_c(const tran_low_t *input, tran_low_t *output, int bd); @@ -75,7 +74,6 @@ void aom_highbd_idct32_c(const tran_low_t *input, tran_low_t *output, int bd); void aom_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd); void aom_highbd_iadst8_c(const tran_low_t *input, tran_low_t *output, int bd); void aom_highbd_iadst16_c(const tran_low_t *input, tran_low_t *output, int bd); -#endif // CONFIG_HIGHBITDEPTH static INLINE uint16_t highbd_clip_pixel_add(uint16_t dest, tran_high_t trans, int bd) { diff --git a/aom_dsp/x86/inv_txfm_sse2.c b/aom_dsp/x86/inv_txfm_sse2.c index fb4968e8c..6973fbdd5 100644 --- a/aom_dsp/x86/inv_txfm_sse2.c +++ b/aom_dsp/x86/inv_txfm_sse2.c @@ -3499,7 +3499,6 @@ void idct32_8col(__m128i *in0, __m128i *in1) { in1[15] = _mm_sub_epi16(stp1_0, stp1_31); } -#if CONFIG_HIGHBITDEPTH static INLINE __m128i clamp_high_sse2(__m128i value, int bd) { __m128i ubounded, retval; const __m128i zero = _mm_set1_epi16(0); @@ -3627,4 +3626,3 @@ void aom_highbd_idct4x4_16_add_sse2(const tran_low_t *input, uint8_t *dest8, } } } -#endif // CONFIG_HIGHBITDEPTH diff --git a/av1/av1_common.mk b/av1/av1_common.mk index dcd1f221c..c18f7d5d1 100644 --- a/av1/av1_common.mk +++ b/av1/av1_common.mk @@ -154,11 +154,10 @@ AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_txfm1d_sse4.h AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm1d_sse4.c AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm2d_sse4.c endif -ifeq ($(CONFIG_HIGHBITDEPTH),yes) + AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_txfm_utility_sse4.h AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_inv_txfm_sse4.c AV1_COMMON_SRCS-$(HAVE_AVX2) += common/x86/highbd_inv_txfm_avx2.c -endif ifneq ($(CONFIG_HIGHBITDEPTH),yes) AV1_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iht4x4_add_neon.c diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index a0e6b072a..b16f48638 100755 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl @@ -253,24 +253,22 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { add_proto qw/void av1_highbd_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type, int bd"; } -if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - #inv txfm - add_proto qw/void av1_inv_txfm2d_add_4x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_8x4/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_8x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_16x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_16x32/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_32x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - add_proto qw/void av1_inv_txfm2d_add_4x4/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - specialize qw/av1_inv_txfm2d_add_4x4 sse4_1/; - add_proto qw/void av1_inv_txfm2d_add_8x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - specialize qw/av1_inv_txfm2d_add_8x8 sse4_1/; - add_proto qw/void av1_inv_txfm2d_add_16x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - specialize qw/av1_inv_txfm2d_add_16x16 sse4_1/; - add_proto qw/void av1_inv_txfm2d_add_32x32/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; - specialize qw/av1_inv_txfm2d_add_32x32 avx2/; - add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; -} +#inv txfm +add_proto qw/void av1_inv_txfm2d_add_4x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_8x4/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_8x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_16x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_16x32/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_32x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_4x4/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +specialize qw/av1_inv_txfm2d_add_4x4 sse4_1/; +add_proto qw/void av1_inv_txfm2d_add_8x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +specialize qw/av1_inv_txfm2d_add_8x8 sse4_1/; +add_proto qw/void av1_inv_txfm2d_add_16x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +specialize qw/av1_inv_txfm2d_add_16x16 sse4_1/; +add_proto qw/void av1_inv_txfm2d_add_32x32/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; +specialize qw/av1_inv_txfm2d_add_32x32 avx2/; +add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd"; # # Encoder functions below this point. diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 4f877788f..06a29328f 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h @@ -737,6 +737,10 @@ typedef struct macroblockd { #endif } MACROBLOCKD; +static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) { + return xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH ? 1 : 0; +} + static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, PARTITION_TYPE partition) { if (partition == PARTITION_INVALID) diff --git a/av1/common/idct.c b/av1/common/idct.c index 6500d30a3..260df3461 100644 --- a/av1/common/idct.c +++ b/av1/common/idct.c @@ -1456,7 +1456,6 @@ static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, } #endif // CONFIG_TX64X64 -#if CONFIG_HIGHBITDEPTH // idct void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd) { @@ -1509,6 +1508,7 @@ static void highbd_inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type, int lossless) { + const int32_t *src = (const int32_t *)input; if (lossless) { assert(tx_type == DCT_DCT); av1_highbd_iwht4x4_add(input, dest, stride, eob, bd); @@ -1519,7 +1519,7 @@ void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, case ADST_DCT: case DCT_ADST: case ADST_ADST: - av1_inv_txfm2d_add_4x4(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + av1_inv_txfm2d_add_4x4(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; #if CONFIG_EXT_TX @@ -1528,7 +1528,7 @@ void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: - av1_inv_txfm2d_add_4x4(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + av1_inv_txfm2d_add_4x4(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; // use the c version for anything including identity for now @@ -1539,8 +1539,8 @@ void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, case V_FLIPADST: case H_FLIPADST: case IDTX: - av1_inv_txfm2d_add_4x4_c(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_4x4_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; #endif // CONFIG_EXT_TX default: assert(0); break; @@ -1550,22 +1550,23 @@ void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, void av1_highbd_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_4x8_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, - bd); + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_4x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_8x4_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, - bd); + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_8x4_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } static void highbd_inv_txfm_add_8x16(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_8x16_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_8x16_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } @@ -1573,7 +1574,8 @@ static void highbd_inv_txfm_add_16x8(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_16x8_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_16x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } @@ -1581,7 +1583,8 @@ static void highbd_inv_txfm_add_16x32(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_16x32_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_16x32_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } @@ -1589,7 +1592,8 @@ static void highbd_inv_txfm_add_32x16(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; - av1_inv_txfm2d_add_32x16_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + const int32_t *src = (const int32_t *)input; + av1_inv_txfm2d_add_32x16_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); } @@ -1597,12 +1601,13 @@ static void highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; + const int32_t *src = (const int32_t *)input; switch (tx_type) { case DCT_DCT: case ADST_DCT: case DCT_ADST: case ADST_ADST: - av1_inv_txfm2d_add_8x8(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + av1_inv_txfm2d_add_8x8(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; #if CONFIG_EXT_TX @@ -1611,7 +1616,7 @@ static void highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: - av1_inv_txfm2d_add_8x8(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + av1_inv_txfm2d_add_8x8(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; // use the c version for anything including identity for now @@ -1622,8 +1627,8 @@ static void highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, case V_FLIPADST: case H_FLIPADST: case IDTX: - av1_inv_txfm2d_add_8x8_c(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_8x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; #endif // CONFIG_EXT_TX default: assert(0); @@ -1634,13 +1639,14 @@ static void highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; + const int32_t *src = (const int32_t *)input; switch (tx_type) { case DCT_DCT: case ADST_DCT: case DCT_ADST: case ADST_ADST: - av1_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_16x16(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; #if CONFIG_EXT_TX case FLIPADST_DCT: @@ -1648,8 +1654,8 @@ static void highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: - av1_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_16x16(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; // use the c version for anything including identity for now case V_DCT: @@ -1659,7 +1665,7 @@ static void highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, case V_FLIPADST: case H_FLIPADST: case IDTX: - av1_inv_txfm2d_add_16x16_c(input, CONVERT_TO_SHORTPTR(dest), stride, + av1_inv_txfm2d_add_16x16_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; #endif // CONFIG_EXT_TX @@ -1671,13 +1677,14 @@ static void highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; + const int32_t *src = (const int32_t *)input; switch (tx_type) { case DCT_DCT: case ADST_DCT: case DCT_ADST: case ADST_ADST: - av1_inv_txfm2d_add_32x32(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_32x32(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; #if CONFIG_EXT_TX case FLIPADST_DCT: @@ -1685,8 +1692,8 @@ static void highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: - av1_inv_txfm2d_add_32x32(input, CONVERT_TO_SHORTPTR(dest), stride, - tx_type, bd); + av1_inv_txfm2d_add_32x32(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, + bd); break; // use the c version for anything including identity for now case V_DCT: @@ -1696,7 +1703,7 @@ static void highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, case V_FLIPADST: case H_FLIPADST: case IDTX: - av1_inv_txfm2d_add_32x32_c(input, CONVERT_TO_SHORTPTR(dest), stride, + av1_inv_txfm2d_add_32x32_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; #endif // CONFIG_EXT_TX @@ -1709,10 +1716,11 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type) { (void)eob; + const int32_t *src = (const int32_t *)input; switch (tx_type) { case DCT_DCT: - av1_inv_txfm2d_add_64x64(input, CONVERT_TO_SHORTPTR(dest), stride, - DCT_DCT, bd); + av1_inv_txfm2d_add_64x64(src, CONVERT_TO_SHORTPTR(dest), stride, DCT_DCT, + bd); break; #if CONFIG_EXT_TX case ADST_DCT: @@ -1735,7 +1743,7 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, // in a later change. This shouldn't impact performance since // DCT_DCT is the only extended type currently allowed for 64x64, // as dictated by get_ext_tx_set_type in blockd.h. - av1_inv_txfm2d_add_64x64_c(input, CONVERT_TO_SHORTPTR(dest), stride, + av1_inv_txfm2d_add_64x64_c(src, CONVERT_TO_SHORTPTR(dest), stride, DCT_DCT, bd); break; case IDTX: @@ -1746,7 +1754,6 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, } } #endif // CONFIG_TX64X64 -#endif // CONFIG_HIGHBITDEPTH void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, INV_TXFM_PARAM *param) { @@ -1804,6 +1811,12 @@ static void init_inv_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size, #endif } +typedef void (*InvTxfmFunc)(const tran_low_t *dqcoeff, uint8_t *dst, int stride, + INV_TXFM_PARAM *param); + +static InvTxfmFunc inv_txfm_func[2] = { av1_inv_txfm_add, + av1_highbd_inv_txfm_add }; + void av1_inverse_transform_block(const MACROBLOCKD *xd, const tran_low_t *dqcoeff, TX_TYPE tx_type, TX_SIZE tx_size, uint8_t *dst, int stride, @@ -1830,15 +1843,8 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd, INV_TXFM_PARAM inv_txfm_param; init_inv_txfm_param(xd, tx_size, tx_type, eob, &inv_txfm_param); -#if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - av1_highbd_inv_txfm_add(dqcoeff, dst, stride, &inv_txfm_param); - } else { -#endif // CONFIG_HIGHBITDEPTH - av1_inv_txfm_add(dqcoeff, dst, stride, &inv_txfm_param); -#if CONFIG_HIGHBITDEPTH - } -#endif // CONFIG_HIGHBITDEPTH + const int is_hbd = get_bitdepth_data_path_index(xd); + inv_txfm_func[is_hbd](dqcoeff, dst, stride, &inv_txfm_param); } void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, @@ -1855,7 +1861,6 @@ void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, eob); } -#if CONFIG_HIGHBITDEPTH void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, INV_TXFM_PARAM *inv_txfm_param) { const TX_TYPE tx_type = inv_txfm_param->tx_type; @@ -1912,7 +1917,6 @@ void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, default: assert(0 && "Invalid transform size"); break; } } -#endif // CONFIG_HIGHBITDEPTH #if CONFIG_DPCM_INTRA void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, diff --git a/av1/common/idct.h b/av1/common/idct.h index 55f0c6587..e1bda4b53 100644 --- a/av1/common/idct.h +++ b/av1/common/idct.h @@ -34,9 +34,7 @@ typedef struct INV_TXFM_PARAM { TX_SIZE tx_size; int eob; int lossless; -#if CONFIG_HIGHBITDEPTH int bd; -#endif } INV_TXFM_PARAM; typedef void (*transform_1d)(const tran_low_t *, tran_low_t *); @@ -69,7 +67,7 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd, int eob); void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, int blk_row, int blk_col, int eob); -#if CONFIG_HIGHBITDEPTH + void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd); void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride, @@ -83,7 +81,7 @@ void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride, int eob, int bd, TX_TYPE tx_type); void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, INV_TXFM_PARAM *inv_txfm_param); -#endif // CONFIG_HIGHBITDEPTH + #if CONFIG_DPCM_INTRA void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, TX_TYPE_1D tx_type, uint8_t *dest);