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
This commit is contained in:
Yi Luo 2017-06-26 16:36:15 -07:00
Родитель 784596d5f1
Коммит 5128109508
9 изменённых файлов: 70 добавлений и 73 удалений

Просмотреть файл

@ -390,7 +390,6 @@ if ((aom_config("CONFIG_AV1_ENCODER") eq "yes") || (aom_config("CONFIG_PVQ") eq
# #
# Inverse transform # Inverse transform
if (aom_config("CONFIG_AV1") eq "yes") { 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_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"; 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"; 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/; specialize qw/aom_highbd_idct4x4_16_add sse2/;
} }
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
} else { } else {
{ {
add_proto qw/void aom_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride"; add_proto qw/void aom_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";

Просмотреть файл

@ -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, void aom_highbd_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int bd) { int stride, int bd) {
/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds, /* 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; dest += dest_stride;
} }
} }
#endif // CONFIG_HIGHBITDEPTH

Просмотреть файл

@ -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_iadst8_c(const tran_low_t *input, tran_low_t *output);
void aom_iadst16_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_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_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); 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_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_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); 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, static INLINE uint16_t highbd_clip_pixel_add(uint16_t dest, tran_high_t trans,
int bd) { int bd) {

Просмотреть файл

@ -3499,7 +3499,6 @@ void idct32_8col(__m128i *in0, __m128i *in1) {
in1[15] = _mm_sub_epi16(stp1_0, stp1_31); in1[15] = _mm_sub_epi16(stp1_0, stp1_31);
} }
#if CONFIG_HIGHBITDEPTH
static INLINE __m128i clamp_high_sse2(__m128i value, int bd) { static INLINE __m128i clamp_high_sse2(__m128i value, int bd) {
__m128i ubounded, retval; __m128i ubounded, retval;
const __m128i zero = _mm_set1_epi16(0); 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

Просмотреть файл

@ -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_txfm1d_sse4.c
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm2d_sse4.c AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm2d_sse4.c
endif 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_txfm_utility_sse4.h
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_inv_txfm_sse4.c 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 AV1_COMMON_SRCS-$(HAVE_AVX2) += common/x86/highbd_inv_txfm_avx2.c
endif
ifneq ($(CONFIG_HIGHBITDEPTH),yes) ifneq ($(CONFIG_HIGHBITDEPTH),yes)
AV1_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iht4x4_add_neon.c AV1_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iht4x4_add_neon.c

Просмотреть файл

@ -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"; 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
#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_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_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_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_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_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_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";
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/;
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";
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/;
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";
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/;
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";
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/;
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";
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. # Encoder functions below this point.

Просмотреть файл

@ -737,6 +737,10 @@ typedef struct macroblockd {
#endif #endif
} MACROBLOCKD; } 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, static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
PARTITION_TYPE partition) { PARTITION_TYPE partition) {
if (partition == PARTITION_INVALID) if (partition == PARTITION_INVALID)

Просмотреть файл

@ -1456,7 +1456,6 @@ static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest,
} }
#endif // CONFIG_TX64X64 #endif // CONFIG_TX64X64
#if CONFIG_HIGHBITDEPTH
// idct // idct
void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride, void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
int eob, int bd) { 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, 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 stride, int eob, int bd, TX_TYPE tx_type,
int lossless) { int lossless) {
const int32_t *src = (const int32_t *)input;
if (lossless) { if (lossless) {
assert(tx_type == DCT_DCT); assert(tx_type == DCT_DCT);
av1_highbd_iwht4x4_add(input, dest, stride, eob, bd); 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 ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_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); bd);
break; break;
#if CONFIG_EXT_TX #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 FLIPADST_FLIPADST:
case ADST_FLIPADST: case ADST_FLIPADST:
case FLIPADST_ADST: 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); bd);
break; break;
// use the c version for anything including identity for now // 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 V_FLIPADST:
case H_FLIPADST: case H_FLIPADST:
case IDTX: case IDTX:
av1_inv_txfm2d_add_4x4_c(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_4x4_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
default: assert(0); break; 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, 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) { int stride, int eob, int bd, TX_TYPE tx_type) {
(void)eob; (void)eob;
av1_inv_txfm2d_add_4x8_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, const int32_t *src = (const int32_t *)input;
bd); 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, 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) { int stride, int eob, int bd, TX_TYPE tx_type) {
(void)eob; (void)eob;
av1_inv_txfm2d_add_8x4_c(input, CONVERT_TO_SHORTPTR(dest), stride, tx_type, const int32_t *src = (const int32_t *)input;
bd); 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, static void highbd_inv_txfm_add_8x16(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (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); 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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (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); 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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (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); 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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (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); 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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (void)eob;
const int32_t *src = (const int32_t *)input;
switch (tx_type) { switch (tx_type) {
case DCT_DCT: case DCT_DCT:
case ADST_DCT: case ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_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); bd);
break; break;
#if CONFIG_EXT_TX #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 FLIPADST_FLIPADST:
case ADST_FLIPADST: case ADST_FLIPADST:
case FLIPADST_ADST: 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); bd);
break; break;
// use the c version for anything including identity for now // 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 V_FLIPADST:
case H_FLIPADST: case H_FLIPADST:
case IDTX: case IDTX:
av1_inv_txfm2d_add_8x8_c(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_8x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
default: assert(0); 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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (void)eob;
const int32_t *src = (const int32_t *)input;
switch (tx_type) { switch (tx_type) {
case DCT_DCT: case DCT_DCT:
case ADST_DCT: case ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_ADST: case ADST_ADST:
av1_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_16x16(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
case FLIPADST_DCT: 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 FLIPADST_FLIPADST:
case ADST_FLIPADST: case ADST_FLIPADST:
case FLIPADST_ADST: case FLIPADST_ADST:
av1_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_16x16(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
// use the c version for anything including identity for now // use the c version for anything including identity for now
case V_DCT: 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 V_FLIPADST:
case H_FLIPADST: case H_FLIPADST:
case IDTX: 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); tx_type, bd);
break; break;
#endif // CONFIG_EXT_TX #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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (void)eob;
const int32_t *src = (const int32_t *)input;
switch (tx_type) { switch (tx_type) {
case DCT_DCT: case DCT_DCT:
case ADST_DCT: case ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_ADST: case ADST_ADST:
av1_inv_txfm2d_add_32x32(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_32x32(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
case FLIPADST_DCT: 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 FLIPADST_FLIPADST:
case ADST_FLIPADST: case ADST_FLIPADST:
case FLIPADST_ADST: case FLIPADST_ADST:
av1_inv_txfm2d_add_32x32(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_32x32(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type,
tx_type, bd); bd);
break; break;
// use the c version for anything including identity for now // use the c version for anything including identity for now
case V_DCT: 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 V_FLIPADST:
case H_FLIPADST: case H_FLIPADST:
case IDTX: 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); tx_type, bd);
break; break;
#endif // CONFIG_EXT_TX #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, int stride, int eob, int bd,
TX_TYPE tx_type) { TX_TYPE tx_type) {
(void)eob; (void)eob;
const int32_t *src = (const int32_t *)input;
switch (tx_type) { switch (tx_type) {
case DCT_DCT: case DCT_DCT:
av1_inv_txfm2d_add_64x64(input, CONVERT_TO_SHORTPTR(dest), stride, av1_inv_txfm2d_add_64x64(src, CONVERT_TO_SHORTPTR(dest), stride, DCT_DCT,
DCT_DCT, bd); bd);
break; break;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
case ADST_DCT: 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 // in a later change. This shouldn't impact performance since
// DCT_DCT is the only extended type currently allowed for 64x64, // DCT_DCT is the only extended type currently allowed for 64x64,
// as dictated by get_ext_tx_set_type in blockd.h. // 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); DCT_DCT, bd);
break; break;
case IDTX: 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_TX64X64
#endif // CONFIG_HIGHBITDEPTH
void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
INV_TXFM_PARAM *param) { INV_TXFM_PARAM *param) {
@ -1804,6 +1811,12 @@ static void init_inv_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size,
#endif #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, void av1_inverse_transform_block(const MACROBLOCKD *xd,
const tran_low_t *dqcoeff, TX_TYPE tx_type, const tran_low_t *dqcoeff, TX_TYPE tx_type,
TX_SIZE tx_size, uint8_t *dst, int stride, 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; INV_TXFM_PARAM inv_txfm_param;
init_inv_txfm_param(xd, tx_size, tx_type, eob, &inv_txfm_param); init_inv_txfm_param(xd, tx_size, tx_type, eob, &inv_txfm_param);
#if CONFIG_HIGHBITDEPTH const int is_hbd = get_bitdepth_data_path_index(xd);
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { inv_txfm_func[is_hbd](dqcoeff, dst, stride, &inv_txfm_param);
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
} }
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, 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); eob);
} }
#if CONFIG_HIGHBITDEPTH
void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
INV_TXFM_PARAM *inv_txfm_param) { INV_TXFM_PARAM *inv_txfm_param) {
const TX_TYPE tx_type = inv_txfm_param->tx_type; 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; default: assert(0 && "Invalid transform size"); break;
} }
} }
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_DPCM_INTRA #if CONFIG_DPCM_INTRA
void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,

Просмотреть файл

@ -34,9 +34,7 @@ typedef struct INV_TXFM_PARAM {
TX_SIZE tx_size; TX_SIZE tx_size;
int eob; int eob;
int lossless; int lossless;
#if CONFIG_HIGHBITDEPTH
int bd; int bd;
#endif
} INV_TXFM_PARAM; } INV_TXFM_PARAM;
typedef void (*transform_1d)(const tran_low_t *, tran_low_t *); 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); int eob);
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
int blk_row, int blk_col, int eob); 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, void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
int eob, int bd); int eob, int bd);
void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride, 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); 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, void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
INV_TXFM_PARAM *inv_txfm_param); INV_TXFM_PARAM *inv_txfm_param);
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_DPCM_INTRA #if CONFIG_DPCM_INTRA
void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
TX_TYPE_1D tx_type, uint8_t *dest); TX_TYPE_1D tx_type, uint8_t *dest);