diff options
author | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
commit | ec910d81405c736a4490383a250299a7837c2e64 (patch) | |
tree | 4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/av1/common | |
parent | 01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff) | |
download | UXP-ec910d81405c736a4490383a250299a7837c2e64.tar UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz UXP-ec910d81405c736a4490383a250299a7837c2e64.zip |
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/av1/common')
105 files changed, 31582 insertions, 14716 deletions
diff --git a/third_party/aom/av1/common/alloccommon.c b/third_party/aom/av1/common/alloccommon.c index c37f1ea50..fd635686f 100644 --- a/third_party/aom/av1/common/alloccommon.c +++ b/third_party/aom/av1/common/alloccommon.c @@ -19,9 +19,28 @@ #include "av1/common/entropymv.h" #include "av1/common/onyxc_int.h" +int av1_get_MBs(int width, int height) { + const int aligned_width = ALIGN_POWER_OF_TWO(width, 3); + const int aligned_height = ALIGN_POWER_OF_TWO(height, 3); + const int mi_cols = aligned_width >> MI_SIZE_LOG2; + const int mi_rows = aligned_height >> MI_SIZE_LOG2; + +#if CONFIG_CB4X4 + const int mb_cols = (mi_cols + 2) >> 2; + const int mb_rows = (mi_rows + 2) >> 2; +#else + const int mb_cols = (mi_cols + 1) >> 1; + const int mb_rows = (mi_rows + 1) >> 1; +#endif + return mb_rows * mb_cols; +} + void av1_set_mb_mi(AV1_COMMON *cm, int width, int height) { - // TODO(jingning): Fine tune the loop filter operations and bring this - // back to integer multiple of 4 for cb4x4. + // Ensure that the decoded width and height are both multiples of + // 8 luma pixels (note: this may only be a multiple of 4 chroma pixels if + // subsampling is used). + // This simplifies the implementation of various experiments, + // eg. cdef, which operates on units of 8x8 luma pixels. const int aligned_width = ALIGN_POWER_OF_TWO(width, 3); const int aligned_height = ALIGN_POWER_OF_TWO(height, 3); @@ -72,6 +91,36 @@ static void free_seg_map(AV1_COMMON *cm) { if (!cm->frame_parallel_decode) { cm->last_frame_seg_map = NULL; } + cm->seg_map_alloc_size = 0; +} + +static void free_scratch_buffers(AV1_COMMON *cm) { + (void)cm; +#if CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT + for (int i = 0; i < 4; ++i) { + if (cm->ncobmcaw_buf[i]) { + aom_free(cm->ncobmcaw_buf[i]); + cm->ncobmcaw_buf[i] = NULL; + } + } +#endif // CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT +} + +static int alloc_scratch_buffers(AV1_COMMON *cm) { + (void)cm; +#if CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT + // If not allocated already, allocate + if (!cm->ncobmcaw_buf[0] && !cm->ncobmcaw_buf[1] && !cm->ncobmcaw_buf[2] && + !cm->ncobmcaw_buf[3]) { + for (int i = 0; i < 4; ++i) { + CHECK_MEM_ERROR( + cm, cm->ncobmcaw_buf[i], + (uint8_t *)aom_memalign( + 16, (1 + CONFIG_HIGHBITDEPTH) * MAX_MB_PLANE * MAX_SB_SQUARE)); + } + } +#endif // CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT + return 0; } void av1_free_ref_frame_buffers(BufferPool *pool) { @@ -85,7 +134,14 @@ void av1_free_ref_frame_buffers(BufferPool *pool) { } aom_free(pool->frame_bufs[i].mvs); pool->frame_bufs[i].mvs = NULL; +#if CONFIG_MFMV + aom_free(pool->frame_bufs[i].tpl_mvs); + pool->frame_bufs[i].tpl_mvs = NULL; +#endif aom_free_frame_buffer(&pool->frame_bufs[i].buf); +#if CONFIG_HASH_ME + av1_hash_table_destroy(&pool->frame_bufs[i].hash_table); +#endif } } @@ -108,6 +164,33 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) { aom_free(cm->rst_internal.tmpbuf); CHECK_MEM_ERROR(cm, cm->rst_internal.tmpbuf, (int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE)); + +#if CONFIG_STRIPED_LOOP_RESTORATION + // Allocate internal storage for the loop restoration stripe boundary lines + for (p = 0; p < MAX_MB_PLANE; ++p) { + int w = p == 0 ? width : ROUND_POWER_OF_TWO(width, cm->subsampling_x); + int align_bits = 5; // align for efficiency + int stride = ALIGN_POWER_OF_TWO(w, align_bits); + int num_stripes = (height + 63) / 64; + // for each processing stripe: 2 lines above, 2 below + int buf_size = num_stripes * 2 * stride; + uint8_t *above_buf, *below_buf; + + aom_free(cm->rst_internal.stripe_boundary_above[p]); + aom_free(cm->rst_internal.stripe_boundary_below[p]); + +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) buf_size = buf_size * 2; +#endif + CHECK_MEM_ERROR(cm, above_buf, + (uint8_t *)aom_memalign(1 << align_bits, buf_size)); + CHECK_MEM_ERROR(cm, below_buf, + (uint8_t *)aom_memalign(1 << align_bits, buf_size)); + cm->rst_internal.stripe_boundary_above[p] = above_buf; + cm->rst_internal.stripe_boundary_below[p] = below_buf; + cm->rst_internal.stripe_boundary_stride[p] = stride; + } +#endif // CONFIG_STRIPED_LOOP_RESTORATION } void av1_free_restoration_buffers(AV1_COMMON *cm) { @@ -123,12 +206,14 @@ void av1_free_context_buffers(AV1_COMMON *cm) { int i; cm->free_mi(cm); free_seg_map(cm); + free_scratch_buffers(cm); for (i = 0; i < MAX_MB_PLANE; i++) { aom_free(cm->above_context[i]); cm->above_context[i] = NULL; } aom_free(cm->above_seg_context); cm->above_seg_context = NULL; + cm->above_context_alloc_cols = 0; #if CONFIG_VAR_TX aom_free(cm->above_txfm_context); cm->above_txfm_context = NULL; @@ -155,6 +240,7 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) { free_seg_map(cm); if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail; } + if (alloc_scratch_buffers(cm)) goto fail; if (cm->above_context_alloc_cols < cm->mi_cols) { // TODO(geza.lore): These are bigger than they need to be. diff --git a/third_party/aom/av1/common/alloccommon.h b/third_party/aom/av1/common/alloccommon.h index 51863cd04..0d420f825 100644 --- a/third_party/aom/av1/common/alloccommon.h +++ b/third_party/aom/av1/common/alloccommon.h @@ -37,6 +37,7 @@ int av1_alloc_state_buffers(struct AV1Common *cm, int width, int height); void av1_free_state_buffers(struct AV1Common *cm); void av1_set_mb_mi(struct AV1Common *cm, int width, int height); +int av1_get_MBs(int width, int height); void av1_swap_current_and_last_seg_map(struct AV1Common *cm); diff --git a/third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c b/third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c index 68184c510..b29228e43 100644 --- a/third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c +++ b/third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c @@ -148,13 +148,13 @@ void av1_iht4x4_16_add_neon(const tran_low_t *input, uint8_t *dest, TRANSPOSE4X4(&q8s16, &q9s16); - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; switch (tx_type) { - case 0: // idct_idct is not supported. Fall back to C + case DCT_DCT: // idct_idct is not supported. Fall back to C av1_iht4x4_16_add_c(input, dest, dest_stride, txfm_param); return; break; - case 1: // iadst_idct + case ADST_DCT: // iadst_idct // generate constants GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16); GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16); @@ -168,7 +168,7 @@ void av1_iht4x4_16_add_neon(const tran_low_t *input, uint8_t *dest, // then transform columns IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16); break; - case 2: // idct_iadst + case DCT_ADST: // idct_iadst // generate constantsyy GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16); GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16); @@ -182,7 +182,7 @@ void av1_iht4x4_16_add_neon(const tran_low_t *input, uint8_t *dest, // then transform columns IDCT4x4_1D(&d0s16, &d1s16, &d2s16, &q8s16, &q9s16); break; - case 3: // iadst_iadst + case ADST_ADST: // iadst_iadst // generate constants GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16); diff --git a/third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c b/third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c index a98449589..4cd43a99d 100644 --- a/third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c +++ b/third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c @@ -478,13 +478,13 @@ void av1_iht8x8_64_add_neon(const tran_low_t *input, uint8_t *dest, TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16, &q15s16); - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; switch (tx_type) { - case 0: // idct_idct is not supported. Fall back to C + case DCT_DCT: // idct_idct is not supported. Fall back to C av1_iht8x8_64_add_c(input, dest, dest_stride, txfm_param); return; break; - case 1: // iadst_idct + case ADST_DCT: // iadst_idct // generate IDCT constants // GENERATE_IDCT_CONSTANTS @@ -503,7 +503,7 @@ void av1_iht8x8_64_add_neon(const tran_low_t *input, uint8_t *dest, IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16, &q15s16); break; - case 2: // idct_iadst + case DCT_ADST: // idct_iadst // generate IADST constants // GENERATE_IADST_CONSTANTS @@ -522,7 +522,7 @@ void av1_iht8x8_64_add_neon(const tran_low_t *input, uint8_t *dest, IDCT8x8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16, &q15s16); break; - case 3: // iadst_iadst + case ADST_ADST: // iadst_iadst // generate IADST constants // GENERATE_IADST_CONSTANTS diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d.c b/third_party/aom/av1/common/av1_fwd_txfm1d.c index cfe274185..c9c7f437e 100644 --- a/third_party/aom/av1/common/av1_fwd_txfm1d.c +++ b/third_party/aom/av1/common/av1_fwd_txfm1d.c @@ -1547,6 +1547,16 @@ void av1_fidentity32_c(const int32_t *input, int32_t *output, for (int i = 0; i < 32; ++i) output[i] = input[i] * 4; range_check(0, input, output, 32, stage_range[0]); } + +#if CONFIG_TX64X64 +void av1_fidentity64_c(const int32_t *input, int32_t *output, + const int8_t *cos_bit, const int8_t *stage_range) { + (void)cos_bit; + for (int i = 0; i < 64; ++i) + output[i] = (int32_t)dct_const_round_shift(input[i] * 4 * Sqrt2); + range_check(0, input, output, 64, stage_range[0]); +} +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX #if CONFIG_TX64X64 diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d.h b/third_party/aom/av1/common/av1_fwd_txfm1d.h index f6419303a..f880239f7 100644 --- a/third_party/aom/av1/common/av1_fwd_txfm1d.h +++ b/third_party/aom/av1/common/av1_fwd_txfm1d.h @@ -26,8 +26,10 @@ void av1_fdct16_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); void av1_fdct32_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#if CONFIG_TX64X64 void av1_fdct64_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#endif // CONFIG_TX64X64 void av1_fadst4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); @@ -46,6 +48,10 @@ void av1_fidentity16_c(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); void av1_fidentity32_c(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#if CONFIG_TX64X64 +void av1_fidentity64_c(const int32_t *input, int32_t *output, + const int8_t *cos_bit, const int8_t *stage_range); +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX #ifdef __cplusplus diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h b/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h index 60026da21..f2ed93151 100644 --- a/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h +++ b/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h @@ -19,11 +19,11 @@ static const int8_t fwd_shift_4[3] = { 2, 0, 0 }; // stage range -static const int8_t fwd_stage_range_col_dct_4[4] = { 15, 16, 17, 17 }; -static const int8_t fwd_stage_range_row_dct_4[4] = { 17, 18, 18, 18 }; -static const int8_t fwd_stage_range_col_adst_4[6] = { 15, 15, 16, 17, 17, 17 }; -static const int8_t fwd_stage_range_row_adst_4[6] = { 17, 17, 17, 18, 18, 18 }; -static const int8_t fwd_stage_range_idx_4[1] = { 18 }; +static const int8_t fwd_stage_range_col_dct_4[4] = { 0, 1, 2, 2 }; +static const int8_t fwd_stage_range_row_dct_4[4] = { 2, 3, 3, 3 }; +static const int8_t fwd_stage_range_col_adst_4[6] = { 0, 0, 1, 2, 2, 2 }; +static const int8_t fwd_stage_range_row_adst_4[6] = { 2, 2, 2, 3, 3, 3 }; +static const int8_t fwd_stage_range_idx_4[1] = { 0 }; // cos bit static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 }; @@ -36,13 +36,11 @@ static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 }; static const int8_t fwd_shift_8[3] = { 2, -1, 0 }; // stage range -static const int8_t fwd_stage_range_col_dct_8[6] = { 15, 16, 17, 18, 18, 18 }; -static const int8_t fwd_stage_range_row_dct_8[6] = { 17, 18, 19, 19, 19, 19 }; -static const int8_t fwd_stage_range_col_adst_8[8] = { 15, 15, 16, 17, - 17, 18, 18, 18 }; -static const int8_t fwd_stage_range_row_adst_8[8] = { 17, 17, 17, 18, - 18, 19, 19, 19 }; -static const int8_t fwd_stage_range_idx_8[1] = { 19 }; +static const int8_t fwd_stage_range_col_dct_8[6] = { 0, 1, 2, 3, 3, 3 }; +static const int8_t fwd_stage_range_row_dct_8[6] = { 3, 4, 5, 5, 5, 5 }; +static const int8_t fwd_stage_range_col_adst_8[8] = { 0, 0, 1, 2, 2, 3, 3, 3 }; +static const int8_t fwd_stage_range_row_adst_8[8] = { 3, 3, 3, 4, 4, 5, 5, 5 }; +static const int8_t fwd_stage_range_idx_8[1] = { 0 }; // cos bit static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 }; @@ -59,15 +57,14 @@ static const int8_t fwd_cos_bit_row_adst_8[8] = { static const int8_t fwd_shift_16[3] = { 2, -2, 0 }; // stage range -static const int8_t fwd_stage_range_col_dct_16[8] = { 15, 16, 17, 18, - 19, 19, 19, 19 }; -static const int8_t fwd_stage_range_row_dct_16[8] = { 17, 18, 19, 20, - 20, 20, 20, 20 }; -static const int8_t fwd_stage_range_col_adst_16[10] = { 15, 15, 16, 17, 17, - 18, 18, 19, 19, 19 }; -static const int8_t fwd_stage_range_row_adst_16[10] = { 17, 17, 17, 18, 18, - 19, 19, 20, 20, 20 }; -static const int8_t fwd_stage_range_idx_16[1] = { 20 }; +static const int8_t fwd_stage_range_col_dct_16[8] = { 0, 1, 2, 3, 4, 4, 4, 4 }; +static const int8_t fwd_stage_range_row_dct_16[8] = { 4, 5, 6, 7, 7, 7, 7, 7 }; +static const int8_t fwd_stage_range_col_adst_16[10] = { 0, 0, 1, 2, 2, + 3, 3, 4, 4, 4 }; +static const int8_t fwd_stage_range_row_adst_16[10] = { + 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, +}; +static const int8_t fwd_stage_range_idx_16[1] = { 0 }; // cos bit static const int8_t fwd_cos_bit_col_dct_16[8] = { @@ -86,17 +83,15 @@ static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12, static const int8_t fwd_shift_32[3] = { 2, -4, 0 }; // stage range -static const int8_t fwd_stage_range_col_dct_32[10] = { 15, 16, 17, 18, 19, - 20, 20, 20, 20, 20 }; -static const int8_t fwd_stage_range_row_dct_32[10] = { 16, 17, 18, 19, 20, - 20, 20, 20, 20, 20 }; -static const int8_t fwd_stage_range_col_adst_32[12] = { - 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20 -}; -static const int8_t fwd_stage_range_row_adst_32[12] = { - 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20 -}; -static const int8_t fwd_stage_range_idx_32[1] = { 20 }; +static const int8_t fwd_stage_range_col_dct_32[10] = { 0, 1, 2, 3, 4, + 5, 5, 5, 5, 5 }; +static const int8_t fwd_stage_range_row_dct_32[10] = { 5, 6, 7, 8, 9, + 9, 9, 9, 9, 9 }; +static const int8_t fwd_stage_range_col_adst_32[12] = { 0, 0, 1, 2, 2, 3, + 3, 4, 4, 5, 5, 5 }; +static const int8_t fwd_stage_range_row_adst_32[12] = { 5, 5, 5, 6, 6, 7, + 7, 8, 8, 9, 9, 9 }; +static const int8_t fwd_stage_range_idx_32[1] = { 0 }; // cos bit static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12, @@ -113,11 +108,11 @@ static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12, static const int8_t fwd_shift_64[3] = { 0, -2, -2 }; // stage range -static const int8_t fwd_stage_range_col_dct_64[12] = { 13, 14, 15, 16, 17, 18, - 19, 19, 19, 19, 19, 19 }; -static const int8_t fwd_stage_range_row_dct_64[12] = { 17, 18, 19, 20, 21, 22, - 22, 22, 22, 22, 22, 22 }; -static const int8_t fwd_stage_range_idx_64[1] = { 22 }; +static const int8_t fwd_stage_range_col_dct_64[12] = { 0, 1, 2, 3, 4, 5, + 6, 6, 6, 6, 6, 6 }; +static const int8_t fwd_stage_range_row_dct_64[12] = { 6, 7, 8, 9, 10, 11, + 11, 11, 11, 11, 11, 11 }; +static const int8_t fwd_stage_range_idx_64[1] = { 0 }; // cos bit static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14, diff --git a/third_party/aom/av1/common/av1_fwd_txfm2d.c b/third_party/aom/av1/common/av1_fwd_txfm2d.c index c124f3af7..740c63322 100644 --- a/third_party/aom/av1/common/av1_fwd_txfm2d.c +++ b/third_party/aom/av1/common/av1_fwd_txfm2d.c @@ -24,6 +24,9 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) { case TXFM_TYPE_DCT8: return av1_fdct8_new; case TXFM_TYPE_DCT16: return av1_fdct16_new; case TXFM_TYPE_DCT32: return av1_fdct32_new; +#if CONFIG_TX64X64 + case TXFM_TYPE_DCT64: return av1_fdct64_new; +#endif // CONFIG_TX64X64 case TXFM_TYPE_ADST4: return av1_fadst4_new; case TXFM_TYPE_ADST8: return av1_fadst8_new; case TXFM_TYPE_ADST16: return av1_fadst16_new; @@ -33,14 +36,42 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) { case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c; case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c; case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c; +#if CONFIG_TX64X64 + case TXFM_TYPE_IDENTITY64: return av1_fidentity64_c; +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX default: assert(0); return NULL; } } +void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row, + const TXFM_2D_FLIP_CFG *cfg, int bd) { + // Note when assigning txfm_size_col, we use the txfm_size from the + // row configuration and vice versa. This is intentionally done to + // accurately perform rectangular transforms. When the transform is + // rectangular, the number of columns will be the same as the + // txfm_size stored in the row cfg struct. It will make no difference + // for square transforms. + const int txfm_size_col = cfg->row_cfg->txfm_size; + const int txfm_size_row = cfg->col_cfg->txfm_size; + // Take the shift from the larger dimension in the rectangular case. + const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift + : cfg->col_cfg->shift; + // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning + for (int i = 0; i < cfg->col_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) { + stage_range_col[i] = cfg->col_cfg->stage_range[i] + shift[0] + bd + 1; + } + + // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning + for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) { + stage_range_row[i] = + cfg->row_cfg->stage_range[i] + shift[0] + shift[1] + bd + 1; + } +} + static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, const int stride, const TXFM_2D_FLIP_CFG *cfg, - int32_t *buf) { + int32_t *buf, int bd) { int c, r; // Note when assigning txfm_size_col, we use the txfm_size from the // row configuration and vice versa. This is intentionally done to @@ -53,8 +84,12 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, // Take the shift from the larger dimension in the rectangular case. const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift : cfg->col_cfg->shift; - const int8_t *stage_range_col = cfg->col_cfg->stage_range; - const int8_t *stage_range_row = cfg->row_cfg->stage_range; + int8_t stage_range_col[MAX_TXFM_STAGE_NUM]; + int8_t stage_range_row[MAX_TXFM_STAGE_NUM]; + assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM); + assert(cfg->row_cfg->stage_num <= MAX_TXFM_STAGE_NUM); + av1_gen_fwd_stage_range(stage_range_col, stage_range_row, cfg, bd); + const int8_t *cos_bit_col = cfg->col_cfg->cos_bit; const int8_t *cos_bit_row = cfg->row_cfg->cos_bit; const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type); @@ -108,93 +143,146 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, } void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int32_t txfm_buf[4 * 8]; + int16_t rinput[4 * 8]; + TX_SIZE tx_size = TX_4X8; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int16(rinput, rw, input, stride, w, h); + TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); + fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd); + transpose_int32(output, w, txfm_buf, rw, rw, rh); +#else int32_t txfm_buf[4 * 8]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X8); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); +#endif } void av1_fwd_txfm2d_8x4_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[8 * 4]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X4); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int32_t txfm_buf[8 * 16]; + int16_t rinput[8 * 16]; + TX_SIZE tx_size = TX_8X16; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int16(rinput, rw, input, stride, w, h); + TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); + fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd); + transpose_int32(output, w, txfm_buf, rw, rw, rh); +#else int32_t txfm_buf[8 * 16]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X16); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); +#endif } void av1_fwd_txfm2d_16x8_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[16 * 8]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X8); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int32_t txfm_buf[16 * 32]; + int16_t rinput[16 * 32]; + TX_SIZE tx_size = TX_16X32; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int16(rinput, rw, input, stride, w, h); + TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); + fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd); + transpose_int32(output, w, txfm_buf, rw, rw, rh); +#else int32_t txfm_buf[16 * 32]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X32); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); +#endif } void av1_fwd_txfm2d_32x16_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[32 * 16]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X16); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[4 * 4]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X4); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[8 * 8]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X8); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[16 * 16]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X16); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[32 * 32]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } +#if CONFIG_TX64X64 void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride, - int tx_type, int bd) { + TX_TYPE tx_type, int bd) { int32_t txfm_buf[64 * 64]; TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type); - (void)bd; - fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); +} + +void av1_fwd_txfm2d_32x64_c(const int16_t *input, int32_t *output, int stride, + TX_TYPE tx_type, int bd) { + int32_t txfm_buf[32 * 64]; + TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_32x64_cfg(tx_type); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); } +void av1_fwd_txfm2d_64x32_c(const int16_t *input, int32_t *output, int stride, + TX_TYPE tx_type, int bd) { + int32_t txfm_buf[64 * 32]; + TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x32_cfg(tx_type); + fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); +} +#endif // CONFIG_TX64X64 + static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = { // DCT { @@ -261,19 +349,52 @@ static const TXFM_1D_CFG *fwd_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = { #endif // CONFIG_EXT_TX }; -TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(int tx_type, int tx_size) { +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) { TXFM_2D_FLIP_CFG cfg; set_flip_cfg(tx_type, &cfg); - const int tx_type_col = vtx_tab[tx_type]; - const int tx_type_row = htx_tab[tx_type]; - const int tx_size_col = txsize_vert_map[tx_size]; - const int tx_size_row = txsize_horz_map[tx_size]; + const TX_TYPE_1D tx_type_col = vtx_tab[tx_type]; + const TX_TYPE_1D tx_type_row = htx_tab[tx_type]; + const TX_SIZE tx_size_col = txsize_vert_map[tx_size]; + const TX_SIZE tx_size_row = txsize_horz_map[tx_size]; cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col]; cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size_row]; return cfg; } -TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type) { +#if CONFIG_TX64X64 +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type) { + TXFM_2D_FLIP_CFG cfg; + const TX_TYPE_1D tx_type_row = htx_tab[tx_type]; + const TX_SIZE tx_size_row = txsize_horz_map[TX_32X64]; + switch (tx_type) { + case DCT_DCT: + cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64; + cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size_row]; + cfg.ud_flip = 0; + cfg.lr_flip = 0; + break; + default: assert(0); + } + return cfg; +} + +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type) { + TXFM_2D_FLIP_CFG cfg; + const TX_TYPE_1D tx_type_col = vtx_tab[tx_type]; + const TX_SIZE tx_size_col = txsize_vert_map[TX_64X32]; + switch (tx_type) { + case DCT_DCT: + cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col]; + cfg.row_cfg = &fwd_txfm_1d_row_cfg_dct_64; + cfg.ud_flip = 0; + cfg.lr_flip = 0; + break; + default: assert(0); + } + return cfg; +} + +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(TX_TYPE tx_type) { TXFM_2D_FLIP_CFG cfg; switch (tx_type) { case DCT_DCT: @@ -289,3 +410,4 @@ TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type) { } return cfg; } +#endif // CONFIG_TX64X64 diff --git a/third_party/aom/av1/common/av1_inv_txfm1d.c b/third_party/aom/av1/common/av1_inv_txfm1d.c index 3399b7cb9..51f4b6362 100644 --- a/third_party/aom/av1/common/av1_inv_txfm1d.c +++ b/third_party/aom/av1/common/av1_inv_txfm1d.c @@ -19,24 +19,40 @@ void range_check_func(int32_t stage, const int32_t *input, const int32_t *buf, const int64_t maxValue = (1LL << (bit - 1)) - 1; const int64_t minValue = -(1LL << (bit - 1)); + int in_range = 1; + for (int i = 0; i < size; ++i) { if (buf[i] < minValue || buf[i] > maxValue) { - fprintf(stderr, "Error: coeffs contain out-of-range values\n"); - fprintf(stderr, "stage: %d\n", stage); - fprintf(stderr, "node: %d\n", i); - fprintf(stderr, "allowed range: [%" PRId64 ";%" PRId64 "]\n", minValue, - maxValue); - fprintf(stderr, "coeffs: "); - - fprintf(stderr, "["); - for (int j = 0; j < size; j++) { - if (j > 0) fprintf(stderr, ", "); - fprintf(stderr, "%d", input[j]); - } - fprintf(stderr, "]\n"); - assert(0); + in_range = 0; + } + } + + if (!in_range) { + fprintf(stderr, "Error: coeffs contain out-of-range values\n"); + fprintf(stderr, "stage: %d\n", stage); + fprintf(stderr, "allowed range: [%" PRId64 ";%" PRId64 "]\n", minValue, + maxValue); + + fprintf(stderr, "coeffs: "); + + fprintf(stderr, "["); + for (int j = 0; j < size; j++) { + if (j > 0) fprintf(stderr, ", "); + fprintf(stderr, "%d", input[j]); + } + fprintf(stderr, "]\n"); + + fprintf(stderr, " buf: "); + + fprintf(stderr, "["); + for (int j = 0; j < size; j++) { + if (j > 0) fprintf(stderr, ", "); + fprintf(stderr, "%d", buf[j]); } + fprintf(stderr, "]\n\n"); } + + assert(in_range); } #define range_check(stage, input, buf, size, bit) \ @@ -1577,6 +1593,16 @@ void av1_iidentity32_c(const int32_t *input, int32_t *output, for (int i = 0; i < 32; ++i) output[i] = input[i] * 4; range_check(0, input, output, 32, stage_range[0]); } + +#if CONFIG_TX64X64 +void av1_iidentity64_c(const int32_t *input, int32_t *output, + const int8_t *cos_bit, const int8_t *stage_range) { + (void)cos_bit; + for (int i = 0; i < 64; ++i) + output[i] = (int32_t)dct_const_round_shift(input[i] * 4 * Sqrt2); + range_check(0, input, output, 64, stage_range[0]); +} +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX #if CONFIG_TX64X64 diff --git a/third_party/aom/av1/common/av1_inv_txfm1d.h b/third_party/aom/av1/common/av1_inv_txfm1d.h index 037a3c6bc..8996f7c9d 100644 --- a/third_party/aom/av1/common/av1_inv_txfm1d.h +++ b/third_party/aom/av1/common/av1_inv_txfm1d.h @@ -26,8 +26,10 @@ void av1_idct16_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); void av1_idct32_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#if CONFIG_TX64X64 void av1_idct64_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#endif // CONFIG_TX64X64 void av1_iadst4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); @@ -46,6 +48,10 @@ void av1_iidentity16_c(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); void av1_iidentity32_c(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); +#if CONFIG_TX64X64 +void av1_iidentity64_c(const int32_t *input, int32_t *output, + const int8_t *cos_bit, const int8_t *stage_range); +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX #ifdef __cplusplus diff --git a/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h b/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h index f30f91576..8bcf84e05 100644 --- a/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h +++ b/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h @@ -13,16 +13,31 @@ #define AV1_INV_TXFM2D_CFG_H_ #include "av1/common/av1_inv_txfm1d.h" +// sum of fwd_shift_## +#if CONFIG_CHROMA_2X2 +#if CONFIG_TX64X64 +static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2, -4 }; +#else // CONFIG_TX64X64 +static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2 }; +#endif // CONFIG_TX64X64 +#else // CONFIG_CHROMA_2X2 +#if CONFIG_TX64X64 +static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2, -4 }; +#else // CONFIG_TX64X64 +static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2 }; +#endif // CONFIG_TX64X64 +#endif // CONFIG_CHROMA_2X2 + // ---------------- 4x4 1D config ----------------------- // shift static const int8_t inv_shift_4[2] = { 0, -4 }; // stage range -static const int8_t inv_stage_range_col_dct_4[4] = { 18, 18, 17, 17 }; -static const int8_t inv_stage_range_row_dct_4[4] = { 18, 18, 18, 18 }; -static const int8_t inv_stage_range_col_adst_4[6] = { 18, 18, 18, 18, 17, 17 }; -static const int8_t inv_stage_range_row_adst_4[6] = { 18, 18, 18, 18, 18, 18 }; -static const int8_t inv_stage_range_idx_4[1] = { 18 }; +static const int8_t inv_stage_range_col_dct_4[4] = { 3, 3, 2, 2 }; +static const int8_t inv_stage_range_row_dct_4[4] = { 3, 3, 3, 3 }; +static const int8_t inv_stage_range_col_adst_4[6] = { 3, 3, 3, 3, 2, 2 }; +static const int8_t inv_stage_range_row_adst_4[6] = { 3, 3, 3, 3, 3, 3 }; +static const int8_t inv_stage_range_idx_4[1] = { 0 }; // cos bit static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 }; @@ -35,13 +50,11 @@ static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 }; static const int8_t inv_shift_8[2] = { 0, -5 }; // stage range -static const int8_t inv_stage_range_col_dct_8[6] = { 19, 19, 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_dct_8[6] = { 19, 19, 19, 19, 19, 19 }; -static const int8_t inv_stage_range_col_adst_8[8] = { 19, 19, 19, 19, - 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_adst_8[8] = { 19, 19, 19, 19, - 19, 19, 19, 19 }; -static const int8_t inv_stage_range_idx_8[1] = { 19 }; +static const int8_t inv_stage_range_col_dct_8[6] = { 5, 5, 5, 5, 4, 4 }; +static const int8_t inv_stage_range_row_dct_8[6] = { 5, 5, 5, 5, 5, 5 }; +static const int8_t inv_stage_range_col_adst_8[8] = { 5, 5, 5, 5, 5, 5, 4, 4 }; +static const int8_t inv_stage_range_row_adst_8[8] = { 5, 5, 5, 5, 5, 5, 5, 5 }; +static const int8_t inv_stage_range_idx_8[1] = { 0 }; // cos bit static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 }; @@ -58,15 +71,13 @@ static const int8_t inv_cos_bit_row_adst_8[8] = { static const int8_t inv_shift_16[2] = { -1, -5 }; // stage range -static const int8_t inv_stage_range_col_dct_16[8] = { 19, 19, 19, 19, - 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_dct_16[8] = { 20, 20, 20, 20, - 20, 20, 20, 20 }; -static const int8_t inv_stage_range_col_adst_16[10] = { 19, 19, 19, 19, 19, - 19, 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_adst_16[10] = { 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20 }; -static const int8_t inv_stage_range_idx_16[1] = { 20 }; +static const int8_t inv_stage_range_col_dct_16[8] = { 7, 7, 7, 7, 7, 7, 6, 6 }; +static const int8_t inv_stage_range_row_dct_16[8] = { 7, 7, 7, 7, 7, 7, 7, 7 }; +static const int8_t inv_stage_range_col_adst_16[10] = { 7, 7, 7, 7, 7, + 7, 7, 7, 6, 6 }; +static const int8_t inv_stage_range_row_adst_16[10] = { 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7 }; +static const int8_t inv_stage_range_idx_16[1] = { 0 }; // cos bit static const int8_t inv_cos_bit_col_dct_16[8] = { @@ -85,17 +96,15 @@ static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12, static const int8_t inv_shift_32[2] = { -1, -5 }; // stage range -static const int8_t inv_stage_range_col_dct_32[10] = { 19, 19, 19, 19, 19, - 19, 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_dct_32[10] = { 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20 }; -static const int8_t inv_stage_range_col_adst_32[12] = { - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18 -}; -static const int8_t inv_stage_range_row_adst_32[12] = { - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 -}; -static const int8_t inv_stage_range_idx_32[1] = { 20 }; +static const int8_t inv_stage_range_col_dct_32[10] = { 9, 9, 9, 9, 9, + 9, 9, 9, 8, 8 }; +static const int8_t inv_stage_range_row_dct_32[10] = { 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9 }; +static const int8_t inv_stage_range_col_adst_32[12] = { 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 8, 8 }; +static const int8_t inv_stage_range_row_adst_32[12] = { 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9 }; +static const int8_t inv_stage_range_idx_32[1] = { 0 }; // cos bit static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13, @@ -109,14 +118,15 @@ static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12, // ---------------- 64x64 1D constants ----------------------- // shift -static const int8_t inv_shift_64[2] = { -1, -7 }; +static const int8_t inv_shift_64[2] = { -1, -5 }; // stage range -static const int8_t inv_stage_range_col_dct_64[12] = { 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 18, 18 }; -static const int8_t inv_stage_range_row_dct_64[12] = { 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20 }; -static const int8_t inv_stage_range_idx_64[1] = { 20 }; +static const int8_t inv_stage_range_col_dct_64[12] = { 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 10, 10 }; +static const int8_t inv_stage_range_row_dct_64[12] = { 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11 }; + +static const int8_t inv_stage_range_idx_64[1] = { 0 }; // cos bit static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13, @@ -126,9 +136,8 @@ static const int8_t inv_cos_bit_row_dct_64[12] = { 12, 12, 12, 12, 12, 12, // ---------------- row config inv_dct_4 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = { - 4, // .txfm_size - 4, // .stage_num - // 0, // .log_scale + 4, // .txfm_size + 4, // .stage_num inv_shift_4, // .shift inv_stage_range_row_dct_4, // .stage_range inv_cos_bit_row_dct_4, // .cos_bit @@ -137,9 +146,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = { // ---------------- row config inv_dct_8 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = { - 8, // .txfm_size - 6, // .stage_num - // 0, // .log_scale + 8, // .txfm_size + 6, // .stage_num inv_shift_8, // .shift inv_stage_range_row_dct_8, // .stage_range inv_cos_bit_row_dct_8, // .cos_bit_ @@ -147,9 +155,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = { }; // ---------------- row config inv_dct_16 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = { - 16, // .txfm_size - 8, // .stage_num - // 0, // .log_scale + 16, // .txfm_size + 8, // .stage_num inv_shift_16, // .shift inv_stage_range_row_dct_16, // .stage_range inv_cos_bit_row_dct_16, // .cos_bit @@ -158,15 +165,15 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = { // ---------------- row config inv_dct_32 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_32 = { - 32, // .txfm_size - 10, // .stage_num - // 1, // .log_scale + 32, // .txfm_size + 10, // .stage_num inv_shift_32, // .shift inv_stage_range_row_dct_32, // .stage_range inv_cos_bit_row_dct_32, // .cos_bit_row TXFM_TYPE_DCT32 // .txfm_type }; +#if CONFIG_TX64X64 // ---------------- row config inv_dct_64 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = { 64, // .txfm_size @@ -176,12 +183,12 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = { inv_cos_bit_row_dct_64, // .cos_bit TXFM_TYPE_DCT64, // .txfm_type_col }; +#endif // CONFIG_TX64X64 // ---------------- row config inv_adst_4 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = { - 4, // .txfm_size - 6, // .stage_num - // 0, // .log_scale + 4, // .txfm_size + 6, // .stage_num inv_shift_4, // .shift inv_stage_range_row_adst_4, // .stage_range inv_cos_bit_row_adst_4, // .cos_bit @@ -190,9 +197,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = { // ---------------- row config inv_adst_8 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = { - 8, // .txfm_size - 8, // .stage_num - // 0, // .log_scale + 8, // .txfm_size + 8, // .stage_num inv_shift_8, // .shift inv_stage_range_row_adst_8, // .stage_range inv_cos_bit_row_adst_8, // .cos_bit @@ -201,9 +207,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = { // ---------------- row config inv_adst_16 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = { - 16, // .txfm_size - 10, // .stage_num - // 0, // .log_scale + 16, // .txfm_size + 10, // .stage_num inv_shift_16, // .shift inv_stage_range_row_adst_16, // .stage_range inv_cos_bit_row_adst_16, // .cos_bit @@ -212,9 +217,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = { // ---------------- row config inv_adst_32 ---------------- static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = { - 32, // .txfm_size - 12, // .stage_num - // 1, // .log_scale + 32, // .txfm_size + 12, // .stage_num inv_shift_32, // .shift inv_stage_range_row_adst_32, // .stage_range inv_cos_bit_row_adst_32, // .cos_bit @@ -223,9 +227,8 @@ static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = { // ---------------- col config inv_dct_4 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = { - 4, // .txfm_size - 4, // .stage_num - // 0, // .log_scale + 4, // .txfm_size + 4, // .stage_num inv_shift_4, // .shift inv_stage_range_col_dct_4, // .stage_range inv_cos_bit_col_dct_4, // .cos_bit @@ -234,9 +237,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = { // ---------------- col config inv_dct_8 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = { - 8, // .txfm_size - 6, // .stage_num - // 0, // .log_scale + 8, // .txfm_size + 6, // .stage_num inv_shift_8, // .shift inv_stage_range_col_dct_8, // .stage_range inv_cos_bit_col_dct_8, // .cos_bit_ @@ -244,9 +246,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = { }; // ---------------- col config inv_dct_16 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = { - 16, // .txfm_size - 8, // .stage_num - // 0, // .log_scale + 16, // .txfm_size + 8, // .stage_num inv_shift_16, // .shift inv_stage_range_col_dct_16, // .stage_range inv_cos_bit_col_dct_16, // .cos_bit @@ -255,9 +256,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = { // ---------------- col config inv_dct_32 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_32 = { - 32, // .txfm_size - 10, // .stage_num - // 1, // .log_scale + 32, // .txfm_size + 10, // .stage_num inv_shift_32, // .shift inv_stage_range_col_dct_32, // .stage_range inv_cos_bit_col_dct_32, // .cos_bit_col @@ -276,9 +276,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_64 = { // ---------------- col config inv_adst_4 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = { - 4, // .txfm_size - 6, // .stage_num - // 0, // .log_scale + 4, // .txfm_size + 6, // .stage_num inv_shift_4, // .shift inv_stage_range_col_adst_4, // .stage_range inv_cos_bit_col_adst_4, // .cos_bit @@ -287,9 +286,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = { // ---------------- col config inv_adst_8 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = { - 8, // .txfm_size - 8, // .stage_num - // 0, // .log_scale + 8, // .txfm_size + 8, // .stage_num inv_shift_8, // .shift inv_stage_range_col_adst_8, // .stage_range inv_cos_bit_col_adst_8, // .cos_bit @@ -298,9 +296,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = { // ---------------- col config inv_adst_16 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = { - 16, // .txfm_size - 10, // .stage_num - // 0, // .log_scale + 16, // .txfm_size + 10, // .stage_num inv_shift_16, // .shift inv_stage_range_col_adst_16, // .stage_range inv_cos_bit_col_adst_16, // .cos_bit @@ -309,9 +306,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = { // ---------------- col config inv_adst_32 ---------------- static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = { - 32, // .txfm_size - 12, // .stage_num - // 1, // .log_scale + 32, // .txfm_size + 12, // .stage_num inv_shift_32, // .shift inv_stage_range_col_adst_32, // .stage_range inv_cos_bit_col_adst_32, // .cos_bit @@ -322,9 +318,8 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = { // identity does not need to differentiate between row and col // ---------------- row/col config inv_identity_4 ---------- static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = { - 4, // .txfm_size - 1, // .stage_num - // 0, // .log_scale + 4, // .txfm_size + 1, // .stage_num inv_shift_4, // .shift inv_stage_range_idx_4, // .stage_range NULL, // .cos_bit @@ -333,9 +328,8 @@ static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = { // ---------------- row/col config inv_identity_8 ---------------- static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = { - 8, // .txfm_size - 1, // .stage_num - // 0, // .log_scale + 8, // .txfm_size + 1, // .stage_num inv_shift_8, // .shift inv_stage_range_idx_8, // .stage_range NULL, // .cos_bit @@ -344,9 +338,8 @@ static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = { // ---------------- row/col config inv_identity_16 ---------------- static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = { - 16, // .txfm_size - 1, // .stage_num - // 0, // .log_scale + 16, // .txfm_size + 1, // .stage_num inv_shift_16, // .shift inv_stage_range_idx_16, // .stage_range NULL, // .cos_bit @@ -355,13 +348,24 @@ static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = { // ---------------- row/col config inv_identity_32 ---------------- static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = { - 32, // .txfm_size - 1, // .stage_num - // 1, // .log_scale + 32, // .txfm_size + 1, // .stage_num inv_shift_32, // .shift inv_stage_range_idx_32, // .stage_range NULL, // .cos_bit TXFM_TYPE_IDENTITY32, // .txfm_type }; + +#if CONFIG_TX64X64 +// ---------------- row/col config inv_identity_32 ---------------- +static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_64 = { + 64, // .txfm_size + 1, // .stage_num + inv_shift_64, // .shift + inv_stage_range_idx_64, // .stage_range + NULL, // .cos_bit + TXFM_TYPE_IDENTITY64, // .txfm_type +}; +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX #endif // AV1_INV_TXFM2D_CFG_H_ diff --git a/third_party/aom/av1/common/av1_inv_txfm2d.c b/third_party/aom/av1/common/av1_inv_txfm2d.c index 58845f19b..031d11b40 100644 --- a/third_party/aom/av1/common/av1_inv_txfm2d.c +++ b/third_party/aom/av1/common/av1_inv_txfm2d.c @@ -22,6 +22,9 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) { case TXFM_TYPE_DCT8: return av1_idct8_new; case TXFM_TYPE_DCT16: return av1_idct16_new; case TXFM_TYPE_DCT32: return av1_idct32_new; +#if CONFIG_TX64X64 + case TXFM_TYPE_DCT64: return av1_idct64_new; +#endif // CONFIG_TX64X64 case TXFM_TYPE_ADST4: return av1_iadst4_new; case TXFM_TYPE_ADST8: return av1_iadst8_new; case TXFM_TYPE_ADST16: return av1_iadst16_new; @@ -31,6 +34,9 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) { case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c; case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c; case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c; +#if CONFIG_TX64X64 + case TXFM_TYPE_IDENTITY64: return av1_iidentity64_c; +#endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX default: assert(0); return NULL; } @@ -43,14 +49,22 @@ static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = { NULL, #endif &inv_txfm_1d_col_cfg_dct_4, &inv_txfm_1d_col_cfg_dct_8, - &inv_txfm_1d_col_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_32 }, + &inv_txfm_1d_col_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_32, +#if CONFIG_TX64X64 + &inv_txfm_1d_col_cfg_dct_64 +#endif // CONFIG_TX64X64 + }, // ADST { #if CONFIG_CHROMA_2X2 NULL, #endif &inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8, - &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 }, + &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32, +#if CONFIG_TX64X64 + NULL +#endif // CONFIG_TX64X64 + }, #if CONFIG_EXT_TX // FLIPADST { @@ -58,14 +72,22 @@ static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = { NULL, #endif &inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8, - &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 }, + &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32, +#if CONFIG_TX64X64 + NULL +#endif // CONFIG_TX64X64 + }, // IDENTITY { #if CONFIG_CHROMA_2X2 NULL, #endif &inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8, - &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 }, + &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32, +#if CONFIG_TX64X64 + &inv_txfm_1d_cfg_identity_64 +#endif // CONFIG_TX64X64 + }, #endif // CONFIG_EXT_TX }; @@ -76,14 +98,22 @@ static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = { NULL, #endif &inv_txfm_1d_row_cfg_dct_4, &inv_txfm_1d_row_cfg_dct_8, - &inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_row_cfg_dct_32 }, + &inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_row_cfg_dct_32, +#if CONFIG_TX64X64 + &inv_txfm_1d_row_cfg_dct_64, +#endif // CONFIG_TX64X64 + }, // ADST { #if CONFIG_CHROMA_2X2 NULL, #endif &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8, - &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 }, + &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32, +#if CONFIG_TX64X64 + NULL +#endif // CONFIG_TX64X64 + }, #if CONFIG_EXT_TX // FLIPADST { @@ -91,30 +121,39 @@ static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = { NULL, #endif &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8, - &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 }, + &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32, +#if CONFIG_TX64X64 + NULL +#endif // CONFIG_TX64X64 + }, // IDENTITY { #if CONFIG_CHROMA_2X2 NULL, #endif &inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8, - &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 }, + &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32, +#if CONFIG_TX64X64 + &inv_txfm_1d_cfg_identity_64 +#endif // CONFIG_TX64X64 + }, #endif // CONFIG_EXT_TX }; -TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(int tx_type, int tx_size) { +TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) { TXFM_2D_FLIP_CFG cfg; set_flip_cfg(tx_type, &cfg); - const int tx_type_col = vtx_tab[tx_type]; - const int tx_type_row = htx_tab[tx_type]; - const int tx_size_col = txsize_vert_map[tx_size]; - const int tx_size_row = txsize_horz_map[tx_size]; + const TX_TYPE_1D tx_type_col = vtx_tab[tx_type]; + const TX_TYPE_1D tx_type_row = htx_tab[tx_type]; + const TX_SIZE tx_size_col = txsize_vert_map[tx_size]; + const TX_SIZE tx_size_row = txsize_horz_map[tx_size]; cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size_col]; cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size_row]; return cfg; } -TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) { +#if CONFIG_TX64X64 +TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(TX_TYPE tx_type) { TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL }; switch (tx_type) { case DCT_DCT: @@ -127,9 +166,62 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) { return cfg; } +TXFM_2D_FLIP_CFG av1_get_inv_txfm_32x64_cfg(int tx_type) { + TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL }; + switch (tx_type) { + case DCT_DCT: + cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_64; + cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_32; + set_flip_cfg(tx_type, &cfg); + break; + default: assert(0); + } + return cfg; +} + +TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x32_cfg(int tx_type) { + TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL }; + switch (tx_type) { + case DCT_DCT: + cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_32; + cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_64; + set_flip_cfg(tx_type, &cfg); + break; + default: assert(0); + } + return cfg; +} +#endif // CONFIG_TX64X64 + +void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row, + const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift, + int bd) { + // Note when assigning txfm_size_col, we use the txfm_size from the + // row configuration and vice versa. This is intentionally done to + // accurately perform rectangular transforms. When the transform is + // rectangular, the number of columns will be the same as the + // txfm_size stored in the row cfg struct. It will make no difference + // for square transforms. + const int txfm_size_col = cfg->row_cfg->txfm_size; + const int txfm_size_row = cfg->col_cfg->txfm_size; + // Take the shift from the larger dimension in the rectangular case. + const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift + : cfg->col_cfg->shift; + // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning + for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) { + stage_range_row[i] = cfg->row_cfg->stage_range[i] + fwd_shift + bd + 1; + } + // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning + for (int i = 0; i < cfg->col_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) { + stage_range_col[i] = + cfg->col_cfg->stage_range[i] + fwd_shift + shift[0] + bd + 1; + } +} + static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output, int stride, TXFM_2D_FLIP_CFG *cfg, - int32_t *txfm_buf, int bd) { + int32_t *txfm_buf, int8_t fwd_shift, + int bd) { // Note when assigning txfm_size_col, we use the txfm_size from the // row configuration and vice versa. This is intentionally done to // accurately perform rectangular transforms. When the transform is @@ -141,8 +233,12 @@ static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output, // Take the shift from the larger dimension in the rectangular case. const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift : cfg->col_cfg->shift; - const int8_t *stage_range_col = cfg->col_cfg->stage_range; - const int8_t *stage_range_row = cfg->row_cfg->stage_range; + int8_t stage_range_row[MAX_TXFM_STAGE_NUM]; + int8_t stage_range_col[MAX_TXFM_STAGE_NUM]; + assert(cfg->row_cfg->stage_num <= MAX_TXFM_STAGE_NUM); + assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM); + av1_gen_inv_stage_range(stage_range_col, stage_range_row, cfg, fwd_shift, bd); + const int8_t *cos_bit_col = cfg->col_cfg->cos_bit; const int8_t *cos_bit_row = cfg->row_cfg->cos_bit; const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->col_cfg->txfm_type); @@ -198,74 +294,158 @@ static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output, static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output, int stride, int32_t *txfm_buf, - int tx_type, int tx_size, int bd) { + TX_TYPE tx_type, TX_SIZE tx_size, + int bd) { TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size); - inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf, bd); + TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size]; + inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf, + fwd_shift_sum[tx_size_sqr], bd); } void av1_inv_txfm2d_add_4x8_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[4 * 8 + 8 + 8]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X8, bd); } void av1_inv_txfm2d_add_8x4_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int txfm_buf[8 * 4 + 8 + 8]; + int32_t rinput[8 * 4]; + uint16_t routput[8 * 4]; + TX_SIZE tx_size = TX_8X4; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int32(rinput, rw, input, w, w, h); + transpose_uint16(routput, rw, output, stride, w, h); + inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd); + transpose_uint16(output, stride, routput, rw, rw, rh); +#else int txfm_buf[8 * 4 + 4 + 4]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X4, bd); +#endif } void av1_inv_txfm2d_add_8x16_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[8 * 16 + 16 + 16]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X16, bd); } void av1_inv_txfm2d_add_16x8_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int txfm_buf[16 * 8 + 16 + 16]; + int32_t rinput[16 * 8]; + uint16_t routput[16 * 8]; + TX_SIZE tx_size = TX_16X8; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int32(rinput, rw, input, w, w, h); + transpose_uint16(routput, rw, output, stride, w, h); + inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd); + transpose_uint16(output, stride, routput, rw, rw, rh); +#else int txfm_buf[16 * 8 + 8 + 8]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X8, bd); +#endif } void av1_inv_txfm2d_add_16x32_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[16 * 32 + 32 + 32]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X32, bd); } void av1_inv_txfm2d_add_32x16_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int txfm_buf[32 * 16 + 32 + 32]; + int32_t rinput[32 * 16]; + uint16_t routput[32 * 16]; + TX_SIZE tx_size = TX_32X16; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int32(rinput, rw, input, w, w, h); + transpose_uint16(routput, rw, output, stride, w, h); + inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd); + transpose_uint16(output, stride, routput, rw, rw, rh); +#else int txfm_buf[32 * 16 + 16 + 16]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X16, bd); +#endif } void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[4 * 4 + 4 + 4]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X4, bd); } void av1_inv_txfm2d_add_8x8_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[8 * 8 + 8 + 8]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X8, bd); } void av1_inv_txfm2d_add_16x16_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[16 * 16 + 16 + 16]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X16, bd); } void av1_inv_txfm2d_add_32x32_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[32 * 32 + 32 + 32]; inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X32, bd); } +#if CONFIG_TX64X64 void av1_inv_txfm2d_add_64x64_c(const int32_t *input, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { int txfm_buf[64 * 64 + 64 + 64]; - TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_64x64_cfg(tx_type); - inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf, bd); + inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_64X64, bd); +} + +void av1_inv_txfm2d_add_64x32_c(const int32_t *input, uint16_t *output, + int stride, TX_TYPE tx_type, int bd) { +#if CONFIG_TXMG + int txfm_buf[64 * 32 + 64 + 64]; + int32_t rinput[64 * 32]; + uint16_t routput[64 * 32]; + TX_SIZE tx_size = TX_64X32; + TX_SIZE rtx_size = av1_rotate_tx_size(tx_size); + TX_TYPE rtx_type = av1_rotate_tx_type(tx_type); + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + int rw = h; + int rh = w; + transpose_int32(rinput, rw, input, w, w, h); + transpose_uint16(routput, rw, output, stride, w, h); + inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd); + transpose_uint16(output, stride, routput, rw, rw, rh); +#else + int txfm_buf[64 * 32 + 64 + 64]; + inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_64X32, bd); +#endif +} + +void av1_inv_txfm2d_add_32x64_c(const int32_t *input, uint16_t *output, + int stride, TX_TYPE tx_type, int bd) { + int txfm_buf[64 * 32 + 64 + 64]; + inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X64, bd); } +#endif // CONFIG_TX64X64 diff --git a/third_party/aom/av1/common/av1_loopfilter.c b/third_party/aom/av1/common/av1_loopfilter.c index 10df7fa91..95f7a8687 100644 --- a/third_party/aom/av1/common/av1_loopfilter.c +++ b/third_party/aom/av1/common/av1_loopfilter.c @@ -13,15 +13,28 @@ #include "./aom_config.h" #include "./aom_dsp_rtcd.h" -#include "av1/common/av1_loopfilter.h" -#include "av1/common/onyxc_int.h" -#include "av1/common/reconinter.h" #include "aom_dsp/aom_dsp_common.h" #include "aom_mem/aom_mem.h" #include "aom_ports/mem.h" - +#include "av1/common/av1_loopfilter.h" +#include "av1/common/onyxc_int.h" +#include "av1/common/reconinter.h" #include "av1/common/seg_common.h" +#if CONFIG_LOOPFILTER_LEVEL +static const SEG_LVL_FEATURES seg_lvl_lf_lut[MAX_MB_PLANE][2] = { + { SEG_LVL_ALT_LF_Y_V, SEG_LVL_ALT_LF_Y_H }, + { SEG_LVL_ALT_LF_U, SEG_LVL_ALT_LF_U }, + { SEG_LVL_ALT_LF_V, SEG_LVL_ALT_LF_V } +}; + +#if CONFIG_EXT_DELTA_Q +static const int delta_lf_id_lut[MAX_MB_PLANE][2] = { + { 0, 1 }, { 2, 2 }, { 3, 3 } +}; +#endif // CONFIG_EXT_DELTA_Q +#endif // CONFIG_LOOPFILTER_LEVEL + #if CONFIG_LPF_DIRECT static void pick_filter_pixel_left(uint8_t *const src, uint8_t *const line, int *const orig_pos, int length, int row, @@ -278,6 +291,29 @@ static int pick_min_grad_direct(uint8_t *const src, int length, int row, #define PARALLEL_DEBLOCKING_15TAPLUMAONLY 1 #define PARALLEL_DEBLOCKING_DISABLE_15TAP 0 +#if CONFIG_DEBLOCK_13TAP +#define PARALLEL_DEBLOCKING_5_TAP_CHROMA 1 +#else +#define PARALLEL_DEBLOCKING_5_TAP_CHROMA 0 +#endif + +#if PARALLEL_DEBLOCKING_5_TAP_CHROMA +extern void aom_lpf_vertical_6_c(uint8_t *s, int pitch, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh); + +extern void aom_lpf_horizontal_6_c(uint8_t *s, int p, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh); + +extern void aom_highbd_lpf_horizontal_6_c(uint16_t *s, int p, + const uint8_t *blimit, + const uint8_t *limit, + const uint8_t *thresh, int bd); + +extern void aom_highbd_lpf_vertical_6_c(uint16_t *s, int pitch, + const uint8_t *blimit, + const uint8_t *limit, + const uint8_t *thresh, int bd); +#endif // 64 bit masks for left transform size. Each 1 represents a position where // we should apply a loop filter across the left border of an 8x8 block @@ -376,7 +412,9 @@ static const uint64_t left_prediction_mask[BLOCK_SIZES_ALL] = { 0x0000000000000101ULL, // BLOCK_4X16, 0x0000000000000001ULL, // BLOCK_16X4, 0x0000000001010101ULL, // BLOCK_8X32, - 0x0000000000000001ULL, // BLOCK_32X8 + 0x0000000000000001ULL, // BLOCK_32X8, + 0x0101010101010101ULL, // BLOCK_16X64, + 0x0000000000000101ULL, // BLOCK_64X16 }; // 64 bit mask to shift and set for each prediction size. @@ -402,7 +440,9 @@ static const uint64_t above_prediction_mask[BLOCK_SIZES_ALL] = { 0x0000000000000001ULL, // BLOCK_4X16, 0x0000000000000003ULL, // BLOCK_16X4, 0x0000000000000001ULL, // BLOCK_8X32, - 0x000000000000000fULL, // BLOCK_32X8 + 0x000000000000000fULL, // BLOCK_32X8, + 0x0000000000000003ULL, // BLOCK_16X64, + 0x00000000000000ffULL, // BLOCK_64X16 }; // 64 bit mask to shift and set for each prediction size. A bit is set for // each 8x8 block that would be in the top left most block of the given block @@ -429,7 +469,9 @@ static const uint64_t size_mask[BLOCK_SIZES_ALL] = { 0x0000000000000101ULL, // BLOCK_4X16, 0x0000000000000003ULL, // BLOCK_16X4, 0x0000000001010101ULL, // BLOCK_8X32, - 0x000000000000000fULL, // BLOCK_32X8 + 0x000000000000000fULL, // BLOCK_32X8, + 0x0303030303030303ULL, // BLOCK_16X64, + 0x000000000000ffffULL, // BLOCK_64X16 }; // These are used for masking the left and above 32x32 borders. @@ -486,7 +528,9 @@ static const uint16_t left_prediction_mask_uv[BLOCK_SIZES_ALL] = { 0x0001, // BLOCK_4X16, 0x0001, // BLOCK_16X4, 0x0011, // BLOCK_8X32, - 0x0001, // BLOCK_32X8 + 0x0001, // BLOCK_32X8, + 0x1111, // BLOCK_16X64, + 0x0001, // BLOCK_64X16, }; // 16 bit above mask to shift and set for uv each prediction size. @@ -512,7 +556,9 @@ static const uint16_t above_prediction_mask_uv[BLOCK_SIZES_ALL] = { 0x0001, // BLOCK_4X16, 0x0001, // BLOCK_16X4, 0x0001, // BLOCK_8X32, - 0x0003, // BLOCK_32X8 + 0x0003, // BLOCK_32X8, + 0x0001, // BLOCK_16X64, + 0x000f, // BLOCK_64X16 }; // 64 bit mask to shift and set for each uv prediction size @@ -538,28 +584,26 @@ static const uint16_t size_mask_uv[BLOCK_SIZES_ALL] = { 0x0001, // BLOCK_4X16, 0x0001, // BLOCK_16X4, 0x0011, // BLOCK_8X32, - 0x0003, // BLOCK_32X8 + 0x0003, // BLOCK_32X8, + 0x1111, // BLOCK_16X64, + 0x000f, // BLOCK_64X16 }; static const uint16_t left_border_uv = 0x1111; static const uint16_t above_border_uv = 0x000f; static const int mode_lf_lut[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES -#if CONFIG_ALT_INTRA 0, #if CONFIG_SMOOTH_HV 0, 0, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA 1, 1, 0, 1, // INTER_MODES (ZEROMV == 0) -#if CONFIG_EXT_INTER #if CONFIG_COMPOUND_SINGLEREF // 1, 1, 1, 1, 1, // INTER_SINGLEREF_COMP_MODES // NOTE(zoeliu): Remove SR_NEAREST_NEWMV 1, 1, 1, 1, // INTER_SINGLEREF_COMP_MODES #endif // CONFIG_COMPOUND_SINGLEREF 1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0) -#endif // CONFIG_EXT_INTER }; static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) { @@ -585,7 +629,17 @@ static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) { #if CONFIG_EXT_DELTA_Q static uint8_t get_filter_level(const AV1_COMMON *cm, const loop_filter_info_n *lfi_n, +#if CONFIG_LOOPFILTER_LEVEL + const int dir_idx, int plane, +#endif +#if CONFIG_LPF_SB + int mi_row, int mi_col, +#endif const MB_MODE_INFO *mbmi) { +#if CONFIG_LPF_SB + return cm->mi[mi_row * cm->mi_stride + mi_col].mbmi.filt_lvl; +#endif + #if CONFIG_SUPERTX const int segment_id = AOMMIN(mbmi->segment_id, mbmi->segment_id_supertx); assert( @@ -596,15 +650,38 @@ static uint8_t get_filter_level(const AV1_COMMON *cm, const int segment_id = mbmi->segment_id; #endif // CONFIG_SUPERTX if (cm->delta_lf_present_flag) { +#if CONFIG_LOOPFILTER_LEVEL + int delta_lf; + if (cm->delta_lf_multi) { + const int delta_lf_idx = delta_lf_id_lut[plane][dir_idx]; + delta_lf = mbmi->curr_delta_lf[delta_lf_idx]; + } else { + delta_lf = mbmi->current_delta_lf_from_base; + } + int lvl_seg = + clamp(delta_lf + cm->lf.filter_level[dir_idx], 0, MAX_LOOP_FILTER); +#else int lvl_seg = clamp(mbmi->current_delta_lf_from_base + cm->lf.filter_level, 0, MAX_LOOP_FILTER); +#endif const int scale = 1 << (lvl_seg >> 5); +#if CONFIG_LOOPFILTER_LEVEL + assert(plane >= 0 && plane <= 2); + const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir_idx]; + if (segfeature_active(&cm->seg, segment_id, seg_lf_feature_id)) { + const int data = get_segdata(&cm->seg, segment_id, seg_lf_feature_id); + lvl_seg = + clamp(cm->seg.abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0, + MAX_LOOP_FILTER); + } +#else if (segfeature_active(&cm->seg, segment_id, SEG_LVL_ALT_LF)) { const int data = get_segdata(&cm->seg, segment_id, SEG_LVL_ALT_LF); lvl_seg = clamp(cm->seg.abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0, MAX_LOOP_FILTER); } +#endif // CONFIG_LOOPFILTER_LEVEL if (cm->lf.mode_ref_delta_enabled) { lvl_seg += cm->lf.ref_deltas[mbmi->ref_frame[0]] * scale; @@ -614,7 +691,12 @@ static uint8_t get_filter_level(const AV1_COMMON *cm, } return lvl_seg; } else { +#if CONFIG_LOOPFILTER_LEVEL + return lfi_n + ->lvl[segment_id][dir_idx][mbmi->ref_frame[0]][mode_lf_lut[mbmi->mode]]; +#else return lfi_n->lvl[segment_id][mbmi->ref_frame[0]][mode_lf_lut[mbmi->mode]]; +#endif } } #else @@ -648,12 +730,39 @@ void av1_loop_filter_init(AV1_COMMON *cm) { memset(lfi->lfthr[lvl].hev_thr, (lvl >> 4), SIMD_WIDTH); } -void av1_loop_filter_frame_init(AV1_COMMON *cm, int default_filt_lvl) { +#if CONFIG_LPF_SB +void av1_loop_filter_sb_level_init(AV1_COMMON *cm, int mi_row, int mi_col, + int lvl) { + const int mi_row_start = AOMMAX(0, mi_row - FILT_BOUNDARY_MI_OFFSET); + const int mi_col_start = AOMMAX(0, mi_col - FILT_BOUNDARY_MI_OFFSET); + const int mi_row_range = mi_row - FILT_BOUNDARY_MI_OFFSET + MAX_MIB_SIZE; + const int mi_col_range = mi_col - FILT_BOUNDARY_MI_OFFSET + MAX_MIB_SIZE; + const int mi_row_end = AOMMIN(mi_row_range, cm->mi_rows); + const int mi_col_end = AOMMIN(mi_col_range, cm->mi_cols); + + int row, col; + for (row = mi_row_start; row < mi_row_end; ++row) { + for (col = mi_col_start; col < mi_col_end; ++col) { + // Note: can't use cm->mi_grid_visible. Because for each partition, + // all visible pointers will point to the first of the partition. + cm->mi[row * cm->mi_stride + col].mbmi.filt_lvl = lvl; + } + } +} +#endif // CONFIG_LPF_SB + +void av1_loop_filter_frame_init(AV1_COMMON *cm, int default_filt_lvl, + int default_filt_lvl_r +#if CONFIG_LOOPFILTER_LEVEL + , + int plane +#endif + ) { int seg_id; // n_shift is the multiplier for lf_deltas // the multiplier is 1 for when filter_lvl is between 0 and 31; // 2 when filter_lvl is between 32 and 63 - const int scale = 1 << (default_filt_lvl >> 5); + int scale = 1 << (default_filt_lvl >> 5); loop_filter_info_n *const lfi = &cm->lf_info; struct loopfilter *const lf = &cm->lf; const struct segmentation *const seg = &cm->seg; @@ -665,29 +774,64 @@ void av1_loop_filter_frame_init(AV1_COMMON *cm, int default_filt_lvl) { } for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) { - int lvl_seg = default_filt_lvl; - if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) { - const int data = get_segdata(seg, seg_id, SEG_LVL_ALT_LF); - lvl_seg = clamp( - seg->abs_delta == SEGMENT_ABSDATA ? data : default_filt_lvl + data, 0, - MAX_LOOP_FILTER); - } + for (int dir = 0; dir < 2; ++dir) { + int lvl_seg = (dir == 0) ? default_filt_lvl : default_filt_lvl_r; +#if CONFIG_LOOPFILTER_LEVEL + assert(plane >= 0 && plane <= 2); + const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir]; + if (segfeature_active(seg, seg_id, seg_lf_feature_id)) { + const int data = get_segdata(&cm->seg, seg_id, seg_lf_feature_id); + lvl_seg = clamp( + seg->abs_delta == SEGMENT_ABSDATA ? data : default_filt_lvl + data, + 0, MAX_LOOP_FILTER); + } +#else + if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) { + const int data = get_segdata(seg, seg_id, SEG_LVL_ALT_LF); + lvl_seg = clamp( + seg->abs_delta == SEGMENT_ABSDATA ? data : default_filt_lvl + data, + 0, MAX_LOOP_FILTER); + } +#endif // CONFIG_LOOPFILTER_LEVEL - if (!lf->mode_ref_delta_enabled) { - // we could get rid of this if we assume that deltas are set to - // zero when not in use; encoder always uses deltas - memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id])); - } else { - int ref, mode; - const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; - lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER); - - for (ref = LAST_FRAME; ref < TOTAL_REFS_PER_FRAME; ++ref) { - for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) { - const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale + - lf->mode_deltas[mode] * scale; - lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER); + if (!lf->mode_ref_delta_enabled) { +// we could get rid of this if we assume that deltas are set to +// zero when not in use; encoder always uses deltas +#if CONFIG_LOOPFILTER_LEVEL + memset(lfi->lvl[seg_id][dir], lvl_seg, sizeof(lfi->lvl[seg_id][dir])); +#else + memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id])); +#endif // CONFIG_LOOPFILTER_LEVEL + } else { + int ref, mode; +#if CONFIG_LOOPFILTER_LEVEL + scale = 1 << (lvl_seg >> 5); + + const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; + lfi->lvl[seg_id][dir][INTRA_FRAME][0] = + clamp(intra_lvl, 0, MAX_LOOP_FILTER); + + for (ref = LAST_FRAME; ref < TOTAL_REFS_PER_FRAME; ++ref) { + for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) { + const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale + + lf->mode_deltas[mode] * scale; + lfi->lvl[seg_id][dir][ref][mode] = + clamp(inter_lvl, 0, MAX_LOOP_FILTER); + } } +#else + (void)default_filt_lvl_r; + const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; + lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER); + + for (ref = LAST_FRAME; ref < TOTAL_REFS_PER_FRAME; ++ref) { + for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) { + const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale + + lf->mode_deltas[mode] * scale; + lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER); + } + } +#endif } } } @@ -1384,7 +1528,15 @@ static void build_masks(AV1_COMMON *const cm, const TX_SIZE tx_size_uv_above = txsize_vert_map[uv_txsize_lookup[block_size][mbmi->tx_size][1][1]]; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); +#else +#if CONFIG_LPF_SB + const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); +#else const int filter_level = get_filter_level(cm, lfi_n, mbmi); +#endif // CONFIG_LPF_SB +#endif #else const int filter_level = get_filter_level(lfi_n, mbmi); (void)cm; @@ -1478,7 +1630,15 @@ static void build_y_mask(AV1_COMMON *const cm, const BLOCK_SIZE block_size = mbmi->sb_type; #endif #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); +#else +#if CONFIG_LPF_SB + const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); +#else const int filter_level = get_filter_level(cm, lfi_n, mbmi); +#endif // CONFIG_LPF_SB +#endif #else const int filter_level = get_filter_level(lfi_n, mbmi); (void)cm; @@ -1548,6 +1708,9 @@ static void update_tile_boundary_filter_mask(AV1_COMMON *const cm, void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col, MODE_INFO **mi, const int mode_info_stride, LOOP_FILTER_MASK *lfm) { +#if CONFIG_EXT_PARTITION + assert(0 && "Not yet updated"); +#endif // CONFIG_EXT_PARTITION int idx_32, idx_16, idx_8; const loop_filter_info_n *const lfi_n = &cm->lf_info; MODE_INFO **mip = mi; @@ -1575,9 +1738,6 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col, int i; const int max_rows = AOMMIN(cm->mi_rows - mi_row, MAX_MIB_SIZE); const int max_cols = AOMMIN(cm->mi_cols - mi_col, MAX_MIB_SIZE); -#if CONFIG_EXT_PARTITION - assert(0 && "Not yet updated"); -#endif // CONFIG_EXT_PARTITION av1_zero(*lfm); assert(mip[0] != NULL); @@ -1898,8 +2058,8 @@ static void filter_selectively_vert( orig_pos[i] = -1; } - int direct = pick_min_grad_direct(src, left_filt_len, row, col, width, - height, pitch, 1, 0); + const int direct = pick_min_grad_direct(src, left_filt_len, row, col, + width, height, pitch, 1, 0); pick_filter_block_vert(src, block, orig_pos, left_filt_len, row, col, width, height, pitch, pivot, line_length, 1, @@ -1928,8 +2088,8 @@ static void filter_selectively_vert( orig_pos[i] = -1; } - int direct = pick_min_grad_direct(src, 4, row, col + 4, width, height, - pitch, 1, 0); + const int direct = pick_min_grad_direct(src, 4, row, col + 4, width, + height, pitch, 1, 0); pick_filter_block_vert(src, block, orig_pos, 4, row, col + 4, width, height, pitch, pivot, line_length, 1, direct); @@ -2083,7 +2243,18 @@ static void get_filter_level_and_masks_non420( // Filter level can vary per MI #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, 0, 0, mbmi))) + continue; +#else +#if CONFIG_LPF_SB + if (!(lfl_r[c_step] = + get_filter_level(cm, &cm->lf_info, mi_row, mi_col, mbmi))) + continue; +#else if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, mbmi))) continue; +#endif // CONFIG_LPF_SB +#endif #else if (!(lfl_r[c_step] = get_filter_level(&cm->lf_info, mbmi))) continue; #endif @@ -2249,7 +2420,7 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm, &col_masks); // Disable filtering on the leftmost column or tile boundary - unsigned int border_mask = ~(mi_col == 0); + unsigned int border_mask = ~(mi_col == 0 ? 1 : 0); #if CONFIG_LOOPFILTERING_ACROSS_TILES MODE_INFO *const mi = cm->mi + (mi_row + idx_r) * cm->mi_stride + mi_col; if (av1_disable_loopfilter_on_tile_boundary(cm) && @@ -2588,7 +2759,13 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = { 4 - 1, // BLOCK_4X16, 16 - 1, // BLOCK_16X4, 8 - 1, // BLOCK_8X32, - 32 - 1 // BLOCK_32X8 + 32 - 1, // BLOCK_32X8, + 16 - 1, // BLOCK_16X64, + 64 - 1, // BLOCK_64X16 +#if CONFIG_EXT_PARTITION + 32 - 1, // BLOCK_32X128 + 128 - 1, // BLOCK_128X32 +#endif // CONFIG_EXT_PARTITION }, // mask for horizontal edges filtering { @@ -2618,7 +2795,13 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = { 16 - 1, // BLOCK_4X16, 4 - 1, // BLOCK_16X4, 32 - 1, // BLOCK_8X32, - 8 - 1 // BLOCK_32X8 + 8 - 1, // BLOCK_32X8, + 64 - 1, // BLOCK_16X64, + 16 - 1, // BLOCK_64X16 +#if CONFIG_EXT_PARTITION + 128 - 1, // BLOCK_32X128 + 32 - 1, // BLOCK_128X32 +#endif // CONFIG_EXT_PARTITION }, }; @@ -2640,6 +2823,10 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = { 16 - 1, // TX_16X8 16 - 1, // TX_16X32 32 - 1, // TX_32X16 +#if CONFIG_TX64X64 + 32 - 1, // TX_32X64 + 64 - 1, // TX_64X32 +#endif // CONFIG_TX64X64 4 - 1, // TX_4X16 16 - 1, // TX_16X4 8 - 1, // TX_8X32 @@ -2662,6 +2849,10 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = { 8 - 1, // TX_16X8 32 - 1, // TX_16X32 16 - 1, // TX_32X16 +#if CONFIG_TX64X64 + 64 - 1, // TX_32X64 + 32 - 1, // TX_64X32 +#endif // CONFIG_TX64X64 16 - 1, // TX_4X16 4 - 1, // TX_16X4 32 - 1, // TX_8X32 @@ -2669,15 +2860,16 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = { } }; -static TX_SIZE av1_get_transform_size(const MODE_INFO *const pCurr, - const EDGE_DIR edgeDir, const int mi_row, +static TX_SIZE av1_get_transform_size(const MODE_INFO *const mi, + const EDGE_DIR edge_dir, const int mi_row, const int mi_col, const int plane, - const struct macroblockd_plane *pPlane, - const uint32_t scaleHorz, - const uint32_t scaleVert) { - const MB_MODE_INFO *mbmi = &pCurr->mbmi; - TX_SIZE tx_size = (plane == PLANE_TYPE_Y) ? mbmi->tx_size - : av1_get_uv_tx_size(mbmi, pPlane); + const struct macroblockd_plane *plane_ptr, + const uint32_t scale_horz, + const uint32_t scale_vert) { + const MB_MODE_INFO *mbmi = &mi->mbmi; + TX_SIZE tx_size = (plane == AOM_PLANE_Y) + ? mbmi->tx_size + : av1_get_uv_tx_size(mbmi, plane_ptr); assert(tx_size < TX_SIZES_ALL); #if CONFIG_VAR_TX @@ -2690,7 +2882,7 @@ static TX_SIZE av1_get_transform_size(const MODE_INFO *const pCurr, const int idx_r = mi_row & MAX_MIB_MASK; const int c = idx_c >> mi_width_log2_lookup[BLOCK_8X8]; const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8]; - const BLOCK_SIZE sb_type = pCurr->mbmi.sb_type; + const BLOCK_SIZE sb_type = mi->mbmi.sb_type; const int blk_row = r & (num_8x8_blocks_high_lookup[sb_type] - 1); const int blk_col = c & (num_8x8_blocks_wide_lookup[sb_type] - 1); @@ -2702,40 +2894,40 @@ static TX_SIZE av1_get_transform_size(const MODE_INFO *const pCurr, #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE bsize = - AOMMAX(BLOCK_4X4, ss_size_lookup[sb_type][scaleHorz][scaleVert]); + AOMMAX(BLOCK_4X4, ss_size_lookup[sb_type][scale_horz][scale_vert]); #else - const BLOCK_SIZE bsize = ss_size_lookup[sb_type][scaleHorz][scaleVert]; + const BLOCK_SIZE bsize = ss_size_lookup[sb_type][scale_horz][scale_vert]; #endif const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx]; assert(mb_tx_size < TX_SIZES_ALL); - tx_size = (plane == PLANE_TYPE_UV) - ? uv_txsize_lookup[bsize][mb_tx_size][0][0] - : mb_tx_size; + tx_size = (plane == AOM_PLANE_Y) + ? mb_tx_size + : uv_txsize_lookup[bsize][mb_tx_size][0][0]; assert(tx_size < TX_SIZES_ALL); } #else (void)mi_row; (void)mi_col; - (void)scaleHorz; - (void)scaleVert; + (void)scale_horz; + (void)scale_vert; #endif // CONFIG_VAR_TX // since in case of chrominance or non-square transorm need to convert // transform size into transform size in particular direction. // for vertical edge, filter direction is horizontal, for horizontal // edge, filter direction is vertical. - tx_size = (VERT_EDGE == edgeDir) ? txsize_horz_map[tx_size] - : txsize_vert_map[tx_size]; + tx_size = (VERT_EDGE == edge_dir) ? txsize_horz_map[tx_size] + : txsize_vert_map[tx_size]; return tx_size; } typedef struct AV1_DEBLOCKING_PARAMETERS { // length of the filter applied to the outer edge - uint32_t filterLength; + uint32_t filter_length; // length of the filter applied to the inner edge - uint32_t filterLengthInternal; + uint32_t filter_length_internal; // deblocking limits const uint8_t *lim; const uint8_t *mblim; @@ -2743,291 +2935,595 @@ typedef struct AV1_DEBLOCKING_PARAMETERS { } AV1_DEBLOCKING_PARAMETERS; static void set_lpf_parameters( - AV1_DEBLOCKING_PARAMETERS *const pParams, const MODE_INFO **const ppCurr, - const ptrdiff_t modeStep, const AV1_COMMON *const cm, - const EDGE_DIR edgeDir, const uint32_t x, const uint32_t y, - const uint32_t width, const uint32_t height, const int plane, - const struct macroblockd_plane *const pPlane, const uint32_t scaleHorz, - const uint32_t scaleVert) { + AV1_DEBLOCKING_PARAMETERS *const params, const ptrdiff_t mode_step, + const AV1_COMMON *const cm, const EDGE_DIR edge_dir, const uint32_t x, + const uint32_t y, const int plane, + const struct macroblockd_plane *const plane_ptr) { // reset to initial values - pParams->filterLength = 0; - pParams->filterLengthInternal = 0; + params->filter_length = 0; + params->filter_length_internal = 0; + // no deblocking is required + const uint32_t width = plane_ptr->dst.width; + const uint32_t height = plane_ptr->dst.height; if ((width <= x) || (height <= y)) { return; } - const int mi_row = (y << scaleVert) >> MI_SIZE_LOG2; - const int mi_col = (x << scaleHorz) >> MI_SIZE_LOG2; - const MB_MODE_INFO *mbmi = &ppCurr[0]->mbmi; + const uint32_t scale_horz = plane_ptr->subsampling_x; + const uint32_t scale_vert = plane_ptr->subsampling_y; + const int mi_row = (y << scale_vert) >> MI_SIZE_LOG2; + const int mi_col = (x << scale_horz) >> MI_SIZE_LOG2; + MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride + mi_col; + const MB_MODE_INFO *mbmi = &mi[0]->mbmi; { const TX_SIZE ts = - av1_get_transform_size(ppCurr[0], edgeDir, mi_row, mi_col, plane, - pPlane, scaleHorz, scaleVert); + av1_get_transform_size(mi[0], edge_dir, mi_row, mi_col, plane, + plane_ptr, scale_horz, scale_vert); #if CONFIG_EXT_DELTA_Q - const uint32_t currLevel = get_filter_level(cm, &cm->lf_info, mbmi); +#if CONFIG_LOOPFILTER_LEVEL + const uint32_t curr_level = + get_filter_level(cm, &cm->lf_info, edge_dir, plane, mbmi); #else - const uint32_t currLevel = get_filter_level(&cm->lf_info, mbmi); +#if CONFIG_LPF_SB + const uint32_t curr_level = + get_filter_level(cm, &cm->lf_info, mi_row, mi_col, mbmi); +#else + const uint32_t curr_level = get_filter_level(cm, &cm->lf_info, mbmi); +#endif // CONFIG_LPF_SB +#endif +#else + const uint32_t curr_level = get_filter_level(&cm->lf_info, mbmi); #endif // CONFIG_EXT_DELTA_Q - const int currSkipped = mbmi->skip && is_inter_block(mbmi); - const uint32_t coord = (VERT_EDGE == edgeDir) ? (x) : (y); - uint32_t level = currLevel; + const int curr_skipped = mbmi->skip && is_inter_block(mbmi); + const uint32_t coord = (VERT_EDGE == edge_dir) ? (x) : (y); + uint32_t level = curr_level; // prepare outer edge parameters. deblock the edge if it's an edge of a TU if (coord) { #if CONFIG_LOOPFILTERING_ACROSS_TILES - MODE_INFO *const mi = cm->mi + mi_row * cm->mi_stride + mi_col; + MODE_INFO *const mi_bound = cm->mi + mi_row * cm->mi_stride + mi_col; if (!av1_disable_loopfilter_on_tile_boundary(cm) || - ((VERT_EDGE == edgeDir) && - (0 == (mi->mbmi.boundary_info & TILE_LEFT_BOUNDARY))) || - ((HORZ_EDGE == edgeDir) && - (0 == (mi->mbmi.boundary_info & TILE_ABOVE_BOUNDARY)))) + ((VERT_EDGE == edge_dir) && + (0 == (mi_bound->mbmi.boundary_info & TILE_LEFT_BOUNDARY))) || + ((HORZ_EDGE == edge_dir) && + (0 == (mi_bound->mbmi.boundary_info & TILE_ABOVE_BOUNDARY)))) #endif // CONFIG_LOOPFILTERING_ACROSS_TILES { - const int32_t tuEdge = - (coord & av1_transform_masks[edgeDir][ts]) ? (0) : (1); - if (tuEdge) { - const MODE_INFO *const pPrev = *(ppCurr - modeStep); - const int pvRow = - (VERT_EDGE == edgeDir) ? (mi_row) : (mi_row - (1 << scaleVert)); - const int pvCol = - (VERT_EDGE == edgeDir) ? (mi_col - (1 << scaleHorz)) : (mi_col); - const TX_SIZE pvTs = - av1_get_transform_size(pPrev, edgeDir, pvRow, pvCol, plane, - pPlane, scaleHorz, scaleVert); + const int32_t tu_edge = + (coord & av1_transform_masks[edge_dir][ts]) ? (0) : (1); + if (tu_edge) { + const MODE_INFO *const mi_prev = *(mi - mode_step); + const int pv_row = + (VERT_EDGE == edge_dir) ? (mi_row) : (mi_row - (1 << scale_vert)); + const int pv_col = + (VERT_EDGE == edge_dir) ? (mi_col - (1 << scale_horz)) : (mi_col); + const TX_SIZE pv_ts = + av1_get_transform_size(mi_prev, edge_dir, pv_row, pv_col, plane, + plane_ptr, scale_horz, scale_vert); #if CONFIG_EXT_DELTA_Q - const uint32_t pvLvl = - get_filter_level(cm, &cm->lf_info, &pPrev->mbmi); +#if CONFIG_LOOPFILTER_LEVEL + const uint32_t pv_lvl = get_filter_level(cm, &cm->lf_info, edge_dir, + plane, &mi_prev->mbmi); +#else +#if CONFIG_LPF_SB + const uint32_t pv_lvl = get_filter_level(cm, &cm->lf_info, pv_row, + pv_col, &mi_prev->mbmi); +#else + const uint32_t pv_lvl = + get_filter_level(cm, &cm->lf_info, &mi_prev->mbmi); +#endif // CONFIG_LPF_SB +#endif #else - const uint32_t pvLvl = get_filter_level(&cm->lf_info, &pPrev->mbmi); + const uint32_t pv_lvl = + get_filter_level(&cm->lf_info, &mi_prev->mbmi); #endif // CONFIG_EXT_DELTA_Q - const int pvSkip = pPrev->mbmi.skip && is_inter_block(&pPrev->mbmi); - const int32_t puEdge = + const int pv_skip = + mi_prev->mbmi.skip && is_inter_block(&mi_prev->mbmi); + const int32_t pu_edge = (coord & - av1_prediction_masks[edgeDir] - [ss_size_lookup[mbmi->sb_type][scaleHorz] - [scaleVert]]) + av1_prediction_masks[edge_dir] + [ss_size_lookup[mbmi->sb_type][scale_horz] + [scale_vert]]) ? (0) : (1); // if the current and the previous blocks are skipped, // deblock the edge if the edge belongs to a PU's edge only. - if ((currLevel || pvLvl) && (!pvSkip || !currSkipped || puEdge)) { - const TX_SIZE minTs = AOMMIN(ts, pvTs); - if (TX_4X4 >= minTs) { - pParams->filterLength = 4; - } else if (TX_8X8 == minTs) { - pParams->filterLength = 8; + if ((curr_level || pv_lvl) && + (!pv_skip || !curr_skipped || pu_edge)) { + const TX_SIZE min_ts = AOMMIN(ts, pv_ts); + if (TX_4X4 >= min_ts) { + params->filter_length = 4; + } else if (TX_8X8 == min_ts) { + params->filter_length = 8; } else { - pParams->filterLength = 16; + params->filter_length = 16; #if PARALLEL_DEBLOCKING_15TAPLUMAONLY // No wide filtering for chroma plane if (plane != 0) { - pParams->filterLength = 8; +#if PARALLEL_DEBLOCKING_5_TAP_CHROMA + params->filter_length = 6; +#else + params->filter_length = 8; +#endif } #endif } #if PARALLEL_DEBLOCKING_DISABLE_15TAP - pParams->filterLength = (TX_4X4 >= AOMMIN(ts, pvTs)) ? (4) : (8); + params->filter_length = (TX_4X4 >= AOMMIN(ts, pv_ts)) ? (4) : (8); #endif // PARALLEL_DEBLOCKING_DISABLE_15TAP // update the level if the current block is skipped, // but the previous one is not - level = (currLevel) ? (currLevel) : (pvLvl); + level = (curr_level) ? (curr_level) : (pv_lvl); } } } #if !CONFIG_CB4X4 // prepare internal edge parameters - if (currLevel && !currSkipped) { - pParams->filterLengthInternal = (TX_4X4 >= ts) ? (4) : (0); + if (curr_level && !curr_skipped) { + params->filter_length_internal = (TX_4X4 >= ts) ? (4) : (0); } #endif // prepare common parameters - if (pParams->filterLength || pParams->filterLengthInternal) { + if (params->filter_length || params->filter_length_internal) { const loop_filter_thresh *const limits = cm->lf_info.lfthr + level; - pParams->lim = limits->lim; - pParams->mblim = limits->mblim; - pParams->hev_thr = limits->hev_thr; + params->lim = limits->lim; + params->mblim = limits->mblim; + params->hev_thr = limits->hev_thr; } } } } -static void av1_filter_block_plane_vert(const AV1_COMMON *const cm, - const int plane, - const MACROBLOCKD_PLANE *const pPlane, - const MODE_INFO **ppModeInfo, - const uint32_t cuX, - const uint32_t cuY) { +static void av1_filter_block_plane_vert( + const AV1_COMMON *const cm, const int plane, + const MACROBLOCKD_PLANE *const plane_ptr, const uint32_t mi_row, + const uint32_t mi_col) { const int col_step = MI_SIZE >> MI_SIZE_LOG2; const int row_step = MI_SIZE >> MI_SIZE_LOG2; - const uint32_t scaleHorz = pPlane->subsampling_x; - const uint32_t scaleVert = pPlane->subsampling_y; - const uint32_t width = pPlane->dst.width; - const uint32_t height = pPlane->dst.height; - uint8_t *const pDst = pPlane->dst.buf; - const int dstStride = pPlane->dst.stride; - for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) { - uint8_t *p = pDst + y * MI_SIZE * dstStride; - for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) { + const uint32_t scale_horz = plane_ptr->subsampling_x; + const uint32_t scale_vert = plane_ptr->subsampling_y; + uint8_t *const dst_ptr = plane_ptr->dst.buf; + const int dst_stride = plane_ptr->dst.stride; +#if CONFIG_LPF_SB + int y_range = mi_row ? MAX_MIB_SIZE : MAX_MIB_SIZE - FILT_BOUNDARY_MI_OFFSET; + y_range = AOMMIN(y_range, cm->mi_rows); + y_range >>= scale_vert; + + int x_range = mi_col ? MAX_MIB_SIZE : MAX_MIB_SIZE - FILT_BOUNDARY_MI_OFFSET; + x_range = AOMMIN(x_range, cm->mi_cols); + x_range >>= scale_horz; +#else + const int y_range = (MAX_MIB_SIZE >> scale_vert); + const int x_range = (MAX_MIB_SIZE >> scale_horz); +#endif // CONFIG_LPF_SB + for (int y = 0; y < y_range; y += row_step) { + uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride; + for (int x = 0; x < x_range; x += col_step) { // inner loop always filter vertical edges in a MI block. If MI size // is 8x8, it will filter the vertical edge aligned with a 8x8 block. // If 4x4 trasnform is used, it will then filter the internal edge // aligned with a 4x4 block - const MODE_INFO **const pCurr = - ppModeInfo + (y << scaleVert) * cm->mi_stride + (x << scaleHorz); + const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE; + const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE; AV1_DEBLOCKING_PARAMETERS params; memset(¶ms, 0, sizeof(params)); - set_lpf_parameters(¶ms, pCurr, ((ptrdiff_t)1 << scaleHorz), cm, - VERT_EDGE, cuX + x * MI_SIZE, cuY + y * MI_SIZE, width, - height, plane, pPlane, scaleHorz, scaleVert); + set_lpf_parameters(¶ms, ((ptrdiff_t)1 << scale_horz), cm, VERT_EDGE, + curr_x, curr_y, plane, plane_ptr); + +#if CONFIG_LPF_DIRECT + uint8_t *const src = plane_ptr->dst.buf0; + const int width = cm->width >> scale_horz; + const int height = cm->height >> scale_vert; + const int pivot = 8; + const int line_length = 16; + uint8_t block[128]; + int orig_pos[128]; + const int vert_or_horz = 0; // 0: vertical + const int unit = 1; + int i; + for (i = 0; i < 128; ++i) { + block[i] = 0; + orig_pos[i] = -1; + } + + if (params.filter_length) { + const int filt_len = params.filter_length == 16 ? 8 : 4; + const int direct = + pick_min_grad_direct(src, filt_len, curr_y, curr_x, width, height, + dst_stride, unit, vert_or_horz); + + pick_filter_block_vert(src, block, orig_pos, filt_len, curr_y, curr_x, + width, height, dst_stride, pivot, line_length, + unit, direct); + uint8_t *const filt_start = block + pivot; + switch (params.filter_length) { + // apply 4-tap filtering + case 4: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_vertical_4(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // apply 8-tap filtering + case 8: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_vertical_8(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_vertical_8(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // apply 16-tap filtering + case 16: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_vertical_16(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_vertical_16(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // no filtering + default: break; + } + + for (i = 0; i < 128; ++i) { + if (orig_pos[i] >= 0) src[orig_pos[i]] = block[i]; + } + } + + if (params.filter_length_internal) { + for (i = 0; i < 128; ++i) { + block[i] = 0; + orig_pos[i] = -1; + } + + const int direct = + pick_min_grad_direct(src, 4, curr_y, curr_x + 4, width, height, + dst_stride, unit, vert_or_horz); - switch (params.filterLength) { + pick_filter_block_vert(src, block, orig_pos, 4, curr_y, curr_x + 4, + width, height, dst_stride, pivot, line_length, + unit, direct); + + uint8_t *const filt_start = block + pivot; +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_vertical_4(filt_start, line_length, params.mblim, params.lim, + params.hev_thr); + + for (i = 0; i < 128; ++i) { + if (orig_pos[i] >= 0) src[orig_pos[i]] = block[i]; + } + } +#else // !CONFIG_LPF_DIRECT + switch (params.filter_length) { // apply 4-tap filtering case 4: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p), dstStride, + aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(p), dst_stride, + params.mblim, params.lim, params.hev_thr, + cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_vertical_4(p, dst_stride, params.mblim, params.lim, + params.hev_thr); + break; +#if PARALLEL_DEBLOCKING_5_TAP_CHROMA + case 6: // apply 6-tap filter for chroma plane only + assert(plane != 0); +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_vertical_6_c(CONVERT_TO_SHORTPTR(p), dst_stride, params.mblim, params.lim, params.hev_thr, cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_vertical_4_c(p, dstStride, params.mblim, params.lim, + aom_lpf_vertical_6_c(p, dst_stride, params.mblim, params.lim, params.hev_thr); break; +#endif // apply 8-tap filtering case 8: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_vertical_8_c(CONVERT_TO_SHORTPTR(p), dstStride, - params.mblim, params.lim, - params.hev_thr, cm->bit_depth); + aom_highbd_lpf_vertical_8(CONVERT_TO_SHORTPTR(p), dst_stride, + params.mblim, params.lim, params.hev_thr, + cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_vertical_8_c(p, dstStride, params.mblim, params.lim, - params.hev_thr); + aom_lpf_vertical_8(p, dst_stride, params.mblim, params.lim, + params.hev_thr); break; // apply 16-tap filtering case 16: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_vertical_16_c(CONVERT_TO_SHORTPTR(p), dstStride, +#if CONFIG_DEBLOCK_13TAP + // TODO(olah): Remove _c once SIMD for 13-tap is available + aom_highbd_lpf_vertical_16_c(CONVERT_TO_SHORTPTR(p), dst_stride, params.mblim, params.lim, params.hev_thr, cm->bit_depth); +#else + aom_highbd_lpf_vertical_16(CONVERT_TO_SHORTPTR(p), dst_stride, + params.mblim, params.lim, params.hev_thr, + cm->bit_depth); +#endif else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_vertical_16_c(p, dstStride, params.mblim, params.lim, +#if CONFIG_DEBLOCK_13TAP + aom_lpf_vertical_16_c(p, dst_stride, params.mblim, params.lim, params.hev_thr); +#else + aom_lpf_vertical_16(p, dst_stride, params.mblim, params.lim, + params.hev_thr); +#endif break; // no filtering default: break; } // process the internal edge - if (params.filterLengthInternal) { + if (params.filter_length_internal) { #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p + 4), dstStride, - params.mblim, params.lim, params.hev_thr, - cm->bit_depth); + aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(p + 4), dst_stride, + params.mblim, params.lim, params.hev_thr, + cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_vertical_4_c(p + 4, dstStride, params.mblim, params.lim, - params.hev_thr); + aom_lpf_vertical_4(p + 4, dst_stride, params.mblim, params.lim, + params.hev_thr); } +#endif // CONFIG_LPF_DIRECT // advance the destination pointer p += MI_SIZE; } } } -static void av1_filter_block_plane_horz(const AV1_COMMON *const cm, - const int plane, - const MACROBLOCKD_PLANE *const pPlane, - const MODE_INFO **ppModeInfo, - const uint32_t cuX, - const uint32_t cuY) { +static void av1_filter_block_plane_horz( + const AV1_COMMON *const cm, const int plane, + const MACROBLOCKD_PLANE *const plane_ptr, const uint32_t mi_row, + const uint32_t mi_col) { const int col_step = MI_SIZE >> MI_SIZE_LOG2; const int row_step = MI_SIZE >> MI_SIZE_LOG2; - const uint32_t scaleHorz = pPlane->subsampling_x; - const uint32_t scaleVert = pPlane->subsampling_y; - const uint32_t width = pPlane->dst.width; - const uint32_t height = pPlane->dst.height; - uint8_t *const pDst = pPlane->dst.buf; - const int dstStride = pPlane->dst.stride; - for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) { - uint8_t *p = pDst + y * MI_SIZE * dstStride; - for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) { + const uint32_t scale_horz = plane_ptr->subsampling_x; + const uint32_t scale_vert = plane_ptr->subsampling_y; + uint8_t *const dst_ptr = plane_ptr->dst.buf; + const int dst_stride = plane_ptr->dst.stride; +#if CONFIG_LPF_SB + int y_range = mi_row ? MAX_MIB_SIZE : MAX_MIB_SIZE - FILT_BOUNDARY_MI_OFFSET; + y_range = AOMMIN(y_range, cm->mi_rows); + y_range >>= scale_vert; + + int x_range = mi_col ? MAX_MIB_SIZE : MAX_MIB_SIZE - FILT_BOUNDARY_MI_OFFSET; + x_range = AOMMIN(x_range, cm->mi_cols); + x_range >>= scale_horz; +#else + const int y_range = (MAX_MIB_SIZE >> scale_vert); + const int x_range = (MAX_MIB_SIZE >> scale_horz); +#endif // CONFIG_LPF_SB + for (int y = 0; y < y_range; y += row_step) { + uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride; + for (int x = 0; x < x_range; x += col_step) { // inner loop always filter vertical edges in a MI block. If MI size // is 8x8, it will first filter the vertical edge aligned with a 8x8 // block. If 4x4 trasnform is used, it will then filter the internal // edge aligned with a 4x4 block - const MODE_INFO **const pCurr = - ppModeInfo + (y << scaleVert) * cm->mi_stride + (x << scaleHorz); + const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE; + const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE; AV1_DEBLOCKING_PARAMETERS params; memset(¶ms, 0, sizeof(params)); - set_lpf_parameters(¶ms, pCurr, (cm->mi_stride << scaleVert), cm, - HORZ_EDGE, cuX + x * MI_SIZE, cuY + y * MI_SIZE, width, - height, plane, pPlane, scaleHorz, scaleVert); - switch (params.filterLength) { + + set_lpf_parameters(¶ms, (cm->mi_stride << scale_vert), cm, HORZ_EDGE, + curr_x, curr_y, plane, plane_ptr); + +#if CONFIG_LPF_DIRECT + uint8_t *const src = plane_ptr->dst.buf0; + const int width = cm->width >> scale_horz; + const int height = cm->height >> scale_vert; + const int pivot = 8; + const int line_length = 16; + uint8_t block[256]; + int orig_pos[256]; + const int vert_or_horz = 1; // 1: horizontal + const int unit = 1; + int i; + for (i = 0; i < 256; ++i) { + block[i] = 0; + orig_pos[i] = -1; + } + + if (params.filter_length) { + const int filt_len = params.filter_length == 16 ? 8 : 4; + const int direct = + pick_min_grad_direct(src, filt_len, curr_y, curr_x, width, height, + dst_stride, unit, vert_or_horz); + + pick_filter_block_horz(src, block, orig_pos, filt_len, curr_y, curr_x, + width, height, dst_stride, pivot, line_length, + unit, direct); + uint8_t *const filt_start = block + pivot * line_length; + switch (params.filter_length) { + // apply 4-tap filtering + case 4: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_horizontal_4(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // apply 8-tap filtering + case 8: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_horizontal_8(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_horizontal_8(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // apply 16-tap filtering + case 16: +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_horizontal_edge_16( + CONVERT_TO_SHORTPTR(filt_start), line_length, params.mblim, + params.lim, params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_horizontal_edge_16(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + break; + // no filtering + default: break; + } + + for (i = 0; i < 256; ++i) { + if (orig_pos[i] >= 0) src[orig_pos[i]] = block[i]; + } + } + if (params.filter_length_internal) { + for (i = 0; i < 256; ++i) { + block[i] = 0; + orig_pos[i] = -1; + } + + const int direct = + pick_min_grad_direct(src, 4, curr_y + 4, curr_x, width, height, + dst_stride, unit, vert_or_horz); + + pick_filter_block_horz(src, block, orig_pos, 4, curr_y + 4, curr_x, + width, height, dst_stride, pivot, line_length, + unit, direct); + + uint8_t *const filt_start = block + pivot * line_length; +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(filt_start), + line_length, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_horizontal_4(filt_start, line_length, params.mblim, + params.lim, params.hev_thr); + + for (i = 0; i < 256; ++i) { + if (orig_pos[i] >= 0) src[orig_pos[i]] = block[i]; + } + } +#else // !CONFIG_LPF_DIRECT + switch (params.filter_length) { // apply 4-tap filtering case 4: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p), dstStride, + aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(p), dst_stride, + params.mblim, params.lim, + params.hev_thr, cm->bit_depth); + else +#endif // CONFIG_HIGHBITDEPTH + aom_lpf_horizontal_4(p, dst_stride, params.mblim, params.lim, + params.hev_thr); + break; +#if PARALLEL_DEBLOCKING_5_TAP_CHROMA + // apply 6-tap filtering + case 6: assert(plane != 0); +#if CONFIG_HIGHBITDEPTH + if (cm->use_highbitdepth) + aom_highbd_lpf_horizontal_6_c(CONVERT_TO_SHORTPTR(p), dst_stride, params.mblim, params.lim, params.hev_thr, cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_horizontal_4_c(p, dstStride, params.mblim, params.lim, + aom_lpf_horizontal_6_c(p, dst_stride, params.mblim, params.lim, params.hev_thr); break; +#endif // apply 8-tap filtering case 8: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_horizontal_8_c(CONVERT_TO_SHORTPTR(p), dstStride, - params.mblim, params.lim, - params.hev_thr, cm->bit_depth); + aom_highbd_lpf_horizontal_8(CONVERT_TO_SHORTPTR(p), dst_stride, + params.mblim, params.lim, + params.hev_thr, cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_horizontal_8_c(p, dstStride, params.mblim, params.lim, - params.hev_thr); + aom_lpf_horizontal_8(p, dst_stride, params.mblim, params.lim, + params.hev_thr); break; // apply 16-tap filtering case 16: #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) +#if CONFIG_DEBLOCK_13TAP + // TODO(olah): Remove _c once SIMD for 13-tap is available aom_highbd_lpf_horizontal_edge_16_c( - CONVERT_TO_SHORTPTR(p), dstStride, params.mblim, params.lim, + CONVERT_TO_SHORTPTR(p), dst_stride, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); +#else + aom_highbd_lpf_horizontal_edge_16( + CONVERT_TO_SHORTPTR(p), dst_stride, params.mblim, params.lim, params.hev_thr, cm->bit_depth); +#endif else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_horizontal_edge_16_c(p, dstStride, params.mblim, params.lim, - params.hev_thr); +#if CONFIG_DEBLOCK_13TAP + aom_lpf_horizontal_edge_16_c(p, dst_stride, params.mblim, + params.lim, params.hev_thr); +#else + aom_lpf_horizontal_edge_16(p, dst_stride, params.mblim, params.lim, + params.hev_thr); +#endif break; // no filtering default: break; } // process the internal edge - if (params.filterLengthInternal) { + if (params.filter_length_internal) { #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) - aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p + 4 * dstStride), - dstStride, params.mblim, params.lim, - params.hev_thr, cm->bit_depth); + aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(p + 4 * dst_stride), + dst_stride, params.mblim, params.lim, + params.hev_thr, cm->bit_depth); else #endif // CONFIG_HIGHBITDEPTH - aom_lpf_horizontal_4_c(p + 4 * dstStride, dstStride, params.mblim, - params.lim, params.hev_thr); + aom_lpf_horizontal_4(p + 4 * dst_stride, dst_stride, params.mblim, + params.lim, params.hev_thr); } +#endif // CONFIG_LPF_DIRECT // advance the destination pointer p += MI_SIZE; } @@ -3036,9 +3532,12 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm, #endif // CONFIG_PARALLEL_DEBLOCKING void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, - struct macroblockd_plane planes[MAX_MB_PLANE], - int start, int stop, int y_only) { -#if CONFIG_UV_LVL + struct macroblockd_plane *planes, int start, int stop, +#if CONFIG_LPF_SB + int col_start, int col_end, +#endif + int y_only) { +#if CONFIG_LOOPFILTER_LEVEL // y_only no longer has its original meaning. // Here it means which plane to filter // when y_only = {0, 1, 2}, it means we are searching for filter level for @@ -3047,8 +3546,15 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, const int plane_end = plane_start + 1; #else const int num_planes = y_only ? 1 : MAX_MB_PLANE; -#endif // CONFIG_UV_LVL + const int plane_start = 0; + const int plane_end = num_planes; +#endif // CONFIG_LOOPFILTER_LEVEL +#if !CONFIG_LPF_SB + const int col_start = 0; + const int col_end = cm->mi_cols; +#endif // CONFIG_LPF_SB int mi_row, mi_col; + int plane; #if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \ CONFIG_CB4X4 @@ -3062,19 +3568,13 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; #if CONFIG_VAR_TX for (int i = 0; i < MAX_MB_PLANE; ++i) - memset(cm->left_txfm_context[i], TX_32X32, MAX_MIB_SIZE - << TX_UNIT_HIGH_LOG2); + memset(cm->left_txfm_context[i], TX_32X32, + MAX_MIB_SIZE << TX_UNIT_HIGH_LOG2); #endif // CONFIG_VAR_TX for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->mib_size) { - int plane; - av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); -#if CONFIG_UV_LVL for (plane = plane_start; plane < plane_end; ++plane) { -#else - for (plane = 0; plane < num_planes; ++plane) { -#endif // CONFIG_UV_LVL av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col, mi_row, mi_col, plane); av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col, @@ -3086,38 +3586,20 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, // filter all vertical edges in every 64x64 super block for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { - MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { + for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) { av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); -#if CONFIG_UV_LVL - for (int planeIdx = plane_start; planeIdx < plane_end; ++planeIdx) { -#else - for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) { -#endif // CONFIG_UV_LVL - const int32_t scaleHorz = planes[planeIdx].subsampling_x; - const int32_t scaleVert = planes[planeIdx].subsampling_y; - av1_filter_block_plane_vert( - cm, planeIdx, &planes[planeIdx], (const MODE_INFO **)(mi + mi_col), - (mi_col * MI_SIZE) >> scaleHorz, (mi_row * MI_SIZE) >> scaleVert); + for (plane = plane_start; plane < plane_end; ++plane) { + av1_filter_block_plane_vert(cm, plane, &planes[plane], mi_row, mi_col); } } } // filter all horizontal edges in every 64x64 super block for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { - MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { + for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) { av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); -#if CONFIG_UV_LVL - for (int planeIdx = plane_start; planeIdx < plane_end; ++planeIdx) { -#else - for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) { -#endif // CONFIG_UV_LVL - const int32_t scaleHorz = planes[planeIdx].subsampling_x; - const int32_t scaleVert = planes[planeIdx].subsampling_y; - av1_filter_block_plane_horz( - cm, planeIdx, &planes[planeIdx], (const MODE_INFO **)(mi + mi_col), - (mi_col * MI_SIZE) >> scaleHorz, (mi_row * MI_SIZE) >> scaleVert); + for (plane = plane_start; plane < plane_end; ++plane) { + av1_filter_block_plane_horz(cm, plane, &planes[plane], mi_row, mi_col); } } } @@ -3127,30 +3609,20 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, #if CONFIG_PARALLEL_DEBLOCKING for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { - MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); // filter all vertical edges in every 64x64 super block - for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) { - const int32_t scaleHorz = planes[planeIdx].subsampling_x; - const int32_t scaleVert = planes[planeIdx].subsampling_y; - av1_filter_block_plane_vert( - cm, planeIdx, planes + planeIdx, (const MODE_INFO **)(mi + mi_col), - (mi_col * MI_SIZE) >> scaleHorz, (mi_row * MI_SIZE) >> scaleVert); + for (plane = plane_start; plane < plane_end; plane += 1) { + av1_filter_block_plane_vert(cm, plane, &planes[plane], mi_row, mi_col); } } } for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { - MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); // filter all horizontal edges in every 64x64 super block - for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) { - const int32_t scaleHorz = planes[planeIdx].subsampling_x; - const int32_t scaleVert = planes[planeIdx].subsampling_y; - av1_filter_block_plane_horz( - cm, planeIdx, planes + planeIdx, (const MODE_INFO **)(mi + mi_col), - (mi_col * MI_SIZE) >> scaleHorz, (mi_row * MI_SIZE) >> scaleVert); + for (plane = plane_start; plane < plane_end; plane += 1) { + av1_filter_block_plane_horz(cm, plane, &planes[plane], mi_row, mi_col); } } } @@ -3170,8 +3642,6 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { - int plane; - av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col); // TODO(JBB): Make setup_mask work for non 420. @@ -3205,13 +3675,60 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, } void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, - MACROBLOCKD *xd, int frame_filter_level, int y_only, - int partial_frame) { + MACROBLOCKD *xd, int frame_filter_level, +#if CONFIG_LOOPFILTER_LEVEL + int frame_filter_level_r, +#endif + int y_only, int partial_frame +#if CONFIG_LPF_SB + , + int mi_row, int mi_col +#endif + ) { int start_mi_row, end_mi_row, mi_rows_to_filter; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + int orig_filter_level[2] = { cm->lf.filter_level[0], cm->lf.filter_level[1] }; +#else int orig_filter_level = cm->lf.filter_level; #endif +#endif + +#if CONFIG_LPF_SB + if (partial_frame && !frame_filter_level) return; +#else +#if CONFIG_LOOPFILTER_LEVEL + if (!frame_filter_level && !frame_filter_level_r) return; +#else if (!frame_filter_level) return; +#endif +#endif // CONFIG_LPF_SB +#if CONFIG_LPF_SB + int start_mi_col; + int end_mi_col; + + // In the experiment of deblocking filtering per superblock. + // When partial_frame is 1, it indicates we are searching for the best filter + // level for current superblock. We reuse frame_filter_level as filter level + // for superblock, no longer for the whole frame. + // When partial_frame is 0, it's in the actual filtering stage for the frame + if (partial_frame) { + start_mi_row = AOMMAX(0, mi_row - FILT_BOUNDARY_MI_OFFSET); + start_mi_col = AOMMAX(0, mi_col - FILT_BOUNDARY_MI_OFFSET); + const int mi_row_range = mi_row - FILT_BOUNDARY_MI_OFFSET + MAX_MIB_SIZE; + const int mi_col_range = mi_col - FILT_BOUNDARY_MI_OFFSET + MAX_MIB_SIZE; + end_mi_row = AOMMIN(mi_row_range, cm->mi_rows); + end_mi_col = AOMMIN(mi_col_range, cm->mi_cols); + + av1_loop_filter_sb_level_init(cm, mi_row, mi_col, frame_filter_level); + } else { + start_mi_row = 0; + mi_rows_to_filter = cm->mi_rows; + end_mi_row = start_mi_row + mi_rows_to_filter; + start_mi_col = 0; + end_mi_col = cm->mi_cols; + } +#else start_mi_row = 0; mi_rows_to_filter = cm->mi_rows; if (partial_frame && cm->mi_rows > 8) { @@ -3220,19 +3737,46 @@ void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, mi_rows_to_filter = AOMMAX(cm->mi_rows / 8, 8); } end_mi_row = start_mi_row + mi_rows_to_filter; - av1_loop_filter_frame_init(cm, frame_filter_level); +#if CONFIG_LOOPFILTER_LEVEL + // TODO(chengchen): refactor the code such that y_only has its matching + // meaning. Now it means the plane to be filtered in this experiment. + av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level_r, + y_only); +#else + av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level); +#endif +#endif // CONFIG_LPF_SB + #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + cm->lf.filter_level[0] = frame_filter_level; + cm->lf.filter_level[1] = frame_filter_level_r; +#else cm->lf.filter_level = frame_filter_level; #endif +#endif + +#if CONFIG_LPF_SB + av1_loop_filter_rows(frame, cm, xd->plane, start_mi_row, end_mi_row, + start_mi_col, end_mi_col, y_only); +#else av1_loop_filter_rows(frame, cm, xd->plane, start_mi_row, end_mi_row, y_only); +#endif // CONFIG_LPF_SB + #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + cm->lf.filter_level[0] = orig_filter_level[0]; + cm->lf.filter_level[1] = orig_filter_level[1]; +#else cm->lf.filter_level = orig_filter_level; #endif +#endif } -void av1_loop_filter_data_reset( - LFWorkerData *lf_data, YV12_BUFFER_CONFIG *frame_buffer, - struct AV1Common *cm, const struct macroblockd_plane planes[MAX_MB_PLANE]) { +void av1_loop_filter_data_reset(LFWorkerData *lf_data, + YV12_BUFFER_CONFIG *frame_buffer, + struct AV1Common *cm, + const struct macroblockd_plane *planes) { lf_data->frame_buffer = frame_buffer; lf_data->cm = cm; lf_data->start = 0; @@ -3243,7 +3787,11 @@ void av1_loop_filter_data_reset( int av1_loop_filter_worker(LFWorkerData *const lf_data, void *unused) { (void)unused; +#if !CONFIG_LPF_SB av1_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, lf_data->planes, lf_data->start, lf_data->stop, lf_data->y_only); +#else + (void)lf_data; +#endif // CONFIG_LPF_SB return 1; } diff --git a/third_party/aom/av1/common/av1_loopfilter.h b/third_party/aom/av1/common/av1_loopfilter.h index 043081e57..ee32c368c 100644 --- a/third_party/aom/av1/common/av1_loopfilter.h +++ b/third_party/aom/av1/common/av1_loopfilter.h @@ -36,10 +36,12 @@ enum lf_path { }; struct loopfilter { - int filter_level; -#if CONFIG_UV_LVL +#if CONFIG_LOOPFILTER_LEVEL + int filter_level[2]; int filter_level_u; int filter_level_v; +#else + int filter_level; #endif int sharpness_level; @@ -49,14 +51,13 @@ struct loopfilter { uint8_t mode_ref_delta_update; // 0 = Intra, Last, Last2+Last3(CONFIG_EXT_REFS), - // GF, BRF(CONFIG_EXT_REFS), - // ARF2(CONFIG_EXT_REFS+CONFIG_ALTREF2), ARF - signed char ref_deltas[TOTAL_REFS_PER_FRAME]; - signed char last_ref_deltas[TOTAL_REFS_PER_FRAME]; + // GF, BRF(CONFIG_EXT_REFS), ARF2(CONFIG_EXT_REFS), ARF + int8_t ref_deltas[TOTAL_REFS_PER_FRAME]; + int8_t last_ref_deltas[TOTAL_REFS_PER_FRAME]; // 0 = ZERO_MV, MV - signed char mode_deltas[MAX_MODE_LF_DELTAS]; - signed char last_mode_deltas[MAX_MODE_LF_DELTAS]; + int8_t mode_deltas[MAX_MODE_LF_DELTAS]; + int8_t last_mode_deltas[MAX_MODE_LF_DELTAS]; }; // Need to align this structure so when it is declared and @@ -69,7 +70,11 @@ typedef struct { typedef struct { loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1]; +#if CONFIG_LOOPFILTER_LEVEL + uint8_t lvl[MAX_SEGMENTS][2][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS]; +#else uint8_t lvl[MAX_SEGMENTS][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS]; +#endif } loop_filter_info_n; // This structure holds bit masks for all 8x8 blocks in a 64x64 region. @@ -132,17 +137,42 @@ void av1_loop_filter_init(struct AV1Common *cm); // This should be called before av1_loop_filter_rows(), // av1_loop_filter_frame() // calls this function directly. -void av1_loop_filter_frame_init(struct AV1Common *cm, int default_filt_lvl); +void av1_loop_filter_frame_init(struct AV1Common *cm, int default_filt_lvl, + int default_filt_lvl_r +#if CONFIG_LOOPFILTER_LEVEL + , + int plane +#endif + ); + +#if CONFIG_LPF_SB +void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, + struct macroblockd *mbd, int filter_level, + int y_only, int partial_frame, int mi_row, + int mi_col); + +// Apply the loop filter to [start, stop) macro block rows in frame_buffer. +void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, + struct AV1Common *cm, + struct macroblockd_plane *planes, int start, int stop, + int col_start, int col_end, int y_only); +void av1_loop_filter_sb_level_init(struct AV1Common *cm, int mi_row, int mi_col, + int lvl); +#else void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, struct macroblockd *mbd, int filter_level, +#if CONFIG_LOOPFILTER_LEVEL + int filter_level_r, +#endif int y_only, int partial_frame); // Apply the loop filter to [start, stop) macro block rows in frame_buffer. void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, struct AV1Common *cm, - struct macroblockd_plane planes[MAX_MB_PLANE], - int start, int stop, int y_only); + struct macroblockd_plane *planes, int start, int stop, + int y_only); +#endif // CONFIG_LPF_SB typedef struct LoopFilterWorkerData { YV12_BUFFER_CONFIG *frame_buffer; @@ -154,9 +184,10 @@ typedef struct LoopFilterWorkerData { int y_only; } LFWorkerData; -void av1_loop_filter_data_reset( - LFWorkerData *lf_data, YV12_BUFFER_CONFIG *frame_buffer, - struct AV1Common *cm, const struct macroblockd_plane planes[MAX_MB_PLANE]); +void av1_loop_filter_data_reset(LFWorkerData *lf_data, + YV12_BUFFER_CONFIG *frame_buffer, + struct AV1Common *cm, + const struct macroblockd_plane *planes); // Operates on the rows described by 'lf_data'. int av1_loop_filter_worker(LFWorkerData *const lf_data, void *unused); diff --git a/third_party/aom/av1/common/av1_rtcd_defs.pl b/third_party/aom/av1/common/av1_rtcd_defs.pl index 88e9ea4d8..203426e59 100755 --- a/third_party/aom/av1/common/av1_rtcd_defs.pl +++ b/third_party/aom/av1/common/av1_rtcd_defs.pl @@ -24,7 +24,6 @@ struct search_site_config; struct mv; union int_mv; struct yv12_buffer_config; -typedef uint16_t od_dering_in; EOF } forward_decls qw/av1_common_forward_decls/; @@ -64,86 +63,94 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { # Inverse dct # if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - { - add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht4x4_16_add sse2/; + add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht4x4_16_add sse2/; - add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht4x8_32_add sse2/; + add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht4x8_32_add sse2/; - add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x4_32_add sse2/; + add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht8x4_32_add sse2/; - add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x16_128_add sse2/; + add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht8x16_128_add sse2/; - add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht16x8_128_add sse2/; + add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht16x8_128_add sse2/; - add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht16x32_512_add sse2/; + add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht16x32_512_add sse2/; - add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht32x16_512_add sse2/; + add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht32x16_512_add sse2/; - add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x8_64_add sse2/; + add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht8x8_64_add sse2/; - add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; - specialize qw/av1_iht16x16_256_add sse2 avx2/; + add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; + specialize qw/av1_iht16x16_256_add sse2 avx2/; - add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; - } + add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; } else { - { - add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht4x4_16_add sse2 neon dspr2/; + add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { + specialize qw/av1_iht4x4_16_add sse2 neon/; + } - add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht4x8_32_add sse2/; + add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht4x8_32_add sse2/; - add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x4_32_add sse2/; + add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht8x4_32_add sse2/; - add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x16_128_add sse2/; + add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht8x16_128_add sse2/; - add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht16x8_128_add sse2/; + add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht16x8_128_add sse2/; - add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht16x32_512_add sse2/; + add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht16x32_512_add sse2/; - add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht32x16_512_add sse2/; + add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + specialize qw/av1_iht32x16_512_add sse2/; - add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; - specialize qw/av1_iht8x8_64_add sse2 neon dspr2/; + add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { + specialize qw/av1_iht8x8_64_add sse2 neon/; + } - add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; - specialize qw/av1_iht16x16_256_add sse2 avx2 dspr2/; + add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { + specialize qw/av1_iht16x16_256_add sse2 avx2/; + } - add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; + add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; - if (aom_config("CONFIG_EXT_TX") ne "yes") { + if (aom_config("CONFIG_EXT_TX") ne "yes") { + if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { specialize qw/av1_iht4x4_16_add msa/; + } + if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { specialize qw/av1_iht8x8_64_add msa/; + } + if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { specialize qw/av1_iht16x16_256_add msa/; } } @@ -153,6 +160,8 @@ add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *out if (aom_config("CONFIG_TX64X64") eq "yes") { add_proto qw/void av1_iht64x64_4096_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; + add_proto qw/void av1_iht32x64_2048_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; + add_proto qw/void av1_iht64x32_2048_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param"; } if (aom_config("CONFIG_NEW_QUANT") eq "yes") { @@ -256,63 +265,41 @@ 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"; +add_proto qw/void av1_inv_txfm2d_add_4x8/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_8x4/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_8x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_16x8/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_16x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_32x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +add_proto qw/void av1_inv_txfm2d_add_4x4/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { + 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, TX_TYPE tx_type, int bd"; +if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { + 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, TX_TYPE tx_type, int bd"; +if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { + 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, TX_TYPE tx_type, int bd"; +if (aom_config("CONFIG_DAALA_DCT32") ne "yes") { + specialize qw/av1_inv_txfm2d_add_32x32 avx2/; +} +if (aom_config("CONFIG_TX64X64") eq "yes") { + add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_inv_txfm2d_add_64x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_inv_txfm2d_add_32x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd"; +} # # Encoder functions below this point. # if (aom_config("CONFIG_AV1_ENCODER") eq "yes") { -# ENCODEMB INVOKE - -if (aom_config("CONFIG_AOM_QM") eq "yes") { - if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - # the transform coefficients are held in 32-bit - # values, so the assembler code for av1_block_error can no longer be used. - add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz"; - specialize qw/av1_block_error avx2/; - - add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - - add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - - if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - } - - add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - } else { - add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz"; - specialize qw/av1_block_error avx2 msa/, "$sse2_x86inc"; - - add_proto qw/int64_t av1_block_error_fp/, "const int16_t *coeff, const int16_t *dqcoeff, int block_size"; - specialize qw/av1_block_error_fp neon/, "$sse2_x86inc"; - - add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - - add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - - if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - } + # ENCODEMB INVOKE - add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr"; - } -} else { if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { # the transform coefficients are held in 32-bit # values, so the assembler code for av1_block_error can no longer be used. @@ -328,8 +315,6 @@ if (aom_config("CONFIG_AOM_QM") eq "yes") { if (aom_config("CONFIG_TX64X64") eq "yes") { add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan"; } - - add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan"; } else { add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz"; specialize qw/av1_block_error sse2 avx2 msa/; @@ -347,249 +332,257 @@ if (aom_config("CONFIG_AOM_QM") eq "yes") { add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan"; } - add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan"; - specialize qw/av1_fdct8x8_quant sse2 ssse3 neon/; } -} - -# fdct functions + # fdct functions -add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht4x4 sse2/; + add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { + specialize qw/av1_fht4x4 sse2/; + } -add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; + add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; -add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht8x8 sse2/; + add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { + specialize qw/av1_fht8x8 sse2/; + } -add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht16x16 sse2 avx2/; + add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { + specialize qw/av1_fht16x16 sse2 avx2/; + } -add_proto qw/void av1_fht32x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht32x32 sse2 avx2/; + add_proto qw/void av1_fht32x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + if (aom_config("CONFIG_DAALA_DCT32") ne "yes") { + specialize qw/av1_fht32x32 sse2 avx2/; + } -if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void av1_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -} + if (aom_config("CONFIG_TX64X64") eq "yes") { + add_proto qw/void av1_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht64x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht32x64/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + } -add_proto qw/void av1_fht4x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht4x8 sse2/; + add_proto qw/void av1_fht4x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht4x8 sse2/; -add_proto qw/void av1_fht8x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht8x4 sse2/; + add_proto qw/void av1_fht8x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht8x4 sse2/; -add_proto qw/void av1_fht8x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht8x16 sse2/; + add_proto qw/void av1_fht8x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht8x16 sse2/; -add_proto qw/void av1_fht16x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht16x8 sse2/; + add_proto qw/void av1_fht16x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht16x8 sse2/; -add_proto qw/void av1_fht16x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht16x32 sse2/; + add_proto qw/void av1_fht16x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht16x32 sse2/; -add_proto qw/void av1_fht32x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -specialize qw/av1_fht32x16 sse2/; + add_proto qw/void av1_fht32x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht32x16 sse2/; -add_proto qw/void av1_fht4x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht4x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -add_proto qw/void av1_fht16x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht16x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -add_proto qw/void av1_fht8x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht8x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -add_proto qw/void av1_fht32x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + add_proto qw/void av1_fht32x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; -if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") { - if (aom_config("CONFIG_EXT_TX") ne "yes") { - specialize qw/av1_fht4x4 msa/; - specialize qw/av1_fht8x8 msa/; - specialize qw/av1_fht16x16 msa/; + if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") { + if (aom_config("CONFIG_EXT_TX") ne "yes") { + if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { + specialize qw/av1_fht4x4 msa/; + } + if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { + specialize qw/av1_fht8x8 msa/; + } + if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { + specialize qw/av1_fht16x16 msa/; + } + } } -} -add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bs, int tx_type"; - -if (aom_config("CONFIG_DPCM_INTRA") eq "yes") { - @sizes = (4, 8, 16, 32); - foreach $size (@sizes) { - if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - add_proto "void", "av1_hbd_dpcm_ft$size", "const int16_t *input, int stride, TX_TYPE_1D tx_type, tran_low_t *output, int dir"; - } - add_proto "void", "av1_dpcm_ft$size", "const int16_t *input, int stride, TX_TYPE_1D tx_type, tran_low_t *output"; + add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bsx, int bsy, TX_TYPE tx_type"; + + #fwd txfm + add_proto qw/void av1_fwd_txfm2d_4x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_8x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_8x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_16x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_16x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_32x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + if (aom_config("CONFIG_DAALA_DCT4") ne "yes") { + specialize qw/av1_fwd_txfm2d_4x4 sse4_1/; + } + add_proto qw/void av1_fwd_txfm2d_8x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + if (aom_config("CONFIG_DAALA_DCT8") ne "yes") { + specialize qw/av1_fwd_txfm2d_8x8 sse4_1/; + } + add_proto qw/void av1_fwd_txfm2d_16x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + if (aom_config("CONFIG_DAALA_DCT16") ne "yes") { + specialize qw/av1_fwd_txfm2d_16x16 sse4_1/; + } + add_proto qw/void av1_fwd_txfm2d_32x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + if (aom_config("CONFIG_DAALA_DCT32") ne "yes") { + specialize qw/av1_fwd_txfm2d_32x32 sse4_1/; } -} -#fwd txfm -add_proto qw/void av1_fwd_txfm2d_4x8/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_8x4/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_8x16/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_16x8/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_16x32/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_32x16/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -specialize qw/av1_fwd_txfm2d_4x4 sse4_1/; -add_proto qw/void av1_fwd_txfm2d_8x8/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -specialize qw/av1_fwd_txfm2d_8x8 sse4_1/; -add_proto qw/void av1_fwd_txfm2d_16x16/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -specialize qw/av1_fwd_txfm2d_16x16 sse4_1/; -add_proto qw/void av1_fwd_txfm2d_32x32/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -specialize qw/av1_fwd_txfm2d_32x32 sse4_1/; -add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd"; -specialize qw/av1_fwd_txfm2d_64x64 sse4_1/; + if (aom_config("CONFIG_TX64X64") eq "yes") { + add_proto qw/void av1_fwd_txfm2d_32x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_64x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd"; + } + # + # Motion search + # + add_proto qw/int av1_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv"; + specialize qw/av1_full_search_sad sse3 sse4_1/; + $av1_full_search_sad_sse3=av1_full_search_sadx3; + $av1_full_search_sad_sse4_1=av1_full_search_sadx8; -# -# Motion search -# -add_proto qw/int av1_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv"; -specialize qw/av1_full_search_sad sse3 sse4_1/; -$av1_full_search_sad_sse3=av1_full_search_sadx3; -$av1_full_search_sad_sse4_1=av1_full_search_sadx8; + add_proto qw/int av1_diamond_search_sad/, "struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv"; -add_proto qw/int av1_diamond_search_sad/, "struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv"; + add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv"; -add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv"; + add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; + specialize qw/av1_temporal_filter_apply sse2 msa/; -add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; -specialize qw/av1_temporal_filter_apply sse2 msa/; + if (aom_config("CONFIG_AOM_QM") eq "yes") { + add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; + } else { + add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale"; + } -if (aom_config("CONFIG_AOM_QM") eq "yes") { - add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; -} else { - add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale"; -} + if (aom_config("CONFIG_LGT_FROM_PRED") eq "yes") { + add_proto qw/void flgt2d_from_pred/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + } -if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { + if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - # ENCODEMB INVOKE - if (aom_config("CONFIG_NEW_QUANT") eq "yes") { - add_proto qw/void highbd_quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + # ENCODEMB INVOKE + if (aom_config("CONFIG_NEW_QUANT") eq "yes") { + add_proto qw/void highbd_quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; - add_proto qw/void highbd_quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + add_proto qw/void highbd_quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; - add_proto qw/void highbd_quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + add_proto qw/void highbd_quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; - add_proto qw/void highbd_quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + add_proto qw/void highbd_quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; - if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void highbd_quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + if (aom_config("CONFIG_TX64X64") eq "yes") { + add_proto qw/void highbd_quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; - add_proto qw/void highbd_quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + add_proto qw/void highbd_quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band"; + } } - } - - add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd"; - specialize qw/av1_highbd_block_error sse2/; - # fdct functions - if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void av1_highbd_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, int tx_type"; - } + add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd"; + specialize qw/av1_highbd_block_error sse2/; - add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; + add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"; -} - -if (aom_config("CONFIG_AOM_QM") eq "yes") { - add_proto qw/void av1_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; - - add_proto qw/void av1_highbd_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; - - if (aom_config("CONFIG_TX64X64") eq "yes") { - add_proto qw/void av1_highbd_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; } - add_proto qw/void av1_highbd_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale"; -} else { add_proto qw/void av1_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale"; specialize qw/av1_highbd_quantize_fp sse4_1 avx2/; - add_proto qw/void av1_highbd_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale"; -} - -add_proto qw/void av1_highbd_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; + add_proto qw/void av1_highbd_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; -# End av1_high encoder functions + # End av1_high encoder functions -if (aom_config("CONFIG_EXT_INTER") eq "yes") { add_proto qw/uint64_t av1_wedge_sse_from_residuals/, "const int16_t *r1, const int16_t *d, const uint8_t *m, int N"; specialize qw/av1_wedge_sse_from_residuals sse2/; add_proto qw/int av1_wedge_sign_from_residuals/, "const int16_t *ds, const uint8_t *m, int N, int64_t limit"; specialize qw/av1_wedge_sign_from_residuals sse2/; add_proto qw/void av1_wedge_compute_delta_squares/, "int16_t *d, const int16_t *a, const int16_t *b, int N"; specialize qw/av1_wedge_compute_delta_squares sse2/; -} } # end encoder functions # If PVQ is enabled, fwd transforms are required by decoder if (aom_config("CONFIG_PVQ") eq "yes") { -# fdct functions + # fdct functions -if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { - add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht4x4 sse2/; + if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { + add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht4x4 sse2/; - add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht8x8 sse2/; + add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht8x8 sse2/; - add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht16x16 sse2/; + add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht16x16 sse2/; - add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; - specialize qw/av1_fwht4x4 sse2/; -} else { - add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht4x4 sse2 msa/; + add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; + specialize qw/av1_fwht4x4 sse2/; + } else { + add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht4x4 sse2 msa/; - add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht8x8 sse2 msa/; + add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht8x8 sse2 msa/; - add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; - specialize qw/av1_fht16x16 sse2 msa/; + add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param"; + specialize qw/av1_fht16x16 sse2 msa/; - add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; - specialize qw/av1_fwht4x4 msa sse2/; -} + add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride"; + specialize qw/av1_fwht4x4 msa sse2/; + } } # Deringing Functions if (aom_config("CONFIG_CDEF") eq "yes") { - add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; - add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; - add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; - add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; - add_proto qw/int od_dir_find8/, "const od_dering_in *img, int stride, int32_t *var, int coeff_shift"; - add_proto qw/void od_filter_dering_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping"; - add_proto qw/void od_filter_dering_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping"; - - add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride"; - add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride"; - add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride"; - add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride"; + add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift"; + if (aom_config("CONFIG_CDEF_SINGLEPASS") ne "yes") { + add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; + add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; + add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; + add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd"; + add_proto qw/void cdef_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping"; + add_proto qw/void cdef_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping"; + add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride"; + add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride"; + add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride"; + add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride"; + } else { + add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max"; + } + add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h"; add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h"; -# VS compiling for 32 bit targets does not support vector types in + # VS compiling for 32 bit targets does not support vector types in # structs as arguments, which makes the v256 type of the intrinsics # hard to support, so optimizations for this target are disabled. if ($opts{config} !~ /libs-x86-win32-vs.*/) { - specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/; - specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/; - specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/; - specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/; - specialize qw/od_dir_find8 sse2 ssse3 sse4_1 neon/; - specialize qw/od_filter_dering_direction_4x4 sse2 ssse3 sse4_1 neon/; - specialize qw/od_filter_dering_direction_8x8 sse2 ssse3 sse4_1 neon/; - - specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/; - specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/; - specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/; - specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/; - specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/; - specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/; + if (aom_config("CONFIG_CDEF_SINGLEPASS") eq "yes") { + specialize qw/cdef_find_dir sse2 ssse3 sse4_1 avx2 neon/; + specialize qw/cdef_filter_block sse2 ssse3 sse4_1 avx2 neon/; + specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/; + specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/; + } else { + specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/; + specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/; + specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/; + specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/; + specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/; + specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/; + specialize qw/cdef_direction_4x4 sse2 ssse3 sse4_1 neon/; + specialize qw/cdef_direction_8x8 sse2 ssse3 sse4_1 neon/; + + specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/; + specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/; + specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/; + specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/; + specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/; + specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/; + } } } @@ -607,16 +600,9 @@ if ((aom_config("CONFIG_WARPED_MOTION") eq "yes") || add_proto qw/void av1_warp_affine/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta"; specialize qw/av1_warp_affine sse2 ssse3/; - if (aom_config("CONFIG_CONVOLVE_ROUND") eq "yes") { - add_proto qw/void av1_warp_affine_post_round/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta"; - } - if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { add_proto qw/void av1_highbd_warp_affine/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta"; specialize qw/av1_highbd_warp_affine ssse3/; - if (aom_config("CONFIG_CONVOLVE_ROUND") eq "yes") { - add_proto qw/void av1_highbd_warp_affine_post_round/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta"; - } } } @@ -632,7 +618,7 @@ if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") { add_proto qw/void apply_selfguided_restoration/, "uint8_t *dat, int width, int height, int stride, int eps, int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf"; specialize qw/apply_selfguided_restoration sse4_1/; - add_proto qw/void av1_selfguided_restoration/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps, int32_t *tmpbuf"; + add_proto qw/void av1_selfguided_restoration/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps"; specialize qw/av1_selfguided_restoration sse4_1/; add_proto qw/void av1_highpass_filter/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps"; @@ -642,7 +628,7 @@ if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") { add_proto qw/void apply_selfguided_restoration_highbd/, "uint16_t *dat, int width, int height, int stride, int bit_depth, int eps, int *xqd, uint16_t *dst, int dst_stride, int32_t *tmpbuf"; specialize qw/apply_selfguided_restoration_highbd sse4_1/; - add_proto qw/void av1_selfguided_restoration_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int bit_depth, int r, int eps, int32_t *tmpbuf"; + add_proto qw/void av1_selfguided_restoration_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int bit_depth, int r, int eps"; specialize qw/av1_selfguided_restoration_highbd sse4_1/; add_proto qw/void av1_highpass_filter_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps"; @@ -653,17 +639,40 @@ if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") { # CONVOLVE_ROUND/COMPOUND_ROUND functions if (aom_config("CONFIG_CONVOLVE_ROUND") eq "yes") { - add_proto qw/void av1_convolve_2d/, "const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params"; - specialize qw/av1_convolve_2d sse2/; - add_proto qw/void av1_convolve_rounding/, "const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits"; - specialize qw/av1_convolve_rounding avx2/; + add_proto qw/void av1_convolve_2d/, "const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params"; + specialize qw/av1_convolve_2d sse2/; + add_proto qw/void av1_convolve_rounding/, "const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits"; + specialize qw/av1_convolve_rounding avx2/; + + add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params"; + if (aom_config("CONFIG_COMPOUND_ROUND") ne "yes") { + specialize qw/av1_convolve_2d_scale sse4_1/; + } if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { add_proto qw/void av1_highbd_convolve_2d/, "const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd"; specialize qw/av1_highbd_convolve_2d ssse3/; add_proto qw/void av1_highbd_convolve_rounding/, "const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits, int bd"; specialize qw/av1_highbd_convolve_rounding avx2/; + + add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd"; + if (aom_config("CONFIG_COMPOUND_ROUND") ne "yes") { + specialize qw/av1_highbd_convolve_2d_scale sse4_1/; + } + } +} + +# INTRA_EDGE functions +if (aom_config("CONFIG_INTRA_EDGE") eq "yes") { + add_proto qw/void av1_filter_intra_edge/, "uint8_t *p, int sz, int strength"; + specialize qw/av1_filter_intra_edge sse4_1/; + add_proto qw/void av1_upsample_intra_edge/, "uint8_t *p, int sz"; + specialize qw/av1_upsample_intra_edge sse4_1/; + if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") { + add_proto qw/void av1_filter_intra_edge_high/, "uint16_t *p, int sz, int strength"; + specialize qw/av1_filter_intra_edge_high sse4_1/; + add_proto qw/void av1_upsample_intra_edge_high/, "uint16_t *p, int sz, int bd"; + specialize qw/av1_upsample_intra_edge_high sse4_1/; } } -1; diff --git a/third_party/aom/av1/common/av1_txfm.h b/third_party/aom/av1/common/av1_txfm.h index 269ef5705..bd365de59 100644 --- a/third_party/aom/av1/common/av1_txfm.h +++ b/third_party/aom/av1/common/av1_txfm.h @@ -17,9 +17,16 @@ #include <stdio.h> #include "av1/common/enums.h" +#include "av1/common/blockd.h" #include "aom/aom_integer.h" #include "aom_dsp/aom_dsp_common.h" +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_TXFM_STAGE_NUM 12 + static const int cos_bit_min = 10; static const int cos_bit_max = 16; @@ -110,27 +117,6 @@ static INLINE int32_t half_btf(int32_t w0, int32_t in0, int32_t w1, int32_t in1, return round_shift(result_32, bit); } -static INLINE int get_max_bit(int x) { - int max_bit = -1; - while (x) { - x = x >> 1; - max_bit++; - } - return max_bit; -} - -// TODO(angiebird): implement SSE -static INLINE void clamp_block(int16_t *block, int block_size_row, - int block_size_col, int stride, int low, - int high) { - int i, j; - for (i = 0; i < block_size_row; ++i) { - for (j = 0; j < block_size_col; ++j) { - block[i * stride + j] = clamp(block[i * stride + j], low, high); - } - } -} - typedef void (*TxfmFunc)(const int32_t *input, int32_t *output, const int8_t *cos_bit, const int8_t *stage_range); @@ -148,6 +134,7 @@ typedef enum TXFM_TYPE { TXFM_TYPE_IDENTITY8, TXFM_TYPE_IDENTITY16, TXFM_TYPE_IDENTITY32, + TXFM_TYPE_IDENTITY64, } TXFM_TYPE; typedef struct TXFM_1D_CFG { @@ -167,7 +154,7 @@ typedef struct TXFM_2D_FLIP_CFG { const TXFM_1D_CFG *row_cfg; } TXFM_2D_FLIP_CFG; -static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) { +static INLINE void set_flip_cfg(TX_TYPE tx_type, TXFM_2D_FLIP_CFG *cfg) { switch (tx_type) { case DCT_DCT: case ADST_DCT: @@ -209,21 +196,171 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) { } } +#if CONFIG_TXMG +static INLINE TX_SIZE av1_rotate_tx_size(TX_SIZE tx_size) { + switch (tx_size) { +#if CONFIG_CHROMA_2X2 + case TX_2X2: return TX_2X2; +#endif + case TX_4X4: return TX_4X4; + case TX_8X8: return TX_8X8; + case TX_16X16: return TX_16X16; + case TX_32X32: return TX_32X32; +#if CONFIG_TX64X64 + case TX_64X64: return TX_64X64; + case TX_32X64: return TX_64X32; + case TX_64X32: return TX_32X64; +#endif + case TX_4X8: return TX_8X4; + case TX_8X4: return TX_4X8; + case TX_8X16: return TX_16X8; + case TX_16X8: return TX_8X16; + case TX_16X32: return TX_32X16; + case TX_32X16: return TX_16X32; + case TX_4X16: return TX_16X4; + case TX_16X4: return TX_4X16; + case TX_8X32: return TX_32X8; + case TX_32X8: return TX_8X32; + default: assert(0); return TX_INVALID; + } +} + +static INLINE TX_TYPE av1_rotate_tx_type(TX_TYPE tx_type) { + switch (tx_type) { + case DCT_DCT: return DCT_DCT; + case ADST_DCT: return DCT_ADST; + case DCT_ADST: return ADST_DCT; + case ADST_ADST: return ADST_ADST; +#if CONFIG_EXT_TX + case FLIPADST_DCT: return DCT_FLIPADST; + case DCT_FLIPADST: return FLIPADST_DCT; + case FLIPADST_FLIPADST: return FLIPADST_FLIPADST; + case ADST_FLIPADST: return FLIPADST_ADST; + case FLIPADST_ADST: return ADST_FLIPADST; + case IDTX: return IDTX; + case V_DCT: return H_DCT; + case H_DCT: return V_DCT; + case V_ADST: return H_ADST; + case H_ADST: return V_ADST; + case V_FLIPADST: return H_FLIPADST; + case H_FLIPADST: return V_FLIPADST; +#endif // CONFIG_EXT_TX +#if CONFIG_MRC_TX + case MRC_DCT: return MRC_DCT; +#endif // CONFIG_MRC_TX + default: assert(0); return TX_TYPES; + } +} +#endif // CONFIG_TXMG + #if CONFIG_MRC_TX -static INLINE void get_mrc_mask(const uint8_t *pred, int pred_stride, int *mask, - int mask_stride, int width, int height) { +static INLINE int get_mrc_diff_mask_inter(const int16_t *diff, int diff_stride, + uint8_t *mask, int mask_stride, + int width, int height) { + // placeholder mask generation function + assert(SIGNAL_MRC_MASK_INTER); + int n_masked_vals = 0; for (int i = 0; i < height; ++i) { - for (int j = 0; j < width; ++j) + for (int j = 0; j < width; ++j) { + mask[i * mask_stride + j] = diff[i * diff_stride + j] > 100 ? 1 : 0; + n_masked_vals += mask[i * mask_stride + j]; + } + } + return n_masked_vals; +} + +static INLINE int get_mrc_pred_mask_inter(const uint8_t *pred, int pred_stride, + uint8_t *mask, int mask_stride, + int width, int height) { + // placeholder mask generation function + int n_masked_vals = 0; + for (int i = 0; i < height; ++i) { + for (int j = 0; j < width; ++j) { + mask[i * mask_stride + j] = pred[i * pred_stride + j] > 100 ? 1 : 0; + n_masked_vals += mask[i * mask_stride + j]; + } + } + return n_masked_vals; +} + +static INLINE int get_mrc_diff_mask_intra(const int16_t *diff, int diff_stride, + uint8_t *mask, int mask_stride, + int width, int height) { + // placeholder mask generation function + assert(SIGNAL_MRC_MASK_INTRA); + int n_masked_vals = 0; + for (int i = 0; i < height; ++i) { + for (int j = 0; j < width; ++j) { + mask[i * mask_stride + j] = diff[i * diff_stride + j] > 100 ? 1 : 0; + n_masked_vals += mask[i * mask_stride + j]; + } + } + return n_masked_vals; +} + +static INLINE int get_mrc_pred_mask_intra(const uint8_t *pred, int pred_stride, + uint8_t *mask, int mask_stride, + int width, int height) { + // placeholder mask generation function + int n_masked_vals = 0; + for (int i = 0; i < height; ++i) { + for (int j = 0; j < width; ++j) { mask[i * mask_stride + j] = pred[i * pred_stride + j] > 100 ? 1 : 0; + n_masked_vals += mask[i * mask_stride + j]; + } + } + return n_masked_vals; +} + +static INLINE int get_mrc_diff_mask(const int16_t *diff, int diff_stride, + uint8_t *mask, int mask_stride, int width, + int height, int is_inter) { + if (is_inter) { + assert(USE_MRC_INTER && "MRC invalid for inter blocks"); + assert(SIGNAL_MRC_MASK_INTER); + return get_mrc_diff_mask_inter(diff, diff_stride, mask, mask_stride, width, + height); + } else { + assert(USE_MRC_INTRA && "MRC invalid for intra blocks"); + assert(SIGNAL_MRC_MASK_INTRA); + return get_mrc_diff_mask_intra(diff, diff_stride, mask, mask_stride, width, + height); + } +} + +static INLINE int get_mrc_pred_mask(const uint8_t *pred, int pred_stride, + uint8_t *mask, int mask_stride, int width, + int height, int is_inter) { + if (is_inter) { + assert(USE_MRC_INTER && "MRC invalid for inter blocks"); + return get_mrc_pred_mask_inter(pred, pred_stride, mask, mask_stride, width, + height); + } else { + assert(USE_MRC_INTRA && "MRC invalid for intra blocks"); + return get_mrc_pred_mask_intra(pred, pred_stride, mask, mask_stride, width, + height); } } + +static INLINE int is_valid_mrc_mask(int n_masked_vals, int width, int height) { + return !(n_masked_vals == 0 || n_masked_vals == (width * height)); +} #endif // CONFIG_MRC_TX -#ifdef __cplusplus -extern "C" { -#endif -TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(int tx_type, int tx_size); -TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type); +void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row, + const TXFM_2D_FLIP_CFG *cfg, int bd); + +void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row, + const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift, + int bd); + +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size); +#if CONFIG_TX64X64 +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(TX_TYPE tx_type); +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type); +TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type); +#endif // CONFIG_TX64X64 +TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size); #ifdef __cplusplus } #endif // __cplusplus diff --git a/third_party/aom/av1/common/blockd.h b/third_party/aom/av1/common/blockd.h index 8ea64628e..01a449a1c 100644 --- a/third_party/aom/av1/common/blockd.h +++ b/third_party/aom/av1/common/blockd.h @@ -31,9 +31,6 @@ #include "av1/common/pvq_state.h" #include "av1/decoder/decint.h" #endif -#if CONFIG_CFL -#include "av1/common/cfl.h" -#endif #ifdef __cplusplus extern "C" { #endif @@ -46,8 +43,6 @@ extern "C" { #define MAX_MB_PLANE 3 -#if CONFIG_EXT_INTER - #if CONFIG_COMPOUND_SEGMENT // Set COMPOUND_SEGMENT_TYPE to one of the three // 0: Uniform @@ -68,20 +63,28 @@ typedef enum { } SEG_MASK_TYPE; #endif // CONFIG_COMPOUND_SEGMENT -#endif // CONFIG_EXT_INTER typedef enum { KEY_FRAME = 0, INTER_FRAME = 1, +#if CONFIG_OBU + INTRA_ONLY_FRAME = 2, // replaces intra-only + S_FRAME = 3, +#endif FRAME_TYPES, } FRAME_TYPE; +static INLINE int is_comp_ref_allowed(BLOCK_SIZE bsize) { + (void)bsize; +#if SUB8X8_COMP_REF + return 1; +#else + return AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8; +#endif // SUB8X8_COMP_REF +} + static INLINE int is_inter_mode(PREDICTION_MODE mode) { -#if CONFIG_EXT_INTER return mode >= NEARESTMV && mode <= NEW_NEWMV; -#else - return mode >= NEARESTMV && mode <= NEWMV; -#endif // CONFIG_EXT_INTER } #if CONFIG_PVQ @@ -110,12 +113,22 @@ typedef struct PVQ_QUEUE { } PVQ_QUEUE; #endif +#if CONFIG_NCOBMC_ADAPT_WEIGHT +typedef struct superblock_mi_boundaries { + int mi_row_begin; + int mi_col_begin; + int mi_row_end; + int mi_col_end; +} SB_MI_BD; + +typedef struct { int16_t KERNEL[4][MAX_SB_SIZE][MAX_SB_SIZE]; } NCOBMC_KERNELS; +#endif + typedef struct { uint8_t *plane[MAX_MB_PLANE]; int stride[MAX_MB_PLANE]; } BUFFER_SET; -#if CONFIG_EXT_INTER static INLINE int is_inter_singleref_mode(PREDICTION_MODE mode) { return mode >= NEARESTMV && mode <= NEWMV; } @@ -142,13 +155,11 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) { MB_MODE_COUNT, // D153_PRED MB_MODE_COUNT, // D207_PRED MB_MODE_COUNT, // D63_PRED -#if CONFIG_ALT_INTRA MB_MODE_COUNT, // SMOOTH_PRED #if CONFIG_SMOOTH_HV MB_MODE_COUNT, // SMOOTH_V_PRED MB_MODE_COUNT, // SMOOTH_H_PRED #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA MB_MODE_COUNT, // TM_PRED MB_MODE_COUNT, // NEARESTMV MB_MODE_COUNT, // NEARMV @@ -190,13 +201,11 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) { MB_MODE_COUNT, // D153_PRED MB_MODE_COUNT, // D207_PRED MB_MODE_COUNT, // D63_PRED -#if CONFIG_ALT_INTRA MB_MODE_COUNT, // SMOOTH_PRED #if CONFIG_SMOOTH_HV MB_MODE_COUNT, // SMOOTH_V_PRED MB_MODE_COUNT, // SMOOTH_H_PRED #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA MB_MODE_COUNT, // TM_PRED MB_MODE_COUNT, // NEARESTMV MB_MODE_COUNT, // NEARMV @@ -265,17 +274,6 @@ static INLINE int is_masked_compound_type(COMPOUND_TYPE type) { return 0; } -#else // !CONFIG_EXT_INTER - -static INLINE int have_nearmv_in_inter_mode(PREDICTION_MODE mode) { - return (mode == NEARMV); -} - -static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) { - return (mode == NEWMV); -} -#endif // CONFIG_EXT_INTER - /* For keyframes, intra block modes are predicted by the (already decoded) modes for the Y blocks to the left and above us; for interframes, there is a single probability table. */ @@ -284,21 +282,17 @@ typedef struct { PREDICTION_MODE as_mode; int_mv as_mv[2]; // first, second inter predictor motion vectors int_mv pred_mv[2]; -#if CONFIG_EXT_INTER int_mv ref_mv[2]; -#endif // CONFIG_EXT_INTER } b_mode_info; typedef int8_t MV_REFERENCE_FRAME; -#if CONFIG_PALETTE typedef struct { // Number of base colors for Y (0) and UV (1) uint8_t palette_size[2]; // Value of base colors for Y, U, and V uint16_t palette_colors[3 * PALETTE_MAX_SIZE]; } PALETTE_MODE_INFO; -#endif // CONFIG_PALETTE #if CONFIG_FILTER_INTRA #define USE_3TAP_INTRA_FILTER 1 // 0: 4-tap; 1: 3-tap @@ -328,9 +322,7 @@ typedef struct RD_STATS { int skip; // sse should equal to dist when skip == 1 int64_t ref_rdcost; int zero_rate; -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 - int64_t dist_y; -#endif + uint8_t invalid_rate; #if CONFIG_RD_DEBUG int txb_coeff_cost[MAX_MB_PLANE]; #if CONFIG_VAR_TX @@ -340,7 +332,6 @@ typedef struct RD_STATS { #endif // CONFIG_RD_DEBUG } RD_STATS; -#if CONFIG_EXT_INTER // This struct is used to group function args that are commonly // sent together in functions related to interinter compound modes typedef struct { @@ -354,7 +345,6 @@ typedef struct { #endif // CONFIG_COMPOUND_SEGMENT COMPOUND_TYPE interinter_compound_type; } INTERINTER_COMPOUND_DATA; -#endif // CONFIG_EXT_INTER // This structure now relates to 8x8 block regions. typedef struct MB_MODE_INFO { @@ -376,26 +366,28 @@ typedef struct MB_MODE_INFO { #endif // CONFIG_SUPERTX int8_t seg_id_predicted; // valid only when temporal_update is enabled +#if CONFIG_MRC_TX + int valid_mrc_mask; +#endif // CONFIG_MRC_TX + // Only for INTRA blocks UV_PREDICTION_MODE uv_mode; -#if CONFIG_PALETTE + PALETTE_MODE_INFO palette_mode_info; -#endif // CONFIG_PALETTE #if CONFIG_INTRABC uint8_t use_intrabc; #endif // CONFIG_INTRABC -// Only for INTER blocks -#if CONFIG_DUAL_FILTER - InterpFilter interp_filter[4]; -#else - InterpFilter interp_filter; -#endif + // Only for INTER blocks + InterpFilters interp_filters; MV_REFERENCE_FRAME ref_frame[2]; TX_TYPE tx_type; #if CONFIG_TXK_SEL TX_TYPE txk_type[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; #endif +#if CONFIG_LGT_FROM_PRED + int use_lgt; +#endif #if CONFIG_FILTER_INTRA FILTER_INTRA_MODE_INFO filter_intra_mode_info; @@ -409,7 +401,6 @@ typedef struct MB_MODE_INFO { #endif // CONFIG_INTRA_INTERP #endif // CONFIG_EXT_INTRA -#if CONFIG_EXT_INTER #if CONFIG_INTERINTRA // interintra members INTERINTRA_MODE interintra_mode; @@ -427,7 +418,6 @@ typedef struct MB_MODE_INFO { #if CONFIG_COMPOUND_SEGMENT SEG_MASK_TYPE mask_type; #endif // CONFIG_COMPOUND_SEGMENT -#endif // CONFIG_EXT_INTER MOTION_MODE motion_mode; #if CONFIG_MOTION_VAR int overlappable_neighbors[2]; @@ -437,7 +427,7 @@ typedef struct MB_MODE_INFO { // blocks. A rectangular block is divided into two squared blocks and each // squared block has an interpolation mode. NCOBMC_MODE ncobmc_mode[2]; -#endif +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT #endif // CONFIG_MOTION_VAR int_mv mv[2]; int_mv pred_mv[2]; @@ -451,11 +441,12 @@ typedef struct MB_MODE_INFO { #endif // CONFIG_NEW_QUANT /* deringing gain *per-superblock* */ int8_t cdef_strength; -#if CONFIG_DELTA_Q int current_q_index; #if CONFIG_EXT_DELTA_Q int current_delta_lf_from_base; -#endif +#if CONFIG_LOOPFILTER_LEVEL + int curr_delta_lf[FRAME_LF_COUNT]; +#endif // CONFIG_LOOPFILTER_LEVEL #endif #if CONFIG_RD_DEBUG RD_STATS rd_stats; @@ -470,11 +461,17 @@ typedef struct MB_MODE_INFO { #if CONFIG_CFL // Index of the alpha Cb and alpha Cr combination int cfl_alpha_idx; - // Signs of alpha Cb and alpha Cr - CFL_SIGN_TYPE cfl_alpha_signs[CFL_PRED_PLANES]; + // Joint sign of alpha Cb and alpha Cr + int cfl_alpha_signs; #endif BOUNDARY_TYPE boundary_info; +#if CONFIG_LPF_SB + uint8_t filt_lvl; + int reuse_sb_lvl; + int sign; + int delta; +#endif } MB_MODE_INFO; typedef struct MODE_INFO { @@ -500,23 +497,22 @@ static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { #if CONFIG_CFL static INLINE PREDICTION_MODE get_uv_mode(UV_PREDICTION_MODE mode) { static const PREDICTION_MODE uv2y[UV_INTRA_MODES] = { - DC_PRED, // UV_DC_PRED - V_PRED, // UV_V_PRED - H_PRED, // UV_H_PRED - D45_PRED, // UV_D45_PRED - D135_PRED, // UV_D135_PRED - D117_PRED, // UV_D117_PRED - D153_PRED, // UV_D153_PRED - D207_PRED, // UV_D207_PRED - D63_PRED, // UV_D63_PRED -#if CONFIG_ALT_INTRA + DC_PRED, // UV_DC_PRED + V_PRED, // UV_V_PRED + H_PRED, // UV_H_PRED + D45_PRED, // UV_D45_PRED + D135_PRED, // UV_D135_PRED + D117_PRED, // UV_D117_PRED + D153_PRED, // UV_D153_PRED + D207_PRED, // UV_D207_PRED + D63_PRED, // UV_D63_PRED SMOOTH_PRED, // UV_SMOOTH_PRED #if CONFIG_SMOOTH_HV SMOOTH_V_PRED, // UV_SMOOTH_V_PRED SMOOTH_H_PRED, // UV_SMOOTH_H_PRED #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA TM_PRED, // UV_TM_PRED + DC_PRED, // CFL_PRED }; return uv2y[mode]; } @@ -578,14 +574,11 @@ static INLINE int is_global_mv_block(const MODE_INFO *mi, int block, const int block_size_allowed = 1; #else const BLOCK_SIZE bsize = mi->mbmi.sb_type; - const int block_size_allowed = (bsize >= BLOCK_8X8); + const int block_size_allowed = + AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8; #endif // GLOBAL_SUB8X8_USED -#if CONFIG_EXT_INTER return (mode == ZEROMV || mode == ZERO_ZEROMV) && type > TRANSLATION && block_size_allowed; -#else - return mode == ZEROMV && type > TRANSLATION && block_size_allowed; -#endif // CONFIG_EXT_INTER } #endif // CONFIG_GLOBAL_MOTION @@ -613,9 +606,7 @@ typedef struct macroblockd_plane { dequant_val_type_nuq seg_dequant_nuq[MAX_SEGMENTS][QUANT_PROFILES] [COEF_BANDS]; #endif -#if CONFIG_PALETTE uint8_t *color_index_map; -#endif // CONFIG_PALETTE // number of 4x4s in current block uint16_t n4_w, n4_h; @@ -625,8 +616,8 @@ typedef struct macroblockd_plane { uint8_t width, height; #if CONFIG_AOM_QM - const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL]; - const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL]; + qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL]; + qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL]; #endif // encoder const int16_t *dequant; @@ -659,6 +650,63 @@ typedef struct RefBuffer { typedef int16_t EobThresholdMD[TX_TYPES][EOB_THRESHOLD_NUM]; #endif +#if CONFIG_LOOP_RESTORATION +typedef struct { + DECLARE_ALIGNED(16, InterpKernel, vfilter); + DECLARE_ALIGNED(16, InterpKernel, hfilter); +} WienerInfo; + +typedef struct { + int ep; + int xqd[2]; +} SgrprojInfo; +#endif // CONFIG_LOOP_RESTORATION + +#if CONFIG_CFL +#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG +#define CFL_SUB8X8_VAL_MI_SIZE (4) +#define CFL_SUB8X8_VAL_MI_SQUARE \ + (CFL_SUB8X8_VAL_MI_SIZE * CFL_SUB8X8_VAL_MI_SIZE) +#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG +typedef struct cfl_ctx { + // The CfL prediction buffer is used in two steps: + // 1. Stores Q3 reconstructed luma pixels + // (only Q2 is required, but Q3 is used to avoid shifts) + // 2. Stores Q3 AC contributions (step1 - tx block avg) + int16_t pred_buf_q3[MAX_SB_SQUARE]; + + // Height and width currently used in the CfL prediction buffer. + int buf_height, buf_width; + + // Height and width of the chroma prediction block currently associated with + // this context + int uv_height, uv_width; + + int are_parameters_computed; + + // Chroma subsampling + int subsampling_x, subsampling_y; + + // Block level DC_PRED for each chromatic plane + int dc_pred[CFL_PRED_PLANES]; + + int mi_row, mi_col; + + // Whether the reconstructed luma pixels need to be stored + int store_y; + +#if CONFIG_CB4X4 + int is_chroma_reference; +#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG + // The prediction used for sub8x8 blocks originates from multiple luma blocks, + // this array is used to validate that cfl_store() is called only once for + // each luma block + uint8_t sub8x8_val[CFL_SUB8X8_VAL_MI_SQUARE]; +#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG +#endif // CONFIG_CB4X4 +} CFL_CTX; +#endif // CONFIG_CFL + typedef struct macroblockd { struct macroblockd_plane plane[MAX_MB_PLANE]; uint8_t bmode_blocks_wl; @@ -684,7 +732,7 @@ typedef struct macroblockd { const aom_prob (*partition_probs)[PARTITION_TYPES - 1]; - /* Distance of MB away from frame edges */ + /* Distance of MB away from frame edges in subpixels (1/8th pixel) */ int mb_to_left_edge; int mb_to_right_edge; int mb_to_top_edge; @@ -720,6 +768,11 @@ typedef struct macroblockd { #endif #endif +#if CONFIG_LOOP_RESTORATION + WienerInfo wiener_info[MAX_MB_PLANE]; + SgrprojInfo sgrproj_info[MAX_MB_PLANE]; +#endif // CONFIG_LOOP_RESTORATION + // block dimension in the unit of mode_info. uint8_t n8_w, n8_h; @@ -737,12 +790,14 @@ typedef struct macroblockd { int qindex[MAX_SEGMENTS]; int lossless[MAX_SEGMENTS]; int corrupted; - +#if CONFIG_AMVR + int cur_frame_mv_precision_level; +// same with that in AV1_COMMON +#endif struct aom_internal_error_info *error_info; #if CONFIG_GLOBAL_MOTION WarpedMotionParams *global_motion; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_DELTA_Q int prev_qindex; int delta_qindex; int current_qindex; @@ -755,19 +810,45 @@ typedef struct macroblockd { // superblock's actual lf and current lf. int prev_delta_lf_from_base; int current_delta_lf_from_base; -#endif +#if CONFIG_LOOPFILTER_LEVEL + // For this experiment, we have four frame filter levels for different plane + // and direction. So, to support the per superblock update, we need to add + // a few more params as below. + // 0: delta loop filter level for y plane vertical + // 1: delta loop filter level for y plane horizontal + // 2: delta loop filter level for u plane + // 3: delta loop filter level for v plane + // To make it consistent with the reference to each filter level in segment, + // we need to -1, since + // SEG_LVL_ALT_LF_Y_V = 1; + // SEG_LVL_ALT_LF_Y_H = 2; + // SEG_LVL_ALT_LF_U = 3; + // SEG_LVL_ALT_LF_V = 4; + int prev_delta_lf[FRAME_LF_COUNT]; + int curr_delta_lf[FRAME_LF_COUNT]; +#endif // CONFIG_LOOPFILTER_LEVEL #endif #if CONFIG_ADAPT_SCAN const EobThresholdMD *eob_threshold_md; #endif -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SEGMENT +#if CONFIG_COMPOUND_SEGMENT DECLARE_ALIGNED(16, uint8_t, seg_mask[2 * MAX_SB_SQUARE]); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SEGMENT +#endif // CONFIG_COMPOUND_SEGMENT + +#if CONFIG_MRC_TX + uint8_t *mrc_mask; +#endif // CONFIG_MRC_TX #if CONFIG_CFL CFL_CTX *cfl; #endif + +#if CONFIG_NCOBMC_ADAPT_WEIGHT + uint8_t *ncobmc_pred_buf[MAX_MB_PLANE]; + int ncobmc_pred_buf_stride[MAX_MB_PLANE]; + SB_MI_BD sb_mi_bd; +#endif } MACROBLOCKD; static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) { @@ -792,13 +873,11 @@ static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = { DCT_ADST, // D153 DCT_ADST, // D207 ADST_DCT, // D63 -#if CONFIG_ALT_INTRA ADST_ADST, // SMOOTH #if CONFIG_SMOOTH_HV ADST_DCT, // SMOOTH_V DCT_ADST, // SMOOTH_H #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA ADST_ADST, // TM }; @@ -816,78 +895,100 @@ static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) { static INLINE int is_rect_tx(TX_SIZE tx_size) { return tx_size >= TX_SIZES; } #endif // CONFIG_RECT_TX -#if CONFIG_EXT_TX -#define ALLOW_INTRA_EXT_TX 1 +static INLINE int block_signals_txsize(BLOCK_SIZE bsize) { +#if CONFIG_CB4X4 && (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX + return bsize > BLOCK_4X4; +#else + return bsize >= BLOCK_8X8; +#endif +} -typedef enum { - // DCT only - EXT_TX_SET_DCTONLY = 0, - // DCT + Identity only - EXT_TX_SET_DCT_IDTX, #if CONFIG_MRC_TX - // DCT + MRC_DCT - EXT_TX_SET_MRC_DCT, - // DCT + MRC_DCT + IDTX - EXT_TX_SET_MRC_DCT_IDTX, +#define USE_MRC_INTRA 0 +#define USE_MRC_INTER 1 +#define SIGNAL_MRC_MASK_INTRA (USE_MRC_INTRA && 0) +#define SIGNAL_MRC_MASK_INTER (USE_MRC_INTER && 1) +#define SIGNAL_ANY_MRC_MASK (SIGNAL_MRC_MASK_INTRA || SIGNAL_MRC_MASK_INTER) #endif // CONFIG_MRC_TX - // Discrete Trig transforms w/o flip (4) + Identity (1) - EXT_TX_SET_DTT4_IDTX, - // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2) - EXT_TX_SET_DTT4_IDTX_1DDCT, - // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2) - EXT_TX_SET_DTT9_IDTX_1DDCT, - // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6) - EXT_TX_SET_ALL16, - EXT_TX_SET_TYPES -} TxSetType; -#if CONFIG_MRC_TX +#if CONFIG_EXT_TX +#define ALLOW_INTRA_EXT_TX 1 + // Number of transform types in each set type -static const int num_ext_tx_set[EXT_TX_SET_TYPES] = { - 1, 2, 2, 3, 5, 7, 12, 16 +static const int av1_num_ext_tx_set[EXT_TX_SET_TYPES] = { + 1, 2, +#if CONFIG_MRC_TX + 2, 3, +#endif // CONFIG_MRC_TX + 5, 7, 12, 16, }; -// Maps intra set index to the set type -static const int ext_tx_set_type_intra[EXT_TX_SETS_INTRA] = { - EXT_TX_SET_DCTONLY, EXT_TX_SET_DTT4_IDTX_1DDCT, EXT_TX_SET_DTT4_IDTX, - EXT_TX_SET_MRC_DCT +static const int av1_ext_tx_set_idx_to_type[2][AOMMAX(EXT_TX_SETS_INTRA, + EXT_TX_SETS_INTER)] = { + { + // Intra + EXT_TX_SET_DCTONLY, EXT_TX_SET_DTT4_IDTX_1DDCT, EXT_TX_SET_DTT4_IDTX, +#if CONFIG_MRC_TX + EXT_TX_SET_MRC_DCT, +#endif // CONFIG_MRC_TX + }, + { + // Inter + EXT_TX_SET_DCTONLY, EXT_TX_SET_ALL16, EXT_TX_SET_DTT9_IDTX_1DDCT, + EXT_TX_SET_DCT_IDTX, +#if CONFIG_MRC_TX + EXT_TX_SET_MRC_DCT_IDTX, +#endif // CONFIG_MRC_TX + } }; -// Maps inter set index to the set type -static const int ext_tx_set_type_inter[EXT_TX_SETS_INTER] = { - EXT_TX_SET_DCTONLY, EXT_TX_SET_ALL16, EXT_TX_SET_DTT9_IDTX_1DDCT, - EXT_TX_SET_DCT_IDTX, EXT_TX_SET_MRC_DCT_IDTX +#if CONFIG_MRC_TX +static const int av1_ext_tx_used[EXT_TX_SET_TYPES][TX_TYPES] = { + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, + }, + { + 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + }, }; - -// Maps set types above to the indices used for intra -static const int ext_tx_set_index_intra[EXT_TX_SET_TYPES] = { 0, -1, 3, -1, - 2, 1, -1, -1 }; - -// Maps set types above to the indices used for inter -static const int ext_tx_set_index_inter[EXT_TX_SET_TYPES] = { 0, 3, -1, 4, - -1, -1, 2, 1 }; #else // CONFIG_MRC_TX -// Number of transform types in each set type -static const int num_ext_tx_set[EXT_TX_SET_TYPES] = { 1, 2, 5, 7, 12, 16 }; - -// Maps intra set index to the set type -static const int ext_tx_set_type_intra[EXT_TX_SETS_INTRA] = { - EXT_TX_SET_DCTONLY, EXT_TX_SET_DTT4_IDTX_1DDCT, EXT_TX_SET_DTT4_IDTX -}; - -// Maps inter set index to the set type -static const int ext_tx_set_type_inter[EXT_TX_SETS_INTER] = { - EXT_TX_SET_DCTONLY, EXT_TX_SET_ALL16, EXT_TX_SET_DTT9_IDTX_1DDCT, - EXT_TX_SET_DCT_IDTX -}; - -// Maps set types above to the indices used for intra -static const int ext_tx_set_index_intra[EXT_TX_SET_TYPES] = { 0, -1, 2, - 1, -1, -1 }; - -// Maps set types above to the indices used for inter -static const int ext_tx_set_index_inter[EXT_TX_SET_TYPES] = { - 0, 3, -1, -1, 2, 1 +static const int av1_ext_tx_used[EXT_TX_SET_TYPES][TX_TYPES] = { + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + }, }; #endif // CONFIG_MRC_TX @@ -897,15 +998,19 @@ static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs, const TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size]; #if CONFIG_CB4X4 && USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 (void)bs; - if (tx_size_sqr > TX_32X32) return EXT_TX_SET_DCTONLY; + if (tx_size_sqr_up > TX_32X32) return EXT_TX_SET_DCTONLY; #else - if (tx_size_sqr > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY; + if (tx_size_sqr_up > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY; #endif if (use_reduced_set) return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DTT4_IDTX; #if CONFIG_MRC_TX - if (tx_size == TX_32X32) - return is_inter ? EXT_TX_SET_MRC_DCT_IDTX : EXT_TX_SET_MRC_DCT; + if (tx_size == TX_32X32) { + if (is_inter && USE_MRC_INTER) + return EXT_TX_SET_MRC_DCT_IDTX; + else if (!is_inter && USE_MRC_INTRA) + return EXT_TX_SET_MRC_DCT; + } #endif // CONFIG_MRC_TX if (tx_size_sqr_up == TX_32X32) return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DCTONLY; @@ -917,133 +1022,69 @@ static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs, : EXT_TX_SET_DTT4_IDTX_1DDCT); } +// Maps tx set types to the indices. +static const int ext_tx_set_index[2][EXT_TX_SET_TYPES] = { + { + // Intra + 0, -1, +#if CONFIG_MRC_TX + 3, -1, +#endif // CONFIG_MRC_TX + 2, 1, -1, -1, + }, + { + // Inter + 0, 3, +#if CONFIG_MRC_TX + -1, 4, +#endif // CONFIG_MRC_TX + -1, -1, 2, 1, + }, +}; + static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter, int use_reduced_set) { const TxSetType set_type = get_ext_tx_set_type(tx_size, bs, is_inter, use_reduced_set); - return is_inter ? ext_tx_set_index_inter[set_type] - : ext_tx_set_index_intra[set_type]; + return ext_tx_set_index[is_inter][set_type]; } -#if CONFIG_MRC_TX -static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] = - { -#if CONFIG_CHROMA_2X2 - { 1, 1, 1, 1, 1 }, // unused - { 0, 1, 1, 0, 0 }, - { 0, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1 }, -#else - { 1, 1, 1, 1 }, // unused - { 1, 1, 0, 0 }, - { 0, 0, 1, 0 }, - { 0, 0, 0, 1 }, -#endif // CONFIG_CHROMA_2X2 - }; - -static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] = - { -#if CONFIG_CHROMA_2X2 - { 1, 1, 1, 1, 1 }, // unused - { 0, 1, 1, 0, 0 }, { 0, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 1 }, -#else - { 1, 1, 1, 1 }, // unused - { 1, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 1 }, -#endif // CONFIG_CHROMA_2X2 - }; - -// Transform types used in each intra set -static const int ext_tx_used_intra[EXT_TX_SETS_INTRA][TX_TYPES] = { - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }, -}; - -// Numbers of transform types used in each intra set -static const int ext_tx_cnt_intra[EXT_TX_SETS_INTRA] = { 1, 7, 5, 2 }; - -// Transform types used in each inter set -static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = { - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }, -}; - -// Numbers of transform types used in each inter set -static const int ext_tx_cnt_inter[EXT_TX_SETS_INTER] = { 1, 16, 12, 2, 3 }; - -// 1D Transforms used in inter set, this needs to be changed if -// ext_tx_used_inter is changed -static const int ext_tx_used_inter_1D[EXT_TX_SETS_INTER][TX_TYPES_1D] = { - { 1, 0, 0, 0 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 0, 0, 1 }, { 1, 0, 0, 1 } -}; -#else // CONFIG_MRC_TX -static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] = - { -#if CONFIG_CHROMA_2X2 - { 1, 1, 1, 1, 1 }, // unused - { 0, 1, 1, 0, 0 }, - { 0, 0, 0, 1, 0 }, -#else - { 1, 1, 1, 1 }, // unused - { 1, 1, 0, 0 }, - { 0, 0, 1, 0 }, -#endif // CONFIG_CHROMA_2X2 - }; - -static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] = - { -#if CONFIG_CHROMA_2X2 - { 1, 1, 1, 1, 1 }, // unused - { 0, 1, 1, 0, 0 }, - { 0, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1 }, -#else - { 1, 1, 1, 1 }, // unused - { 1, 1, 0, 0 }, - { 0, 0, 1, 0 }, - { 0, 0, 0, 1 }, -#endif // CONFIG_CHROMA_2X2 - }; - -// Transform types used in each intra set -static const int ext_tx_used_intra[EXT_TX_SETS_INTRA][TX_TYPES] = { - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, -}; - -// Numbers of transform types used in each intra set -static const int ext_tx_cnt_intra[EXT_TX_SETS_INTRA] = { 1, 7, 5 }; - -// Transform types used in each inter set -static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = { - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, -}; - -// Numbers of transform types used in each inter set -static const int ext_tx_cnt_inter[EXT_TX_SETS_INTER] = { 1, 16, 12, 2 }; - -// 1D Transforms used in inter set, this needs to be changed if -// ext_tx_used_inter is changed -static const int ext_tx_used_inter_1D[EXT_TX_SETS_INTER][TX_TYPES_1D] = { - { 1, 0, 0, 0 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 0, 0, 1 }, -}; -#endif // CONFIG_MRC_TX - static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter, int use_reduced_set) { const int set_type = get_ext_tx_set_type(tx_size, bs, is_inter, use_reduced_set); - return num_ext_tx_set[set_type]; + return av1_num_ext_tx_set[set_type]; +} + +#if CONFIG_LGT_FROM_PRED +static INLINE int is_lgt_allowed(PREDICTION_MODE mode, TX_SIZE tx_size) { + if (!LGT_FROM_PRED_INTRA && !is_inter_mode(mode)) return 0; + if (!LGT_FROM_PRED_INTER && is_inter_mode(mode)) return 0; + + switch (mode) { + case D45_PRED: + case D63_PRED: + case D117_PRED: + case V_PRED: +#if CONFIG_SMOOTH_HV + case SMOOTH_V_PRED: +#endif + return tx_size_wide[tx_size] <= 8; + case D135_PRED: + case D153_PRED: + case D207_PRED: + case H_PRED: +#if CONFIG_SMOOTH_HV + case SMOOTH_H_PRED: +#endif + return tx_size_high[tx_size] <= 8; + case DC_PRED: + case SMOOTH_PRED: return 0; + case TM_PRED: + default: return tx_size_wide[tx_size] <= 8 || tx_size_high[tx_size] <= 8; + } } +#endif // CONFIG_LGT_FROM_PRED #if CONFIG_RECT_TX static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) { @@ -1063,8 +1104,8 @@ static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) { 1, // BLOCK_16X32 1, // BLOCK_32X16 0, // BLOCK_32X32 - 0, // BLOCK_32X64 - 0, // BLOCK_64X32 + 1, // BLOCK_32X64 + 1, // BLOCK_64X32 0, // BLOCK_64X64 #if CONFIG_EXT_PARTITION 0, // BLOCK_64X128 @@ -1075,6 +1116,12 @@ static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) { 0, // BLOCK_16X4 0, // BLOCK_8X32 0, // BLOCK_32X8 + 0, // BLOCK_16X64 + 0, // BLOCK_64X16 +#if CONFIG_EXT_PARTITION + 0, // BLOCK_32X128 + 0, // BLOCK_128X32 +#endif // CONFIG_EXT_PARTITION }; return LUT[bsize]; @@ -1118,6 +1165,12 @@ static INLINE int is_quarter_tx_allowed_bsize(BLOCK_SIZE bsize) { 0, // BLOCK_16X4 0, // BLOCK_8X32 0, // BLOCK_32X8 + 0, // BLOCK_16X64 + 0, // BLOCK_64X16 +#if CONFIG_EXT_PARTITION + 0, // BLOCK_32X128 + 0, // BLOCK_128X32 +#endif // CONFIG_EXT_PARTITION }; return LUT_QTTX[bsize]; @@ -1168,13 +1221,10 @@ static INLINE TX_SIZE tx_size_from_tx_mode(BLOCK_SIZE bsize, TX_MODE tx_mode, #define ANGLE_STEP 3 extern const int16_t dr_intra_derivative[90]; static const uint8_t mode_to_angle_map[] = { - 0, 90, 180, 45, 135, 111, 157, 203, 67, 0, -#if CONFIG_ALT_INTRA - 0, + 0, 90, 180, 45, 135, 111, 157, 203, 67, 0, 0, #if CONFIG_SMOOTH_HV 0, 0, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA }; #if CONFIG_INTRA_INTERP // Returns whether filter selection is needed for a given @@ -1210,19 +1260,6 @@ static INLINE int av1_raster_order_to_block_index(TX_SIZE tx_size, return (tx_size == TX_4X4) ? raster_order : (raster_order > 0) ? 2 : 0; } -#if CONFIG_DPCM_INTRA || CONFIG_LGT -static INLINE PREDICTION_MODE get_prediction_mode(const MODE_INFO *mi, - int plane, TX_SIZE tx_size, - int block_idx) { - const MB_MODE_INFO *const mbmi = &mi->mbmi; - if (is_inter_block(mbmi)) return mbmi->mode; - - int block_raster_idx = av1_block_index_to_raster_order(tx_size, block_idx); - return (plane == PLANE_TYPE_Y) ? get_y_mode(mi, block_raster_idx) - : get_uv_mode(mbmi->uv_mode); -} -#endif - static INLINE TX_TYPE get_default_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd, int block_idx, TX_SIZE tx_size) { @@ -1273,6 +1310,9 @@ static INLINE TX_TYPE av1_get_tx_type(PLANE_TYPE plane_type, #if CONFIG_EXT_TX #if CONFIG_MRC_TX if (mbmi->tx_type == MRC_DCT) { + assert(((is_inter_block(mbmi) && USE_MRC_INTER) || + (!is_inter_block(mbmi) && USE_MRC_INTRA)) && + "INVALID BLOCK TYPE FOR MRC_DCT"); if (plane_type == PLANE_TYPE_Y) { assert(tx_size == TX_32X32); return mbmi->tx_type; @@ -1415,7 +1455,6 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, int plane, TX_SIZE tx_size, int has_eob, int aoff, int loff); -#if CONFIG_EXT_INTER static INLINE int is_interintra_allowed_bsize(const BLOCK_SIZE bsize) { #if CONFIG_INTERINTRA // TODO(debargha): Should this be bsize < BLOCK_LARGEST? @@ -1464,32 +1503,46 @@ static INLINE int is_interintra_allowed_bsize_group(int group) { static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) { return (mbmi->ref_frame[1] == INTRA_FRAME) && is_interintra_allowed(mbmi); } -#endif // CONFIG_EXT_INTER #if CONFIG_VAR_TX static INLINE int get_vartx_max_txsize(const MB_MODE_INFO *const mbmi, - BLOCK_SIZE bsize) { + BLOCK_SIZE bsize, int subsampled) { #if CONFIG_CB4X4 (void)mbmi; - return max_txsize_rect_lookup[bsize]; + TX_SIZE max_txsize = max_txsize_rect_lookup[bsize]; +#else + TX_SIZE max_txsize = mbmi->sb_type < BLOCK_8X8 + ? max_txsize_rect_lookup[mbmi->sb_type] + : max_txsize_rect_lookup[bsize]; #endif // CONFIG_C4X4 - return mbmi->sb_type < BLOCK_8X8 ? max_txsize_rect_lookup[mbmi->sb_type] - : max_txsize_rect_lookup[bsize]; + +#if CONFIG_EXT_PARTITION && CONFIG_TX64X64 + // The decoder is designed so that it can process 64x64 luma pixels at a + // time. If this is a chroma plane with subsampling and bsize corresponds to + // a subsampled BLOCK_128X128 then the lookup above will give TX_64X64. That + // mustn't be used for the subsampled plane (because it would be bigger than + // a 64x64 luma block) so we round down to TX_32X32. + if (subsampled && max_txsize == TX_64X64) max_txsize = TX_32X32; +#else + (void)subsampled; +#endif + + return max_txsize; } #endif // CONFIG_VAR_TX #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION static INLINE int is_motion_variation_allowed_bsize(BLOCK_SIZE bsize) { - return (bsize >= BLOCK_8X8); + return AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8; } static INLINE int is_motion_variation_allowed_compound( const MB_MODE_INFO *mbmi) { -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF if (!has_second_ref(mbmi) && !is_inter_singleref_comp_mode(mbmi->mode)) #else if (!has_second_ref(mbmi)) -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF return 1; else return 0; @@ -1503,7 +1556,15 @@ static INLINE int check_num_overlappable_neighbors(const MB_MODE_INFO *mbmi) { return !(mbmi->overlappable_neighbors[0] == 0 && mbmi->overlappable_neighbors[1] == 0); } -#endif +#if CONFIG_NCOBMC_ADAPT_WEIGHT +static INLINE NCOBMC_MODE ncobmc_mode_allowed_bsize(BLOCK_SIZE bsize) { + if (bsize < BLOCK_8X8 || bsize >= BLOCK_64X64) + return NO_OVERLAP; + else + return MAX_NCOBMC_MODES; +} +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT +#endif // CONFIG_MOTION_VAR static INLINE MOTION_MODE motion_mode_allowed( #if CONFIG_GLOBAL_MOTION @@ -1514,28 +1575,40 @@ static INLINE MOTION_MODE motion_mode_allowed( #endif const MODE_INFO *mi) { const MB_MODE_INFO *mbmi = &mi->mbmi; +#if CONFIG_AMVR + if (xd->cur_frame_mv_precision_level == 0) { +#endif #if CONFIG_GLOBAL_MOTION - const TransformationType gm_type = gm_params[mbmi->ref_frame[0]].wmtype; - if (is_global_mv_block(mi, block, gm_type)) return SIMPLE_TRANSLATION; + const TransformationType gm_type = gm_params[mbmi->ref_frame[0]].wmtype; + if (is_global_mv_block(mi, block, gm_type)) return SIMPLE_TRANSLATION; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_EXT_INTER +#if CONFIG_AMVR + } +#endif if (is_motion_variation_allowed_bsize(mbmi->sb_type) && is_inter_mode(mbmi->mode) && mbmi->ref_frame[1] != INTRA_FRAME && is_motion_variation_allowed_compound(mbmi)) { -#else - if (is_motion_variation_allowed_bsize(mbmi->sb_type) && - is_inter_mode(mbmi->mode) && is_motion_variation_allowed_compound(mbmi)) { -#endif // CONFIG_EXT_INTER #if CONFIG_MOTION_VAR if (!check_num_overlappable_neighbors(mbmi)) return SIMPLE_TRANSLATION; #endif #if CONFIG_WARPED_MOTION if (!has_second_ref(mbmi) && mbmi->num_proj_ref[0] >= 1 && - !av1_is_scaled(&(xd->block_refs[0]->sf))) + !av1_is_scaled(&(xd->block_refs[0]->sf))) { +#if CONFIG_AMVR + if (xd->cur_frame_mv_precision_level) { + return OBMC_CAUSAL; + } +#endif return WARPED_CAUSAL; - else + } + #endif // CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR +#if CONFIG_NCOBMC_ADAPT_WEIGHT + if (ncobmc_mode_allowed_bsize(mbmi->sb_type) < NO_OVERLAP) + return NCOBMC_ADAPT_WEIGHT; + else +#endif return OBMC_CAUSAL; #else return SIMPLE_TRANSLATION; @@ -1545,42 +1618,6 @@ static INLINE MOTION_MODE motion_mode_allowed( } } -#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR -static INLINE NCOBMC_MODE ncobmc_mode_allowed_bsize(BLOCK_SIZE bsize) { - if (bsize < BLOCK_8X8 || bsize > BLOCK_64X64) - return NO_OVERLAP; - else - return (NCOBMC_MODE)(MAX_NCOBMC_MODES - 1); -} - -static INLINE MOTION_MODE -motion_mode_allowed_wrapper(int for_mv_search, -#if CONFIG_GLOBAL_MOTION - int block, const WarpedMotionParams *gm_params, -#endif // CONFIG_GLOBAL_MOTION -#if CONFIG_WARPED_MOTION - const MACROBLOCKD *xd, -#endif - const MODE_INFO *mi) { - const MB_MODE_INFO *mbmi = &mi->mbmi; - MOTION_MODE motion_mode_for_mv_search = motion_mode_allowed( -#if CONFIG_GLOBAL_MOTION - int block, const WarpedMotionParams *gm_params, -#endif -#if CONFIG_WARPED_MOTION - xd, -#endif - mi); - int ncobmc_mode_allowed = - ncobmc_mode_allowed_bsize(mbmi->sb_type) && is_inter_mode(mbmi->mode); - if (for_mv_search) - return motion_mode_for_mv_search; - else - return ncobmc_mode_allowed ? NCOBMC_ADAPT_WEIGHT - : motion_mode_for_mv_search; -} -#endif - static INLINE void assert_motion_mode_valid(MOTION_MODE mode, #if CONFIG_GLOBAL_MOTION int block, @@ -1590,14 +1627,6 @@ static INLINE void assert_motion_mode_valid(MOTION_MODE mode, const MACROBLOCKD *xd, #endif const MODE_INFO *mi) { -#if CONFIG_NCOBMC_ADAPT_WEIGHT - const MOTION_MODE last_motion_mode_allowed = - motion_mode_allowed_wrapper(0, -#if CONFIG_GLOBAL_MOTION - block, gm_params, -#endif // CONFIG_GLOBAL_MOTION - mi); -#else const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed( #if CONFIG_GLOBAL_MOTION block, gm_params, @@ -1606,7 +1635,7 @@ static INLINE void assert_motion_mode_valid(MOTION_MODE mode, xd, #endif mi); -#endif + // Check that the input mode is not illegal if (last_motion_mode_allowed < mode) assert(0 && "Illegal motion mode selected"); @@ -1619,9 +1648,16 @@ static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) { #endif // CONFIG_MOTION_VAR #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION +static INLINE int av1_allow_palette(int allow_screen_content_tools, + BLOCK_SIZE sb_type) { + return allow_screen_content_tools && sb_type >= BLOCK_8X8 && + sb_type <= BLOCK_LARGEST; +} + // Returns sub-sampled dimensions of the given block. // The output values for 'rows_within_bounds' and 'cols_within_bounds' will -// differ from 'height' and 'width' when part of the block is outside the right +// differ from 'height' and 'width' when part of the block is outside the +// right // and/or bottom image boundary. static INLINE void av1_get_block_dimensions(BLOCK_SIZE bsize, int plane, const MACROBLOCKD *xd, int *width, @@ -1647,6 +1683,24 @@ static INLINE void av1_get_block_dimensions(BLOCK_SIZE bsize, int plane, if (cols_within_bounds) *cols_within_bounds = block_cols >> pd->subsampling_x; } +/* clang-format off */ +typedef aom_cdf_prob (*MapCdf)[PALETTE_COLOR_INDEX_CONTEXTS] + [CDF_SIZE(PALETTE_COLORS)]; +typedef const int (*ColorCost)[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] + [PALETTE_COLORS]; +/* clang-format on */ + +typedef struct { + int rows; + int cols; + int n_colors; + int plane_width; + int plane_height; + uint8_t *color_map; + MapCdf map_cdf; + ColorCost color_cost; +} Av1ColorMapParam; + #if CONFIG_GLOBAL_MOTION static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) { const MODE_INFO *mi = xd->mi[0]; @@ -1660,23 +1714,13 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) { // First check if all modes are ZEROMV if (mbmi->sb_type >= BLOCK_8X8 || unify_bsize) { -#if CONFIG_EXT_INTER if (mbmi->mode != ZEROMV && mbmi->mode != ZERO_ZEROMV) return 0; -#else - if (mbmi->mode != ZEROMV) return 0; -#endif // CONFIG_EXT_INTER } else { -#if CONFIG_EXT_INTER if ((mi->bmi[0].as_mode != ZEROMV && mi->bmi[0].as_mode != ZERO_ZEROMV) || (mi->bmi[1].as_mode != ZEROMV && mi->bmi[1].as_mode != ZERO_ZEROMV) || (mi->bmi[2].as_mode != ZEROMV && mi->bmi[2].as_mode != ZERO_ZEROMV) || (mi->bmi[3].as_mode != ZEROMV && mi->bmi[3].as_mode != ZERO_ZEROMV)) return 0; -#else - if (mi->bmi[0].as_mode != ZEROMV || mi->bmi[1].as_mode != ZEROMV || - mi->bmi[2].as_mode != ZEROMV || mi->bmi[3].as_mode != ZEROMV) - return 0; -#endif // CONFIG_EXT_INTER } #if !GLOBAL_SUB8X8_USED @@ -1695,6 +1739,38 @@ static INLINE PLANE_TYPE get_plane_type(int plane) { return (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; } +static INLINE void transpose_uint8(uint8_t *dst, int dst_stride, + const uint8_t *src, int src_stride, int w, + int h) { + int r, c; + for (r = 0; r < h; ++r) + for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c]; +} + +static INLINE void transpose_uint16(uint16_t *dst, int dst_stride, + const uint16_t *src, int src_stride, int w, + int h) { + int r, c; + for (r = 0; r < h; ++r) + for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c]; +} + +static INLINE void transpose_int16(int16_t *dst, int dst_stride, + const int16_t *src, int src_stride, int w, + int h) { + int r, c; + for (r = 0; r < h; ++r) + for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c]; +} + +static INLINE void transpose_int32(int32_t *dst, int dst_stride, + const int32_t *src, int src_stride, int w, + int h) { + int r, c; + for (r = 0; r < h; ++r) + for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c]; +} + #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/cdef.c b/third_party/aom/av1/common/cdef.c index ba8abbbe0..397a14845 100644 --- a/third_party/aom/av1/common/cdef.c +++ b/third_party/aom/av1/common/cdef.c @@ -16,7 +16,7 @@ #include "./aom_scale_rtcd.h" #include "aom/aom_integer.h" #include "av1/common/cdef.h" -#include "av1/common/od_dering.h" +#include "av1/common/cdef_block.h" #include "av1/common/onyxc_int.h" #include "av1/common/reconinter.h" @@ -50,8 +50,8 @@ static int is_8x8_block_skip(MODE_INFO **grid, int mi_row, int mi_col, return is_skip; } -int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col, - dering_list *dlist, int filter_skip) { +int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col, + cdef_list *dlist, int filter_skip) { int r, c; int maxc, maxr; MODE_INFO **grid; @@ -156,82 +156,82 @@ static INLINE void copy_rect(uint16_t *dst, int dstride, const uint16_t *src, void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd) { - int sbr, sbc; - int nhsb, nvsb; - uint16_t src[OD_DERING_INBUF_SIZE]; + int fbr, fbc; + int nhfb, nvfb; + uint16_t src[CDEF_INBUF_SIZE]; uint16_t *linebuf[3]; uint16_t *colbuf[3]; - dering_list dlist[MI_SIZE_64X64 * MI_SIZE_64X64]; - unsigned char *row_dering, *prev_row_dering, *curr_row_dering; - int dering_count; - int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS] = { { 0 } }; - int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS] = { { 0 } }; + cdef_list dlist[MI_SIZE_64X64 * MI_SIZE_64X64]; + unsigned char *row_cdef, *prev_row_cdef, *curr_row_cdef; + int cdef_count; + int dir[CDEF_NBLOCKS][CDEF_NBLOCKS] = { { 0 } }; + int var[CDEF_NBLOCKS][CDEF_NBLOCKS] = { { 0 } }; int stride; int mi_wide_l2[3]; int mi_high_l2[3]; int xdec[3]; int ydec[3]; int pli; - int dering_left; + int cdef_left; int coeff_shift = AOMMAX(cm->bit_depth - 8, 0); - int nplanes = 3; - int chroma_dering = - xd->plane[1].subsampling_x == xd->plane[1].subsampling_y && - xd->plane[2].subsampling_x == xd->plane[2].subsampling_y; - nvsb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64; - nhsb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64; + int nplanes = MAX_MB_PLANE; + int chroma_cdef = xd->plane[1].subsampling_x == xd->plane[1].subsampling_y && + xd->plane[2].subsampling_x == xd->plane[2].subsampling_y; + nvfb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64; + nhfb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64; av1_setup_dst_planes(xd->plane, cm->sb_size, frame, 0, 0); - row_dering = aom_malloc(sizeof(*row_dering) * (nhsb + 2) * 2); - memset(row_dering, 1, sizeof(*row_dering) * (nhsb + 2) * 2); - prev_row_dering = row_dering + 1; - curr_row_dering = prev_row_dering + nhsb + 2; + row_cdef = aom_malloc(sizeof(*row_cdef) * (nhfb + 2) * 2); + memset(row_cdef, 1, sizeof(*row_cdef) * (nhfb + 2) * 2); + prev_row_cdef = row_cdef + 1; + curr_row_cdef = prev_row_cdef + nhfb + 2; for (pli = 0; pli < nplanes; pli++) { xdec[pli] = xd->plane[pli].subsampling_x; ydec[pli] = xd->plane[pli].subsampling_y; mi_wide_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_x; mi_high_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_y; + if (xdec[pli] != ydec[pli]) nplanes = 1; } - stride = (cm->mi_cols << MI_SIZE_LOG2) + 2 * OD_FILT_HBORDER; + stride = (cm->mi_cols << MI_SIZE_LOG2) + 2 * CDEF_HBORDER; for (pli = 0; pli < nplanes; pli++) { - linebuf[pli] = aom_malloc(sizeof(*linebuf) * OD_FILT_VBORDER * stride); + linebuf[pli] = aom_malloc(sizeof(*linebuf) * CDEF_VBORDER * stride); colbuf[pli] = aom_malloc(sizeof(*colbuf) * - ((MAX_SB_SIZE << mi_high_l2[pli]) + 2 * OD_FILT_VBORDER) * - OD_FILT_HBORDER); + ((CDEF_BLOCKSIZE << mi_high_l2[pli]) + 2 * CDEF_VBORDER) * + CDEF_HBORDER); } - for (sbr = 0; sbr < nvsb; sbr++) { + for (fbr = 0; fbr < nvfb; fbr++) { for (pli = 0; pli < nplanes; pli++) { const int block_height = - (MI_SIZE_64X64 << mi_high_l2[pli]) + 2 * OD_FILT_VBORDER; - fill_rect(colbuf[pli], OD_FILT_HBORDER, block_height, OD_FILT_HBORDER, - OD_DERING_VERY_LARGE); + (MI_SIZE_64X64 << mi_high_l2[pli]) + 2 * CDEF_VBORDER; + fill_rect(colbuf[pli], CDEF_HBORDER, block_height, CDEF_HBORDER, + CDEF_VERY_LARGE); } - dering_left = 1; - for (sbc = 0; sbc < nhsb; sbc++) { - int level, clpf_strength; - int uv_level, uv_clpf_strength; + cdef_left = 1; + for (fbc = 0; fbc < nhfb; fbc++) { + int level, sec_strength; + int uv_level, uv_sec_strength; int nhb, nvb; int cstart = 0; - curr_row_dering[sbc] = 0; - if (cm->mi_grid_visible[MI_SIZE_64X64 * sbr * cm->mi_stride + - MI_SIZE_64X64 * sbc] == NULL || - cm->mi_grid_visible[MI_SIZE_64X64 * sbr * cm->mi_stride + - MI_SIZE_64X64 * sbc] + curr_row_cdef[fbc] = 0; + if (cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride + + MI_SIZE_64X64 * fbc] == NULL || + cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride + + MI_SIZE_64X64 * fbc] ->mbmi.cdef_strength == -1) { - dering_left = 0; + cdef_left = 0; continue; } - if (!dering_left) cstart = -OD_FILT_HBORDER; - nhb = AOMMIN(MI_SIZE_64X64, cm->mi_cols - MI_SIZE_64X64 * sbc); - nvb = AOMMIN(MI_SIZE_64X64, cm->mi_rows - MI_SIZE_64X64 * sbr); + if (!cdef_left) cstart = -CDEF_HBORDER; + nhb = AOMMIN(MI_SIZE_64X64, cm->mi_cols - MI_SIZE_64X64 * fbc); + nvb = AOMMIN(MI_SIZE_64X64, cm->mi_rows - MI_SIZE_64X64 * fbr); int tile_top, tile_left, tile_bottom, tile_right; - int mi_idx = MI_SIZE_64X64 * sbr * cm->mi_stride + MI_SIZE_64X64 * sbc; + int mi_idx = MI_SIZE_64X64 * fbr * cm->mi_stride + MI_SIZE_64X64 * fbc; MODE_INFO *const mi_tl = cm->mi + mi_idx; BOUNDARY_TYPE boundary_tl = mi_tl->mbmi.boundary_info; tile_top = boundary_tl & TILE_ABOVE_BOUNDARY; tile_left = boundary_tl & TILE_LEFT_BOUNDARY; - if (sbr != nvsb - 1 && + if (fbr != nvfb - 1 && (&cm->mi[mi_idx + (MI_SIZE_64X64 - 1) * cm->mi_stride])) tile_bottom = cm->mi[mi_idx + (MI_SIZE_64X64 - 1) * cm->mi_stride] .mbmi.boundary_info & @@ -239,197 +239,216 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, else tile_bottom = 1; - if (sbc != nhsb - 1 && (&cm->mi[mi_idx + MI_SIZE_64X64 - 1])) + if (fbc != nhfb - 1 && (&cm->mi[mi_idx + MI_SIZE_64X64 - 1])) tile_right = cm->mi[mi_idx + MI_SIZE_64X64 - 1].mbmi.boundary_info & TILE_RIGHT_BOUNDARY; else tile_right = 1; const int mbmi_cdef_strength = - cm->mi_grid_visible[MI_SIZE_64X64 * sbr * cm->mi_stride + - MI_SIZE_64X64 * sbc] + cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride + + MI_SIZE_64X64 * fbc] ->mbmi.cdef_strength; - level = cm->cdef_strengths[mbmi_cdef_strength] / CLPF_STRENGTHS; - clpf_strength = cm->cdef_strengths[mbmi_cdef_strength] % CLPF_STRENGTHS; - clpf_strength += clpf_strength == 3; - uv_level = cm->cdef_uv_strengths[mbmi_cdef_strength] / CLPF_STRENGTHS; - uv_clpf_strength = - cm->cdef_uv_strengths[mbmi_cdef_strength] % CLPF_STRENGTHS; - uv_clpf_strength += uv_clpf_strength == 3; - if ((level == 0 && clpf_strength == 0 && uv_level == 0 && - uv_clpf_strength == 0) || - (dering_count = sb_compute_dering_list( - cm, sbr * MI_SIZE_64X64, sbc * MI_SIZE_64X64, dlist, - get_filter_skip(level) || get_filter_skip(uv_level))) == 0) { - dering_left = 0; + level = cm->cdef_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS; + sec_strength = + cm->cdef_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS; + sec_strength += sec_strength == 3; + uv_level = cm->cdef_uv_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS; + uv_sec_strength = + cm->cdef_uv_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS; + uv_sec_strength += uv_sec_strength == 3; + if ((level == 0 && sec_strength == 0 && uv_level == 0 && + uv_sec_strength == 0) || + (cdef_count = sb_compute_cdef_list( + cm, fbr * MI_SIZE_64X64, fbc * MI_SIZE_64X64, dlist, +#if CONFIG_CDEF_SINGLEPASS + (level & 1) || (uv_level & 1))) == 0) +#else + get_filter_skip(level) || get_filter_skip(uv_level))) == 0) +#endif + { + cdef_left = 0; continue; } - curr_row_dering[sbc] = 1; + curr_row_cdef[fbc] = 1; for (pli = 0; pli < nplanes; pli++) { - uint16_t dst[MAX_SB_SIZE * MAX_SB_SIZE]; +#if !CONFIG_CDEF_SINGLEPASS + uint16_t dst[CDEF_BLOCKSIZE * CDEF_BLOCKSIZE]; +#endif int coffset; int rend, cend; - int clpf_damping = cm->cdef_clpf_damping; - int dering_damping = cm->cdef_dering_damping; + int pri_damping = cm->cdef_pri_damping; + int sec_damping = cm->cdef_sec_damping; int hsize = nhb << mi_wide_l2[pli]; int vsize = nvb << mi_high_l2[pli]; if (pli) { - if (chroma_dering) + if (chroma_cdef) level = uv_level; else level = 0; - clpf_strength = uv_clpf_strength; + sec_strength = uv_sec_strength; } - if (sbc == nhsb - 1) + if (fbc == nhfb - 1) cend = hsize; else - cend = hsize + OD_FILT_HBORDER; + cend = hsize + CDEF_HBORDER; - if (sbr == nvsb - 1) + if (fbr == nvfb - 1) rend = vsize; else - rend = vsize + OD_FILT_VBORDER; + rend = vsize + CDEF_VBORDER; - coffset = sbc * MI_SIZE_64X64 << mi_wide_l2[pli]; - if (sbc == nhsb - 1) { + coffset = fbc * MI_SIZE_64X64 << mi_wide_l2[pli]; + if (fbc == nhfb - 1) { /* On the last superblock column, fill in the right border with - OD_DERING_VERY_LARGE to avoid filtering with the outside. */ - fill_rect(&src[cend + OD_FILT_HBORDER], OD_FILT_BSTRIDE, - rend + OD_FILT_VBORDER, hsize + OD_FILT_HBORDER - cend, - OD_DERING_VERY_LARGE); + CDEF_VERY_LARGE to avoid filtering with the outside. */ + fill_rect(&src[cend + CDEF_HBORDER], CDEF_BSTRIDE, + rend + CDEF_VBORDER, hsize + CDEF_HBORDER - cend, + CDEF_VERY_LARGE); } - if (sbr == nvsb - 1) { + if (fbr == nvfb - 1) { /* On the last superblock row, fill in the bottom border with - OD_DERING_VERY_LARGE to avoid filtering with the outside. */ - fill_rect(&src[(rend + OD_FILT_VBORDER) * OD_FILT_BSTRIDE], - OD_FILT_BSTRIDE, OD_FILT_VBORDER, - hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE); + CDEF_VERY_LARGE to avoid filtering with the outside. */ + fill_rect(&src[(rend + CDEF_VBORDER) * CDEF_BSTRIDE], CDEF_BSTRIDE, + CDEF_VBORDER, hsize + 2 * CDEF_HBORDER, CDEF_VERY_LARGE); } /* Copy in the pixels we need from the current superblock for deringing.*/ - copy_sb8_16( - cm, - &src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER + cstart], - OD_FILT_BSTRIDE, xd->plane[pli].dst.buf, - (MI_SIZE_64X64 << mi_high_l2[pli]) * sbr, coffset + cstart, - xd->plane[pli].dst.stride, rend, cend - cstart); - if (!prev_row_dering[sbc]) { - copy_sb8_16( - cm, &src[OD_FILT_HBORDER], OD_FILT_BSTRIDE, - xd->plane[pli].dst.buf, - (MI_SIZE_64X64 << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER, - coffset, xd->plane[pli].dst.stride, OD_FILT_VBORDER, hsize); - } else if (sbr > 0) { - copy_rect(&src[OD_FILT_HBORDER], OD_FILT_BSTRIDE, - &linebuf[pli][coffset], stride, OD_FILT_VBORDER, hsize); + copy_sb8_16(cm, + &src[CDEF_VBORDER * CDEF_BSTRIDE + CDEF_HBORDER + cstart], + CDEF_BSTRIDE, xd->plane[pli].dst.buf, + (MI_SIZE_64X64 << mi_high_l2[pli]) * fbr, coffset + cstart, + xd->plane[pli].dst.stride, rend, cend - cstart); + if (!prev_row_cdef[fbc]) { + copy_sb8_16(cm, &src[CDEF_HBORDER], CDEF_BSTRIDE, + xd->plane[pli].dst.buf, + (MI_SIZE_64X64 << mi_high_l2[pli]) * fbr - CDEF_VBORDER, + coffset, xd->plane[pli].dst.stride, CDEF_VBORDER, hsize); + } else if (fbr > 0) { + copy_rect(&src[CDEF_HBORDER], CDEF_BSTRIDE, &linebuf[pli][coffset], + stride, CDEF_VBORDER, hsize); } else { - fill_rect(&src[OD_FILT_HBORDER], OD_FILT_BSTRIDE, OD_FILT_VBORDER, - hsize, OD_DERING_VERY_LARGE); + fill_rect(&src[CDEF_HBORDER], CDEF_BSTRIDE, CDEF_VBORDER, hsize, + CDEF_VERY_LARGE); } - if (!prev_row_dering[sbc - 1]) { - copy_sb8_16( - cm, src, OD_FILT_BSTRIDE, xd->plane[pli].dst.buf, - (MI_SIZE_64X64 << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER, - coffset - OD_FILT_HBORDER, xd->plane[pli].dst.stride, - OD_FILT_VBORDER, OD_FILT_HBORDER); - } else if (sbr > 0 && sbc > 0) { - copy_rect(src, OD_FILT_BSTRIDE, - &linebuf[pli][coffset - OD_FILT_HBORDER], stride, - OD_FILT_VBORDER, OD_FILT_HBORDER); + if (!prev_row_cdef[fbc - 1]) { + copy_sb8_16(cm, src, CDEF_BSTRIDE, xd->plane[pli].dst.buf, + (MI_SIZE_64X64 << mi_high_l2[pli]) * fbr - CDEF_VBORDER, + coffset - CDEF_HBORDER, xd->plane[pli].dst.stride, + CDEF_VBORDER, CDEF_HBORDER); + } else if (fbr > 0 && fbc > 0) { + copy_rect(src, CDEF_BSTRIDE, &linebuf[pli][coffset - CDEF_HBORDER], + stride, CDEF_VBORDER, CDEF_HBORDER); } else { - fill_rect(src, OD_FILT_BSTRIDE, OD_FILT_VBORDER, OD_FILT_HBORDER, - OD_DERING_VERY_LARGE); + fill_rect(src, CDEF_BSTRIDE, CDEF_VBORDER, CDEF_HBORDER, + CDEF_VERY_LARGE); } - if (!prev_row_dering[sbc + 1]) { - copy_sb8_16( - cm, &src[OD_FILT_HBORDER + (nhb << mi_wide_l2[pli])], - OD_FILT_BSTRIDE, xd->plane[pli].dst.buf, - (MI_SIZE_64X64 << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER, - coffset + hsize, xd->plane[pli].dst.stride, OD_FILT_VBORDER, - OD_FILT_HBORDER); - } else if (sbr > 0 && sbc < nhsb - 1) { - copy_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE, - &linebuf[pli][coffset + hsize], stride, OD_FILT_VBORDER, - OD_FILT_HBORDER); + if (!prev_row_cdef[fbc + 1]) { + copy_sb8_16(cm, &src[CDEF_HBORDER + (nhb << mi_wide_l2[pli])], + CDEF_BSTRIDE, xd->plane[pli].dst.buf, + (MI_SIZE_64X64 << mi_high_l2[pli]) * fbr - CDEF_VBORDER, + coffset + hsize, xd->plane[pli].dst.stride, CDEF_VBORDER, + CDEF_HBORDER); + } else if (fbr > 0 && fbc < nhfb - 1) { + copy_rect(&src[hsize + CDEF_HBORDER], CDEF_BSTRIDE, + &linebuf[pli][coffset + hsize], stride, CDEF_VBORDER, + CDEF_HBORDER); } else { - fill_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE, - OD_FILT_VBORDER, OD_FILT_HBORDER, OD_DERING_VERY_LARGE); + fill_rect(&src[hsize + CDEF_HBORDER], CDEF_BSTRIDE, CDEF_VBORDER, + CDEF_HBORDER, CDEF_VERY_LARGE); } - if (dering_left) { + if (cdef_left) { /* If we deringed the superblock on the left then we need to copy in saved pixels. */ - copy_rect(src, OD_FILT_BSTRIDE, colbuf[pli], OD_FILT_HBORDER, - rend + OD_FILT_VBORDER, OD_FILT_HBORDER); + copy_rect(src, CDEF_BSTRIDE, colbuf[pli], CDEF_HBORDER, + rend + CDEF_VBORDER, CDEF_HBORDER); } /* Saving pixels in case we need to dering the superblock on the right. */ - copy_rect(colbuf[pli], OD_FILT_HBORDER, src + hsize, OD_FILT_BSTRIDE, - rend + OD_FILT_VBORDER, OD_FILT_HBORDER); + copy_rect(colbuf[pli], CDEF_HBORDER, src + hsize, CDEF_BSTRIDE, + rend + CDEF_VBORDER, CDEF_HBORDER); copy_sb8_16( cm, &linebuf[pli][coffset], stride, xd->plane[pli].dst.buf, - (MI_SIZE_64X64 << mi_high_l2[pli]) * (sbr + 1) - OD_FILT_VBORDER, - coffset, xd->plane[pli].dst.stride, OD_FILT_VBORDER, hsize); + (MI_SIZE_64X64 << mi_high_l2[pli]) * (fbr + 1) - CDEF_VBORDER, + coffset, xd->plane[pli].dst.stride, CDEF_VBORDER, hsize); if (tile_top) { - fill_rect(src, OD_FILT_BSTRIDE, OD_FILT_VBORDER, - hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE); + fill_rect(src, CDEF_BSTRIDE, CDEF_VBORDER, hsize + 2 * CDEF_HBORDER, + CDEF_VERY_LARGE); } if (tile_left) { - fill_rect(src, OD_FILT_BSTRIDE, vsize + 2 * OD_FILT_VBORDER, - OD_FILT_HBORDER, OD_DERING_VERY_LARGE); + fill_rect(src, CDEF_BSTRIDE, vsize + 2 * CDEF_VBORDER, CDEF_HBORDER, + CDEF_VERY_LARGE); } if (tile_bottom) { - fill_rect(&src[(vsize + OD_FILT_VBORDER) * OD_FILT_BSTRIDE], - OD_FILT_BSTRIDE, OD_FILT_VBORDER, - hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE); + fill_rect(&src[(vsize + CDEF_VBORDER) * CDEF_BSTRIDE], CDEF_BSTRIDE, + CDEF_VBORDER, hsize + 2 * CDEF_HBORDER, CDEF_VERY_LARGE); } if (tile_right) { - fill_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE, - vsize + 2 * OD_FILT_VBORDER, OD_FILT_HBORDER, - OD_DERING_VERY_LARGE); + fill_rect(&src[hsize + CDEF_HBORDER], CDEF_BSTRIDE, + vsize + 2 * CDEF_VBORDER, CDEF_HBORDER, CDEF_VERY_LARGE); } #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) { - od_dering( - (uint8_t *)&CONVERT_TO_SHORTPTR( - xd->plane[pli] - .dst.buf)[xd->plane[pli].dst.stride * - (MI_SIZE_64X64 * sbr << mi_high_l2[pli]) + - (sbc * MI_SIZE_64X64 << mi_wide_l2[pli])], + cdef_filter_fb( +#if CONFIG_CDEF_SINGLEPASS + NULL, + &CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf) +#else + (uint8_t *)&CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf) +#endif + [xd->plane[pli].dst.stride * + (MI_SIZE_64X64 * fbr << mi_high_l2[pli]) + + (fbc * MI_SIZE_64X64 << mi_wide_l2[pli])], +#if CONFIG_CDEF_SINGLEPASS + xd->plane[pli].dst.stride, +#else xd->plane[pli].dst.stride, dst, - &src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER], - xdec[pli], ydec[pli], dir, NULL, var, pli, dlist, dering_count, - level, clpf_strength, clpf_damping, dering_damping, coeff_shift, - 0, 1); +#endif + &src[CDEF_VBORDER * CDEF_BSTRIDE + CDEF_HBORDER], xdec[pli], + ydec[pli], dir, NULL, var, pli, dlist, cdef_count, level, +#if CONFIG_CDEF_SINGLEPASS + sec_strength, pri_damping, sec_damping, coeff_shift); +#else + sec_strength, sec_damping, pri_damping, coeff_shift, 0, 1); +#endif } else { #endif - od_dering(&xd->plane[pli] - .dst.buf[xd->plane[pli].dst.stride * - (MI_SIZE_64X64 * sbr << mi_high_l2[pli]) + - (sbc * MI_SIZE_64X64 << mi_wide_l2[pli])], - xd->plane[pli].dst.stride, dst, - &src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER], - xdec[pli], ydec[pli], dir, NULL, var, pli, dlist, - dering_count, level, clpf_strength, clpf_damping, - dering_damping, coeff_shift, 0, 0); + cdef_filter_fb( + &xd->plane[pli] + .dst.buf[xd->plane[pli].dst.stride * + (MI_SIZE_64X64 * fbr << mi_high_l2[pli]) + + (fbc * MI_SIZE_64X64 << mi_wide_l2[pli])], +#if CONFIG_CDEF_SINGLEPASS + NULL, xd->plane[pli].dst.stride, +#else + xd->plane[pli].dst.stride, dst, +#endif + &src[CDEF_VBORDER * CDEF_BSTRIDE + CDEF_HBORDER], xdec[pli], + ydec[pli], dir, NULL, var, pli, dlist, cdef_count, level, +#if CONFIG_CDEF_SINGLEPASS + sec_strength, pri_damping, sec_damping, coeff_shift); +#else + sec_strength, sec_damping, pri_damping, coeff_shift, 0, 0); +#endif #if CONFIG_HIGHBITDEPTH } #endif } - dering_left = 1; + cdef_left = 1; } { unsigned char *tmp; - tmp = prev_row_dering; - prev_row_dering = curr_row_dering; - curr_row_dering = tmp; + tmp = prev_row_cdef; + prev_row_cdef = curr_row_cdef; + curr_row_cdef = tmp; } } - aom_free(row_dering); + aom_free(row_cdef); for (pli = 0; pli < nplanes; pli++) { aom_free(linebuf[pli]); aom_free(colbuf[pli]); diff --git a/third_party/aom/av1/common/cdef.h b/third_party/aom/av1/common/cdef.h index a0dd0a698..9de24bf92 100644 --- a/third_party/aom/av1/common/cdef.h +++ b/third_party/aom/av1/common/cdef.h @@ -8,31 +8,28 @@ * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ -#ifndef AV1_COMMON_DERING_H_ -#define AV1_COMMON_DERING_H_ +#ifndef AV1_COMMON_CDEF_H_ +#define AV1_COMMON_CDEF_H_ #define CDEF_STRENGTH_BITS 7 -#define DERING_STRENGTHS 32 -#define CLPF_STRENGTHS 4 +#define CDEF_PRI_STRENGTHS 32 +#define CDEF_SEC_STRENGTHS 4 #include "./aom_config.h" #include "aom/aom_integer.h" #include "aom_ports/mem.h" -#include "av1/common/od_dering.h" +#include "av1/common/cdef_block.h" #include "av1/common/onyxc_int.h" -#include "./od_dering.h" static INLINE int sign(int i) { return i < 0 ? -1 : 1; } -static INLINE int constrain(int diff, int threshold, unsigned int damping) { - return threshold - ? sign(diff) * - AOMMIN( - abs(diff), - AOMMAX(0, threshold - (abs(diff) >> - (damping - get_msb(threshold))))) - : 0; +static INLINE int constrain(int diff, int threshold, int damping) { + if (!threshold) return 0; + + const int shift = AOMMAX(0, damping - get_msb(threshold)); + return sign(diff) * + AOMMIN(abs(diff), AOMMAX(0, threshold - (abs(diff) >> shift))); } #ifdef __cplusplus @@ -40,8 +37,8 @@ extern "C" { #endif int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col); -int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col, - dering_list *dlist, int filter_skip); +int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col, + cdef_list *dlist, int filter_skip); void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd); void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref, @@ -50,4 +47,4 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref, #ifdef __cplusplus } // extern "C" #endif -#endif // AV1_COMMON_DERING_H_ +#endif // AV1_COMMON_CDEF_H_ diff --git a/third_party/aom/av1/common/cdef_block.c b/third_party/aom/av1/common/cdef_block.c new file mode 100644 index 000000000..aaa32c950 --- /dev/null +++ b/third_party/aom/av1/common/cdef_block.c @@ -0,0 +1,584 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include <math.h> +#include <stdlib.h> + +#ifdef HAVE_CONFIG_H +#include "./config.h" +#endif + +#include "./aom_dsp_rtcd.h" +#include "./av1_rtcd.h" +#include "./cdef.h" + +/* Generated from gen_filter_tables.c. */ +#if !CONFIG_CDEF_SINGLEPASS || CDEF_FULL +const int cdef_directions[8][3] = { + { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2, -3 * CDEF_BSTRIDE + 3 }, + { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2, -1 * CDEF_BSTRIDE + 3 }, + { 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2, 0 * CDEF_BSTRIDE + 3 }, + { 0 * CDEF_BSTRIDE + 1, 1 * CDEF_BSTRIDE + 2, 1 * CDEF_BSTRIDE + 3 }, + { 1 * CDEF_BSTRIDE + 1, 2 * CDEF_BSTRIDE + 2, 3 * CDEF_BSTRIDE + 3 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 1, 3 * CDEF_BSTRIDE + 1 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0, 3 * CDEF_BSTRIDE + 0 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1, 3 * CDEF_BSTRIDE - 1 } +}; +#else +const int cdef_directions[8][2] = { + { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 }, + { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 }, + { 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2 }, + { 0 * CDEF_BSTRIDE + 1, 1 * CDEF_BSTRIDE + 2 }, + { 1 * CDEF_BSTRIDE + 1, 2 * CDEF_BSTRIDE + 2 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 1 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 }, + { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 } +}; +#endif + +/* Detect direction. 0 means 45-degree up-right, 2 is horizontal, and so on. + The search minimizes the weighted variance along all the lines in a + particular direction, i.e. the squared error between the input and a + "predicted" block where each pixel is replaced by the average along a line + in a particular direction. Since each direction have the same sum(x^2) term, + that term is never computed. See Section 2, step 2, of: + http://jmvalin.ca/notes/intra_paint.pdf */ +int cdef_find_dir_c(const uint16_t *img, int stride, int32_t *var, + int coeff_shift) { + int i; + int32_t cost[8] = { 0 }; + int partial[8][15] = { { 0 } }; + int32_t best_cost = 0; + int best_dir = 0; + /* Instead of dividing by n between 2 and 8, we multiply by 3*5*7*8/n. + The output is then 840 times larger, but we don't care for finding + the max. */ + static const int div_table[] = { 0, 840, 420, 280, 210, 168, 140, 120, 105 }; + for (i = 0; i < 8; i++) { + int j; + for (j = 0; j < 8; j++) { + int x; + /* We subtract 128 here to reduce the maximum range of the squared + partial sums. */ + x = (img[i * stride + j] >> coeff_shift) - 128; + partial[0][i + j] += x; + partial[1][i + j / 2] += x; + partial[2][i] += x; + partial[3][3 + i - j / 2] += x; + partial[4][7 + i - j] += x; + partial[5][3 - i / 2 + j] += x; + partial[6][j] += x; + partial[7][i / 2 + j] += x; + } + } + for (i = 0; i < 8; i++) { + cost[2] += partial[2][i] * partial[2][i]; + cost[6] += partial[6][i] * partial[6][i]; + } + cost[2] *= div_table[8]; + cost[6] *= div_table[8]; + for (i = 0; i < 7; i++) { + cost[0] += (partial[0][i] * partial[0][i] + + partial[0][14 - i] * partial[0][14 - i]) * + div_table[i + 1]; + cost[4] += (partial[4][i] * partial[4][i] + + partial[4][14 - i] * partial[4][14 - i]) * + div_table[i + 1]; + } + cost[0] += partial[0][7] * partial[0][7] * div_table[8]; + cost[4] += partial[4][7] * partial[4][7] * div_table[8]; + for (i = 1; i < 8; i += 2) { + int j; + for (j = 0; j < 4 + 1; j++) { + cost[i] += partial[i][3 + j] * partial[i][3 + j]; + } + cost[i] *= div_table[8]; + for (j = 0; j < 4 - 1; j++) { + cost[i] += (partial[i][j] * partial[i][j] + + partial[i][10 - j] * partial[i][10 - j]) * + div_table[2 * j + 2]; + } + } + for (i = 0; i < 8; i++) { + if (cost[i] > best_cost) { + best_cost = cost[i]; + best_dir = i; + } + } + /* Difference between the optimal variance and the variance along the + orthogonal direction. Again, the sum(x^2) terms cancel out. */ + *var = best_cost - cost[(best_dir + 4) & 7]; + /* We'd normally divide by 840, but dividing by 1024 is close enough + for what we're going to do with this. */ + *var >>= 10; + return best_dir; +} + +#if CONFIG_CDEF_SINGLEPASS +#if CDEF_FULL +const int cdef_pri_taps[2][3] = { { 3, 2, 1 }, { 2, 2, 2 } }; +const int cdef_sec_taps[2][2] = { { 3, 1 }, { 3, 1 } }; +#else +const int cdef_pri_taps[2][2] = { { 4, 2 }, { 3, 3 } }; +const int cdef_sec_taps[2][2] = { { 2, 1 }, { 2, 1 } }; +#endif + +/* Smooth in the direction detected. */ +#if CDEF_CAP +void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride, + const uint16_t *in, int pri_strength, int sec_strength, + int dir, int pri_damping, int sec_damping, int bsize, + UNUSED int max_unused) +#else +void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride, + const uint16_t *in, int pri_strength, int sec_strength, + int dir, int pri_damping, int sec_damping, int bsize, + int max) +#endif +{ + int i, j, k; + const int s = CDEF_BSTRIDE; + const int *pri_taps = cdef_pri_taps[pri_strength & 1]; + const int *sec_taps = cdef_sec_taps[pri_strength & 1]; + for (i = 0; i < 4 << (bsize == BLOCK_8X8); i++) { + for (j = 0; j < 4 << (bsize == BLOCK_8X8); j++) { + int16_t sum = 0; + int16_t y; + int16_t x = in[i * s + j]; +#if CDEF_CAP + int max = x; + int min = x; +#endif +#if CDEF_FULL + for (k = 0; k < 3; k++) +#else + for (k = 0; k < 2; k++) +#endif + { + int16_t p0 = in[i * s + j + cdef_directions[dir][k]]; + int16_t p1 = in[i * s + j - cdef_directions[dir][k]]; + sum += pri_taps[k] * constrain(p0 - x, pri_strength, pri_damping); + sum += pri_taps[k] * constrain(p1 - x, pri_strength, pri_damping); +#if CDEF_CAP + if (p0 != CDEF_VERY_LARGE) max = AOMMAX(p0, max); + if (p1 != CDEF_VERY_LARGE) max = AOMMAX(p1, max); + min = AOMMIN(p0, min); + min = AOMMIN(p1, min); +#endif +#if CDEF_FULL + if (k == 2) continue; +#endif + int16_t s0 = in[i * s + j + cdef_directions[(dir + 2) & 7][k]]; + int16_t s1 = in[i * s + j - cdef_directions[(dir + 2) & 7][k]]; + int16_t s2 = in[i * s + j + cdef_directions[(dir + 6) & 7][k]]; + int16_t s3 = in[i * s + j - cdef_directions[(dir + 6) & 7][k]]; +#if CDEF_CAP + if (s0 != CDEF_VERY_LARGE) max = AOMMAX(s0, max); + if (s1 != CDEF_VERY_LARGE) max = AOMMAX(s1, max); + if (s2 != CDEF_VERY_LARGE) max = AOMMAX(s2, max); + if (s3 != CDEF_VERY_LARGE) max = AOMMAX(s3, max); + min = AOMMIN(s0, min); + min = AOMMIN(s1, min); + min = AOMMIN(s2, min); + min = AOMMIN(s3, min); +#endif + sum += sec_taps[k] * constrain(s0 - x, sec_strength, sec_damping); + sum += sec_taps[k] * constrain(s1 - x, sec_strength, sec_damping); + sum += sec_taps[k] * constrain(s2 - x, sec_strength, sec_damping); + sum += sec_taps[k] * constrain(s3 - x, sec_strength, sec_damping); + } +#if CDEF_CAP + y = clamp((int16_t)x + ((8 + sum - (sum < 0)) >> 4), min, max); +#else + y = clamp((int16_t)x + ((8 + sum - (sum < 0)) >> 4), 0, max); +#endif + if (dst8) + dst8[i * dstride + j] = (uint8_t)y; + else + dst16[i * dstride + j] = (uint16_t)y; + } + } +} + +#else + +/* Smooth in the direction detected. */ +void cdef_direction_8x8_c(uint16_t *y, int ystride, const uint16_t *in, + int threshold, int dir, int damping) { + int i; + int j; + int k; + static const int taps[3] = { 3, 2, 1 }; + for (i = 0; i < 8; i++) { + for (j = 0; j < 8; j++) { + int16_t sum; + int16_t xx; + int16_t yy; + xx = in[i * CDEF_BSTRIDE + j]; + sum = 0; + for (k = 0; k < 3; k++) { + int16_t p0; + int16_t p1; + p0 = in[i * CDEF_BSTRIDE + j + cdef_directions[dir][k]] - xx; + p1 = in[i * CDEF_BSTRIDE + j - cdef_directions[dir][k]] - xx; + sum += taps[k] * constrain(p0, threshold, damping); + sum += taps[k] * constrain(p1, threshold, damping); + } + sum = (sum + 8) >> 4; + yy = xx + sum; + y[i * ystride + j] = yy; + } + } +} + +/* Smooth in the direction detected. */ +void cdef_direction_4x4_c(uint16_t *y, int ystride, const uint16_t *in, + int threshold, int dir, int damping) { + int i; + int j; + int k; + static const int taps[2] = { 4, 1 }; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + int16_t sum; + int16_t xx; + int16_t yy; + xx = in[i * CDEF_BSTRIDE + j]; + sum = 0; + for (k = 0; k < 2; k++) { + int16_t p0; + int16_t p1; + p0 = in[i * CDEF_BSTRIDE + j + cdef_directions[dir][k]] - xx; + p1 = in[i * CDEF_BSTRIDE + j - cdef_directions[dir][k]] - xx; + sum += taps[k] * constrain(p0, threshold, damping); + sum += taps[k] * constrain(p1, threshold, damping); + } + sum = (sum + 8) >> 4; + yy = xx + sum; + y[i * ystride + j] = yy; + } + } +} +#endif + +/* Compute the primary filter strength for an 8x8 block based on the + directional variance difference. A high variance difference means + that we have a highly directional pattern (e.g. a high contrast + edge), so we can apply more deringing. A low variance means that we + either have a low contrast edge, or a non-directional texture, so + we want to be careful not to blur. */ +static INLINE int adjust_strength(int strength, int32_t var) { + const int i = var >> 6 ? AOMMIN(get_msb(var >> 6), 12) : 0; + /* We use the variance of 8x8 blocks to adjust the strength. */ + return var ? (strength * (4 + i) + 8) >> 4 : 0; +} + +#if !CONFIG_CDEF_SINGLEPASS +void copy_8x8_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src, + int sstride) { + int i, j; + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) dst[i * dstride + j] = src[i * sstride + j]; +} + +void copy_4x4_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src, + int sstride) { + int i, j; + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) dst[i * dstride + j] = src[i * sstride + j]; +} + +static void copy_block_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src, + cdef_list *dlist, int cdef_count, + int bsize) { + int bi, bx, by; + + if (bsize == BLOCK_8X8) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_8x8_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 3)], dstride, + &src[bi << (3 + 3)], 8); + } + } else if (bsize == BLOCK_4X8) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 2)], dstride, + &src[bi << (3 + 2)], 4); + copy_4x4_16bit_to_16bit(&dst[((by << 3) + 4) * dstride + (bx << 2)], + dstride, &src[(bi << (3 + 2)) + 4 * 4], 4); + } + } else if (bsize == BLOCK_8X4) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3)], dstride, + &src[bi << (2 + 3)], 8); + copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3) + 4], + dstride, &src[(bi << (2 + 3)) + 4], 8); + } + } else { + assert(bsize == BLOCK_4X4); + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 2)], dstride, + &src[bi << (2 + 2)], 4); + } + } +} + +void copy_8x8_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src, + int sstride) { + int i, j; + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + dst[i * dstride + j] = (uint8_t)src[i * sstride + j]; +} + +void copy_4x4_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src, + int sstride) { + int i, j; + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + dst[i * dstride + j] = (uint8_t)src[i * sstride + j]; +} + +static void copy_block_16bit_to_8bit(uint8_t *dst, int dstride, + const uint16_t *src, cdef_list *dlist, + int cdef_count, int bsize) { + int bi, bx, by; + if (bsize == BLOCK_8X8) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_8x8_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 3)], dstride, + &src[bi << (3 + 3)], 8); + } + } else if (bsize == BLOCK_4X8) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 2)], dstride, + &src[bi << (3 + 2)], 4); + copy_4x4_16bit_to_8bit(&dst[((by << 3) + 4) * dstride + (bx << 2)], + dstride, &src[(bi << (3 + 2)) + 4 * 4], 4); + } + } else if (bsize == BLOCK_8X4) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3)], dstride, + &src[bi << (2 + 3)], 8); + copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3) + 4], dstride, + &src[(bi << (2 + 3)) + 4], 8); + } + } else { + assert(bsize == BLOCK_4X4); + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 2)], dstride, + &src[bi << (2 * 2)], 4); + } + } +} + +int get_filter_skip(int level) { + int filter_skip = level & 1; + if (level == 1) filter_skip = 0; + return filter_skip; +} + +void cdef_filter_fb(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, + int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], + int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli, + cdef_list *dlist, int cdef_count, int level, + int sec_strength, int sec_damping, int pri_damping, + int coeff_shift, int skip_dering, int hbd) { +#else + +void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in, + int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], + int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli, + cdef_list *dlist, int cdef_count, int level, + int sec_strength, int pri_damping, int sec_damping, + int coeff_shift) { +#endif + int bi; + int bx; + int by; + int bsize, bsizex, bsizey; + +#if CONFIG_CDEF_SINGLEPASS + int pri_strength = (level >> 1) << coeff_shift; + int filter_skip = level & 1; + if (!pri_strength && !sec_strength && filter_skip) { + pri_strength = 19 << coeff_shift; + sec_strength = 7 << coeff_shift; + } +#else + int threshold = (level >> 1) << coeff_shift; + int filter_skip = get_filter_skip(level); + if (level == 1) threshold = 31 << coeff_shift; + + cdef_direction_func cdef_direction[] = { cdef_direction_4x4, + cdef_direction_8x8 }; +#endif + sec_damping += coeff_shift - (pli != AOM_PLANE_Y); + pri_damping += coeff_shift - (pli != AOM_PLANE_Y); + bsize = + ydec ? (xdec ? BLOCK_4X4 : BLOCK_8X4) : (xdec ? BLOCK_4X8 : BLOCK_8X8); + bsizex = 3 - xdec; + bsizey = 3 - ydec; +#if CONFIG_CDEF_SINGLEPASS + if (dirinit && pri_strength == 0 && sec_strength == 0) +#else + if (!skip_dering) +#endif + { +#if CONFIG_CDEF_SINGLEPASS + // If we're here, both primary and secondary strengths are 0, and + // we still haven't written anything to y[] yet, so we just copy + // the input to y[]. This is necessary only for av1_cdef_search() + // and only av1_cdef_search() sets dirinit. + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; +#else + if (pli == 0) { + if (!dirinit || !*dirinit) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + dir[by][bx] = cdef_find_dir(&in[8 * by * CDEF_BSTRIDE + 8 * bx], + CDEF_BSTRIDE, &var[by][bx], coeff_shift); + } + if (dirinit) *dirinit = 1; + } + } + // Only run dering for non-zero threshold (which is always the case for + // 4:2:2 or 4:4:0). If we don't dering, we still need to eventually write + // something out in y[] later. + if (threshold != 0) { + assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4); + for (bi = 0; bi < cdef_count; bi++) { + int t = !filter_skip && dlist[bi].skip ? 0 : threshold; + by = dlist[bi].by; + bx = dlist[bi].bx; + (cdef_direction[bsize == BLOCK_8X8])( + &y[bi << (bsizex + bsizey)], 1 << bsizex, + &in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)], + pli ? t : adjust_strength(t, var[by][bx]), dir[by][bx], + pri_damping); + } + } + } + + if (sec_strength) { + if (threshold && !skip_dering) + copy_block_16bit_to_16bit(in, CDEF_BSTRIDE, y, dlist, cdef_count, bsize); + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + int py = by << bsizey; + int px = bx << bsizex; + + if (!filter_skip && dlist[bi].skip) continue; + if (!dst || hbd) { + // 16 bit destination if high bitdepth or 8 bit destination not given + (!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd + : aom_clpf_hblock_hbd)( + dst ? (uint16_t *)dst + py * dstride + px + : &y[bi << (bsizex + bsizey)], + in + py * CDEF_BSTRIDE + px, dst && hbd ? dstride : 1 << bsizex, + CDEF_BSTRIDE, 1 << bsizex, 1 << bsizey, sec_strength << coeff_shift, + sec_damping); + } else { + // Do clpf and write the result to an 8 bit destination + (!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block + : aom_clpf_hblock)( + dst + py * dstride + px, in + py * CDEF_BSTRIDE + px, dstride, + CDEF_BSTRIDE, 1 << bsizex, 1 << bsizey, sec_strength << coeff_shift, + sec_damping); + } + } + } else if (threshold != 0) { + // No clpf, so copy instead + if (hbd) { + copy_block_16bit_to_16bit((uint16_t *)dst, dstride, y, dlist, cdef_count, + bsize); + } else { + copy_block_16bit_to_8bit(dst, dstride, y, dlist, cdef_count, bsize); + } + } else if (dirinit) { + // If we're here, both dering and clpf are off, and we still haven't written + // anything to y[] yet, so we just copy the input to y[]. This is necessary + // only for av1_cdef_search() and only av1_cdef_search() sets dirinit. + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; +#endif + int iy, ix; + // TODO(stemidts/jmvalin): SIMD optimisations + for (iy = 0; iy < 1 << bsizey; iy++) + for (ix = 0; ix < 1 << bsizex; ix++) +#if CONFIG_CDEF_SINGLEPASS + dst16[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] = +#else + y[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] = +#endif + in[((by << bsizey) + iy) * CDEF_BSTRIDE + (bx << bsizex) + ix]; + } +#if CONFIG_CDEF_SINGLEPASS + return; +#endif + } + +#if CONFIG_CDEF_SINGLEPASS + if (pli == 0) { + if (!dirinit || !*dirinit) { + for (bi = 0; bi < cdef_count; bi++) { + by = dlist[bi].by; + bx = dlist[bi].bx; + dir[by][bx] = cdef_find_dir(&in[8 * by * CDEF_BSTRIDE + 8 * bx], + CDEF_BSTRIDE, &var[by][bx], coeff_shift); + } + if (dirinit) *dirinit = 1; + } + } + + assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4); + for (bi = 0; bi < cdef_count; bi++) { + int t = !filter_skip && dlist[bi].skip ? 0 : pri_strength; + int s = !filter_skip && dlist[bi].skip ? 0 : sec_strength; + by = dlist[bi].by; + bx = dlist[bi].bx; + if (dst8) + cdef_filter_block( + &dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL, dstride, + &in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)], + (pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0, + pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1); + else + cdef_filter_block( + NULL, + &dst16[dirinit ? bi << (bsizex + bsizey) + : (by << bsizey) * dstride + (bx << bsizex)], + dirinit ? 1 << bsizex : dstride, + &in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)], + (pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0, + pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1); + } +#endif +} diff --git a/third_party/aom/av1/common/cdef_block.h b/third_party/aom/av1/common/cdef_block.h new file mode 100644 index 000000000..bf277faad --- /dev/null +++ b/third_party/aom/av1/common/cdef_block.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#if !defined(_CDEF_BLOCK_H) +#define _CDEF_BLOCK_H (1) + +#include "./odintrin.h" + +#define CDEF_BLOCKSIZE 64 +#define CDEF_BLOCKSIZE_LOG2 6 +#define CDEF_NBLOCKS (CDEF_BLOCKSIZE / 8) +#if CONFIG_CDEF_SINGLEPASS +#define CDEF_SB_SHIFT (MAX_SB_SIZE_LOG2 - CDEF_BLOCKSIZE_LOG2) +#endif + +/* We need to buffer three vertical lines. */ +#define CDEF_VBORDER (3) +/* We only need to buffer three horizontal pixels too, but let's align to + 16 bytes (8 x 16 bits) to make vectorization easier. */ +#define CDEF_HBORDER (8) +#define CDEF_BSTRIDE ALIGN_POWER_OF_TWO(CDEF_BLOCKSIZE + 2 * CDEF_HBORDER, 3) + +#define CDEF_VERY_LARGE (30000) +#define CDEF_INBUF_SIZE (CDEF_BSTRIDE * (CDEF_BLOCKSIZE + 2 * CDEF_VBORDER)) + +#if CONFIG_CDEF_SINGLEPASS +// Filter configuration +#define CDEF_CAP 1 // 1 = Cap change to largest diff +#define CDEF_FULL 0 // 1 = 7x7 filter, 0 = 5x5 filter + +#if CDEF_FULL +extern const int cdef_pri_taps[2][3]; +extern const int cdef_sec_taps[2][2]; +extern const int cdef_directions[8][3]; +#else +extern const int cdef_pri_taps[2][2]; +extern const int cdef_sec_taps[2][2]; +extern const int cdef_directions[8][2]; +#endif + +#else // CONFIG_CDEF_SINGLEPASS +extern const int cdef_directions[8][3]; +#endif + +typedef struct { + uint8_t by; + uint8_t bx; + uint8_t skip; +} cdef_list; + +#if CONFIG_CDEF_SINGLEPASS +typedef void (*cdef_filter_block_func)(uint8_t *dst8, uint16_t *dst16, + int dstride, const uint16_t *in, + int pri_strength, int sec_strength, + int dir, int pri_damping, + int sec_damping, int bsize, int max); +void copy_cdef_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src, + cdef_list *dlist, int cdef_count, int bsize); +#else +typedef void (*cdef_direction_func)(uint16_t *y, int ystride, + const uint16_t *in, int threshold, int dir, + int damping); + +int get_filter_skip(int level); +#endif + +#if CONFIG_CDEF_SINGLEPASS +void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in, + int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], + int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli, + cdef_list *dlist, int cdef_count, int level, + int sec_strength, int pri_damping, int sec_damping, + int coeff_shift); +#else +void cdef_filter_fb(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, + int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], + int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli, + cdef_list *dlist, int cdef_count, int level, + int sec_strength, int sec_damping, int pri_damping, + int coeff_shift, int skip_dering, int hbd); +#endif +#endif diff --git a/third_party/aom/av1/common/cdef_block_avx2.c b/third_party/aom/av1/common/cdef_block_avx2.c new file mode 100644 index 000000000..5e48045c0 --- /dev/null +++ b/third_party/aom/av1/common/cdef_block_avx2.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include "aom_dsp/aom_simd.h" +#define SIMD_FUNC(name) name##_avx2 +#include "./cdef_block_simd.h" diff --git a/third_party/aom/av1/common/od_dering_neon.c b/third_party/aom/av1/common/cdef_block_neon.c index 99441050a..030b32531 100644 --- a/third_party/aom/av1/common/od_dering_neon.c +++ b/third_party/aom/av1/common/cdef_block_neon.c @@ -11,4 +11,4 @@ #include "aom_dsp/aom_simd.h" #define SIMD_FUNC(name) name##_neon -#include "./od_dering_simd.h" +#include "./cdef_block_simd.h" diff --git a/third_party/aom/av1/common/cdef_block_simd.h b/third_party/aom/av1/common/cdef_block_simd.h new file mode 100644 index 000000000..aa7d3c3ca --- /dev/null +++ b/third_party/aom/av1/common/cdef_block_simd.h @@ -0,0 +1,1214 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include "./av1_rtcd.h" +#include "./cdef_block.h" + +/* partial A is a 16-bit vector of the form: + [x8 x7 x6 x5 x4 x3 x2 x1] and partial B has the form: + [0 y1 y2 y3 y4 y5 y6 y7]. + This function computes (x1^2+y1^2)*C1 + (x2^2+y2^2)*C2 + ... + (x7^2+y2^7)*C7 + (x8^2+0^2)*C8 where the C1..C8 constants are in const1 + and const2. */ +static INLINE v128 fold_mul_and_sum(v128 partiala, v128 partialb, v128 const1, + v128 const2) { + v128 tmp; + /* Reverse partial B. */ + partialb = v128_shuffle_8( + partialb, v128_from_32(0x0f0e0100, 0x03020504, 0x07060908, 0x0b0a0d0c)); + /* Interleave the x and y values of identical indices and pair x8 with 0. */ + tmp = partiala; + partiala = v128_ziplo_16(partialb, partiala); + partialb = v128_ziphi_16(partialb, tmp); + /* Square and add the corresponding x and y values. */ + partiala = v128_madd_s16(partiala, partiala); + partialb = v128_madd_s16(partialb, partialb); + /* Multiply by constant. */ + partiala = v128_mullo_s32(partiala, const1); + partialb = v128_mullo_s32(partialb, const2); + /* Sum all results. */ + partiala = v128_add_32(partiala, partialb); + return partiala; +} + +static INLINE v128 hsum4(v128 x0, v128 x1, v128 x2, v128 x3) { + v128 t0, t1, t2, t3; + t0 = v128_ziplo_32(x1, x0); + t1 = v128_ziplo_32(x3, x2); + t2 = v128_ziphi_32(x1, x0); + t3 = v128_ziphi_32(x3, x2); + x0 = v128_ziplo_64(t1, t0); + x1 = v128_ziphi_64(t1, t0); + x2 = v128_ziplo_64(t3, t2); + x3 = v128_ziphi_64(t3, t2); + return v128_add_32(v128_add_32(x0, x1), v128_add_32(x2, x3)); +} + +/* Computes cost for directions 0, 5, 6 and 7. We can call this function again + to compute the remaining directions. */ +static INLINE v128 compute_directions(v128 lines[8], int32_t tmp_cost1[4]) { + v128 partial4a, partial4b, partial5a, partial5b, partial7a, partial7b; + v128 partial6; + v128 tmp; + /* Partial sums for lines 0 and 1. */ + partial4a = v128_shl_n_byte(lines[0], 14); + partial4b = v128_shr_n_byte(lines[0], 2); + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[1], 12)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[1], 4)); + tmp = v128_add_16(lines[0], lines[1]); + partial5a = v128_shl_n_byte(tmp, 10); + partial5b = v128_shr_n_byte(tmp, 6); + partial7a = v128_shl_n_byte(tmp, 4); + partial7b = v128_shr_n_byte(tmp, 12); + partial6 = tmp; + + /* Partial sums for lines 2 and 3. */ + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[2], 10)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[2], 6)); + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[3], 8)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[3], 8)); + tmp = v128_add_16(lines[2], lines[3]); + partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 8)); + partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 8)); + partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 6)); + partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 10)); + partial6 = v128_add_16(partial6, tmp); + + /* Partial sums for lines 4 and 5. */ + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[4], 6)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[4], 10)); + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[5], 4)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[5], 12)); + tmp = v128_add_16(lines[4], lines[5]); + partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 6)); + partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 10)); + partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 8)); + partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 8)); + partial6 = v128_add_16(partial6, tmp); + + /* Partial sums for lines 6 and 7. */ + partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[6], 2)); + partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[6], 14)); + partial4a = v128_add_16(partial4a, lines[7]); + tmp = v128_add_16(lines[6], lines[7]); + partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 4)); + partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 12)); + partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 10)); + partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 6)); + partial6 = v128_add_16(partial6, tmp); + + /* Compute costs in terms of partial sums. */ + partial4a = + fold_mul_and_sum(partial4a, partial4b, v128_from_32(210, 280, 420, 840), + v128_from_32(105, 120, 140, 168)); + partial7a = + fold_mul_and_sum(partial7a, partial7b, v128_from_32(210, 420, 0, 0), + v128_from_32(105, 105, 105, 140)); + partial5a = + fold_mul_and_sum(partial5a, partial5b, v128_from_32(210, 420, 0, 0), + v128_from_32(105, 105, 105, 140)); + partial6 = v128_madd_s16(partial6, partial6); + partial6 = v128_mullo_s32(partial6, v128_dup_32(105)); + + partial4a = hsum4(partial4a, partial5a, partial6, partial7a); + v128_store_unaligned(tmp_cost1, partial4a); + return partial4a; +} + +/* transpose and reverse the order of the lines -- equivalent to a 90-degree + counter-clockwise rotation of the pixels. */ +static INLINE void array_reverse_transpose_8x8(v128 *in, v128 *res) { + const v128 tr0_0 = v128_ziplo_16(in[1], in[0]); + const v128 tr0_1 = v128_ziplo_16(in[3], in[2]); + const v128 tr0_2 = v128_ziphi_16(in[1], in[0]); + const v128 tr0_3 = v128_ziphi_16(in[3], in[2]); + const v128 tr0_4 = v128_ziplo_16(in[5], in[4]); + const v128 tr0_5 = v128_ziplo_16(in[7], in[6]); + const v128 tr0_6 = v128_ziphi_16(in[5], in[4]); + const v128 tr0_7 = v128_ziphi_16(in[7], in[6]); + + const v128 tr1_0 = v128_ziplo_32(tr0_1, tr0_0); + const v128 tr1_1 = v128_ziplo_32(tr0_5, tr0_4); + const v128 tr1_2 = v128_ziphi_32(tr0_1, tr0_0); + const v128 tr1_3 = v128_ziphi_32(tr0_5, tr0_4); + const v128 tr1_4 = v128_ziplo_32(tr0_3, tr0_2); + const v128 tr1_5 = v128_ziplo_32(tr0_7, tr0_6); + const v128 tr1_6 = v128_ziphi_32(tr0_3, tr0_2); + const v128 tr1_7 = v128_ziphi_32(tr0_7, tr0_6); + + res[7] = v128_ziplo_64(tr1_1, tr1_0); + res[6] = v128_ziphi_64(tr1_1, tr1_0); + res[5] = v128_ziplo_64(tr1_3, tr1_2); + res[4] = v128_ziphi_64(tr1_3, tr1_2); + res[3] = v128_ziplo_64(tr1_5, tr1_4); + res[2] = v128_ziphi_64(tr1_5, tr1_4); + res[1] = v128_ziplo_64(tr1_7, tr1_6); + res[0] = v128_ziphi_64(tr1_7, tr1_6); +} + +int SIMD_FUNC(cdef_find_dir)(const uint16_t *img, int stride, int32_t *var, + int coeff_shift) { + int i; + int32_t cost[8]; + int32_t best_cost = 0; + int best_dir = 0; + v128 lines[8]; + for (i = 0; i < 8; i++) { + lines[i] = v128_load_unaligned(&img[i * stride]); + lines[i] = + v128_sub_16(v128_shr_s16(lines[i], coeff_shift), v128_dup_16(128)); + } + +#if defined(__SSE4_1__) + /* Compute "mostly vertical" directions. */ + __m128i dir47 = compute_directions(lines, cost + 4); + + array_reverse_transpose_8x8(lines, lines); + + /* Compute "mostly horizontal" directions. */ + __m128i dir03 = compute_directions(lines, cost); + + __m128i max = _mm_max_epi32(dir03, dir47); + max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(1, 0, 3, 2))); + max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(2, 3, 0, 1))); + best_cost = _mm_cvtsi128_si32(max); + __m128i t = + _mm_packs_epi32(_mm_cmpeq_epi32(max, dir03), _mm_cmpeq_epi32(max, dir47)); + best_dir = _mm_movemask_epi8(_mm_packs_epi16(t, t)); + best_dir = get_msb(best_dir ^ (best_dir - 1)); // Count trailing zeros +#else + /* Compute "mostly vertical" directions. */ + compute_directions(lines, cost + 4); + + array_reverse_transpose_8x8(lines, lines); + + /* Compute "mostly horizontal" directions. */ + compute_directions(lines, cost); + + for (i = 0; i < 8; i++) { + if (cost[i] > best_cost) { + best_cost = cost[i]; + best_dir = i; + } + } +#endif + + /* Difference between the optimal variance and the variance along the + orthogonal direction. Again, the sum(x^2) terms cancel out. */ + *var = best_cost - cost[(best_dir + 4) & 7]; + /* We'd normally divide by 840, but dividing by 1024 is close enough + for what we're going to do with this. */ + *var >>= 10; + return best_dir; +} + +// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp))) +SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold, + unsigned int adjdamp) { + v128 diff = v128_sub_16(a, b); + const v128 sign = v128_shr_n_s16(diff, 15); + diff = v128_abs_s16(diff); + const v128 s = + v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp)); + return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign); +} + +#if CONFIG_CDEF_SINGLEPASS +// sign(a - b) * min(abs(a - b), max(0, strength - (abs(a - b) >> adjdamp))) +SIMD_INLINE v128 constrain(v256 a, v256 b, unsigned int strength, + unsigned int adjdamp) { + const v256 diff16 = v256_sub_16(a, b); + v128 diff = v128_pack_s16_s8(v256_high_v128(diff16), v256_low_v128(diff16)); + const v128 sign = v128_cmplt_s8(diff, v128_zero()); + diff = v128_abs_s8(diff); + return v128_xor( + v128_add_8(sign, + v128_min_u8(diff, v128_ssub_u8(v128_dup_8(strength), + v128_shr_u8(diff, adjdamp)))), + sign); +} + +#if CDEF_CAP +void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + UNUSED int max_unused) +#else +void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + int max) +#endif +{ + v128 p0, p1, p2, p3; + v256 sum, row, tap, res; +#if CDEF_CAP + v256 max, min, large = v256_dup_16(CDEF_VERY_LARGE); +#endif + int po1 = cdef_directions[dir][0]; + int po2 = cdef_directions[dir][1]; +#if CDEF_FULL + int po3 = cdef_directions[dir][2]; +#endif + int s1o1 = cdef_directions[(dir + 2) & 7][0]; + int s1o2 = cdef_directions[(dir + 2) & 7][1]; + int s2o1 = cdef_directions[(dir + 6) & 7][0]; + int s2o2 = cdef_directions[(dir + 6) & 7][1]; + + const int *pri_taps = cdef_pri_taps[pri_strength & 1]; + const int *sec_taps = cdef_sec_taps[pri_strength & 1]; + + if (pri_strength) + pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength)); + if (sec_strength) + sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength)); + + sum = v256_zero(); + row = v256_from_v64(v64_load_aligned(&in[0 * CDEF_BSTRIDE]), + v64_load_aligned(&in[1 * CDEF_BSTRIDE]), + v64_load_aligned(&in[2 * CDEF_BSTRIDE]), + v64_load_aligned(&in[3 * CDEF_BSTRIDE])); +#if CDEF_CAP + max = min = row; +#endif + + if (pri_strength) { + // Primary near taps + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + po1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + po1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + po1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + po1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - po1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - po1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - po1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - po1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[0] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[0]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); + + // Primary far taps + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + po2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + po2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + po2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + po2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - po2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - po2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - po2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - po2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[1] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[1]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); + +#if CDEF_FULL + // Primary extra taps + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + po3]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + po3]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + po3]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + po3])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - po3]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - po3]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - po3]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - po3])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[2] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[2]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); +#endif + } + + if (sec_strength) { + // Secondary near taps + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + s1o1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + s1o1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + s1o1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + s1o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - s1o1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - s1o1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - s1o1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - s1o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + s2o1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + s2o1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + s2o1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + s2o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p2 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - s2o1]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - s2o1]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - s2o1]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - s2o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p3 = constrain(tap, row, sec_strength, sec_damping); + + // sum += sec_taps[0] * (p0 + p1 + p2 + p3) + p0 = v128_add_8(p0, p1); + p2 = v128_add_8(p2, p3); + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(sec_taps[0]), + v256_from_v128(v128_ziphi_8(p0, p2), + v128_ziplo_8(p0, p2)))); + + // Secondary far taps + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + s1o2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + s1o2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + s1o2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + s1o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - s1o2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - s1o2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - s1o2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - s1o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE + s2o2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE + s2o2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE + s2o2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE + s2o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p2 = constrain(tap, row, sec_strength, sec_damping); + tap = v256_from_v64(v64_load_unaligned(&in[0 * CDEF_BSTRIDE - s2o2]), + v64_load_unaligned(&in[1 * CDEF_BSTRIDE - s2o2]), + v64_load_unaligned(&in[2 * CDEF_BSTRIDE - s2o2]), + v64_load_unaligned(&in[3 * CDEF_BSTRIDE - s2o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p3 = constrain(tap, row, sec_strength, sec_damping); + + // sum += sec_taps[1] * (p0 + p1 + p2 + p3) + p0 = v128_add_8(p0, p1); + p2 = v128_add_8(p2, p3); + + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(sec_taps[1]), + v256_from_v128(v128_ziphi_8(p0, p2), + v128_ziplo_8(p0, p2)))); + } + + // res = row + ((sum - (sum < 0) + 8) >> 4) + sum = v256_add_16(sum, v256_cmplt_s16(sum, v256_zero())); + res = v256_add_16(sum, v256_dup_16(8)); + res = v256_shr_n_s16(res, 4); + res = v256_add_16(row, res); +#if CDEF_CAP + res = v256_min_s16(v256_max_s16(res, min), max); +#else + res = v256_min_s16(v256_max_s16(res, v256_zero()), v256_dup_16(max)); +#endif + res = v256_pack_s16_u8(res, res); + + p0 = v256_low_v128(res); + u32_store_aligned(&dst[0 * dstride], v64_high_u32(v128_high_v64(p0))); + u32_store_aligned(&dst[1 * dstride], v64_low_u32(v128_high_v64(p0))); + u32_store_aligned(&dst[2 * dstride], v64_high_u32(v128_low_v64(p0))); + u32_store_aligned(&dst[3 * dstride], v64_low_u32(v128_low_v64(p0))); +} + +#if CDEF_CAP +void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + UNUSED int max_unused) +#else +void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + int max) +#endif +{ + int i; + v128 p0, p1, p2, p3; + v256 sum, row, res, tap; +#if CDEF_CAP + v256 max, min, large = v256_dup_16(CDEF_VERY_LARGE); +#endif + int po1 = cdef_directions[dir][0]; + int po2 = cdef_directions[dir][1]; +#if CDEF_FULL + int po3 = cdef_directions[dir][2]; +#endif + int s1o1 = cdef_directions[(dir + 2) & 7][0]; + int s1o2 = cdef_directions[(dir + 2) & 7][1]; + int s2o1 = cdef_directions[(dir + 6) & 7][0]; + int s2o2 = cdef_directions[(dir + 6) & 7][1]; + + const int *pri_taps = cdef_pri_taps[pri_strength & 1]; + const int *sec_taps = cdef_sec_taps[pri_strength & 1]; + + if (pri_strength) + pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength)); + if (sec_strength) + sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength)); + for (i = 0; i < 8; i += 2) { + sum = v256_zero(); + row = v256_from_v128(v128_load_aligned(&in[i * CDEF_BSTRIDE]), + v128_load_aligned(&in[(i + 1) * CDEF_BSTRIDE])); + +#if CDEF_CAP + max = min = row; +#endif + // Primary near taps + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + po1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - po1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[0] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[0]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); + + // Primary far taps + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + po2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - po2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[1] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[1]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); + +#if CDEF_FULL + // Primary extra taps + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + po3]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po3])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, pri_strength, pri_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - po3]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po3])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, pri_strength, pri_damping); + + // sum += pri_taps[2] * (p0 + p1) + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(pri_taps[2]), + v256_from_v128(v128_ziphi_8(p0, p1), + v128_ziplo_8(p0, p1)))); +#endif + + // Secondary near taps + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p2 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o1]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o1])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p3 = constrain(tap, row, sec_strength, sec_damping); + + // sum += sec_taps[0] * (p0 + p1 + p2 + p3) + p0 = v128_add_8(p0, p1); + p2 = v128_add_8(p2, p3); + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(sec_taps[0]), + v256_from_v128(v128_ziphi_8(p0, p2), + v128_ziplo_8(p0, p2)))); + + // Secondary far taps + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p0 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p1 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p2 = constrain(tap, row, sec_strength, sec_damping); + tap = + v256_from_v128(v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o2]), + v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o2])); +#if CDEF_CAP + max = v256_max_s16(max, v256_andn(tap, v256_cmpeq_16(tap, large))); + min = v256_min_s16(min, tap); +#endif + p3 = constrain(tap, row, sec_strength, sec_damping); + + // sum += sec_taps[1] * (p0 + p1 + p2 + p3) + p0 = v128_add_8(p0, p1); + p2 = v128_add_8(p2, p3); + sum = v256_add_16(sum, v256_madd_us8(v256_dup_8(sec_taps[1]), + v256_from_v128(v128_ziphi_8(p0, p2), + v128_ziplo_8(p0, p2)))); + + // res = row + ((sum - (sum < 0) + 8) >> 4) + sum = v256_add_16(sum, v256_cmplt_s16(sum, v256_zero())); + res = v256_add_16(sum, v256_dup_16(8)); + res = v256_shr_n_s16(res, 4); + res = v256_add_16(row, res); +#if CDEF_CAP + res = v256_min_s16(v256_max_s16(res, min), max); +#else + res = v256_min_s16(v256_max_s16(res, v256_zero()), v256_dup_16(max)); +#endif + res = v256_pack_s16_u8(res, res); + + p0 = v256_low_v128(res); + v64_store_aligned(&dst[i * dstride], v128_high_v64(p0)); + v64_store_aligned(&dst[(i + 1) * dstride], v128_low_v64(p0)); + } +} + +#if CDEF_CAP +void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + UNUSED int max_unused) +#else +void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + int max) +#endif +{ + int i; + v128 p0, p1, p2, p3, sum, row, res; +#if CDEF_CAP + v128 max, min, large = v128_dup_16(CDEF_VERY_LARGE); +#endif + int po1 = cdef_directions[dir][0]; + int po2 = cdef_directions[dir][1]; +#if CDEF_FULL + int po3 = cdef_directions[dir][2]; +#endif + int s1o1 = cdef_directions[(dir + 2) & 7][0]; + int s1o2 = cdef_directions[(dir + 2) & 7][1]; + int s2o1 = cdef_directions[(dir + 6) & 7][0]; + int s2o2 = cdef_directions[(dir + 6) & 7][1]; + + const int *pri_taps = cdef_pri_taps[pri_strength & 1]; + const int *sec_taps = cdef_sec_taps[pri_strength & 1]; + + if (pri_strength) + pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength)); + if (sec_strength) + sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength)); + for (i = 0; i < 4; i += 2) { + sum = v128_zero(); + row = v128_from_v64(v64_load_aligned(&in[i * CDEF_BSTRIDE]), + v64_load_aligned(&in[(i + 1) * CDEF_BSTRIDE])); +#if CDEF_CAP + min = max = row; +#endif + + // Primary near taps + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + po1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po1])); + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - po1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po1])); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[0] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[0]), v128_add_16(p0, p1))); + + // Primary far taps + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + po2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po2])); + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - po2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po2])); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[1] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[1]), v128_add_16(p0, p1))); + +#if CDEF_FULL + // Primary extra taps + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + po3]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po3])); + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - po3]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po3])); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[2] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[2]), v128_add_16(p0, p1))); +#endif + + // Secondary near taps + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + s1o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o1])); + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - s1o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o1])); + p2 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + s2o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o1])); + p3 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - s2o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o1])); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + max = + v128_max_s16(v128_max_s16(max, v128_andn(p2, v128_cmpeq_16(p2, large))), + v128_andn(p3, v128_cmpeq_16(p3, large))); + min = v128_min_s16( + v128_min_s16(v128_min_s16(v128_min_s16(min, p0), p1), p2), p3); +#endif + p0 = constrain16(p0, row, sec_strength, sec_damping); + p1 = constrain16(p1, row, sec_strength, sec_damping); + p2 = constrain16(p2, row, sec_strength, sec_damping); + p3 = constrain16(p3, row, sec_strength, sec_damping); + + // sum += sec_taps[0] * (p0 + p1 + p2 + p3) + sum = v128_add_16(sum, v128_mullo_s16(v128_dup_16(sec_taps[0]), + v128_add_16(v128_add_16(p0, p1), + v128_add_16(p2, p3)))); + + // Secondary far taps + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + s1o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o2])); + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - s1o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o2])); + p2 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + s2o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o2])); + p3 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - s2o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o2])); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + max = + v128_max_s16(v128_max_s16(max, v128_andn(p2, v128_cmpeq_16(p2, large))), + v128_andn(p3, v128_cmpeq_16(p3, large))); + min = v128_min_s16( + v128_min_s16(v128_min_s16(v128_min_s16(min, p0), p1), p2), p3); +#endif + p0 = constrain16(p0, row, sec_strength, sec_damping); + p1 = constrain16(p1, row, sec_strength, sec_damping); + p2 = constrain16(p2, row, sec_strength, sec_damping); + p3 = constrain16(p3, row, sec_strength, sec_damping); + + // sum += sec_taps[1] * (p0 + p1 + p2 + p3) + sum = v128_add_16(sum, v128_mullo_s16(v128_dup_16(sec_taps[1]), + v128_add_16(v128_add_16(p0, p1), + v128_add_16(p2, p3)))); + + // res = row + ((sum - (sum < 0) + 8) >> 4) + sum = v128_add_16(sum, v128_cmplt_s16(sum, v128_zero())); + res = v128_add_16(sum, v128_dup_16(8)); + res = v128_shr_n_s16(res, 4); + res = v128_add_16(row, res); +#if CDEF_CAP + res = v128_min_s16(v128_max_s16(res, min), max); +#else + res = v128_min_s16(v128_max_s16(res, v128_zero()), v128_dup_16(max)); +#endif + v64_store_aligned(&dst[i * dstride], v128_high_v64(res)); + v64_store_aligned(&dst[(i + 1) * dstride], v128_low_v64(res)); + } +} + +#if CDEF_CAP +void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + UNUSED int max_unused) +#else +void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, + int pri_damping, int sec_damping, + int max) +#endif +{ + int i; + v128 sum, p0, p1, p2, p3, row, res; +#if CDEF_CAP + v128 max, min, large = v128_dup_16(CDEF_VERY_LARGE); +#endif + int po1 = cdef_directions[dir][0]; + int po2 = cdef_directions[dir][1]; +#if CDEF_FULL + int po3 = cdef_directions[dir][2]; +#endif + int s1o1 = cdef_directions[(dir + 2) & 7][0]; + int s1o2 = cdef_directions[(dir + 2) & 7][1]; + int s2o1 = cdef_directions[(dir + 6) & 7][0]; + int s2o2 = cdef_directions[(dir + 6) & 7][1]; + + const int *pri_taps = cdef_pri_taps[pri_strength & 1]; + const int *sec_taps = cdef_sec_taps[pri_strength & 1]; + + if (pri_strength) + pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength)); + if (sec_strength) + sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength)); + + for (i = 0; i < 8; i++) { + sum = v128_zero(); + row = v128_load_aligned(&in[i * CDEF_BSTRIDE]); + +#if CDEF_CAP + min = max = row; +#endif + // Primary near taps + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + po1]); + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - po1]); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[0] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[0]), v128_add_16(p0, p1))); + + // Primary far taps + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + po2]); + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - po2]); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[1] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[1]), v128_add_16(p0, p1))); + +#if CDEF_FULL + // Primary extra taps + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + po3]); + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - po3]); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + min = v128_min_s16(v128_min_s16(min, p0), p1); +#endif + p0 = constrain16(p0, row, pri_strength, pri_damping); + p1 = constrain16(p1, row, pri_strength, pri_damping); + + // sum += pri_taps[2] * (p0 + p1) + sum = v128_add_16( + sum, v128_mullo_s16(v128_dup_16(pri_taps[2]), v128_add_16(p0, p1))); +#endif + + // Secondary near taps + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o1]); + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o1]); + p2 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o1]); + p3 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o1]); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + max = + v128_max_s16(v128_max_s16(max, v128_andn(p2, v128_cmpeq_16(p2, large))), + v128_andn(p3, v128_cmpeq_16(p3, large))); + min = v128_min_s16( + v128_min_s16(v128_min_s16(v128_min_s16(min, p0), p1), p2), p3); +#endif + p0 = constrain16(p0, row, sec_strength, sec_damping); + p1 = constrain16(p1, row, sec_strength, sec_damping); + p2 = constrain16(p2, row, sec_strength, sec_damping); + p3 = constrain16(p3, row, sec_strength, sec_damping); + + // sum += sec_taps[0] * (p0 + p1 + p2 + p3) + sum = v128_add_16(sum, v128_mullo_s16(v128_dup_16(sec_taps[0]), + v128_add_16(v128_add_16(p0, p1), + v128_add_16(p2, p3)))); + + // Secondary far taps + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o2]); + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o2]); + p2 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o2]); + p3 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o2]); +#if CDEF_CAP + max = + v128_max_s16(v128_max_s16(max, v128_andn(p0, v128_cmpeq_16(p0, large))), + v128_andn(p1, v128_cmpeq_16(p1, large))); + max = + v128_max_s16(v128_max_s16(max, v128_andn(p2, v128_cmpeq_16(p2, large))), + v128_andn(p3, v128_cmpeq_16(p3, large))); + min = v128_min_s16( + v128_min_s16(v128_min_s16(v128_min_s16(min, p0), p1), p2), p3); +#endif + p0 = constrain16(p0, row, sec_strength, sec_damping); + p1 = constrain16(p1, row, sec_strength, sec_damping); + p2 = constrain16(p2, row, sec_strength, sec_damping); + p3 = constrain16(p3, row, sec_strength, sec_damping); + + // sum += sec_taps[1] * (p0 + p1 + p2 + p3) + sum = v128_add_16(sum, v128_mullo_s16(v128_dup_16(sec_taps[1]), + v128_add_16(v128_add_16(p0, p1), + v128_add_16(p2, p3)))); + + // res = row + ((sum - (sum < 0) + 8) >> 4) + sum = v128_add_16(sum, v128_cmplt_s16(sum, v128_zero())); + res = v128_add_16(sum, v128_dup_16(8)); + res = v128_shr_n_s16(res, 4); + res = v128_add_16(row, res); +#if CDEF_CAP + res = v128_min_s16(v128_max_s16(res, min), max); +#else + res = v128_min_s16(v128_max_s16(res, v128_zero()), v128_dup_16(max)); +#endif + v128_store_unaligned(&dst[i * dstride], res); + } +} + +void SIMD_FUNC(cdef_filter_block)(uint8_t *dst8, uint16_t *dst16, int dstride, + const uint16_t *in, int pri_strength, + int sec_strength, int dir, int pri_damping, + int sec_damping, int bsize, int max) { + if (dst8) + (bsize == BLOCK_8X8 ? SIMD_FUNC(cdef_filter_block_8x8_8) + : SIMD_FUNC(cdef_filter_block_4x4_8))( + dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping, + sec_damping, max); + else + (bsize == BLOCK_8X8 ? SIMD_FUNC(cdef_filter_block_8x8_16) + : SIMD_FUNC(cdef_filter_block_4x4_16))( + dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping, + sec_damping, max); +} + +#else + +void SIMD_FUNC(cdef_direction_4x4)(uint16_t *y, int ystride, const uint16_t *in, + int threshold, int dir, int damping) { + int i; + v128 p0, p1, sum, row, res; + int o1 = cdef_directions[dir][0]; + int o2 = cdef_directions[dir][1]; + + if (threshold) damping -= get_msb(threshold); + for (i = 0; i < 4; i += 2) { + sum = v128_zero(); + row = v128_from_v64(v64_load_aligned(&in[i * CDEF_BSTRIDE]), + v64_load_aligned(&in[(i + 1) * CDEF_BSTRIDE])); + + // p0 = constrain16(in[i*CDEF_BSTRIDE + offset], row, threshold, damping) + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + o1])); + p0 = constrain16(p0, row, threshold, damping); + + // p1 = constrain16(in[i*CDEF_BSTRIDE - offset], row, threshold, damping) + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - o1]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - o1])); + p1 = constrain16(p1, row, threshold, damping); + + // sum += 4 * (p0 + p1) + sum = v128_add_16(sum, v128_shl_n_16(v128_add_16(p0, p1), 2)); + + // p0 = constrain16(in[i*CDEF_BSTRIDE + offset], row, threshold, damping) + p0 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE + o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + o2])); + p0 = constrain16(p0, row, threshold, damping); + + // p1 = constrain16(in[i*CDEF_BSTRIDE - offset], row, threshold, damping) + p1 = v128_from_v64(v64_load_unaligned(&in[i * CDEF_BSTRIDE - o2]), + v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - o2])); + p1 = constrain16(p1, row, threshold, damping); + + // sum += 1 * (p0 + p1) + sum = v128_add_16(sum, v128_add_16(p0, p1)); + + // res = row + ((sum + 8) >> 4) + res = v128_add_16(sum, v128_dup_16(8)); + res = v128_shr_n_s16(res, 4); + res = v128_add_16(row, res); + v64_store_aligned(&y[i * ystride], v128_high_v64(res)); + v64_store_aligned(&y[(i + 1) * ystride], v128_low_v64(res)); + } +} + +void SIMD_FUNC(cdef_direction_8x8)(uint16_t *y, int ystride, const uint16_t *in, + int threshold, int dir, int damping) { + int i; + v128 sum, p0, p1, row, res; + int o1 = cdef_directions[dir][0]; + int o2 = cdef_directions[dir][1]; + int o3 = cdef_directions[dir][2]; + + if (threshold) damping -= get_msb(threshold); + for (i = 0; i < 8; i++) { + sum = v128_zero(); + row = v128_load_aligned(&in[i * CDEF_BSTRIDE]); + + // p0 = constrain16(in[i*CDEF_BSTRIDE + offset], row, threshold, damping) + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + o1]); + p0 = constrain16(p0, row, threshold, damping); + + // p1 = constrain16(in[i*CDEF_BSTRIDE - offset], row, threshold, damping) + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - o1]); + p1 = constrain16(p1, row, threshold, damping); + + // sum += 3 * (p0 + p1) + p0 = v128_add_16(p0, p1); + p0 = v128_add_16(p0, v128_shl_n_16(p0, 1)); + sum = v128_add_16(sum, p0); + + // p0 = constrain16(in[i*CDEF_BSTRIDE + offset], row, threshold, damping) + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + o2]); + p0 = constrain16(p0, row, threshold, damping); + + // p1 = constrain16(in[i*CDEF_BSTRIDE - offset], row, threshold, damping) + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - o2]); + p1 = constrain16(p1, row, threshold, damping); + + // sum += 2 * (p0 + p1) + p0 = v128_shl_n_16(v128_add_16(p0, p1), 1); + sum = v128_add_16(sum, p0); + + // p0 = constrain16(in[i*CDEF_BSTRIDE + offset], row, threshold, damping) + p0 = v128_load_unaligned(&in[i * CDEF_BSTRIDE + o3]); + p0 = constrain16(p0, row, threshold, damping); + + // p1 = constrain16(in[i*CDEF_BSTRIDE - offset], row, threshold, damping) + p1 = v128_load_unaligned(&in[i * CDEF_BSTRIDE - o3]); + p1 = constrain16(p1, row, threshold, damping); + + // sum += (p0 + p1) + p0 = v128_add_16(p0, p1); + sum = v128_add_16(sum, p0); + + // res = row + ((sum + 8) >> 4) + res = v128_add_16(sum, v128_dup_16(8)); + res = v128_shr_n_s16(res, 4); + res = v128_add_16(row, res); + v128_store_unaligned(&y[i * ystride], res); + } +} + +void SIMD_FUNC(copy_8x8_16bit_to_8bit)(uint8_t *dst, int dstride, + const uint16_t *src, int sstride) { + int i; + for (i = 0; i < 8; i++) { + v128 row = v128_load_unaligned(&src[i * sstride]); + row = v128_pack_s16_u8(row, row); + v64_store_unaligned(&dst[i * dstride], v128_low_v64(row)); + } +} + +void SIMD_FUNC(copy_4x4_16bit_to_8bit)(uint8_t *dst, int dstride, + const uint16_t *src, int sstride) { + int i; + for (i = 0; i < 4; i++) { + v128 row = v128_load_unaligned(&src[i * sstride]); + row = v128_pack_s16_u8(row, row); + u32_store_unaligned(&dst[i * dstride], v128_low_u32(row)); + } +} + +void SIMD_FUNC(copy_8x8_16bit_to_16bit)(uint16_t *dst, int dstride, + const uint16_t *src, int sstride) { + int i; + for (i = 0; i < 8; i++) { + v128 row = v128_load_unaligned(&src[i * sstride]); + v128_store_unaligned(&dst[i * dstride], row); + } +} + +void SIMD_FUNC(copy_4x4_16bit_to_16bit)(uint16_t *dst, int dstride, + const uint16_t *src, int sstride) { + int i; + for (i = 0; i < 4; i++) { + v64 row = v64_load_unaligned(&src[i * sstride]); + v64_store_unaligned(&dst[i * dstride], row); + } +} +#endif + +void SIMD_FUNC(copy_rect8_8bit_to_16bit)(uint16_t *dst, int dstride, + const uint8_t *src, int sstride, int v, + int h) { + int i, j; + for (i = 0; i < v; i++) { + for (j = 0; j < (h & ~0x7); j += 8) { + v64 row = v64_load_unaligned(&src[i * sstride + j]); + v128_store_unaligned(&dst[i * dstride + j], v128_unpack_u8_s16(row)); + } + for (; j < h; j++) { + dst[i * dstride + j] = src[i * sstride + j]; + } + } +} + +void SIMD_FUNC(copy_rect8_16bit_to_16bit)(uint16_t *dst, int dstride, + const uint16_t *src, int sstride, + int v, int h) { + int i, j; + for (i = 0; i < v; i++) { + for (j = 0; j < (h & ~0x7); j += 8) { + v128 row = v128_load_unaligned(&src[i * sstride + j]); + v128_store_unaligned(&dst[i * dstride + j], row); + } + for (; j < h; j++) { + dst[i * dstride + j] = src[i * sstride + j]; + } + } +} diff --git a/third_party/aom/av1/common/od_dering_sse2.c b/third_party/aom/av1/common/cdef_block_sse2.c index 8a2a62f6c..f3de763fa 100644 --- a/third_party/aom/av1/common/od_dering_sse2.c +++ b/third_party/aom/av1/common/cdef_block_sse2.c @@ -11,4 +11,4 @@ #include "aom_dsp/aom_simd.h" #define SIMD_FUNC(name) name##_sse2 -#include "./od_dering_simd.h" +#include "./cdef_block_simd.h" diff --git a/third_party/aom/av1/common/od_dering_sse4.c b/third_party/aom/av1/common/cdef_block_sse4.c index 0769db9fd..27e9ff32e 100644 --- a/third_party/aom/av1/common/od_dering_sse4.c +++ b/third_party/aom/av1/common/cdef_block_sse4.c @@ -11,4 +11,4 @@ #include "aom_dsp/aom_simd.h" #define SIMD_FUNC(name) name##_sse4_1 -#include "./od_dering_simd.h" +#include "./cdef_block_simd.h" diff --git a/third_party/aom/av1/common/od_dering_ssse3.c b/third_party/aom/av1/common/cdef_block_ssse3.c index 99df62b6b..863522199 100644 --- a/third_party/aom/av1/common/od_dering_ssse3.c +++ b/third_party/aom/av1/common/cdef_block_ssse3.c @@ -11,4 +11,4 @@ #include "aom_dsp/aom_simd.h" #define SIMD_FUNC(name) name##_ssse3 -#include "./od_dering_simd.h" +#include "./cdef_block_simd.h" diff --git a/third_party/aom/av1/common/cdef_simd.h b/third_party/aom/av1/common/cdef_simd.h deleted file mode 100644 index 2649099a2..000000000 --- a/third_party/aom/av1/common/cdef_simd.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ -#ifndef AV1_COMMON_CDEF_SIMD_H_ -#define AV1_COMMON_CDEF_SIMD_H_ - -#include "aom_dsp/aom_simd.h" - -// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp))) -SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold, - unsigned int adjdamp) { - v128 diff = v128_sub_16(a, b); - const v128 sign = v128_shr_n_s16(diff, 15); - diff = v128_abs_s16(diff); - const v128 s = - v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp)); - return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign); -} - -#endif // AV1_COMMON_CDEF_SIMD_H_ diff --git a/third_party/aom/av1/common/cfl.c b/third_party/aom/av1/common/cfl.c index 7c88dd0c8..f9acfcbc9 100644 --- a/third_party/aom/av1/common/cfl.c +++ b/third_party/aom/av1/common/cfl.c @@ -13,117 +13,148 @@ #include "av1/common/common_data.h" #include "av1/common/onyxc_int.h" -#include "aom/internal/aom_codec_internal.h" - void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) { if (!((cm->subsampling_x == 0 && cm->subsampling_y == 0) || (cm->subsampling_x == 1 && cm->subsampling_y == 1))) { aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM, "Only 4:4:4 and 4:2:0 are currently supported by CfL"); } - memset(&cfl->y_pix, 0, sizeof(uint8_t) * MAX_SB_SQUARE); + memset(&cfl->pred_buf_q3, 0, sizeof(cfl->pred_buf_q3)); cfl->subsampling_x = cm->subsampling_x; cfl->subsampling_y = cm->subsampling_y; cfl->are_parameters_computed = 0; + cfl->store_y = 0; +#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG + cfl_clear_sub8x8_val(cfl); +#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG } -// Load from the CfL pixel buffer into output -static void cfl_load(CFL_CTX *cfl, int row, int col, int width, int height) { - const int sub_x = cfl->subsampling_x; - const int sub_y = cfl->subsampling_y; - const int off_log2 = tx_size_wide_log2[0]; - - // TODO(ltrudeau) convert to uint16 to add HBD support - const uint8_t *y_pix; - // TODO(ltrudeau) convert to uint16 to add HBD support - uint8_t *output = cfl->y_down_pix; - - int pred_row_offset = 0; - int output_row_offset = 0; - - // TODO(ltrudeau) should be faster to downsample when we store the values - // TODO(ltrudeau) add support for 4:2:2 - if (sub_y == 0 && sub_x == 0) { - y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << off_log2]; - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - // In 4:4:4, pixels match 1 to 1 - output[output_row_offset + i] = y_pix[pred_row_offset + i]; - } - pred_row_offset += MAX_SB_SIZE; - output_row_offset += MAX_SB_SIZE; - } - } else if (sub_y == 1 && sub_x == 1) { - y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << (off_log2 + sub_y)]; - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - int top_left = (pred_row_offset + i) << sub_y; - int bot_left = top_left + MAX_SB_SIZE; - // In 4:2:0, average pixels in 2x2 grid - output[output_row_offset + i] = OD_SHR_ROUND( - y_pix[top_left] + y_pix[top_left + 1] // Top row - + y_pix[bot_left] + y_pix[bot_left + 1] // Bottom row - , - 2); - } - pred_row_offset += MAX_SB_SIZE; - output_row_offset += MAX_SB_SIZE; - } - } else { - assert(0); // Unsupported chroma subsampling - } - // Due to frame boundary issues, it is possible that the total area of - // covered by Chroma exceeds that of Luma. When this happens, we write over - // the broken data by repeating the last columns and/or rows. - // - // Note that in order to manage the case where both rows and columns - // overrun, - // we apply rows first. This way, when the rows overrun the bottom of the - // frame, the columns will be copied over them. - const int uv_width = (col << off_log2) + width; - const int uv_height = (row << off_log2) + height; - - const int diff_width = uv_width - (cfl->y_width >> sub_x); - const int diff_height = uv_height - (cfl->y_height >> sub_y); +// Due to frame boundary issues, it is possible that the total area covered by +// chroma exceeds that of luma. When this happens, we fill the missing pixels by +// repeating the last columns and/or rows. +static INLINE void cfl_pad(CFL_CTX *cfl, int width, int height) { + const int diff_width = width - cfl->buf_width; + const int diff_height = height - cfl->buf_height; if (diff_width > 0) { - int last_pixel; - output_row_offset = width - diff_width; - - for (int j = 0; j < height; j++) { - last_pixel = output_row_offset - 1; + const int min_height = height - diff_height; + int16_t *pred_buf_q3 = cfl->pred_buf_q3 + (width - diff_width); + for (int j = 0; j < min_height; j++) { + const int last_pixel = pred_buf_q3[-1]; for (int i = 0; i < diff_width; i++) { - output[output_row_offset + i] = output[last_pixel]; + pred_buf_q3[i] = last_pixel; } - output_row_offset += MAX_SB_SIZE; + pred_buf_q3 += MAX_SB_SIZE; } + cfl->buf_width = width; } - if (diff_height > 0) { - output_row_offset = (height - diff_height) * MAX_SB_SIZE; - const int last_row_offset = output_row_offset - MAX_SB_SIZE; - + int16_t *pred_buf_q3 = + cfl->pred_buf_q3 + ((height - diff_height) * MAX_SB_SIZE); for (int j = 0; j < diff_height; j++) { + const int16_t *last_row_q3 = pred_buf_q3 - MAX_SB_SIZE; for (int i = 0; i < width; i++) { - output[output_row_offset + i] = output[last_row_offset + i]; + pred_buf_q3[i] = last_row_q3[i]; } - output_row_offset += MAX_SB_SIZE; + pred_buf_q3 += MAX_SB_SIZE; } + cfl->buf_height = height; } } -// CfL computes its own block-level DC_PRED. This is required to compute both -// alpha_cb and alpha_cr before the prediction are computed. -static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { +static void sum_above_row_lbd(const uint8_t *above_u, const uint8_t *above_v, + int width, int *out_sum_u, int *out_sum_v) { + int sum_u = 0; + int sum_v = 0; + for (int i = 0; i < width; i++) { + sum_u += above_u[i]; + sum_v += above_v[i]; + } + *out_sum_u += sum_u; + *out_sum_v += sum_v; +} +#if CONFIG_HIGHBITDEPTH +static void sum_above_row_hbd(const uint16_t *above_u, const uint16_t *above_v, + int width, int *out_sum_u, int *out_sum_v) { + int sum_u = 0; + int sum_v = 0; + for (int i = 0; i < width; i++) { + sum_u += above_u[i]; + sum_v += above_v[i]; + } + *out_sum_u += sum_u; + *out_sum_v += sum_v; +} +#endif // CONFIG_HIGHBITDEPTH + +static void sum_above_row(const MACROBLOCKD *xd, int width, int *out_sum_u, + int *out_sum_v) { const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U]; const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V]; +#if CONFIG_HIGHBITDEPTH + if (get_bitdepth_data_path_index(xd)) { + const uint16_t *above_u_16 = + CONVERT_TO_SHORTPTR(pd_u->dst.buf) - pd_u->dst.stride; + const uint16_t *above_v_16 = + CONVERT_TO_SHORTPTR(pd_v->dst.buf) - pd_v->dst.stride; + sum_above_row_hbd(above_u_16, above_v_16, width, out_sum_u, out_sum_v); + return; + } +#endif // CONFIG_HIGHBITDEPTH + const uint8_t *above_u = pd_u->dst.buf - pd_u->dst.stride; + const uint8_t *above_v = pd_v->dst.buf - pd_v->dst.stride; + sum_above_row_lbd(above_u, above_v, width, out_sum_u, out_sum_v); +} - const uint8_t *const dst_u = pd_u->dst.buf; - const uint8_t *const dst_v = pd_v->dst.buf; +static void sum_left_col_lbd(const uint8_t *left_u, int u_stride, + const uint8_t *left_v, int v_stride, int height, + int *out_sum_u, int *out_sum_v) { + int sum_u = 0; + int sum_v = 0; + for (int i = 0; i < height; i++) { + sum_u += left_u[i * u_stride]; + sum_v += left_v[i * v_stride]; + } + *out_sum_u += sum_u; + *out_sum_v += sum_v; +} +#if CONFIG_HIGHBITDEPTH +static void sum_left_col_hbd(const uint16_t *left_u, int u_stride, + const uint16_t *left_v, int v_stride, int height, + int *out_sum_u, int *out_sum_v) { + int sum_u = 0; + int sum_v = 0; + for (int i = 0; i < height; i++) { + sum_u += left_u[i * u_stride]; + sum_v += left_v[i * v_stride]; + } + *out_sum_u += sum_u; + *out_sum_v += sum_v; +} +#endif // CONFIG_HIGHBITDEPTH +static void sum_left_col(const MACROBLOCKD *xd, int height, int *out_sum_u, + int *out_sum_v) { + const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U]; + const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V]; - const int dst_u_stride = pd_u->dst.stride; - const int dst_v_stride = pd_v->dst.stride; +#if CONFIG_HIGHBITDEPTH + if (get_bitdepth_data_path_index(xd)) { + const uint16_t *left_u_16 = CONVERT_TO_SHORTPTR(pd_u->dst.buf) - 1; + const uint16_t *left_v_16 = CONVERT_TO_SHORTPTR(pd_v->dst.buf) - 1; + sum_left_col_hbd(left_u_16, pd_u->dst.stride, left_v_16, pd_v->dst.stride, + height, out_sum_u, out_sum_v); + return; + } +#endif // CONFIG_HIGHBITDEPTH + const uint8_t *left_u = pd_u->dst.buf - 1; + const uint8_t *left_v = pd_v->dst.buf - 1; + sum_left_col_lbd(left_u, pd_u->dst.stride, left_v, pd_v->dst.stride, height, + out_sum_u, out_sum_v); +} +// CfL computes its own block-level DC_PRED. This is required to compute both +// alpha_cb and alpha_cr before the prediction are computed. +static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { CFL_CTX *const cfl = xd->cfl; // Compute DC_PRED until block boundary. We can't assume the neighbor will use @@ -138,14 +169,13 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { int sum_u = 0; int sum_v = 0; -// Match behavior of build_intra_predictors (reconintra.c) at superblock +// Match behavior of build_intra_predictors_high (reconintra.c) at superblock // boundaries: -// -// 127 127 127 .. 127 127 127 127 127 127 -// 129 A B .. Y Z -// 129 C D .. W X -// 129 E F .. U V -// 129 G H .. S T T T T T +// base-1 base-1 base-1 .. base-1 base-1 base-1 base-1 base-1 base-1 +// base+1 A B .. Y Z +// base+1 C D .. W X +// base+1 E F .. U V +// base+1 G H .. S T T T T T // .. #if CONFIG_CHROMA_SUB8X8 @@ -153,14 +183,11 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { #else if (xd->up_available && xd->mb_to_right_edge >= 0) { #endif - // TODO(ltrudeau) replace this with DC_PRED assembly - for (int i = 0; i < width; i++) { - sum_u += dst_u[-dst_u_stride + i]; - sum_v += dst_v[-dst_v_stride + i]; - } + sum_above_row(xd, width, &sum_u, &sum_v); } else { - sum_u = width * 127; - sum_v = width * 127; + const int base = 128 << (xd->bd - 8); + sum_u = width * (base - 1); + sum_v = width * (base - 1); } #if CONFIG_CHROMA_SUB8X8 @@ -168,13 +195,11 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { #else if (xd->left_available && xd->mb_to_bottom_edge >= 0) { #endif - for (int i = 0; i < height; i++) { - sum_u += dst_u[i * dst_u_stride - 1]; - sum_v += dst_v[i * dst_v_stride - 1]; - } + sum_left_col(xd, height, &sum_u, &sum_v); } else { - sum_u += height * 129; - sum_v += height * 129; + const int base = 128 << (xd->bd - 8); + sum_u += height * (base + 1); + sum_v += height * (base + 1); } // TODO(ltrudeau) Because of max_block_wide and max_block_high, num_pel will @@ -183,64 +208,103 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) { cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel; } -static void cfl_compute_averages(CFL_CTX *cfl, TX_SIZE tx_size) { +static void cfl_subtract_averages(CFL_CTX *cfl, TX_SIZE tx_size) { const int width = cfl->uv_width; const int height = cfl->uv_height; const int tx_height = tx_size_high[tx_size]; const int tx_width = tx_size_wide[tx_size]; - const int stride = width >> tx_size_wide_log2[tx_size]; const int block_row_stride = MAX_SB_SIZE << tx_size_high_log2[tx_size]; const int num_pel_log2 = (tx_size_high_log2[tx_size] + tx_size_wide_log2[tx_size]); - // TODO(ltrudeau) Convert to uint16 for HBD support - const uint8_t *y_pix = cfl->y_down_pix; - // TODO(ltrudeau) Convert to uint16 for HBD support - const uint8_t *t_y_pix; - int *averages_q3 = cfl->y_averages_q3; + int16_t *pred_buf_q3 = cfl->pred_buf_q3; - cfl_load(cfl, 0, 0, width, height); + cfl_pad(cfl, width, height); - int a = 0; for (int b_j = 0; b_j < height; b_j += tx_height) { for (int b_i = 0; b_i < width; b_i += tx_width) { - int sum = 0; - t_y_pix = y_pix; + int sum_q3 = 0; + int16_t *tx_pred_buf_q3 = pred_buf_q3; for (int t_j = 0; t_j < tx_height; t_j++) { for (int t_i = b_i; t_i < b_i + tx_width; t_i++) { - sum += t_y_pix[t_i]; + sum_q3 += tx_pred_buf_q3[t_i]; } - t_y_pix += MAX_SB_SIZE; + tx_pred_buf_q3 += MAX_SB_SIZE; } - averages_q3[a++] = - ((sum << 3) + (1 << (num_pel_log2 - 1))) >> num_pel_log2; - + int avg_q3 = (sum_q3 + (1 << (num_pel_log2 - 1))) >> num_pel_log2; // Loss is never more than 1/2 (in Q3) - assert(fabs((double)averages_q3[a - 1] - - (sum / ((double)(1 << num_pel_log2))) * (1 << 3)) <= 0.5); + assert(fabs((double)avg_q3 - (sum_q3 / ((double)(1 << num_pel_log2)))) <= + 0.5); + + tx_pred_buf_q3 = pred_buf_q3; + for (int t_j = 0; t_j < tx_height; t_j++) { + for (int t_i = b_i; t_i < b_i + tx_width; t_i++) { + tx_pred_buf_q3[t_i] -= avg_q3; + } + + tx_pred_buf_q3 += MAX_SB_SIZE; + } } - assert(a % stride == 0); - y_pix += block_row_stride; + pred_buf_q3 += block_row_stride; } - - cfl->y_averages_stride = stride; - assert(a <= MAX_NUM_TXB); } -static INLINE int cfl_idx_to_alpha(int alpha_idx, CFL_SIGN_TYPE alpha_sign, +static INLINE int cfl_idx_to_alpha(int alpha_idx, int joint_sign, CFL_PRED_TYPE pred_type) { - const int mag_idx = cfl_alpha_codes[alpha_idx][pred_type]; - const int abs_alpha_q3 = cfl_alpha_mags_q3[mag_idx]; - if (alpha_sign == CFL_SIGN_POS) { - return abs_alpha_q3; - } else { - assert(abs_alpha_q3 != 0); - assert(cfl_alpha_mags_q3[mag_idx + 1] == -abs_alpha_q3); - return -abs_alpha_q3; + const int alpha_sign = (pred_type == CFL_PRED_U) ? CFL_SIGN_U(joint_sign) + : CFL_SIGN_V(joint_sign); + if (alpha_sign == CFL_SIGN_ZERO) return 0; + const int abs_alpha_q3 = + (pred_type == CFL_PRED_U) ? CFL_IDX_U(alpha_idx) : CFL_IDX_V(alpha_idx); + return (alpha_sign == CFL_SIGN_POS) ? abs_alpha_q3 + 1 : -abs_alpha_q3 - 1; +} + +static void cfl_build_prediction_lbd(const int16_t *pred_buf_q3, uint8_t *dst, + int dst_stride, int width, int height, + int alpha_q3, int dc_pred) { + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + dst[i] = + clip_pixel(get_scaled_luma_q0(alpha_q3, pred_buf_q3[i]) + dc_pred); + } + dst += dst_stride; + pred_buf_q3 += MAX_SB_SIZE; } } -// Predict the current transform block using CfL. +#if CONFIG_HIGHBITDEPTH +static void cfl_build_prediction_hbd(const int16_t *pred_buf_q3, uint16_t *dst, + int dst_stride, int width, int height, + int alpha_q3, int dc_pred, int bit_depth) { + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + dst[i] = clip_pixel_highbd( + get_scaled_luma_q0(alpha_q3, pred_buf_q3[i]) + dc_pred, bit_depth); + } + dst += dst_stride; + pred_buf_q3 += MAX_SB_SIZE; + } +} +#endif // CONFIG_HIGHBITDEPTH + +static void cfl_build_prediction(const int16_t *pred_buf_q3, uint8_t *dst, + int dst_stride, int width, int height, + int alpha_q3, int dc_pred, int use_hbd, + int bit_depth) { +#if CONFIG_HIGHBITDEPTH + if (use_hbd) { + uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst); + cfl_build_prediction_hbd(pred_buf_q3, dst_16, dst_stride, width, height, + alpha_q3, dc_pred, bit_depth); + return; + } +#endif // CONFIG_HIGHBITDEPTH + (void)use_hbd; + (void)bit_depth; + cfl_build_prediction_lbd(pred_buf_q3, dst, dst_stride, width, height, + alpha_q3, dc_pred); +} + void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride, int row, int col, TX_SIZE tx_size, int plane) { CFL_CTX *const cfl = xd->cfl; @@ -249,74 +313,112 @@ void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride, // CfL parameters must be computed before prediction can be done. assert(cfl->are_parameters_computed == 1); - const int width = tx_size_wide[tx_size]; - const int height = tx_size_high[tx_size]; - // TODO(ltrudeau) Convert to uint16 to support HBD - const uint8_t *y_pix = cfl->y_down_pix; + const int16_t *pred_buf_q3 = + cfl->pred_buf_q3 + ((row * MAX_SB_SIZE + col) << tx_size_wide_log2[0]); + const int alpha_q3 = + cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, plane - 1); - const int dc_pred = cfl->dc_pred[plane - 1]; - const int alpha_q3 = cfl_idx_to_alpha( - mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs[plane - 1], plane - 1); - - const int avg_row = - (row << tx_size_wide_log2[0]) >> tx_size_wide_log2[tx_size]; - const int avg_col = - (col << tx_size_high_log2[0]) >> tx_size_high_log2[tx_size]; - const int avg_q3 = - cfl->y_averages_q3[cfl->y_averages_stride * avg_row + avg_col]; + cfl_build_prediction(pred_buf_q3, dst, dst_stride, tx_size_wide[tx_size], + tx_size_high[tx_size], alpha_q3, cfl->dc_pred[plane - 1], + get_bitdepth_data_path_index(xd), xd->bd); +} - cfl_load(cfl, row, col, width, height); +static void cfl_luma_subsampling_420_lbd(const uint8_t *input, int input_stride, + int16_t *output_q3, int width, + int height) { for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { - // TODO(ltrudeau) add support for HBD. - dst[i] = - clip_pixel(get_scaled_luma_q0(alpha_q3, y_pix[i], avg_q3) + dc_pred); + int top = i << 1; + int bot = top + input_stride; + output_q3[i] = (input[top] + input[top + 1] + input[bot] + input[bot + 1]) + << 1; } - dst += dst_stride; - y_pix += MAX_SB_SIZE; + input += input_stride << 1; + output_q3 += MAX_SB_SIZE; } } -void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row, - int col, TX_SIZE tx_size, BLOCK_SIZE bsize) { - const int tx_width = tx_size_wide[tx_size]; - const int tx_height = tx_size_high[tx_size]; - const int tx_off_log2 = tx_size_wide_log2[0]; +static void cfl_luma_subsampling_444_lbd(const uint8_t *input, int input_stride, + int16_t *output_q3, int width, + int height) { + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + output_q3[i] = input[i] << 3; + } + input += input_stride; + output_q3 += MAX_SB_SIZE; + } +} -#if CONFIG_CHROMA_SUB8X8 - if (bsize < BLOCK_8X8) { - // Transform cannot be smaller than - assert(tx_width >= 4); - assert(tx_height >= 4); - - const int bw = block_size_wide[bsize]; - const int bh = block_size_high[bsize]; - - // For chroma_sub8x8, the CfL prediction for prediction blocks smaller than - // 8X8 uses non chroma reference reconstructed luma pixels. To do so, we - // combine the 4X4 non chroma reference into the CfL pixel buffers based on - // their row and column index. - - // The following code is adapted from the is_chroma_reference() function. - if ((cfl->mi_row & - 0x01) // Increment the row index for odd indexed 4X4 blocks - && (bh == 4) // But not for 4X8 blocks - && cfl->subsampling_y) { // And only when chroma is subsampled - assert(row == 0); - row++; +#if CONFIG_HIGHBITDEPTH +static void cfl_luma_subsampling_420_hbd(const uint16_t *input, + int input_stride, int16_t *output_q3, + int width, int height) { + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + int top = i << 1; + int bot = top + input_stride; + output_q3[i] = (input[top] + input[top + 1] + input[bot] + input[bot + 1]) + << 1; } + input += input_stride << 1; + output_q3 += MAX_SB_SIZE; + } +} - if ((cfl->mi_col & - 0x01) // Increment the col index for odd indexed 4X4 blocks - && (bw == 4) // But not for 8X4 blocks - && cfl->subsampling_x) { // And only when chroma is subsampled - assert(col == 0); - col++; +static void cfl_luma_subsampling_444_hbd(const uint16_t *input, + int input_stride, int16_t *output_q3, + int width, int height) { + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + output_q3[i] = input[i] << 3; } + input += input_stride; + output_q3 += MAX_SB_SIZE; } -#else - (void)bsize; -#endif +} +#endif // CONFIG_HIGHBITDEPTH + +static void cfl_luma_subsampling_420(const uint8_t *input, int input_stride, + int16_t *output_q3, int width, int height, + int use_hbd) { +#if CONFIG_HIGHBITDEPTH + if (use_hbd) { + const uint16_t *input_16 = CONVERT_TO_SHORTPTR(input); + cfl_luma_subsampling_420_hbd(input_16, input_stride, output_q3, width, + height); + return; + } +#endif // CONFIG_HIGHBITDEPTH + (void)use_hbd; + cfl_luma_subsampling_420_lbd(input, input_stride, output_q3, width, height); +} + +static void cfl_luma_subsampling_444(const uint8_t *input, int input_stride, + int16_t *output_q3, int width, int height, + int use_hbd) { +#if CONFIG_HIGHBITDEPTH + if (use_hbd) { + uint16_t *input_16 = CONVERT_TO_SHORTPTR(input); + cfl_luma_subsampling_444_hbd(input_16, input_stride, output_q3, width, + height); + return; + } +#endif // CONFIG_HIGHBITDEPTH + (void)use_hbd; + cfl_luma_subsampling_444_lbd(input, input_stride, output_q3, width, height); +} + +static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input, + int input_stride, int row, int col, int width, + int height, int use_hbd) { + const int tx_off_log2 = tx_size_wide_log2[0]; + const int sub_x = cfl->subsampling_x; + const int sub_y = cfl->subsampling_y; + const int store_row = row << (tx_off_log2 - sub_y); + const int store_col = col << (tx_off_log2 - sub_x); + const int store_height = height >> sub_y; + const int store_width = width >> sub_x; // Invalidate current parameters cfl->are_parameters_computed = 0; @@ -325,29 +427,109 @@ void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row, // can manage chroma overrun (e.g. when the chroma surfaces goes beyond the // frame boundary) if (col == 0 && row == 0) { - cfl->y_width = tx_width; - cfl->y_height = tx_height; + cfl->buf_width = store_width; + cfl->buf_height = store_height; } else { - cfl->y_width = OD_MAXI((col << tx_off_log2) + tx_width, cfl->y_width); - cfl->y_height = OD_MAXI((row << tx_off_log2) + tx_height, cfl->y_height); + cfl->buf_width = OD_MAXI(store_col + store_width, cfl->buf_width); + cfl->buf_height = OD_MAXI(store_row + store_height, cfl->buf_height); } // Check that we will remain inside the pixel buffer. - assert((row << tx_off_log2) + tx_height <= MAX_SB_SIZE); - assert((col << tx_off_log2) + tx_width <= MAX_SB_SIZE); + assert(store_row + store_height <= MAX_SB_SIZE); + assert(store_col + store_width <= MAX_SB_SIZE); // Store the input into the CfL pixel buffer - uint8_t *y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << tx_off_log2]; + int16_t *pred_buf_q3 = + cfl->pred_buf_q3 + (store_row * MAX_SB_SIZE + store_col); - // TODO(ltrudeau) Speedup possible by moving the downsampling to cfl_store - for (int j = 0; j < tx_height; j++) { - for (int i = 0; i < tx_width; i++) { - y_pix[i] = input[i]; + if (sub_y == 0 && sub_x == 0) { + cfl_luma_subsampling_444(input, input_stride, pred_buf_q3, store_width, + store_height, use_hbd); + } else if (sub_y == 1 && sub_x == 1) { + cfl_luma_subsampling_420(input, input_stride, pred_buf_q3, store_width, + store_height, use_hbd); + } else { + // TODO(ltrudeau) add support for 4:2:2 + assert(0); // Unsupported chroma subsampling + } +} + +#if CONFIG_CHROMA_SUB8X8 +// Adjust the row and column of blocks smaller than 8X8, as chroma-referenced +// and non-chroma-referenced blocks are stored together in the CfL buffer. +static INLINE void sub8x8_adjust_offset(const CFL_CTX *cfl, int *row_out, + int *col_out) { + // Increment row index for bottom: 8x4, 16x4 or both bottom 4x4s. + if ((cfl->mi_row & 0x01) && cfl->subsampling_y) { + assert(*row_out == 0); + (*row_out)++; + } + + // Increment col index for right: 4x8, 4x16 or both right 4x4s. + if ((cfl->mi_col & 0x01) && cfl->subsampling_x) { + assert(*col_out == 0); + (*col_out)++; + } +} +#if CONFIG_DEBUG +static INLINE void sub8x8_set_val(CFL_CTX *cfl, int row, int col, int val_high, + int val_wide) { + for (int val_r = 0; val_r < val_high; val_r++) { + assert(row + val_r < CFL_SUB8X8_VAL_MI_SIZE); + int row_off = (row + val_r) * CFL_SUB8X8_VAL_MI_SIZE; + for (int val_c = 0; val_c < val_wide; val_c++) { + assert(col + val_c < CFL_SUB8X8_VAL_MI_SIZE); + assert(cfl->sub8x8_val[row_off + col + val_c] == 0); + cfl->sub8x8_val[row_off + col + val_c]++; } - y_pix += MAX_SB_SIZE; - input += input_stride; } } +#endif // CONFIG_DEBUG +#endif // CONFIG_CHROMA_SUB8X8 + +void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size, + BLOCK_SIZE bsize) { + CFL_CTX *const cfl = xd->cfl; + struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y]; + uint8_t *dst = + &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]]; + (void)bsize; +#if CONFIG_CHROMA_SUB8X8 + + if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) { + // Only dimensions of size 4 can have an odd offset. + assert(!((col & 1) && tx_size_wide[tx_size] != 4)); + assert(!((row & 1) && tx_size_high[tx_size] != 4)); + sub8x8_adjust_offset(cfl, &row, &col); +#if CONFIG_DEBUG + sub8x8_set_val(cfl, row, col, tx_size_high_unit[tx_size], + tx_size_wide_unit[tx_size]); +#endif // CONFIG_DEBUG + } +#endif + cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size_wide[tx_size], + tx_size_high[tx_size], get_bitdepth_data_path_index(xd)); +} + +void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) { + CFL_CTX *const cfl = xd->cfl; + struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y]; + int row = 0; + int col = 0; +#if CONFIG_CHROMA_SUB8X8 + bsize = AOMMAX(BLOCK_4X4, bsize); + if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) { + sub8x8_adjust_offset(cfl, &row, &col); +#if CONFIG_DEBUG + sub8x8_set_val(cfl, row, col, mi_size_high[bsize], mi_size_wide[bsize]); +#endif // CONFIG_DEBUG + } +#endif // CONFIG_CHROMA_SUB8X8 + const int width = max_intra_block_width(xd, bsize, AOM_PLANE_Y, tx_size); + const int height = max_intra_block_height(xd, bsize, AOM_PLANE_Y, tx_size); + cfl_store(cfl, pd->dst.buf, pd->dst.stride, row, col, width, height, + get_bitdepth_data_path_index(xd)); +} void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) { CFL_CTX *const cfl = xd->cfl; @@ -359,6 +541,16 @@ void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) { #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX( BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U])); +#if CONFIG_DEBUG + if (mbmi->sb_type < BLOCK_8X8) { + for (int val_r = 0; val_r < mi_size_high[mbmi->sb_type]; val_r++) { + for (int val_c = 0; val_c < mi_size_wide[mbmi->sb_type]; val_c++) { + assert(cfl->sub8x8_val[val_r * CFL_SUB8X8_VAL_MI_SIZE + val_c] == 1); + } + } + cfl_clear_sub8x8_val(cfl); + } +#endif // CONFIG_DEBUG #else const BLOCK_SIZE plane_bsize = get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]); @@ -368,17 +560,10 @@ void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) { cfl->uv_height = max_intra_block_height(xd, plane_bsize, AOM_PLANE_U, tx_size); -#if CONFIG_DEBUG - if (mbmi->sb_type >= BLOCK_8X8) { - assert(cfl->y_width <= cfl->uv_width << cfl->subsampling_x); - assert(cfl->y_height <= cfl->uv_height << cfl->subsampling_y); - } -#endif + assert(cfl->buf_width <= cfl->uv_width); + assert(cfl->buf_height <= cfl->uv_height); - // Compute block-level DC_PRED for both chromatic planes. - // DC_PRED replaces beta in the linear model. cfl_dc_pred(xd, plane_bsize); - // Compute transform-level average on reconstructed luma input. - cfl_compute_averages(cfl, tx_size); + cfl_subtract_averages(cfl, tx_size); cfl->are_parameters_computed = 1; } diff --git a/third_party/aom/av1/common/cfl.h b/third_party/aom/av1/common/cfl.h index f2df4b22b..4ac0b401c 100644 --- a/third_party/aom/av1/common/cfl.h +++ b/third_party/aom/av1/common/cfl.h @@ -12,79 +12,20 @@ #ifndef AV1_COMMON_CFL_H_ #define AV1_COMMON_CFL_H_ -#include <assert.h> +#include "av1/common/blockd.h" -#include "av1/common/enums.h" - -// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic -// dependency by importing av1/common/onyxc_int.h -typedef struct AV1Common AV1_COMMON; - -// Forward declaration of MACROBLOCK, in order to avoid creating a cyclic -// dependency by importing av1/common/blockd.h -typedef struct macroblockd MACROBLOCKD; - -typedef struct { - // Pixel buffer containing the luma pixels used as prediction for chroma - // TODO(ltrudeau) Convert to uint16 for HBD support - uint8_t y_pix[MAX_SB_SQUARE]; - - // Pixel buffer containing the downsampled luma pixels used as prediction for - // chroma - // TODO(ltrudeau) Convert to uint16 for HBD support - uint8_t y_down_pix[MAX_SB_SQUARE]; - - // Height and width of the luma prediction block currently in the pixel buffer - int y_height, y_width; - - // Height and width of the chroma prediction block currently associated with - // this context - int uv_height, uv_width; - - // Transform level averages of the luma reconstructed values over the entire - // prediction unit - // Fixed point y_averages is Q12.3: - // * Worst case division is 1/1024 - // * Max error will be 1/16th. - // Note: 3 is chosen so that y_averages fits in 15 bits when 12 bit input is - // used - int y_averages_q3[MAX_NUM_TXB]; - int y_averages_stride; - - int are_parameters_computed; - - // Chroma subsampling - int subsampling_x, subsampling_y; - - // Block level DC_PRED for each chromatic plane - int dc_pred[CFL_PRED_PLANES]; - - // The rate associated with each alpha codeword - int costs[CFL_ALPHABET_SIZE]; - - int mi_row, mi_col; -} CFL_CTX; - -static const int cfl_alpha_mags_q3[CFL_MAGS_SIZE] = { 0, 1, -1, 2, -2, 4, -4 }; - -static const int cfl_alpha_codes[CFL_ALPHABET_SIZE][CFL_PRED_PLANES] = { - // barrbrain's simple 1D quant ordered by subset 3 likelihood - { 0, 0 }, { 1, 1 }, { 3, 0 }, { 3, 3 }, { 1, 0 }, { 3, 1 }, - { 5, 5 }, { 0, 1 }, { 5, 3 }, { 5, 0 }, { 3, 5 }, { 1, 3 }, - { 0, 3 }, { 5, 1 }, { 1, 5 }, { 0, 5 } -}; - -static INLINE int get_scaled_luma_q0(int alpha_q3, int y_pix, int avg_q3) { - return (alpha_q3 * ((y_pix << 3) - avg_q3) + 32) >> 6; +static INLINE int get_scaled_luma_q0(int alpha_q3, int16_t pred_buf_q3) { + int scaled_luma_q6 = alpha_q3 * pred_buf_q3; + return ROUND_POWER_OF_TWO_SIGNED(scaled_luma_q6, 6); } -void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm); - void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride, int row, int col, TX_SIZE tx_size, int plane); -void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row, - int col, TX_SIZE tx_size, BLOCK_SIZE bsize); +void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size); + +void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size, + BLOCK_SIZE bsize); void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size); diff --git a/third_party/aom/av1/common/clpf_simd.h b/third_party/aom/av1/common/clpf_simd.h index a615b5ed3..c7ffc569a 100644 --- a/third_party/aom/av1/common/clpf_simd.h +++ b/third_party/aom/av1/common/clpf_simd.h @@ -10,10 +10,20 @@ */ #include "./av1_rtcd.h" -#include "./cdef_simd.h" #include "aom_ports/bitops.h" #include "aom_ports/mem.h" +// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp))) +SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold, + unsigned int adjdamp) { + v128 diff = v128_sub_16(a, b); + const v128 sign = v128_shr_n_s16(diff, 15); + diff = v128_abs_s16(diff); + const v128 s = + v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp)); + return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign); +} + // sign(a - b) * min(abs(a - b), max(0, strength - (abs(a - b) >> adjdamp))) SIMD_INLINE v128 constrain(v256 a, v256 b, unsigned int strength, unsigned int adjdamp) { diff --git a/third_party/aom/av1/common/common.h b/third_party/aom/av1/common/common.h index 551055a76..8611b776f 100644 --- a/third_party/aom/av1/common/common.h +++ b/third_party/aom/av1/common/common.h @@ -50,10 +50,6 @@ static INLINE int get_unsigned_bits(unsigned int num_values) { #define CHECK_MEM_ERROR(cm, lval, expr) \ AOM_CHECK_MEM_ERROR(&cm->error, lval, expr) -// TODO(yaowu: validate the usage of these codes or develop new ones.) -#define AV1_SYNC_CODE_0 0x49 -#define AV1_SYNC_CODE_1 0x83 -#define AV1_SYNC_CODE_2 0x43 #define AOM_FRAME_MARKER 0x2 diff --git a/third_party/aom/av1/common/common_data.h b/third_party/aom/av1/common/common_data.h index f49c7335a..1a74fe76e 100644 --- a/third_party/aom/av1/common/common_data.h +++ b/third_party/aom/av1/common/common_data.h @@ -29,35 +29,93 @@ extern "C" { // Log 2 conversion lookup tables for block width and height static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 0, 0, 0, -#endif - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0, 2, 1, 3 + 0, 0, + 0, +#endif + 0, 0, + 1, 1, + 1, 2, + 2, 2, + 3, 3, + 3, 4, + 4, IF_EXT_PARTITION(4, 5, 5) 0, + 2, 1, + 3, 2, + 4, IF_EXT_PARTITION(3, 5) }; static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 0, 0, 0, -#endif - 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2, 0, 3, 1 + 0, 0, + 0, +#endif + 0, 1, + 0, 1, + 2, 1, + 2, 3, + 2, 3, + 4, 3, + 4, IF_EXT_PARTITION(5, 4, 5) 2, + 0, 3, + 1, 4, + 2, IF_EXT_PARTITION(5, 3) }; // Log 2 conversion lookup tables for modeinfo width and height static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CB4X4 #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 0, 0, 0, -#endif - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0, 2, 1, 3 + 0, 0, + 0, +#endif + 0, 0, + 1, 1, + 1, 2, + 2, 2, + 3, 3, + 3, 4, + 4, IF_EXT_PARTITION(4, 5, 5) 0, + 2, 1, + 3, 2, + 4, IF_EXT_PARTITION(3, 5) #else // CONFIG_CB4X4 - 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4) 0, 1, 0, 2 + 0, 0, + 0, 0, + 0, 1, + 1, 1, + 2, 2, + 2, 3, + 3, IF_EXT_PARTITION(3, 4, 4) 0, + 1, 0, + 2, 1, + 3, IF_EXT_PARTITION(2, 4) #endif }; static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CB4X4 #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 0, 0, 0, -#endif - 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2, 0, 3, 1 + 0, 0, + 0, +#endif + 0, 1, + 0, 1, + 2, 1, + 2, 3, + 2, 3, + 4, 3, + 4, IF_EXT_PARTITION(5, 4, 5) 2, + 0, 3, + 1, 4, + 2, IF_EXT_PARTITION(5, 3) #else // CONFIG_CB4X4 - 0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4) 1, 0, 2, 0 + 0, 0, + 0, 0, + 1, 0, + 1, 2, + 1, 2, + 3, 2, + 3, IF_EXT_PARTITION(4, 3, 4) 1, + 0, 2, + 0, 3, + 1, IF_EXT_PARTITION(2, 4) #endif }; @@ -68,9 +126,10 @@ static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = { 1, 1, 1, #endif 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, - IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8 + IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8, 4, 16, IF_EXT_PARTITION(8, 32) #else // CONFIG_CB4X4 - 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4 + 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4, + 2, 8, IF_EXT_PARTITION(4, 16) #endif }; static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = { @@ -79,9 +138,10 @@ static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = { 1, 1, 1, #endif 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, - IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2 + IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2, 16, 4, IF_EXT_PARTITION(32, 8) #else // CONFIG_CB4X4 - 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1 + 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1, + 8, 2, IF_EXT_PARTITION(16, 4) #endif }; /* clang-format on */ @@ -89,248 +149,171 @@ static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = { // Width/height lookup tables in units of various block sizes static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 2, 2, 4, + 2, 2, + 4, #endif - 4, 4, 8, 8, 8, 16, 16, - 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128) 4, - 16, 8, 32 + 4, 4, + 8, 8, + 8, 16, + 16, 16, + 32, 32, + 32, 64, + 64, IF_EXT_PARTITION(64, 128, 128) 4, + 16, 8, + 32, 16, + 64, IF_EXT_PARTITION(32, 128) }; static const uint8_t block_size_high[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 2, 4, 2, + 2, 4, + 2, #endif - 4, 8, 4, 8, 16, 8, 16, - 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128) 16, - 4, 32, 8 + 4, 8, + 4, 8, + 16, 8, + 16, 32, + 16, 32, + 64, 32, + 64, IF_EXT_PARTITION(128, 64, 128) 16, + 4, 32, + 8, 64, + 16, IF_EXT_PARTITION(128, 32) }; static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32) 1, - 4, 2, 8 + 1, 1, + 2, 2, + 2, 4, + 4, 4, + 8, 8, + 8, 16, + 16, IF_EXT_PARTITION(16, 32, 32) 1, + 4, 2, + 8, 4, + 16, IF_EXT_PARTITION(8, 32) }; static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32) 4, - 1, 8, 2 + 1, 2, + 1, 2, + 4, 2, + 4, 8, + 4, 8, + 16, 8, + 16, IF_EXT_PARTITION(32, 16, 32) 4, + 1, 8, + 2, 16, + 4, IF_EXT_PARTITION(32, 8) }; static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4 + 1, 1, + 1, 1, + 1, 2, + 2, 2, + 4, 4, + 4, 8, + 8, IF_EXT_PARTITION(8, 16, 16) 1, + 2, 1, + 4, 2, + 8, IF_EXT_PARTITION(4, 16) }; static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1 + 1, 1, + 1, 1, + 2, 1, + 2, 4, + 2, 4, + 8, 4, + 8, IF_EXT_PARTITION(16, 8, 16) 2, + 1, 4, + 1, 8, + 2, IF_EXT_PARTITION(16, 4) }; static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8) 1, 1, 1, 2 + 1, 1, + 1, 1, + 1, 1, + 1, 1, + 2, 2, + 2, 4, + 4, IF_EXT_PARTITION(4, 8, 8) 1, + 1, 1, + 2, 2, + 4, IF_EXT_PARTITION(2, 8) }; static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 1, 1, 1, + 1, 1, + 1, #endif - 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8) 1, 1, 2, 1 + 1, 1, + 1, 1, + 1, 1, + 1, 2, + 1, 2, + 4, 2, + 4, IF_EXT_PARTITION(8, 4, 8) 1, + 1, 2, + 1, 4, + 2, IF_EXT_PARTITION(8, 2) }; // AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize))) static const uint8_t size_group_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 0, 0, 0, -#endif - 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3) 0, 0, 1, 1 + 0, 0, + 0, +#endif + 0, 0, + 0, 1, + 1, 1, + 2, 2, + 2, 3, + 3, 3, + 3, IF_EXT_PARTITION(3, 3, 3) 0, + 0, 1, + 1, 2, + 2, IF_EXT_PARTITION(3, 3) }; static const uint8_t num_pels_log2_lookup[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - 2, 3, 3, -#endif - 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14) 6, - 6, 8, 8 + 2, 3, + 3, +#endif + 4, 5, + 5, 6, + 7, 7, + 8, 9, + 9, 10, + 11, 11, + 12, IF_EXT_PARTITION(13, 13, 14) 6, + 6, 8, + 8, 10, + 10, IF_EXT_PARTITION(12, 12) }; /* clang-format off */ -static const PARTITION_TYPE - partition_lookup[MAX_SB_SIZE_LOG2 - 1][BLOCK_SIZES_ALL] = { - { // 4X4 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_NONE, - // 4X8, 8X4, 8X8 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 8X16, 16X8, 16X16 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 16X32, 32X16, 32X32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32X64, 64X32, 64X64 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#if CONFIG_EXT_PARTITION - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif // CONFIG_EXT_PARTITION - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID - }, { // 8X8 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_SPLIT, - // 4X8, 8X4, 8X8 - PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, - // 8X16, 16X8, 16X16 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 16X32, 32X16, 32X32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32X64, 64X32, 64X64 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#if CONFIG_EXT_PARTITION - // 64x128, 128x64, 128x128 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif // CONFIG_EXT_PARTITION - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID - }, { // 16X16 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_SPLIT, - // 4X8, 8X4, 8X8 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 8X16, 16X8, 16X16 - PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, - // 16X32, 32X16, 32X32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32X64, 64X32, 64X64 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#if CONFIG_EXT_PARTITION - // 64x128, 128x64, 128x128 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif // CONFIG_EXT_PARTITION -#if CONFIG_EXT_PARTITION_TYPES - // 4x16, 16x4, 8x32 - PARTITION_VERT_4, PARTITION_HORZ_4, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID -#else - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID -#endif - }, { // 32X32 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_SPLIT, - // 4X8, 8X4, 8X8 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 8X16, 16X8, 16X16 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 16X32, 32X16, 32X32 - PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, - // 32X64, 64X32, 64X64 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#if CONFIG_EXT_PARTITION - // 64x128, 128x64, 128x128 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif // CONFIG_EXT_PARTITION -#if CONFIG_EXT_PARTITION_TYPES - // 4x16, 16x4, 8x32 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT_4, - // 32x8 - PARTITION_HORZ_4 -#else - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID -#endif - }, { // 64X64 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_SPLIT, - // 4X8, 8X4, 8X8 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 8X16, 16X8, 16X16 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 16X32, 32X16, 32X32 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 32X64, 64X32, 64X64 - PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, -#if CONFIG_EXT_PARTITION - // 64x128, 128x64, 128x128 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif // CONFIG_EXT_PARTITION -#if CONFIG_EXT_PARTITION_TYPES - // 4x16, 16x4, 8x32 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 32x8 - PARTITION_SPLIT -#else - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID -#endif // CONFIG_EXT_PARTITION_TYPES -#if CONFIG_EXT_PARTITION - }, { // 128x128 -> -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - // 2X2, 2X4, 4X2, - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, -#endif - // 4X4 - PARTITION_SPLIT, - // 4X8, 8X4, 8X8 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 8X16, 16X8, 16X16 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 16X32, 32X16, 32X32 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 32X64, 64X32, 64X64 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 64x128, 128x64, 128x128 - PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, -#if CONFIG_EXT_PARTITION_TYPES - // 4x16, 16x4, 8x32 - PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, - // 32x8 - PARTITION_SPLIT -#else - // 4x16, 16x4, 8x32 - PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, - // 32x8 - PARTITION_INVALID -#endif // CONFIG_EXT_PARTITION_TYPES -#endif // CONFIG_EXT_PARTITION - } -}; - #if CONFIG_EXT_PARTITION_TYPES static const BLOCK_SIZE subsize_lookup[EXT_PARTITION_TYPES][BLOCK_SIZES_ALL] = #else @@ -358,8 +341,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_4X16, BLOCK_16X4, BLOCK_8X32, - // 32X8, - BLOCK_32X8, + // 32X8, 16X64, 64X16 + BLOCK_32X8, BLOCK_16X64, BLOCK_64X16, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_32X128, BLOCK_128X32 +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_HORZ #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -384,8 +371,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_VERT #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -410,8 +401,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_SPLIT #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -433,8 +428,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION #if CONFIG_EXT_PARTITION_TYPES }, { // PARTITION_HORZ_A #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 @@ -457,8 +456,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_HORZ_B #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -480,8 +483,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_VERT_A #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -503,8 +510,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_VERT_B #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, @@ -526,8 +537,12 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_HORZ_4 #if CONFIG_CB4X4 // 2X2, 2X4, 4X2, @@ -545,15 +560,19 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = // 16X32, 32X16, 32X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X8, // 32X64, 64X32, 64X64 - BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, + BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X16, #if CONFIG_EXT_PARTITION // 64x128, 128x64, 128x128 - BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, + BLOCK_INVALID, BLOCK_INVALID, BLOCK_128X32, #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }, { // PARTITION_VERT_4 #if CONFIG_CB4X4 // 2X2, 2X4, 4X2, @@ -571,15 +590,19 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] = // 16X32, 32X16, 32X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X32, // 32X64, 64X32, 64X64 - BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, + BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X64, #if CONFIG_EXT_PARTITION // 64x128, 128x64, 128x128 - BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, + BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X128, #endif // CONFIG_EXT_PARTITION // 4X16, 16X4, 8X32 BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, - // 32X8, - BLOCK_INVALID, + // 32X8, 16X64, 64X16 + BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + BLOCK_INVALID, BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION #endif // CONFIG_EXT_PARTITION_TYPES } }; @@ -618,8 +641,12 @@ static const TX_SIZE max_txsize_lookup[BLOCK_SIZES_ALL] = { #endif // CONFIG_TX64X64 // 4x16, 16x4, 8x32 TX_4X4, TX_4X4, TX_8X8, - // 32x8 - TX_8X8 + // 32x8, 16x64 64x16 + TX_8X8, TX_16X16, TX_16X16, +#if CONFIG_EXT_PARTITION + // 32x128 128x32 + TX_32X32, TX_32X32 +#endif // CONFIG_EXT_PARTITION }; #if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX) @@ -638,9 +665,9 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES_ALL] = { TX_8X16, TX_16X8, TX_16X16, // 16X32, 32X16, 32X32 TX_16X32, TX_32X16, TX_32X32, - // 32X64, 64X32, - TX_32X32, TX_32X32, #if CONFIG_TX64X64 + // 32X64, 64X32, + TX_32X64, TX_64X32, // 64X64 TX_64X64, #if CONFIG_EXT_PARTITION @@ -648,6 +675,8 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES_ALL] = { TX_64X64, TX_64X64, TX_64X64, #endif // CONFIG_EXT_PARTITION #else + // 32X64, 64X32, + TX_32X32, TX_32X32, // 64X64 TX_32X32, #if CONFIG_EXT_PARTITION @@ -659,13 +688,19 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES_ALL] = { // 4x16, 16x4, 8x32 TX_4X16, TX_16X4, TX_8X32, // 32x8 - TX_32X8 + TX_32X8, #else // 4x16, 16x4, 8x32 TX_4X8, TX_8X4, TX_8X16, // 32x8 - TX_16X8 + TX_16X8, #endif + // 16x64, 64x16 + TX_16X32, TX_32X16, +#if CONFIG_EXT_PARTITION + // 32x128 128x32 + TX_32X32, TX_32X32 +#endif // CONFIG_EXT_PARTITION }; #if CONFIG_RECT_TX_EXT @@ -690,8 +725,12 @@ static const TX_SIZE quarter_txsize_lookup[BLOCK_SIZES_ALL] = { #endif // 4x16, 16x4, 8x32 TX_4X16, TX_16X4, TX_8X32, - // 32x8 - TX_32X8 + // 32x8 16x64 64x16 + TX_32X8, TX_INVALID, TX_INVALID, +#if CONFIG_EXT_PARTITION + // 32x128 128x32 + TX_INVALID, TX_INVALID +#endif // CONFIG_EXT_PARTITION }; #endif #else @@ -738,9 +777,9 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, // 16X32, 32X16, 32X32 TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, - // 32X64, 64X32, - TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, #if CONFIG_TX64X64 + // 32X64, 64X32, + TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, // 64X64 TX_64X64 - TX_8X8, #if CONFIG_EXT_PARTITION @@ -748,6 +787,8 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, #endif // CONFIG_EXT_PARTITION #else + // 32X64, 64X32, + TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, // 64X64 TX_32X32 - TX_8X8, #if CONFIG_EXT_PARTITION @@ -757,10 +798,14 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { #endif // CONFIG_TX64X64 // TODO(david.barker): Change these if we support rectangular transforms // for 4:1 shaped partitions - // 4x16, 16x4, 8x32 - INT32_MIN, INT32_MIN, TX_8X8 - TX_8X8, - // 32x8 - TX_8X8 - TX_8X8 + // 4x16, 16x4, 8x32 + TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, + // 32x8, 16x64, 64x16 + TX_8X8 - TX_8X8, TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + TX_32X32 - TX_8X8, TX_32X32 - TX_8X8 +#endif // CONFIG_EXT_PARTITION }; #else // Same as "max_txsize_lookup[bsize] - TX_8X8", invalid for bsize < 8X8 @@ -777,9 +822,9 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, TX_16X16 - TX_8X8, // 16X32, 32X16, 32X32 TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, TX_32X32 - TX_8X8, - // 32X64, 64X32, - TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, #if CONFIG_TX64X64 + // 32X64, 64X32, + TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, // 64X64 TX_64X64 - TX_8X8, #if CONFIG_EXT_PARTITION @@ -787,6 +832,8 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, TX_64X64 - TX_8X8, #endif // CONFIG_EXT_PARTITION #else + // 32X64, 64X32, + TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, // 64X64 TX_32X32 - TX_8X8, #if CONFIG_EXT_PARTITION @@ -794,10 +841,14 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, TX_32X32 - TX_8X8, #endif // CONFIG_EXT_PARTITION #endif // CONFIG_TX64X64 - // 4x16, 16x4, 8x32 - INT32_MIN, INT32_MIN, TX_8X8 - TX_8X8, - // 32x8 - TX_8X8 - TX_8X8 + // 4x16, 16x4, 8x32 + TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, + // 32x8 16x64, 64x16 + TX_8X8 - TX_8X8, TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, +#if CONFIG_EXT_PARTITION + // 32x128, 128x32 + TX_32X32 - TX_8X8, TX_32X32 - TX_8X8 +#endif // CONFIG_EXT_PARTITION }; #endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX) @@ -822,6 +873,10 @@ static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = { TX_8X8, // TX_16X8 TX_16X16, // TX_16X32 TX_16X16, // TX_32X16 +#if CONFIG_TX64X64 + TX_32X32, // TX_32X64 + TX_32X32, // TX_64X32 +#endif // CONFIG_TX64X64 TX_4X4, // TX_4X16 TX_4X4, // TX_16X4 TX_8X8, // TX_8X32 @@ -845,6 +900,10 @@ static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = { TX_16X16, // TX_16X8 TX_16X16, // TX_16X32 TX_32X32, // TX_32X16 +#if CONFIG_TX64X64 + TX_32X32, // TX_32X64 + TX_64X64, // TX_64X32 +#endif // CONFIG_TX64X64 TX_4X4, // TX_4X16 TX_16X16, // TX_16X4 TX_8X8, // TX_8X32 @@ -868,6 +927,10 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = { TX_8X8, // TX_16X8 TX_32X32, // TX_16X32 TX_16X16, // TX_32X16 +#if CONFIG_TX64X64 + TX_64X64, // TX_32X64 + TX_32X32, // TX_64X32 +#endif // CONFIG_TX64X64 TX_16X16, // TX_4X16 TX_4X4, // TX_16X4 TX_32X32, // TX_8X32 @@ -885,11 +948,15 @@ static const int tx_size_wide[TX_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 2, #endif - 4, 8, 16, 32, + 4, 8, 16, 32, #if CONFIG_TX64X64 64, #endif // CONFIG_TX64X64 - 4, 8, 8, 16, 16, 32, 4, 16, 8, 32 + 4, 8, 8, 16, 16, 32, +#if CONFIG_TX64X64 + 32, 64, +#endif // CONFIG_TX64X64 + 4, 16, 8, 32 }; #if CONFIG_CHROMA_2X2 @@ -903,44 +970,64 @@ static const int tx_size_high[TX_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 2, #endif - 4, 8, 16, 32, + 4, 8, 16, 32, #if CONFIG_TX64X64 64, #endif // CONFIG_TX64X64 - 8, 4, 16, 8, 32, 16, 16, 4, 32, 8 + 8, 4, 16, 8, 32, 16, +#if CONFIG_TX64X64 + 64, 32, +#endif // CONFIG_TX64X64 + 16, 4, 32, 8 }; // Transform block width in unit static const int tx_size_wide_unit[TX_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 - 1, 2, 4, 8, 16, + 1, 2, 4, 8, 16, #if CONFIG_TX64X64 32, #endif // CONFIG_TX64X64 - 2, 4, 4, 8, 8, 16, 2, 8, 4, 16 + 2, 4, 4, 8, 8, 16, +#if CONFIG_TX64X64 + 16, 32, +#endif // CONFIG_TX64X64 + 2, 8, 4, 16 #else // CONFIG_CHROMA_2X2 - 1, 2, 4, 8, + 1, 2, 4, 8, #if CONFIG_TX64X64 16, #endif // CONFIG_TX64X64 - 1, 2, 2, 4, 4, 8, 1, 4, 2, 8 + 1, 2, 2, 4, 4, 8, +#if CONFIG_TX64X64 + 8, 16, +#endif // CONFIG_TX64X64 + 1, 4, 2, 8 #endif // CONFIG_CHROMA_2X2 }; // Transform block height in unit static const int tx_size_high_unit[TX_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 - 1, 2, 4, 8, 16, + 1, 2, 4, 8, 16, #if CONFIG_TX64X64 32, #endif // CONFIG_TX64X64 - 4, 2, 8, 4, 16, 8, 8, 2, 16, 4 + 4, 2, 8, 4, 16, 8, +#if CONFIG_TX64X64 + 32, 16, +#endif // CONFIG_TX64X64 + 8, 2, 16, 4 #else // CONFIG_CHROMA_2X2 1, 2, 4, 8, #if CONFIG_TX64X64 16, #endif // CONFIG_TX64X64 - 2, 1, 4, 2, 8, 4, 4, 1, 8, 2 + 2, 1, 4, 2, 8, 4, +#if CONFIG_TX64X64 + 16, 8, +#endif // CONFIG_TX64X64 + 4, 1, 8, 2 #endif // CONFIG_CHROMA_2X2 }; @@ -953,7 +1040,11 @@ static const int tx_size_wide_log2[TX_SIZES_ALL] = { #if CONFIG_TX64X64 6, #endif // CONFIG_TX64X64 - 2, 3, 3, 4, 4, 5, 2, 4, 3, 5 + 2, 3, 3, 4, 4, 5, +#if CONFIG_TX64X64 + 5, 6, +#endif // CONFIG_TX64X64 + 2, 4, 3, 5 }; // Transform block height in log2 @@ -965,7 +1056,11 @@ static const int tx_size_high_log2[TX_SIZES_ALL] = { #if CONFIG_TX64X64 6, #endif // CONFIG_TX64X64 - 3, 2, 4, 3, 5, 4, 4, 2, 5, 3 + 3, 2, 4, 3, 5, 4, +#if CONFIG_TX64X64 + 6, 5, +#endif // CONFIG_TX64X64 + 4, 2, 5, 3 }; #define TX_UNIT_WIDE_LOG2 (MI_SIZE_LOG2 - tx_size_wide_log2[0]) @@ -975,11 +1070,15 @@ static const int tx_size_2d[TX_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 4, #endif - 16, 64, 256, 1024, + 16, 64, 256, 1024, #if CONFIG_TX64X64 4096, #endif // CONFIG_TX64X64 - 32, 32, 128, 128, 512, 512, 64, 64, 256, 256 + 32, 32, 128, 128, 512, 512, +#if CONFIG_TX64X64 + 2048, 2048, +#endif // CONFIG_TX64X64 + 64, 64, 256, 256 }; static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = { @@ -999,6 +1098,10 @@ static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = { BLOCK_16X8, // TX_16X8 BLOCK_16X32, // TX_16X32 BLOCK_32X16, // TX_32X16 +#if CONFIG_TX64X64 + BLOCK_32X64, // TX_32X64 + BLOCK_64X32, // TX_64X32 +#endif // CONFIG_TX64X64 BLOCK_4X16, // TX_4X16 BLOCK_16X4, // TX_16X4 BLOCK_8X32, // TX_8X32 @@ -1022,6 +1125,10 @@ static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = { TX_8X8, // TX_16X8 TX_16X16, // TX_16X32 TX_16X16, // TX_32X16 +#if CONFIG_TX64X64 + TX_32X32, // TX_32X64 + TX_32X32, // TX_64X32 +#endif // CONFIG_TX64X64 TX_4X4, // TX_4X16 TX_4X4, // TX_16X4 TX_8X8, // TX_8X32 @@ -1045,6 +1152,10 @@ static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = { TX_16X16, // TX_16X8 TX_32X32, // TX_16X32 TX_32X32, // TX_32X16 +#if CONFIG_TX64X64 + TX_64X64, // TX_32X64 + TX_64X64, // TX_64X32 +#endif // CONFIG_TX64X64 TX_16X16, // TX_4X16 TX_16X16, // TX_16X4 TX_32X32, // TX_8X32 @@ -1100,10 +1211,16 @@ static const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES_ALL][2][2] = { { { BLOCK_128X64, BLOCK_INVALID }, { BLOCK_64X64, BLOCK_64X32 } }, { { BLOCK_128X128, BLOCK_128X64 }, { BLOCK_64X128, BLOCK_64X64 } }, #endif // CONFIG_EXT_PARTITION - { { BLOCK_4X16, BLOCK_4X8 }, { BLOCK_INVALID, BLOCK_INVALID } }, - { { BLOCK_16X4, BLOCK_INVALID }, { BLOCK_8X4, BLOCK_INVALID } }, + { { BLOCK_4X16, BLOCK_4X8 }, { BLOCK_INVALID, BLOCK_4X8 } }, + { { BLOCK_16X4, BLOCK_INVALID }, { BLOCK_8X4, BLOCK_8X4 } }, { { BLOCK_8X32, BLOCK_8X16 }, { BLOCK_INVALID, BLOCK_4X16 } }, { { BLOCK_32X8, BLOCK_INVALID }, { BLOCK_16X8, BLOCK_16X4 } }, + { { BLOCK_16X64, BLOCK_16X32 }, { BLOCK_INVALID, BLOCK_8X32 } }, + { { BLOCK_64X16, BLOCK_INVALID }, { BLOCK_32X16, BLOCK_32X8 } }, +#if CONFIG_EXT_PARTITION + { { BLOCK_32X128, BLOCK_32X64 }, { BLOCK_INVALID, BLOCK_16X64 } }, + { { BLOCK_128X32, BLOCK_INVALID }, { BLOCK_64X32, BLOCK_64X16 } }, +#endif // CONFIG_EXT_PARTITION }; static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { @@ -1123,6 +1240,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#if CONFIG_TX64X64 + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#endif // CONFIG_TX64X64 { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, @@ -1147,13 +1268,17 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#if CONFIG_TX64X64 + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#endif // CONFIG_TX64X64 { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, }, { - // BLOCK_2X4 + // BLOCK_4X2 { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, @@ -1165,6 +1290,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#if CONFIG_TX64X64 + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, + { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, +#endif // CONFIG_TX64X64 { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } }, @@ -1175,7 +1304,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { }, #elif CONFIG_CHROMA_SUB8X8 { - // BLOCK_2X2 + // BLOCK_2x2 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1186,6 +1315,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1209,13 +1342,17 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, }, { - // BLOCK_2X4 + // BLOCK_4X2 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1226,6 +1363,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1252,6 +1393,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1284,6 +1429,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1313,6 +1462,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, @@ -1336,6 +1489,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } }, { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } }, { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } }, { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } }, @@ -1351,7 +1508,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, #if CONFIG_TX64X64 - { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, + { { TX_8X16, TX_8X8 }, { TX_4X4, TX_4X4 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } }, @@ -1359,6 +1516,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } }, +#if CONFIG_TX64X64 + { { TX_8X16, TX_8X8 }, { TX_4X4, TX_4X4 } }, + { { TX_8X16, TX_8X8 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X16, TX_8X8 }, { TX_4X16, TX_4X8 } }, @@ -1374,7 +1535,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, #if CONFIG_TX64X64 - { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, + { { TX_16X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1382,6 +1543,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, // used { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, +#if CONFIG_TX64X64 + { { TX_16X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, + { { TX_16X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } }, { { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } }, { { TX_8X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, @@ -1405,6 +1570,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } }, { { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } }, { { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } }, +#if CONFIG_TX64X64 + { { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1420,7 +1589,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, #if CONFIG_TX64X64 - { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, + { { TX_16X32, TX_16X16 }, { TX_8X8, TX_8X8 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1428,6 +1597,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } }, { { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } }, // used { { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } }, +#if CONFIG_TX64X64 + { { TX_16X32, TX_16X16 }, { TX_8X8, TX_8X8 } }, + { { TX_16X32, TX_16X16 }, { TX_8X8, TX_8X8 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X16 }, { TX_4X16, TX_4X16 } }, { { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } }, { { TX_8X32, TX_8X16 }, { TX_8X32, TX_8X16 } }, @@ -1443,7 +1616,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, #if CONFIG_TX64X64 - { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, + { { TX_32X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1451,6 +1624,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_32X16, TX_16X8 }, { TX_16X16, TX_16X8 } }, { { TX_32X16, TX_16X8 }, { TX_16X16, TX_16X8 } }, // used +#if CONFIG_TX64X64 + { { TX_32X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, + { { TX_32X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1474,6 +1651,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X16 }, { TX_16X32, TX_16X16 } }, { { TX_32X16, TX_32X16 }, { TX_16X16, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X32, TX_16X16 }, { TX_16X16, TX_16X16 } }, + { { TX_32X32, TX_16X16 }, { TX_16X16, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1497,6 +1678,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X32 }, { TX_16X16, TX_16X16 } }, { { TX_32X16, TX_32X16 }, { TX_16X16, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X64, TX_32X32 }, { TX_16X16, TX_16X16 } }, + { { TX_32X32, TX_32X32 }, { TX_16X16, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1520,6 +1705,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X16 }, { TX_16X32, TX_16X16 } }, { { TX_32X16, TX_16X16 }, { TX_32X16, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, + { { TX_64X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1543,6 +1732,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } }, { { TX_32X16, TX_32X16 }, { TX_32X16, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X64, TX_32X32 }, { TX_16X16, TX_16X16 } }, + { { TX_64X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1559,7 +1752,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } }, { { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } }, #if CONFIG_TX64X64 - { { TX_64X64, TX_64X64 }, { TX_32X32, TX_32X32 } }, + { { TX_64X64, TX_32X32 }, { TX_32X32, TX_32X32 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1567,6 +1760,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } }, { { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } }, +#if CONFIG_TX64X64 + { { TX_32X64, TX_32X32 }, { TX_16X16, TX_16X16 } }, + { { TX_64X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } }, { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } }, { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } }, @@ -1582,7 +1779,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } }, { { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } }, #if CONFIG_TX64X64 - { { TX_64X64, TX_32X32 }, { TX_64X64, TX_32X32 } }, + { { TX_64X64, TX_32X32 }, { TX_32X32, TX_32X32 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1590,6 +1787,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } }, { { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } }, +#if CONFIG_TX64X64 + { { TX_32X64, TX_32X32 }, { TX_16X16, TX_16X16 } }, + { { TX_64X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1605,7 +1806,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } }, { { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } }, #if CONFIG_TX64X64 - { { TX_64X64, TX_64X64 }, { TX_64X64, TX_64X64 } }, + { { TX_64X64, TX_32X32 }, { TX_32X32, TX_32X32 } }, #endif // CONFIG_TX64X64 { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, @@ -1613,6 +1814,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, { { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } }, { { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } }, +#if CONFIG_TX64X64 + { { TX_32X64, TX_32X32 }, { TX_16X16, TX_16X16 } }, + { { TX_64X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, @@ -1639,6 +1844,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_4X8, TX_4X8 }, { TX_4X4, TX_4X4 } }, { { TX_4X8, TX_4X8 }, { TX_4X4, TX_4X4 } }, { { TX_4X8, TX_4X8 }, { TX_4X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X8 }, { TX_4X4, TX_4X4 } }, { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_4X16, TX_4X8 }, { TX_4X4, TX_4X4 } }, @@ -1664,6 +1873,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X4, TX_4X4 }, { TX_8X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_8X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_8X4, TX_4X4 } }, +#if CONFIG_TX64X64 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, { { TX_16X4, TX_4X4 }, { TX_8X4, TX_4X4 } }, { { TX_8X4, TX_4X4 }, { TX_8X4, TX_4X4 } }, @@ -1687,6 +1900,10 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_8X8, TX_8X8 }, { TX_4X8, TX_4X8 } }, { { TX_8X16, TX_8X16 }, { TX_4X8, TX_4X8 } }, { { TX_8X16, TX_8X16 }, { TX_4X8, TX_4X8 } }, +#if CONFIG_TX64X64 + { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X16, TX_4X16 }, { TX_4X16, TX_4X16 } }, { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } }, { { TX_8X32, TX_8X16 }, { TX_4X16, TX_4X16 } }, @@ -1710,11 +1927,117 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES_ALL][TX_SIZES_ALL][2][2] = { { { TX_16X8, TX_8X4 }, { TX_16X8, TX_8X4 } }, { { TX_16X8, TX_8X4 }, { TX_16X8, TX_8X4 } }, { { TX_16X8, TX_8X4 }, { TX_16X8, TX_8X4 } }, +#if CONFIG_TX64X64 + { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, + { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, +#endif // CONFIG_TX64X64 { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } }, { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, { { TX_8X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, { { TX_32X8, TX_16X4 }, { TX_16X8, TX_16X4 } }, - } + }, + { +// BLOCK_16X64 +#if CONFIG_CHROMA_2X2 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, +#if CONFIG_TX64X64 + { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, +#endif + { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, + { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, + { { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } }, + { { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X32, TX_16X32 }, { TX_8X16, TX_8X16 } }, + { { TX_16X16, TX_16X16 }, { TX_8X16, TX_8X16 } }, +#if CONFIG_TX64X64 + { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, +#endif + { { TX_4X16, TX_4X16 }, { TX_4X16, TX_4X16 } }, + { { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } }, + { { TX_8X32, TX_8X32 }, { TX_8X32, TX_8X32 } }, + { { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } }, + }, + { +// BLOCK_64X16 +#if CONFIG_CHROMA_2X2 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, + { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, +#if CONFIG_TX64X64 + { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, +#endif + { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, + { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, + { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, + { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, + { { TX_16X16, TX_16X8 }, { TX_16X16, TX_16X8 } }, + { { TX_32X16, TX_16X8 }, { TX_32X16, TX_16X8 } }, +#if CONFIG_TX64X64 + { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, + { { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, +#endif + { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } }, + { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, + { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } }, + { { TX_32X8, TX_32X8 }, { TX_32X8, TX_32X8 } }, + }, +#if CONFIG_EXT_PARTITION + { +// BLOCK_32X128 +#if CONFIG_CHROMA_2X2 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } }, + { { TX_32X32, TX_32X32 }, { TX_16X16, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X32, TX_32X32 }, { TX_16X16, TX_16X16 } }, +#endif + { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, + { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, + { { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } }, + { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, + { { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } }, + { { TX_32X16, TX_32X16 }, { TX_16X16, TX_16X16 } }, + { { TX_4X16, TX_4X16 }, { TX_4X16, TX_4X16 } }, + { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, + { { TX_8X32, TX_8X32 }, { TX_8X32, TX_8X32 } }, + { { TX_32X8, TX_32X8 }, { TX_16X8, TX_16X8 } }, + }, + { +// BLOCK_128X32 +#if CONFIG_CHROMA_2X2 + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, +#endif + { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, + { { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } }, + { { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } }, + { { TX_32X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#if CONFIG_TX64X64 + { { TX_32X32, TX_16X16 }, { TX_32X32, TX_16X16 } }, +#endif + { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } }, + { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } }, + { { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } }, + { { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } }, + { { TX_16X32, TX_16X16 }, { TX_16X32, TX_16X16 } }, + { { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } }, + { { TX_4X16, TX_4X16 }, { TX_4X16, TX_4X16 } }, + { { TX_16X4, TX_16X4 }, { TX_16X4, TX_16X4 } }, + { { TX_8X32, TX_8X16 }, { TX_8X32, TX_8X16 } }, + { { TX_32X8, TX_32X8 }, { TX_32X8, TX_32X8 } }, + }, +#endif }; // Generates 4 bit field in which each bit set to 1 represents @@ -1748,10 +2071,14 @@ static const struct { { 0, 16 }, // 128X64- {0b00000, 0b10000} { 0, 0 }, // 128X128-{0b00000, 0b00000} - { 31, 28 }, // 4X16 - {0b11111, 0b11100} - { 28, 31 }, // 16X4 - {0b11100, 0b11111} - { 30, 24 }, // 8X32 - {0b11110, 0b11000} - { 24, 30 }, // 32X8 - {0b11000, 0b11110} + { 31, 28 }, // 4X16 - {0b11111, 0b11100} + { 28, 31 }, // 16X4 - {0b11100, 0b11111} + { 30, 24 }, // 8X32 - {0b11110, 0b11000} + { 24, 30 }, // 32X8 - {0b11000, 0b11110} + { 28, 16 }, // 16X64 - {0b11100, 0b10000} + { 16, 28 }, // 64X16 - {0b10000, 0b11100} + { 24, 0 }, // 32X128- {0b11000, 0b00000} + { 0, 24 }, // 128X32- {0b00000, 0b11000} #else #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 { 15, 15 }, // 2X2 - {0b1111, 0b1111} @@ -1774,12 +2101,24 @@ static const struct { { 15, 12 }, // 4X16 - {0b1111, 0b1100} { 12, 15 }, // 16X4 - {0b1100, 0b1111} - { 8, 14 }, // 8X32 - {0b1110, 0b1000} - { 14, 8 }, // 32X8 - {0b1000, 0b1110} + { 8, 14 }, // 8X32 - {0b1110, 0b1000} + { 14, 8 }, // 32X8 - {0b1000, 0b1110} + { 12, 0 }, // 16X64- {0b1100, 0b0000} + { 0, 12 }, // 64X16- {0b0000, 0b1100} #endif // CONFIG_EXT_PARTITION }; /* clang-format on */ +#if CONFIG_KF_CTX +static const int intra_mode_context[INTRA_MODES] = { + 0, 1, 2, 3, 4, 4, 4, 4, 3, 0, +#if CONFIG_SMOOTH_HV + 1, 2, +#endif + 0, +}; +#endif + #if CONFIG_SUPERTX static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = { // ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1 @@ -1831,8 +2170,25 @@ static const ADAPT_OVERLAP_BLOCK adapt_overlap_block_lookup[BLOCK_SIZES_ALL] = { ADAPT_OVERLAP_BLOCK_INVALID, #endif // CONFIG_EXT_PARTITION ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID, + ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID, + ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID, +#if CONFIG_EXT_PARTITION ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID +#endif // CONFIG_EXT_PARTITION }; + +static const BLOCK_SIZE bsize_2_sqr_bsize[BLOCK_SIZES] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + BLOCK_2X2, BLOCK_2X2, BLOCK_2X2, +#endif + BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_8X8, BLOCK_8X8, + BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, BLOCK_32X32, + BLOCK_32X32, BLOCK_32X32, BLOCK_64X64, +#if CONFIG_EXT_PARTITION + BLOCK_64X64, BLOCK_64X64, +#endif +}; + #endif // CONFIG_NCOBMC_ADAPT_WEIGHT #if CONFIG_ADAPT_SCAN diff --git a/third_party/aom/av1/common/convolve.c b/third_party/aom/av1/common/convolve.c index 54ad7555c..5476f59a6 100644 --- a/third_party/aom/av1/common/convolve.c +++ b/third_party/aom/av1/common/convolve.c @@ -14,6 +14,7 @@ #include "./aom_dsp_rtcd.h" #include "./av1_rtcd.h" +#include "av1/common/blockd.h" #include "av1/common/convolve.h" #include "av1/common/filter.h" #include "av1/common/onyxc_int.h" @@ -360,11 +361,75 @@ void av1_convolve_2d_c(const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x]; } CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1); - dst[y * dst_stride + x] += res; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + } +} + +void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, + CONV_BUF_TYPE *dst, int dst_stride, int w, int h, + InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int x_step_qn, + const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params) { + int x, y, k; + uint8_t im_block[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + int im_stride = w; + const int fo_vert = filter_params_y->taps / 2 - 1; + const int fo_horiz = filter_params_x->taps / 2 - 1; + + // horizontal filter + const uint8_t *src_horiz = src - fo_vert * src_stride; + for (y = 0; y < im_h; ++y) { + int x_qn = subpel_x_qn; + for (x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint8_t *const src_x = &src_horiz[(x_qn >> SCALE_SUBPEL_BITS)]; + const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(x_filter_idx < SUBPEL_SHIFTS); + const int16_t *x_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx); + int sum = 0; + for (k = 0; k < filter_params_x->taps; ++k) + sum += x_filter[k] * src_x[k - fo_horiz]; + im_block[y * im_stride + x] = + clip_pixel(ROUND_POWER_OF_TWO(sum, conv_params->round_0)); + } + src_horiz += src_stride; + } + + // vertical filter + const uint8_t *src_vert = im_block + fo_vert * im_stride; + for (x = 0; x < w; ++x) { + int y_qn = subpel_y_qn; + for (y = 0; y < h; ++y, y_qn += y_step_qn) { + const uint8_t *const src_y = + &src_vert[(y_qn >> SCALE_SUBPEL_BITS) * im_stride]; + const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(y_filter_idx < SUBPEL_SHIFTS); + const int16_t *y_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx); + CONV_BUF_TYPE sum = 0; + for (k = 0; k < filter_params_y->taps; ++k) { + sum += y_filter[k] * src_y[(k - fo_vert) * im_stride]; + } + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1); + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; } + src_vert++; } } + #else + /* When convolve-round is enabled and compound-round is disabled, we use a high-precision convolve filter. Note: For notes on hardware implementations, including the required @@ -416,60 +481,93 @@ void av1_convolve_2d_c(const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - ((1 << (offset_bits - conv_params->round_1)) + (1 << (offset_bits - conv_params->round_1 - 1))); - dst[y * dst_stride + x] += res; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; } } } -#endif -static INLINE void transpose_uint8(uint8_t *dst, int dst_stride, - const uint8_t *src, int src_stride, int w, - int h) { - int r, c; - for (r = 0; r < h; ++r) - for (c = 0; c < w; ++c) - dst[c * (dst_stride) + r] = src[r * (src_stride) + c]; -} +void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, + CONV_BUF_TYPE *dst, int dst_stride, int w, int h, + InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int x_step_qn, + const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params) { + int x, y, k; + int32_t im_block[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + int im_stride = w; + const int fo_vert = filter_params_y->taps / 2 - 1; + const int fo_horiz = filter_params_x->taps / 2 - 1; + const int bd = 8; -static INLINE void transpose_int32(int32_t *dst, int dst_stride, - const int32_t *src, int src_stride, int w, - int h) { - int r, c; - for (r = 0; r < h; ++r) - for (c = 0; c < w; ++c) - dst[c * (dst_stride) + r] = src[r * (src_stride) + c]; + // horizontal filter + const uint8_t *src_horiz = src - fo_vert * src_stride; + for (y = 0; y < im_h; ++y) { + int x_qn = subpel_x_qn; + for (x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint8_t *const src_x = &src_horiz[(x_qn >> SCALE_SUBPEL_BITS)]; + const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(x_filter_idx < SUBPEL_SHIFTS); + const int16_t *x_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx); + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (k = 0; k < filter_params_x->taps; ++k) { + sum += x_filter[k] * src_x[k - fo_horiz]; + } + assert(0 <= sum && sum < (1 << (bd + FILTER_BITS + 1))); + im_block[y * im_stride + x] = + ROUND_POWER_OF_TWO(sum, conv_params->round_0); + } + src_horiz += src_stride; + } + + // vertical filter + int32_t *src_vert = im_block + fo_vert * im_stride; + const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0; + for (x = 0; x < w; ++x) { + int y_qn = subpel_y_qn; + for (y = 0; y < h; ++y, y_qn += y_step_qn) { + const int32_t *src_y = &src_vert[(y_qn >> SCALE_SUBPEL_BITS) * im_stride]; + const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(y_filter_idx < SUBPEL_SHIFTS); + const int16_t *y_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx); + CONV_BUF_TYPE sum = 1 << offset_bits; + for (k = 0; k < filter_params_y->taps; ++k) { + sum += y_filter[k] * src_y[(k - fo_vert) * im_stride]; + } + assert(0 <= sum && sum < (1 << (offset_bits + 2))); + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - + ((1 << (offset_bits - conv_params->round_1)) + + (1 << (offset_bits - conv_params->round_1 - 1))); + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + src_vert++; + } } +#endif // CONFIG_COMPOUND_ROUND void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, - const InterpFilter *interp_filter, - const int subpel_x_q4, int x_step_q4, - const int subpel_y_q4, int y_step_q4, - ConvolveParams *conv_params) { + InterpFilters interp_filters, const int subpel_x_q4, + int x_step_q4, const int subpel_y_q4, int y_step_q4, + int scaled, ConvolveParams *conv_params) { (void)x_step_q4; (void)y_step_q4; (void)dst; (void)dst_stride; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]); - -#if USE_EXTRA_FILTER - if (filter_params_x.interp_filter == MULTITAP_SHARP && - filter_params_y.interp_filter == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } -#endif // USE_EXTRA_FILTER -#else - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(*interp_filter); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(*interp_filter); -#endif + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 1, &filter_params_x, + &filter_params_y); if (filter_params_y.taps < filter_params_x.taps) { uint8_t tr_src[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * @@ -487,27 +585,32 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst, conv_params->dst_stride, w, h); // horizontal and vertical parameters are swapped because of the transpose - av1_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert, tr_src_stride, - tr_dst, tr_dst_stride, h, w, &filter_params_y, - &filter_params_x, subpel_y_q4, subpel_x_q4, conv_params); + if (scaled) + av1_convolve_2d_scale(tr_src + fo_horiz * tr_src_stride + fo_vert, + tr_src_stride, tr_dst, tr_dst_stride, h, w, + &filter_params_y, &filter_params_x, subpel_y_q4, + y_step_q4, subpel_x_q4, x_step_q4, conv_params); + else + av1_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert, + tr_src_stride, tr_dst, tr_dst_stride, h, w, + &filter_params_y, &filter_params_x, subpel_y_q4, + subpel_x_q4, conv_params); transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst, tr_dst_stride, h, w); } else { - av1_convolve_2d(src, src_stride, conv_params->dst, conv_params->dst_stride, - w, h, &filter_params_x, &filter_params_y, subpel_x_q4, - subpel_y_q4, conv_params); + if (scaled) + av1_convolve_2d_scale(src, src_stride, conv_params->dst, + conv_params->dst_stride, w, h, &filter_params_x, + &filter_params_y, subpel_x_q4, x_step_q4, + subpel_y_q4, y_step_q4, conv_params); + else + av1_convolve_2d(src, src_stride, conv_params->dst, + conv_params->dst_stride, w, h, &filter_params_x, + &filter_params_y, subpel_x_q4, subpel_y_q4, conv_params); } } #if CONFIG_HIGHBITDEPTH -static INLINE void transpose_uint16(uint16_t *dst, int dst_stride, - const uint16_t *src, int src_stride, int w, - int h) { - int r, c; - for (r = 0; r < h; ++r) - for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c]; -} - void av1_highbd_convolve_rounding_c(const int32_t *src, int src_stride, uint8_t *dst8, int dst_stride, int w, int h, int bits, int bd) { @@ -561,11 +664,76 @@ void av1_highbd_convolve_2d_c(const uint16_t *src, int src_stride, sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x]; } CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1); - dst[y * dst_stride + x] += res; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + } +} + +void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride, + CONV_BUF_TYPE *dst, int dst_stride, int w, + int h, InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int x_step_qn, + const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params, int bd) { + int x, y, k; + uint16_t im_block[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + int im_stride = w; + const int fo_vert = filter_params_y->taps / 2 - 1; + const int fo_horiz = filter_params_x->taps / 2 - 1; + (void)bd; + + // horizontal filter + const uint16_t *src_horiz = src - fo_vert * src_stride; + for (y = 0; y < im_h; ++y) { + int x_qn = subpel_x_qn; + for (x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint16_t *const src_x = &src_horiz[(x_qn >> SCALE_SUBPEL_BITS)]; + const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(x_filter_idx < SUBPEL_SHIFTS); + const int16_t *x_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx); + int sum = 0; + for (k = 0; k < filter_params_x->taps; ++k) + sum += x_filter[k] * src_x[k - fo_horiz]; + im_block[y * im_stride + x] = + clip_pixel(ROUND_POWER_OF_TWO(sum, conv_params->round_0)); + } + src_horiz += src_stride; + } + + // vertical filter + uint16_t *src_vert = im_block + fo_vert * im_stride; + for (x = 0; x < w; ++x) { + int y_qn = subpel_y_qn; + for (y = 0; y < h; ++y, y_qn += y_step_qn) { + const uint16_t *const src_y = + &src_vert[(y_qn >> SCALE_SUBPEL_BITS) * im_stride]; + const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(y_filter_idx < SUBPEL_SHIFTS); + const int16_t *y_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx); + CONV_BUF_TYPE sum = 0; + for (k = 0; k < filter_params_y->taps; ++k) { + sum += y_filter[k] * src_y[(k - fo_vert) * im_stride]; + } + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1); + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; } + src_vert++; } } + #else + void av1_highbd_convolve_2d_c(const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, @@ -611,42 +779,95 @@ void av1_highbd_convolve_2d_c(const uint16_t *src, int src_stride, CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - ((1 << (offset_bits - conv_params->round_1)) + (1 << (offset_bits - conv_params->round_1 - 1))); - dst[y * dst_stride + x] += res; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; } } } -#endif + +void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride, + CONV_BUF_TYPE *dst, int dst_stride, int w, + int h, InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int x_step_qn, + const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params, int bd) { + int x, y, k; + int32_t im_block[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + int im_stride = w; + const int fo_vert = filter_params_y->taps / 2 - 1; + const int fo_horiz = filter_params_x->taps / 2 - 1; + + // horizontal filter + const uint16_t *src_horiz = src - fo_vert * src_stride; + for (y = 0; y < im_h; ++y) { + int x_qn = subpel_x_qn; + for (x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint16_t *const src_x = &src_horiz[(x_qn >> SCALE_SUBPEL_BITS)]; + const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(x_filter_idx < SUBPEL_SHIFTS); + const int16_t *x_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx); + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (k = 0; k < filter_params_x->taps; ++k) { + sum += x_filter[k] * src_x[k - fo_horiz]; + } + assert(0 <= sum && sum < (1 << (bd + FILTER_BITS + 1))); + im_block[y * im_stride + x] = + ROUND_POWER_OF_TWO(sum, conv_params->round_0); + } + src_horiz += src_stride; + } + + // vertical filter + int32_t *src_vert = im_block + fo_vert * im_stride; + const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0; + for (x = 0; x < w; ++x) { + int y_qn = subpel_y_qn; + for (y = 0; y < h; ++y, y_qn += y_step_qn) { + const int32_t *src_y = &src_vert[(y_qn >> SCALE_SUBPEL_BITS) * im_stride]; + const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(y_filter_idx < SUBPEL_SHIFTS); + const int16_t *y_filter = + av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx); + CONV_BUF_TYPE sum = 1 << offset_bits; + for (k = 0; k < filter_params_y->taps; ++k) { + sum += y_filter[k] * src_y[(k - fo_vert) * im_stride]; + } + assert(0 <= sum && sum < (1 << (offset_bits + 2))); + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - + ((1 << (offset_bits - conv_params->round_1)) + + (1 << (offset_bits - conv_params->round_1 - 1))); + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + src_vert++; + } +} +#endif // CONFIG_COMPOUND_ROUND void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride, uint8_t *dst, int dst_stride, int w, int h, - const InterpFilter *interp_filter, + InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, int y_step_q4, - ConvolveParams *conv_params, int bd) { + int scaled, ConvolveParams *conv_params, + int bd) { (void)x_step_q4; (void)y_step_q4; (void)dst; (void)dst_stride; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]); - -#if USE_EXTRA_FILTER - if (filter_params_x.interp_filter == MULTITAP_SHARP && - filter_params_y.interp_filter == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } -#endif -#else - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(*interp_filter); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(*interp_filter); -#endif + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 1, &filter_params_x, + &filter_params_y); + const uint16_t *src = CONVERT_TO_SHORTPTR(src8); if (filter_params_y.taps < filter_params_x.taps) { uint16_t tr_src[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * @@ -664,17 +885,29 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride, conv_params->dst_stride, w, h); // horizontal and vertical parameters are swapped because of the transpose - av1_highbd_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert, - tr_src_stride, tr_dst, tr_dst_stride, h, w, - &filter_params_y, &filter_params_x, subpel_y_q4, - subpel_x_q4, conv_params, bd); + if (scaled) + av1_highbd_convolve_2d_scale( + tr_src + fo_horiz * tr_src_stride + fo_vert, tr_src_stride, tr_dst, + tr_dst_stride, h, w, &filter_params_y, &filter_params_x, subpel_y_q4, + y_step_q4, subpel_x_q4, x_step_q4, conv_params, bd); + else + av1_highbd_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert, + tr_src_stride, tr_dst, tr_dst_stride, h, w, + &filter_params_y, &filter_params_x, subpel_y_q4, + subpel_x_q4, conv_params, bd); transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst, tr_dst_stride, h, w); } else { - av1_highbd_convolve_2d(src, src_stride, conv_params->dst, - conv_params->dst_stride, w, h, &filter_params_x, - &filter_params_y, subpel_x_q4, subpel_y_q4, - conv_params, bd); + if (scaled) + av1_highbd_convolve_2d_scale( + src, src_stride, conv_params->dst, conv_params->dst_stride, w, h, + &filter_params_x, &filter_params_y, subpel_x_q4, x_step_q4, + subpel_y_q4, y_step_q4, conv_params, bd); + else + av1_highbd_convolve_2d(src, src_stride, conv_params->dst, + conv_params->dst_stride, w, h, &filter_params_x, + &filter_params_y, subpel_x_q4, subpel_y_q4, + conv_params, bd); } } #endif // CONFIG_HIGHBITDEPTH @@ -689,11 +922,7 @@ typedef void (*ConvolveFunc)(const uint8_t *src, int src_stride, uint8_t *dst, static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + const InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, int y_step_q4, ConvolveParams *conv_params, @@ -701,16 +930,11 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, ConvolveFunc convolve_vert) { int ignore_horiz = x_step_q4 == SUBPEL_SHIFTS && subpel_x_q4 == 0; int ignore_vert = y_step_q4 == SUBPEL_SHIFTS && subpel_y_q4 == 0; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]); - InterpFilterParams filter_params; -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + assert(conv_params->round == CONVOLVE_OPT_ROUND); assert(w <= MAX_BLOCK_WIDTH); @@ -721,18 +945,12 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, if (ignore_horiz && ignore_vert) { convolve_copy(src, src_stride, dst, dst_stride, w, h, conv_params); } else if (ignore_vert) { -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); - convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params, + assert(filter_params_x.taps <= MAX_FILTER_TAP); + convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params_x, subpel_x_q4, x_step_q4, conv_params); } else if (ignore_horiz) { -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); - convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params, + assert(filter_params_y.taps <= MAX_FILTER_TAP); + convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params_y, subpel_y_q4, y_step_q4, conv_params); } else { // temp's size is set to a 256 aligned value to facilitate SIMD @@ -743,12 +961,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); int filter_size; #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER - if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP && - interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } + av1_convolve_filter_params_fixup_1212(&filter_params_x, &filter_params_y); // we do filter with fewer taps first to reduce hardware implementation // complexity @@ -759,22 +972,21 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, temp_conv_params.ref = 0; temp_conv_params.do_average = 0; temp_conv_params.round = CONVOLVE_OPT_ROUND; - filter_params = filter_params_y; filter_size = filter_params_x.taps; intermediate_width = (((w - 1) * x_step_q4 + subpel_x_q4) >> SUBPEL_BITS) + filter_size; assert(intermediate_width <= max_intermediate_size); - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); convolve_vert(src - (filter_size / 2 - 1), src_stride, temp, temp_stride, - intermediate_width, h, filter_params, subpel_y_q4, + intermediate_width, h, filter_params_y, subpel_y_q4, y_step_q4, &temp_conv_params); - filter_params = filter_params_x; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride, - w, h, filter_params, subpel_x_q4, x_step_q4, conv_params); + w, h, filter_params_x, subpel_x_q4, x_step_q4, + conv_params); } else #endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER { @@ -784,30 +996,22 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, temp_conv_params.ref = 0; temp_conv_params.do_average = 0; temp_conv_params.round = CONVOLVE_OPT_ROUND; -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; filter_size = filter_params_y.taps; -#else - filter_size = filter_params.taps; -#endif intermediate_height = (((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size; assert(intermediate_height <= max_intermediate_size); (void)max_intermediate_size; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); convolve_horiz(src - src_stride * (filter_size / 2 - 1), src_stride, temp, - temp_stride, w, intermediate_height, filter_params, + temp_stride, w, intermediate_height, filter_params_x, subpel_x_q4, x_step_q4, &temp_conv_params); -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); convolve_vert(temp + temp_stride * (filter_size / 2 - 1), temp_stride, - dst, dst_stride, w, h, filter_params, subpel_y_q4, + dst, dst_stride, w, h, filter_params_y, subpel_y_q4, y_step_q4, conv_params); } } @@ -815,11 +1019,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst, static void convolve_scale_helper(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + const InterpFilters interp_filters, const int subpel_x_qn, int x_step_qn, const int subpel_y_qn, int y_step_qn, ConvolveParams *conv_params, @@ -827,16 +1027,11 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, ConvolveFunc convolve_vert) { int ignore_horiz = x_step_qn == SCALE_SUBPEL_SHIFTS && subpel_x_qn == 0; int ignore_vert = y_step_qn == SCALE_SUBPEL_SHIFTS && subpel_y_qn == 0; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]); - InterpFilterParams filter_params; -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + assert(conv_params->round == CONVOLVE_OPT_ROUND); assert(w <= MAX_BLOCK_WIDTH); @@ -847,18 +1042,12 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, if (ignore_horiz && ignore_vert) { convolve_copy(src, src_stride, dst, dst_stride, w, h, conv_params); } else if (ignore_vert) { -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); - convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params, + assert(filter_params_x.taps <= MAX_FILTER_TAP); + convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params_x, subpel_x_qn, x_step_qn, conv_params); } else if (ignore_horiz) { -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); - convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params, + assert(filter_params_y.taps <= MAX_FILTER_TAP); + convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params_y, subpel_y_qn, y_step_qn, conv_params); } else { // temp's size is set to a 256 aligned value to facilitate SIMD @@ -869,12 +1058,7 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); int filter_size; #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER - if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP && - interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } + av1_convolve_filter_params_fixup_1212(&filter_params_x, &filter_params_y); // we do filter with fewer taps first to reduce hardware implementation // complexity @@ -885,23 +1069,22 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, temp_conv_params.ref = 0; temp_conv_params.do_average = 0; temp_conv_params.round = CONVOLVE_OPT_ROUND; - filter_params = filter_params_y; filter_size = filter_params_x.taps; intermediate_width = (((w - 1) * x_step_qn + subpel_x_qn) >> SCALE_SUBPEL_BITS) + filter_size; assert(intermediate_width <= max_intermediate_size); - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); convolve_vert(src - (filter_size / 2 - 1), src_stride, temp, temp_stride, - intermediate_width, h, filter_params, subpel_y_qn, + intermediate_width, h, filter_params_y, subpel_y_qn, y_step_qn, &temp_conv_params); - filter_params = filter_params_x; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride, - w, h, filter_params, subpel_x_qn, x_step_qn, conv_params); + w, h, filter_params_x, subpel_x_qn, x_step_qn, + conv_params); } else { #endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER int intermediate_height; @@ -910,31 +1093,23 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, temp_conv_params.ref = 0; temp_conv_params.do_average = 0; temp_conv_params.round = CONVOLVE_OPT_ROUND; -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; filter_size = filter_params_y.taps; -#else - filter_size = filter_params.taps; -#endif intermediate_height = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + filter_size; assert(intermediate_height <= max_intermediate_size); (void)max_intermediate_size; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); convolve_horiz(src - src_stride * (filter_size / 2 - 1), src_stride, temp, - temp_stride, w, intermediate_height, filter_params, + temp_stride, w, intermediate_height, filter_params_x, subpel_x_qn, x_step_qn, &temp_conv_params); -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); convolve_vert(temp + temp_stride * (filter_size / 2 - 1), temp_stride, - dst, dst_stride, w, h, filter_params, subpel_y_qn, + dst, dst_stride, w, h, filter_params_y, subpel_y_qn, y_step_qn, conv_params); #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER } @@ -943,44 +1118,29 @@ static void convolve_scale_helper(const uint8_t *src, int src_stride, } void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, int y_step_q4, ConvolveParams *conv_params) { - convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filter, + convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filters, subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4, conv_params, av1_convolve_horiz_facade, av1_convolve_vert_facade); } void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, int y_step_q4, ConvolveParams *conv_params) { - convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filter, + convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filters, subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4, conv_params, av1_convolve_horiz_facade_c, av1_convolve_vert_facade_c); } void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - const int subpel_x_qn, int x_step_qn, - const int subpel_y_qn, int y_step_qn, + InterpFilters interp_filters, const int subpel_x_qn, + int x_step_qn, const int subpel_y_qn, int y_step_qn, ConvolveParams *conv_params) { - convolve_scale_helper(src, src_stride, dst, dst_stride, w, h, interp_filter, + convolve_scale_helper(src, src_stride, dst, dst_stride, w, h, interp_filters, subpel_x_qn, x_step_qn, subpel_y_qn, y_step_qn, conv_params, av1_convolve_horiz_facade_scale, av1_convolve_vert_facade_scale); @@ -1242,14 +1402,9 @@ void av1_highbd_convolve_vert_facade_scale( void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - const int subpel_x_q4, int x_step_q4, - const int subpel_y_q4, int y_step_q4, int ref_idx, - int bd) { + InterpFilters interp_filters, const int subpel_x_q4, + int x_step_q4, const int subpel_y_q4, int y_step_q4, + int ref_idx, int bd) { uint16_t *src = CONVERT_TO_SHORTPTR(src8); uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); int ignore_horiz = x_step_q4 == SUBPEL_SHIFTS && subpel_x_q4 == 0; @@ -1262,27 +1417,20 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8, if (ignore_horiz && ignore_vert) { highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd); - } else if (ignore_vert) { -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]); -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif + return; + } + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + + if (ignore_vert) { av1_highbd_convolve_horiz_facade(src8, src_stride, dst8, dst_stride, w, h, - filter_params, subpel_x_q4, x_step_q4, + filter_params_x, subpel_x_q4, x_step_q4, ref_idx, bd); } else if (ignore_horiz) { -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]); -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif av1_highbd_convolve_vert_facade(src8, src_stride, dst8, dst_stride, w, h, - filter_params, subpel_y_q4, y_step_q4, + filter_params_y, subpel_y_q4, y_step_q4, ref_idx, bd); } else { // temp's size is set to a 256 aligned value to facilitate SIMD @@ -1293,54 +1441,37 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8, uint8_t *temp8 = CONVERT_TO_BYTEPTR(temp); int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); int filter_size; - InterpFilterParams filter_params; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]); -#endif #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER - if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP && - interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } + av1_convolve_filter_params_fixup_1212(&filter_params_x, &filter_params_y); + if (filter_params_y.taps < filter_params_x.taps) { int intermediate_width; int temp_stride = max_intermediate_size; - filter_params = filter_params_y; filter_size = filter_params_x.taps; intermediate_width = (((w - 1) * x_step_q4 + subpel_x_q4) >> SUBPEL_BITS) + filter_size; assert(intermediate_width <= max_intermediate_size); - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); - av1_highbd_convolve_vert_facade( - src8 - (filter_size / 2 - 1), src_stride, temp8, temp_stride, - intermediate_width, h, filter_params, subpel_y_q4, y_step_q4, 0, bd); + av1_highbd_convolve_vert_facade(src8 - (filter_size / 2 - 1), src_stride, + temp8, temp_stride, intermediate_width, h, + filter_params_y, subpel_y_q4, y_step_q4, + 0, bd); - filter_params = filter_params_x; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); av1_highbd_convolve_horiz_facade( temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h, - filter_params, subpel_x_q4, x_step_q4, ref_idx, bd); + filter_params_x, subpel_x_q4, x_step_q4, ref_idx, bd); } else #endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER { int intermediate_height; int temp_stride = MAX_SB_SIZE; -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; filter_size = filter_params_y.taps; -#else - filter_params = av1_get_interp_filter_params(interp_filter); - filter_size = filter_params.taps; -#endif + intermediate_height = (((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size; assert(intermediate_height <= max_intermediate_size); @@ -1348,29 +1479,23 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8, av1_highbd_convolve_horiz_facade( src8 - src_stride * (filter_size / 2 - 1), src_stride, temp8, - temp_stride, w, intermediate_height, filter_params, subpel_x_q4, + temp_stride, w, intermediate_height, filter_params_x, subpel_x_q4, x_step_q4, 0, bd); -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - filter_size = filter_params.taps; - assert(filter_params.taps <= MAX_FILTER_TAP); + filter_size = filter_params_y.taps; + assert(filter_params_y.taps <= MAX_FILTER_TAP); av1_highbd_convolve_vert_facade( temp8 + temp_stride * (filter_size / 2 - 1), temp_stride, dst8, - dst_stride, w, h, filter_params, subpel_y_q4, y_step_q4, ref_idx, bd); + dst_stride, w, h, filter_params_y, subpel_y_q4, y_step_q4, ref_idx, + bd); } } } void av1_highbd_convolve_scale(const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + InterpFilters interp_filters, const int subpel_x_qn, int x_step_qn, const int subpel_y_qn, int y_step_qn, int ref_idx, int bd) { @@ -1386,27 +1511,20 @@ void av1_highbd_convolve_scale(const uint8_t *src8, int src_stride, if (ignore_horiz && ignore_vert) { highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd); - } else if (ignore_vert) { -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]); -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif + return; + } + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + + if (ignore_vert) { av1_highbd_convolve_horiz_facade_scale(src8, src_stride, dst8, dst_stride, - w, h, filter_params, subpel_x_qn, + w, h, filter_params_x, subpel_x_qn, x_step_qn, ref_idx, bd); } else if (ignore_horiz) { -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]); -#else - InterpFilterParams filter_params = - av1_get_interp_filter_params(interp_filter); -#endif av1_highbd_convolve_vert_facade_scale(src8, src_stride, dst8, dst_stride, w, - h, filter_params, subpel_y_qn, + h, filter_params_y, subpel_y_qn, y_step_qn, ref_idx, bd); } else { // temp's size is set to a 256 aligned value to facilitate SIMD @@ -1417,54 +1535,36 @@ void av1_highbd_convolve_scale(const uint8_t *src8, int src_stride, uint8_t *temp8 = CONVERT_TO_BYTEPTR(temp); int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); int filter_size; - InterpFilterParams filter_params; -#if CONFIG_DUAL_FILTER - InterpFilterParams filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]); - InterpFilterParams filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]); -#endif #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER - if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP && - interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) { - // Avoid two directions both using 12-tap filter. - // This will reduce hardware implementation cost. - filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); - } + av1_convolve_filter_params_fixup_1212(&filter_params_x, &filter_params_y); + if (filter_params_y.taps < filter_params_x.taps) { int intermediate_width; int temp_stride = max_intermediate_size; - filter_params = filter_params_y; filter_size = filter_params_x.taps; intermediate_width = (((w - 1) * x_step_qn + subpel_x_qn) >> SCALE_SUBPEL_BITS) + filter_size; assert(intermediate_width <= max_intermediate_size); - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_y.taps <= MAX_FILTER_TAP); av1_highbd_convolve_vert_facade_scale( src8 - (filter_size / 2 - 1), src_stride, temp8, temp_stride, - intermediate_width, h, filter_params, subpel_y_qn, y_step_qn, 0, bd); + intermediate_width, h, filter_params_y, subpel_y_qn, y_step_qn, 0, + bd); - filter_params = filter_params_x; - assert(filter_params.taps <= MAX_FILTER_TAP); + assert(filter_params_x.taps <= MAX_FILTER_TAP); av1_highbd_convolve_horiz_facade_scale( temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h, - filter_params, subpel_x_qn, x_step_qn, ref_idx, bd); + filter_params_x, subpel_x_qn, x_step_qn, ref_idx, bd); } else { #endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER int intermediate_height; int temp_stride = MAX_SB_SIZE; -#if CONFIG_DUAL_FILTER - filter_params = filter_params_x; filter_size = filter_params_y.taps; -#else - filter_params = av1_get_interp_filter_params(interp_filter); - filter_size = filter_params.taps; -#endif intermediate_height = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + filter_size; @@ -1473,18 +1573,16 @@ void av1_highbd_convolve_scale(const uint8_t *src8, int src_stride, av1_highbd_convolve_horiz_facade_scale( src8 - src_stride * (filter_size / 2 - 1), src_stride, temp8, - temp_stride, w, intermediate_height, filter_params, subpel_x_qn, + temp_stride, w, intermediate_height, filter_params_x, subpel_x_qn, x_step_qn, 0, bd); -#if CONFIG_DUAL_FILTER - filter_params = filter_params_y; -#endif - filter_size = filter_params.taps; - assert(filter_params.taps <= MAX_FILTER_TAP); + filter_size = filter_params_y.taps; + assert(filter_params_y.taps <= MAX_FILTER_TAP); av1_highbd_convolve_vert_facade_scale( temp8 + temp_stride * (filter_size / 2 - 1), temp_stride, dst8, - dst_stride, w, h, filter_params, subpel_y_qn, y_step_qn, ref_idx, bd); + dst_stride, w, h, filter_params_y, subpel_y_qn, y_step_qn, ref_idx, + bd); #if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER } #endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER diff --git a/third_party/aom/av1/common/convolve.h b/third_party/aom/av1/common/convolve.h index 462733946..c43f649e0 100644 --- a/third_party/aom/av1/common/convolve.h +++ b/third_party/aom/av1/common/convolve.h @@ -47,15 +47,49 @@ static INLINE ConvolveParams get_conv_params(int ref, int do_average, conv_params.do_post_rounding = 0; return conv_params; } + +#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER +static INLINE void av1_convolve_filter_params_fixup_1212( + const InterpFilterParams *params_x, InterpFilterParams *params_y) { + if (params_x->interp_filter == MULTITAP_SHARP && + params_y->interp_filter == MULTITAP_SHARP) { + // Avoid two directions both using 12-tap filter. + // This will reduce hardware implementation cost. + *params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP); + } +} +#endif + +static INLINE void av1_get_convolve_filter_params( + InterpFilters interp_filters, int avoid_1212, InterpFilterParams *params_x, + InterpFilterParams *params_y) { +#if CONFIG_DUAL_FILTER + InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1); + InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0); +#else + InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 0); + InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0); +#endif + + *params_x = av1_get_interp_filter_params(filter_x); + *params_y = av1_get_interp_filter_params(filter_y); + + if (avoid_1212) { +#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER + convolve_filter_params_fixup_1212(params_x, params_y); +#endif + } +} + struct AV1Common; void av1_convolve_init(struct AV1Common *cm); + #if CONFIG_CONVOLVE_ROUND void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, - const InterpFilter *interp_filter, - const int subpel_x_q4, int x_step_q4, - const int subpel_y_q4, int y_step_q4, - ConvolveParams *conv_params); + InterpFilters interp_filters, const int subpel_x_q4, + int x_step_q4, const int subpel_y_q4, int y_step_q4, + int scaled, ConvolveParams *conv_params); static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average, int plane, int32_t *dst, @@ -80,63 +114,42 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average, #if CONFIG_HIGHBITDEPTH void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride, uint8_t *dst, int dst_stride, int w, int h, - const InterpFilter *interp_filter, + InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, int y_step_q4, - ConvolveParams *conv_params, int bd); + int scaled, ConvolveParams *conv_params, + int bd); #endif #endif // CONFIG_CONVOLVE_ROUND void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x, int xstep, const int subpel_y, int ystep, ConvolveParams *conv_params); void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x, int xstep, const int subpel_y, int ystep, ConvolveParams *conv_params); void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - const int subpel_x, int xstep, const int subpel_y, - int ystep, ConvolveParams *conv_params); + InterpFilters interp_filters, const int subpel_x, + int xstep, const int subpel_y, int ystep, + ConvolveParams *conv_params); #if CONFIG_HIGHBITDEPTH void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - const int subpel_x, int xstep, const int subpel_y, - int ystep, int avg, int bd); + InterpFilters interp_filters, const int subpel_x, + int xstep, const int subpel_y, int ystep, int avg, + int bd); void av1_highbd_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif // CONFIG_DUAL_FILTER - const int subpel_x, int xstep, - const int subpel_y, int ystep, int avg, int bd); + InterpFilters interp_filters, const int subpel_x, + int xstep, const int subpel_y, int ystep, + int avg, int bd); #endif // CONFIG_HIGHBITDEPTH #ifdef __cplusplus diff --git a/third_party/aom/av1/common/daala_tx.c b/third_party/aom/av1/common/daala_tx.c index 31f03de53..e5b2372e3 100644 --- a/third_party/aom/av1/common/daala_tx.c +++ b/third_party/aom/av1/common/daala_tx.c @@ -166,6 +166,87 @@ } \ while (0) +#define OD_FDST_4(q0, q2, q1, q3) \ + /* Embedded 4-point orthonormal Type-IV fDST. */ \ + do { \ + int q0h; \ + int q1h; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(q1, 13573, 16384, 190); \ + q2 += (q1*13573 + 16384) >> 15; \ + /* 5793/8192 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + OD_DCT_OVERFLOW_CHECK(q2, 5793, 4096, 191); \ + q1 -= (q2*5793 + 4096) >> 13; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(q1, 3393, 4096, 192); \ + q2 += (q1*3393 + 4096) >> 13; \ + q0 += q2; \ + q0h = OD_DCT_RSHIFT(q0, 1); \ + q2 = q0h - q2; \ + q1 += q3; \ + q1h = OD_DCT_RSHIFT(q1, 1); \ + q3 -= q1h; \ + /* 537/1024 ~= (1/Sqrt[2] - Cos[3*Pi/16]/2)/Sin[3*Pi/16] ~= + 0.524455699240090 */ \ + OD_DCT_OVERFLOW_CHECK(q1, 537, 512, 193); \ + q2 -= (q1*537 + 512) >> 10; \ + /* 1609/2048 ~= Sqrt[2]*Sin[3*Pi/16] ~= 0.785694958387102 */ \ + OD_DCT_OVERFLOW_CHECK(q2, 1609, 1024, 194); \ + q1 += (q2*1609 + 1024) >> 11; \ + /* 7335/32768 ~= (1/Sqrt[2] - Cos[3*Pi/16])/Sin[3*Pi/16] ~= + 0.223847182092655 */ \ + OD_DCT_OVERFLOW_CHECK(q1, 7335, 16384, 195); \ + q2 += (q1*7335 + 16384) >> 15; \ + /* 5091/8192 ~= (1/Sqrt[2] - Cos[7*Pi/16]/2)/Sin[7*Pi/16] ~= + 0.6215036383171189 */ \ + OD_DCT_OVERFLOW_CHECK(q0, 5091, 4096, 196); \ + q3 += (q0*5091 + 4096) >> 13; \ + /* 5681/4096 ~= Sqrt[2]*Sin[7*Pi/16] ~= 1.38703984532215 */ \ + OD_DCT_OVERFLOW_CHECK(q3, 5681, 2048, 197); \ + q0 -= (q3*5681 + 2048) >> 12; \ + /* 4277/8192 ~= (1/Sqrt[2] - Cos[7*Pi/16])/Sin[7*Pi/16] ~= + 0.52204745462729 */ \ + OD_DCT_OVERFLOW_CHECK(q0, 4277, 4096, 198); \ + q3 += (q0*4277 + 4096) >> 13; \ + } \ + while (0) + +#define OD_IDST_4(q0, q2, q1, q3) \ + /* Embedded 4-point orthonormal Type-IV iDST. */ \ + do { \ + int q0h; \ + int q2h; \ + /* 4277/8192 ~= (1/Sqrt[2] - Cos[7*Pi/16])/Sin[7*Pi/16] ~= + 0.52204745462729 */ \ + q3 -= (q0*4277 + 4096) >> 13; \ + /* 5681/4096 ~= Sqrt[2]*Sin[7*Pi/16] ~= 1.38703984532215 */ \ + q0 += (q3*5681 + 2048) >> 12; \ + /* 5091/8192 ~= (1/Sqrt[2] - Cos[7*Pi/16]/2)/Sin[7*Pi/16] ~= + 0.6215036383171189 */ \ + q3 -= (q0*5091 + 4096) >> 13; \ + /* 7335/32768 ~= (1/Sqrt[2] - Cos[3*Pi/16])/Sin[3*Pi/16] ~= + 0.223847182092655 */ \ + q1 -= (q2*7335 + 16384) >> 15; \ + /* 1609/2048 ~= Sqrt[2]*Sin[3*Pi/16] ~= 0.785694958387102 */ \ + q2 -= (q1*1609 + 1024) >> 11; \ + /* 537/1024 ~= (1/Sqrt[2] - Cos[3*Pi/16]/2)/Sin[3*Pi/16] ~= + 0.524455699240090 */ \ + q1 += (q2*537 + 512) >> 10; \ + q2h = OD_DCT_RSHIFT(q2, 1); \ + q3 += q2h; \ + q2 -= q3; \ + q0h = OD_DCT_RSHIFT(q0, 1); \ + q1 = q0h - q1; \ + q0 -= q1; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + q1 -= (q2*3393 + 4096) >> 13; \ + /* 5793/8192 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + q2 += (q1*5793 + 4096) >> 13; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + q1 -= (q2*13573 + 16384) >> 15; \ + } \ + while (0) + #define OD_FDST_4_ASYM(t0, t0h, t2, t1, t3) \ /* Embedded 4-point asymmetric Type-IV fDST. */ \ do { \ @@ -277,7 +358,43 @@ } \ while (0) -#define OD_FDST_8(t0, t4, t2, t6, t1, t5, t3, t7) \ +#define OD_FDCT_8_ASYM(r0, r4, r4h, r2, r6, r6h, r1, r5, r5h, r3, r7, r7h) \ + /* Embedded 8-point asymmetric Type-II fDCT. */ \ + do { \ + r0 += r7h; \ + r7 = r0 - r7; \ + r1 = r6h - r1; \ + r6 -= r1; \ + r2 += r5h; \ + r5 = r2 - r5; \ + r3 = r4h - r3; \ + r4 -= r3; \ + OD_FDCT_4(r0, r4, r2, r6); \ + OD_FDST_4(r7, r3, r5, r1); \ + } \ + while (0) + +#define OD_IDCT_8_ASYM(r0, r4, r2, r6, r1, r1h, r5, r5h, r3, r3h, r7, r7h) \ + /* Embedded 8-point asymmetric Type-II iDCT. */ \ + do { \ + OD_IDST_4(r7, r5, r6, r4); \ + OD_IDCT_4(r0, r2, r1, r3); \ + r7 = r0 - r7; \ + r7h = OD_DCT_RSHIFT(r7, 1); \ + r0 -= r7h; \ + r1 += r6; \ + r1h = OD_DCT_RSHIFT(r1, 1); \ + r6 = r1h - r6; \ + r5 = r2 - r5; \ + r5h = OD_DCT_RSHIFT(r5, 1); \ + r2 -= r5h; \ + r3 += r4; \ + r3h = OD_DCT_RSHIFT(r3, 1); \ + r4 = r3h - r4; \ + } \ + while (0) + +#define OD_FDST_8(t0, t4, t2, t6, t1, t5, t3, t7) \ /* Embedded 8-point orthonormal Type-IV fDST. */ \ do { \ int t0h; \ @@ -446,6 +563,2561 @@ } \ while (0) +/* Rewrite this so that t0h can be passed in. */ +#define OD_FDST_8_ASYM(t0, t4, t2, t6, t1, t5, t3, t7) \ + /* Embedded 8-point asymmetric Type-IV fDST. */ \ + do { \ + int t0h; \ + int t2h; \ + int t5h; \ + int t7h; \ + /* 1035/2048 ~= (Sqrt[2] - Cos[7*Pi/32])/(2*Sin[7*Pi/32]) */ \ + OD_DCT_OVERFLOW_CHECK(t1, 1035, 1024, 199); \ + t6 += (t1*1035 + 1024) >> 11; \ + /* 3675/4096 ~= Sqrt[2]*Sin[7*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t6, 3675, 2048, 200); \ + t1 -= (t6*3675 + 2048) >> 12; \ + /* 851/8192 ~= (Cos[7*Pi/32] - 1/Sqrt[2])/Sin[7*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t1, 851, 4096, 201); \ + t6 -= (t1*851 + 4096) >> 13; \ + /* 4379/8192 ~= (Sqrt[2] - Sin[5*Pi/32])/(2*Cos[5*Pi/32]) */ \ + OD_DCT_OVERFLOW_CHECK(t2, 4379, 4096, 202); \ + t5 += (t2*4379 + 4096) >> 13; \ + /* 10217/8192 ~= Sqrt[2]*Cos[5*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t5, 10217, 4096, 203); \ + t2 -= (t5*10217 + 4096) >> 13; \ + /* 4379/16384 ~= (1/Sqrt[2] - Sin[5*Pi/32])/Cos[5*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t2, 4379, 8192, 204); \ + t5 += (t2*4379 + 8192) >> 14; \ + /* 12905/16384 ~= (Sqrt[2] - Cos[3*Pi/32])/(2*Sin[3*Pi/32]) */ \ + OD_DCT_OVERFLOW_CHECK(t3, 12905, 8192, 205); \ + t4 += (t3*12905 + 8192) >> 14; \ + /* 3363/8192 ~= Sqrt[2]*Sin[3*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t4, 3363, 4096, 206); \ + t3 -= (t4*3363 + 4096) >> 13; \ + /* 3525/4096 ~= (Cos[3*Pi/32] - 1/Sqrt[2])/Sin[3*Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t3, 3525, 2048, 207); \ + t4 -= (t3*3525 + 2048) >> 12; \ + /* 5417/8192 ~= (Sqrt[2] - Sin[Pi/32])/(2*Cos[Pi/32]) */ \ + OD_DCT_OVERFLOW_CHECK(t0, 5417, 4096, 208); \ + t7 += (t0*5417 + 4096) >> 13; \ + /* 5765/4096 ~= Sqrt[2]*Cos[Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t7, 5765, 2048, 209); \ + t0 -= (t7*5765 + 2048) >> 12; \ + /* 2507/4096 ~= (1/Sqrt[2] - Sin[Pi/32])/Cos[Pi/32] */ \ + OD_DCT_OVERFLOW_CHECK(t0, 2507, 2048, 210); \ + t7 += (t0*2507 + 2048) >> 12; \ + t0 += t1; \ + t0h = OD_DCT_RSHIFT(t0, 1); \ + t1 -= t0h; \ + t2 -= t3; \ + t2h = OD_DCT_RSHIFT(t2, 1); \ + t3 += t2h; \ + t5 -= t4; \ + t5h = OD_DCT_RSHIFT(t5, 1); \ + t4 += t5h; \ + t7 += t6; \ + t7h = OD_DCT_RSHIFT(t7, 1); \ + t6 = t7h - t6; \ + t4 = t7h - t4; \ + t7 -= t4; \ + t1 += t5h; \ + t5 = t1 - t5; \ + t6 += t2h; \ + t2 = t6 - t2; \ + t3 -= t0h; \ + t0 += t3; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 3259, 8192, 211); \ + t1 += (t6*3259 + 8192) >> 14; \ + /* 3135/8192 ~= Sin[Pi/8] ~= 0.382683432365090 */ \ + OD_DCT_OVERFLOW_CHECK(t1, 3135, 4096, 212); \ + t6 -= (t1*3135 + 4096) >> 13; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 3259, 8192, 213); \ + t1 += (t6*3259 + 8192) >> 14; \ + /* 2737/4096 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 2737, 2048, 214); \ + t5 += (t2*2737 + 2048) >> 12; \ + /* 473/512 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 473, 256, 215); \ + t2 -= (t5*473 + 256) >> 9; \ + /* 2737/4096 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 2737, 2048, 216); \ + t5 += (t2*2737 + 2048) >> 12; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 3393, 4096, 217); \ + t3 += (t4*3393 + 4096) >> 13; \ + /* 5793/8192 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + OD_DCT_OVERFLOW_CHECK(t3, 5793, 4096, 218); \ + t4 -= (t3*5793 + 4096) >> 13; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 3393, 4096, 219); \ + t3 += (t4*3393 + 4096) >> 13; \ + } \ + while (0) + +#define OD_IDST_8_ASYM(t0, t4, t2, t6, t1, t5, t3, t7) \ + /* Embedded 8-point asymmetric Type-IV iDST. */ \ + do { \ + int t0h; \ + int t2h; \ + int t5h__; \ + int t7h__; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + t6 -= (t1*3393 + 4096) >> 13; \ + /* 5793/8192 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + t1 += (t6*5793 + 4096) >> 13; \ + /* 3393/8192 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + t6 -= (t1*3393 + 4096) >> 13; \ + /* 2737/4096 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + t5 -= (t2*2737 + 2048) >> 12; \ + /* 473/512 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t2 += (t5*473 + 256) >> 9; \ + /* 2737/4096 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + t5 -= (t2*2737 + 2048) >> 12; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + t4 -= (t3*3259 + 8192) >> 14; \ + /* 3135/8192 ~= Sin[Pi/8] ~= 0.382683432365090 */ \ + t3 += (t4*3135 + 4096) >> 13; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + t4 -= (t3*3259 + 8192) >> 14; \ + t0 -= t6; \ + t0h = OD_DCT_RSHIFT(t0, 1); \ + t6 += t0h; \ + t2 = t3 - t2; \ + t2h = OD_DCT_RSHIFT(t2, 1); \ + t3 -= t2h; \ + t5 = t4 - t5; \ + t5h__ = OD_DCT_RSHIFT(t5, 1); \ + t4 -= t5h__; \ + t7 += t1; \ + t7h__ = OD_DCT_RSHIFT(t7, 1); \ + t1 = t7h__ - t1; \ + t3 = t7h__ - t3; \ + t7 -= t3; \ + t1 -= t5h__; \ + t5 += t1; \ + t6 -= t2h; \ + t2 += t6; \ + t4 += t0h; \ + t0 -= t4; \ + /* 2507/4096 ~= (1/Sqrt[2] - Sin[Pi/32])/Cos[Pi/32] */ \ + t7 -= (t0*2507 + 2048) >> 12; \ + /* 5765/4096 ~= Sqrt[2]*Cos[Pi/32] */ \ + t0 += (t7*5765 + 2048) >> 12; \ + /* 5417/8192 ~= (Sqrt[2] - Sin[Pi/32])/(2*Cos[Pi/32]) */ \ + t7 -= (t0*5417 + 4096) >> 13; \ + /* 3525/4096 ~= (Cos[3*Pi/32] - 1/Sqrt[2])/Sin[3*Pi/32] */ \ + t1 += (t6*3525 + 2048) >> 12; \ + /* 3363/8192 ~= Sqrt[2]*Sin[3*Pi/32] */ \ + t6 += (t1*3363 + 4096) >> 13; \ + /* 12905/16384 ~= (1/Sqrt[2] - Cos[3*Pi/32]/1)/Sin[3*Pi/32] */ \ + t1 -= (t6*12905 + 8192) >> 14; \ + /* 4379/16384 ~= (1/Sqrt[2] - Sin[5*Pi/32])/Cos[5*Pi/32] */ \ + t5 -= (t2*4379 + 8192) >> 14; \ + /* 10217/8192 ~= Sqrt[2]*Cos[5*Pi/32] */ \ + t2 += (t5*10217 + 4096) >> 13; \ + /* 4379/8192 ~= (Sqrt[2] - Sin[5*Pi/32])/(2*Cos[5*Pi/32]) */ \ + t5 -= (t2*4379 + 4096) >> 13; \ + /* 851/8192 ~= (Cos[7*Pi/32] - 1/Sqrt[2])/Sin[7*Pi/32] */ \ + t3 += (t4*851 + 4096) >> 13; \ + /* 3675/4096 ~= Sqrt[2]*Sin[7*Pi/32] */ \ + t4 += (t3*3675 + 2048) >> 12; \ + /* 1035/2048 ~= (Sqrt[2] - Cos[7*Pi/32])/(2*Sin[7*Pi/32]) */ \ + t3 -= (t4*1035 + 1024) >> 11; \ + } \ + while (0) + +#define OD_FDCT_16(s0, s8, s4, sc, s2, sa, s6, se, \ + s1, s9, s5, sd, s3, sb, s7, sf) \ + /* Embedded 16-point orthonormal Type-II fDCT. */ \ + do { \ + int s8h; \ + int sah; \ + int sch; \ + int seh; \ + int sfh; \ + sf = s0 - sf; \ + sfh = OD_DCT_RSHIFT(sf, 1); \ + s0 -= sfh; \ + se += s1; \ + seh = OD_DCT_RSHIFT(se, 1); \ + s1 = seh - s1; \ + sd = s2 - sd; \ + s2 -= OD_DCT_RSHIFT(sd, 1); \ + sc += s3; \ + sch = OD_DCT_RSHIFT(sc, 1); \ + s3 = sch - s3; \ + sb = s4 - sb; \ + s4 -= OD_DCT_RSHIFT(sb, 1); \ + sa += s5; \ + sah = OD_DCT_RSHIFT(sa, 1); \ + s5 = sah - s5; \ + s9 = s6 - s9; \ + s6 -= OD_DCT_RSHIFT(s9, 1); \ + s8 += s7; \ + s8h = OD_DCT_RSHIFT(s8, 1); \ + s7 = s8h - s7; \ + OD_FDCT_8_ASYM(s0, s8, s8h, s4, sc, sch, s2, sa, sah, s6, se, seh); \ + OD_FDST_8_ASYM(sf, s7, sb, s3, sd, s5, s9, s1); \ + } \ + while (0) + +#define OD_IDCT_16(s0, s8, s4, sc, s2, sa, s6, se, \ + s1, s9, s5, sd, s3, sb, s7, sf) \ + /* Embedded 16-point orthonormal Type-II iDCT. */ \ + do { \ + int s1h; \ + int s3h; \ + int s5h; \ + int s7h; \ + int sfh; \ + OD_IDST_8_ASYM(sf, sb, sd, s9, se, sa, sc, s8); \ + OD_IDCT_8_ASYM(s0, s4, s2, s6, s1, s1h, s5, s5h, s3, s3h, s7, s7h); \ + sfh = OD_DCT_RSHIFT(sf, 1); \ + s0 += sfh; \ + sf = s0 - sf; \ + se = s1h - se; \ + s1 -= se; \ + s2 += OD_DCT_RSHIFT(sd, 1); \ + sd = s2 - sd; \ + sc = s3h - sc; \ + s3 -= sc; \ + s4 += OD_DCT_RSHIFT(sb, 1); \ + sb = s4 - sb; \ + sa = s5h - sa; \ + s5 -= sa; \ + s6 += OD_DCT_RSHIFT(s9, 1); \ + s9 = s6 - s9; \ + s8 = s7h - s8; \ + s7 -= s8; \ + } \ + while (0) + +#define OD_FDCT_16_ASYM(t0, t8, t8h, t4, tc, tch, t2, ta, tah, t6, te, teh, \ + t1, t9, t9h, t5, td, tdh, t3, tb, tbh, t7, tf, tfh) \ + /* Embedded 16-point asymmetric Type-II fDCT. */ \ + do { \ + t0 += tfh; \ + tf = t0 - tf; \ + t1 -= teh; \ + te += t1; \ + t2 += tdh; \ + td = t2 - td; \ + t3 -= tch; \ + tc += t3; \ + t4 += tbh; \ + tb = t4 - tb; \ + t5 -= tah; \ + ta += t5; \ + t6 += t9h; \ + t9 = t6 - t9; \ + t7 -= t8h; \ + t8 += t7; \ + OD_FDCT_8(t0, t8, t4, tc, t2, ta, t6, te); \ + OD_FDST_8(tf, t7, tb, t3, td, t5, t9, t1); \ + } \ + while (0) + +#define OD_IDCT_16_ASYM(t0, t8, t4, tc, t2, ta, t6, te, \ + t1, t1h, t9, t9h, t5, t5h, td, tdh, t3, t3h, tb, tbh, t7, t7h, tf, tfh) \ + /* Embedded 16-point asymmetric Type-II iDCT. */ \ + do { \ + OD_IDST_8(tf, tb, td, t9, te, ta, tc, t8); \ + OD_IDCT_8(t0, t4, t2, t6, t1, t5, t3, t7); \ + t1 -= te; \ + t1h = OD_DCT_RSHIFT(t1, 1); \ + te += t1h; \ + t9 = t6 - t9; \ + t9h = OD_DCT_RSHIFT(t9, 1); \ + t6 -= t9h; \ + t5 -= ta; \ + t5h = OD_DCT_RSHIFT(t5, 1); \ + ta += t5h; \ + td = t2 - td; \ + tdh = OD_DCT_RSHIFT(td, 1); \ + t2 -= tdh; \ + t3 -= tc; \ + t3h = OD_DCT_RSHIFT(t3, 1); \ + tc += t3h; \ + tb = t4 - tb; \ + tbh = OD_DCT_RSHIFT(tb, 1); \ + t4 -= tbh; \ + t7 -= t8; \ + t7h = OD_DCT_RSHIFT(t7, 1); \ + t8 += t7h; \ + tf = t0 - tf; \ + tfh = OD_DCT_RSHIFT(tf, 1); \ + t0 -= tfh; \ + } \ + while (0) + +#define OD_FDST_16(s0, s8, s4, sc, s2, sa, s6, se, \ + s1, s9, s5, sd, s3, sb, s7, sf) \ + /* Embedded 16-point orthonormal Type-IV fDST. */ \ + do { \ + int s0h; \ + int s2h; \ + int sdh; \ + int sfh; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s3, 13573, 16384, 220); \ + s1 += (se*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + OD_DCT_OVERFLOW_CHECK(s1, 11585, 8192, 221); \ + se -= (s1*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s3, 13573, 16384, 222); \ + s1 += (se*13573 + 16384) >> 15; \ + /* 21895/32768 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + OD_DCT_OVERFLOW_CHECK(s2, 21895, 16384, 223); \ + sd += (s2*21895 + 16384) >> 15; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(sd, 15137, 16384, 224); \ + s2 -= (sd*15137 + 8192) >> 14; \ + /* 21895/32768 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + OD_DCT_OVERFLOW_CHECK(s2, 21895, 16384, 225); \ + sd += (s2*21895 + 16384) >> 15; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + OD_DCT_OVERFLOW_CHECK(s3, 3259, 8192, 226); \ + sc += (s3*3259 + 8192) >> 14; \ + /* 3135/8192 ~= Sin[Pi/8] ~= 0.382683432365090 */ \ + OD_DCT_OVERFLOW_CHECK(sc, 3135, 4096, 227); \ + s3 -= (sc*3135 + 4096) >> 13; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + OD_DCT_OVERFLOW_CHECK(s3, 3259, 8192, 228); \ + sc += (s3*3259 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s5, 13573, 16384, 229); \ + sa += (s5*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186547 */ \ + OD_DCT_OVERFLOW_CHECK(sa, 11585, 8192, 230); \ + s5 -= (sa*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[Pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s5, 13573, 16384, 231); \ + sa += (s5*13573 + 16384) >> 15; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s9, 13573, 16384, 232); \ + s6 += (s9*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[pi/4] ~= 0.707106781186547 */ \ + OD_DCT_OVERFLOW_CHECK(s6, 11585, 8192, 233); \ + s9 -= (s6*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(s9, 13573, 16384, 234); \ + s6 += (s9*13573 + 16384) >> 15; \ + sf += se; \ + sfh = OD_DCT_RSHIFT(sf, 1); \ + se = sfh - se; \ + s0 += s1; \ + s0h = OD_DCT_RSHIFT(s0, 1); \ + s1 = s0h - s1; \ + s2 = s3 - s2; \ + s2h = OD_DCT_RSHIFT(s2, 1); \ + s3 -= s2h; \ + sd -= sc; \ + sdh = OD_DCT_RSHIFT(sd, 1); \ + sc += sdh; \ + sa = s4 - sa; \ + s4 -= OD_DCT_RSHIFT(sa, 1); \ + s5 += sb; \ + sb = OD_DCT_RSHIFT(s5, 1) - sb; \ + s8 += s6; \ + s6 -= OD_DCT_RSHIFT(s8, 1); \ + s7 = s9 - s7; \ + s9 -= OD_DCT_RSHIFT(s7, 1); \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(sb, 6723, 4096, 235); \ + s4 += (sb*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + OD_DCT_OVERFLOW_CHECK(s4, 16069, 8192, 236); \ + sb -= (s4*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32]) ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(sb, 6723, 4096, 237); \ + s4 += (sb*6723 + 4096) >> 13; \ + /* 8757/16384 ~= Tan[5*Pi/32]) ~= 0.534511135950792 */ \ + OD_DCT_OVERFLOW_CHECK(s5, 8757, 8192, 238); \ + sa += (s5*8757 + 8192) >> 14; \ + /* 6811/8192 ~= Sin[5*Pi/16] ~= 0.831469612302545 */ \ + OD_DCT_OVERFLOW_CHECK(sa, 6811, 4096, 239); \ + s5 -= (sa*6811 + 4096) >> 13; \ + /* 8757/16384 ~= Tan[5*Pi/32] ~= 0.534511135950792 */ \ + OD_DCT_OVERFLOW_CHECK(s5, 8757, 8192, 240); \ + sa += (s5*8757 + 8192) >> 14; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(s9, 2485, 4096, 241); \ + s6 += (s9*2485 + 4096) >> 13; \ + /* 4551/8192 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + OD_DCT_OVERFLOW_CHECK(s6, 4551, 4096, 242); \ + s9 -= (s6*4551 + 4096) >> 13; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(s9, 2485, 4096, 243); \ + s6 += (s9*2485 + 4096) >> 13; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + OD_DCT_OVERFLOW_CHECK(s8, 3227, 16384, 244); \ + s7 += (s8*3227 + 16384) >> 15; \ + /* 6393/32768 ~= Sin[Pi/16] ~= 0.19509032201612825 */ \ + OD_DCT_OVERFLOW_CHECK(s7, 6393, 16384, 245); \ + s8 -= (s7*6393 + 16384) >> 15; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + OD_DCT_OVERFLOW_CHECK(s8, 3227, 16384, 246); \ + s7 += (s8*3227 + 16384) >> 15; \ + s1 -= s2h; \ + s2 += s1; \ + se += sdh; \ + sd = se - sd; \ + s3 += sfh; \ + sf -= s3; \ + sc = s0h - sc; \ + s0 -= sc; \ + sb += OD_DCT_RSHIFT(s8, 1); \ + s8 = sb - s8; \ + s4 += OD_DCT_RSHIFT(s7, 1); \ + s7 -= s4; \ + s6 += OD_DCT_RSHIFT(s5, 1); \ + s5 = s6 - s5; \ + s9 -= OD_DCT_RSHIFT(sa, 1); \ + sa += s9; \ + s8 += s0; \ + s0 -= OD_DCT_RSHIFT(s8, 1); \ + sf += s7; \ + s7 = OD_DCT_RSHIFT(sf, 1) - s7; \ + s1 -= s6; \ + s6 += OD_DCT_RSHIFT(s1, 1); \ + s9 += se; \ + se = OD_DCT_RSHIFT(s9, 1) - se; \ + s2 += sa; \ + sa = OD_DCT_RSHIFT(s2, 1) - sa; \ + s5 += sd; \ + sd -= OD_DCT_RSHIFT(s5, 1); \ + s4 = sc - s4; \ + sc -= OD_DCT_RSHIFT(s4, 1); \ + s3 -= sb; \ + sb += OD_DCT_RSHIFT(s3, 1); \ + /* 2799/4096 ~= (1/Sqrt[2] - Cos[31*Pi/64]/2)/Sin[31*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(sf, 2799, 2048, 247); \ + s0 -= (sf*2799 + 2048) >> 12; \ + /* 2893/2048 ~= Sqrt[2]*Sin[31*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s0, 2893, 1024, 248); \ + sf += (s0*2893 + 1024) >> 11; \ + /* 5397/8192 ~= (Cos[Pi/4] - Cos[31*Pi/64])/Sin[31*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(sf, 5397, 4096, 249); \ + s0 -= (sf*5397 + 4096) >> 13; \ + /* 41/64 ~= (1/Sqrt[2] - Cos[29*Pi/64]/2)/Sin[29*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s1, 41, 32, 250); \ + se += (s1*41 + 32) >> 6; \ + /* 2865/2048 ~= Sqrt[2]*Sin[29*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(se, 2865, 1024, 251); \ + s1 -= (se*2865 + 1024) >> 11; \ + /* 4641/8192 ~= (1/Sqrt[2] - Cos[29*Pi/64])/Sin[29*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s1, 4641, 4096, 252); \ + se += (s1*4641 + 4096) >> 13; \ + /* 2473/4096 ~= (1/Sqrt[2] - Cos[27*Pi/64]/2)/Sin[27*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s2, 2473, 2048, 253); \ + sd += (s2*2473 + 2048) >> 12; \ + /* 5619/4096 ~= Sqrt[2]*Sin[27*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(sd, 5619, 2048, 254); \ + s2 -= (sd*5619 + 2048) >> 12; \ + /* 7839/16384 ~= (1/Sqrt[2] - Cos[27*Pi/64])/Sin[27*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s2, 7839, 8192, 255); \ + sd += (s2*7839 + 8192) >> 14; \ + /* 5747/8192 ~= (1/Sqrt[2] - Cos[7*Pi/64]/2)/Sin[7*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s3, 5747, 4096, 256); \ + sc -= (s3*5747 + 4096) >> 13; \ + /* 3903/8192 ~= Sqrt[2]*Sin[7*Pi/64] ~= */ \ + OD_DCT_OVERFLOW_CHECK(sc, 3903, 4096, 257); \ + s3 += (sc*3903 + 4096) >> 13; \ + /* 5701/8192 ~= (1/Sqrt[2] - Cos[7*Pi/64])/Sin[7*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s3, 5701, 4096, 258); \ + sc += (s3*5701 + 4096) >> 13; \ + /* 4471/8192 ~= (1/Sqrt[2] - Cos[23*Pi/64]/2)/Sin[23*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s4, 4471, 4096, 259); \ + sb += (s4*4471 + 4096) >> 13; \ + /* 1309/1024 ~= Sqrt[2]*Sin[23*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(sb, 1309, 512, 260); \ + s4 -= (sb*1309 + 512) >> 10; \ + /* 5067/16384 ~= (1/Sqrt[2] - Cos[23*Pi/64])/Sin[23*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s4, 5067, 8192, 261); \ + sb += (s4*5067 + 8192) >> 14; \ + /* 2217/4096 ~= (1/Sqrt[2] - Cos[11*Pi/64]/2)/Sin[11*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s5, 2217, 2048, 262); \ + sa -= (s5*2217 + 2048) >> 12; \ + /* 1489/2048 ~= Sqrt[2]*Sin[11*Pi/64] ~= 0.72705107329128 */ \ + OD_DCT_OVERFLOW_CHECK(sa, 1489, 1024, 263); \ + s5 += (sa*1489 + 1024) >> 11; \ + /* 75/256 ~= (1/Sqrt[2] - Cos[11*Pi/64])/Sin[11*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s5, 75, 128, 264); \ + sa += (s5*75 + 128) >> 8; \ + /* 2087/4096 ~= (1/Sqrt[2] - Cos[19*Pi/64]/2)/Sin[19*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s9, 2087, 2048, 265); \ + s6 -= (s9*2087 + 2048) >> 12; \ + /* 4653/4096 ~= Sqrt[2]*Sin[19*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s6, 4653, 2048, 266); \ + s9 += (s6*4653 + 2048) >> 12; \ + /* 4545/32768 ~= (1/Sqrt[2] - Cos[19*Pi/64])/Sin[19*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s9, 4545, 16384, 267); \ + s6 -= (s9*4545 + 16384) >> 15; \ + /* 2053/4096 ~= (1/Sqrt[2] - Cos[15*Pi/64]/2)/Sin[15*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s8, 2053, 2048, 268); \ + s7 += (s8*2053 + 2048) >> 12; \ + /* 1945/2048 ~= Sqrt[2]*Sin[15*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s7, 1945, 1024, 269); \ + s8 -= (s7*1945 + 1024) >> 11; \ + /* 1651/32768 ~= (1/Sqrt[2] - Cos[15*Pi/64])/Sin[15*Pi/64] */ \ + OD_DCT_OVERFLOW_CHECK(s8, 1651, 16384, 270); \ + s7 -= (s8*1651 + 16384) >> 15; \ + } \ + while (0) + +#define OD_IDST_16(s0, s8, s4, sc, s2, sa, s6, se, \ + s1, s9, s5, sd, s3, sb, s7, sf) \ + /* Embedded 16-point orthonormal Type-IV iDST. */ \ + do { \ + int s0h; \ + int s4h; \ + int sbh; \ + int sfh; \ + /* 1651/32768 ~= (1/Sqrt[2] - Cos[15*Pi/64])/Sin[15*Pi/64] */ \ + se += (s1*1651 + 16384) >> 15; \ + /* 1945/2048 ~= Sqrt[2]*Sin[15*Pi/64] */ \ + s1 += (se*1945 + 1024) >> 11; \ + /* 2053/4096 ~= (1/Sqrt[2] - Cos[15*Pi/64]/2)/Sin[15*Pi/64] */ \ + se -= (s1*2053 + 2048) >> 12; \ + /* 4545/32768 ~= (1/Sqrt[2] - Cos[19*Pi/64])/Sin[19*Pi/64] */ \ + s6 += (s9*4545 + 16384) >> 15; \ + /* 4653/32768 ~= Sqrt[2]*Sin[19*Pi/64] */ \ + s9 -= (s6*4653 + 2048) >> 12; \ + /* 2087/4096 ~= (1/Sqrt[2] - Cos[19*Pi/64]/2)/Sin[19*Pi/64] */ \ + s6 += (s9*2087 + 2048) >> 12; \ + /* 75/256 ~= (1/Sqrt[2] - Cos[11*Pi/64])/Sin[11*Pi/64] */ \ + s5 -= (sa*75 + 128) >> 8; \ + /* 1489/2048 ~= Sqrt[2]*Sin[11*Pi/64] */ \ + sa -= (s5*1489 + 1024) >> 11; \ + /* 2217/4096 ~= (1/Sqrt[2] - Cos[11*Pi/64]/2)/Sin[11*Pi/64] */ \ + s5 += (sa*2217 + 2048) >> 12; \ + /* 5067/16384 ~= (1/Sqrt[2] - Cos[23*Pi/64])/Sin[23*Pi/64] */ \ + sd -= (s2*5067 + 8192) >> 14; \ + /* 1309/1024 ~= Sqrt[2]*Sin[23*Pi/64] */ \ + s2 += (sd*1309 + 512) >> 10; \ + /* 4471/8192 ~= (1/Sqrt[2] - Cos[23*Pi/64]/2)/Sin[23*Pi/64] */ \ + sd -= (s2*4471 + 4096) >> 13; \ + /* 5701/8192 ~= (1/Sqrt[2] - Cos[7*Pi/64])/Sin[7*Pi/64] */ \ + s3 -= (sc*5701 + 4096) >> 13; \ + /* 3903/8192 ~= Sqrt[2]*Sin[7*Pi/64] */ \ + sc -= (s3*3903 + 4096) >> 13; \ + /* 5747/8192 ~= (1/Sqrt[2] - Cos[7*Pi/64]/2)/Sin[7*Pi/64] */ \ + s3 += (sc*5747 + 4096) >> 13; \ + /* 7839/16384 ~= (1/Sqrt[2] - Cos[27*Pi/64])/Sin[27*Pi/64] */ \ + sb -= (s4*7839 + 8192) >> 14; \ + /* 5619/4096 ~= Sqrt[2]*Sin[27*Pi/64] */ \ + s4 += (sb*5619 + 2048) >> 12; \ + /* 2473/4096 ~= (1/Sqrt[2] - Cos[27*Pi/64]/2)/Sin[27*Pi/64] */ \ + sb -= (s4*2473 + 2048) >> 12; \ + /* 4641/8192 ~= (1/Sqrt[2] - Cos[29*Pi/64])/Sin[29*Pi/64] */ \ + s7 -= (s8*4641 + 4096) >> 13; \ + /* 2865/2048 ~= Sqrt[2]*Sin[29*Pi/64] */ \ + s8 += (s7*2865 + 1024) >> 11; \ + /* 41/64 ~= (1/Sqrt[2] - Cos[29*Pi/64]/2)/Sin[29*Pi/64] */ \ + s7 -= (s8*41 + 32) >> 6; \ + /* 5397/8192 ~= (Cos[Pi/4] - Cos[31*Pi/64])/Sin[31*Pi/64] */ \ + s0 += (sf*5397 + 4096) >> 13; \ + /* 2893/2048 ~= Sqrt[2]*Sin[31*Pi/64] */ \ + sf -= (s0*2893 + 1024) >> 11; \ + /* 2799/4096 ~= (1/Sqrt[2] - Cos[31*Pi/64]/2)/Sin[31*Pi/64] */ \ + s0 += (sf*2799 + 2048) >> 12; \ + sd -= OD_DCT_RSHIFT(sc, 1); \ + sc += sd; \ + s3 += OD_DCT_RSHIFT(s2, 1); \ + s2 = s3 - s2; \ + sb += OD_DCT_RSHIFT(sa, 1); \ + sa -= sb; \ + s5 = OD_DCT_RSHIFT(s4, 1) - s5; \ + s4 -= s5; \ + s7 = OD_DCT_RSHIFT(s9, 1) - s7; \ + s9 -= s7; \ + s6 -= OD_DCT_RSHIFT(s8, 1); \ + s8 += s6; \ + se = OD_DCT_RSHIFT(sf, 1) - se; \ + sf -= se; \ + s0 += OD_DCT_RSHIFT(s1, 1); \ + s1 -= s0; \ + s5 -= s9; \ + s9 += OD_DCT_RSHIFT(s5, 1); \ + sa = s6 - sa; \ + s6 -= OD_DCT_RSHIFT(sa, 1); \ + se += s2; \ + s2 -= OD_DCT_RSHIFT(se, 1); \ + s1 = sd - s1; \ + sd -= OD_DCT_RSHIFT(s1, 1); \ + s0 += s3; \ + s0h = OD_DCT_RSHIFT(s0, 1); \ + s3 = s0h - s3; \ + sf += sc; \ + sfh = OD_DCT_RSHIFT(sf, 1); \ + sc -= sfh; \ + sb = s7 - sb; \ + sbh = OD_DCT_RSHIFT(sb, 1); \ + s7 -= sbh; \ + s4 -= s8; \ + s4h = OD_DCT_RSHIFT(s4, 1); \ + s8 += s4h; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + se -= (s1*3227 + 16384) >> 15; \ + /* 6393/32768 ~= Sin[Pi/16] ~= 0.19509032201612825 */ \ + s1 += (se*6393 + 16384) >> 15; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + se -= (s1*3227 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + s6 -= (s9*2485 + 4096) >> 13; \ + /* 4551/8192 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + s9 += (s6*4551 + 4096) >> 13; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + s6 -= (s9*2485 + 4096) >> 13; \ + /* 8757/16384 ~= Tan[5*Pi/32] ~= 0.534511135950792 */ \ + s5 -= (sa*8757 + 8192) >> 14; \ + /* 6811/8192 ~= Sin[5*Pi/16] ~= 0.831469612302545 */ \ + sa += (s5*6811 + 4096) >> 13; \ + /* 8757/16384 ~= Tan[5*Pi/32]) ~= 0.534511135950792 */ \ + s5 -= (sa*8757 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32]) ~= 0.820678790828660 */ \ + s2 -= (sd*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + sd += (s2*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + s2 -= (sd*6723 + 4096) >> 13; \ + s9 += OD_DCT_RSHIFT(se, 1); \ + se = s9 - se; \ + s6 += OD_DCT_RSHIFT(s1, 1); \ + s1 -= s6; \ + sd = OD_DCT_RSHIFT(sa, 1) - sd; \ + sa -= sd; \ + s2 += OD_DCT_RSHIFT(s5, 1); \ + s5 = s2 - s5; \ + s3 -= sbh; \ + sb += s3; \ + sc += s4h; \ + s4 = sc - s4; \ + s8 = s0h - s8; \ + s0 -= s8; \ + s7 = sfh - s7; \ + sf -= s7; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s6 -= (s9*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[pi/4] ~= 0.707106781186547 */ \ + s9 += (s6*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s6 -= (s9*13573 + 16384) >> 15; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s5 -= (sa*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[pi/4] ~= 0.707106781186547 */ \ + sa += (s5*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s5 -= (sa*13573 + 16384) >> 15; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + s3 -= (sc*3259 + 8192) >> 14; \ + /* 3135/8192 ~= Sin[Pi/8] ~= 0.382683432365090 */ \ + sc += (s3*3135 + 4096) >> 13; \ + /* 3259/16384 ~= Tan[Pi/16] ~= 0.198912367379658 */ \ + s3 -= (sc*3259 + 8192) >> 14; \ + /* 21895/32768 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + sb -= (s4*21895 + 16384) >> 15; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + s4 += (sb*15137 + 8192) >> 14; \ + /* 21895/32768 ~= Tan[3*Pi/16] ~= 0.668178637919299 */ \ + sb -= (s4*21895 + 16384) >> 15; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s8 -= (s7*13573 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[pi/4] ~= 0.707106781186547 */ \ + s7 += (s8*11585 + 8192) >> 14; \ + /* 13573/32768 ~= Tan[pi/8] ~= 0.414213562373095 */ \ + s8 -= (s7*13573 + 16384) >> 15; \ + } \ + while (0) + +/* TODO: rewrite this to match OD_FDST_16. */ +#define OD_FDST_16_ASYM(t0, t0h, t8, t4, t4h, tc, t2, ta, t6, te, \ + t1, t9, t5, td, t3, tb, t7, t7h, tf) \ + /* Embedded 16-point asymmetric Type-IV fDST. */ \ + do { \ + int t2h; \ + int t3h; \ + int t6h; \ + int t8h; \ + int t9h; \ + int tch; \ + int tdh; \ + /* TODO: Can we move these into another operation */ \ + t8 = -t8; \ + t9 = -t9; \ + ta = -ta; \ + tb = -tb; \ + td = -td; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(te, 13573, 8192, 136); \ + t1 -= (te*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + OD_DCT_OVERFLOW_CHECK(t1, 11585, 16384, 137); \ + te += (t1*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(te, 13573, 8192, 138); \ + t1 -= (te*13573 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(td, 4161, 8192, 139); \ + t2 += (td*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 15137, 8192, 140); \ + td -= (t2*15137 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(td, 14341, 8192, 141); \ + t2 += (td*14341 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(t3, 14341, 8192, 142); \ + tc -= (t3*14341 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 15137, 8192, 143); \ + t3 += (tc*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(t3, 4161, 8192, 144); \ + tc -= (t3*4161 + 8192) >> 14; \ + te = t0h - te; \ + t0 -= te; \ + tf = OD_DCT_RSHIFT(t1, 1) - tf; \ + t1 -= tf; \ + /* TODO: Can we move this into another operation */ \ + tc = -tc; \ + t2 = OD_DCT_RSHIFT(tc, 1) - t2; \ + tc -= t2; \ + t3 = OD_DCT_RSHIFT(td, 1) - t3; \ + td = t3 - td; \ + /* 7489/8192 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 7489, 4096, 145); \ + t9 -= (t6*7489 + 4096) >> 13; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 11585, 8192, 146); \ + t6 += (t9*11585 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 19195, 16384, 147); \ + t9 += (t6*19195 + 16384) >> 15; \ + t8 += OD_DCT_RSHIFT(t9, 1); \ + t9 -= t8; \ + t6 = t7h - t6; \ + t7 -= t6; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(t7, 6723, 4096, 148); \ + t8 += (t7*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + OD_DCT_OVERFLOW_CHECK(t8, 16069, 8192, 149); \ + t7 -= (t8*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32]) ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(t7, 6723, 4096, 150); \ + t8 += (t7*6723 + 4096) >> 13; \ + /* 17515/32768 ~= Tan[5*Pi/32]) ~= 0.534511135950792 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 17515, 16384, 151); \ + t9 += (t6*17515 + 16384) >> 15; \ + /* 13623/16384 ~= Sin[5*Pi/16] ~= 0.831469612302545 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 13623, 8192, 152); \ + t6 -= (t9*13623 + 8192) >> 14; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.534511135950792 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 17515, 16384, 153); \ + t9 += (t6*17515 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 13573, 8192, 154); \ + t5 += (ta*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 11585, 16384, 155); \ + ta -= (t5*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 13573, 8192, 156); \ + t5 += (ta*13573 + 8192) >> 14; \ + tb += OD_DCT_RSHIFT(t5, 1); \ + t5 = tb - t5; \ + ta += t4h; \ + t4 -= ta; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 2485, 4096, 157); \ + ta += (t5*2485 + 4096) >> 13; \ + /* 18205/32768 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 18205, 16384, 158); \ + t5 -= (ta*18205 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 2485, 4096, 159); \ + ta += (t5*2485 + 4096) >> 13; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 6723, 4096, 160); \ + tb -= (t4*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 16069, 8192, 161); \ + t4 += (tb*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 6723, 4096, 162); \ + tb -= (t4*6723 + 4096) >> 13; \ + /* TODO: Can we move this into another operation */ \ + t5 = -t5; \ + tc -= tf; \ + tch = OD_DCT_RSHIFT(tc, 1); \ + tf += tch; \ + t3 += t0; \ + t3h = OD_DCT_RSHIFT(t3, 1); \ + t0 -= t3h; \ + td -= t1; \ + tdh = OD_DCT_RSHIFT(td, 1); \ + t1 += tdh; \ + t2 += te; \ + t2h = OD_DCT_RSHIFT(t2, 1); \ + te -= t2h; \ + t8 += t4; \ + t8h = OD_DCT_RSHIFT(t8, 1); \ + t4 = t8h - t4; \ + t7 = tb - t7; \ + t7h = OD_DCT_RSHIFT(t7, 1); \ + tb = t7h - tb; \ + t6 -= ta; \ + t6h = OD_DCT_RSHIFT(t6, 1); \ + ta += t6h; \ + t9 = t5 - t9; \ + t9h = OD_DCT_RSHIFT(t9, 1); \ + t5 -= t9h; \ + t0 -= t7h; \ + t7 += t0; \ + tf += t8h; \ + t8 -= tf; \ + te -= t6h; \ + t6 += te; \ + t1 += t9h; \ + t9 -= t1; \ + tb -= tch; \ + tc += tb; \ + t4 += t3h; \ + t3 -= t4; \ + ta -= tdh; \ + td += ta; \ + t5 = t2h - t5; \ + t2 -= t5; \ + /* TODO: Can we move these into another operation */ \ + t8 = -t8; \ + t9 = -t9; \ + ta = -ta; \ + tb = -tb; \ + tc = -tc; \ + td = -td; \ + tf = -tf; \ + /* 7799/8192 ~= Tan[31*Pi/128] ~= 0.952079146700925 */ \ + OD_DCT_OVERFLOW_CHECK(tf, 7799, 4096, 163); \ + t0 -= (tf*7799 + 4096) >> 13; \ + /* 4091/4096 ~= Sin[31*Pi/64] ~= 0.998795456205172 */ \ + OD_DCT_OVERFLOW_CHECK(t0, 4091, 2048, 164); \ + tf += (t0*4091 + 2048) >> 12; \ + /* 7799/8192 ~= Tan[31*Pi/128] ~= 0.952079146700925 */ \ + OD_DCT_OVERFLOW_CHECK(tf, 7799, 4096, 165); \ + t0 -= (tf*7799 + 4096) >> 13; \ + /* 2417/32768 ~= Tan[3*Pi/128] ~= 0.0737644315224493 */ \ + OD_DCT_OVERFLOW_CHECK(te, 2417, 16384, 166); \ + t1 += (te*2417 + 16384) >> 15; \ + /* 601/4096 ~= Sin[3*Pi/64] ~= 0.146730474455362 */ \ + OD_DCT_OVERFLOW_CHECK(t1, 601, 2048, 167); \ + te -= (t1*601 + 2048) >> 12; \ + /* 2417/32768 ~= Tan[3*Pi/128] ~= 0.0737644315224493 */ \ + OD_DCT_OVERFLOW_CHECK(te, 2417, 16384, 168); \ + t1 += (te*2417 + 16384) >> 15; \ + /* 14525/32768 ~= Tan[17*Pi/128] ~= 0.443269513890864 */ \ + OD_DCT_OVERFLOW_CHECK(t8, 14525, 16384, 169); \ + t7 -= (t8*14525 + 16384) >> 15; \ + /* 3035/4096 ~= Sin[17*Pi/64] ~= 0.740951125354959 */ \ + OD_DCT_OVERFLOW_CHECK(t7, 3035, 2048, 170); \ + t8 += (t7*3035 + 2048) >> 12; \ + /* 7263/16384 ~= Tan[17*Pi/128] ~= 0.443269513890864 */ \ + OD_DCT_OVERFLOW_CHECK(t8, 7263, 8192, 171); \ + t7 -= (t8*7263 + 8192) >> 14; \ + /* 6393/8192 ~= Tan[27*Pi/128] ~= 0.780407659653944 */ \ + OD_DCT_OVERFLOW_CHECK(td, 6393, 4096, 172); \ + t2 -= (td*6393 + 4096) >> 13; \ + /* 3973/4096 ~= Sin[27*Pi/64] ~= 0.970031253194544 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 3973, 2048, 173); \ + td += (t2*3973 + 2048) >> 12; \ + /* 6393/8192 ~= Tan[27*Pi/128] ~= 0.780407659653944 */ \ + OD_DCT_OVERFLOW_CHECK(td, 6393, 4096, 174); \ + t2 -= (td*6393 + 4096) >> 13; \ + /* 9281/16384 ~= Tan[21*Pi/128] ~= 0.566493002730344 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 9281, 8192, 175); \ + t5 -= (ta*9281 + 8192) >> 14; \ + /* 7027/8192 ~= Sin[21*Pi/64] ~= 0.857728610000272 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 7027, 4096, 176); \ + ta += (t5*7027 + 4096) >> 13; \ + /* 9281/16384 ~= Tan[21*Pi/128] ~= 0.566493002730344 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 9281, 8192, 177); \ + t5 -= (ta*9281 + 8192) >> 14; \ + /* 11539/16384 ~= Tan[25*Pi/128] ~= 0.704279460865044 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 11539, 8192, 178); \ + t3 -= (tc*11539 + 8192) >> 14; \ + /* 7713/8192 ~= Sin[25*Pi/64] ~= 0.941544065183021 */ \ + OD_DCT_OVERFLOW_CHECK(t3, 7713, 4096, 179); \ + tc += (t3*7713 + 4096) >> 13; \ + /* 11539/16384 ~= Tan[25*Pi/128] ~= 0.704279460865044 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 11539, 8192, 180); \ + t3 -= (tc*11539 + 8192) >> 14; \ + /* 10375/16384 ~= Tan[23*Pi/128] ~= 0.633243016177569 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 10375, 8192, 181); \ + t4 -= (tb*10375 + 8192) >> 14; \ + /* 7405/8192 ~= Sin[23*Pi/64] ~= 0.903989293123443 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 7405, 4096, 182); \ + tb += (t4*7405 + 4096) >> 13; \ + /* 10375/16384 ~= Tan[23*Pi/128] ~= 0.633243016177569 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 10375, 8192, 183); \ + t4 -= (tb*10375 + 8192) >> 14; \ + /* 8247/16384 ~= Tan[19*Pi/128] ~= 0.503357699799294 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 8247, 8192, 184); \ + t6 -= (t9*8247 + 8192) >> 14; \ + /* 1645/2048 ~= Sin[19*Pi/64] ~= 0.803207531480645 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 1645, 1024, 185); \ + t9 += (t6*1645 + 1024) >> 11; \ + /* 8247/16384 ~= Tan[19*Pi/128] ~= 0.503357699799294 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 8247, 8192, 186); \ + t6 -= (t9*8247 + 8192) >> 14; \ + } \ + while (0) + +#define OD_IDST_16_ASYM(t0, t0h, t8, t4, tc, t2, t2h, ta, t6, te, teh, \ + t1, t9, t5, td, t3, tb, t7, tf) \ + /* Embedded 16-point asymmetric Type-IV iDST. */ \ + do { \ + int t1h_; \ + int t3h_; \ + int t4h; \ + int t6h; \ + int t9h_; \ + int tbh_; \ + int tch; \ + /* 8247/16384 ~= Tan[19*Pi/128] ~= 0.503357699799294 */ \ + t6 += (t9*8247 + 8192) >> 14; \ + /* 1645/2048 ~= Sin[19*Pi/64] ~= 0.803207531480645 */ \ + t9 -= (t6*1645 + 1024) >> 11; \ + /* 8247/16384 ~= Tan[19*Pi/128] ~= 0.503357699799294 */ \ + t6 += (t9*8247 + 8192) >> 14; \ + /* 10375/16384 ~= Tan[23*Pi/128] ~= 0.633243016177569 */ \ + t2 += (td*10375 + 8192) >> 14; \ + /* 7405/8192 ~= Sin[23*Pi/64] ~= 0.903989293123443 */ \ + td -= (t2*7405 + 4096) >> 13; \ + /* 10375/16384 ~= Tan[23*Pi/128] ~= 0.633243016177569 */ \ + t2 += (td*10375 + 8192) >> 14; \ + /* 11539/16384 ~= Tan[25*Pi/128] ~= 0.704279460865044 */ \ + tc += (t3*11539 + 8192) >> 14; \ + /* 7713/8192 ~= Sin[25*Pi/64] ~= 0.941544065183021 */ \ + t3 -= (tc*7713 + 4096) >> 13; \ + /* 11539/16384 ~= Tan[25*Pi/128] ~= 0.704279460865044 */ \ + tc += (t3*11539 + 8192) >> 14; \ + /* 9281/16384 ~= Tan[21*Pi/128] ~= 0.566493002730344 */ \ + ta += (t5*9281 + 8192) >> 14; \ + /* 7027/8192 ~= Sin[21*Pi/64] ~= 0.857728610000272 */ \ + t5 -= (ta*7027 + 4096) >> 13; \ + /* 9281/16384 ~= Tan[21*Pi/128] ~= 0.566493002730344 */ \ + ta += (t5*9281 + 8192) >> 14; \ + /* 6393/8192 ~= Tan[27*Pi/128] ~= 0.780407659653944 */ \ + t4 += (tb*6393 + 4096) >> 13; \ + /* 3973/4096 ~= Sin[27*Pi/64] ~= 0.970031253194544 */ \ + tb -= (t4*3973 + 2048) >> 12; \ + /* 6393/8192 ~= Tan[27*Pi/128] ~= 0.780407659653944 */ \ + t4 += (tb*6393 + 4096) >> 13; \ + /* 7263/16384 ~= Tan[17*Pi/128] ~= 0.443269513890864 */ \ + te += (t1*7263 + 8192) >> 14; \ + /* 3035/4096 ~= Sin[17*Pi/64] ~= 0.740951125354959 */ \ + t1 -= (te*3035 + 2048) >> 12; \ + /* 14525/32768 ~= Tan[17*Pi/128] ~= 0.443269513890864 */ \ + te += (t1*14525 + 16384) >> 15; \ + /* 2417/32768 ~= Tan[3*Pi/128] ~= 0.0737644315224493 */ \ + t8 -= (t7*2417 + 16384) >> 15; \ + /* 601/4096 ~= Sin[3*Pi/64] ~= 0.146730474455362 */ \ + t7 += (t8*601 + 2048) >> 12; \ + /* 2417/32768 ~= Tan[3*Pi/128] ~= 0.0737644315224493 */ \ + t8 -= (t7*2417 + 16384) >> 15; \ + /* 7799/8192 ~= Tan[31*Pi/128] ~= 0.952079146700925 */ \ + t0 += (tf*7799 + 4096) >> 13; \ + /* 4091/4096 ~= Sin[31*Pi/64] ~= 0.998795456205172 */ \ + tf -= (t0*4091 + 2048) >> 12; \ + /* 7799/8192 ~= Tan[31*Pi/128] ~= 0.952079146700925 */ \ + t0 += (tf*7799 + 4096) >> 13; \ + /* TODO: Can we move these into another operation */ \ + t1 = -t1; \ + t3 = -t3; \ + t5 = -t5; \ + t9 = -t9; \ + tb = -tb; \ + td = -td; \ + tf = -tf; \ + t4 += ta; \ + t4h = OD_DCT_RSHIFT(t4, 1); \ + ta = t4h - ta; \ + tb -= t5; \ + tbh_ = OD_DCT_RSHIFT(tb, 1); \ + t5 += tbh_; \ + tc += t2; \ + tch = OD_DCT_RSHIFT(tc, 1); \ + t2 -= tch; \ + t3 -= td; \ + t3h_ = OD_DCT_RSHIFT(t3, 1); \ + td += t3h_; \ + t9 += t8; \ + t9h_ = OD_DCT_RSHIFT(t9, 1); \ + t8 -= t9h_; \ + t6 -= t7; \ + t6h = OD_DCT_RSHIFT(t6, 1); \ + t7 += t6h; \ + t1 += tf; \ + t1h_ = OD_DCT_RSHIFT(t1, 1); \ + tf -= t1h_; \ + te -= t0; \ + teh = OD_DCT_RSHIFT(te, 1); \ + t0 += teh; \ + ta += t9h_; \ + t9 = ta - t9; \ + t5 -= t6h; \ + t6 += t5; \ + td = teh - td; \ + te = td - te; \ + t2 = t1h_ - t2; \ + t1 -= t2; \ + t7 += t4h; \ + t4 -= t7; \ + t8 -= tbh_; \ + tb += t8; \ + t0 += tch; \ + tc -= t0; \ + tf -= t3h_; \ + t3 += tf; \ + /* TODO: Can we move this into another operation */ \ + ta = -ta; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + td += (t2*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + t2 -= (td*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.820678790828660 */ \ + td += (t2*6723 + 4096) >> 13; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + t5 -= (ta*2485 + 4096) >> 13; \ + /* 18205/32768 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + ta += (t5*18205 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + t5 -= (ta*2485 + 4096) >> 13; \ + t2 += t5; \ + t2h = OD_DCT_RSHIFT(t2, 1); \ + t5 -= t2h; \ + ta = td - ta; \ + td -= OD_DCT_RSHIFT(ta, 1); \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + ta -= (t5*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + t5 += (ta*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + ta -= (t5*13573 + 8192) >> 14; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.534511135950792 */ \ + t9 -= (t6*17515 + 16384) >> 15; \ + /* 13623/16384 ~= Sin[5*Pi/16] ~= 0.831469612302545 */ \ + t6 += (t9*13623 + 8192) >> 14; \ + /* 17515/32768 ~= Tan[5*Pi/32]) ~= 0.534511135950792 */ \ + t9 -= (t6*17515 + 16384) >> 15; \ + /* 6723/8192 ~= Tan[7*Pi/32]) ~= 0.820678790828660 */ \ + t1 -= (te*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.980785280403230 */ \ + te += (t1*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32]) ~= 0.820678790828660 */ \ + t1 -= (te*6723 + 4096) >> 13; \ + te += t6; \ + teh = OD_DCT_RSHIFT(te, 1); \ + t6 = teh - t6; \ + t9 += t1; \ + t1 -= OD_DCT_RSHIFT(t9, 1); \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + t9 -= (t6*19195 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + t6 -= (t9*11585 + 8192) >> 14; \ + /* 7489/8192 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + t9 += (t6*7489 + 4096) >> 13; \ + tb = tc - tb; \ + tc = OD_DCT_RSHIFT(tb, 1) - tc; \ + t3 += t4; \ + t4 = OD_DCT_RSHIFT(t3, 1) - t4; \ + /* TODO: Can we move this into another operation */ \ + t3 = -t3; \ + t8 += tf; \ + tf = OD_DCT_RSHIFT(t8, 1) - tf; \ + t0 += t7; \ + t0h = OD_DCT_RSHIFT(t0, 1); \ + t7 = t0h - t7; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + t3 += (tc*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + tc -= (t3*15137 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + t3 += (tc*14341 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + t4 -= (tb*14341 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + tb += (t4*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + t4 -= (tb*4161 + 8192) >> 14; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + t8 += (t7*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + t7 -= (t8*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + t8 += (t7*13573 + 8192) >> 14; \ + /* TODO: Can we move these into another operation */ \ + t1 = -t1; \ + t5 = -t5; \ + t9 = -t9; \ + tb = -tb; \ + td = -td; \ + } \ + while (0) + +#define OD_FDCT_32(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, tm, \ + te, tu, t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv) \ + /* Embedded 32-point orthonormal Type-II fDCT. */ \ + do { \ + int tgh; \ + int thh; \ + int tih; \ + int tkh; \ + int tmh; \ + int tnh; \ + int toh; \ + int tqh; \ + int tsh; \ + int tuh; \ + int tvh; \ + tv = t0 - tv; \ + tvh = OD_DCT_RSHIFT(tv, 1); \ + t0 -= tvh; \ + tu += t1; \ + tuh = OD_DCT_RSHIFT(tu, 1); \ + t1 = tuh - t1; \ + tt = t2 - tt; \ + t2 -= OD_DCT_RSHIFT(tt, 1); \ + ts += t3; \ + tsh = OD_DCT_RSHIFT(ts, 1); \ + t3 = tsh - t3; \ + tr = t4 - tr; \ + t4 -= OD_DCT_RSHIFT(tr, 1); \ + tq += t5; \ + tqh = OD_DCT_RSHIFT(tq, 1); \ + t5 = tqh - t5; \ + tp = t6 - tp; \ + t6 -= OD_DCT_RSHIFT(tp, 1); \ + to += t7; \ + toh = OD_DCT_RSHIFT(to, 1); \ + t7 = toh - t7; \ + tn = t8 - tn; \ + tnh = OD_DCT_RSHIFT(tn, 1); \ + t8 -= tnh; \ + tm += t9; \ + tmh = OD_DCT_RSHIFT(tm, 1); \ + t9 = tmh - t9; \ + tl = ta - tl; \ + ta -= OD_DCT_RSHIFT(tl, 1); \ + tk += tb; \ + tkh = OD_DCT_RSHIFT(tk, 1); \ + tb = tkh - tb; \ + tj = tc - tj; \ + tc -= OD_DCT_RSHIFT(tj, 1); \ + ti += td; \ + tih = OD_DCT_RSHIFT(ti, 1); \ + td = tih - td; \ + th = te - th; \ + thh = OD_DCT_RSHIFT(th, 1); \ + te -= thh; \ + tg += tf; \ + tgh = OD_DCT_RSHIFT(tg, 1); \ + tf = tgh - tf; \ + OD_FDCT_16_ASYM(t0, tg, tgh, t8, to, toh, t4, tk, tkh, tc, ts, tsh, \ + t2, ti, tih, ta, tq, tqh, t6, tm, tmh, te, tu, tuh); \ + OD_FDST_16_ASYM(tv, tvh, tf, tn, tnh, t7, tr, tb, tj, t3, \ + tt, td, tl, t5, tp, t9, th, thh, t1); \ + } \ + while (0) + +#define OD_IDCT_32(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, tm, \ + te, tu, t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv) \ + /* Embedded 32-point orthonormal Type-II iDCT. */ \ + do { \ + int t1h; \ + int t3h; \ + int t5h; \ + int t7h; \ + int t9h; \ + int tbh; \ + int tdh; \ + int tfh; \ + int thh; \ + int tth; \ + int tvh; \ + OD_IDST_16_ASYM(tv, tvh, tn, tr, tj, tt, tth, tl, tp, th, thh, \ + tu, tm, tq, ti, ts, tk, to, tg); \ + OD_IDCT_16_ASYM(t0, t8, t4, tc, t2, ta, t6, te, \ + t1, t1h, t9, t9h, t5, t5h, td, tdh, t3, t3h, tb, tbh, t7, t7h, tf, tfh); \ + tu = t1h - tu; \ + t1 -= tu; \ + te += thh; \ + th = te - th; \ + tm = t9h - tm; \ + t9 -= tm; \ + t6 += OD_DCT_RSHIFT(tp, 1); \ + tp = t6 - tp; \ + tq = t5h - tq; \ + t5 -= tq; \ + ta += OD_DCT_RSHIFT(tl, 1); \ + tl = ta - tl; \ + ti = tdh - ti; \ + td -= ti; \ + t2 += tth; \ + tt = t2 - tt; \ + ts = t3h - ts; \ + t3 -= ts; \ + tc += OD_DCT_RSHIFT(tj, 1); \ + tj = tc - tj; \ + tk = tbh - tk; \ + tb -= tk; \ + t4 += OD_DCT_RSHIFT(tr, 1); \ + tr = t4 - tr; \ + to = t7h - to; \ + t7 -= to; \ + t8 += OD_DCT_RSHIFT(tn, 1); \ + tn = t8 - tn; \ + tg = tfh - tg; \ + tf -= tg; \ + t0 += tvh; \ + tv = t0 - tv; \ + } \ + while (0) + +#if CONFIG_TX64X64 +#define OD_FDCT_32_ASYM(t0, tg, tgh, t8, to, toh, t4, tk, tkh, tc, ts, tsh, \ + t2, ti, tih, ta, tq, tqh, t6, tm, tmh, te, tu, tuh, t1, th, thh, \ + t9, tp, tph, t5, tl, tlh, td, tt, tth, t3, tj, tjh, tb, tr, trh, \ + t7, tn, tnh, tf, tv, tvh) \ + /* Embedded 32-point asymmetric Type-II fDCT. */ \ + do { \ + t0 += tvh; \ + tv = t0 - tv; \ + t1 = tuh - t1; \ + tu -= t1; \ + t2 += tth; \ + tt = t2 - tt; \ + t3 = tsh - t3; \ + ts -= t3; \ + t4 += trh; \ + tr = t4 - tr; \ + t5 = tqh - t5; \ + tq -= t5; \ + t6 += tph; \ + tp = t6 - tp; \ + t7 = toh - t7; \ + to -= t7; \ + t8 += tnh; \ + tn = t8 - tn; \ + t9 = tmh - t9; \ + tm -= t9; \ + ta += tlh; \ + tl = ta - tl; \ + tb = tkh - tb; \ + tk -= tb; \ + tc += tjh; \ + tj = tc - tj; \ + td = tih - td; \ + ti -= td; \ + te += thh; \ + th = te - th; \ + tf = tgh - tf; \ + tg -= tf; \ + OD_FDCT_16(t0, tg, t8, to, t4, tk, tc, ts, \ + t2, ti, ta, tq, t6, tm, te, tu); \ + OD_FDST_16(tv, tf, tn, t7, tr, tb, tj, t3, \ + tt, td, tl, t5, tp, t9, th, t1); \ + } \ + while (0) + +#define OD_IDCT_32_ASYM(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, \ + t6, tm, te, tu, t1, t1h, th, thh, t9, t9h, tp, tph, t5, t5h, tl, tlh, \ + td, tdh, tt, tth, t3, t3h, tj, tjh, tb, tbh, tr, trh, t7, t7h, tn, tnh, \ + tf, tfh, tv, tvh) \ + /* Embedded 32-point asymmetric Type-II iDCT. */ \ + do { \ + OD_IDST_16(tv, tn, tr, tj, tt, tl, tp, th, \ + tu, tm, tq, ti, ts, tk, to, tg); \ + OD_IDCT_16(t0, t8, t4, tc, t2, ta, t6, te, \ + t1, t9, t5, td, t3, tb, t7, tf); \ + tv = t0 - tv; \ + tvh = OD_DCT_RSHIFT(tv, 1); \ + t0 -= tvh; \ + t1 += tu; \ + t1h = OD_DCT_RSHIFT(t1, 1); \ + tu = t1h - tu; \ + tt = t2 - tt; \ + tth = OD_DCT_RSHIFT(tt, 1); \ + t2 -= tth; \ + t3 += ts; \ + t3h = OD_DCT_RSHIFT(t3, 1); \ + ts = t3h - ts; \ + tr = t4 - tr; \ + trh = OD_DCT_RSHIFT(tr, 1); \ + t4 -= trh; \ + t5 += tq; \ + t5h = OD_DCT_RSHIFT(t5, 1); \ + tq = t5h - tq; \ + tp = t6 - tp; \ + tph = OD_DCT_RSHIFT(tp, 1); \ + t6 -= tph; \ + t7 += to; \ + t7h = OD_DCT_RSHIFT(t7, 1); \ + to = t7h - to; \ + tn = t8 - tn; \ + tnh = OD_DCT_RSHIFT(tn, 1); \ + t8 -= tnh; \ + t9 += tm; \ + t9h = OD_DCT_RSHIFT(t9, 1); \ + tm = t9h - tm; \ + tl = ta - tl; \ + tlh = OD_DCT_RSHIFT(tl, 1); \ + ta -= tlh; \ + tb += tk; \ + tbh = OD_DCT_RSHIFT(tb, 1); \ + tk = tbh - tk; \ + tj = tc - tj; \ + tjh = OD_DCT_RSHIFT(tj, 1); \ + tc -= tjh; \ + td += ti; \ + tdh = OD_DCT_RSHIFT(td, 1); \ + ti = tdh - ti; \ + th = te - th; \ + thh = OD_DCT_RSHIFT(th, 1); \ + te -= thh; \ + tf += tg; \ + tfh = OD_DCT_RSHIFT(tf, 1); \ + tg = tfh - tg; \ + } \ + while (0) + +#define OD_FDST_32_ASYM(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, \ + tm, te, tu, t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv) \ + /* Embedded 32-point asymmetric Type-IV fDST. */ \ + do { \ + int t0h; \ + int t1h; \ + int t4h; \ + int t5h; \ + int tqh; \ + int trh; \ + int tuh; \ + int tvh; \ + \ + tu = -tu; \ + \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(tq, 13573, 8192, 271); \ + t5 -= (tq*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 11585, 16384, 272); \ + tq += (t5*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + OD_DCT_OVERFLOW_CHECK(tq, 13573, 8192, 273); \ + t5 -= (tq*13573 + 8192) >> 14; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 29957, 16384, 274); \ + tp += (t6*29957 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + OD_DCT_OVERFLOW_CHECK(tp, 11585, 8192, 275); \ + t6 -= (tp*11585 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 19195, 16384, 276); \ + tp -= (t6*19195 + 16384) >> 15; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(t1, 29957, 16384, 277); \ + tu += (t1*29957 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + OD_DCT_OVERFLOW_CHECK(tu, 11585, 8192, 278); \ + t1 -= (tu*11585 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + OD_DCT_OVERFLOW_CHECK(t1, 19195, 16384, 279); \ + tu -= (t1*19195 + 16384) >> 15; \ + /* 28681/32768 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 28681, 16384, 280); \ + tt += (t2*28681 + 16384) >> 15; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(tt, 15137, 8192, 281); \ + t2 -= (tt*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(t2, 4161, 8192, 282); \ + tt += (t2*4161 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(ts, 4161, 8192, 283); \ + t3 += (ts*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(t3, 15137, 8192, 284); \ + ts -= (t3*15137 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(ts, 14341, 8192, 285); \ + t3 += (ts*14341 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + OD_DCT_OVERFLOW_CHECK(tm, 19195, 16384, 286); \ + t9 -= (tm*19195 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 11585, 8192, 287); \ + tm -= (t9*11585 + 8192) >> 14; \ + /* 7489/8192 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(tm, 7489, 4096, 288); \ + t9 += (tm*7489 + 4096) >> 13; \ + /* 3259/8192 ~= 2*Tan[Pi/16] ~= 0.397824734759316 */ \ + OD_DCT_OVERFLOW_CHECK(tl, 3259, 4096, 289); \ + ta += (tl*3259 + 4096) >> 13; \ + /* 3135/16384 ~= Sin[Pi/8]/2 ~= 0.1913417161825449 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 3135, 8192, 290); \ + tl -= (ta*3135 + 8192) >> 14; \ + /* 3259/8192 ~= 2*Tan[Pi/16] ~= 0.397824734759316 */ \ + OD_DCT_OVERFLOW_CHECK(tl, 3259, 4096, 291); \ + ta += (tl*3259 + 4096) >> 13; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(tk, 4161, 8192, 292); \ + tb += (tk*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 15137, 8192, 293); \ + tk -= (tb*15137 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(tk, 14341, 8192, 294); \ + tb += (tk*14341 + 8192) >> 14; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + OD_DCT_OVERFLOW_CHECK(te, 29957, 16384, 295); \ + th += (te*29957 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + OD_DCT_OVERFLOW_CHECK(th, 11585, 8192, 296); \ + te -= (th*11585 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + OD_DCT_OVERFLOW_CHECK(te, 19195, 16384, 297); \ + th -= (te*19195 + 16384) >> 15; \ + /* 28681/32768 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 28681, 16384, 298); \ + tj += (tc*28681 + 16384) >> 15; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(tj, 15137, 8192, 299); \ + tc -= (tj*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 4161, 8192, 300); \ + tj += (tc*4161 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + OD_DCT_OVERFLOW_CHECK(ti, 4161, 8192, 301); \ + td += (ti*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + OD_DCT_OVERFLOW_CHECK(td, 15137, 8192, 302); \ + ti -= (td*15137 + 8192) >> 14; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + OD_DCT_OVERFLOW_CHECK(ti, 14341, 8192, 303); \ + td += (ti*14341 + 8192) >> 14; \ + \ + t1 = -t1; \ + t2 = -t2; \ + t3 = -t3; \ + td = -td; \ + tg = -tg; \ + to = -to; \ + ts = -ts; \ + \ + tr -= OD_DCT_RSHIFT(t5, 1); \ + t5 += tr; \ + tq -= OD_DCT_RSHIFT(t4, 1); /* pass */ \ + t4 += tq; \ + t6 -= OD_DCT_RSHIFT(t7, 1); \ + t7 += t6; \ + to -= OD_DCT_RSHIFT(tp, 1); /* pass */ \ + tp += to; \ + t1 += OD_DCT_RSHIFT(t0, 1); /* pass */ \ + t0 -= t1; \ + tv -= OD_DCT_RSHIFT(tu, 1); \ + tu += tv; \ + t3 -= OD_DCT_RSHIFT(tt, 1); \ + tt += t3; \ + t2 += OD_DCT_RSHIFT(ts, 1); \ + ts -= t2; \ + t9 -= OD_DCT_RSHIFT(t8, 1); /* pass */ \ + t8 += t9; \ + tn += OD_DCT_RSHIFT(tm, 1); \ + tm -= tn; \ + tb += OD_DCT_RSHIFT(ta, 1); \ + ta -= tb; \ + tl -= OD_DCT_RSHIFT(tk, 1); \ + tk += tl; \ + te -= OD_DCT_RSHIFT(tf, 1); /* pass */ \ + tf += te; \ + tg -= OD_DCT_RSHIFT(th, 1); \ + th += tg; \ + tc -= OD_DCT_RSHIFT(ti, 1); \ + ti += tc; \ + td += OD_DCT_RSHIFT(tj, 1); \ + tj -= td; \ + \ + t4 = -t4; \ + \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.8206787908286602 */ \ + OD_DCT_OVERFLOW_CHECK(tr, 6723, 4096, 304); \ + t4 += (tr*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.9807852804032304 */ \ + OD_DCT_OVERFLOW_CHECK(t4, 16069, 8192, 305); \ + tr -= (t4*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.8206787908286602 */ \ + OD_DCT_OVERFLOW_CHECK(tr, 6723, 4096, 306); \ + t4 += (tr*6723 + 4096) >> 13; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.5345111359507916 */ \ + OD_DCT_OVERFLOW_CHECK(tq, 17515, 16384, 307); \ + t5 += (tq*17515 + 16384) >> 15; \ + /* 13623/16384 ~= Sin[5*Pi/16] ~= 0.8314696123025452 */ \ + OD_DCT_OVERFLOW_CHECK(t5, 13623, 8192, 308); \ + tq -= (t5*13623 + 8192) >> 14; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.5345111359507916 */ \ + OD_DCT_OVERFLOW_CHECK(tq, 17515, 16384, 309); \ + t5 += (tq*17515 + 16384) >> 15; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + OD_DCT_OVERFLOW_CHECK(to, 3227, 16384, 310); \ + t7 += (to*3227 + 16384) >> 15; \ + /* 6393/32768 ~= Sin[Pi/16] ~= 0.19509032201612825 */ \ + OD_DCT_OVERFLOW_CHECK(t7, 6393, 16384, 311); \ + to -= (t7*6393 + 16384) >> 15; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + OD_DCT_OVERFLOW_CHECK(to, 3227, 16384, 312); \ + t7 += (to*3227 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(tp, 2485, 4096, 313); \ + t6 += (tp*2485 + 4096) >> 13; \ + /* 18205/32768 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + OD_DCT_OVERFLOW_CHECK(t6, 18205, 16384, 314); \ + tp -= (t6*18205 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + OD_DCT_OVERFLOW_CHECK(tp, 2485, 4096, 315); \ + t6 += (tp*2485 + 4096) >> 13; \ + \ + t5 = -t5; \ + \ + tr += to; \ + trh = OD_DCT_RSHIFT(tr, 1); \ + to -= trh; \ + t4 += t7; \ + t4h = OD_DCT_RSHIFT(t4, 1); \ + t7 -= t4h; \ + t5 += tp; \ + t5h = OD_DCT_RSHIFT(t5, 1); \ + tp -= t5h; \ + tq += t6; \ + tqh = OD_DCT_RSHIFT(tq, 1); \ + t6 -= tqh; \ + t0 -= t3; \ + t0h = OD_DCT_RSHIFT(t0, 1); \ + t3 += t0h; \ + tv -= ts; \ + tvh = OD_DCT_RSHIFT(tv, 1); \ + ts += tvh; \ + tu += tt; \ + tuh = OD_DCT_RSHIFT(tu, 1); \ + tt -= tuh; \ + t1 -= t2; \ + t1h = OD_DCT_RSHIFT(t1, 1); \ + t2 += t1h; \ + t8 += tb; \ + tb -= OD_DCT_RSHIFT(t8, 1); \ + tn += tk; \ + tk -= OD_DCT_RSHIFT(tn, 1); \ + t9 += tl; \ + tl -= OD_DCT_RSHIFT(t9, 1); \ + tm -= ta; \ + ta += OD_DCT_RSHIFT(tm, 1); \ + tc -= tf; \ + tf += OD_DCT_RSHIFT(tc, 1); \ + tj += tg; \ + tg -= OD_DCT_RSHIFT(tj, 1); \ + td -= te; \ + te += OD_DCT_RSHIFT(td, 1); \ + ti += th; \ + th -= OD_DCT_RSHIFT(ti, 1); \ + \ + t9 = -t9; \ + tl = -tl; \ + \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + OD_DCT_OVERFLOW_CHECK(tn, 805, 8192, 316); \ + t8 += (tn*805 + 8192) >> 14; \ + /* 803/8192 ~= Sin[Pi/32] ~= 0.0980171403295606 */ \ + OD_DCT_OVERFLOW_CHECK(t8, 803, 4096, 317); \ + tn -= (t8*803 + 4096) >> 13; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + OD_DCT_OVERFLOW_CHECK(tn, 805, 8192, 318); \ + t8 += (tn*805 + 8192) >> 14; \ + /* 11725/32768 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 11725, 16384, 319); \ + tk += (tb*11725 + 16384) >> 15; \ + /* 5197/8192 ~= Sin[7*Pi/32] ~= 0.6343932841636455 */ \ + OD_DCT_OVERFLOW_CHECK(tk, 5197, 4096, 320); \ + tb -= (tk*5197 + 4096) >> 13; \ + /* 11725/32768 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + OD_DCT_OVERFLOW_CHECK(tb, 11725, 16384, 321); \ + tk += (tb*11725 + 16384) >> 15; \ + /* 2455/4096 ~= Tan[11*Pi/64] ~= 0.5993769336819237 */ \ + OD_DCT_OVERFLOW_CHECK(tl, 2455, 2048, 322); \ + ta += (tl*2455 + 2048) >> 12; \ + /* 14449/16384 ~= Sin[11*Pi/32] ~= 0.881921264348355 */ \ + OD_DCT_OVERFLOW_CHECK(ta, 14449, 8192, 323); \ + tl -= (ta*14449 + 8192) >> 14; \ + /* 2455/4096 ~= Tan[11*Pi/64] ~= 0.5993769336819237 */ \ + OD_DCT_OVERFLOW_CHECK(tl, 2455, 2048, 324); \ + ta += (tl*2455 + 2048) >> 12; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + OD_DCT_OVERFLOW_CHECK(tm, 4861, 16384, 325); \ + t9 += (tm*4861 + 16384) >> 15; \ + /* 1189/4096 ~= Sin[3*Pi/32] ~= 0.29028467725446233 */ \ + OD_DCT_OVERFLOW_CHECK(t9, 1189, 2048, 326); \ + tm -= (t9*1189 + 2048) >> 12; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + OD_DCT_OVERFLOW_CHECK(tm, 4861, 16384, 327); \ + t9 += (tm*4861 + 16384) >> 15; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + OD_DCT_OVERFLOW_CHECK(tg, 805, 8192, 328); \ + tf += (tg*805 + 8192) >> 14; \ + /* 803/8192 ~= Sin[Pi/32] ~= 0.0980171403295606 */ \ + OD_DCT_OVERFLOW_CHECK(tf, 803, 4096, 329); \ + tg -= (tf*803 + 4096) >> 13; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + OD_DCT_OVERFLOW_CHECK(tg, 805, 8192, 330); \ + tf += (tg*805 + 8192) >> 14; \ + /* 2931/8192 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + OD_DCT_OVERFLOW_CHECK(tj, 2931, 4096, 331); \ + tc += (tj*2931 + 4096) >> 13; \ + /* 5197/8192 ~= Sin[7*Pi/32] ~= 0.6343932841636455 */ \ + OD_DCT_OVERFLOW_CHECK(tc, 5197, 4096, 332); \ + tj -= (tc*5197 + 4096) >> 13; \ + /* 2931/8192 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + OD_DCT_OVERFLOW_CHECK(tj, 2931, 4096, 333); \ + tc += (tj*2931 + 4096) >> 13; \ + /* 513/2048 ~= Tan[5*Pi/64] ~= 0.25048696019130545 */ \ + OD_DCT_OVERFLOW_CHECK(ti, 513, 1024, 334); \ + td += (ti*513 + 1024) >> 11; \ + /* 7723/16384 ~= Sin[5*Pi/32] ~= 0.47139673682599764 */ \ + OD_DCT_OVERFLOW_CHECK(td, 7723, 8192, 335); \ + ti -= (td*7723 + 8192) >> 14; \ + /* 513/2048 ~= Tan[5*Pi/64] ~= 0.25048696019130545 */ \ + OD_DCT_OVERFLOW_CHECK(ti, 513, 1024, 336); \ + td += (ti*513 + 1024) >> 11; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + OD_DCT_OVERFLOW_CHECK(th, 4861, 16384, 337); \ + te += (th*4861 + 16384) >> 15; \ + /* 1189/4096 ~= Sin[3*Pi/32] ~= 0.29028467725446233 */ \ + OD_DCT_OVERFLOW_CHECK(te, 1189, 2048, 338); \ + th -= (te*1189 + 2048) >> 12; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + OD_DCT_OVERFLOW_CHECK(th, 4861, 16384, 339); \ + te += (th*4861 + 16384) >> 15; \ + \ + ta = -ta; \ + tb = -tb; \ + \ + tt += t5h; \ + t5 -= tt; \ + t2 -= tqh; \ + tq += t2; \ + tp += t1h; \ + t1 -= tp; \ + t6 -= tuh; \ + tu += t6; \ + t7 += tvh; \ + tv -= t7; \ + to += t0h; \ + t0 -= to; \ + t3 -= t4h; \ + t4 += t3; \ + ts += trh; \ + tr -= ts; \ + tf -= OD_DCT_RSHIFT(tn, 1); \ + tn += tf; \ + tg -= OD_DCT_RSHIFT(t8, 1); \ + t8 += tg; \ + tk += OD_DCT_RSHIFT(tc, 1); \ + tc -= tk; \ + tb += OD_DCT_RSHIFT(tj, 1); \ + tj -= tb; \ + ta += OD_DCT_RSHIFT(ti, 1); \ + ti -= ta; \ + tl += OD_DCT_RSHIFT(td, 1); \ + td -= tl; \ + te -= OD_DCT_RSHIFT(tm, 1); \ + tm += te; \ + th -= OD_DCT_RSHIFT(t9, 1); \ + t9 += th; \ + ta -= t5; \ + t5 += OD_DCT_RSHIFT(ta, 1); \ + tq -= tl; \ + tl += OD_DCT_RSHIFT(tq, 1); \ + t2 -= ti; \ + ti += OD_DCT_RSHIFT(t2, 1); \ + td -= tt; \ + tt += OD_DCT_RSHIFT(td, 1); \ + tm += tp; \ + tp -= OD_DCT_RSHIFT(tm, 1); \ + t6 += t9; \ + t9 -= OD_DCT_RSHIFT(t6, 1); \ + te -= tu; \ + tu += OD_DCT_RSHIFT(te, 1); \ + t1 -= th; \ + th += OD_DCT_RSHIFT(t1, 1); \ + t0 -= tg; \ + tg += OD_DCT_RSHIFT(t0, 1); \ + tf += tv; \ + tv -= OD_DCT_RSHIFT(tf, 1); \ + t8 -= t7; \ + t7 += OD_DCT_RSHIFT(t8, 1); \ + to -= tn; \ + tn += OD_DCT_RSHIFT(to, 1); \ + t4 -= tk; \ + tk += OD_DCT_RSHIFT(t4, 1); \ + tb -= tr; \ + tr += OD_DCT_RSHIFT(tb, 1); \ + t3 -= tj; \ + tj += OD_DCT_RSHIFT(t3, 1); \ + tc -= ts; \ + ts += OD_DCT_RSHIFT(tc, 1); \ + \ + tr = -tr; \ + ts = -ts; \ + tt = -tt; \ + tu = -tu; \ + \ + /* 2847/4096 ~= (1/Sqrt[2] - Cos[63*Pi/128]/2)/Sin[63*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t0, 2847, 2048, 340); \ + tv += (t0*2847 + 2048) >> 12; \ + /* 5791/4096 ~= Sqrt[2]*Sin[63*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tv, 5791, 2048, 341); \ + t0 -= (tv*5791 + 2048) >> 12; \ + /* 5593/8192 ~= (1/Sqrt[2] - Cos[63*Pi/128])/Sin[63*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t0, 5593, 4096, 342); \ + tv += (t0*5593 + 4096) >> 13; \ + /* 4099/8192 ~= (1/Sqrt[2] - Cos[31*Pi/128]/2)/Sin[31*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tf, 4099, 4096, 343); \ + tg -= (tf*4099 + 4096) >> 13; \ + /* 1997/2048 ~= Sqrt[2]*Sin[31*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tg, 1997, 1024, 344); \ + tf += (tg*1997 + 1024) >> 11; \ + /* -815/32768 ~= (1/Sqrt[2] - Cos[31*Pi/128])/Sin[31*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tf, 815, 16384, 345); \ + tg += (tf*815 + 16384) >> 15; \ + /* 2527/4096 ~= (1/Sqrt[2] - Cos[17*Pi/128]/2)/Sin[17*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t8, 2527, 2048, 346); \ + tn -= (t8*2527 + 2048) >> 12; \ + /* 4695/8192 ~= Sqrt[2]*Sin[17*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tn, 4695, 4096, 347); \ + t8 += (tn*4695 + 4096) >> 13; \ + /* -4187/8192 ~= (1/Sqrt[2] - Cos[17*Pi/128])/Sin[17*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t8, 4187, 4096, 348); \ + tn += (t8*4187 + 4096) >> 13; \ + /* 5477/8192 ~= (1/Sqrt[2] - Cos[15*Pi/128]/2)/Sin[15*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(to, 5477, 4096, 349); \ + t7 += (to*5477 + 4096) >> 13; \ + /* 4169/8192 ~= Sqrt[2]*Sin[15*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t7, 4169, 4096, 350); \ + to -= (t7*4169 + 4096) >> 13; \ + /* -2571/4096 ~= (1/Sqrt[2] - Cos[15*Pi/128])/Sin[15*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(to, 2571, 2048, 351); \ + t7 -= (to*2571 + 2048) >> 12; \ + /* 5331/8192 ~= (1/Sqrt[2] - Cos[59*Pi/128]/2)/Sin[59*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t2, 5331, 4096, 352); \ + tt += (t2*5331 + 4096) >> 13; \ + /* 5749/4096 ~= Sqrt[2]*Sin[59*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tt, 5749, 2048, 353); \ + t2 -= (tt*5749 + 2048) >> 12; \ + /* 2413/4096 ~= (1/Sqrt[2] - Cos[59*Pi/128])/Sin[59*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t2, 2413, 2048, 354); \ + tt += (t2*2413 + 2048) >> 12; \ + /* 4167/8192 ~= (1/Sqrt[2] - Cos[27*Pi/128]/2)/Sin[27*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(td, 4167, 4096, 355); \ + ti -= (td*4167 + 4096) >> 13; \ + /* 891/1024 ~= Sqrt[2]*Sin[27*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(ti, 891, 512, 356); \ + td += (ti*891 + 512) >> 10; \ + /* -4327/32768 ~= (1/Sqrt[2] - Cos[27*Pi/128])/Sin[27*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(td, 4327, 16384, 357); \ + ti += (td*4327 + 16384) >> 15; \ + /* 2261/4096 ~= (1/Sqrt[2] - Cos[21*Pi/128]/2)/Sin[21*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(ta, 2261, 2048, 358); \ + tl -= (ta*2261 + 2048) >> 12; \ + /* 2855/4096 ~= Sqrt[2]*Sin[21*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tl, 2855, 2048, 359); \ + ta += (tl*2855 + 2048) >> 12; \ + /* -5417/16384 ~= (1/Sqrt[2] - Cos[21*Pi/128])/Sin[21*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(ta, 5417, 8192, 360); \ + tl += (ta*5417 + 8192) >> 14; \ + /* 3459/4096 ~= (1/Sqrt[2] - Cos[11*Pi/128]/2)/Sin[11*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tq, 3459, 2048, 361); \ + t5 += (tq*3459 + 2048) >> 12; \ + /* 1545/4096 ~= Sqrt[2]*Sin[11*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t5, 1545, 2048, 362); \ + tq -= (t5*1545 + 2048) >> 12; \ + /* -1971/2048 ~= (1/Sqrt[2] - Cos[11*Pi/128])/Sin[11*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tq, 1971, 1024, 363); \ + t5 -= (tq*1971 + 1024) >> 11; \ + /* 323/512 ~= (1/Sqrt[2] - Cos[57*Pi/128]/2)/Sin[57*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t3, 323, 256, 364); \ + ts += (t3*323 + 256) >> 9; \ + /* 5707/4096 ~= Sqrt[2]*Sin[57*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(ts, 5707, 2048, 365); \ + t3 -= (ts*5707 + 2048) >> 12; \ + /* 2229/4096 ~= (1/Sqrt[2] - Cos[57*Pi/128])/Sin[57*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t3, 2229, 2048, 366); \ + ts += (t3*2229 + 2048) >> 12; \ + /* 1061/2048 ~= (1/Sqrt[2] - Cos[25*Pi/128]/2)/Sin[25*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tc, 1061, 1024, 367); \ + tj -= (tc*1061 + 1024) >> 11; \ + /* 6671/8192 ~= Sqrt[2]*Sin[25*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tj, 6671, 4096, 368); \ + tc += (tj*6671 + 4096) >> 13; \ + /* -6287/32768 ~= (1/Sqrt[2] - Cos[25*Pi/128])/Sin[25*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tc, 6287, 16384, 369); \ + tj += (tc*6287 + 16384) >> 15; \ + /* 4359/8192 ~= (1/Sqrt[2] - Cos[23*Pi/128]/2)/Sin[23*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tb, 4359, 4096, 370); \ + tk -= (tb*4359 + 4096) >> 13; \ + /* 3099/4096 ~= Sqrt[2]*Sin[23*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tk, 3099, 2048, 371); \ + tb += (tk*3099 + 2048) >> 12; \ + /* -2109/8192 ~= (1/Sqrt[2] - Cos[23*Pi/128])/Sin[23*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tb, 2109, 4096, 372); \ + tk += (tb*2109 + 4096) >> 13; \ + /* 5017/8192 ~= (1/Sqrt[2] - Cos[55*Pi/128]/2)/Sin[55*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t4, 5017, 4096, 373); \ + tr += (t4*5017 + 4096) >> 13; \ + /* 1413/1024 ~= Sqrt[2]*Sin[55*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tr, 1413, 512, 374); \ + t4 -= (tr*1413 + 512) >> 10; \ + /* 8195/16384 ~= (1/Sqrt[2] - Cos[55*Pi/128])/Sin[55*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t4, 8195, 8192, 375); \ + tr += (t4*8195 + 8192) >> 14; \ + /* 2373/4096 ~= (1/Sqrt[2] - Cos[19*Pi/128]/2)/Sin[19*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tm, 2373, 2048, 376); \ + t9 += (tm*2373 + 2048) >> 12; \ + /* 5209/8192 ~= Sqrt[2]*Sin[19*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t9, 5209, 4096, 377); \ + tm -= (t9*5209 + 4096) >> 13; \ + /* -3391/8192 ~= (1/Sqrt[2] - Cos[19*Pi/128])/Sin[19*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tm, 3391, 4096, 378); \ + t9 -= (tm*3391 + 4096) >> 13; \ + /* 1517/2048 ~= (1/Sqrt[2] - Cos[13*Pi/128]/2)/Sin[13*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t6, 1517, 1024, 379); \ + tp -= (t6*1517 + 1024) >> 11; \ + /* 1817/4096 ~= Sqrt[2]*Sin[13*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tp, 1817, 2048, 380); \ + t6 += (tp*1817 + 2048) >> 12; \ + /* -6331/8192 ~= (1/Sqrt[2] - Cos[13*Pi/128])/Sin[13*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t6, 6331, 4096, 381); \ + tp += (t6*6331 + 4096) >> 13; \ + /* 515/1024 ~= (1/Sqrt[2] - Cos[29*Pi/128]/2)/Sin[29*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(te, 515, 512, 382); \ + th -= (te*515 + 512) >> 10; \ + /* 7567/8192 ~= Sqrt[2]*Sin[29*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(th, 7567, 4096, 383); \ + te += (th*7567 + 4096) >> 13; \ + /* -2513/32768 ~= (1/Sqrt[2] - Cos[29*Pi/128])/Sin[29*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(te, 2513, 16384, 384); \ + th += (te*2513 + 16384) >> 15; \ + /* 2753/4096 ~= (1/Sqrt[2] - Cos[61*Pi/128]/2)/Sin[61*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t1, 2753, 2048, 385); \ + tu += (t1*2753 + 2048) >> 12; \ + /* 5777/4096 ~= Sqrt[2]*Sin[61*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(tu, 5777, 2048, 386); \ + t1 -= (tu*5777 + 2048) >> 12; \ + /* 1301/2048 ~= (1/Sqrt[2] - Cos[61*Pi/128])/Sin[61*Pi/128] */ \ + OD_DCT_OVERFLOW_CHECK(t1, 1301, 1024, 387); \ + tu += (t1*1301 + 1024) >> 11; \ + } \ + while (0) + +#define OD_IDST_32_ASYM(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, \ + tm, te, tu, t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv) \ + /* Embedded 32-point asymmetric Type-IV iDST. */ \ + do { \ + int t0h; \ + int t4h; \ + int tbh; \ + int tfh; \ + int tgh; \ + int tkh; \ + int trh; \ + int tvh; \ + /* 1301/2048 ~= (1/Sqrt[2] - Cos[61*Pi/128])/Sin[61*Pi/128] */ \ + tf -= (tg*1301 + 1024) >> 11; \ + /* 5777/4096 ~= Sqrt[2]*Sin[61*Pi/128] */ \ + tg += (tf*5777 + 2048) >> 12; \ + /* 2753/4096 ~= (1/Sqrt[2] - Cos[61*Pi/128]/2)/Sin[61*Pi/128] */ \ + tf -= (tg*2753 + 2048) >> 12; \ + /* -2513/32768 ~= (1/Sqrt[2] - Cos[29*Pi/128])/Sin[29*Pi/128] */ \ + th -= (te*2513 + 16384) >> 15; \ + /* 7567/8192 ~= Sqrt[2]*Sin[29*Pi/128] */ \ + te -= (th*7567 + 4096) >> 13; \ + /* 515/1024 ~= (1/Sqrt[2] - Cos[29*Pi/128]/2)/Sin[29*Pi/128] */ \ + th += (te*515 + 512) >> 10; \ + /* -6331/8192 ~= (1/Sqrt[2] - Cos[13*Pi/128])/Sin[13*Pi/128] */ \ + tj -= (tc*6331 + 4096) >> 13; \ + /* 1817/4096 ~= Sqrt[2]*Sin[13*Pi/128] */ \ + tc -= (tj*1817 + 2048) >> 12; \ + /* 1517/2048 ~= (1/Sqrt[2] - Cos[13*Pi/128]/2)/Sin[13*Pi/128] */ \ + tj += (tc*1517 + 1024) >> 11; \ + /* -3391/8192 ~= (1/Sqrt[2] - Cos[19*Pi/128])/Sin[19*Pi/128] */ \ + ti += (td*3391 + 4096) >> 13; \ + /* 5209/8192 ~= Sqrt[2]*Sin[19*Pi/128] */ \ + td += (ti*5209 + 4096) >> 13; \ + /* 2373/4096 ~= (1/Sqrt[2] - Cos[19*Pi/128]/2)/Sin[19*Pi/128] */ \ + ti -= (td*2373 + 2048) >> 12; \ + /* 8195/16384 ~= (1/Sqrt[2] - Cos[55*Pi/128])/Sin[55*Pi/128] */ \ + tr -= (t4*8195 + 8192) >> 14; \ + /* 1413/1024 ~= Sqrt[2]*Sin[55*Pi/128] */ \ + t4 += (tr*1413 + 512) >> 10; \ + /* 5017/8192 ~= (1/Sqrt[2] - Cos[55*Pi/128]/2)/Sin[55*Pi/128] */ \ + tr -= (t4*5017 + 4096) >> 13; \ + /* -2109/8192 ~= (1/Sqrt[2] - Cos[23*Pi/128])/Sin[23*Pi/128] */ \ + t5 -= (tq*2109 + 4096) >> 13; \ + /* 3099/4096 ~= Sqrt[2]*Sin[23*Pi/128] */ \ + tq -= (t5*3099 + 2048) >> 12; \ + /* 4359/8192 ~= (1/Sqrt[2] - Cos[23*Pi/128]/2)/Sin[23*Pi/128] */ \ + t5 += (tq*4359 + 4096) >> 13; \ + /* -6287/32768 ~= (1/Sqrt[2] - Cos[25*Pi/128])/Sin[25*Pi/128] */ \ + tp -= (t6*6287 + 16384) >> 15; \ + /* 6671/8192 ~= Sqrt[2]*Sin[25*Pi/128] */ \ + t6 -= (tp*6671 + 4096) >> 13; \ + /* 1061/2048 ~= (1/Sqrt[2] - Cos[25*Pi/128]/2)/Sin[25*Pi/128] */ \ + tp += (t6*1061 + 1024) >> 11; \ + /* 2229/4096 ~= (1/Sqrt[2] - Cos[57*Pi/128])/Sin[57*Pi/128] */ \ + t7 -= (to*2229 + 2048) >> 12; \ + /* 5707/4096 ~= Sqrt[2]*Sin[57*Pi/128] */ \ + to += (t7*5707 + 2048) >> 12; \ + /* 323/512 ~= (1/Sqrt[2] - Cos[57*Pi/128]/2)/Sin[57*Pi/128] */ \ + t7 -= (to*323 + 256) >> 9; \ + /* -1971/2048 ~= (1/Sqrt[2] - Cos[11*Pi/128])/Sin[11*Pi/128] */ \ + tk += (tb*1971 + 1024) >> 11; \ + /* 1545/4096 ~= Sqrt[2]*Sin[11*Pi/128] */ \ + tb += (tk*1545 + 2048) >> 12; \ + /* 3459/4096 ~= (1/Sqrt[2] - Cos[11*Pi/128]/2)/Sin[11*Pi/128] */ \ + tk -= (tb*3459 + 2048) >> 12; \ + /* -5417/16384 ~= (1/Sqrt[2] - Cos[21*Pi/128])/Sin[21*Pi/128] */ \ + tl -= (ta*5417 + 8192) >> 14; \ + /* 2855/4096 ~= Sqrt[2]*Sin[21*Pi/128] */ \ + ta -= (tl*2855 + 2048) >> 12; \ + /* 2261/4096 ~= (1/Sqrt[2] - Cos[21*Pi/128]/2)/Sin[21*Pi/128] */ \ + tl += (ta*2261 + 2048) >> 12; \ + /* -4327/32768 ~= (1/Sqrt[2] - Cos[27*Pi/128])/Sin[27*Pi/128] */ \ + t9 -= (tm*4327 + 16384) >> 15; \ + /* 891/1024 ~= Sqrt[2]*Sin[27*Pi/128] */ \ + tm -= (t9*891 + 512) >> 10; \ + /* 4167/8192 ~= (1/Sqrt[2] - Cos[27*Pi/128]/2)/Sin[27*Pi/128] */ \ + t9 += (tm*4167 + 4096) >> 13; \ + /* 2413/4096 ~= (1/Sqrt[2] - Cos[59*Pi/128])/Sin[59*Pi/128] */ \ + tn -= (t8*2413 + 2048) >> 12; \ + /* 5749/4096 ~= Sqrt[2]*Sin[59*Pi/128] */ \ + t8 += (tn*5749 + 2048) >> 12; \ + /* 5331/8192 ~= (1/Sqrt[2] - Cos[59*Pi/128]/2)/Sin[59*Pi/128] */ \ + tn -= (t8*5331 + 4096) >> 13; \ + /* -2571/4096 ~= (1/Sqrt[2] - Cos[15*Pi/128])/Sin[15*Pi/128] */ \ + ts += (t3*2571 + 2048) >> 12; \ + /* 4169/8192 ~= Sqrt[2]*Sin[15*Pi/128] */ \ + t3 += (ts*4169 + 4096) >> 13; \ + /* 5477/8192 ~= (1/Sqrt[2] - Cos[15*Pi/128]/2)/Sin[15*Pi/128] */ \ + ts -= (t3*5477 + 4096) >> 13; \ + /* -4187/8192 ~= (1/Sqrt[2] - Cos[17*Pi/128])/Sin[17*Pi/128] */ \ + tt -= (t2*4187 + 4096) >> 13; \ + /* 4695/8192 ~= Sqrt[2]*Sin[17*Pi/128] */ \ + t2 -= (tt*4695 + 4096) >> 13; \ + /* 2527/4096 ~= (1/Sqrt[2] - Cos[17*Pi/128]/2)/Sin[17*Pi/128] */ \ + tt += (t2*2527 + 2048) >> 12; \ + /* -815/32768 ~= (1/Sqrt[2] - Cos[31*Pi/128])/Sin[31*Pi/128] */ \ + t1 -= (tu*815 + 16384) >> 15; \ + /* 1997/2048 ~= Sqrt[2]*Sin[31*Pi/128] */ \ + tu -= (t1*1997 + 1024) >> 11; \ + /* 4099/8192 ~= (1/Sqrt[2] - Cos[31*Pi/128]/2)/Sin[31*Pi/128] */ \ + t1 += (tu*4099 + 4096) >> 13; \ + /* 5593/8192 ~= (1/Sqrt[2] - Cos[63*Pi/128])/Sin[63*Pi/128] */ \ + tv -= (t0*5593 + 4096) >> 13; \ + /* 5791/4096 ~= Sqrt[2]*Sin[63*Pi/128] */ \ + t0 += (tv*5791 + 2048) >> 12; \ + /* 2847/4096 ~= (1/Sqrt[2] - Cos[63*Pi/128]/2)/Sin[63*Pi/128] */ \ + tv -= (t0*2847 + 2048) >> 12; \ + \ + t7 = -t7; \ + tf = -tf; \ + tn = -tn; \ + tr = -tr; \ + \ + t7 -= OD_DCT_RSHIFT(t6, 1); \ + t6 += t7; \ + tp -= OD_DCT_RSHIFT(to, 1); \ + to += tp; \ + tr -= OD_DCT_RSHIFT(tq, 1); \ + tq += tr; \ + t5 -= OD_DCT_RSHIFT(t4, 1); \ + t4 += t5; \ + tt -= OD_DCT_RSHIFT(t3, 1); \ + t3 += tt; \ + ts -= OD_DCT_RSHIFT(t2, 1); \ + t2 += ts; \ + tv += OD_DCT_RSHIFT(tu, 1); \ + tu -= tv; \ + t1 -= OD_DCT_RSHIFT(t0, 1); \ + t0 += t1; \ + th -= OD_DCT_RSHIFT(tg, 1); \ + tg += th; \ + tf -= OD_DCT_RSHIFT(te, 1); \ + te += tf; \ + ti += OD_DCT_RSHIFT(tc, 1); \ + tc -= ti; \ + tj += OD_DCT_RSHIFT(td, 1); \ + td -= tj; \ + tn -= OD_DCT_RSHIFT(tm, 1); \ + tm += tn; \ + t9 -= OD_DCT_RSHIFT(t8, 1); \ + t8 += t9; \ + tl -= OD_DCT_RSHIFT(tb, 1); \ + tb += tl; \ + tk -= OD_DCT_RSHIFT(ta, 1); \ + ta += tk; \ + \ + ti -= th; \ + th += OD_DCT_RSHIFT(ti, 1); \ + td -= te; \ + te += OD_DCT_RSHIFT(td, 1); \ + tm += tl; \ + tl -= OD_DCT_RSHIFT(tm, 1); \ + t9 += ta; \ + ta -= OD_DCT_RSHIFT(t9, 1); \ + tp += tq; \ + tq -= OD_DCT_RSHIFT(tp, 1); \ + t6 += t5; \ + t5 -= OD_DCT_RSHIFT(t6, 1); \ + t2 -= t1; \ + t1 += OD_DCT_RSHIFT(t2, 1); \ + tt -= tu; \ + tu += OD_DCT_RSHIFT(tt, 1); \ + tr += t7; \ + trh = OD_DCT_RSHIFT(tr, 1); \ + t7 -= trh; \ + t4 -= to; \ + t4h = OD_DCT_RSHIFT(t4, 1); \ + to += t4h; \ + t0 += t3; \ + t0h = OD_DCT_RSHIFT(t0, 1); \ + t3 -= t0h; \ + tv += ts; \ + tvh = OD_DCT_RSHIFT(tv, 1); \ + ts -= tvh; \ + tf -= tc; \ + tfh = OD_DCT_RSHIFT(tf, 1); \ + tc += tfh; \ + tg += tj; \ + tgh = OD_DCT_RSHIFT(tg, 1); \ + tj -= tgh; \ + tb -= t8; \ + tbh = OD_DCT_RSHIFT(tb, 1); \ + t8 += tbh; \ + tk += tn; \ + tkh = OD_DCT_RSHIFT(tk, 1); \ + tn -= tkh; \ + \ + ta = -ta; \ + tq = -tq; \ + \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + te -= (th*4861 + 16384) >> 15; \ + /* 1189/4096 ~= Sin[3*Pi/32] ~= 0.29028467725446233 */ \ + th += (te*1189 + 2048) >> 12; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + te -= (th*4861 + 16384) >> 15; \ + /* 513/2048 ~= Tan[5*Pi/64] ~= 0.25048696019130545 */ \ + tm -= (t9*513 + 1024) >> 11; \ + /* 7723/16384 ~= Sin[5*Pi/32] ~= 0.47139673682599764 */ \ + t9 += (tm*7723 + 8192) >> 14; \ + /* 513/2048 ~= Tan[5*Pi/64] ~= 0.25048696019130545 */ \ + tm -= (t9*513 + 1024) >> 11; \ + /* 2931/8192 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + t6 -= (tp*2931 + 4096) >> 13; \ + /* 5197/8192 ~= Sin[7*Pi/32] ~= 0.6343932841636455 */ \ + tp += (t6*5197 + 4096) >> 13; \ + /* 2931/8192 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + t6 -= (tp*2931 + 4096) >> 13; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + tu -= (t1*805 + 8192) >> 14; \ + /* 803/8192 ~= Sin[Pi/32] ~= 0.0980171403295606 */ \ + t1 += (tu*803 + 4096) >> 13; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + tu -= (t1*805 + 8192) >> 14; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + ti -= (td*4861 + 16384) >> 15; \ + /* 1189/4096 ~= Sin[3*Pi/32] ~= 0.29028467725446233 */ \ + td += (ti*1189 + 2048) >> 12; \ + /* 4861/32768 ~= Tan[3*Pi/64] ~= 0.14833598753834742 */ \ + ti -= (td*4861 + 16384) >> 15; \ + /* 2455/4096 ~= Tan[11*Pi/64] ~= 0.5993769336819237 */ \ + ta -= (tl*2455 + 2048) >> 12; \ + /* 14449/16384 ~= Sin[11*Pi/32] ~= 0.881921264348355 */ \ + tl += (ta*14449 + 8192) >> 14; \ + /* 2455/4096 ~= Tan[11*Pi/64] ~= 0.5993769336819237 */ \ + ta -= (tl*2455 + 2048) >> 12; \ + /* 11725/32768 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + t5 -= (tq*11725 + 16384) >> 15; \ + /* 5197/8192 ~= Sin[7*Pi/32] ~= 0.6343932841636455 */ \ + tq += (t5*5197 + 4096) >> 13; \ + /* 11725/32768 ~= Tan[7*Pi/64] ~= 0.3578057213145241 */ \ + t5 -= (tq*11725 + 16384) >> 15; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + t2 -= (tt*805 + 8192) >> 14; \ + /* 803/8192 ~= Sin[Pi/32] ~= 0.0980171403295606 */ \ + tt += (t2*803 + 4096) >> 13; \ + /* 805/16384 ~= Tan[Pi/64] ~= 0.04912684976946793 */ \ + t2 -= (tt*805 + 8192) >> 14; \ + \ + tl = -tl; \ + ti = -ti; \ + \ + th += OD_DCT_RSHIFT(t9, 1); \ + t9 -= th; \ + te -= OD_DCT_RSHIFT(tm, 1); \ + tm += te; \ + t1 += OD_DCT_RSHIFT(tp, 1); \ + tp -= t1; \ + tu -= OD_DCT_RSHIFT(t6, 1); \ + t6 += tu; \ + ta -= OD_DCT_RSHIFT(td, 1); \ + td += ta; \ + tl += OD_DCT_RSHIFT(ti, 1); \ + ti -= tl; \ + t5 += OD_DCT_RSHIFT(tt, 1); \ + tt -= t5; \ + tq += OD_DCT_RSHIFT(t2, 1); \ + t2 -= tq; \ + \ + t8 -= tgh; \ + tg += t8; \ + tn += tfh; \ + tf -= tn; \ + t7 -= tvh; \ + tv += t7; \ + to -= t0h; \ + t0 += to; \ + tc += tbh; \ + tb -= tc; \ + tj += tkh; \ + tk -= tj; \ + ts += t4h; \ + t4 -= ts; \ + t3 += trh; \ + tr -= t3; \ + \ + tk = -tk; \ + \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + tc -= (tj*2485 + 4096) >> 13; \ + /* 18205/32768 ~= Sin[3*Pi/16] ~= 0.555570233019602 */ \ + tj += (tc*18205 + 16384) >> 15; \ + /* 2485/8192 ~= Tan[3*Pi/32] ~= 0.303346683607342 */ \ + tc -= (tj*2485 + 4096) >> 13; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + ts -= (t3*3227 + 16384) >> 15; \ + /* 6393/32768 ~= Sin[Pi/16] ~= 0.19509032201612825 */ \ + t3 += (ts*6393 + 16384) >> 15; \ + /* 3227/32768 ~= Tan[Pi/32] ~= 0.09849140335716425 */ \ + ts -= (t3*3227 + 16384) >> 15; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.5345111359507916 */ \ + tk -= (tb*17515 + 16384) >> 15; \ + /* 13623/16384 ~= Sin[5*Pi/16] ~= 0.8314696123025452 */ \ + tb += (tk*13623 + 8192) >> 14; \ + /* 17515/32768 ~= Tan[5*Pi/32] ~= 0.5345111359507916 */ \ + tk -= (tb*17515 + 16384) >> 15; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.8206787908286602 */ \ + t4 -= (tr*6723 + 4096) >> 13; \ + /* 16069/16384 ~= Sin[7*Pi/16] ~= 0.9807852804032304 */ \ + tr += (t4*16069 + 8192) >> 14; \ + /* 6723/8192 ~= Tan[7*Pi/32] ~= 0.8206787908286602 */ \ + t4 -= (tr*6723 + 4096) >> 13; \ + \ + t4 = -t4; \ + \ + tp += tm; \ + tm -= OD_DCT_RSHIFT(tp, 1); \ + t9 -= t6; \ + t6 += OD_DCT_RSHIFT(t9, 1); \ + th -= t1; \ + t1 += OD_DCT_RSHIFT(th, 1); \ + tu -= te; \ + te += OD_DCT_RSHIFT(tu, 1); /* pass */ \ + t5 -= tl; \ + tl += OD_DCT_RSHIFT(t5, 1); \ + ta += tq; \ + tq -= OD_DCT_RSHIFT(ta, 1); \ + td += tt; \ + tt -= OD_DCT_RSHIFT(td, 1); \ + t2 -= ti; \ + ti += OD_DCT_RSHIFT(t2, 1); /* pass */ \ + t7 += t8; \ + t8 -= OD_DCT_RSHIFT(t7, 1); \ + tn -= to; \ + to += OD_DCT_RSHIFT(tn, 1); \ + tf -= tv; \ + tv += OD_DCT_RSHIFT(tf, 1); \ + t0 += tg; \ + tg -= OD_DCT_RSHIFT(t0, 1); /* pass */ \ + tj -= t3; \ + t3 += OD_DCT_RSHIFT(tj, 1); /* pass */ \ + ts -= tc; \ + tc += OD_DCT_RSHIFT(ts, 1); \ + t4 -= tb; \ + tb += OD_DCT_RSHIFT(t4, 1); /* pass */ \ + tk -= tr; \ + tr += OD_DCT_RSHIFT(tk, 1); \ + \ + t1 = -t1; \ + t3 = -t3; \ + t7 = -t7; \ + t8 = -t8; \ + tg = -tg; \ + tm = -tm; \ + to = -to; \ + \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + tm -= (t9*14341 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t9 += (tm*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + tm -= (t9*4161 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + tp -= (t6*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t6 += (tp*15137 + 8192) >> 14; \ + /* 28681/32768 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + tp -= (t6*28681 + 16384) >> 15; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + th += (te*19195 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + te += (th*11585 + 8192) >> 14; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + th -= (te*29957 + 16384) >> 15; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + tq -= (t5*14341 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t5 += (tq*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + tq -= (t5*4161 + 8192) >> 14; \ + /* 3259/8192 ~= 2*Tan[Pi/16] ~= 0.397824734759316 */ \ + ta -= (tl*3259 + 4096) >> 13; \ + /* 3135/16384 ~= Sin[Pi/8]/2 ~= 0.1913417161825449 */ \ + tl += (ta*3135 + 8192) >> 14; \ + /* 3259/8192 ~= 2*Tan[Pi/16] ~= 0.397824734759316 */ \ + ta -= (tl*3259 + 4096) >> 13; \ + /* 7489/8192 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + ti -= (td*7489 + 4096) >> 13; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + td += (ti*11585 + 8192) >> 14; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + ti += (td*19195 + 16384) >> 15; \ + /* 14341/16384 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + to -= (t7*14341 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t7 += (to*15137 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + to -= (t7*4161 + 8192) >> 14; \ + /* 4161/16384 ~= Tan[3*Pi/16] - Tan[Pi/8] ~= 0.253965075546204 */ \ + tn -= (t8*4161 + 8192) >> 14; \ + /* 15137/16384 ~= Sin[3*Pi/8] ~= 0.923879532511287 */ \ + t8 += (tn*15137 + 8192) >> 14; \ + /* 28681/32768 ~= Tan[3*Pi/16] + Tan[Pi/8]/2 ~= 0.875285419105846 */ \ + tn -= (t8*28681 + 16384) >> 15; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + tf += (tg*19195 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + tg += (tf*11585 + 8192) >> 14; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + tf -= (tg*29957 + 16384) >> 15; \ + /* -19195/32768 ~= Tan[Pi/8] - Tan[Pi/4] ~= -0.585786437626905 */ \ + tj += (tc*19195 + 16384) >> 15; \ + /* 11585/16384 ~= Sin[Pi/4] ~= 0.707106781186548 */ \ + tc += (tj*11585 + 8192) >> 14; \ + /* 29957/32768 ~= Tan[Pi/8] + Tan[Pi/4]/2 ~= 0.914213562373095 */ \ + tj -= (tc*29957 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + tk += (tb*13573 + 8192) >> 14; \ + /* 11585/32768 ~= Sin[Pi/4]/2 ~= 0.353553390593274 */ \ + tb -= (tk*11585 + 16384) >> 15; \ + /* 13573/16384 ~= 2*Tan[Pi/8] ~= 0.828427124746190 */ \ + tk += (tb*13573 + 8192) >> 14; \ + \ + tf = -tf; \ + \ + } \ + while (0) + +#define OD_FDCT_64(u0, uw, ug, uM, u8, uE, uo, uU, u4, uA, uk, uQ, uc, uI, \ + us, uY, u2, uy, ui, uO, ua, uG, uq, uW, u6, uC, um, uS, ue, uK, uu, u_, u1, \ + ux, uh, uN, u9, uF, up, uV, u5, uB, ul, uR, ud, uJ, ut, uZ, u3, uz, uj, uP, \ + ub, uH, ur, uX, u7, uD, un, uT, uf, uL, uv, u) \ + /* Embedded 64-point orthonormal Type-II fDCT. */ \ + do { \ + int uwh; \ + int uxh; \ + int uyh; \ + int uzh; \ + int uAh; \ + int uBh; \ + int uCh; \ + int uDh; \ + int uEh; \ + int uFh; \ + int uGh; \ + int uHh; \ + int uIh; \ + int uJh; \ + int uKh; \ + int uLh; \ + int uMh; \ + int uNh; \ + int uOh; \ + int uPh; \ + int uQh; \ + int uRh; \ + int uSh; \ + int uTh; \ + int uUh; \ + int uVh; \ + int uWh; \ + int uXh; \ + int uYh; \ + int uZh; \ + int u_h; \ + int uh_; \ + u = u0 - u; \ + uh_ = OD_DCT_RSHIFT(u, 1); \ + u0 -= uh_; \ + u_ += u1; \ + u_h = OD_DCT_RSHIFT(u_, 1); \ + u1 = u_h - u1; \ + uZ = u2 - uZ; \ + uZh = OD_DCT_RSHIFT(uZ, 1); \ + u2 -= uZh; \ + uY += u3; \ + uYh = OD_DCT_RSHIFT(uY, 1); \ + u3 = uYh - u3; \ + uX = u4 - uX; \ + uXh = OD_DCT_RSHIFT(uX, 1); \ + u4 -= uXh; \ + uW += u5; \ + uWh = OD_DCT_RSHIFT(uW, 1); \ + u5 = uWh - u5; \ + uV = u6 - uV; \ + uVh = OD_DCT_RSHIFT(uV, 1); \ + u6 -= uVh; \ + uU += u7; \ + uUh = OD_DCT_RSHIFT(uU, 1); \ + u7 = uUh - u7; \ + uT = u8 - uT; \ + uTh = OD_DCT_RSHIFT(uT, 1); \ + u8 -= uTh; \ + uS += u9; \ + uSh = OD_DCT_RSHIFT(uS, 1); \ + u9 = uSh - u9; \ + uR = ua - uR; \ + uRh = OD_DCT_RSHIFT(uR, 1); \ + ua -= uRh; \ + uQ += ub; \ + uQh = OD_DCT_RSHIFT(uQ, 1); \ + ub = uQh - ub; \ + uP = uc - uP; \ + uPh = OD_DCT_RSHIFT(uP, 1); \ + uc -= uPh; \ + uO += ud; \ + uOh = OD_DCT_RSHIFT(uO, 1); \ + ud = uOh - ud; \ + uN = ue - uN; \ + uNh = OD_DCT_RSHIFT(uN, 1); \ + ue -= uNh; \ + uM += uf; \ + uMh = OD_DCT_RSHIFT(uM, 1); \ + uf = uMh - uf; \ + uL = ug - uL; \ + uLh = OD_DCT_RSHIFT(uL, 1); \ + ug -= uLh; \ + uK += uh; \ + uKh = OD_DCT_RSHIFT(uK, 1); \ + uh = uKh - uh; \ + uJ = ui - uJ; \ + uJh = OD_DCT_RSHIFT(uJ, 1); \ + ui -= uJh; \ + uI += uj; \ + uIh = OD_DCT_RSHIFT(uI, 1); \ + uj = uIh - uj; \ + uH = uk - uH; \ + uHh = OD_DCT_RSHIFT(uH, 1); \ + uk -= uHh; \ + uG += ul; \ + uGh = OD_DCT_RSHIFT(uG, 1); \ + ul = uGh - ul; \ + uF = um - uF; \ + uFh = OD_DCT_RSHIFT(uF, 1); \ + um -= uFh; \ + uE += un; \ + uEh = OD_DCT_RSHIFT(uE, 1); \ + un = uEh - un; \ + uD = uo - uD; \ + uDh = OD_DCT_RSHIFT(uD, 1); \ + uo -= uDh; \ + uC += up; \ + uCh = OD_DCT_RSHIFT(uC, 1); \ + up = uCh - up; \ + uB = uq - uB; \ + uBh = OD_DCT_RSHIFT(uB, 1); \ + uq -= uBh; \ + uA += ur; \ + uAh = OD_DCT_RSHIFT(uA, 1); \ + ur = uAh - ur; \ + uz = us - uz; \ + uzh = OD_DCT_RSHIFT(uz, 1); \ + us -= uzh; \ + uy += ut; \ + uyh = OD_DCT_RSHIFT(uy, 1); \ + ut = uyh - ut; \ + ux = uu - ux; \ + uxh = OD_DCT_RSHIFT(ux, 1); \ + uu -= uxh; \ + uw += uv; \ + uwh = OD_DCT_RSHIFT(uw, 1); \ + uv = uwh - uv; \ + OD_FDCT_32_ASYM(u0, uw, uwh, ug, uM, uMh, u8, uE, uEh, uo, uU, uUh, \ + u4, uA, uAh, uk, uQ, uQh, uc, uI, uIh, us, uY, uYh, u2, uy, uyh, \ + ui, uO, uOh, ua, uG, uGh, uq, uW, uWh, u6, uC, uCh, um, uS, uSh, \ + ue, uK, uKh, uu, u_, u_h); \ + OD_FDST_32_ASYM(u, uv, uL, uf, uT, un, uD, u7, uX, ur, uH, ub, uP, uj, \ + uz, u3, uZ, ut, uJ, ud, uR, ul, uB, u5, uV, up, uF, u9, uN, uh, ux, u1); \ + } \ + while (0) + +#define OD_IDCT_64(u0, uw, ug, uM, u8, uE, uo, uU, u4, uA, uk, uQ, uc, uI, \ + us, uY, u2, uy, ui, uO, ua, uG, uq, uW, u6, uC, um, uS, ue, uK, uu, u_, u1, \ + ux, uh, uN, u9, uF, up, uV, u5, uB, ul, uR, ud, uJ, ut, uZ, u3, uz, uj, uP, \ + ub, uH, ur, uX, u7, uD, un, uT, uf, uL, uv, u) \ + /* Embedded 64-point orthonormal Type-II fDCT. */ \ + do { \ + int u1h; \ + int u3h; \ + int u5h; \ + int u7h; \ + int u9h; \ + int ubh; \ + int udh; \ + int ufh; \ + int uhh; \ + int ujh; \ + int ulh; \ + int unh; \ + int uph; \ + int urh; \ + int uth; \ + int uvh; \ + int uxh; \ + int uzh; \ + int uBh; \ + int uDh; \ + int uFh; \ + int uHh; \ + int uJh; \ + int uLh; \ + int uNh; \ + int uPh; \ + int uRh; \ + int uTh; \ + int uVh; \ + int uXh; \ + int uZh; \ + int uh_; \ + OD_IDST_32_ASYM(u, uL, uT, uD, uX, uH, uP, uz, uZ, uJ, uR, uB, uV, uF, \ + uN, ux, u_, uK, uS, uC, uW, uG, uO, uy, uY, uI, uQ, uA, uU, uE, uM, uw); \ + OD_IDCT_32_ASYM(u0, ug, u8, uo, u4, uk, uc, us, u2, ui, ua, uq, u6, um, \ + ue, uu, u1, u1h, uh, uhh, u9, u9h, up, uph, u5, u5h, ul, ulh, ud, udh, \ + ut, uth, u3, u3h, uj, ujh, ub, ubh, ur, urh, u7, u7h, un, unh, uf, ufh, \ + uv, uvh); \ + uh_ = OD_DCT_RSHIFT(u, 1); \ + u0 += uh_; \ + u = u0 - u; \ + u_ = u1h - u_; \ + u1 -= u_; \ + uZh = OD_DCT_RSHIFT(uZ, 1); \ + u2 += uZh; \ + uZ = u2 - uZ; \ + uY = u3h - uY; \ + u3 -= uY; \ + uXh = OD_DCT_RSHIFT(uX, 1); \ + u4 += uXh; \ + uX = u4 - uX; \ + uW = u5h - uW; \ + u5 -= uW; \ + uVh = OD_DCT_RSHIFT(uV, 1); \ + u6 += uVh; \ + uV = u6 - uV; \ + uU = u7h - uU; \ + u7 -= uU; \ + uTh = OD_DCT_RSHIFT(uT, 1); \ + u8 += uTh; \ + uT = u8 - uT; \ + uS = u9h - uS; \ + u9 -= uS; \ + uRh = OD_DCT_RSHIFT(uR, 1); \ + ua += uRh; \ + uR = ua - uR; \ + uQ = ubh - uQ; \ + ub -= uQ; \ + uPh = OD_DCT_RSHIFT(uP, 1); \ + uc += uPh; \ + uP = uc - uP; \ + uO = udh - uO; \ + ud -= uO; \ + uNh = OD_DCT_RSHIFT(uN, 1); \ + ue += uNh; \ + uN = ue - uN; \ + uM = ufh - uM; \ + uf -= uM; \ + uLh = OD_DCT_RSHIFT(uL, 1); \ + ug += uLh; \ + uL = ug - uL; \ + uK = uhh - uK; \ + uh -= uK; \ + uJh = OD_DCT_RSHIFT(uJ, 1); \ + ui += uJh; \ + uJ = ui - uJ; \ + uI = ujh - uI; \ + uj -= uI; \ + uHh = OD_DCT_RSHIFT(uH, 1); \ + uk += uHh; \ + uH = uk - uH; \ + uG = ulh - uG; \ + ul -= uG; \ + uFh = OD_DCT_RSHIFT(uF, 1); \ + um += uFh; \ + uF = um - uF; \ + uE = unh - uE; \ + un -= uE; \ + uDh = OD_DCT_RSHIFT(uD, 1); \ + uo += uDh; \ + uD = uo - uD; \ + uC = uph - uC; \ + up -= uC; \ + uBh = OD_DCT_RSHIFT(uB, 1); \ + uq += uBh; \ + uB = uq - uB; \ + uA = urh - uA; \ + ur -= uA; \ + uzh = OD_DCT_RSHIFT(uz, 1); \ + us += uzh; \ + uz = us - uz; \ + uy = uth - uy; \ + ut -= uy; \ + uxh = OD_DCT_RSHIFT(ux, 1); \ + uu += uxh; \ + ux = uu - ux; \ + uw = uvh - uw; \ + uv -= uw; \ + } while (0) +#endif + void od_bin_fdct4(od_coeff y[4], const od_coeff *x, int xstride) { int q0; int q1; @@ -478,6 +3150,38 @@ void od_bin_idct4(od_coeff *x, int xstride, const od_coeff y[4]) { x[3*xstride] = q3; } +void od_bin_fdst4(od_coeff y[4], const od_coeff *x, int xstride) { + int q0; + int q1; + int q2; + int q3; + q0 = x[3*xstride]; + q2 = x[2*xstride]; + q1 = x[1*xstride]; + q3 = x[0*xstride]; + OD_FDST_4(q0, q2, q1, q3); + y[0] = (od_coeff)q3; + y[1] = (od_coeff)q2; + y[2] = (od_coeff)q1; + y[3] = (od_coeff)q0; +} + +void od_bin_idst4(od_coeff *x, int xstride, const od_coeff y[4]) { + int q0; + int q1; + int q2; + int q3; + q0 = y[3]; + q2 = y[2]; + q1 = y[1]; + q3 = y[0]; + OD_IDST_4(q0, q2, q1, q3); + x[0*xstride] = q3; + x[1*xstride] = q2; + x[2*xstride] = q1; + x[3*xstride] = q0; +} + void od_bin_fdct8(od_coeff y[8], const od_coeff *x, int xstride) { int r0; int r1; @@ -589,3 +3293,1039 @@ void od_bin_idst8(od_coeff *x, int xstride, const od_coeff y[8]) { x[6*xstride] = (od_coeff)r6; x[7*xstride] = (od_coeff)r7; } + +void od_bin_fdct16(od_coeff y[16], const od_coeff *x, int xstride) { + int s0; + int s1; + int s2; + int s3; + int s4; + int s5; + int s6; + int s7; + int s8; + int s9; + int sa; + int sb; + int sc; + int sd; + int se; + int sf; + s0 = x[0*xstride]; + s8 = x[1*xstride]; + s4 = x[2*xstride]; + sc = x[3*xstride]; + s2 = x[4*xstride]; + sa = x[5*xstride]; + s6 = x[6*xstride]; + se = x[7*xstride]; + s1 = x[8*xstride]; + s9 = x[9*xstride]; + s5 = x[10*xstride]; + sd = x[11*xstride]; + s3 = x[12*xstride]; + sb = x[13*xstride]; + s7 = x[14*xstride]; + sf = x[15*xstride]; + OD_FDCT_16(s0, s8, s4, sc, s2, sa, s6, se, s1, s9, s5, sd, s3, sb, s7, sf); + y[0] = (od_coeff)s0; + y[1] = (od_coeff)s1; + y[2] = (od_coeff)s2; + y[3] = (od_coeff)s3; + y[4] = (od_coeff)s4; + y[5] = (od_coeff)s5; + y[6] = (od_coeff)s6; + y[7] = (od_coeff)s7; + y[8] = (od_coeff)s8; + y[9] = (od_coeff)s9; + y[10] = (od_coeff)sa; + y[11] = (od_coeff)sb; + y[12] = (od_coeff)sc; + y[13] = (od_coeff)sd; + y[14] = (od_coeff)se; + y[15] = (od_coeff)sf; +} + +void od_bin_idct16(od_coeff *x, int xstride, const od_coeff y[16]) { + int s0; + int s1; + int s2; + int s3; + int s4; + int s5; + int s6; + int s7; + int s8; + int s9; + int sa; + int sb; + int sc; + int sd; + int se; + int sf; + s0 = y[0]; + s8 = y[1]; + s4 = y[2]; + sc = y[3]; + s2 = y[4]; + sa = y[5]; + s6 = y[6]; + se = y[7]; + s1 = y[8]; + s9 = y[9]; + s5 = y[10]; + sd = y[11]; + s3 = y[12]; + sb = y[13]; + s7 = y[14]; + sf = y[15]; + OD_IDCT_16(s0, s8, s4, sc, s2, sa, s6, se, s1, s9, s5, sd, s3, sb, s7, sf); + x[0*xstride] = (od_coeff)s0; + x[1*xstride] = (od_coeff)s1; + x[2*xstride] = (od_coeff)s2; + x[3*xstride] = (od_coeff)s3; + x[4*xstride] = (od_coeff)s4; + x[5*xstride] = (od_coeff)s5; + x[6*xstride] = (od_coeff)s6; + x[7*xstride] = (od_coeff)s7; + x[8*xstride] = (od_coeff)s8; + x[9*xstride] = (od_coeff)s9; + x[10*xstride] = (od_coeff)sa; + x[11*xstride] = (od_coeff)sb; + x[12*xstride] = (od_coeff)sc; + x[13*xstride] = (od_coeff)sd; + x[14*xstride] = (od_coeff)se; + x[15*xstride] = (od_coeff)sf; +} + +void od_bin_fdst16(od_coeff y[16], const od_coeff *x, int xstride) { + int s0; + int s1; + int s2; + int s3; + int s4; + int s5; + int s6; + int s7; + int s8; + int s9; + int sa; + int sb; + int sc; + int sd; + int se; + int sf; + s0 = x[15*xstride]; + s8 = x[14*xstride]; + s4 = x[13*xstride]; + sc = x[12*xstride]; + s2 = x[11*xstride]; + sa = x[10*xstride]; + s6 = x[9*xstride]; + se = x[8*xstride]; + s1 = x[7*xstride]; + s9 = x[6*xstride]; + s5 = x[5*xstride]; + sd = x[4*xstride]; + s3 = x[3*xstride]; + sb = x[2*xstride]; + s7 = x[1*xstride]; + sf = x[0*xstride]; + OD_FDST_16(s0, s8, s4, sc, s2, sa, s6, se, s1, s9, s5, sd, s3, sb, s7, sf); + y[0] = (od_coeff)sf; + y[1] = (od_coeff)se; + y[2] = (od_coeff)sd; + y[3] = (od_coeff)sc; + y[4] = (od_coeff)sb; + y[5] = (od_coeff)sa; + y[6] = (od_coeff)s9; + y[7] = (od_coeff)s8; + y[8] = (od_coeff)s7; + y[9] = (od_coeff)s6; + y[10] = (od_coeff)s5; + y[11] = (od_coeff)s4; + y[12] = (od_coeff)s3; + y[13] = (od_coeff)s2; + y[14] = (od_coeff)s1; + y[15] = (od_coeff)s0; +} + +void od_bin_idst16(od_coeff *x, int xstride, const od_coeff y[16]) { + int s0; + int s1; + int s2; + int s3; + int s4; + int s5; + int s6; + int s7; + int s8; + int s9; + int sa; + int sb; + int sc; + int sd; + int se; + int sf; + s0 = y[15]; + s8 = y[14]; + s4 = y[13]; + sc = y[12]; + s2 = y[11]; + sa = y[10]; + s6 = y[9]; + se = y[8]; + s1 = y[7]; + s9 = y[6]; + s5 = y[5]; + sd = y[4]; + s3 = y[3]; + sb = y[2]; + s7 = y[1]; + sf = y[0]; + OD_IDST_16(s0, s8, s4, sc, s2, sa, s6, se, s1, s9, s5, sd, s3, sb, s7, sf); + x[0*xstride] = (od_coeff)sf; + x[1*xstride] = (od_coeff)se; + x[2*xstride] = (od_coeff)sd; + x[3*xstride] = (od_coeff)sc; + x[4*xstride] = (od_coeff)sb; + x[5*xstride] = (od_coeff)sa; + x[6*xstride] = (od_coeff)s9; + x[7*xstride] = (od_coeff)s8; + x[8*xstride] = (od_coeff)s7; + x[9*xstride] = (od_coeff)s6; + x[10*xstride] = (od_coeff)s5; + x[11*xstride] = (od_coeff)s4; + x[12*xstride] = (od_coeff)s3; + x[13*xstride] = (od_coeff)s2; + x[14*xstride] = (od_coeff)s1; + x[15*xstride] = (od_coeff)s0; +} + +void od_bin_fdct32(od_coeff y[32], const od_coeff *x, int xstride) { + /*215 adds, 38 shifts, 87 "muls".*/ + int t0; + int t1; + int t2; + int t3; + int t4; + int t5; + int t6; + int t7; + int t8; + int t9; + int ta; + int tb; + int tc; + int td; + int te; + int tf; + int tg; + int th; + int ti; + int tj; + int tk; + int tl; + int tm; + int tn; + int to; + int tp; + int tq; + int tr; + int ts; + int tt; + int tu; + int tv; + t0 = x[0*xstride]; + tg = x[1*xstride]; + t8 = x[2*xstride]; + to = x[3*xstride]; + t4 = x[4*xstride]; + tk = x[5*xstride]; + tc = x[6*xstride]; + ts = x[7*xstride]; + t2 = x[8*xstride]; + ti = x[9*xstride]; + ta = x[10*xstride]; + tq = x[11*xstride]; + t6 = x[12*xstride]; + tm = x[13*xstride]; + te = x[14*xstride]; + tu = x[15*xstride]; + t1 = x[16*xstride]; + th = x[17*xstride]; + t9 = x[18*xstride]; + tp = x[19*xstride]; + t5 = x[20*xstride]; + tl = x[21*xstride]; + td = x[22*xstride]; + tt = x[23*xstride]; + t3 = x[24*xstride]; + tj = x[25*xstride]; + tb = x[26*xstride]; + tr = x[27*xstride]; + t7 = x[28*xstride]; + tn = x[29*xstride]; + tf = x[30*xstride]; + tv = x[31*xstride]; + OD_FDCT_32(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, tm, te, tu, + t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv); + y[0] = (od_coeff)t0; + y[1] = (od_coeff)t1; + y[2] = (od_coeff)t2; + y[3] = (od_coeff)t3; + y[4] = (od_coeff)t4; + y[5] = (od_coeff)t5; + y[6] = (od_coeff)t6; + y[7] = (od_coeff)t7; + y[8] = (od_coeff)t8; + y[9] = (od_coeff)t9; + y[10] = (od_coeff)ta; + y[11] = (od_coeff)tb; + y[12] = (od_coeff)tc; + y[13] = (od_coeff)td; + y[14] = (od_coeff)te; + y[15] = (od_coeff)tf; + y[16] = (od_coeff)tg; + y[17] = (od_coeff)th; + y[18] = (od_coeff)ti; + y[19] = (od_coeff)tj; + y[20] = (od_coeff)tk; + y[21] = (od_coeff)tl; + y[22] = (od_coeff)tm; + y[23] = (od_coeff)tn; + y[24] = (od_coeff)to; + y[25] = (od_coeff)tp; + y[26] = (od_coeff)tq; + y[27] = (od_coeff)tr; + y[28] = (od_coeff)ts; + y[29] = (od_coeff)tt; + y[30] = (od_coeff)tu; + y[31] = (od_coeff)tv; +} + +void od_bin_idct32(od_coeff *x, int xstride, const od_coeff y[32]) { + int t0; + int t1; + int t2; + int t3; + int t4; + int t5; + int t6; + int t7; + int t8; + int t9; + int ta; + int tb; + int tc; + int td; + int te; + int tf; + int tg; + int th; + int ti; + int tj; + int tk; + int tl; + int tm; + int tn; + int to; + int tp; + int tq; + int tr; + int ts; + int tt; + int tu; + int tv; + t0 = y[0]; + tg = y[1]; + t8 = y[2]; + to = y[3]; + t4 = y[4]; + tk = y[5]; + tc = y[6]; + ts = y[7]; + t2 = y[8]; + ti = y[9]; + ta = y[10]; + tq = y[11]; + t6 = y[12]; + tm = y[13]; + te = y[14]; + tu = y[15]; + t1 = y[16]; + th = y[17]; + t9 = y[18]; + tp = y[19]; + t5 = y[20]; + tl = y[21]; + td = y[22]; + tt = y[23]; + t3 = y[24]; + tj = y[25]; + tb = y[26]; + tr = y[27]; + t7 = y[28]; + tn = y[29]; + tf = y[30]; + tv = y[31]; + OD_IDCT_32(t0, tg, t8, to, t4, tk, tc, ts, t2, ti, ta, tq, t6, tm, te, tu, + t1, th, t9, tp, t5, tl, td, tt, t3, tj, tb, tr, t7, tn, tf, tv); + x[0*xstride] = (od_coeff)t0; + x[1*xstride] = (od_coeff)t1; + x[2*xstride] = (od_coeff)t2; + x[3*xstride] = (od_coeff)t3; + x[4*xstride] = (od_coeff)t4; + x[5*xstride] = (od_coeff)t5; + x[6*xstride] = (od_coeff)t6; + x[7*xstride] = (od_coeff)t7; + x[8*xstride] = (od_coeff)t8; + x[9*xstride] = (od_coeff)t9; + x[10*xstride] = (od_coeff)ta; + x[11*xstride] = (od_coeff)tb; + x[12*xstride] = (od_coeff)tc; + x[13*xstride] = (od_coeff)td; + x[14*xstride] = (od_coeff)te; + x[15*xstride] = (od_coeff)tf; + x[16*xstride] = (od_coeff)tg; + x[17*xstride] = (od_coeff)th; + x[18*xstride] = (od_coeff)ti; + x[19*xstride] = (od_coeff)tj; + x[20*xstride] = (od_coeff)tk; + x[21*xstride] = (od_coeff)tl; + x[22*xstride] = (od_coeff)tm; + x[23*xstride] = (od_coeff)tn; + x[24*xstride] = (od_coeff)to; + x[25*xstride] = (od_coeff)tp; + x[26*xstride] = (od_coeff)tq; + x[27*xstride] = (od_coeff)tr; + x[28*xstride] = (od_coeff)ts; + x[29*xstride] = (od_coeff)tt; + x[30*xstride] = (od_coeff)tu; + x[31*xstride] = (od_coeff)tv; +} + +#if CONFIG_TX64X64 +void od_bin_fdct64(od_coeff y[64], const od_coeff *x, int xstride) { + int t0; + int t1; + int t2; + int t3; + int t4; + int t5; + int t6; + int t7; + int t8; + int t9; + int ta; + int tb; + int tc; + int td; + int te; + int tf; + int tg; + int th; + int ti; + int tj; + int tk; + int tl; + int tm; + int tn; + int to; + int tp; + int tq; + int tr; + int ts; + int tt; + int tu; + int tv; + int tw; + int tx; + int ty; + int tz; + int tA; + int tB; + int tC; + int tD; + int tE; + int tF; + int tG; + int tH; + int tI; + int tJ; + int tK; + int tL; + int tM; + int tN; + int tO; + int tP; + int tQ; + int tR; + int tS; + int tT; + int tU; + int tV; + int tW; + int tX; + int tY; + int tZ; + int t_; + int t; + t0 = x[0*xstride]; + tw = x[1*xstride]; + tg = x[2*xstride]; + tM = x[3*xstride]; + t8 = x[4*xstride]; + tE = x[5*xstride]; + to = x[6*xstride]; + tU = x[7*xstride]; + t4 = x[8*xstride]; + tA = x[9*xstride]; + tk = x[10*xstride]; + tQ = x[11*xstride]; + tc = x[12*xstride]; + tI = x[13*xstride]; + ts = x[14*xstride]; + tY = x[15*xstride]; + t2 = x[16*xstride]; + ty = x[17*xstride]; + ti = x[18*xstride]; + tO = x[19*xstride]; + ta = x[20*xstride]; + tG = x[21*xstride]; + tq = x[22*xstride]; + tW = x[23*xstride]; + t6 = x[24*xstride]; + tC = x[25*xstride]; + tm = x[26*xstride]; + tS = x[27*xstride]; + te = x[28*xstride]; + tK = x[29*xstride]; + tu = x[30*xstride]; + t_ = x[31*xstride]; + t1 = x[32*xstride]; + tx = x[33*xstride]; + th = x[34*xstride]; + tN = x[35*xstride]; + t9 = x[36*xstride]; + tF = x[37*xstride]; + tp = x[38*xstride]; + tV = x[39*xstride]; + t5 = x[40*xstride]; + tB = x[41*xstride]; + tl = x[42*xstride]; + tR = x[43*xstride]; + td = x[44*xstride]; + tJ = x[45*xstride]; + tt = x[46*xstride]; + tZ = x[47*xstride]; + t3 = x[48*xstride]; + tz = x[49*xstride]; + tj = x[50*xstride]; + tP = x[51*xstride]; + tb = x[52*xstride]; + tH = x[53*xstride]; + tr = x[54*xstride]; + tX = x[55*xstride]; + t7 = x[56*xstride]; + tD = x[57*xstride]; + tn = x[58*xstride]; + tT = x[59*xstride]; + tf = x[60*xstride]; + tL = x[61*xstride]; + tv = x[62*xstride]; + t = x[63*xstride]; + OD_FDCT_64(t0, tw, tg, tM, t8, tE, to, tU, t4, tA, tk, tQ, tc, tI, ts, tY, + t2, ty, ti, tO, ta, tG, tq, tW, t6, tC, tm, tS, te, tK, tu, t_, t1, tx, + th, tN, t9, tF, tp, tV, t5, tB, tl, tR, td, tJ, tt, tZ, t3, tz, tj, tP, + tb, tH, tr, tX, t7, tD, tn, tT, tf, tL, tv, t); + y[0] = (od_coeff)t0; + y[1] = (od_coeff)t1; + y[2] = (od_coeff)t2; + y[3] = (od_coeff)t3; + y[4] = (od_coeff)t4; + y[5] = (od_coeff)t5; + y[6] = (od_coeff)t6; + y[7] = (od_coeff)t7; + y[8] = (od_coeff)t8; + y[9] = (od_coeff)t9; + y[10] = (od_coeff)ta; + y[11] = (od_coeff)tb; + y[12] = (od_coeff)tc; + y[13] = (od_coeff)td; + y[14] = (od_coeff)te; + y[15] = (od_coeff)tf; + y[16] = (od_coeff)tg; + y[17] = (od_coeff)th; + y[18] = (od_coeff)ti; + y[19] = (od_coeff)tj; + y[20] = (od_coeff)tk; + y[21] = (od_coeff)tl; + y[22] = (od_coeff)tm; + y[23] = (od_coeff)tn; + y[24] = (od_coeff)to; + y[25] = (od_coeff)tp; + y[26] = (od_coeff)tq; + y[27] = (od_coeff)tr; + y[28] = (od_coeff)ts; + y[29] = (od_coeff)tt; + y[30] = (od_coeff)tu; + y[31] = (od_coeff)tv; + y[32] = (od_coeff)tw; + y[33] = (od_coeff)tx; + y[34] = (od_coeff)ty; + y[35] = (od_coeff)tz; + y[36] = (od_coeff)tA; + y[37] = (od_coeff)tB; + y[38] = (od_coeff)tC; + y[39] = (od_coeff)tD; + y[40] = (od_coeff)tE; + y[41] = (od_coeff)tF; + y[41] = (od_coeff)tF; + y[42] = (od_coeff)tG; + y[43] = (od_coeff)tH; + y[44] = (od_coeff)tI; + y[45] = (od_coeff)tJ; + y[46] = (od_coeff)tK; + y[47] = (od_coeff)tL; + y[48] = (od_coeff)tM; + y[49] = (od_coeff)tN; + y[50] = (od_coeff)tO; + y[51] = (od_coeff)tP; + y[52] = (od_coeff)tQ; + y[53] = (od_coeff)tR; + y[54] = (od_coeff)tS; + y[55] = (od_coeff)tT; + y[56] = (od_coeff)tU; + y[57] = (od_coeff)tV; + y[58] = (od_coeff)tW; + y[59] = (od_coeff)tX; + y[60] = (od_coeff)tY; + y[61] = (od_coeff)tZ; + y[62] = (od_coeff)t_; + y[63] = (od_coeff)t; +} + +void od_bin_idct64(od_coeff *x, int xstride, const od_coeff y[64]) { + int t0; + int t1; + int t2; + int t3; + int t4; + int t5; + int t6; + int t7; + int t8; + int t9; + int ta; + int tb; + int tc; + int td; + int te; + int tf; + int tg; + int th; + int ti; + int tj; + int tk; + int tl; + int tm; + int tn; + int to; + int tp; + int tq; + int tr; + int ts; + int tt; + int tu; + int tv; + int tw; + int tx; + int ty; + int tz; + int tA; + int tB; + int tC; + int tD; + int tE; + int tF; + int tG; + int tH; + int tI; + int tJ; + int tK; + int tL; + int tM; + int tN; + int tO; + int tP; + int tQ; + int tR; + int tS; + int tT; + int tU; + int tV; + int tW; + int tX; + int tY; + int tZ; + int t_; + int t; + t0 = y[0]; + tw = y[1]; + tg = y[2]; + tM = y[3]; + t8 = y[4]; + tE = y[5]; + to = y[6]; + tU = y[7]; + t4 = y[8]; + tA = y[9]; + tk = y[10]; + tQ = y[11]; + tc = y[12]; + tI = y[13]; + ts = y[14]; + tY = y[15]; + t2 = y[16]; + ty = y[17]; + ti = y[18]; + tO = y[19]; + ta = y[20]; + tG = y[21]; + tq = y[22]; + tW = y[23]; + t6 = y[24]; + tC = y[25]; + tm = y[26]; + tS = y[27]; + te = y[28]; + tK = y[29]; + tu = y[30]; + t_ = y[31]; + t1 = y[32]; + tx = y[33]; + th = y[34]; + tN = y[35]; + t9 = y[36]; + tF = y[37]; + tp = y[38]; + tV = y[39]; + t5 = y[40]; + tB = y[41]; + tl = y[42]; + tR = y[43]; + td = y[44]; + tJ = y[45]; + tt = y[46]; + tZ = y[47]; + t3 = y[48]; + tz = y[49]; + tj = y[50]; + tP = y[51]; + tb = y[52]; + tH = y[53]; + tr = y[54]; + tX = y[55]; + t7 = y[56]; + tD = y[57]; + tn = y[58]; + tT = y[59]; + tf = y[60]; + tL = y[61]; + tv = y[62]; + t = y[63]; + OD_IDCT_64(t0, tw, tg, tM, t8, tE, to, tU, t4, tA, tk, tQ, tc, tI, ts, tY, + t2, ty, ti, tO, ta, tG, tq, tW, t6, tC, tm, tS, te, tK, tu, t_, t1, tx, + th, tN, t9, tF, tp, tV, t5, tB, tl, tR, td, tJ, tt, tZ, t3, tz, tj, tP, + tb, tH, tr, tX, t7, tD, tn, tT, tf, tL, tv, t); + x[0*xstride] = (od_coeff)t0; + x[1*xstride] = (od_coeff)t1; + x[2*xstride] = (od_coeff)t2; + x[3*xstride] = (od_coeff)t3; + x[4*xstride] = (od_coeff)t4; + x[5*xstride] = (od_coeff)t5; + x[6*xstride] = (od_coeff)t6; + x[7*xstride] = (od_coeff)t7; + x[8*xstride] = (od_coeff)t8; + x[9*xstride] = (od_coeff)t9; + x[10*xstride] = (od_coeff)ta; + x[11*xstride] = (od_coeff)tb; + x[12*xstride] = (od_coeff)tc; + x[13*xstride] = (od_coeff)td; + x[14*xstride] = (od_coeff)te; + x[15*xstride] = (od_coeff)tf; + x[16*xstride] = (od_coeff)tg; + x[17*xstride] = (od_coeff)th; + x[18*xstride] = (od_coeff)ti; + x[19*xstride] = (od_coeff)tj; + x[20*xstride] = (od_coeff)tk; + x[21*xstride] = (od_coeff)tl; + x[22*xstride] = (od_coeff)tm; + x[23*xstride] = (od_coeff)tn; + x[24*xstride] = (od_coeff)to; + x[25*xstride] = (od_coeff)tp; + x[26*xstride] = (od_coeff)tq; + x[27*xstride] = (od_coeff)tr; + x[28*xstride] = (od_coeff)ts; + x[29*xstride] = (od_coeff)tt; + x[30*xstride] = (od_coeff)tu; + x[31*xstride] = (od_coeff)tv; + x[32*xstride] = (od_coeff)tw; + x[33*xstride] = (od_coeff)tx; + x[34*xstride] = (od_coeff)ty; + x[35*xstride] = (od_coeff)tz; + x[36*xstride] = (od_coeff)tA; + x[37*xstride] = (od_coeff)tB; + x[38*xstride] = (od_coeff)tC; + x[39*xstride] = (od_coeff)tD; + x[40*xstride] = (od_coeff)tE; + x[41*xstride] = (od_coeff)tF; + x[41*xstride] = (od_coeff)tF; + x[42*xstride] = (od_coeff)tG; + x[43*xstride] = (od_coeff)tH; + x[44*xstride] = (od_coeff)tI; + x[45*xstride] = (od_coeff)tJ; + x[46*xstride] = (od_coeff)tK; + x[47*xstride] = (od_coeff)tL; + x[48*xstride] = (od_coeff)tM; + x[49*xstride] = (od_coeff)tN; + x[50*xstride] = (od_coeff)tO; + x[51*xstride] = (od_coeff)tP; + x[52*xstride] = (od_coeff)tQ; + x[53*xstride] = (od_coeff)tR; + x[54*xstride] = (od_coeff)tS; + x[55*xstride] = (od_coeff)tT; + x[56*xstride] = (od_coeff)tU; + x[57*xstride] = (od_coeff)tV; + x[58*xstride] = (od_coeff)tW; + x[59*xstride] = (od_coeff)tX; + x[60*xstride] = (od_coeff)tY; + x[61*xstride] = (od_coeff)tZ; + x[62*xstride] = (od_coeff)t_; + x[63*xstride] = (od_coeff)t; +} +#endif + +void daala_fdct4(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[4]; + od_coeff y[4]; + for (i = 0; i < 4; i++) x[i] = (od_coeff)input[i]; + od_bin_fdct4(y, x, 1); + for (i = 0; i < 4; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idct4(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[4]; + od_coeff y[4]; + for (i = 0; i < 4; i++) y[i] = input[i]; + od_bin_idct4(x, 1, y); + for (i = 0; i < 4; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_fdst4(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[4]; + od_coeff y[4]; + for (i = 0; i < 4; i++) x[i] = (od_coeff)input[i]; + od_bin_fdst4(y, x, 1); + for (i = 0; i < 4; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idst4(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[4]; + od_coeff y[4]; + for (i = 0; i < 4; i++) y[i] = input[i]; + od_bin_idst4(x, 1, y); + for (i = 0; i < 4; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_idtx4(const tran_low_t *input, tran_low_t *output) { + int i; + for (i = 0; i < 4; i++) output[i] = input[i]; +} + +void daala_fdct8(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[8]; + od_coeff y[8]; + for (i = 0; i < 8; i++) x[i] = (od_coeff)input[i]; + od_bin_fdct8(y, x, 1); + for (i = 0; i < 8; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idct8(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[8]; + od_coeff y[8]; + for (i = 0; i < 8; i++) y[i] = (od_coeff)input[i]; + od_bin_idct8(x, 1, y); + for (i = 0; i < 8; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_fdst8(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[8]; + od_coeff y[8]; + for (i = 0; i < 8; i++) x[i] = (od_coeff)input[i]; + od_bin_fdst8(y, x, 1); + for (i = 0; i < 8; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idst8(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[8]; + od_coeff y[8]; + for (i = 0; i < 8; i++) y[i] = (od_coeff)input[i]; + od_bin_idst8(x, 1, y); + for (i = 0; i < 8; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_idtx8(const tran_low_t *input, tran_low_t *output) { + int i; + for (i = 0; i < 8; i++) output[i] = input[i]; +} + +void daala_fdct16(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[16]; + od_coeff y[16]; + for (i = 0; i < 16; i++) x[i] = (od_coeff)input[i]; + od_bin_fdct16(y, x, 1); + for (i = 0; i < 16; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idct16(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[16]; + od_coeff y[16]; + for (i = 0; i < 16; i++) y[i] = (od_coeff)input[i]; + od_bin_idct16(x, 1, y); + for (i = 0; i < 16; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_fdst16(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[16]; + od_coeff y[16]; + for (i = 0; i < 16; i++) x[i] = (od_coeff)input[i]; + od_bin_fdst16(y, x, 1); + for (i = 0; i < 16; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idst16(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[16]; + od_coeff y[16]; + for (i = 0; i < 16; i++) y[i] = (od_coeff)input[i]; + od_bin_idst16(x, 1, y); + for (i = 0; i < 16; i++) output[i] = (tran_low_t)x[i]; +} + +void daala_idtx16(const tran_low_t *input, tran_low_t *output) { + int i; + for (i = 0; i < 16; i++) output[i] = input[i]; +} + +void daala_fdct32(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[32]; + od_coeff y[32]; + for (i = 0; i < 32; i++) x[i] = (od_coeff)input[i]; + od_bin_fdct32(y, x, 1); + for (i = 0; i < 32; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idct32(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[32]; + od_coeff y[32]; + for (i = 0; i < 32; i++) y[i] = (od_coeff)input[i]; + od_bin_idct32(x, 1, y); + for (i = 0; i < 32; i++) output[i] = (tran_low_t)x[i]; +} + +/* Preserve the "half-right" transform behavior. */ +void daala_fdst32(const tran_low_t *input, tran_low_t *output) { + int i; + tran_low_t inputhalf[16]; + for (i = 0; i < 16; ++i) { + output[16 + i] = input[i]; + } + for (i = 0; i < 16; ++i) { + inputhalf[i] = input[i + 16]; + } + daala_fdct16(inputhalf, output); +} + +/* Preserve the "half-right" transform behavior. */ +void daala_idst32(const tran_low_t *input, tran_low_t *output) { + int i; + tran_low_t inputhalf[16]; + for (i = 0; i < 16; ++i) { + inputhalf[i] = input[i]; + } + for (i = 0; i < 16; ++i) { + output[i] = input[16 + i]; + } + daala_idct16(inputhalf, output + 16); +} + +void daala_idtx32(const tran_low_t *input, tran_low_t *output) { + int i; + for (i = 0; i < 32; i++) output[i] = input[i]; +} + +#if CONFIG_TX64X64 +void daala_fdct64(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[64]; + od_coeff y[64]; + for (i = 0; i < 64; i++) x[i] = (od_coeff)input[i]; + od_bin_fdct64(y, x, 1); + for (i = 0; i < 64; i++) output[i] = (tran_low_t)y[i]; +} + +void daala_idct64(const tran_low_t *input, tran_low_t *output) { + int i; + od_coeff x[64]; + od_coeff y[64]; + for (i = 0; i < 64; i++) y[i] = (od_coeff)input[i]; + od_bin_idct64(x, 1, y); + for (i = 0; i < 64; i++) output[i] = (tran_low_t)x[i]; +} + +/* Preserve the "half-right" transform behavior. */ +void daala_fdst64(const tran_low_t *input, tran_low_t *output) { + int i; + tran_low_t inputhalf[32]; + for (i = 0; i < 32; ++i) { + output[32 + i] = input[i]; + } + for (i = 0; i < 32; ++i) { + inputhalf[i] = input[i + 32]; + } + daala_fdct32(inputhalf, output); +} + +/* Preserve the "half-right" transform behavior. */ +void daala_idst64(const tran_low_t *input, tran_low_t *output) { + int i; + tran_low_t inputhalf[32]; + for (i = 0; i < 32; ++i) { + inputhalf[i] = input[i]; + } + for (i = 0; i < 32; ++i) { + output[i] = input[32 + i]; + } + daala_idct32(inputhalf, output + 32); +} + +void daala_idtx64(const tran_low_t *input, tran_low_t *output) { + int i; + for (i = 0; i < 64; i++) output[i] = input[i]; +} +#endif diff --git a/third_party/aom/av1/common/daala_tx.h b/third_party/aom/av1/common/daala_tx.h index 39a844c44..7145b66a2 100644 --- a/third_party/aom/av1/common/daala_tx.h +++ b/third_party/aom/av1/common/daala_tx.h @@ -1,13 +1,53 @@ #ifndef AOM_DSP_DAALA_TX_H_ #define AOM_DSP_DAALA_TX_H_ +#include "aom_dsp/aom_dsp_common.h" #include "av1/common/odintrin.h" +void daala_fdct4(const tran_low_t *input, tran_low_t *output); +void daala_idct4(const tran_low_t *input, tran_low_t *output); +void daala_fdst4(const tran_low_t *input, tran_low_t *output); +void daala_idst4(const tran_low_t *input, tran_low_t *output); +void daala_idtx4(const tran_low_t *input, tran_low_t *output); +void daala_fdct8(const tran_low_t *input, tran_low_t *output); +void daala_idct8(const tran_low_t *input, tran_low_t *output); +void daala_fdst8(const tran_low_t *input, tran_low_t *output); +void daala_idst8(const tran_low_t *input, tran_low_t *output); +void daala_idtx8(const tran_low_t *input, tran_low_t *output); +void daala_fdct16(const tran_low_t *input, tran_low_t *output); +void daala_idct16(const tran_low_t *input, tran_low_t *output); +void daala_fdst16(const tran_low_t *input, tran_low_t *output); +void daala_idst16(const tran_low_t *input, tran_low_t *output); +void daala_idtx16(const tran_low_t *input, tran_low_t *output); +void daala_fdct32(const tran_low_t *input, tran_low_t *output); +void daala_idct32(const tran_low_t *input, tran_low_t *output); +void daala_fdst32(const tran_low_t *input, tran_low_t *output); +void daala_idst32(const tran_low_t *input, tran_low_t *output); +void daala_idtx32(const tran_low_t *input, tran_low_t *output); +#if CONFIG_TX64X64 +void daala_fdct64(const tran_low_t *input, tran_low_t *output); +void daala_idct64(const tran_low_t *input, tran_low_t *output); +void daala_fdst64(const tran_low_t *input, tran_low_t *output); +void daala_idst64(const tran_low_t *input, tran_low_t *output); +void daala_idtx64(const tran_low_t *input, tran_low_t *output); +#endif + void od_bin_fdct4(od_coeff y[4], const od_coeff *x, int xstride); void od_bin_idct4(od_coeff *x, int xstride, const od_coeff y[4]); +void od_bin_fdst4(od_coeff y[4], const od_coeff *x, int xstride); +void od_bin_idst4(od_coeff *x, int xstride, const od_coeff y[4]); void od_bin_fdct8(od_coeff y[8], const od_coeff *x, int xstride); void od_bin_idct8(od_coeff *x, int xstride, const od_coeff y[8]); void od_bin_fdst8(od_coeff y[8], const od_coeff *x, int xstride); void od_bin_idst8(od_coeff *x, int xstride, const od_coeff y[8]); - +void od_bin_fdct16(od_coeff y[16], const od_coeff *x, int xstride); +void od_bin_idct16(od_coeff *x, int xstride, const od_coeff y[16]); +void od_bin_fdst16(od_coeff y[16], const od_coeff *x, int xstride); +void od_bin_idst16(od_coeff *x, int xstride, const od_coeff y[16]); +void od_bin_fdct32(od_coeff y[32], const od_coeff *x, int xstride); +void od_bin_idct32(od_coeff *x, int xstride, const od_coeff y[32]); +#if CONFIG_TX64X64 +void od_bin_fdct64(od_coeff y[64], const od_coeff *x, int xstride); +void od_bin_idct64(od_coeff *x, int xstride, const od_coeff y[64]); +#endif #endif diff --git a/third_party/aom/av1/common/entropy.c b/third_party/aom/av1/common/entropy.c index b3d573867..17a8f1356 100644 --- a/third_party/aom/av1/common/entropy.c +++ b/third_party/aom/av1/common/entropy.c @@ -17,6 +17,9 @@ #include "av1/common/entropymode.h" #include "av1/common/onyxc_int.h" #include "av1/common/scan.h" +#if CONFIG_Q_ADAPT_PROBS +#include "av1/common/token_cdfs.h" +#endif // CONFIG_Q_ADAPT_PROBS #if CONFIG_LV_MAP #include "av1/common/txb_common.h" #endif @@ -146,6 +149,9 @@ const uint16_t band_count_table[TX_SIZES_ALL][8] = { { 1, 2, 3, 4, 8, 32 - 18, 0 }, { 1, 2, 3, 4, 8, 32 - 18, 0 }, { 1, 2, 3, 4, 11, 128 - 21, 0 }, { 1, 2, 3, 4, 11, 128 - 21, 0 }, { 1, 2, 3, 4, 11, 512 - 21, 0 }, { 1, 2, 3, 4, 11, 512 - 21, 0 }, +#if CONFIG_TX64X64 + { 1, 2, 3, 4, 11, 2048 - 21, 0 }, { 1, 2, 3, 4, 11, 2048 - 21, 0 }, +#endif // CONFIG_TX64X64 { 1, 2, 3, 4, 11, 64 - 21, 0 }, { 1, 2, 3, 4, 11, 64 - 21, 0 }, { 1, 2, 3, 4, 11, 256 - 21, 0 }, { 1, 2, 3, 4, 11, 256 - 21, 0 }, }; @@ -162,6 +168,9 @@ const uint16_t band_cum_count_table[TX_SIZES_ALL][8] = { { 0, 1, 3, 6, 10, 18, 32, 0 }, { 0, 1, 3, 6, 10, 18, 32, 0 }, { 0, 1, 3, 6, 10, 21, 128, 0 }, { 0, 1, 3, 6, 10, 21, 128, 0 }, { 0, 1, 3, 6, 10, 21, 512, 0 }, { 0, 1, 3, 6, 10, 21, 512, 0 }, +#if CONFIG_TX64X64 + { 0, 1, 3, 6, 10, 21, 2048, 0 }, { 0, 1, 3, 6, 10, 21, 2048, 0 }, +#endif // CONFIG_TX64X64 { 0, 1, 3, 6, 10, 21, 64, 0 }, { 0, 1, 3, 6, 10, 21, 64, 0 }, { 0, 1, 3, 6, 10, 21, 256, 0 }, { 0, 1, 3, 6, 10, 21, 256, 0 }, }; @@ -891,3256 +900,7 @@ const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS][TAIL_NODES] = { { 31486, 1150, 107, 20, 1, 1, 1, 1, 1 }, }; -/* clang-format off */ -#if CONFIG_Q_ADAPT_PROBS -const av1_coeff_probs_model -default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = { - { // Q_Index 0 -#if CONFIG_CHROMA_2X2 - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {182, 34, 137}, { 79, 39, 103}, { 10, 28, 51}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 45, 88, 147}, { 46, 80, 140}, { 25, 69, 119}, - { 12, 57, 96}, { 4, 41, 65}, { 1, 20, 31}, - }, - { // band 2 - { 58, 124, 190}, { 39, 106, 178}, { 16, 86, 147}, - { 7, 69, 114}, { 3, 50, 80}, { 1, 25, 42}, - }, - { // band 3 - { 90, 138, 215}, { 54, 116, 198}, { 18, 86, 155}, - { 5, 62, 112}, { 1, 38, 68}, { 1, 17, 30}, - }, - { // band 4 - {126, 149, 231}, { 82, 114, 211}, { 21, 80, 157}, - { 6, 56, 105}, { 1, 36, 64}, { 1, 17, 31}, - }, - { // band 5 - {171, 56, 236}, {140, 54, 219}, { 57, 45, 167}, - { 26, 36, 113}, { 11, 29, 72}, { 3, 18, 39}, - }, - }, - { // Intra - { // band 0 - {153, 122, 186}, {106, 109, 171}, { 36, 84, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 27, 151, 201}, { 34, 131, 199}, { 23, 102, 161}, - { 10, 80, 120}, { 4, 52, 78}, { 1, 24, 37}, - }, - { // band 2 - { 43, 158, 213}, { 35, 133, 203}, { 8, 92, 151}, - { 2, 64, 106}, { 1, 36, 60}, { 1, 13, 24}, - }, - { // band 3 - { 68, 167, 223}, { 36, 135, 211}, { 9, 94, 157}, - { 2, 67, 112}, { 1, 40, 68}, { 1, 17, 31}, - }, - { // band 4 - {131, 146, 237}, { 72, 119, 223}, { 17, 82, 164}, - { 4, 55, 107}, { 1, 34, 63}, { 1, 16, 29}, - }, - { // band 5 - {184, 68, 244}, {153, 59, 232}, { 68, 51, 179}, - { 31, 40, 123}, { 13, 29, 77}, { 4, 17, 37}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {203, 41, 203}, {127, 56, 174}, { 49, 56, 127}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {110, 121, 217}, {119, 113, 213}, { 64, 95, 185}, - { 30, 72, 144}, { 8, 42, 76}, { 2, 17, 25}, - }, - { // band 2 - {127, 159, 229}, {115, 134, 223}, { 36, 100, 189}, - { 11, 75, 142}, { 3, 48, 83}, { 1, 19, 33}, - }, - { // band 3 - {150, 172, 241}, { 90, 133, 231}, { 28, 102, 192}, - { 7, 81, 147}, { 1, 53, 91}, { 1, 25, 42}, - }, - { // band 4 - {184, 144, 248}, {114, 117, 237}, { 37, 89, 192}, - { 10, 63, 130}, { 4, 42, 76}, { 1, 19, 38}, - }, - { // band 5 - {207, 79, 250}, {179, 74, 241}, { 83, 67, 199}, - { 38, 51, 142}, { 17, 37, 97}, { 10, 14, 55}, - }, - }, - { // Inter - { // band 0 - {220, 82, 232}, {150, 93, 214}, { 66, 95, 177}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {116, 160, 227}, {136, 141, 227}, { 67, 114, 190}, - { 40, 94, 148}, { 21, 70, 107}, { 10, 43, 63}, - }, - { // band 2 - {124, 173, 235}, {105, 147, 226}, { 27, 107, 184}, - { 10, 80, 142}, { 3, 50, 86}, { 1, 16, 32}, - }, - { // band 3 - {149, 179, 243}, { 89, 147, 234}, { 29, 112, 193}, - { 9, 94, 157}, { 1, 64, 111}, { 1, 25, 43}, - }, - { // band 4 - {187, 153, 248}, {127, 130, 241}, { 52, 99, 202}, - { 20, 79, 152}, { 4, 50, 93}, { 1, 19, 32}, - }, - { // band 5 - {215, 82, 251}, {195, 80, 246}, { 93, 70, 204}, - { 39, 54, 147}, { 14, 33, 88}, { 6, 14, 39}, - }, - }, - }, - }, -#endif - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {182, 34, 137}, { 79, 39, 103}, { 10, 28, 51}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 45, 88, 147}, { 46, 80, 140}, { 25, 69, 119}, - { 12, 57, 96}, { 4, 41, 65}, { 1, 20, 31}, - }, - { // band 2 - { 58, 124, 190}, { 39, 106, 178}, { 16, 86, 147}, - { 7, 69, 114}, { 3, 50, 80}, { 1, 25, 42}, - }, - { // band 3 - { 90, 138, 215}, { 54, 116, 198}, { 18, 86, 155}, - { 5, 62, 112}, { 1, 38, 68}, { 1, 17, 30}, - }, - { // band 4 - {126, 149, 231}, { 82, 114, 211}, { 21, 80, 157}, - { 6, 56, 105}, { 1, 36, 64}, { 1, 17, 31}, - }, - { // band 5 - {171, 56, 236}, {140, 54, 219}, { 57, 45, 167}, - { 26, 36, 113}, { 11, 29, 72}, { 3, 18, 39}, - }, - }, - { // Intra - { // band 0 - {153, 122, 186}, {106, 109, 171}, { 36, 84, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 27, 151, 201}, { 34, 131, 199}, { 23, 102, 161}, - { 10, 80, 120}, { 4, 52, 78}, { 1, 24, 37}, - }, - { // band 2 - { 43, 158, 213}, { 35, 133, 203}, { 8, 92, 151}, - { 2, 64, 106}, { 1, 36, 60}, { 1, 13, 24}, - }, - { // band 3 - { 68, 167, 223}, { 36, 135, 211}, { 9, 94, 157}, - { 2, 67, 112}, { 1, 40, 68}, { 1, 17, 31}, - }, - { // band 4 - {131, 146, 237}, { 72, 119, 223}, { 17, 82, 164}, - { 4, 55, 107}, { 1, 34, 63}, { 1, 16, 29}, - }, - { // band 5 - {184, 68, 244}, {153, 59, 232}, { 68, 51, 179}, - { 31, 40, 123}, { 13, 29, 77}, { 4, 17, 37}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {203, 41, 203}, {127, 56, 174}, { 49, 56, 127}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {110, 121, 217}, {119, 113, 213}, { 64, 95, 185}, - { 30, 72, 144}, { 8, 42, 76}, { 2, 17, 25}, - }, - { // band 2 - {127, 159, 229}, {115, 134, 223}, { 36, 100, 189}, - { 11, 75, 142}, { 3, 48, 83}, { 1, 19, 33}, - }, - { // band 3 - {150, 172, 241}, { 90, 133, 231}, { 28, 102, 192}, - { 7, 81, 147}, { 1, 53, 91}, { 1, 25, 42}, - }, - { // band 4 - {184, 144, 248}, {114, 117, 237}, { 37, 89, 192}, - { 10, 63, 130}, { 4, 42, 76}, { 1, 19, 38}, - }, - { // band 5 - {207, 79, 250}, {179, 74, 241}, { 83, 67, 199}, - { 38, 51, 142}, { 17, 37, 97}, { 10, 14, 55}, - }, - }, - { // Inter - { // band 0 - {220, 82, 232}, {150, 93, 214}, { 66, 95, 177}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {116, 160, 227}, {136, 141, 227}, { 67, 114, 190}, - { 40, 94, 148}, { 21, 70, 107}, { 10, 43, 63}, - }, - { // band 2 - {124, 173, 235}, {105, 147, 226}, { 27, 107, 184}, - { 10, 80, 142}, { 3, 50, 86}, { 1, 16, 32}, - }, - { // band 3 - {149, 179, 243}, { 89, 147, 234}, { 29, 112, 193}, - { 9, 94, 157}, { 1, 64, 111}, { 1, 25, 43}, - }, - { // band 4 - {187, 153, 248}, {127, 130, 241}, { 52, 99, 202}, - { 20, 79, 152}, { 4, 50, 93}, { 1, 19, 32}, - }, - { // band 5 - {215, 82, 251}, {195, 80, 246}, { 93, 70, 204}, - { 39, 54, 147}, { 14, 33, 88}, { 6, 14, 39}, - }, - }, - }, - }, - { // TX_SIZE 1 - { // Y plane - { // Intra - { // band 0 - {116, 43, 131}, { 39, 41, 94}, { 4, 28, 47}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 28, 101, 141}, { 27, 95, 140}, { 18, 80, 121}, - { 10, 61, 95}, { 4, 39, 60}, { 1, 19, 26}, - }, - { // band 2 - { 29, 150, 183}, { 19, 127, 175}, { 8, 98, 147}, - { 3, 76, 115}, { 1, 55, 84}, { 1, 29, 43}, - }, - { // band 3 - { 26, 168, 202}, { 12, 138, 188}, { 2, 98, 149}, - { 1, 69, 110}, { 1, 40, 65}, { 1, 17, 25}, - }, - { // band 4 - { 33, 188, 225}, { 12, 155, 207}, { 2, 101, 155}, - { 1, 65, 106}, { 1, 36, 60}, { 1, 18, 26}, - }, - { // band 5 - { 79, 205, 242}, { 30, 168, 224}, { 5, 106, 164}, - { 1, 68, 110}, { 1, 39, 65}, { 1, 18, 28}, - }, - }, - { // Intra - { // band 0 - { 96, 80, 201}, { 51, 88, 168}, { 14, 78, 116}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 6, 167, 216}, { 32, 152, 211}, { 24, 121, 182}, - { 13, 98, 149}, { 12, 76, 108}, { 8, 48, 62}, - }, - { // band 2 - { 17, 176, 225}, { 13, 147, 209}, { 3, 96, 155}, - { 1, 65, 108}, { 2, 43, 63}, { 2, 23, 25}, - }, - { // band 3 - { 18, 183, 232}, { 10, 153, 214}, { 1, 96, 154}, - { 1, 63, 105}, { 1, 39, 59}, { 1, 21, 24}, - }, - { // band 4 - { 23, 191, 239}, { 8, 159, 221}, { 1, 97, 158}, - { 1, 61, 105}, { 1, 37, 60}, { 1, 20, 26}, - }, - { // band 5 - { 70, 201, 243}, { 29, 163, 228}, { 4, 102, 169}, - { 1, 67, 114}, { 1, 39, 66}, { 1, 17, 29}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {181, 38, 192}, { 95, 47, 151}, { 29, 49, 102}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 72, 131, 202}, { 93, 120, 205}, { 50, 103, 179}, - { 24, 79, 143}, { 11, 47, 78}, { 7, 19, 25}, - }, - { // band 2 - { 84, 176, 221}, { 56, 144, 214}, { 21, 108, 182}, - { 8, 83, 139}, { 3, 55, 90}, { 2, 27, 41}, - }, - { // band 3 - { 84, 195, 234}, { 42, 156, 222}, { 10, 109, 180}, - { 4, 77, 133}, { 1, 48, 80}, { 1, 23, 35}, - }, - { // band 4 - { 89, 210, 238}, { 35, 165, 221}, { 6, 106, 172}, - { 2, 70, 123}, { 1, 44, 74}, { 1, 21, 30}, - }, - { // band 5 - {114, 221, 247}, { 49, 170, 234}, { 7, 113, 184}, - { 2, 77, 132}, { 1, 48, 79}, { 1, 25, 33}, - }, - }, - { // Inter - { // band 0 - {192, 66, 237}, {113, 84, 211}, { 35, 84, 154}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 81, 180, 234}, {127, 165, 229}, { 58, 137, 204}, - { 41, 114, 174}, { 44, 94, 136}, { 29, 66, 86}, - }, - { // band 2 - { 82, 193, 240}, { 39, 162, 223}, { 8, 113, 179}, - { 3, 83, 136}, { 6, 62, 84}, { 5, 45, 45}, - }, - { // band 3 - { 78, 203, 242}, { 31, 170, 227}, { 4, 115, 181}, - { 1, 82, 135}, { 2, 59, 82}, { 1, 45, 47}, - }, - { // band 4 - { 76, 210, 239}, { 25, 170, 213}, { 2, 99, 152}, - { 1, 69, 115}, { 1, 49, 80}, { 1, 47, 57}, - }, - { // band 5 - {103, 217, 250}, { 42, 180, 237}, { 3, 124, 191}, - { 1, 90, 150}, { 1, 69, 116}, { 1, 52, 46}, - }, - }, - }, - }, - { // TX_SIZE 2 - { // Y plane - { // Intra - { // band 0 - { 58, 38, 99}, { 9, 26, 51}, { 1, 14, 22}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 14, 78, 109}, { 16, 73, 105}, { 11, 62, 92}, - { 6, 47, 72}, { 2, 29, 45}, { 1, 12, 18}, - }, - { // band 2 - { 17, 131, 148}, { 11, 112, 140}, { 5, 87, 118}, - { 2, 63, 90}, { 1, 42, 63}, { 1, 19, 31}, - }, - { // band 3 - { 12, 151, 168}, { 6, 116, 152}, { 1, 76, 115}, - { 1, 50, 81}, { 1, 32, 52}, { 1, 14, 23}, - }, - { // band 4 - { 10, 174, 191}, { 3, 130, 172}, { 1, 80, 126}, - { 1, 53, 88}, { 1, 32, 55}, { 1, 14, 24}, - }, - { // band 5 - { 19, 219, 237}, { 3, 168, 211}, { 1, 90, 142}, - { 1, 53, 91}, { 1, 29, 51}, { 1, 12, 21}, - }, - }, - { // Intra - { // band 0 - { 21, 46, 184}, { 10, 53, 130}, { 2, 49, 78}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 3, 169, 198}, { 37, 165, 196}, { 26, 134, 176}, - { 11, 108, 149}, { 5, 81, 112}, { 3, 47, 64}, - }, - { // band 2 - { 11, 183, 215}, { 8, 142, 192}, { 2, 91, 141}, - { 1, 62, 100}, { 1, 38, 62}, { 1, 17, 28}, - }, - { // band 3 - { 12, 190, 223}, { 6, 149, 199}, { 1, 88, 139}, - { 1, 56, 93}, { 1, 31, 54}, { 1, 13, 21}, - }, - { // band 4 - { 11, 197, 230}, { 3, 154, 204}, { 1, 83, 134}, - { 1, 50, 86}, { 1, 28, 49}, { 1, 12, 21}, - }, - { // band 5 - { 17, 211, 240}, { 2, 167, 217}, { 1, 88, 143}, - { 1, 53, 91}, { 1, 30, 53}, { 1, 14, 24}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {151, 30, 151}, { 50, 36, 105}, { 8, 34, 66}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 39, 111, 160}, { 62, 111, 165}, { 37, 99, 147}, - { 15, 77, 118}, { 3, 47, 73}, { 1, 17, 27}, - }, - { // band 2 - { 48, 170, 190}, { 32, 135, 180}, { 11, 100, 149}, - { 4, 76, 116}, { 1, 51, 80}, { 1, 22, 36}, - }, - { // band 3 - { 39, 191, 208}, { 18, 141, 191}, { 3, 96, 150}, - { 1, 66, 110}, { 1, 41, 69}, { 1, 17, 28}, - }, - { // band 4 - { 32, 209, 219}, { 8, 152, 201}, { 1, 96, 153}, - { 1, 63, 106}, { 1, 38, 66}, { 1, 17, 29}, - }, - { // band 5 - { 33, 230, 237}, { 5, 173, 214}, { 1, 100, 155}, - { 1, 62, 105}, { 1, 38, 66}, { 1, 18, 32}, - }, - }, - { // Inter - { // band 0 - {149, 38, 231}, { 59, 51, 186}, { 12, 54, 117}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 53, 179, 226}, {126, 176, 223}, { 58, 147, 202}, - { 28, 118, 174}, { 15, 94, 138}, { 14, 63, 87}, - }, - { // band 2 - { 58, 196, 232}, { 26, 158, 213}, { 5, 106, 166}, - { 1, 75, 124}, { 1, 46, 79}, { 1, 23, 39}, - }, - { // band 3 - { 46, 203, 235}, { 17, 162, 213}, { 2, 104, 165}, - { 1, 72, 120}, { 1, 44, 74}, { 1, 22, 33}, - }, - { // band 4 - { 37, 213, 238}, { 8, 167, 216}, { 1, 104, 168}, - { 1, 68, 119}, { 1, 40, 67}, { 1, 17, 29}, - }, - { // band 5 - { 30, 228, 239}, { 4, 181, 213}, { 1, 103, 153}, - { 1, 65, 110}, { 1, 43, 79}, { 1, 27, 56}, - }, - }, - }, - }, - { // TX_SIZE 3 - { // Y plane - { // Intra - { // band 0 - { 76, 25, 53}, { 9, 18, 32}, { 1, 12, 18}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 29, 55, 91}, { 19, 58, 95}, { 15, 57, 89}, - { 12, 49, 77}, { 3, 29, 44}, { 1, 8, 12}, - }, - { // band 2 - { 32, 160, 148}, { 33, 143, 146}, { 19, 122, 132}, - { 6, 90, 102}, { 1, 58, 70}, { 1, 17, 24}, - }, - { // band 3 - { 16, 181, 181}, { 6, 142, 165}, { 1, 90, 120}, - { 1, 50, 71}, { 1, 25, 38}, { 1, 9, 14}, - }, - { // band 4 - { 13, 203, 203}, { 3, 154, 176}, { 1, 80, 108}, - { 1, 41, 61}, { 1, 24, 37}, { 1, 11, 17}, - }, - { // band 5 - { 6, 234, 240}, { 1, 178, 204}, { 1, 80, 119}, - { 1, 45, 71}, { 1, 26, 42}, { 1, 12, 19}, - }, - }, - { // Intra - { // band 0 - { 78, 20, 135}, { 25, 18, 101}, { 5, 19, 57}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 7, 144, 183}, {117, 151, 195}, {109, 151, 187}, - { 39, 130, 168}, { 11, 100, 125}, { 4, 59, 64}, - }, - { // band 2 - { 20, 184, 212}, { 12, 148, 191}, { 2, 98, 141}, - { 1, 65, 100}, { 1, 39, 61}, { 1, 14, 22}, - }, - { // band 3 - { 15, 194, 222}, { 6, 153, 198}, { 1, 92, 138}, - { 1, 58, 91}, { 1, 32, 52}, { 1, 12, 18}, - }, - { // band 4 - { 14, 206, 232}, { 3, 162, 206}, { 1, 89, 134}, - { 1, 52, 83}, { 1, 28, 46}, { 1, 11, 17}, - }, - { // band 5 - { 6, 225, 241}, { 1, 175, 210}, { 1, 81, 125}, - { 1, 48, 78}, { 1, 28, 46}, { 1, 13, 21}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {124, 23, 93}, { 31, 24, 63}, { 6, 24, 46}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 23, 86, 126}, { 45, 90, 145}, { 31, 91, 133}, - { 19, 80, 114}, { 7, 53, 72}, { 1, 20, 27}, - }, - { // band 2 - { 51, 186, 189}, { 48, 159, 182}, { 33, 128, 156}, - { 15, 92, 124}, { 2, 62, 83}, { 1, 29, 43}, - }, - { // band 3 - { 36, 198, 211}, { 15, 156, 187}, { 3, 97, 137}, - { 1, 61, 93}, { 1, 35, 57}, { 1, 15, 23}, - }, - { // band 4 - { 34, 219, 223}, { 9, 162, 193}, { 1, 91, 136}, - { 1, 58, 92}, { 1, 35, 54}, { 1, 14, 23}, - }, - { // band 5 - { 19, 243, 243}, { 3, 191, 208}, { 1, 91, 137}, - { 1, 56, 90}, { 1, 34, 55}, { 1, 16, 24}, - }, - }, - { // Inter - { // band 0 - {119, 20, 197}, { 19, 29, 156}, { 3, 30, 107}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 24, 192, 226}, {161, 193, 227}, { 97, 185, 222}, - { 31, 158, 204}, { 16, 122, 165}, { 17, 84, 112}, - }, - { // band 2 - { 26, 202, 229}, { 11, 165, 210}, { 2, 103, 152}, - { 1, 68, 104}, { 1, 42, 70}, { 1, 16, 36}, - }, - { // band 3 - { 24, 209, 237}, { 6, 169, 214}, { 1, 102, 154}, - { 1, 65, 107}, { 1, 45, 68}, { 1, 17, 24}, - }, - { // band 4 - { 19, 219, 243}, { 4, 183, 226}, { 1, 115, 172}, - { 1, 73, 119}, { 1, 43, 77}, { 1, 15, 37}, - }, - { // band 5 - { 11, 237, 241}, { 2, 190, 216}, { 1, 108, 146}, - { 1, 59, 94}, { 1, 40, 67}, { 1, 30, 53}, - }, - }, - }, - }, -#if CONFIG_TX64X64 - { // TX_SIZE 4 - { // Y plane - { // Intra - { // band 0 - { 76, 25, 53}, { 9, 18, 32}, { 1, 12, 18}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 29, 55, 91}, { 19, 58, 95}, { 15, 57, 89}, - { 12, 49, 77}, { 3, 29, 44}, { 1, 8, 12}, - }, - { // band 2 - { 32, 160, 148}, { 33, 143, 146}, { 19, 122, 132}, - { 6, 90, 102}, { 1, 58, 70}, { 1, 17, 24}, - }, - { // band 3 - { 16, 181, 181}, { 6, 142, 165}, { 1, 90, 120}, - { 1, 50, 71}, { 1, 25, 38}, { 1, 9, 14}, - }, - { // band 4 - { 13, 203, 203}, { 3, 154, 176}, { 1, 80, 108}, - { 1, 41, 61}, { 1, 24, 37}, { 1, 11, 17}, - }, - { // band 5 - { 6, 234, 240}, { 1, 178, 204}, { 1, 80, 119}, - { 1, 45, 71}, { 1, 26, 42}, { 1, 12, 19}, - }, - }, - { // Intra - { // band 0 - { 78, 20, 135}, { 25, 18, 101}, { 5, 19, 57}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 7, 144, 183}, {117, 151, 195}, {109, 151, 187}, - { 39, 130, 168}, { 11, 100, 125}, { 4, 59, 64}, - }, - { // band 2 - { 20, 184, 212}, { 12, 148, 191}, { 2, 98, 141}, - { 1, 65, 100}, { 1, 39, 61}, { 1, 14, 22}, - }, - { // band 3 - { 15, 194, 222}, { 6, 153, 198}, { 1, 92, 138}, - { 1, 58, 91}, { 1, 32, 52}, { 1, 12, 18}, - }, - { // band 4 - { 14, 206, 232}, { 3, 162, 206}, { 1, 89, 134}, - { 1, 52, 83}, { 1, 28, 46}, { 1, 11, 17}, - }, - { // band 5 - { 6, 225, 241}, { 1, 175, 210}, { 1, 81, 125}, - { 1, 48, 78}, { 1, 28, 46}, { 1, 13, 21}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {124, 23, 93}, { 31, 24, 63}, { 6, 24, 46}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 23, 86, 126}, { 45, 90, 145}, { 31, 91, 133}, - { 19, 80, 114}, { 7, 53, 72}, { 1, 20, 27}, - }, - { // band 2 - { 51, 186, 189}, { 48, 159, 182}, { 33, 128, 156}, - { 15, 92, 124}, { 2, 62, 83}, { 1, 29, 43}, - }, - { // band 3 - { 36, 198, 211}, { 15, 156, 187}, { 3, 97, 137}, - { 1, 61, 93}, { 1, 35, 57}, { 1, 15, 23}, - }, - { // band 4 - { 34, 219, 223}, { 9, 162, 193}, { 1, 91, 136}, - { 1, 58, 92}, { 1, 35, 54}, { 1, 14, 23}, - }, - { // band 5 - { 19, 243, 243}, { 3, 191, 208}, { 1, 91, 137}, - { 1, 56, 90}, { 1, 34, 55}, { 1, 16, 24}, - }, - }, - { // Inter - { // band 0 - {119, 20, 197}, { 19, 29, 156}, { 3, 30, 107}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 24, 192, 226}, {161, 193, 227}, { 97, 185, 222}, - { 31, 158, 204}, { 16, 122, 165}, { 17, 84, 112}, - }, - { // band 2 - { 26, 202, 229}, { 11, 165, 210}, { 2, 103, 152}, - { 1, 68, 104}, { 1, 42, 70}, { 1, 16, 36}, - }, - { // band 3 - { 24, 209, 237}, { 6, 169, 214}, { 1, 102, 154}, - { 1, 65, 107}, { 1, 45, 68}, { 1, 17, 24}, - }, - { // band 4 - { 19, 219, 243}, { 4, 183, 226}, { 1, 115, 172}, - { 1, 73, 119}, { 1, 43, 77}, { 1, 15, 37}, - }, - { // band 5 - { 11, 237, 241}, { 2, 190, 216}, { 1, 108, 146}, - { 1, 59, 94}, { 1, 40, 67}, { 1, 30, 53}, - }, - }, - }, - }, -#endif // CONFIG_TX64X64 - }, - { // Q_Index 1 -#if CONFIG_CHROMA_2X2 - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {174, 30, 159}, { 76, 38, 115}, { 15, 33, 65}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 60, 80, 153}, { 72, 75, 147}, { 36, 68, 129}, - { 15, 59, 104}, { 4, 45, 74}, { 1, 28, 45}, - }, - { // band 2 - { 70, 122, 186}, { 55, 104, 175}, { 21, 83, 144}, - { 8, 67, 112}, { 2, 51, 82}, { 1, 34, 57}, - }, - { // band 3 - { 97, 144, 207}, { 52, 109, 195}, { 16, 77, 153}, - { 4, 58, 113}, { 1, 43, 77}, { 1, 27, 48}, - }, - { // band 4 - {128, 148, 229}, { 76, 104, 210}, { 18, 77, 159}, - { 4, 65, 110}, { 1, 52, 82}, { 1, 31, 55}, - }, - { // band 5 - {165, 51, 238}, {128, 50, 230}, { 57, 49, 185}, - { 28, 47, 130}, { 12, 44, 96}, { 3, 36, 60}, - }, - }, - { // Intra - { // band 0 - {169, 103, 203}, {117, 96, 176}, { 56, 81, 137}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 31, 150, 224}, { 49, 128, 212}, { 19, 92, 165}, - { 6, 67, 116}, { 2, 43, 71}, { 1, 21, 36}, - }, - { // band 2 - { 58, 156, 230}, { 47, 130, 215}, { 7, 87, 158}, - { 2, 63, 114}, { 1, 39, 71}, { 1, 18, 36}, - }, - { // band 3 - { 85, 176, 240}, { 43, 138, 226}, { 8, 93, 172}, - { 2, 70, 127}, { 1, 46, 81}, { 1, 26, 47}, - }, - { // band 4 - {155, 144, 248}, { 93, 116, 235}, { 21, 83, 180}, - { 4, 59, 119}, { 1, 43, 80}, { 1, 25, 50}, - }, - { // band 5 - {203, 61, 250}, {171, 57, 243}, { 71, 57, 199}, - { 31, 49, 144}, { 13, 42, 96}, { 7, 30, 52}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {204, 44, 204}, {137, 57, 184}, { 72, 62, 152}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {145, 117, 236}, {151, 112, 231}, { 87, 95, 208}, - { 31, 77, 165}, { 5, 49, 98}, { 1, 24, 39}, - }, - { // band 2 - {146, 152, 241}, {140, 132, 236}, { 41, 103, 209}, - { 10, 86, 165}, { 2, 55, 106}, { 1, 25, 58}, - }, - { // band 3 - {154, 181, 249}, { 84, 143, 240}, { 23, 114, 210}, - { 6, 102, 182}, { 2, 71, 137}, { 1, 35, 90}, - }, - { // band 4 - {184, 150, 251}, {115, 130, 244}, { 34, 105, 215}, - { 15, 89, 173}, { 1, 51, 141}, {128, 128, 128}, - }, - { // band 5 - {211, 71, 253}, {193, 78, 249}, {106, 91, 232}, - { 61, 87, 198}, { 85, 153, 254}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {232, 104, 242}, {165, 114, 227}, { 96, 120, 206}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {137, 178, 250}, {146, 153, 245}, { 74, 108, 205}, - { 41, 81, 149}, { 24, 55, 104}, { 13, 36, 68}, - }, - { // band 2 - {147, 185, 252}, {127, 161, 246}, { 30, 104, 208}, - { 11, 74, 154}, { 6, 54, 100}, { 2, 29, 63}, - }, - { // band 3 - {163, 191, 254}, {101, 161, 249}, { 22, 114, 215}, - { 6, 89, 173}, { 1, 65, 120}, { 1, 1, 170}, - }, - { // band 4 - {197, 160, 254}, {142, 141, 251}, { 39, 102, 218}, - { 10, 76, 158}, { 1, 56, 122}, {128, 128, 128}, - }, - { // band 5 - {224, 76, 254}, {215, 84, 253}, {107, 85, 232}, - { 43, 71, 177}, { 1, 1, 254}, {128, 128, 128}, - }, - }, - }, - }, -#endif - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {174, 30, 159}, { 76, 38, 115}, { 15, 33, 65}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 60, 80, 153}, { 72, 75, 147}, { 36, 68, 129}, - { 15, 59, 104}, { 4, 45, 74}, { 1, 28, 45}, - }, - { // band 2 - { 70, 122, 186}, { 55, 104, 175}, { 21, 83, 144}, - { 8, 67, 112}, { 2, 51, 82}, { 1, 34, 57}, - }, - { // band 3 - { 97, 144, 207}, { 52, 109, 195}, { 16, 77, 153}, - { 4, 58, 113}, { 1, 43, 77}, { 1, 27, 48}, - }, - { // band 4 - {128, 148, 229}, { 76, 104, 210}, { 18, 77, 159}, - { 4, 65, 110}, { 1, 52, 82}, { 1, 31, 55}, - }, - { // band 5 - {165, 51, 238}, {128, 50, 230}, { 57, 49, 185}, - { 28, 47, 130}, { 12, 44, 96}, { 3, 36, 60}, - }, - }, - { // Intra - { // band 0 - {169, 103, 203}, {117, 96, 176}, { 56, 81, 137}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 31, 150, 224}, { 49, 128, 212}, { 19, 92, 165}, - { 6, 67, 116}, { 2, 43, 71}, { 1, 21, 36}, - }, - { // band 2 - { 58, 156, 230}, { 47, 130, 215}, { 7, 87, 158}, - { 2, 63, 114}, { 1, 39, 71}, { 1, 18, 36}, - }, - { // band 3 - { 85, 176, 240}, { 43, 138, 226}, { 8, 93, 172}, - { 2, 70, 127}, { 1, 46, 81}, { 1, 26, 47}, - }, - { // band 4 - {155, 144, 248}, { 93, 116, 235}, { 21, 83, 180}, - { 4, 59, 119}, { 1, 43, 80}, { 1, 25, 50}, - }, - { // band 5 - {203, 61, 250}, {171, 57, 243}, { 71, 57, 199}, - { 31, 49, 144}, { 13, 42, 96}, { 7, 30, 52}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {204, 44, 204}, {137, 57, 184}, { 72, 62, 152}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {145, 117, 236}, {151, 112, 231}, { 87, 95, 208}, - { 31, 77, 165}, { 5, 49, 98}, { 1, 24, 39}, - }, - { // band 2 - {146, 152, 241}, {140, 132, 236}, { 41, 103, 209}, - { 10, 86, 165}, { 2, 55, 106}, { 1, 25, 58}, - }, - { // band 3 - {154, 181, 249}, { 84, 143, 240}, { 23, 114, 210}, - { 6, 102, 182}, { 2, 71, 137}, { 1, 35, 90}, - }, - { // band 4 - {184, 150, 251}, {115, 130, 244}, { 34, 105, 215}, - { 15, 89, 173}, { 1, 51, 141}, {128, 128, 128}, - }, - { // band 5 - {211, 71, 253}, {193, 78, 249}, {106, 91, 232}, - { 61, 87, 198}, { 85, 153, 254}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {232, 104, 242}, {165, 114, 227}, { 96, 120, 206}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {137, 178, 250}, {146, 153, 245}, { 74, 108, 205}, - { 41, 81, 149}, { 24, 55, 104}, { 13, 36, 68}, - }, - { // band 2 - {147, 185, 252}, {127, 161, 246}, { 30, 104, 208}, - { 11, 74, 154}, { 6, 54, 100}, { 2, 29, 63}, - }, - { // band 3 - {163, 191, 254}, {101, 161, 249}, { 22, 114, 215}, - { 6, 89, 173}, { 1, 65, 120}, { 1, 1, 170}, - }, - { // band 4 - {197, 160, 254}, {142, 141, 251}, { 39, 102, 218}, - { 10, 76, 158}, { 1, 56, 122}, {128, 128, 128}, - }, - { // band 5 - {224, 76, 254}, {215, 84, 253}, {107, 85, 232}, - { 43, 71, 177}, { 1, 1, 254}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 1 - { // Y plane - { // Intra - { // band 0 - { 68, 37, 120}, { 21, 34, 82}, { 5, 26, 49}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 41, 89, 138}, { 56, 83, 132}, { 31, 73, 115}, - { 16, 62, 92}, { 5, 45, 62}, { 1, 24, 32}, - }, - { // band 2 - { 48, 139, 165}, { 30, 114, 160}, { 13, 92, 132}, - { 6, 72, 103}, { 3, 49, 72}, { 1, 26, 41}, - }, - { // band 3 - { 44, 162, 191}, { 20, 127, 175}, { 5, 90, 137}, - { 1, 62, 100}, { 1, 38, 63}, { 1, 20, 32}, - }, - { // band 4 - { 51, 184, 213}, { 16, 137, 193}, { 2, 89, 143}, - { 1, 60, 102}, { 1, 39, 66}, { 1, 23, 37}, - }, - { // band 5 - { 76, 200, 235}, { 27, 150, 216}, { 3, 99, 164}, - { 1, 70, 119}, { 1, 45, 77}, { 1, 22, 38}, - }, - }, - { // Intra - { // band 0 - { 81, 112, 199}, { 49, 101, 164}, { 19, 80, 119}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 12, 181, 217}, { 48, 151, 212}, { 38, 118, 180}, - { 22, 95, 140}, { 11, 67, 92}, { 13, 46, 44}, - }, - { // band 2 - { 29, 188, 226}, { 19, 147, 210}, { 5, 95, 154}, - { 4, 68, 106}, { 3, 44, 60}, { 1, 24, 27}, - }, - { // band 3 - { 30, 195, 234}, { 15, 153, 216}, { 3, 95, 156}, - { 2, 66, 108}, { 2, 44, 62}, { 1, 24, 29}, - }, - { // band 4 - { 36, 203, 243}, { 12, 162, 225}, { 2, 98, 163}, - { 2, 67, 113}, { 2, 45, 68}, { 1, 24, 34}, - }, - { // band 5 - { 86, 207, 248}, { 35, 165, 236}, { 3, 107, 180}, - { 1, 73, 128}, { 1, 45, 78}, { 1, 20, 34}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {188, 37, 205}, {118, 51, 172}, { 56, 57, 135}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {116, 135, 225}, {144, 123, 221}, { 72, 103, 197}, - { 35, 77, 153}, { 15, 47, 82}, { 6, 25, 34}, - }, - { // band 2 - {128, 171, 233}, { 82, 142, 226}, { 31, 106, 191}, - { 16, 82, 146}, { 9, 59, 98}, { 4, 33, 54}, - }, - { // band 3 - {126, 197, 241}, { 66, 155, 230}, { 18, 108, 190}, - { 7, 82, 148}, { 3, 58, 98}, { 1, 25, 50}, - }, - { // band 4 - {117, 207, 244}, { 44, 163, 233}, { 9, 112, 191}, - { 5, 84, 148}, { 3, 61, 87}, { 1, 28, 38}, - }, - { // band 5 - {112, 214, 249}, { 39, 174, 240}, { 6, 125, 205}, - { 4, 96, 163}, { 5, 66, 100}, { 1, 128, 254}, - }, - }, - { // Inter - { // band 0 - {227, 70, 234}, {145, 91, 213}, { 61, 100, 173}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {108, 198, 243}, {171, 172, 240}, {118, 130, 210}, - {104, 107, 165}, { 64, 85, 114}, { 55, 64, 60}, - }, - { // band 2 - {110, 208, 247}, { 64, 175, 237}, { 24, 112, 187}, - { 24, 81, 133}, { 24, 63, 83}, { 21, 47, 53}, - }, - { // band 3 - { 91, 218, 249}, { 46, 188, 238}, { 8, 113, 184}, - { 5, 83, 137}, { 6, 62, 95}, { 17, 44, 94}, - }, - { // band 4 - { 84, 216, 248}, { 30, 187, 237}, { 2, 117, 188}, - { 1, 88, 141}, { 3, 63, 98}, { 1, 1, 1}, - }, - { // band 5 - {116, 218, 252}, { 47, 186, 242}, { 2, 132, 204}, - { 1, 106, 175}, { 1, 88, 104}, { 1, 254, 128}, - }, - }, - }, - }, - { // TX_SIZE 2 - { // Y plane - { // Intra - { // band 0 - { 35, 41, 129}, { 12, 30, 70}, { 2, 19, 32}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 30, 77, 116}, { 39, 70, 110}, { 20, 58, 96}, - { 8, 47, 77}, { 2, 33, 52}, { 1, 17, 26}, - }, - { // band 2 - { 31, 123, 146}, { 18, 103, 140}, { 7, 81, 119}, - { 2, 62, 95}, { 1, 44, 70}, { 1, 26, 42}, - }, - { // band 3 - { 21, 149, 170}, { 9, 114, 158}, { 2, 80, 126}, - { 1, 57, 94}, { 1, 36, 61}, { 1, 18, 31}, - }, - { // band 4 - { 20, 178, 199}, { 6, 134, 183}, { 1, 87, 139}, - { 1, 60, 100}, { 1, 37, 64}, { 1, 18, 31}, - }, - { // band 5 - { 36, 218, 233}, { 6, 160, 207}, { 1, 92, 147}, - { 1, 59, 101}, { 1, 35, 62}, { 1, 18, 31}, - }, - }, - { // Intra - { // band 0 - { 17, 62, 211}, { 14, 62, 153}, { 5, 50, 84}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 11, 180, 205}, { 87, 160, 205}, { 53, 128, 184}, - { 27, 106, 156}, { 13, 79, 115}, { 6, 46, 67}, - }, - { // band 2 - { 32, 194, 220}, { 20, 145, 202}, { 4, 96, 152}, - { 1, 67, 111}, { 1, 42, 70}, { 1, 21, 37}, - }, - { // band 3 - { 30, 204, 228}, { 14, 152, 207}, { 1, 92, 149}, - { 1, 61, 103}, { 1, 34, 59}, { 1, 16, 28}, - }, - { // band 4 - { 27, 213, 235}, { 7, 159, 210}, { 1, 88, 143}, - { 1, 55, 94}, { 1, 31, 53}, { 1, 16, 27}, - }, - { // band 5 - { 28, 223, 243}, { 4, 173, 217}, { 1, 91, 146}, - { 1, 58, 98}, { 1, 35, 60}, { 1, 19, 33}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {172, 37, 202}, { 83, 51, 156}, { 24, 53, 110}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 76, 134, 206}, {110, 124, 200}, { 47, 106, 180}, - { 15, 82, 145}, { 3, 48, 83}, { 1, 19, 32}, - }, - { // band 2 - { 80, 176, 220}, { 49, 145, 212}, { 17, 112, 180}, - { 7, 84, 140}, { 1, 53, 89}, { 1, 27, 43}, - }, - { // band 3 - { 74, 201, 232}, { 38, 158, 221}, { 8, 112, 179}, - { 2, 79, 132}, { 1, 47, 82}, { 1, 26, 42}, - }, - { // band 4 - { 73, 215, 239}, { 28, 169, 227}, { 3, 112, 176}, - { 1, 74, 126}, { 1, 48, 79}, { 1, 27, 44}, - }, - { // band 5 - { 71, 233, 244}, { 18, 180, 230}, { 1, 114, 180}, - { 1, 80, 134}, { 1, 51, 85}, { 1, 26, 36}, - }, - }, - { // Inter - { // band 0 - {213, 34, 244}, {126, 57, 212}, { 46, 67, 151}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {120, 202, 245}, {198, 173, 241}, {119, 146, 224}, - { 76, 126, 195}, { 44, 102, 159}, { 40, 76, 115}, - }, - { // band 2 - {120, 215, 248}, { 69, 171, 237}, { 23, 119, 194}, - { 10, 86, 147}, { 2, 56, 94}, { 1, 25, 44}, - }, - { // band 3 - {102, 226, 250}, { 53, 183, 239}, { 9, 118, 188}, - { 2, 78, 131}, { 1, 48, 89}, { 1, 17, 36}, - }, - { // band 4 - { 86, 235, 252}, { 34, 194, 240}, { 2, 109, 173}, - { 1, 68, 118}, { 1, 44, 79}, { 1, 1, 38}, - }, - { // band 5 - { 59, 236, 243}, { 11, 189, 228}, { 1, 112, 187}, - { 1, 88, 145}, { 1, 55, 92}, { 1, 1, 128}, - }, - }, - }, - }, - { // TX_SIZE 3 - { // Y plane - { // Intra - { // band 0 - { 41, 40, 104}, { 12, 31, 64}, { 2, 16, 28}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 65, 58, 132}, { 50, 61, 130}, { 40, 57, 116}, - { 22, 46, 87}, { 2, 28, 44}, { 1, 11, 17}, - }, - { // band 2 - { 55, 139, 135}, { 46, 122, 132}, { 21, 89, 110}, - { 6, 60, 78}, { 1, 38, 54}, { 1, 17, 27}, - }, - { // band 3 - { 29, 167, 161}, { 10, 120, 141}, { 1, 69, 98}, - { 1, 42, 66}, { 1, 28, 44}, { 1, 15, 24}, - }, - { // band 4 - { 19, 191, 180}, { 4, 125, 154}, { 1, 70, 107}, - { 1, 48, 77}, { 1, 33, 53}, { 1, 17, 28}, - }, - { // band 5 - { 16, 238, 231}, { 2, 163, 198}, { 1, 85, 134}, - { 1, 54, 90}, { 1, 34, 57}, { 1, 17, 29}, - }, - }, - { // Intra - { // band 0 - { 70, 15, 216}, { 40, 18, 164}, { 14, 17, 83}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 25, 150, 200}, {185, 154, 211}, {123, 137, 199}, - { 67, 119, 177}, { 31, 96, 137}, { 18, 63, 86}, - }, - { // band 2 - { 57, 187, 223}, { 35, 148, 207}, { 7, 104, 159}, - { 2, 72, 113}, { 1, 44, 71}, { 1, 20, 34}, - }, - { // band 3 - { 44, 203, 233}, { 18, 157, 212}, { 1, 98, 150}, - { 1, 61, 102}, { 1, 38, 62}, { 1, 19, 31}, - }, - { // band 4 - { 41, 215, 238}, { 11, 166, 215}, { 1, 94, 146}, - { 1, 60, 101}, { 1, 37, 63}, { 1, 17, 28}, - }, - { // band 5 - { 19, 236, 246}, { 3, 188, 223}, { 1, 95, 146}, - { 1, 58, 95}, { 1, 34, 56}, { 1, 17, 27}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {146, 27, 156}, { 49, 32, 116}, { 10, 39, 77}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 47, 101, 172}, { 93, 100, 178}, { 58, 91, 165}, - { 26, 75, 134}, { 4, 49, 82}, { 2, 22, 33}, - }, - { // band 2 - { 60, 158, 196}, { 44, 135, 186}, { 25, 106, 157}, - { 8, 81, 124}, { 2, 56, 86}, { 1, 28, 45}, - }, - { // band 3 - { 44, 169, 212}, { 15, 138, 196}, { 2, 100, 157}, - { 1, 74, 119}, { 1, 49, 76}, { 1, 20, 34}, - }, - { // band 4 - { 38, 199, 231}, { 11, 158, 214}, { 1, 111, 167}, - { 1, 76, 122}, { 1, 44, 76}, { 1, 17, 39}, - }, - { // band 5 - { 40, 236, 246}, { 10, 187, 230}, { 1, 115, 175}, - { 1, 74, 122}, { 1, 42, 71}, { 1, 14, 59}, - }, - }, - { // Inter - { // band 0 - {161, 26, 237}, { 65, 46, 209}, { 21, 46, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 87, 229, 245}, {206, 214, 244}, {148, 186, 236}, - { 89, 165, 221}, { 41, 132, 186}, { 37, 93, 141}, - }, - { // band 2 - { 93, 231, 246}, { 47, 181, 231}, { 8, 117, 188}, - { 2, 84, 138}, { 1, 43, 87}, { 1, 27, 41}, - }, - { // band 3 - { 80, 239, 250}, { 28, 190, 236}, { 1, 119, 183}, - { 1, 84, 135}, { 1, 81, 69}, { 1, 102, 1}, - }, - { // band 4 - { 67, 245, 252}, { 22, 206, 242}, { 1, 130, 195}, - { 1, 77, 136}, { 1, 35, 88}, {128, 128, 128}, - }, - { // band 5 - { 43, 250, 228}, { 31, 185, 204}, { 6, 101, 183}, - { 1, 92, 151}, { 1, 84, 137}, {128, 128, 128}, - }, - }, - }, - }, -#if CONFIG_TX64X64 - { // TX_SIZE 4 - { // Y plane - { // Intra - { // band 0 - { 41, 40, 104}, { 12, 31, 64}, { 2, 16, 28}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 65, 58, 132}, { 50, 61, 130}, { 40, 57, 116}, - { 22, 46, 87}, { 2, 28, 44}, { 1, 11, 17}, - }, - { // band 2 - { 55, 139, 135}, { 46, 122, 132}, { 21, 89, 110}, - { 6, 60, 78}, { 1, 38, 54}, { 1, 17, 27}, - }, - { // band 3 - { 29, 167, 161}, { 10, 120, 141}, { 1, 69, 98}, - { 1, 42, 66}, { 1, 28, 44}, { 1, 15, 24}, - }, - { // band 4 - { 19, 191, 180}, { 4, 125, 154}, { 1, 70, 107}, - { 1, 48, 77}, { 1, 33, 53}, { 1, 17, 28}, - }, - { // band 5 - { 16, 238, 231}, { 2, 163, 198}, { 1, 85, 134}, - { 1, 54, 90}, { 1, 34, 57}, { 1, 17, 29}, - }, - }, - { // Intra - { // band 0 - { 70, 15, 216}, { 40, 18, 164}, { 14, 17, 83}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 25, 150, 200}, {185, 154, 211}, {123, 137, 199}, - { 67, 119, 177}, { 31, 96, 137}, { 18, 63, 86}, - }, - { // band 2 - { 57, 187, 223}, { 35, 148, 207}, { 7, 104, 159}, - { 2, 72, 113}, { 1, 44, 71}, { 1, 20, 34}, - }, - { // band 3 - { 44, 203, 233}, { 18, 157, 212}, { 1, 98, 150}, - { 1, 61, 102}, { 1, 38, 62}, { 1, 19, 31}, - }, - { // band 4 - { 41, 215, 238}, { 11, 166, 215}, { 1, 94, 146}, - { 1, 60, 101}, { 1, 37, 63}, { 1, 17, 28}, - }, - { // band 5 - { 19, 236, 246}, { 3, 188, 223}, { 1, 95, 146}, - { 1, 58, 95}, { 1, 34, 56}, { 1, 17, 27}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {146, 27, 156}, { 49, 32, 116}, { 10, 39, 77}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 47, 101, 172}, { 93, 100, 178}, { 58, 91, 165}, - { 26, 75, 134}, { 4, 49, 82}, { 2, 22, 33}, - }, - { // band 2 - { 60, 158, 196}, { 44, 135, 186}, { 25, 106, 157}, - { 8, 81, 124}, { 2, 56, 86}, { 1, 28, 45}, - }, - { // band 3 - { 44, 169, 212}, { 15, 138, 196}, { 2, 100, 157}, - { 1, 74, 119}, { 1, 49, 76}, { 1, 20, 34}, - }, - { // band 4 - { 38, 199, 231}, { 11, 158, 214}, { 1, 111, 167}, - { 1, 76, 122}, { 1, 44, 76}, { 1, 17, 39}, - }, - { // band 5 - { 40, 236, 246}, { 10, 187, 230}, { 1, 115, 175}, - { 1, 74, 122}, { 1, 42, 71}, { 1, 14, 59}, - }, - }, - { // Inter - { // band 0 - {161, 26, 237}, { 65, 46, 209}, { 21, 46, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 87, 229, 245}, {206, 214, 244}, {148, 186, 236}, - { 89, 165, 221}, { 41, 132, 186}, { 37, 93, 141}, - }, - { // band 2 - { 93, 231, 246}, { 47, 181, 231}, { 8, 117, 188}, - { 2, 84, 138}, { 1, 43, 87}, { 1, 27, 41}, - }, - { // band 3 - { 80, 239, 250}, { 28, 190, 236}, { 1, 119, 183}, - { 1, 84, 135}, { 1, 81, 69}, { 1, 102, 1}, - }, - { // band 4 - { 67, 245, 252}, { 22, 206, 242}, { 1, 130, 195}, - { 1, 77, 136}, { 1, 35, 88}, {128, 128, 128}, - }, - { // band 5 - { 43, 250, 228}, { 31, 185, 204}, { 6, 101, 183}, - { 1, 92, 151}, { 1, 84, 137}, {128, 128, 128}, - }, - }, - }, - }, -#endif // CONFIG_TX64X64 - }, - { // Q_Index 2 -#if CONFIG_CHROMA_2X2 - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {181, 22, 175}, { 96, 37, 147}, { 35, 41, 105}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 80, 95, 197}, {111, 92, 193}, { 59, 87, 175}, - { 29, 79, 150}, { 10, 65, 118}, { 2, 47, 82}, - }, - { // band 2 - { 90, 141, 216}, { 77, 120, 210}, { 23, 95, 184}, - { 11, 81, 151}, { 6, 75, 130}, { 2, 58, 113}, - }, - { // band 3 - {122, 167, 231}, { 66, 119, 225}, { 26, 87, 189}, - { 7, 76, 151}, { 2, 63, 125}, { 1, 59, 77}, - }, - { // band 4 - {162, 147, 244}, {110, 97, 236}, { 32, 88, 204}, - { 11, 89, 174}, { 5, 78, 151}, {128, 128, 128}, - }, - { // band 5 - {205, 59, 251}, {176, 68, 248}, { 90, 71, 223}, - { 49, 72, 188}, { 17, 74, 203}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - {188, 70, 207}, {140, 73, 189}, { 85, 73, 163}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 59, 144, 239}, { 79, 126, 237}, { 31, 102, 202}, - { 10, 81, 153}, { 3, 56, 102}, { 2, 33, 59}, - }, - { // band 2 - {100, 152, 243}, { 80, 129, 236}, { 14, 94, 194}, - { 4, 72, 150}, { 1, 50, 103}, { 1, 35, 60}, - }, - { // band 3 - {130, 183, 247}, { 70, 139, 242}, { 19, 100, 203}, - { 4, 83, 159}, { 1, 59, 119}, { 1, 44, 72}, - }, - { // band 4 - {197, 138, 252}, {135, 107, 247}, { 31, 86, 210}, - { 7, 74, 160}, { 1, 53, 107}, {128, 128, 128}, - }, - { // band 5 - {229, 54, 254}, {200, 51, 251}, { 83, 61, 226}, - { 33, 55, 177}, { 12, 74, 145}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {229, 20, 235}, {183, 37, 221}, {127, 47, 198}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {188, 115, 251}, {208, 110, 250}, {101, 99, 235}, - { 38, 81, 197}, { 9, 56, 132}, { 9, 52, 63}, - }, - { // band 2 - {189, 150, 252}, {186, 137, 251}, { 54, 107, 236}, - { 14, 90, 195}, { 1, 89, 104}, {128, 128, 128}, - }, - { // band 3 - {209, 180, 254}, {142, 145, 253}, { 51, 130, 236}, - { 6, 128, 214}, { 1, 128, 254}, {128, 128, 128}, - }, - { // band 4 - {231, 140, 254}, {194, 128, 254}, { 75, 119, 233}, - {128, 23, 230}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {244, 59, 254}, {239, 81, 254}, {128, 85, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {246, 55, 247}, {197, 64, 235}, {141, 74, 218}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {178, 163, 254}, {192, 138, 252}, { 85, 103, 231}, - { 49, 81, 179}, { 32, 54, 133}, { 12, 26, 98}, - }, - { // band 2 - {189, 173, 254}, {179, 150, 253}, { 60, 94, 237}, - { 34, 81, 198}, { 20, 53, 187}, {128, 128, 128}, - }, - { // band 3 - {202, 191, 254}, {157, 160, 254}, { 57, 117, 240}, - { 28, 105, 211}, { 1, 128, 1}, {128, 128, 128}, - }, - { // band 4 - {231, 146, 254}, {208, 133, 254}, { 66, 78, 233}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {246, 49, 254}, {246, 63, 254}, { 85, 142, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#endif - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {181, 22, 175}, { 96, 37, 147}, { 35, 41, 105}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 80, 95, 197}, {111, 92, 193}, { 59, 87, 175}, - { 29, 79, 150}, { 10, 65, 118}, { 2, 47, 82}, - }, - { // band 2 - { 90, 141, 216}, { 77, 120, 210}, { 23, 95, 184}, - { 11, 81, 151}, { 6, 75, 130}, { 2, 58, 113}, - }, - { // band 3 - {122, 167, 231}, { 66, 119, 225}, { 26, 87, 189}, - { 7, 76, 151}, { 2, 63, 125}, { 1, 59, 77}, - }, - { // band 4 - {162, 147, 244}, {110, 97, 236}, { 32, 88, 204}, - { 11, 89, 174}, { 5, 78, 151}, {128, 128, 128}, - }, - { // band 5 - {205, 59, 251}, {176, 68, 248}, { 90, 71, 223}, - { 49, 72, 188}, { 17, 74, 203}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - {188, 70, 207}, {140, 73, 189}, { 85, 73, 163}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 59, 144, 239}, { 79, 126, 237}, { 31, 102, 202}, - { 10, 81, 153}, { 3, 56, 102}, { 2, 33, 59}, - }, - { // band 2 - {100, 152, 243}, { 80, 129, 236}, { 14, 94, 194}, - { 4, 72, 150}, { 1, 50, 103}, { 1, 35, 60}, - }, - { // band 3 - {130, 183, 247}, { 70, 139, 242}, { 19, 100, 203}, - { 4, 83, 159}, { 1, 59, 119}, { 1, 44, 72}, - }, - { // band 4 - {197, 138, 252}, {135, 107, 247}, { 31, 86, 210}, - { 7, 74, 160}, { 1, 53, 107}, {128, 128, 128}, - }, - { // band 5 - {229, 54, 254}, {200, 51, 251}, { 83, 61, 226}, - { 33, 55, 177}, { 12, 74, 145}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {229, 20, 235}, {183, 37, 221}, {127, 47, 198}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {188, 115, 251}, {208, 110, 250}, {101, 99, 235}, - { 38, 81, 197}, { 9, 56, 132}, { 9, 52, 63}, - }, - { // band 2 - {189, 150, 252}, {186, 137, 251}, { 54, 107, 236}, - { 14, 90, 195}, { 1, 89, 104}, {128, 128, 128}, - }, - { // band 3 - {209, 180, 254}, {142, 145, 253}, { 51, 130, 236}, - { 6, 128, 214}, { 1, 128, 254}, {128, 128, 128}, - }, - { // band 4 - {231, 140, 254}, {194, 128, 254}, { 75, 119, 233}, - {128, 23, 230}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {244, 59, 254}, {239, 81, 254}, {128, 85, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {246, 55, 247}, {197, 64, 235}, {141, 74, 218}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {178, 163, 254}, {192, 138, 252}, { 85, 103, 231}, - { 49, 81, 179}, { 32, 54, 133}, { 12, 26, 98}, - }, - { // band 2 - {189, 173, 254}, {179, 150, 253}, { 60, 94, 237}, - { 34, 81, 198}, { 20, 53, 187}, {128, 128, 128}, - }, - { // band 3 - {202, 191, 254}, {157, 160, 254}, { 57, 117, 240}, - { 28, 105, 211}, { 1, 128, 1}, {128, 128, 128}, - }, - { // band 4 - {231, 146, 254}, {208, 133, 254}, { 66, 78, 233}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {246, 49, 254}, {246, 63, 254}, { 85, 142, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 1 - { // Y plane - { // Intra - { // band 0 - { 45, 28, 124}, { 23, 35, 107}, { 10, 34, 78}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 53, 99, 177}, { 82, 96, 174}, { 46, 89, 158}, - { 21, 76, 133}, { 6, 56, 94}, { 1, 33, 54}, - }, - { // band 2 - { 68, 147, 201}, { 42, 124, 195}, { 17, 98, 166}, - { 7, 75, 131}, { 2, 53, 93}, { 1, 33, 59}, - }, - { // band 3 - { 65, 176, 217}, { 30, 137, 206}, { 6, 97, 167}, - { 2, 70, 128}, { 1, 47, 88}, { 1, 29, 46}, - }, - { // band 4 - { 69, 195, 232}, { 24, 146, 218}, { 4, 100, 175}, - { 2, 72, 134}, { 1, 51, 93}, { 1, 29, 52}, - }, - { // band 5 - { 96, 212, 246}, { 39, 158, 234}, { 6, 109, 192}, - { 2, 77, 144}, { 1, 50, 95}, { 1, 20, 45}, - }, - }, - { // Intra - { // band 0 - { 71, 80, 213}, { 53, 73, 181}, { 25, 66, 141}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 35, 168, 231}, { 91, 150, 229}, { 49, 122, 202}, - { 22, 97, 162}, { 10, 68, 108}, { 9, 48, 57}, - }, - { // band 2 - { 56, 178, 236}, { 32, 148, 225}, { 9, 99, 176}, - { 4, 69, 127}, { 2, 44, 78}, { 1, 25, 41}, - }, - { // band 3 - { 57, 191, 242}, { 27, 155, 230}, { 5, 102, 180}, - { 2, 71, 133}, { 1, 44, 78}, { 1, 27, 41}, - }, - { // band 4 - { 67, 201, 247}, { 24, 162, 237}, { 3, 106, 188}, - { 3, 74, 137}, { 1, 46, 85}, { 1, 34, 48}, - }, - { // band 5 - {111, 210, 251}, { 47, 166, 244}, { 3, 113, 199}, - { 2, 77, 146}, { 1, 48, 93}, { 1, 38, 22}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {206, 21, 221}, {150, 36, 195}, { 94, 44, 164}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {147, 128, 239}, {194, 122, 238}, { 95, 104, 220}, - { 39, 81, 183}, { 13, 53, 111}, { 3, 24, 49}, - }, - { // band 2 - {164, 163, 244}, {106, 142, 239}, { 50, 112, 215}, - { 26, 90, 177}, { 12, 67, 130}, { 1, 1, 64}, - }, - { // band 3 - {155, 193, 249}, { 88, 158, 244}, { 26, 124, 220}, - { 10, 98, 173}, { 1, 77, 126}, {128, 128, 128}, - }, - { // band 4 - {141, 205, 252}, { 64, 174, 248}, { 17, 124, 221}, - { 12, 92, 176}, { 1, 29, 148}, {128, 128, 128}, - }, - { // band 5 - {150, 217, 254}, { 74, 191, 252}, { 30, 144, 215}, - { 1, 106, 137}, {128, 1, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {241, 37, 242}, {175, 48, 223}, { 99, 53, 189}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {153, 183, 248}, {212, 156, 247}, {134, 124, 221}, - { 88, 103, 184}, { 59, 86, 132}, { 29, 61, 67}, - }, - { // band 2 - {162, 199, 250}, {106, 167, 247}, { 56, 110, 207}, - { 32, 85, 165}, { 16, 71, 130}, { 1, 93, 254}, - }, - { // band 3 - {143, 213, 252}, { 86, 187, 250}, { 23, 124, 220}, - { 7, 95, 176}, { 1, 109, 102}, {128, 128, 128}, - }, - { // band 4 - {130, 219, 254}, { 70, 201, 253}, { 15, 128, 215}, - { 1, 101, 201}, { 1, 64, 170}, {128, 128, 128}, - }, - { // band 5 - {155, 219, 254}, {105, 207, 254}, { 28, 155, 229}, - { 1, 153, 191}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 2 - { // Y plane - { // Intra - { // band 0 - { 18, 26, 117}, { 10, 29, 82}, { 3, 25, 52}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 35, 88, 152}, { 62, 85, 150}, { 36, 77, 137}, - { 16, 66, 116}, { 4, 47, 81}, { 1, 26, 44}, - }, - { // band 2 - { 55, 141, 182}, { 32, 119, 177}, { 12, 93, 154}, - { 4, 71, 123}, { 1, 51, 89}, { 1, 32, 56}, - }, - { // band 3 - { 46, 171, 202}, { 21, 130, 191}, { 5, 91, 154}, - { 1, 64, 115}, { 1, 42, 77}, { 1, 25, 41}, - }, - { // band 4 - { 43, 195, 219}, { 12, 142, 203}, { 1, 91, 156}, - { 1, 63, 115}, { 1, 41, 77}, { 1, 22, 43}, - }, - { // band 5 - { 42, 221, 238}, { 8, 162, 219}, { 1, 98, 167}, - { 1, 67, 123}, { 1, 43, 83}, { 1, 25, 38}, - }, - }, - { // Intra - { // band 0 - { 16, 51, 216}, { 20, 48, 168}, { 9, 44, 109}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 34, 164, 226}, {124, 148, 226}, { 72, 127, 207}, - { 36, 107, 175}, { 15, 81, 129}, { 6, 51, 79}, - }, - { // band 2 - { 61, 182, 234}, { 35, 148, 220}, { 9, 101, 178}, - { 4, 71, 134}, { 1, 46, 90}, { 1, 24, 51}, - }, - { // band 3 - { 54, 198, 239}, { 25, 156, 224}, { 3, 98, 173}, - { 1, 66, 124}, { 1, 41, 78}, { 1, 15, 37}, - }, - { // band 4 - { 48, 209, 242}, { 12, 162, 226}, { 1, 96, 169}, - { 1, 63, 119}, { 1, 40, 78}, { 1, 18, 45}, - }, - { // band 5 - { 44, 223, 247}, { 6, 173, 232}, { 1, 105, 178}, - { 1, 71, 131}, { 1, 44, 84}, { 1, 13, 46}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {188, 26, 214}, {121, 42, 181}, { 66, 49, 149}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {136, 128, 233}, {172, 124, 230}, { 80, 106, 211}, - { 27, 81, 174}, { 6, 49, 98}, { 8, 28, 49}, - }, - { // band 2 - {145, 166, 239}, { 92, 141, 229}, { 28, 108, 196}, - { 8, 87, 154}, { 1, 58, 105}, { 1, 27, 59}, - }, - { // band 3 - {131, 193, 242}, { 66, 151, 231}, { 13, 112, 192}, - { 2, 81, 152}, { 1, 66, 121}, { 1, 23, 64}, - }, - { // band 4 - {112, 211, 246}, { 41, 164, 235}, { 5, 117, 202}, - { 1, 83, 162}, { 1, 64, 111}, {128, 128, 128}, - }, - { // band 5 - { 96, 230, 250}, { 28, 185, 243}, { 2, 132, 204}, - { 1, 91, 166}, { 1, 85, 46}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {238, 23, 242}, {157, 29, 215}, { 73, 27, 162}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {165, 173, 250}, {222, 151, 247}, {152, 134, 235}, - {114, 120, 210}, { 86, 109, 176}, { 53, 88, 145}, - }, - { // band 2 - {164, 194, 249}, {100, 158, 241}, { 35, 111, 212}, - { 17, 85, 167}, { 1, 52, 112}, { 1, 73, 1}, - }, - { // band 3 - {151, 215, 252}, { 83, 172, 245}, { 16, 122, 208}, - { 6, 101, 165}, { 1, 74, 113}, { 1, 1, 1}, - }, - { // band 4 - {138, 230, 253}, { 65, 184, 248}, { 8, 128, 212}, - { 1, 111, 182}, {128, 1, 1}, {128, 128, 128}, - }, - { // band 5 - {123, 240, 253}, { 36, 201, 250}, { 3, 127, 211}, - { 1, 68, 204}, {128, 1, 1}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 3 - { // Y plane - { // Intra - { // band 0 - { 51, 21, 156}, { 30, 23, 86}, { 4, 18, 37}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 38, 77, 129}, { 79, 76, 129}, { 40, 66, 117}, - { 12, 54, 95}, { 1, 36, 60}, { 1, 17, 29}, - }, - { // band 2 - { 44, 133, 149}, { 24, 107, 143}, { 8, 78, 121}, - { 3, 59, 97}, { 1, 42, 71}, { 1, 22, 37}, - }, - { // band 3 - { 29, 160, 171}, { 9, 114, 158}, { 1, 76, 125}, - { 1, 54, 93}, { 1, 36, 63}, { 1, 20, 35}, - }, - { // band 4 - { 22, 188, 205}, { 6, 132, 186}, { 1, 87, 144}, - { 1, 62, 107}, { 1, 41, 72}, { 1, 23, 41}, - }, - { // band 5 - { 25, 233, 236}, { 5, 165, 214}, { 1, 96, 158}, - { 1, 63, 112}, { 1, 40, 73}, { 1, 23, 40}, - }, - }, - { // Intra - { // band 0 - { 48, 20, 231}, { 37, 21, 179}, { 15, 18, 109}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 41, 154, 216}, {196, 142, 221}, {131, 125, 207}, - { 84, 111, 181}, { 45, 91, 142}, { 27, 62, 89}, - }, - { // band 2 - { 72, 181, 230}, { 41, 147, 215}, { 10, 102, 173}, - { 3, 73, 132}, { 1, 47, 89}, { 1, 23, 50}, - }, - { // band 3 - { 60, 201, 236}, { 23, 157, 219}, { 2, 99, 167}, - { 1, 69, 124}, { 1, 43, 80}, { 1, 22, 39}, - }, - { // band 4 - { 53, 214, 242}, { 15, 165, 224}, { 1, 101, 173}, - { 1, 70, 131}, { 1, 44, 83}, { 1, 23, 49}, - }, - { // band 5 - { 39, 239, 248}, { 7, 186, 233}, { 1, 108, 174}, - { 1, 70, 123}, { 1, 43, 77}, { 1, 16, 42}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {161, 26, 204}, { 77, 40, 160}, { 26, 50, 117}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 80, 140, 218}, {136, 133, 215}, { 63, 117, 197}, - { 20, 93, 170}, { 7, 55, 102}, { 13, 32, 52}, - }, - { // band 2 - { 86, 173, 231}, { 46, 150, 220}, { 18, 118, 190}, - { 8, 90, 150}, { 2, 60, 95}, { 1, 39, 41}, - }, - { // band 3 - { 80, 183, 242}, { 37, 160, 231}, { 6, 120, 182}, - { 1, 86, 137}, { 1, 46, 78}, { 1, 15, 24}, - }, - { // band 4 - { 88, 215, 247}, { 42, 179, 235}, { 4, 116, 182}, - { 2, 80, 133}, { 1, 46, 85}, { 1, 64, 43}, - }, - { // band 5 - {100, 236, 250}, { 31, 186, 234}, { 1, 114, 181}, - { 1, 85, 135}, { 1, 78, 64}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {213, 13, 245}, {106, 16, 211}, { 32, 11, 156}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {140, 214, 247}, {241, 186, 243}, {177, 172, 235}, - {128, 156, 219}, {106, 130, 191}, { 99, 105, 152}, - }, - { // band 2 - {125, 218, 248}, { 75, 167, 239}, { 29, 111, 212}, - { 6, 66, 152}, { 1, 42, 96}, { 1, 85, 128}, - }, - { // band 3 - {120, 232, 252}, { 60, 189, 247}, { 8, 141, 200}, - { 1, 89, 134}, { 1, 32, 128}, {128, 128, 128}, - }, - { // band 4 - {111, 238, 253}, { 56, 198, 245}, { 1, 123, 208}, - { 1, 93, 176}, { 1, 1, 73}, {128, 128, 128}, - }, - { // band 5 - { 98, 251, 249}, { 56, 189, 244}, { 17, 113, 220}, - { 1, 109, 179}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#if CONFIG_TX64X64 - { // TX_SIZE 4 - { // Y plane - { // Intra - { // band 0 - { 51, 21, 156}, { 30, 23, 86}, { 4, 18, 37}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 38, 77, 129}, { 79, 76, 129}, { 40, 66, 117}, - { 12, 54, 95}, { 1, 36, 60}, { 1, 17, 29}, - }, - { // band 2 - { 44, 133, 149}, { 24, 107, 143}, { 8, 78, 121}, - { 3, 59, 97}, { 1, 42, 71}, { 1, 22, 37}, - }, - { // band 3 - { 29, 160, 171}, { 9, 114, 158}, { 1, 76, 125}, - { 1, 54, 93}, { 1, 36, 63}, { 1, 20, 35}, - }, - { // band 4 - { 22, 188, 205}, { 6, 132, 186}, { 1, 87, 144}, - { 1, 62, 107}, { 1, 41, 72}, { 1, 23, 41}, - }, - { // band 5 - { 25, 233, 236}, { 5, 165, 214}, { 1, 96, 158}, - { 1, 63, 112}, { 1, 40, 73}, { 1, 23, 40}, - }, - }, - { // Intra - { // band 0 - { 48, 20, 231}, { 37, 21, 179}, { 15, 18, 109}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 41, 154, 216}, {196, 142, 221}, {131, 125, 207}, - { 84, 111, 181}, { 45, 91, 142}, { 27, 62, 89}, - }, - { // band 2 - { 72, 181, 230}, { 41, 147, 215}, { 10, 102, 173}, - { 3, 73, 132}, { 1, 47, 89}, { 1, 23, 50}, - }, - { // band 3 - { 60, 201, 236}, { 23, 157, 219}, { 2, 99, 167}, - { 1, 69, 124}, { 1, 43, 80}, { 1, 22, 39}, - }, - { // band 4 - { 53, 214, 242}, { 15, 165, 224}, { 1, 101, 173}, - { 1, 70, 131}, { 1, 44, 83}, { 1, 23, 49}, - }, - { // band 5 - { 39, 239, 248}, { 7, 186, 233}, { 1, 108, 174}, - { 1, 70, 123}, { 1, 43, 77}, { 1, 16, 42}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {161, 26, 204}, { 77, 40, 160}, { 26, 50, 117}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 80, 140, 218}, {136, 133, 215}, { 63, 117, 197}, - { 20, 93, 170}, { 7, 55, 102}, { 13, 32, 52}, - }, - { // band 2 - { 86, 173, 231}, { 46, 150, 220}, { 18, 118, 190}, - { 8, 90, 150}, { 2, 60, 95}, { 1, 39, 41}, - }, - { // band 3 - { 80, 183, 242}, { 37, 160, 231}, { 6, 120, 182}, - { 1, 86, 137}, { 1, 46, 78}, { 1, 15, 24}, - }, - { // band 4 - { 88, 215, 247}, { 42, 179, 235}, { 4, 116, 182}, - { 2, 80, 133}, { 1, 46, 85}, { 1, 64, 43}, - }, - { // band 5 - {100, 236, 250}, { 31, 186, 234}, { 1, 114, 181}, - { 1, 85, 135}, { 1, 78, 64}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {213, 13, 245}, {106, 16, 211}, { 32, 11, 156}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {140, 214, 247}, {241, 186, 243}, {177, 172, 235}, - {128, 156, 219}, {106, 130, 191}, { 99, 105, 152}, - }, - { // band 2 - {125, 218, 248}, { 75, 167, 239}, { 29, 111, 212}, - { 6, 66, 152}, { 1, 42, 96}, { 1, 85, 128}, - }, - { // band 3 - {120, 232, 252}, { 60, 189, 247}, { 8, 141, 200}, - { 1, 89, 134}, { 1, 32, 128}, {128, 128, 128}, - }, - { // band 4 - {111, 238, 253}, { 56, 198, 245}, { 1, 123, 208}, - { 1, 93, 176}, { 1, 1, 73}, {128, 128, 128}, - }, - { // band 5 - { 98, 251, 249}, { 56, 189, 244}, { 17, 113, 220}, - { 1, 109, 179}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#endif // CONFIG_TX64X64 - }, - { // Q_Index 3 -#if CONFIG_CHROMA_2X2 - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {186, 16, 200}, {122, 31, 187}, { 78, 40, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {146, 119, 245}, {182, 115, 244}, {130, 113, 238}, - { 88, 110, 225}, { 47, 103, 208}, { 5, 102, 188}, - }, - { // band 2 - {164, 157, 248}, {155, 141, 250}, { 71, 116, 243}, - { 88, 129, 233}, { 50, 99, 228}, { 26, 148, 191}, - }, - { // band 3 - {200, 158, 253}, {177, 118, 252}, { 99, 113, 245}, - { 77, 120, 210}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {231, 104, 254}, {209, 82, 254}, {143, 112, 252}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {250, 36, 254}, {243, 55, 254}, {223, 170, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - {207, 37, 226}, {164, 46, 218}, {122, 58, 201}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {149, 154, 253}, {170, 137, 253}, { 94, 123, 247}, - { 42, 113, 222}, { 16, 97, 174}, { 49, 98, 159}, - }, - { // band 2 - {177, 162, 253}, {165, 142, 252}, { 51, 108, 243}, - { 18, 108, 213}, { 1, 98, 254}, {128, 128, 128}, - }, - { // band 3 - {211, 152, 254}, {184, 116, 254}, { 70, 110, 244}, - { 8, 108, 237}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {236, 89, 254}, {210, 67, 254}, {112, 111, 248}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {246, 26, 254}, {233, 35, 254}, {128, 1, 254}, - {254, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {247, 2, 247}, {226, 8, 242}, {191, 14, 235}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {231, 94, 254}, {248, 91, 254}, {186, 89, 252}, - {128, 92, 244}, { 79, 112, 254}, {128, 128, 128}, - }, - { // band 2 - {228, 145, 253}, {240, 130, 254}, {223, 105, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {245, 153, 253}, {240, 120, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {254, 128, 254}, {204, 128, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {253, 7, 249}, {224, 9, 244}, {182, 13, 231}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {234, 109, 254}, {242, 104, 254}, {160, 98, 254}, - {123, 85, 243}, { 82, 43, 217}, {128, 128, 128}, - }, - { // band 2 - {243, 137, 254}, {240, 118, 254}, {136, 53, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {251, 173, 254}, {229, 129, 250}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {254, 119, 254}, {254, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#endif - { // TX_SIZE 0 - { // Y plane - { // Intra - { // band 0 - {186, 16, 200}, {122, 31, 187}, { 78, 40, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {146, 119, 245}, {182, 115, 244}, {130, 113, 238}, - { 88, 110, 225}, { 47, 103, 208}, { 5, 102, 188}, - }, - { // band 2 - {164, 157, 248}, {155, 141, 250}, { 71, 116, 243}, - { 88, 129, 233}, { 50, 99, 228}, { 26, 148, 191}, - }, - { // band 3 - {200, 158, 253}, {177, 118, 252}, { 99, 113, 245}, - { 77, 120, 210}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {231, 104, 254}, {209, 82, 254}, {143, 112, 252}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {250, 36, 254}, {243, 55, 254}, {223, 170, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - {207, 37, 226}, {164, 46, 218}, {122, 58, 201}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {149, 154, 253}, {170, 137, 253}, { 94, 123, 247}, - { 42, 113, 222}, { 16, 97, 174}, { 49, 98, 159}, - }, - { // band 2 - {177, 162, 253}, {165, 142, 252}, { 51, 108, 243}, - { 18, 108, 213}, { 1, 98, 254}, {128, 128, 128}, - }, - { // band 3 - {211, 152, 254}, {184, 116, 254}, { 70, 110, 244}, - { 8, 108, 237}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {236, 89, 254}, {210, 67, 254}, {112, 111, 248}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {246, 26, 254}, {233, 35, 254}, {128, 1, 254}, - {254, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {247, 2, 247}, {226, 8, 242}, {191, 14, 235}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {231, 94, 254}, {248, 91, 254}, {186, 89, 252}, - {128, 92, 244}, { 79, 112, 254}, {128, 128, 128}, - }, - { // band 2 - {228, 145, 253}, {240, 130, 254}, {223, 105, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {245, 153, 253}, {240, 120, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {254, 128, 254}, {204, 128, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {253, 7, 249}, {224, 9, 244}, {182, 13, 231}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {234, 109, 254}, {242, 104, 254}, {160, 98, 254}, - {123, 85, 243}, { 82, 43, 217}, {128, 128, 128}, - }, - { // band 2 - {243, 137, 254}, {240, 118, 254}, {136, 53, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {251, 173, 254}, {229, 129, 250}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {254, 119, 254}, {254, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 1 - { // Y plane - { // Intra - { // band 0 - { 49, 26, 159}, { 36, 34, 150}, { 26, 38, 124}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 99, 122, 226}, {143, 119, 225}, { 90, 113, 213}, - { 46, 102, 193}, { 14, 84, 157}, { 3, 59, 107}, - }, - { // band 2 - {109, 164, 237}, { 74, 142, 233}, { 29, 112, 216}, - { 14, 92, 184}, { 10, 80, 156}, { 1, 52, 137}, - }, - { // band 3 - {110, 191, 245}, { 59, 156, 240}, { 18, 121, 220}, - { 8, 97, 184}, { 3, 84, 150}, {128, 128, 128}, - }, - { // band 4 - {115, 203, 250}, { 59, 167, 246}, { 16, 130, 226}, - { 7, 97, 192}, { 1, 71, 99}, {128, 128, 128}, - }, - { // band 5 - {149, 218, 253}, { 93, 171, 251}, { 28, 125, 233}, - { 28, 99, 192}, {128, 85, 85}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - { 97, 45, 229}, { 79, 52, 205}, { 46, 58, 171}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 99, 180, 249}, {156, 165, 249}, { 73, 141, 237}, - { 31, 116, 208}, { 13, 81, 153}, { 5, 42, 86}, - }, - { // band 2 - {113, 188, 251}, { 68, 161, 244}, { 16, 108, 216}, - { 6, 81, 168}, { 2, 65, 118}, {128, 1, 1}, - }, - { // band 3 - {117, 201, 252}, { 62, 171, 248}, { 12, 119, 221}, - { 5, 90, 182}, { 4, 66, 116}, {128, 128, 128}, - }, - { // band 4 - {128, 207, 253}, { 70, 176, 251}, { 11, 126, 228}, - { 6, 89, 189}, { 1, 44, 148}, {128, 128, 128}, - }, - { // band 5 - {162, 218, 254}, {107, 170, 253}, { 22, 131, 238}, - { 1, 77, 182}, { 1, 254, 128}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {235, 5, 238}, {194, 14, 223}, {152, 22, 205}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {200, 121, 251}, {241, 115, 252}, {167, 108, 248}, - { 93, 93, 233}, { 36, 66, 189}, {128, 128, 128}, - }, - { // band 2 - {220, 151, 253}, {176, 135, 252}, { 95, 124, 254}, - { 64, 105, 217}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {225, 189, 254}, {175, 155, 254}, {102, 119, 254}, - { 1, 1, 1}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {218, 195, 254}, {125, 157, 253}, {128, 128, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {221, 197, 254}, { 85, 210, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {250, 9, 246}, {204, 13, 234}, {144, 18, 211}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {213, 157, 253}, {243, 138, 253}, {170, 117, 250}, - {109, 91, 233}, { 66, 77, 163}, { 64, 85, 254}, - }, - { // band 2 - {221, 169, 254}, {182, 141, 253}, {112, 120, 239}, - { 85, 165, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {226, 192, 254}, {189, 174, 251}, {153, 128, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {232, 192, 254}, {195, 187, 247}, { 1, 191, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {247, 185, 254}, {254, 93, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 2 - { // Y plane - { // Intra - { // band 0 - { 14, 30, 136}, { 15, 33, 120}, { 10, 33, 90}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 92, 109, 209}, {113, 108, 207}, { 77, 102, 193}, - { 39, 91, 171}, { 11, 70, 129}, { 2, 44, 77}, - }, - { // band 2 - { 99, 158, 223}, { 66, 135, 217}, { 23, 109, 194}, - { 9, 85, 160}, { 3, 66, 124}, { 1, 51, 100}, - }, - { // band 3 - { 89, 189, 234}, { 46, 149, 225}, { 10, 110, 194}, - { 2, 83, 156}, { 1, 57, 113}, { 1, 47, 73}, - }, - { // band 4 - { 78, 206, 242}, { 28, 161, 232}, { 3, 114, 200}, - { 1, 86, 161}, { 1, 62, 118}, { 1, 1, 1}, - }, - { // band 5 - { 72, 227, 250}, { 20, 182, 242}, { 3, 126, 210}, - { 2, 91, 166}, { 1, 64, 126}, {128, 128, 128}, - }, - }, - { // Intra - { // band 0 - { 23, 42, 227}, { 41, 43, 195}, { 25, 45, 146}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {100, 172, 245}, {165, 158, 246}, { 88, 137, 234}, - { 44, 116, 203}, { 18, 85, 149}, { 7, 56, 92}, - }, - { // band 2 - {117, 188, 247}, { 70, 155, 239}, { 18, 105, 204}, - { 7, 78, 158}, { 2, 50, 111}, { 1, 38, 77}, - }, - { // band 3 - {104, 207, 250}, { 54, 166, 241}, { 6, 110, 199}, - { 1, 78, 155}, { 1, 45, 100}, { 1, 1, 1}, - }, - { // band 4 - { 87, 216, 251}, { 30, 177, 243}, { 1, 114, 203}, - { 1, 85, 157}, { 1, 53, 108}, {128, 128, 128}, - }, - { // band 5 - { 80, 230, 253}, { 23, 193, 248}, { 1, 127, 215}, - { 1, 94, 170}, { 1, 71, 59}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {222, 9, 234}, {161, 20, 210}, {113, 30, 185}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {195, 120, 248}, {231, 124, 247}, {148, 116, 238}, - { 64, 98, 207}, { 20, 70, 147}, { 87, 68, 100}, - }, - { // band 2 - {186, 161, 250}, {124, 148, 245}, { 44, 123, 230}, - { 23, 107, 205}, { 1, 80, 131}, {128, 128, 128}, - }, - { // band 3 - {172, 196, 252}, {110, 160, 248}, { 37, 134, 235}, - { 23, 125, 200}, {128, 254, 128}, {128, 128, 128}, - }, - { // band 4 - {173, 209, 253}, {103, 175, 250}, { 1, 120, 240}, - { 1, 146, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {184, 235, 254}, { 81, 186, 251}, {128, 109, 254}, - {128, 254, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {248, 8, 243}, {185, 11, 225}, {108, 11, 189}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {208, 158, 254}, {244, 147, 252}, {195, 132, 248}, - {161, 122, 224}, {129, 114, 188}, { 59, 119, 159}, - }, - { // band 2 - {202, 182, 253}, {143, 161, 251}, { 73, 115, 247}, - {146, 175, 204}, {128, 1, 254}, {128, 128, 128}, - }, - { // band 3 - {202, 204, 254}, {131, 174, 251}, { 18, 153, 207}, - {128, 254, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {192, 221, 254}, {114, 190, 254}, {128, 170, 254}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {166, 236, 254}, {119, 200, 254}, {128, 128, 128}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, - { // TX_SIZE 3 - { // Y plane - { // Intra - { // band 0 - { 30, 32, 144}, { 21, 35, 96}, { 4, 27, 55}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 35, 107, 172}, { 61, 104, 170}, { 33, 94, 160}, - { 13, 80, 139}, { 2, 55, 97}, { 1, 28, 49}, - }, - { // band 2 - { 51, 153, 195}, { 29, 129, 189}, { 9, 99, 163}, - { 3, 75, 129}, { 1, 49, 88}, { 1, 29, 50}, - }, - { // band 3 - { 53, 164, 210}, { 21, 134, 201}, { 3, 97, 164}, - { 1, 69, 124}, { 1, 45, 82}, { 1, 31, 58}, - }, - { // band 4 - { 47, 205, 234}, { 18, 158, 220}, { 2, 109, 177}, - { 1, 78, 137}, { 1, 53, 101}, { 1, 34, 70}, - }, - { // band 5 - { 55, 233, 245}, { 16, 179, 233}, { 1, 116, 191}, - { 1, 79, 145}, { 1, 53, 101}, { 1, 37, 58}, - }, - }, - { // Intra - { // band 0 - { 36, 33, 227}, { 39, 28, 190}, { 18, 27, 134}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 76, 156, 235}, {184, 147, 235}, {114, 130, 220}, - { 72, 112, 191}, { 42, 87, 144}, { 21, 65, 93}, - }, - { // band 2 - { 96, 179, 240}, { 51, 149, 228}, { 12, 105, 191}, - { 6, 74, 148}, { 1, 47, 100}, { 1, 29, 53}, - }, - { // band 3 - { 88, 191, 242}, { 35, 154, 231}, { 3, 106, 187}, - { 1, 74, 140}, { 1, 41, 84}, { 1, 25, 38}, - }, - { // band 4 - { 77, 212, 249}, { 28, 171, 239}, { 2, 117, 199}, - { 1, 79, 151}, { 1, 45, 99}, { 1, 1, 1}, - }, - { // band 5 - { 77, 236, 252}, { 27, 190, 246}, { 2, 120, 203}, - { 1, 78, 147}, { 1, 42, 72}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {185, 11, 227}, {113, 30, 182}, { 57, 44, 144}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {151, 139, 244}, {212, 139, 241}, {124, 126, 231}, - { 59, 104, 213}, { 26, 73, 158}, { 20, 45, 95}, - }, - { // band 2 - {155, 163, 247}, {108, 152, 239}, { 39, 124, 214}, - { 7, 109, 162}, { 29, 57, 128}, {128, 128, 128}, - }, - { // band 3 - {158, 176, 250}, { 89, 164, 243}, { 11, 114, 196}, - { 1, 96, 141}, { 1, 81, 118}, {128, 1, 1}, - }, - { // band 4 - {148, 212, 251}, { 59, 174, 240}, { 2, 130, 203}, - { 1, 70, 168}, { 1, 51, 106}, {128, 128, 128}, - }, - { // band 5 - {104, 237, 252}, { 39, 190, 246}, { 1, 154, 220}, - {128, 102, 1}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {236, 6, 242}, {111, 6, 206}, { 36, 5, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {193, 193, 252}, {248, 182, 251}, {218, 150, 246}, - {182, 134, 244}, {151, 137, 227}, { 45, 102, 195}, - }, - { // band 2 - {188, 202, 251}, {125, 165, 249}, { 64, 75, 218}, - { 1, 128, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {178, 225, 254}, {107, 188, 231}, { 21, 135, 233}, - {128, 1, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {164, 227, 253}, { 55, 193, 251}, { 1, 111, 225}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {151, 243, 254}, { 50, 203, 254}, {128, 179, 254}, - {128, 1, 254}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#if CONFIG_TX64X64 - { // TX_SIZE 4 - { // Y plane - { // Intra - { // band 0 - { 30, 32, 144}, { 21, 35, 96}, { 4, 27, 55}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 35, 107, 172}, { 61, 104, 170}, { 33, 94, 160}, - { 13, 80, 139}, { 2, 55, 97}, { 1, 28, 49}, - }, - { // band 2 - { 51, 153, 195}, { 29, 129, 189}, { 9, 99, 163}, - { 3, 75, 129}, { 1, 49, 88}, { 1, 29, 50}, - }, - { // band 3 - { 53, 164, 210}, { 21, 134, 201}, { 3, 97, 164}, - { 1, 69, 124}, { 1, 45, 82}, { 1, 31, 58}, - }, - { // band 4 - { 47, 205, 234}, { 18, 158, 220}, { 2, 109, 177}, - { 1, 78, 137}, { 1, 53, 101}, { 1, 34, 70}, - }, - { // band 5 - { 55, 233, 245}, { 16, 179, 233}, { 1, 116, 191}, - { 1, 79, 145}, { 1, 53, 101}, { 1, 37, 58}, - }, - }, - { // Intra - { // band 0 - { 36, 33, 227}, { 39, 28, 190}, { 18, 27, 134}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - { 76, 156, 235}, {184, 147, 235}, {114, 130, 220}, - { 72, 112, 191}, { 42, 87, 144}, { 21, 65, 93}, - }, - { // band 2 - { 96, 179, 240}, { 51, 149, 228}, { 12, 105, 191}, - { 6, 74, 148}, { 1, 47, 100}, { 1, 29, 53}, - }, - { // band 3 - { 88, 191, 242}, { 35, 154, 231}, { 3, 106, 187}, - { 1, 74, 140}, { 1, 41, 84}, { 1, 25, 38}, - }, - { // band 4 - { 77, 212, 249}, { 28, 171, 239}, { 2, 117, 199}, - { 1, 79, 151}, { 1, 45, 99}, { 1, 1, 1}, - }, - { // band 5 - { 77, 236, 252}, { 27, 190, 246}, { 2, 120, 203}, - { 1, 78, 147}, { 1, 42, 72}, {128, 128, 128}, - }, - }, - }, - { // UV plane - { // Inter - { // band 0 - {185, 11, 227}, {113, 30, 182}, { 57, 44, 144}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {151, 139, 244}, {212, 139, 241}, {124, 126, 231}, - { 59, 104, 213}, { 26, 73, 158}, { 20, 45, 95}, - }, - { // band 2 - {155, 163, 247}, {108, 152, 239}, { 39, 124, 214}, - { 7, 109, 162}, { 29, 57, 128}, {128, 128, 128}, - }, - { // band 3 - {158, 176, 250}, { 89, 164, 243}, { 11, 114, 196}, - { 1, 96, 141}, { 1, 81, 118}, {128, 1, 1}, - }, - { // band 4 - {148, 212, 251}, { 59, 174, 240}, { 2, 130, 203}, - { 1, 70, 168}, { 1, 51, 106}, {128, 128, 128}, - }, - { // band 5 - {104, 237, 252}, { 39, 190, 246}, { 1, 154, 220}, - {128, 102, 1}, {128, 128, 128}, {128, 128, 128}, - }, - }, - { // Inter - { // band 0 - {236, 6, 242}, {111, 6, 206}, { 36, 5, 161}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 1 - {193, 193, 252}, {248, 182, 251}, {218, 150, 246}, - {182, 134, 244}, {151, 137, 227}, { 45, 102, 195}, - }, - { // band 2 - {188, 202, 251}, {125, 165, 249}, { 64, 75, 218}, - { 1, 128, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 3 - {178, 225, 254}, {107, 188, 231}, { 21, 135, 233}, - {128, 1, 254}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 4 - {164, 227, 253}, { 55, 193, 251}, { 1, 111, 225}, - {128, 128, 128}, {128, 128, 128}, {128, 128, 128}, - }, - { // band 5 - {151, 243, 254}, { 50, 203, 254}, {128, 179, 254}, - {128, 1, 254}, {128, 128, 128}, {128, 128, 128}, - }, - }, - }, - }, -#endif // CONFIG_TX64X64 - }, -}; -#else -static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - {97, 27, 144}, {81, 38, 128}, {51, 42, 99} - }, - { // Band 1 - {74, 113, 204}, {68, 101, 199}, {50, 87, 173}, - {31, 76, 133}, {13, 55, 86}, {3, 30, 39} - }, - { // Band 2 - {83, 156, 222}, {74, 127, 215}, {46, 101, 179}, - {30, 80, 129}, {14, 57, 81}, {3, 27, 37} - }, - { // Band 3 - {105, 164, 233}, {84, 128, 224}, {49, 92, 175}, - {28, 60, 114}, {12, 34, 53}, {20, 59, 98} - }, - { // Band 4 - {131, 159, 243}, {98, 123, 228}, {40, 78, 151}, - {19, 46, 97}, {13, 47, 19}, {19, 16, 19} - }, - { // Band 5 - {192, 71, 241}, {174, 70, 226}, {125, 46, 153}, - {108, 49, 116}, {82, 24, 46}, {60, 14, 30} - } - }, - { // Inter - { // Band 0 - {111, 66, 218}, {107, 87, 211}, {93, 99, 207} - }, - { // Band 1 - {107, 166, 250}, {107, 143, 247}, {73, 119, 221}, - {43, 91, 166}, {17, 74, 102}, {3, 70, 53} - }, - { // Band 2 - {126, 177, 251}, {109, 148, 246}, {64, 99, 204}, - {42, 68, 140}, {28, 52, 84}, {20, 34, 1} - }, - { // Band 3 - {143, 178, 252}, {114, 144, 245}, {46, 92, 188}, - {45, 65, 104}, {40, 44, 76}, {1, 1, 1} - }, - { // Band 4 - {163, 159, 251}, {120, 131, 243}, {47, 81, 182}, - {32, 39, 128}, {33, 44, 56}, {1, 17, 34} - }, - { // Band 5 - {209, 94, 251}, {190, 81, 241}, {139, 45, 147}, - {123, 35, 73}, {118, 1, 118}, {3, 16, 42} - } - } - }, - { // UV plane - { // Intra - { // Band 0 - {189, 37, 229}, {145, 68, 205}, {99, 74, 171} - }, - { // Band 1 - {153, 139, 242}, {135, 125, 235}, {84, 100, 200}, - {49, 75, 162}, {9, 21, 84}, {3, 31, 69} - }, - { // Band 2 - {165, 165, 244}, {128, 144, 240}, {68, 94, 204}, - {39, 72, 132}, {22, 44, 93}, {26, 73, 26} - }, - { // Band 3 - {181, 174, 246}, {142, 132, 241}, {81, 96, 212}, - {41, 70, 166}, {9, 48, 92}, {1, 19, 38} - }, - { // Band 4 - {197, 159, 251}, {168, 121, 245}, {107, 75, 218}, - {70, 43, 158}, {1, 128, 1}, {1, 18, 37} - }, - { // Band 5 - {231, 79, 255}, {211, 74, 249}, {157, 104, 210}, - {128, 102, 213}, {12, 34, 96}, {2, 20, 47} - } - }, - { // Inter - { // Band 0 - {220, 53, 252}, {191, 80, 248}, {154, 100, 245} - }, - { // Band 1 - {205, 153, 255}, {182, 147, 254}, {110, 131, 231}, - {68, 114, 161}, {50, 114, 140}, {1, 33, 57} - }, - { // Band 2 - {213, 171, 255}, {184, 163, 254}, {116, 104, 235}, - {79, 71, 207}, {1, 41, 79}, {1, 20, 39} - }, - { // Band 3 - {223, 158, 255}, {203, 137, 255}, {111, 142, 244}, - {2, 255, 133}, {1, 44, 85}, {1, 22, 47} - }, - { // Band 4 - {232, 148, 255}, {222, 123, 255}, {255, 128, 255}, - {3, 61, 124}, {1, 41, 84}, {1, 21, 52} - }, - { // Band 5 - {248, 92, 255}, {248, 96, 255}, {69, 58, 184}, - {31, 44, 137}, {14, 38, 105}, {8, 23, 61} - } - } - } -}; -static const av1_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - {112, 31, 159}, {72, 37, 119}, {22, 35, 68} - }, - { // Band 1 - {42, 109, 174}, {45, 99, 172}, {32, 84, 149}, - {18, 69, 119}, {6, 46, 76}, {1, 19, 31} - }, - { // Band 2 - {40, 154, 202}, {35, 126, 191}, {19, 98, 160}, - {10, 75, 122}, {5, 53, 82}, {1, 23, 39} - }, - { // Band 3 - {39, 176, 215}, {28, 135, 200}, {11, 93, 156}, - {5, 63, 109}, {1, 36, 64}, {1, 14, 26} - }, - { // Band 4 - {41, 191, 230}, {25, 147, 212}, {9, 97, 160}, - {3, 65, 109}, {1, 33, 58}, {1, 14, 20} - }, - { // Band 5 - {68, 203, 242}, {40, 159, 220}, {12, 97, 153}, - {5, 58, 97}, {1, 29, 55}, {1, 11, 18} - } - }, - { // Inter - { // Band 0 - {99, 67, 221}, {86, 80, 204}, {60, 87, 184} - }, - { // Band 1 - {73, 169, 246}, {79, 158, 242}, {50, 135, 220}, - {30, 113, 181}, {18, 76, 126}, {5, 54, 85} - }, - { // Band 2 - {90, 184, 250}, {78, 162, 243}, {47, 118, 214}, - {35, 85, 171}, {32, 53, 115}, {20, 28, 76} - }, - { // Band 3 - {109, 197, 252}, {89, 172, 247}, {52, 119, 217}, - {37, 80, 161}, {23, 44, 100}, {1, 18, 34} - }, - { // Band 4 - {132, 202, 254}, {110, 175, 251}, {63, 128, 228}, - {37, 86, 168}, {64, 91, 102}, {1, 17, 34} - }, - { // Band 5 - {126, 204, 253}, {100, 174, 250}, {50, 148, 237}, - {25, 90, 133}, {1, 64, 85}, {3, 16, 42} - } - } - }, - { // UV plane - { // Intra - { // Band 0 - {195, 35, 235}, {137, 63, 201}, {62, 70, 145} - }, - { // Band 1 - {110, 158, 233}, {102, 143, 227}, {60, 120, 199}, - {30, 85, 156}, {9, 50, 90}, {1, 16, 33} - }, - { // Band 2 - {102, 185, 233}, {71, 152, 224}, {29, 111, 187}, - {18, 74, 138}, {4, 56, 87}, {1, 18, 46} - }, - { // Band 3 - {101, 205, 239}, {66, 161, 229}, {23, 109, 183}, - {9, 85, 135}, {5, 71, 142}, {1, 1, 102} - }, - { // Band 4 - {109, 216, 243}, {69, 168, 233}, {23, 119, 191}, - {8, 137, 115}, {1, 54, 98}, {1, 1, 255} - }, - { // Band 5 - {139, 224, 249}, {98, 176, 238}, {55, 129, 187}, - {25, 101, 131}, {26, 59, 154}, {2, 20, 47} - } - }, - { // Inter - { // Band 0 - {220, 72, 254}, {176, 108, 251}, {114, 132, 247} - }, - { // Band 1 - {161, 185, 255}, {141, 185, 254}, {131, 180, 249}, - {111, 164, 186}, {50, 98, 142}, {1, 128, 1} - }, - { // Band 2 - {171, 195, 255}, {133, 184, 254}, {68, 140, 231}, - {102, 96, 205}, {1, 1, 128}, {1, 20, 39} - }, - { // Band 3 - {180, 206, 255}, {148, 191, 254}, {83, 157, 241}, - {128, 171, 128}, {1, 44, 85}, {1, 22, 47} - }, - { // Band 4 - {194, 214, 255}, {159, 188, 255}, {122, 148, 250}, - {3, 255, 124}, {1, 41, 84}, {1, 21, 52} - }, - { // Band 5 - {231, 217, 255}, {209, 149, 255}, {205, 145, 205}, - {31, 44, 137}, {14, 38, 105}, {8, 23, 61} - } - } - } -}; -static const av1_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - {91, 31, 117}, {49, 31, 89}, {14, 25, 48} - }, - { // Band 1 - {31, 97, 151}, {33, 89, 148}, {28, 76, 133}, - {17, 60, 106}, {7, 42, 72}, {1, 19, 32} - }, - { // Band 2 - {28, 152, 182}, {28, 120, 174}, {15, 93, 146}, - {9, 72, 116}, {5, 47, 82}, {1, 21, 37} - }, - { // Band 3 - {29, 174, 203}, {23, 127, 187}, {9, 89, 145}, - {2, 56, 100}, {1, 31, 56}, {1, 12, 25} - }, - { // Band 4 - {28, 193, 220}, {17, 141, 197}, {4, 87, 142}, - {1, 54, 95}, {1, 31, 56}, {1, 12, 26} - }, - { // Band 5 - {29, 221, 240}, {11, 167, 215}, {2, 93, 149}, - {1, 58, 100}, {1, 35, 61}, {1, 16, 28} - } - }, - { // Inter - { // Band 0 - {108, 52, 214}, {84, 60, 186}, {45, 69, 161} - }, - { // Band 1 - {43, 164, 236}, {57, 161, 233}, {38, 146, 214}, - {24, 120, 182}, {15, 80, 126}, {5, 28, 66} - }, - { // Band 2 - {58, 187, 242}, {47, 163, 234}, {28, 118, 204}, - {26, 82, 165}, {21, 54, 112}, {4, 28, 55} - }, - { // Band 3 - {65, 201, 248}, {51, 170, 239}, {22, 117, 204}, - {11, 81, 159}, {10, 43, 102}, {1, 1, 1} - }, - { // Band 4 - {80, 206, 252}, {57, 179, 245}, {25, 129, 214}, - {16, 97, 170}, {6, 60, 130}, {1, 128, 1} - }, - { // Band 5 - {97, 217, 253}, {68, 186, 250}, {26, 138, 216}, - {20, 105, 166}, {11, 78, 111}, {3, 16, 42} - } - } - }, - { // UV plane - { // Intra - { // Band 0 - {181, 37, 233}, {121, 55, 192}, {46, 52, 124} - }, - { // Band 1 - {108, 157, 221}, {98, 140, 215}, {59, 124, 187}, - {34, 92, 158}, {9, 68, 112}, {1, 41, 70} - }, - { // Band 2 - {80, 188, 223}, {46, 153, 204}, {25, 91, 173}, - {11, 73, 131}, {5, 43, 82}, {1, 17, 91} - }, - { // Band 3 - {63, 209, 228}, {31, 157, 206}, {8, 104, 167}, - {3, 63, 122}, {1, 44, 87}, {1, 43, 51} - }, - { // Band 4 - {52, 220, 234}, {22, 165, 216}, {4, 104, 163}, - {2, 62, 129}, {1, 33, 50}, {1, 26, 28} - }, - { // Band 5 - {58, 238, 242}, {24, 183, 224}, {4, 109, 172}, - {2, 87, 141}, {1, 52, 79}, {1, 51, 64} - } - }, - { // Inter - { // Band 0 - {224, 52, 250}, {188, 81, 239}, {138, 114, 228} - }, - { // Band 1 - {131, 206, 255}, {128, 193, 254}, {119, 173, 247}, - {106, 127, 187}, {50, 100, 124}, {1, 96, 1} - }, - { // Band 2 - {123, 214, 254}, {86, 194, 254}, {64, 119, 221}, - {43, 51, 128}, {1, 32, 110}, {1, 20, 39} - }, - { // Band 3 - {115, 223, 255}, {78, 200, 254}, {75, 164, 203}, - {128, 85, 255}, {1, 44, 85}, {1, 22, 47} - }, - { // Band 4 - {132, 226, 255}, {88, 207, 254}, {20, 140, 225}, - {3, 61, 124}, {1, 41, 84}, {1, 21, 52} - }, - { // Band 5 - {180, 236, 255}, {138, 223, 254}, {73, 166, 238}, - {31, 255, 137}, {14, 38, 105}, {8, 23, 61} - } - } - } -}; -static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - {163, 26, 188}, {78, 29, 105}, {22, 22, 48} - }, - { // Band 1 - {72, 93, 168}, {74, 91, 170}, {62, 72, 151}, - {37, 55, 112}, {10, 33, 63}, {1, 14, 23} - }, - { // Band 2 - {41, 163, 182}, {36, 136, 177}, {20, 102, 153}, - {10, 76, 114}, {5, 45, 71}, {1, 17, 27} - }, - { // Band 3 - {43, 202, 213}, {28, 142, 193}, {10, 90, 141}, - {2, 51, 93}, {1, 24, 48}, {1, 10, 19} - }, - { // Band 4 - {46, 216, 220}, {26, 150, 199}, {7, 87, 136}, - {2, 49, 86}, {1, 28, 47}, {1, 12, 24} - }, - { // Band 5 - {19, 241, 237}, {5, 172, 200}, {1, 82, 126}, - {1, 47, 79}, {1, 29, 47}, {1, 14, 25} - } - }, - { // Inter - { // Band 0 - {185, 20, 226}, {151, 26, 187}, {109, 34, 144} - }, - { // Band 1 - {56, 151, 227}, {76, 165, 232}, {62, 161, 222}, - {47, 139, 201}, {29, 106, 150}, {14, 61, 98} - }, - { // Band 2 - {57, 200, 237}, {43, 164, 227}, {22, 106, 190}, - {14, 68, 140}, {10, 48, 90}, {1, 15, 40} - }, - { // Band 3 - {46, 209, 238}, {28, 165, 225}, {7, 107, 180}, - {2, 69, 125}, {2, 36, 94}, {1, 1, 1} - }, - { // Band 4 - {55, 225, 248}, {28, 181, 237}, {7, 117, 198}, - {6, 77, 144}, {3, 60, 90}, {1, 1, 1} - }, - { // Band 5 - {63, 243, 251}, {27, 193, 242}, {4, 124, 200}, - {1, 58, 153}, {1, 59, 124}, {3, 16, 42} - } - } - }, - { // UV plane - { // Intra - { // Band 0 - {208, 28, 218}, {183, 32, 188}, {169, 21, 189} - }, - { // Band 1 - {205, 124, 247}, {190, 96, 240}, {233, 89, 233}, - {177, 44, 212}, {59, 58, 59}, {32, 33, 38} - }, - { // Band 2 - {194, 195, 250}, {179, 190, 226}, {32, 174, 128}, - {32, 85, 128}, {12, 64, 122}, {1, 85, 90} - }, - { // Band 3 - {149, 232, 249}, {95, 159, 227}, {28, 91, 171}, - {28, 102, 114}, {1, 1, 73}, {1, 19, 38} - }, - { // Band 4 - {154, 239, 246}, {138, 151, 235}, {1, 123, 138}, - {128, 183, 255}, {1, 128, 1}, {1, 18, 37} - }, - { // Band 5 - {157, 255, 253}, {75, 171, 241}, {43, 102, 171}, - {30, 44, 136}, {12, 34, 96}, {2, 20, 47} - } - }, - { // Inter - { // Band 0 - {249, 13, 248}, {238, 14, 220}, {225, 16, 174} - }, - { // Band 1 - {190, 189, 254}, {169, 134, 253}, {124, 179, 248}, - {138, 131, 223}, {64, 133, 192}, {1, 85, 128} - }, - { // Band 2 - {139, 212, 254}, {126, 177, 255}, {93, 39, 186}, - {1, 1, 171}, {1, 41, 79}, {1, 20, 39} - }, - { // Band 3 - {153, 216, 255}, {165, 204, 255}, {1, 1, 255}, - {2, 73, 133}, {1, 1, 1}, {1, 22, 47} - }, - { // Band 4 - {147, 226, 254}, {119, 196, 255}, {1, 128, 255}, - {1, 1, 171}, {1, 1, 1}, {1, 21, 52} - }, - { // Band 5 - {168, 240, 255}, {95, 179, 255}, {1, 171, 1}, - {31, 44, 137}, {14, 38, 105}, {8, 23, 61} - } - } - } -}; - -#if CONFIG_TX64X64 -// FIXME. Optimize for EC_MULTISYMBOL -static const av1_coeff_probs_model default_coef_probs_64x64[PLANE_TYPES] = { - { // Y plane - { // Intra - { // Band 0 - { 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 } - }, { // Band 1 - { 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 }, - { 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 } - }, { // Band 2 - { 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 }, - { 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 } - }, { // Band 3 - { 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 }, - { 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 } - }, { // Band 4 - { 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 }, - { 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 } - }, { // Band 5 - { 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 }, - { 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 } - } - }, { // Inter - { // Band 0 - { 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 } - }, { // Band 1 - { 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 }, - { 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 } - }, { // Band 2 - { 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 }, - { 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 } - }, { // Band 3 - { 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 }, - { 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 } - }, { // Band 4 - { 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 }, - { 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 } - }, { // Band 5 - { 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 }, - { 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 } - } - } - }, { // UV plane - { // Intra - { // Band 0 - { 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 } - }, { // Band 1 - { 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 }, - { 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 } - }, { // Band 2 - { 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 }, - { 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 } - }, { // Band 3 - { 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 }, - { 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 } - }, { // Band 4 - { 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 }, - { 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 } - }, { // Band 5 - { 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 }, - { 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 } - } - }, { // Inter - { // Band 0 - { 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 } - }, { // Band 1 - { 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 }, - { 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 } - }, { // Band 2 - { 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 }, - { 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 } - }, { // Band 3 - { 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 }, - { 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 } - }, { // Band 4 - { 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 }, - { 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 } - }, { // Band 5 - { 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 }, - { 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 } - } - } - } -}; -#endif // CONFIG_TX64X64 -#endif // CONFIG_Q_ADAPT_PROBS -static const aom_prob av1_default_blockzero_probs[TX_SIZES][PLANE_TYPES] - [REF_TYPES][BLOCKZ_CONTEXTS] = { -#if CONFIG_CHROMA_2X2 - { // TX_2x2 - { // Y plane - { 195, 84, 8, }, // Intra - { 191, 124, 25, }, // Inter - }, - { // UV plane - { 214, 132, 42, }, // Intra - { 229, 143, 46, }, // Inter - }, - }, -#endif - { // TX_4x4 - { // Y plane - { 195, 84, 8, }, // Intra - { 191, 124, 25, }, // Inter - }, - { // UV plane - { 214, 132, 42, }, // Intra - { 229, 143, 46, }, // Inter - }, - }, - { // TX_8x8 - { // Y plane - { 125, 52, 6, }, // Intra - { 202, 108, 18, }, // Inter - }, - { // UV plane - { 212, 113, 29, }, // Intra - { 225, 144, 42, }, // Inter - }, - }, - { // TX_16x16 - { // Y plane - { 7, 5, 1, }, // Intra - { 19, 19, 3, }, // Inter - }, - { // UV plane - { 211, 96, 22, }, // Intra - { 233, 146, 43, }, // Inter - }, - }, - { // TX_32x32 - { // Y plane - { 17, 7, 1, }, // Intra - { 36, 29, 10, }, // Inter - }, - { // UV plane - { 181, 61, 10, }, // Intra - { 197, 82, 25, }, // Inter - }, - }, -#if CONFIG_TX64X64 - { // TX_64x64 FIXME: currently the same as 32x32 - { // Y plane - { 17, 7, 1, }, // Intra - { 36, 29, 10, }, // Inter - }, - { // UV plane - { 181, 61, 10, }, // Intra - { 197, 82, 25, }, // Inter - }, - }, -#endif -}; - +#if !CONFIG_Q_ADAPT_PROBS static const coeff_cdf_model default_coef_head_cdf_4x4[PLANE_TYPES] = { { // Y plane { // Intra @@ -4152,70 +912,70 @@ static const coeff_cdf_model default_coef_head_cdf_4x4[PLANE_TYPES] = { { AOM_ICDF(1088), AOM_ICDF(6358), AOM_ICDF(8428), AOM_ICDF(16648), AOM_ICDF(18276), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(14529), AOM_ICDF(18769), AOM_ICDF(29100), AOM_ICDF(29634), - AOM_ICDF(32768) }, - {AOM_ICDF(12993), AOM_ICDF(17117), AOM_ICDF(28404), AOM_ICDF(28988), - AOM_ICDF(32768) }, - {AOM_ICDF(11201), AOM_ICDF(14084), AOM_ICDF(25818), AOM_ICDF(26504), - AOM_ICDF(32768) }, - {AOM_ICDF(9793), AOM_ICDF(11267), AOM_ICDF(21775), AOM_ICDF(22451), - AOM_ICDF(32768) }, - {AOM_ICDF(7105), AOM_ICDF(7562), AOM_ICDF(15777), AOM_ICDF(16225), - AOM_ICDF(32768) }, - {AOM_ICDF(3905), AOM_ICDF(3966), AOM_ICDF(8359), AOM_ICDF(8526), - AOM_ICDF(32768) } }, + { AOM_ICDF(14529), AOM_ICDF(18769), AOM_ICDF(29100), AOM_ICDF(29634), + AOM_ICDF(32768) }, + { AOM_ICDF(12993), AOM_ICDF(17117), AOM_ICDF(28404), AOM_ICDF(28988), + AOM_ICDF(32768) }, + { AOM_ICDF(11201), AOM_ICDF(14084), AOM_ICDF(25818), AOM_ICDF(26504), + AOM_ICDF(32768) }, + { AOM_ICDF(9793), AOM_ICDF(11267), AOM_ICDF(21775), AOM_ICDF(22451), + AOM_ICDF(32768) }, + { AOM_ICDF(7105), AOM_ICDF(7562), AOM_ICDF(15777), AOM_ICDF(16225), + AOM_ICDF(32768) }, + { AOM_ICDF(3905), AOM_ICDF(3966), AOM_ICDF(8359), AOM_ICDF(8526), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(20033), AOM_ICDF(23643), AOM_ICDF(31102), AOM_ICDF(31374), - AOM_ICDF(32768) }, - {AOM_ICDF(16321), AOM_ICDF(20350), AOM_ICDF(30167), AOM_ICDF(30546), - AOM_ICDF(32768) }, - {AOM_ICDF(12993), AOM_ICDF(15512), AOM_ICDF(26859), AOM_ICDF(27396), - AOM_ICDF(32768) }, - {AOM_ICDF(10305), AOM_ICDF(11659), AOM_ICDF(21669), AOM_ICDF(22330), - AOM_ICDF(32768) }, - {AOM_ICDF(7361), AOM_ICDF(7819), AOM_ICDF(15450), AOM_ICDF(15940), - AOM_ICDF(32768) }, - {AOM_ICDF(3521), AOM_ICDF(3580), AOM_ICDF(7805), AOM_ICDF(7976), - AOM_ICDF(32768) } }, + { AOM_ICDF(20033), AOM_ICDF(23643), AOM_ICDF(31102), AOM_ICDF(31374), + AOM_ICDF(32768) }, + { AOM_ICDF(16321), AOM_ICDF(20350), AOM_ICDF(30167), AOM_ICDF(30546), + AOM_ICDF(32768) }, + { AOM_ICDF(12993), AOM_ICDF(15512), AOM_ICDF(26859), AOM_ICDF(27396), + AOM_ICDF(32768) }, + { AOM_ICDF(10305), AOM_ICDF(11659), AOM_ICDF(21669), AOM_ICDF(22330), + AOM_ICDF(32768) }, + { AOM_ICDF(7361), AOM_ICDF(7819), AOM_ICDF(15450), AOM_ICDF(15940), + AOM_ICDF(32768) }, + { AOM_ICDF(3521), AOM_ICDF(3580), AOM_ICDF(7805), AOM_ICDF(7976), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(21057), AOM_ICDF(25460), AOM_ICDF(31740), AOM_ICDF(31952), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(21173), AOM_ICDF(30761), AOM_ICDF(31092), - AOM_ICDF(32768) }, - {AOM_ICDF(11841), AOM_ICDF(14615), AOM_ICDF(26188), AOM_ICDF(26824), - AOM_ICDF(32768) }, - {AOM_ICDF(7745), AOM_ICDF(8991), AOM_ICDF(18937), AOM_ICDF(19707), - AOM_ICDF(32768) }, - {AOM_ICDF(4417), AOM_ICDF(4706), AOM_ICDF(10342), AOM_ICDF(10890), - AOM_ICDF(32768) }, - {AOM_ICDF(7617), AOM_ICDF(8392), AOM_ICDF(17295), AOM_ICDF(17915), - AOM_ICDF(32768) } }, + { AOM_ICDF(21057), AOM_ICDF(25460), AOM_ICDF(31740), AOM_ICDF(31952), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(21173), AOM_ICDF(30761), AOM_ICDF(31092), + AOM_ICDF(32768) }, + { AOM_ICDF(11841), AOM_ICDF(14615), AOM_ICDF(26188), AOM_ICDF(26824), + AOM_ICDF(32768) }, + { AOM_ICDF(7745), AOM_ICDF(8991), AOM_ICDF(18937), AOM_ICDF(19707), + AOM_ICDF(32768) }, + { AOM_ICDF(4417), AOM_ICDF(4706), AOM_ICDF(10342), AOM_ICDF(10890), + AOM_ICDF(32768) }, + { AOM_ICDF(7617), AOM_ICDF(8392), AOM_ICDF(17295), AOM_ICDF(17915), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(20417), AOM_ICDF(26452), AOM_ICDF(32166), AOM_ICDF(32321), - AOM_ICDF(32768) }, - {AOM_ICDF(15809), AOM_ICDF(21634), AOM_ICDF(30947), AOM_ICDF(31298), - AOM_ICDF(32768) }, - {AOM_ICDF(10049), AOM_ICDF(12176), AOM_ICDF(23495), AOM_ICDF(24229), - AOM_ICDF(32768) }, - {AOM_ICDF(5953), AOM_ICDF(6731), AOM_ICDF(16166), AOM_ICDF(16798), - AOM_ICDF(32768) }, - {AOM_ICDF(6081), AOM_ICDF(6188), AOM_ICDF(8114), AOM_ICDF(8764), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2291), AOM_ICDF(4448), AOM_ICDF(5527), - AOM_ICDF(32768) } }, + { AOM_ICDF(20417), AOM_ICDF(26452), AOM_ICDF(32166), AOM_ICDF(32321), + AOM_ICDF(32768) }, + { AOM_ICDF(15809), AOM_ICDF(21634), AOM_ICDF(30947), AOM_ICDF(31298), + AOM_ICDF(32768) }, + { AOM_ICDF(10049), AOM_ICDF(12176), AOM_ICDF(23495), AOM_ICDF(24229), + AOM_ICDF(32768) }, + { AOM_ICDF(5953), AOM_ICDF(6731), AOM_ICDF(16166), AOM_ICDF(16798), + AOM_ICDF(32768) }, + { AOM_ICDF(6081), AOM_ICDF(6188), AOM_ICDF(8114), AOM_ICDF(8764), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2291), AOM_ICDF(4448), AOM_ICDF(5527), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(9153), AOM_ICDF(25905), AOM_ICDF(31431), AOM_ICDF(31934), - AOM_ICDF(32768) }, - {AOM_ICDF(9025), AOM_ICDF(23345), AOM_ICDF(30033), AOM_ICDF(30965), - AOM_ICDF(32768) }, - {AOM_ICDF(5953), AOM_ICDF(13835), AOM_ICDF(22032), AOM_ICDF(24664), - AOM_ICDF(32768) }, - {AOM_ICDF(6337), AOM_ICDF(11435), AOM_ICDF(18366), AOM_ICDF(21418), - AOM_ICDF(32768) }, - {AOM_ICDF(3137), AOM_ICDF(4871), AOM_ICDF(8519), AOM_ICDF(12426), - AOM_ICDF(32768) }, - {AOM_ICDF(1857), AOM_ICDF(2727), AOM_ICDF(5540), AOM_ICDF(8757), - AOM_ICDF(32768) } } }, + { AOM_ICDF(9153), AOM_ICDF(25905), AOM_ICDF(31431), AOM_ICDF(31934), + AOM_ICDF(32768) }, + { AOM_ICDF(9025), AOM_ICDF(23345), AOM_ICDF(30033), AOM_ICDF(30965), + AOM_ICDF(32768) }, + { AOM_ICDF(5953), AOM_ICDF(13835), AOM_ICDF(22032), AOM_ICDF(24664), + AOM_ICDF(32768) }, + { AOM_ICDF(6337), AOM_ICDF(11435), AOM_ICDF(18366), AOM_ICDF(21418), + AOM_ICDF(32768) }, + { AOM_ICDF(3137), AOM_ICDF(4871), AOM_ICDF(8519), AOM_ICDF(12426), + AOM_ICDF(32768) }, + { AOM_ICDF(1857), AOM_ICDF(2727), AOM_ICDF(5540), AOM_ICDF(8757), + AOM_ICDF(32768) } } }, { // Intra { // Band 0 { AOM_ICDF(24512), AOM_ICDF(26673), AOM_ICDF(28962), AOM_ICDF(31929), @@ -4225,70 +985,70 @@ static const coeff_cdf_model default_coef_head_cdf_4x4[PLANE_TYPES] = { { AOM_ICDF(3264), AOM_ICDF(14756), AOM_ICDF(20107), AOM_ICDF(29407), AOM_ICDF(30032), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(21313), AOM_ICDF(26020), AOM_ICDF(32523), AOM_ICDF(32575), - AOM_ICDF(32768) }, - {AOM_ICDF(18369), AOM_ICDF(24215), AOM_ICDF(32291), AOM_ICDF(32391), - AOM_ICDF(32768) }, - {AOM_ICDF(15297), AOM_ICDF(19637), AOM_ICDF(30414), AOM_ICDF(30752), - AOM_ICDF(32768) }, - {AOM_ICDF(11713), AOM_ICDF(14040), AOM_ICDF(25408), AOM_ICDF(26033), - AOM_ICDF(32768) }, - {AOM_ICDF(9537), AOM_ICDF(10173), AOM_ICDF(18839), AOM_ICDF(19315), - AOM_ICDF(32768) }, - {AOM_ICDF(9025), AOM_ICDF(9093), AOM_ICDF(13987), AOM_ICDF(14115), - AOM_ICDF(32768) } }, + { AOM_ICDF(21313), AOM_ICDF(26020), AOM_ICDF(32523), AOM_ICDF(32575), + AOM_ICDF(32768) }, + { AOM_ICDF(18369), AOM_ICDF(24215), AOM_ICDF(32291), AOM_ICDF(32391), + AOM_ICDF(32768) }, + { AOM_ICDF(15297), AOM_ICDF(19637), AOM_ICDF(30414), AOM_ICDF(30752), + AOM_ICDF(32768) }, + { AOM_ICDF(11713), AOM_ICDF(14040), AOM_ICDF(25408), AOM_ICDF(26033), + AOM_ICDF(32768) }, + { AOM_ICDF(9537), AOM_ICDF(10173), AOM_ICDF(18839), AOM_ICDF(19315), + AOM_ICDF(32768) }, + { AOM_ICDF(9025), AOM_ICDF(9093), AOM_ICDF(13987), AOM_ICDF(14115), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(22721), AOM_ICDF(27599), AOM_ICDF(32592), AOM_ICDF(32636), - AOM_ICDF(32768) }, - {AOM_ICDF(19009), AOM_ICDF(24676), AOM_ICDF(32258), AOM_ICDF(32367), - AOM_ICDF(32768) }, - {AOM_ICDF(12737), AOM_ICDF(16769), AOM_ICDF(28739), AOM_ICDF(29247), - AOM_ICDF(32768) }, - {AOM_ICDF(8769), AOM_ICDF(10956), AOM_ICDF(21941), AOM_ICDF(22840), - AOM_ICDF(32768) }, - {AOM_ICDF(6721), AOM_ICDF(7678), AOM_ICDF(15319), AOM_ICDF(16290), - AOM_ICDF(32768) }, - {AOM_ICDF(4417), AOM_ICDF(4430), AOM_ICDF(4583), AOM_ICDF(5712), - AOM_ICDF(32768) } }, + { AOM_ICDF(22721), AOM_ICDF(27599), AOM_ICDF(32592), AOM_ICDF(32636), + AOM_ICDF(32768) }, + { AOM_ICDF(19009), AOM_ICDF(24676), AOM_ICDF(32258), AOM_ICDF(32367), + AOM_ICDF(32768) }, + { AOM_ICDF(12737), AOM_ICDF(16769), AOM_ICDF(28739), AOM_ICDF(29247), + AOM_ICDF(32768) }, + { AOM_ICDF(8769), AOM_ICDF(10956), AOM_ICDF(21941), AOM_ICDF(22840), + AOM_ICDF(32768) }, + { AOM_ICDF(6721), AOM_ICDF(7678), AOM_ICDF(15319), AOM_ICDF(16290), + AOM_ICDF(32768) }, + { AOM_ICDF(4417), AOM_ICDF(4430), AOM_ICDF(4583), AOM_ICDF(5712), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(22849), AOM_ICDF(28333), AOM_ICDF(32633), AOM_ICDF(32671), - AOM_ICDF(32768) }, - {AOM_ICDF(18497), AOM_ICDF(24619), AOM_ICDF(32184), AOM_ICDF(32315), - AOM_ICDF(32768) }, - {AOM_ICDF(11841), AOM_ICDF(14640), AOM_ICDF(27251), AOM_ICDF(27752), - AOM_ICDF(32768) }, - {AOM_ICDF(8385), AOM_ICDF(10154), AOM_ICDF(18339), AOM_ICDF(19621), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(6977), AOM_ICDF(13787), AOM_ICDF(15289), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) } }, + { AOM_ICDF(22849), AOM_ICDF(28333), AOM_ICDF(32633), AOM_ICDF(32671), + AOM_ICDF(32768) }, + { AOM_ICDF(18497), AOM_ICDF(24619), AOM_ICDF(32184), AOM_ICDF(32315), + AOM_ICDF(32768) }, + { AOM_ICDF(11841), AOM_ICDF(14640), AOM_ICDF(27251), AOM_ICDF(27752), + AOM_ICDF(32768) }, + { AOM_ICDF(8385), AOM_ICDF(10154), AOM_ICDF(18339), AOM_ICDF(19621), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(6977), AOM_ICDF(13787), AOM_ICDF(15289), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(20417), AOM_ICDF(28167), AOM_ICDF(32552), AOM_ICDF(32621), - AOM_ICDF(32768) }, - {AOM_ICDF(16833), AOM_ICDF(23968), AOM_ICDF(31991), AOM_ICDF(32174), - AOM_ICDF(32768) }, - {AOM_ICDF(10433), AOM_ICDF(13387), AOM_ICDF(26356), AOM_ICDF(26951), - AOM_ICDF(32768) }, - {AOM_ICDF(5057), AOM_ICDF(6823), AOM_ICDF(18967), AOM_ICDF(19843), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(6479), AOM_ICDF(11672), AOM_ICDF(13052), - AOM_ICDF(32768) }, - {AOM_ICDF(2241), AOM_ICDF(2265), AOM_ICDF(6355), AOM_ICDF(6432), - AOM_ICDF(32768) } }, + { AOM_ICDF(20417), AOM_ICDF(28167), AOM_ICDF(32552), AOM_ICDF(32621), + AOM_ICDF(32768) }, + { AOM_ICDF(16833), AOM_ICDF(23968), AOM_ICDF(31991), AOM_ICDF(32174), + AOM_ICDF(32768) }, + { AOM_ICDF(10433), AOM_ICDF(13387), AOM_ICDF(26356), AOM_ICDF(26951), + AOM_ICDF(32768) }, + { AOM_ICDF(5057), AOM_ICDF(6823), AOM_ICDF(18967), AOM_ICDF(19843), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(6479), AOM_ICDF(11672), AOM_ICDF(13052), + AOM_ICDF(32768) }, + { AOM_ICDF(2241), AOM_ICDF(2265), AOM_ICDF(6355), AOM_ICDF(6432), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(12097), AOM_ICDF(28717), AOM_ICDF(32406), AOM_ICDF(32555), - AOM_ICDF(32768) }, - {AOM_ICDF(10433), AOM_ICDF(26113), AOM_ICDF(31504), AOM_ICDF(31975), - AOM_ICDF(32768) }, - {AOM_ICDF(5825), AOM_ICDF(14284), AOM_ICDF(21349), AOM_ICDF(24461), - AOM_ICDF(32768) }, - {AOM_ICDF(4545), AOM_ICDF(8454), AOM_ICDF(12648), AOM_ICDF(17501), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(7173), AOM_ICDF(15272), AOM_ICDF(19322), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), - AOM_ICDF(32768) } } } }, + { AOM_ICDF(12097), AOM_ICDF(28717), AOM_ICDF(32406), AOM_ICDF(32555), + AOM_ICDF(32768) }, + { AOM_ICDF(10433), AOM_ICDF(26113), AOM_ICDF(31504), AOM_ICDF(31975), + AOM_ICDF(32768) }, + { AOM_ICDF(5825), AOM_ICDF(14284), AOM_ICDF(21349), AOM_ICDF(24461), + AOM_ICDF(32768) }, + { AOM_ICDF(4545), AOM_ICDF(8454), AOM_ICDF(12648), AOM_ICDF(17501), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(7173), AOM_ICDF(15272), AOM_ICDF(19322), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), + AOM_ICDF(32768) } } } }, { // UV plane { // Inter { // Band 0 @@ -4299,70 +1059,70 @@ static const coeff_cdf_model default_coef_head_cdf_4x4[PLANE_TYPES] = { { AOM_ICDF(5440), AOM_ICDF(13412), AOM_ICDF(18469), AOM_ICDF(26423), AOM_ICDF(27669), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(17857), AOM_ICDF(26327), AOM_ICDF(31983), AOM_ICDF(32219), - AOM_ICDF(32768) }, - {AOM_ICDF(16065), AOM_ICDF(24198), AOM_ICDF(31431), AOM_ICDF(31785), - AOM_ICDF(32768) }, - {AOM_ICDF(12865), AOM_ICDF(18011), AOM_ICDF(28454), AOM_ICDF(29166), - AOM_ICDF(32768) }, - {AOM_ICDF(9665), AOM_ICDF(12501), AOM_ICDF(24331), AOM_ICDF(25147), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(3121), AOM_ICDF(12661), AOM_ICDF(13034), - AOM_ICDF(32768) }, - {AOM_ICDF(4033), AOM_ICDF(4140), AOM_ICDF(11834), AOM_ICDF(11977), - AOM_ICDF(32768) } }, + { AOM_ICDF(17857), AOM_ICDF(26327), AOM_ICDF(31983), AOM_ICDF(32219), + AOM_ICDF(32768) }, + { AOM_ICDF(16065), AOM_ICDF(24198), AOM_ICDF(31431), AOM_ICDF(31785), + AOM_ICDF(32768) }, + { AOM_ICDF(12865), AOM_ICDF(18011), AOM_ICDF(28454), AOM_ICDF(29166), + AOM_ICDF(32768) }, + { AOM_ICDF(9665), AOM_ICDF(12501), AOM_ICDF(24331), AOM_ICDF(25147), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(3121), AOM_ICDF(12661), AOM_ICDF(13034), + AOM_ICDF(32768) }, + { AOM_ICDF(4033), AOM_ICDF(4140), AOM_ICDF(11834), AOM_ICDF(11977), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(21185), AOM_ICDF(28338), AOM_ICDF(32249), AOM_ICDF(32417), - AOM_ICDF(32768) }, - {AOM_ICDF(18497), AOM_ICDF(25227), AOM_ICDF(31905), AOM_ICDF(32122), - AOM_ICDF(32768) }, - {AOM_ICDF(12097), AOM_ICDF(16516), AOM_ICDF(28610), AOM_ICDF(29166), - AOM_ICDF(32768) }, - {AOM_ICDF(9281), AOM_ICDF(11157), AOM_ICDF(21438), AOM_ICDF(22312), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(6566), AOM_ICDF(15585), AOM_ICDF(16340), - AOM_ICDF(32768) }, - {AOM_ICDF(9409), AOM_ICDF(9659), AOM_ICDF(11827), AOM_ICDF(12911), - AOM_ICDF(32768) } }, + { AOM_ICDF(21185), AOM_ICDF(28338), AOM_ICDF(32249), AOM_ICDF(32417), + AOM_ICDF(32768) }, + { AOM_ICDF(18497), AOM_ICDF(25227), AOM_ICDF(31905), AOM_ICDF(32122), + AOM_ICDF(32768) }, + { AOM_ICDF(12097), AOM_ICDF(16516), AOM_ICDF(28610), AOM_ICDF(29166), + AOM_ICDF(32768) }, + { AOM_ICDF(9281), AOM_ICDF(11157), AOM_ICDF(21438), AOM_ICDF(22312), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(6566), AOM_ICDF(15585), AOM_ICDF(16340), + AOM_ICDF(32768) }, + { AOM_ICDF(9409), AOM_ICDF(9659), AOM_ICDF(11827), AOM_ICDF(12911), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(22337), AOM_ICDF(29459), AOM_ICDF(32382), AOM_ICDF(32519), - AOM_ICDF(32768) }, - {AOM_ICDF(16961), AOM_ICDF(25262), AOM_ICDF(31874), AOM_ICDF(32123), - AOM_ICDF(32768) }, - {AOM_ICDF(12353), AOM_ICDF(17748), AOM_ICDF(29300), AOM_ICDF(29852), - AOM_ICDF(32768) }, - {AOM_ICDF(9025), AOM_ICDF(11528), AOM_ICDF(24468), AOM_ICDF(25141), - AOM_ICDF(32768) }, - {AOM_ICDF(6209), AOM_ICDF(6565), AOM_ICDF(15806), AOM_ICDF(16121), - AOM_ICDF(32768) }, - {AOM_ICDF(2497), AOM_ICDF(2524), AOM_ICDF(7050), AOM_ICDF(7125), - AOM_ICDF(32768) } }, + { AOM_ICDF(22337), AOM_ICDF(29459), AOM_ICDF(32382), AOM_ICDF(32519), + AOM_ICDF(32768) }, + { AOM_ICDF(16961), AOM_ICDF(25262), AOM_ICDF(31874), AOM_ICDF(32123), + AOM_ICDF(32768) }, + { AOM_ICDF(12353), AOM_ICDF(17748), AOM_ICDF(29300), AOM_ICDF(29852), + AOM_ICDF(32768) }, + { AOM_ICDF(9025), AOM_ICDF(11528), AOM_ICDF(24468), AOM_ICDF(25141), + AOM_ICDF(32768) }, + { AOM_ICDF(6209), AOM_ICDF(6565), AOM_ICDF(15806), AOM_ICDF(16121), + AOM_ICDF(32768) }, + { AOM_ICDF(2497), AOM_ICDF(2524), AOM_ICDF(7050), AOM_ICDF(7125), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(20417), AOM_ICDF(29779), AOM_ICDF(32552), AOM_ICDF(32636), - AOM_ICDF(32768) }, - {AOM_ICDF(15553), AOM_ICDF(26420), AOM_ICDF(32063), AOM_ICDF(32295), - AOM_ICDF(32768) }, - {AOM_ICDF(9665), AOM_ICDF(17946), AOM_ICDF(29385), AOM_ICDF(30096), - AOM_ICDF(32768) }, - {AOM_ICDF(5569), AOM_ICDF(10207), AOM_ICDF(22410), AOM_ICDF(23836), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), - AOM_ICDF(32768) }, - {AOM_ICDF(2369), AOM_ICDF(2395), AOM_ICDF(6822), AOM_ICDF(6898), - AOM_ICDF(32768) } }, + { AOM_ICDF(20417), AOM_ICDF(29779), AOM_ICDF(32552), AOM_ICDF(32636), + AOM_ICDF(32768) }, + { AOM_ICDF(15553), AOM_ICDF(26420), AOM_ICDF(32063), AOM_ICDF(32295), + AOM_ICDF(32768) }, + { AOM_ICDF(9665), AOM_ICDF(17946), AOM_ICDF(29385), AOM_ICDF(30096), + AOM_ICDF(32768) }, + { AOM_ICDF(5569), AOM_ICDF(10207), AOM_ICDF(22410), AOM_ICDF(23836), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), + AOM_ICDF(32768) }, + { AOM_ICDF(2369), AOM_ICDF(2395), AOM_ICDF(6822), AOM_ICDF(6898), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(10177), AOM_ICDF(30567), AOM_ICDF(32725), AOM_ICDF(32745), - AOM_ICDF(32768) }, - {AOM_ICDF(9537), AOM_ICDF(28243), AOM_ICDF(32179), AOM_ICDF(32423), - AOM_ICDF(32768) }, - {AOM_ICDF(13377), AOM_ICDF(23187), AOM_ICDF(29322), AOM_ICDF(30382), - AOM_ICDF(32768) }, - {AOM_ICDF(13121), AOM_ICDF(21346), AOM_ICDF(29507), AOM_ICDF(30326), - AOM_ICDF(32768) }, - {AOM_ICDF(4417), AOM_ICDF(4939), AOM_ICDF(15104), AOM_ICDF(15535), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), - AOM_ICDF(32768) } } }, + { AOM_ICDF(10177), AOM_ICDF(30567), AOM_ICDF(32725), AOM_ICDF(32745), + AOM_ICDF(32768) }, + { AOM_ICDF(9537), AOM_ICDF(28243), AOM_ICDF(32179), AOM_ICDF(32423), + AOM_ICDF(32768) }, + { AOM_ICDF(13377), AOM_ICDF(23187), AOM_ICDF(29322), AOM_ICDF(30382), + AOM_ICDF(32768) }, + { AOM_ICDF(13121), AOM_ICDF(21346), AOM_ICDF(29507), AOM_ICDF(30326), + AOM_ICDF(32768) }, + { AOM_ICDF(4417), AOM_ICDF(4939), AOM_ICDF(15104), AOM_ICDF(15535), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), + AOM_ICDF(32768) } } }, { // Inter { // Band 0 { AOM_ICDF(29376), AOM_ICDF(30098), AOM_ICDF(32421), AOM_ICDF(32766), @@ -4372,70 +1132,70 @@ static const coeff_cdf_model default_coef_head_cdf_4x4[PLANE_TYPES] = { { AOM_ICDF(5952), AOM_ICDF(16505), AOM_ICDF(25955), AOM_ICDF(32163), AOM_ICDF(32365), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(19649), AOM_ICDF(30160), AOM_ICDF(32743), AOM_ICDF(32753), - AOM_ICDF(32768) }, - {AOM_ICDF(18881), AOM_ICDF(28724), AOM_ICDF(32688), AOM_ICDF(32717), - AOM_ICDF(32768) }, - {AOM_ICDF(16833), AOM_ICDF(23053), AOM_ICDF(31244), AOM_ICDF(31573), - AOM_ICDF(32768) }, - {AOM_ICDF(14657), AOM_ICDF(17714), AOM_ICDF(26083), AOM_ICDF(26978), - AOM_ICDF(32768) }, - {AOM_ICDF(14657), AOM_ICDF(16618), AOM_ICDF(24597), AOM_ICDF(25403), - AOM_ICDF(32768) }, - {AOM_ICDF(4289), AOM_ICDF(4326), AOM_ICDF(10686), AOM_ICDF(10751), - AOM_ICDF(32768) } }, + { AOM_ICDF(19649), AOM_ICDF(30160), AOM_ICDF(32743), AOM_ICDF(32753), + AOM_ICDF(32768) }, + { AOM_ICDF(18881), AOM_ICDF(28724), AOM_ICDF(32688), AOM_ICDF(32717), + AOM_ICDF(32768) }, + { AOM_ICDF(16833), AOM_ICDF(23053), AOM_ICDF(31244), AOM_ICDF(31573), + AOM_ICDF(32768) }, + { AOM_ICDF(14657), AOM_ICDF(17714), AOM_ICDF(26083), AOM_ICDF(26978), + AOM_ICDF(32768) }, + { AOM_ICDF(14657), AOM_ICDF(16618), AOM_ICDF(24597), AOM_ICDF(25403), + AOM_ICDF(32768) }, + { AOM_ICDF(4289), AOM_ICDF(4326), AOM_ICDF(10686), AOM_ICDF(10751), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(21953), AOM_ICDF(30956), AOM_ICDF(32748), AOM_ICDF(32757), - AOM_ICDF(32768) }, - {AOM_ICDF(20929), AOM_ICDF(29412), AOM_ICDF(32700), AOM_ICDF(32725), - AOM_ICDF(32768) }, - {AOM_ICDF(13377), AOM_ICDF(21495), AOM_ICDF(31216), AOM_ICDF(31569), - AOM_ICDF(32768) }, - {AOM_ICDF(9153), AOM_ICDF(15097), AOM_ICDF(28295), AOM_ICDF(28990), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5363), AOM_ICDF(13839), AOM_ICDF(13894), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), - AOM_ICDF(32768) } }, + { AOM_ICDF(21953), AOM_ICDF(30956), AOM_ICDF(32748), AOM_ICDF(32757), + AOM_ICDF(32768) }, + { AOM_ICDF(20929), AOM_ICDF(29412), AOM_ICDF(32700), AOM_ICDF(32725), + AOM_ICDF(32768) }, + { AOM_ICDF(13377), AOM_ICDF(21495), AOM_ICDF(31216), AOM_ICDF(31569), + AOM_ICDF(32768) }, + { AOM_ICDF(9153), AOM_ICDF(15097), AOM_ICDF(28295), AOM_ICDF(28990), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5363), AOM_ICDF(13839), AOM_ICDF(13894), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(20289), AOM_ICDF(31164), AOM_ICDF(32745), AOM_ICDF(32755), - AOM_ICDF(32768) }, - {AOM_ICDF(17601), AOM_ICDF(29635), AOM_ICDF(32739), AOM_ICDF(32751), - AOM_ICDF(32768) }, - {AOM_ICDF(18241), AOM_ICDF(24284), AOM_ICDF(32116), AOM_ICDF(32258), - AOM_ICDF(32768) }, - {AOM_ICDF(32705), AOM_ICDF(32706), AOM_ICDF(32739), AOM_ICDF(32740), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), - AOM_ICDF(32768) }, - {AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), - AOM_ICDF(32768) } }, + { AOM_ICDF(20289), AOM_ICDF(31164), AOM_ICDF(32745), AOM_ICDF(32755), + AOM_ICDF(32768) }, + { AOM_ICDF(17601), AOM_ICDF(29635), AOM_ICDF(32739), AOM_ICDF(32751), + AOM_ICDF(32768) }, + { AOM_ICDF(18241), AOM_ICDF(24284), AOM_ICDF(32116), AOM_ICDF(32258), + AOM_ICDF(32768) }, + { AOM_ICDF(32705), AOM_ICDF(32706), AOM_ICDF(32739), AOM_ICDF(32740), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), + AOM_ICDF(32768) }, + { AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(19009), AOM_ICDF(31481), AOM_ICDF(32742), AOM_ICDF(32754), - AOM_ICDF(32768) }, - {AOM_ICDF(15809), AOM_ICDF(30521), AOM_ICDF(32736), AOM_ICDF(32750), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(32705), AOM_ICDF(32737), AOM_ICDF(32753), - AOM_ICDF(32768) }, - {AOM_ICDF(7873), AOM_ICDF(8039), AOM_ICDF(19981), AOM_ICDF(20068), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), - AOM_ICDF(32768) } }, + { AOM_ICDF(19009), AOM_ICDF(31481), AOM_ICDF(32742), AOM_ICDF(32754), + AOM_ICDF(32768) }, + { AOM_ICDF(15809), AOM_ICDF(30521), AOM_ICDF(32736), AOM_ICDF(32750), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(32705), AOM_ICDF(32737), AOM_ICDF(32753), + AOM_ICDF(32768) }, + { AOM_ICDF(7873), AOM_ICDF(8039), AOM_ICDF(19981), AOM_ICDF(20068), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(11841), AOM_ICDF(32116), AOM_ICDF(32728), AOM_ICDF(32748), - AOM_ICDF(32768) }, - {AOM_ICDF(12353), AOM_ICDF(32132), AOM_ICDF(32729), AOM_ICDF(32748), - AOM_ICDF(32768) }, - {AOM_ICDF(7489), AOM_ICDF(12435), AOM_ICDF(25708), AOM_ICDF(26666), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), - AOM_ICDF(32768) }, - {AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), - AOM_ICDF(32768) }, - {AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), - AOM_ICDF(32768) } } } } + { AOM_ICDF(11841), AOM_ICDF(32116), AOM_ICDF(32728), AOM_ICDF(32748), + AOM_ICDF(32768) }, + { AOM_ICDF(12353), AOM_ICDF(32132), AOM_ICDF(32729), AOM_ICDF(32748), + AOM_ICDF(32768) }, + { AOM_ICDF(7489), AOM_ICDF(12435), AOM_ICDF(25708), AOM_ICDF(26666), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), + AOM_ICDF(32768) }, + { AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), + AOM_ICDF(32768) }, + { AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), + AOM_ICDF(32768) } } } } }; static const coeff_cdf_model default_coef_head_cdf_8x8[PLANE_TYPES] = { { // Y plane @@ -4448,70 +1208,70 @@ static const coeff_cdf_model default_coef_head_cdf_8x8[PLANE_TYPES] = { { AOM_ICDF(832), AOM_ICDF(5270), AOM_ICDF(5918), AOM_ICDF(12645), AOM_ICDF(13532), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(14017), AOM_ICDF(16139), AOM_ICDF(26799), AOM_ICDF(27295), - AOM_ICDF(32768) }, - {AOM_ICDF(12737), AOM_ICDF(15136), AOM_ICDF(26235), AOM_ICDF(26816), - AOM_ICDF(32768) }, - {AOM_ICDF(10817), AOM_ICDF(12445), AOM_ICDF(23637), AOM_ICDF(24217), - AOM_ICDF(32768) }, - {AOM_ICDF(8897), AOM_ICDF(9702), AOM_ICDF(20040), AOM_ICDF(20500), - AOM_ICDF(32768) }, - {AOM_ICDF(5953), AOM_ICDF(6156), AOM_ICDF(13966), AOM_ICDF(14205), - AOM_ICDF(32768) }, - {AOM_ICDF(2497), AOM_ICDF(2519), AOM_ICDF(6222), AOM_ICDF(6300), - AOM_ICDF(32768) } }, + { AOM_ICDF(14017), AOM_ICDF(16139), AOM_ICDF(26799), AOM_ICDF(27295), + AOM_ICDF(32768) }, + { AOM_ICDF(12737), AOM_ICDF(15136), AOM_ICDF(26235), AOM_ICDF(26816), + AOM_ICDF(32768) }, + { AOM_ICDF(10817), AOM_ICDF(12445), AOM_ICDF(23637), AOM_ICDF(24217), + AOM_ICDF(32768) }, + { AOM_ICDF(8897), AOM_ICDF(9702), AOM_ICDF(20040), AOM_ICDF(20500), + AOM_ICDF(32768) }, + { AOM_ICDF(5953), AOM_ICDF(6156), AOM_ICDF(13966), AOM_ICDF(14205), + AOM_ICDF(32768) }, + { AOM_ICDF(2497), AOM_ICDF(2519), AOM_ICDF(6222), AOM_ICDF(6300), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(19777), AOM_ICDF(21403), AOM_ICDF(30054), AOM_ICDF(30269), - AOM_ICDF(32768) }, - {AOM_ICDF(16193), AOM_ICDF(17913), AOM_ICDF(28593), AOM_ICDF(28883), - AOM_ICDF(32768) }, - {AOM_ICDF(12609), AOM_ICDF(13572), AOM_ICDF(25248), AOM_ICDF(25534), - AOM_ICDF(32768) }, - {AOM_ICDF(9665), AOM_ICDF(10118), AOM_ICDF(20721), AOM_ICDF(20968), - AOM_ICDF(32768) }, - {AOM_ICDF(6849), AOM_ICDF(7028), AOM_ICDF(15202), AOM_ICDF(15391), - AOM_ICDF(32768) }, - {AOM_ICDF(3009), AOM_ICDF(3036), AOM_ICDF(7601), AOM_ICDF(7675), - AOM_ICDF(32768) } }, + { AOM_ICDF(19777), AOM_ICDF(21403), AOM_ICDF(30054), AOM_ICDF(30269), + AOM_ICDF(32768) }, + { AOM_ICDF(16193), AOM_ICDF(17913), AOM_ICDF(28593), AOM_ICDF(28883), + AOM_ICDF(32768) }, + { AOM_ICDF(12609), AOM_ICDF(13572), AOM_ICDF(25248), AOM_ICDF(25534), + AOM_ICDF(32768) }, + { AOM_ICDF(9665), AOM_ICDF(10118), AOM_ICDF(20721), AOM_ICDF(20968), + AOM_ICDF(32768) }, + { AOM_ICDF(6849), AOM_ICDF(7028), AOM_ICDF(15202), AOM_ICDF(15391), + AOM_ICDF(32768) }, + { AOM_ICDF(3009), AOM_ICDF(3036), AOM_ICDF(7601), AOM_ICDF(7675), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(22593), AOM_ICDF(23915), AOM_ICDF(31159), AOM_ICDF(31283), - AOM_ICDF(32768) }, - {AOM_ICDF(17345), AOM_ICDF(18690), AOM_ICDF(29425), AOM_ICDF(29611), - AOM_ICDF(32768) }, - {AOM_ICDF(11969), AOM_ICDF(12540), AOM_ICDF(24685), AOM_ICDF(24867), - AOM_ICDF(32768) }, - {AOM_ICDF(8129), AOM_ICDF(8355), AOM_ICDF(18668), AOM_ICDF(18819), - AOM_ICDF(32768) }, - {AOM_ICDF(4673), AOM_ICDF(4714), AOM_ICDF(11752), AOM_ICDF(11814), - AOM_ICDF(32768) }, - {AOM_ICDF(1857), AOM_ICDF(1876), AOM_ICDF(5057), AOM_ICDF(5138), - AOM_ICDF(32768) } }, + { AOM_ICDF(22593), AOM_ICDF(23915), AOM_ICDF(31159), AOM_ICDF(31283), + AOM_ICDF(32768) }, + { AOM_ICDF(17345), AOM_ICDF(18690), AOM_ICDF(29425), AOM_ICDF(29611), + AOM_ICDF(32768) }, + { AOM_ICDF(11969), AOM_ICDF(12540), AOM_ICDF(24685), AOM_ICDF(24867), + AOM_ICDF(32768) }, + { AOM_ICDF(8129), AOM_ICDF(8355), AOM_ICDF(18668), AOM_ICDF(18819), + AOM_ICDF(32768) }, + { AOM_ICDF(4673), AOM_ICDF(4714), AOM_ICDF(11752), AOM_ICDF(11814), + AOM_ICDF(32768) }, + { AOM_ICDF(1857), AOM_ICDF(1876), AOM_ICDF(5057), AOM_ICDF(5138), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(24513), AOM_ICDF(25718), AOM_ICDF(31947), AOM_ICDF(32014), - AOM_ICDF(32768) }, - {AOM_ICDF(18881), AOM_ICDF(20029), AOM_ICDF(30409), AOM_ICDF(30527), - AOM_ICDF(32768) }, - {AOM_ICDF(12481), AOM_ICDF(12953), AOM_ICDF(25201), AOM_ICDF(25341), - AOM_ICDF(32768) }, - {AOM_ICDF(8385), AOM_ICDF(8528), AOM_ICDF(18815), AOM_ICDF(18910), - AOM_ICDF(32768) }, - {AOM_ICDF(4289), AOM_ICDF(4327), AOM_ICDF(10797), AOM_ICDF(10861), - AOM_ICDF(32768) }, - {AOM_ICDF(1857), AOM_ICDF(1872), AOM_ICDF(4332), AOM_ICDF(4415), - AOM_ICDF(32768) } }, + { AOM_ICDF(24513), AOM_ICDF(25718), AOM_ICDF(31947), AOM_ICDF(32014), + AOM_ICDF(32768) }, + { AOM_ICDF(18881), AOM_ICDF(20029), AOM_ICDF(30409), AOM_ICDF(30527), + AOM_ICDF(32768) }, + { AOM_ICDF(12481), AOM_ICDF(12953), AOM_ICDF(25201), AOM_ICDF(25341), + AOM_ICDF(32768) }, + { AOM_ICDF(8385), AOM_ICDF(8528), AOM_ICDF(18815), AOM_ICDF(18910), + AOM_ICDF(32768) }, + { AOM_ICDF(4289), AOM_ICDF(4327), AOM_ICDF(10797), AOM_ICDF(10861), + AOM_ICDF(32768) }, + { AOM_ICDF(1857), AOM_ICDF(1872), AOM_ICDF(4332), AOM_ICDF(4415), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(26049), AOM_ICDF(27752), AOM_ICDF(32415), AOM_ICDF(32462), - AOM_ICDF(32768) }, - {AOM_ICDF(20417), AOM_ICDF(22100), AOM_ICDF(31056), AOM_ICDF(31192), - AOM_ICDF(32768) }, - {AOM_ICDF(12481), AOM_ICDF(13075), AOM_ICDF(24646), AOM_ICDF(24844), - AOM_ICDF(32768) }, - {AOM_ICDF(7489), AOM_ICDF(7696), AOM_ICDF(17117), AOM_ICDF(17285), - AOM_ICDF(32768) }, - {AOM_ICDF(3777), AOM_ICDF(3814), AOM_ICDF(10062), AOM_ICDF(10129), - AOM_ICDF(32768) }, - {AOM_ICDF(1473), AOM_ICDF(1486), AOM_ICDF(3735), AOM_ICDF(3820), - AOM_ICDF(32768) } } }, + { AOM_ICDF(26049), AOM_ICDF(27752), AOM_ICDF(32415), AOM_ICDF(32462), + AOM_ICDF(32768) }, + { AOM_ICDF(20417), AOM_ICDF(22100), AOM_ICDF(31056), AOM_ICDF(31192), + AOM_ICDF(32768) }, + { AOM_ICDF(12481), AOM_ICDF(13075), AOM_ICDF(24646), AOM_ICDF(24844), + AOM_ICDF(32768) }, + { AOM_ICDF(7489), AOM_ICDF(7696), AOM_ICDF(17117), AOM_ICDF(17285), + AOM_ICDF(32768) }, + { AOM_ICDF(3777), AOM_ICDF(3814), AOM_ICDF(10062), AOM_ICDF(10129), + AOM_ICDF(32768) }, + { AOM_ICDF(1473), AOM_ICDF(1486), AOM_ICDF(3735), AOM_ICDF(3820), + AOM_ICDF(32768) } } }, { // Intra { // Band 0 { AOM_ICDF(25920), AOM_ICDF(27743), AOM_ICDF(29455), AOM_ICDF(32147), @@ -4521,70 +1281,70 @@ static const coeff_cdf_model default_coef_head_cdf_8x8[PLANE_TYPES] = { { AOM_ICDF(2368), AOM_ICDF(12781), AOM_ICDF(16196), AOM_ICDF(27232), AOM_ICDF(27894), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(21697), AOM_ICDF(24758), AOM_ICDF(32358), AOM_ICDF(32417), - AOM_ICDF(32768) }, - {AOM_ICDF(20289), AOM_ICDF(23960), AOM_ICDF(32111), AOM_ICDF(32213), - AOM_ICDF(32768) }, - {AOM_ICDF(17345), AOM_ICDF(19966), AOM_ICDF(30630), AOM_ICDF(30841), - AOM_ICDF(32768) }, - {AOM_ICDF(14529), AOM_ICDF(16070), AOM_ICDF(27461), AOM_ICDF(27777), - AOM_ICDF(32768) }, - {AOM_ICDF(9793), AOM_ICDF(10613), AOM_ICDF(21146), AOM_ICDF(21566), - AOM_ICDF(32768) }, - {AOM_ICDF(6977), AOM_ICDF(7162), AOM_ICDF(15591), AOM_ICDF(15776), - AOM_ICDF(32768) } }, + { AOM_ICDF(21697), AOM_ICDF(24758), AOM_ICDF(32358), AOM_ICDF(32417), + AOM_ICDF(32768) }, + { AOM_ICDF(20289), AOM_ICDF(23960), AOM_ICDF(32111), AOM_ICDF(32213), + AOM_ICDF(32768) }, + { AOM_ICDF(17345), AOM_ICDF(19966), AOM_ICDF(30630), AOM_ICDF(30841), + AOM_ICDF(32768) }, + { AOM_ICDF(14529), AOM_ICDF(16070), AOM_ICDF(27461), AOM_ICDF(27777), + AOM_ICDF(32768) }, + { AOM_ICDF(9793), AOM_ICDF(10613), AOM_ICDF(21146), AOM_ICDF(21566), + AOM_ICDF(32768) }, + { AOM_ICDF(6977), AOM_ICDF(7162), AOM_ICDF(15591), AOM_ICDF(15776), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(23617), AOM_ICDF(26783), AOM_ICDF(32572), AOM_ICDF(32607), - AOM_ICDF(32768) }, - {AOM_ICDF(20801), AOM_ICDF(24292), AOM_ICDF(32185), AOM_ICDF(32275), - AOM_ICDF(32768) }, - {AOM_ICDF(15169), AOM_ICDF(17905), AOM_ICDF(29916), AOM_ICDF(30181), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(12972), AOM_ICDF(25565), AOM_ICDF(26064), - AOM_ICDF(32768) }, - {AOM_ICDF(6849), AOM_ICDF(8334), AOM_ICDF(18543), AOM_ICDF(19446), - AOM_ICDF(32768) }, - {AOM_ICDF(3649), AOM_ICDF(4346), AOM_ICDF(12351), AOM_ICDF(13169), - AOM_ICDF(32768) } }, + { AOM_ICDF(23617), AOM_ICDF(26783), AOM_ICDF(32572), AOM_ICDF(32607), + AOM_ICDF(32768) }, + { AOM_ICDF(20801), AOM_ICDF(24292), AOM_ICDF(32185), AOM_ICDF(32275), + AOM_ICDF(32768) }, + { AOM_ICDF(15169), AOM_ICDF(17905), AOM_ICDF(29916), AOM_ICDF(30181), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(12972), AOM_ICDF(25565), AOM_ICDF(26064), + AOM_ICDF(32768) }, + { AOM_ICDF(6849), AOM_ICDF(8334), AOM_ICDF(18543), AOM_ICDF(19446), + AOM_ICDF(32768) }, + { AOM_ICDF(3649), AOM_ICDF(4346), AOM_ICDF(12351), AOM_ICDF(13169), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(25281), AOM_ICDF(28440), AOM_ICDF(32667), AOM_ICDF(32689), - AOM_ICDF(32768) }, - {AOM_ICDF(22081), AOM_ICDF(25694), AOM_ICDF(32414), AOM_ICDF(32476), - AOM_ICDF(32768) }, - {AOM_ICDF(15297), AOM_ICDF(18341), AOM_ICDF(30141), AOM_ICDF(30410), - AOM_ICDF(32768) }, - {AOM_ICDF(10305), AOM_ICDF(12381), AOM_ICDF(24477), AOM_ICDF(25084), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(6673), AOM_ICDF(16325), AOM_ICDF(17080), - AOM_ICDF(32768) }, - {AOM_ICDF(2369), AOM_ICDF(2393), AOM_ICDF(6466), AOM_ICDF(6543), - AOM_ICDF(32768) } }, + { AOM_ICDF(25281), AOM_ICDF(28440), AOM_ICDF(32667), AOM_ICDF(32689), + AOM_ICDF(32768) }, + { AOM_ICDF(22081), AOM_ICDF(25694), AOM_ICDF(32414), AOM_ICDF(32476), + AOM_ICDF(32768) }, + { AOM_ICDF(15297), AOM_ICDF(18341), AOM_ICDF(30141), AOM_ICDF(30410), + AOM_ICDF(32768) }, + { AOM_ICDF(10305), AOM_ICDF(12381), AOM_ICDF(24477), AOM_ICDF(25084), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(6673), AOM_ICDF(16325), AOM_ICDF(17080), + AOM_ICDF(32768) }, + { AOM_ICDF(2369), AOM_ICDF(2393), AOM_ICDF(6466), AOM_ICDF(6543), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(25921), AOM_ICDF(29445), AOM_ICDF(32729), AOM_ICDF(32739), - AOM_ICDF(32768) }, - {AOM_ICDF(22465), AOM_ICDF(26834), AOM_ICDF(32588), AOM_ICDF(32627), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(20062), AOM_ICDF(31016), AOM_ICDF(31233), - AOM_ICDF(32768) }, - {AOM_ICDF(11073), AOM_ICDF(13165), AOM_ICDF(25353), AOM_ICDF(25896), - AOM_ICDF(32768) }, - {AOM_ICDF(11713), AOM_ICDF(13837), AOM_ICDF(20144), AOM_ICDF(21734), - AOM_ICDF(32768) }, - {AOM_ICDF(2241), AOM_ICDF(2265), AOM_ICDF(6355), AOM_ICDF(6432), - AOM_ICDF(32768) } }, + { AOM_ICDF(25921), AOM_ICDF(29445), AOM_ICDF(32729), AOM_ICDF(32739), + AOM_ICDF(32768) }, + { AOM_ICDF(22465), AOM_ICDF(26834), AOM_ICDF(32588), AOM_ICDF(32627), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(20062), AOM_ICDF(31016), AOM_ICDF(31233), + AOM_ICDF(32768) }, + { AOM_ICDF(11073), AOM_ICDF(13165), AOM_ICDF(25353), AOM_ICDF(25896), + AOM_ICDF(32768) }, + { AOM_ICDF(11713), AOM_ICDF(13837), AOM_ICDF(20144), AOM_ICDF(21734), + AOM_ICDF(32768) }, + { AOM_ICDF(2241), AOM_ICDF(2265), AOM_ICDF(6355), AOM_ICDF(6432), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(26177), AOM_ICDF(29403), AOM_ICDF(32705), AOM_ICDF(32721), - AOM_ICDF(32768) }, - {AOM_ICDF(22337), AOM_ICDF(26344), AOM_ICDF(32545), AOM_ICDF(32589), - AOM_ICDF(32768) }, - {AOM_ICDF(19009), AOM_ICDF(21527), AOM_ICDF(31775), AOM_ICDF(31873), - AOM_ICDF(32768) }, - {AOM_ICDF(11585), AOM_ICDF(12685), AOM_ICDF(22632), AOM_ICDF(23137), - AOM_ICDF(32768) }, - {AOM_ICDF(8257), AOM_ICDF(8305), AOM_ICDF(16444), AOM_ICDF(16492), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), - AOM_ICDF(32768) } } } }, + { AOM_ICDF(26177), AOM_ICDF(29403), AOM_ICDF(32705), AOM_ICDF(32721), + AOM_ICDF(32768) }, + { AOM_ICDF(22337), AOM_ICDF(26344), AOM_ICDF(32545), AOM_ICDF(32589), + AOM_ICDF(32768) }, + { AOM_ICDF(19009), AOM_ICDF(21527), AOM_ICDF(31775), AOM_ICDF(31873), + AOM_ICDF(32768) }, + { AOM_ICDF(11585), AOM_ICDF(12685), AOM_ICDF(22632), AOM_ICDF(23137), + AOM_ICDF(32768) }, + { AOM_ICDF(8257), AOM_ICDF(8305), AOM_ICDF(16444), AOM_ICDF(16492), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), + AOM_ICDF(32768) } } } }, { // UV plane { // Inter { // Band 0 @@ -4595,70 +1355,70 @@ static const coeff_cdf_model default_coef_head_cdf_8x8[PLANE_TYPES] = { { AOM_ICDF(3776), AOM_ICDF(11778), AOM_ICDF(14700), AOM_ICDF(23745), AOM_ICDF(24854), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(20289), AOM_ICDF(25202), AOM_ICDF(31672), AOM_ICDF(31909), - AOM_ICDF(32768) }, - {AOM_ICDF(18369), AOM_ICDF(23493), AOM_ICDF(31166), AOM_ICDF(31487), - AOM_ICDF(32768) }, - {AOM_ICDF(15425), AOM_ICDF(18619), AOM_ICDF(28941), AOM_ICDF(29393), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(12535), AOM_ICDF(24287), AOM_ICDF(24792), - AOM_ICDF(32768) }, - {AOM_ICDF(6465), AOM_ICDF(6810), AOM_ICDF(15764), AOM_ICDF(16080), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2137), AOM_ICDF(6125), AOM_ICDF(6203), - AOM_ICDF(32768) } }, + { AOM_ICDF(20289), AOM_ICDF(25202), AOM_ICDF(31672), AOM_ICDF(31909), + AOM_ICDF(32768) }, + { AOM_ICDF(18369), AOM_ICDF(23493), AOM_ICDF(31166), AOM_ICDF(31487), + AOM_ICDF(32768) }, + { AOM_ICDF(15425), AOM_ICDF(18619), AOM_ICDF(28941), AOM_ICDF(29393), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(12535), AOM_ICDF(24287), AOM_ICDF(24792), + AOM_ICDF(32768) }, + { AOM_ICDF(6465), AOM_ICDF(6810), AOM_ICDF(15764), AOM_ICDF(16080), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2137), AOM_ICDF(6125), AOM_ICDF(6203), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(23745), AOM_ICDF(27041), AOM_ICDF(31976), AOM_ICDF(32135), - AOM_ICDF(32768) }, - {AOM_ICDF(19521), AOM_ICDF(22766), AOM_ICDF(31139), AOM_ICDF(31367), - AOM_ICDF(32768) }, - {AOM_ICDF(14273), AOM_ICDF(15834), AOM_ICDF(27820), AOM_ICDF(28105), - AOM_ICDF(32768) }, - {AOM_ICDF(9537), AOM_ICDF(10445), AOM_ICDF(22106), AOM_ICDF(22491), - AOM_ICDF(32768) }, - {AOM_ICDF(7233), AOM_ICDF(7386), AOM_ICDF(15961), AOM_ICDF(16109), - AOM_ICDF(32768) }, - {AOM_ICDF(2369), AOM_ICDF(2401), AOM_ICDF(7891), AOM_ICDF(7964), - AOM_ICDF(32768) } }, + { AOM_ICDF(23745), AOM_ICDF(27041), AOM_ICDF(31976), AOM_ICDF(32135), + AOM_ICDF(32768) }, + { AOM_ICDF(19521), AOM_ICDF(22766), AOM_ICDF(31139), AOM_ICDF(31367), + AOM_ICDF(32768) }, + { AOM_ICDF(14273), AOM_ICDF(15834), AOM_ICDF(27820), AOM_ICDF(28105), + AOM_ICDF(32768) }, + { AOM_ICDF(9537), AOM_ICDF(10445), AOM_ICDF(22106), AOM_ICDF(22491), + AOM_ICDF(32768) }, + { AOM_ICDF(7233), AOM_ICDF(7386), AOM_ICDF(15961), AOM_ICDF(16109), + AOM_ICDF(32768) }, + { AOM_ICDF(2369), AOM_ICDF(2401), AOM_ICDF(7891), AOM_ICDF(7964), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(26305), AOM_ICDF(28703), AOM_ICDF(32352), AOM_ICDF(32435), - AOM_ICDF(32768) }, - {AOM_ICDF(20673), AOM_ICDF(23490), AOM_ICDF(31517), AOM_ICDF(31680), - AOM_ICDF(32768) }, - {AOM_ICDF(14017), AOM_ICDF(15251), AOM_ICDF(27458), AOM_ICDF(27702), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(11374), AOM_ICDF(22496), AOM_ICDF(22687), - AOM_ICDF(32768) }, - {AOM_ICDF(9153), AOM_ICDF(9435), AOM_ICDF(22299), AOM_ICDF(22411), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(269), AOM_ICDF(13236), AOM_ICDF(13293), - AOM_ICDF(32768) } }, + { AOM_ICDF(26305), AOM_ICDF(28703), AOM_ICDF(32352), AOM_ICDF(32435), + AOM_ICDF(32768) }, + { AOM_ICDF(20673), AOM_ICDF(23490), AOM_ICDF(31517), AOM_ICDF(31680), + AOM_ICDF(32768) }, + { AOM_ICDF(14017), AOM_ICDF(15251), AOM_ICDF(27458), AOM_ICDF(27702), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(11374), AOM_ICDF(22496), AOM_ICDF(22687), + AOM_ICDF(32768) }, + { AOM_ICDF(9153), AOM_ICDF(9435), AOM_ICDF(22299), AOM_ICDF(22411), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(269), AOM_ICDF(13236), AOM_ICDF(13293), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(27713), AOM_ICDF(29770), AOM_ICDF(32522), AOM_ICDF(32575), - AOM_ICDF(32768) }, - {AOM_ICDF(21569), AOM_ICDF(24342), AOM_ICDF(31785), AOM_ICDF(31919), - AOM_ICDF(32768) }, - {AOM_ICDF(15297), AOM_ICDF(16497), AOM_ICDF(28367), AOM_ICDF(28569), - AOM_ICDF(32768) }, - {AOM_ICDF(17601), AOM_ICDF(17828), AOM_ICDF(24444), AOM_ICDF(24582), - AOM_ICDF(32768) }, - {AOM_ICDF(6977), AOM_ICDF(7035), AOM_ICDF(16901), AOM_ICDF(16947), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(384), AOM_ICDF(32706), AOM_ICDF(32707), - AOM_ICDF(32768) } }, + { AOM_ICDF(27713), AOM_ICDF(29770), AOM_ICDF(32522), AOM_ICDF(32575), + AOM_ICDF(32768) }, + { AOM_ICDF(21569), AOM_ICDF(24342), AOM_ICDF(31785), AOM_ICDF(31919), + AOM_ICDF(32768) }, + { AOM_ICDF(15297), AOM_ICDF(16497), AOM_ICDF(28367), AOM_ICDF(28569), + AOM_ICDF(32768) }, + { AOM_ICDF(17601), AOM_ICDF(17828), AOM_ICDF(24444), AOM_ICDF(24582), + AOM_ICDF(32768) }, + { AOM_ICDF(6977), AOM_ICDF(7035), AOM_ICDF(16901), AOM_ICDF(16947), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(384), AOM_ICDF(32706), AOM_ICDF(32707), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(28737), AOM_ICDF(30879), AOM_ICDF(32667), AOM_ICDF(32695), - AOM_ICDF(32768) }, - {AOM_ICDF(22593), AOM_ICDF(26241), AOM_ICDF(32073), AOM_ICDF(32207), - AOM_ICDF(32768) }, - {AOM_ICDF(16577), AOM_ICDF(19148), AOM_ICDF(28436), AOM_ICDF(28906), - AOM_ICDF(32768) }, - {AOM_ICDF(12993), AOM_ICDF(14005), AOM_ICDF(23151), AOM_ICDF(23630), - AOM_ICDF(32768) }, - {AOM_ICDF(7617), AOM_ICDF(9188), AOM_ICDF(22797), AOM_ICDF(23313), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), - AOM_ICDF(32768) } } }, + { AOM_ICDF(28737), AOM_ICDF(30879), AOM_ICDF(32667), AOM_ICDF(32695), + AOM_ICDF(32768) }, + { AOM_ICDF(22593), AOM_ICDF(26241), AOM_ICDF(32073), AOM_ICDF(32207), + AOM_ICDF(32768) }, + { AOM_ICDF(16577), AOM_ICDF(19148), AOM_ICDF(28436), AOM_ICDF(28906), + AOM_ICDF(32768) }, + { AOM_ICDF(12993), AOM_ICDF(14005), AOM_ICDF(23151), AOM_ICDF(23630), + AOM_ICDF(32768) }, + { AOM_ICDF(7617), AOM_ICDF(9188), AOM_ICDF(22797), AOM_ICDF(23313), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), + AOM_ICDF(32768) } } }, { // Inter { // Band 0 { AOM_ICDF(28864), AOM_ICDF(29988), AOM_ICDF(32423), AOM_ICDF(32766), @@ -4668,70 +1428,70 @@ static const coeff_cdf_model default_coef_head_cdf_8x8[PLANE_TYPES] = { { AOM_ICDF(5440), AOM_ICDF(19618), AOM_ICDF(25332), AOM_ICDF(32393), AOM_ICDF(32491), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(23745), AOM_ICDF(29427), AOM_ICDF(32751), AOM_ICDF(32757), - AOM_ICDF(32768) }, - {AOM_ICDF(23745), AOM_ICDF(28704), AOM_ICDF(32716), AOM_ICDF(32731), - AOM_ICDF(32768) }, - {AOM_ICDF(23105), AOM_ICDF(27943), AOM_ICDF(32524), AOM_ICDF(32587), - AOM_ICDF(32768) }, - {AOM_ICDF(21057), AOM_ICDF(24773), AOM_ICDF(29589), AOM_ICDF(30282), - AOM_ICDF(32768) }, - {AOM_ICDF(12609), AOM_ICDF(14823), AOM_ICDF(23831), AOM_ICDF(24713), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), - AOM_ICDF(32768) } }, + { AOM_ICDF(23745), AOM_ICDF(29427), AOM_ICDF(32751), AOM_ICDF(32757), + AOM_ICDF(32768) }, + { AOM_ICDF(23745), AOM_ICDF(28704), AOM_ICDF(32716), AOM_ICDF(32731), + AOM_ICDF(32768) }, + { AOM_ICDF(23105), AOM_ICDF(27943), AOM_ICDF(32524), AOM_ICDF(32587), + AOM_ICDF(32768) }, + { AOM_ICDF(21057), AOM_ICDF(24773), AOM_ICDF(29589), AOM_ICDF(30282), + AOM_ICDF(32768) }, + { AOM_ICDF(12609), AOM_ICDF(14823), AOM_ICDF(23831), AOM_ICDF(24713), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(25025), AOM_ICDF(30203), AOM_ICDF(32754), AOM_ICDF(32759), - AOM_ICDF(32768) }, - {AOM_ICDF(23617), AOM_ICDF(28361), AOM_ICDF(32715), AOM_ICDF(32729), - AOM_ICDF(32768) }, - {AOM_ICDF(17985), AOM_ICDF(21562), AOM_ICDF(31354), AOM_ICDF(31543), - AOM_ICDF(32768) }, - {AOM_ICDF(12353), AOM_ICDF(18915), AOM_ICDF(28742), AOM_ICDF(29548), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(289), AOM_ICDF(16545), AOM_ICDF(16593), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), - AOM_ICDF(32768) } }, + { AOM_ICDF(25025), AOM_ICDF(30203), AOM_ICDF(32754), AOM_ICDF(32759), + AOM_ICDF(32768) }, + { AOM_ICDF(23617), AOM_ICDF(28361), AOM_ICDF(32715), AOM_ICDF(32729), + AOM_ICDF(32768) }, + { AOM_ICDF(17985), AOM_ICDF(21562), AOM_ICDF(31354), AOM_ICDF(31543), + AOM_ICDF(32768) }, + { AOM_ICDF(12353), AOM_ICDF(18915), AOM_ICDF(28742), AOM_ICDF(29548), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(289), AOM_ICDF(16545), AOM_ICDF(16593), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(26433), AOM_ICDF(30892), AOM_ICDF(32757), AOM_ICDF(32761), - AOM_ICDF(32768) }, - {AOM_ICDF(24513), AOM_ICDF(29274), AOM_ICDF(32721), AOM_ICDF(32735), - AOM_ICDF(32768) }, - {AOM_ICDF(20161), AOM_ICDF(24040), AOM_ICDF(32055), AOM_ICDF(32171), - AOM_ICDF(32768) }, - {AOM_ICDF(21953), AOM_ICDF(24678), AOM_ICDF(27382), AOM_ICDF(28734), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), - AOM_ICDF(32768) }, - {AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), - AOM_ICDF(32768) } }, + { AOM_ICDF(26433), AOM_ICDF(30892), AOM_ICDF(32757), AOM_ICDF(32761), + AOM_ICDF(32768) }, + { AOM_ICDF(24513), AOM_ICDF(29274), AOM_ICDF(32721), AOM_ICDF(32735), + AOM_ICDF(32768) }, + { AOM_ICDF(20161), AOM_ICDF(24040), AOM_ICDF(32055), AOM_ICDF(32171), + AOM_ICDF(32768) }, + { AOM_ICDF(21953), AOM_ICDF(24678), AOM_ICDF(27382), AOM_ICDF(28734), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), + AOM_ICDF(32768) }, + { AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(27457), AOM_ICDF(31485), AOM_ICDF(32759), AOM_ICDF(32763), - AOM_ICDF(32768) }, - {AOM_ICDF(24129), AOM_ICDF(29502), AOM_ICDF(32752), AOM_ICDF(32757), - AOM_ICDF(32768) }, - {AOM_ICDF(19009), AOM_ICDF(25452), AOM_ICDF(32473), AOM_ICDF(32544), - AOM_ICDF(32768) }, - {AOM_ICDF(32705), AOM_ICDF(32706), AOM_ICDF(32737), AOM_ICDF(32738), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), - AOM_ICDF(32768) } }, + { AOM_ICDF(27457), AOM_ICDF(31485), AOM_ICDF(32759), AOM_ICDF(32763), + AOM_ICDF(32768) }, + { AOM_ICDF(24129), AOM_ICDF(29502), AOM_ICDF(32752), AOM_ICDF(32757), + AOM_ICDF(32768) }, + { AOM_ICDF(19009), AOM_ICDF(25452), AOM_ICDF(32473), AOM_ICDF(32544), + AOM_ICDF(32768) }, + { AOM_ICDF(32705), AOM_ICDF(32706), AOM_ICDF(32737), AOM_ICDF(32738), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(27841), AOM_ICDF(32288), AOM_ICDF(32759), AOM_ICDF(32764), - AOM_ICDF(32768) }, - {AOM_ICDF(19137), AOM_ICDF(30271), AOM_ICDF(32742), AOM_ICDF(32753), - AOM_ICDF(32768) }, - {AOM_ICDF(18625), AOM_ICDF(27739), AOM_ICDF(29979), AOM_ICDF(31099), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), - AOM_ICDF(32768) }, - {AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), - AOM_ICDF(32768) }, - {AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), - AOM_ICDF(32768) } } } } + { AOM_ICDF(27841), AOM_ICDF(32288), AOM_ICDF(32759), AOM_ICDF(32764), + AOM_ICDF(32768) }, + { AOM_ICDF(19137), AOM_ICDF(30271), AOM_ICDF(32742), AOM_ICDF(32753), + AOM_ICDF(32768) }, + { AOM_ICDF(18625), AOM_ICDF(27739), AOM_ICDF(29979), AOM_ICDF(31099), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), + AOM_ICDF(32768) }, + { AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), + AOM_ICDF(32768) }, + { AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), + AOM_ICDF(32768) } } } } }; static const coeff_cdf_model default_coef_head_cdf_16x16[PLANE_TYPES] = { { // Y plane @@ -4744,70 +1504,70 @@ static const coeff_cdf_model default_coef_head_cdf_16x16[PLANE_TYPES] = { { AOM_ICDF(192), AOM_ICDF(3443), AOM_ICDF(3759), AOM_ICDF(9011), AOM_ICDF(9685), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(12481), AOM_ICDF(13958), AOM_ICDF(24487), AOM_ICDF(24997), - AOM_ICDF(32768) }, - {AOM_ICDF(11457), AOM_ICDF(13075), AOM_ICDF(23820), AOM_ICDF(24406), - AOM_ICDF(32768) }, - {AOM_ICDF(9793), AOM_ICDF(11127), AOM_ICDF(21775), AOM_ICDF(22387), - AOM_ICDF(32768) }, - {AOM_ICDF(7745), AOM_ICDF(8457), AOM_ICDF(18155), AOM_ICDF(18655), - AOM_ICDF(32768) }, - {AOM_ICDF(5441), AOM_ICDF(5668), AOM_ICDF(13180), AOM_ICDF(13467), - AOM_ICDF(32768) }, - {AOM_ICDF(2497), AOM_ICDF(2520), AOM_ICDF(6340), AOM_ICDF(6417), - AOM_ICDF(32768) } }, + { AOM_ICDF(12481), AOM_ICDF(13958), AOM_ICDF(24487), AOM_ICDF(24997), + AOM_ICDF(32768) }, + { AOM_ICDF(11457), AOM_ICDF(13075), AOM_ICDF(23820), AOM_ICDF(24406), + AOM_ICDF(32768) }, + { AOM_ICDF(9793), AOM_ICDF(11127), AOM_ICDF(21775), AOM_ICDF(22387), + AOM_ICDF(32768) }, + { AOM_ICDF(7745), AOM_ICDF(8457), AOM_ICDF(18155), AOM_ICDF(18655), + AOM_ICDF(32768) }, + { AOM_ICDF(5441), AOM_ICDF(5668), AOM_ICDF(13180), AOM_ICDF(13467), + AOM_ICDF(32768) }, + { AOM_ICDF(2497), AOM_ICDF(2520), AOM_ICDF(6340), AOM_ICDF(6417), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(19521), AOM_ICDF(20572), AOM_ICDF(28965), AOM_ICDF(29177), - AOM_ICDF(32768) }, - {AOM_ICDF(15425), AOM_ICDF(16741), AOM_ICDF(27247), AOM_ICDF(27554), - AOM_ICDF(32768) }, - {AOM_ICDF(11969), AOM_ICDF(12690), AOM_ICDF(23872), AOM_ICDF(24141), - AOM_ICDF(32768) }, - {AOM_ICDF(9281), AOM_ICDF(9678), AOM_ICDF(19970), AOM_ICDF(20207), - AOM_ICDF(32768) }, - {AOM_ICDF(6081), AOM_ICDF(6266), AOM_ICDF(14682), AOM_ICDF(14876), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(2779), AOM_ICDF(7150), AOM_ICDF(7225), - AOM_ICDF(32768) } }, + { AOM_ICDF(19521), AOM_ICDF(20572), AOM_ICDF(28965), AOM_ICDF(29177), + AOM_ICDF(32768) }, + { AOM_ICDF(15425), AOM_ICDF(16741), AOM_ICDF(27247), AOM_ICDF(27554), + AOM_ICDF(32768) }, + { AOM_ICDF(11969), AOM_ICDF(12690), AOM_ICDF(23872), AOM_ICDF(24141), + AOM_ICDF(32768) }, + { AOM_ICDF(9281), AOM_ICDF(9678), AOM_ICDF(19970), AOM_ICDF(20207), + AOM_ICDF(32768) }, + { AOM_ICDF(6081), AOM_ICDF(6266), AOM_ICDF(14682), AOM_ICDF(14876), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(2779), AOM_ICDF(7150), AOM_ICDF(7225), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(22337), AOM_ICDF(23293), AOM_ICDF(30630), AOM_ICDF(30753), - AOM_ICDF(32768) }, - {AOM_ICDF(16321), AOM_ICDF(17427), AOM_ICDF(28368), AOM_ICDF(28570), - AOM_ICDF(32768) }, - {AOM_ICDF(11457), AOM_ICDF(11907), AOM_ICDF(23570), AOM_ICDF(23741), - AOM_ICDF(32768) }, - {AOM_ICDF(7233), AOM_ICDF(7331), AOM_ICDF(17258), AOM_ICDF(17334), - AOM_ICDF(32768) }, - {AOM_ICDF(4033), AOM_ICDF(4070), AOM_ICDF(10375), AOM_ICDF(10441), - AOM_ICDF(32768) }, - {AOM_ICDF(1601), AOM_ICDF(1619), AOM_ICDF(4706), AOM_ICDF(4788), - AOM_ICDF(32768) } }, + { AOM_ICDF(22337), AOM_ICDF(23293), AOM_ICDF(30630), AOM_ICDF(30753), + AOM_ICDF(32768) }, + { AOM_ICDF(16321), AOM_ICDF(17427), AOM_ICDF(28368), AOM_ICDF(28570), + AOM_ICDF(32768) }, + { AOM_ICDF(11457), AOM_ICDF(11907), AOM_ICDF(23570), AOM_ICDF(23741), + AOM_ICDF(32768) }, + { AOM_ICDF(7233), AOM_ICDF(7331), AOM_ICDF(17258), AOM_ICDF(17334), + AOM_ICDF(32768) }, + { AOM_ICDF(4033), AOM_ICDF(4070), AOM_ICDF(10375), AOM_ICDF(10441), + AOM_ICDF(32768) }, + { AOM_ICDF(1601), AOM_ICDF(1619), AOM_ICDF(4706), AOM_ICDF(4788), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(24769), AOM_ICDF(25536), AOM_ICDF(31660), AOM_ICDF(31722), - AOM_ICDF(32768) }, - {AOM_ICDF(18113), AOM_ICDF(18886), AOM_ICDF(29420), AOM_ICDF(29534), - AOM_ICDF(32768) }, - {AOM_ICDF(11201), AOM_ICDF(11412), AOM_ICDF(23207), AOM_ICDF(23291), - AOM_ICDF(32768) }, - {AOM_ICDF(6977), AOM_ICDF(7033), AOM_ICDF(16599), AOM_ICDF(16646), - AOM_ICDF(32768) }, - {AOM_ICDF(4033), AOM_ICDF(4070), AOM_ICDF(10375), AOM_ICDF(10441), - AOM_ICDF(32768) }, - {AOM_ICDF(1601), AOM_ICDF(1620), AOM_ICDF(4827), AOM_ICDF(4909), - AOM_ICDF(32768) } }, + { AOM_ICDF(24769), AOM_ICDF(25536), AOM_ICDF(31660), AOM_ICDF(31722), + AOM_ICDF(32768) }, + { AOM_ICDF(18113), AOM_ICDF(18886), AOM_ICDF(29420), AOM_ICDF(29534), + AOM_ICDF(32768) }, + { AOM_ICDF(11201), AOM_ICDF(11412), AOM_ICDF(23207), AOM_ICDF(23291), + AOM_ICDF(32768) }, + { AOM_ICDF(6977), AOM_ICDF(7033), AOM_ICDF(16599), AOM_ICDF(16646), + AOM_ICDF(32768) }, + { AOM_ICDF(4033), AOM_ICDF(4070), AOM_ICDF(10375), AOM_ICDF(10441), + AOM_ICDF(32768) }, + { AOM_ICDF(1601), AOM_ICDF(1620), AOM_ICDF(4827), AOM_ICDF(4909), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(28353), AOM_ICDF(28831), AOM_ICDF(32502), AOM_ICDF(32517), - AOM_ICDF(32768) }, - {AOM_ICDF(21441), AOM_ICDF(21869), AOM_ICDF(30977), AOM_ICDF(31017), - AOM_ICDF(32768) }, - {AOM_ICDF(11969), AOM_ICDF(12088), AOM_ICDF(24116), AOM_ICDF(24158), - AOM_ICDF(32768) }, - {AOM_ICDF(7489), AOM_ICDF(7547), AOM_ICDF(17413), AOM_ICDF(17458), - AOM_ICDF(32768) }, - {AOM_ICDF(4545), AOM_ICDF(4585), AOM_ICDF(11325), AOM_ICDF(11388), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2133), AOM_ICDF(5526), AOM_ICDF(5606), - AOM_ICDF(32768) } } }, + { AOM_ICDF(28353), AOM_ICDF(28831), AOM_ICDF(32502), AOM_ICDF(32517), + AOM_ICDF(32768) }, + { AOM_ICDF(21441), AOM_ICDF(21869), AOM_ICDF(30977), AOM_ICDF(31017), + AOM_ICDF(32768) }, + { AOM_ICDF(11969), AOM_ICDF(12088), AOM_ICDF(24116), AOM_ICDF(24158), + AOM_ICDF(32768) }, + { AOM_ICDF(7489), AOM_ICDF(7547), AOM_ICDF(17413), AOM_ICDF(17458), + AOM_ICDF(32768) }, + { AOM_ICDF(4545), AOM_ICDF(4585), AOM_ICDF(11325), AOM_ICDF(11388), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2133), AOM_ICDF(5526), AOM_ICDF(5606), + AOM_ICDF(32768) } } }, { // Intra { // Band 0 { AOM_ICDF(2496), AOM_ICDF(8717), AOM_ICDF(17280), AOM_ICDF(28922), @@ -4817,70 +1577,70 @@ static const coeff_cdf_model default_coef_head_cdf_16x16[PLANE_TYPES] = { { AOM_ICDF(448), AOM_ICDF(9240), AOM_ICDF(11886), AOM_ICDF(24124), AOM_ICDF(24898), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(21057), AOM_ICDF(22896), AOM_ICDF(31877), AOM_ICDF(31953), - AOM_ICDF(32768) }, - {AOM_ICDF(20673), AOM_ICDF(23151), AOM_ICDF(31706), AOM_ICDF(31825), - AOM_ICDF(32768) }, - {AOM_ICDF(18753), AOM_ICDF(20519), AOM_ICDF(30497), AOM_ICDF(30668), - AOM_ICDF(32768) }, - {AOM_ICDF(15425), AOM_ICDF(16608), AOM_ICDF(27789), AOM_ICDF(28027), - AOM_ICDF(32768) }, - {AOM_ICDF(10305), AOM_ICDF(10977), AOM_ICDF(21405), AOM_ICDF(21749), - AOM_ICDF(32768) }, - {AOM_ICDF(3649), AOM_ICDF(3812), AOM_ICDF(11213), AOM_ICDF(11445), - AOM_ICDF(32768) } }, + { AOM_ICDF(21057), AOM_ICDF(22896), AOM_ICDF(31877), AOM_ICDF(31953), + AOM_ICDF(32768) }, + { AOM_ICDF(20673), AOM_ICDF(23151), AOM_ICDF(31706), AOM_ICDF(31825), + AOM_ICDF(32768) }, + { AOM_ICDF(18753), AOM_ICDF(20519), AOM_ICDF(30497), AOM_ICDF(30668), + AOM_ICDF(32768) }, + { AOM_ICDF(15425), AOM_ICDF(16608), AOM_ICDF(27789), AOM_ICDF(28027), + AOM_ICDF(32768) }, + { AOM_ICDF(10305), AOM_ICDF(10977), AOM_ICDF(21405), AOM_ICDF(21749), + AOM_ICDF(32768) }, + { AOM_ICDF(3649), AOM_ICDF(3812), AOM_ICDF(11213), AOM_ICDF(11445), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(24001), AOM_ICDF(25899), AOM_ICDF(32307), AOM_ICDF(32360), - AOM_ICDF(32768) }, - {AOM_ICDF(20929), AOM_ICDF(22941), AOM_ICDF(31775), AOM_ICDF(31867), - AOM_ICDF(32768) }, - {AOM_ICDF(15169), AOM_ICDF(16734), AOM_ICDF(29228), AOM_ICDF(29425), - AOM_ICDF(32768) }, - {AOM_ICDF(10561), AOM_ICDF(12047), AOM_ICDF(24918), AOM_ICDF(25324), - AOM_ICDF(32768) }, - {AOM_ICDF(6977), AOM_ICDF(7929), AOM_ICDF(18311), AOM_ICDF(18918), - AOM_ICDF(32768) }, - {AOM_ICDF(3649), AOM_ICDF(3760), AOM_ICDF(9962), AOM_ICDF(10162), - AOM_ICDF(32768) } }, + { AOM_ICDF(24001), AOM_ICDF(25899), AOM_ICDF(32307), AOM_ICDF(32360), + AOM_ICDF(32768) }, + { AOM_ICDF(20929), AOM_ICDF(22941), AOM_ICDF(31775), AOM_ICDF(31867), + AOM_ICDF(32768) }, + { AOM_ICDF(15169), AOM_ICDF(16734), AOM_ICDF(29228), AOM_ICDF(29425), + AOM_ICDF(32768) }, + { AOM_ICDF(10561), AOM_ICDF(12047), AOM_ICDF(24918), AOM_ICDF(25324), + AOM_ICDF(32768) }, + { AOM_ICDF(6977), AOM_ICDF(7929), AOM_ICDF(18311), AOM_ICDF(18918), + AOM_ICDF(32768) }, + { AOM_ICDF(3649), AOM_ICDF(3760), AOM_ICDF(9962), AOM_ICDF(10162), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(25793), AOM_ICDF(27526), AOM_ICDF(32565), AOM_ICDF(32591), - AOM_ICDF(32768) }, - {AOM_ICDF(21825), AOM_ICDF(23885), AOM_ICDF(32064), AOM_ICDF(32135), - AOM_ICDF(32768) }, - {AOM_ICDF(15041), AOM_ICDF(16286), AOM_ICDF(29203), AOM_ICDF(29360), - AOM_ICDF(32768) }, - {AOM_ICDF(10433), AOM_ICDF(11058), AOM_ICDF(24349), AOM_ICDF(24538), - AOM_ICDF(32768) }, - {AOM_ICDF(5569), AOM_ICDF(6016), AOM_ICDF(16460), AOM_ICDF(16794), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) } }, + { AOM_ICDF(25793), AOM_ICDF(27526), AOM_ICDF(32565), AOM_ICDF(32591), + AOM_ICDF(32768) }, + { AOM_ICDF(21825), AOM_ICDF(23885), AOM_ICDF(32064), AOM_ICDF(32135), + AOM_ICDF(32768) }, + { AOM_ICDF(15041), AOM_ICDF(16286), AOM_ICDF(29203), AOM_ICDF(29360), + AOM_ICDF(32768) }, + { AOM_ICDF(10433), AOM_ICDF(11058), AOM_ICDF(24349), AOM_ICDF(24538), + AOM_ICDF(32768) }, + { AOM_ICDF(5569), AOM_ICDF(6016), AOM_ICDF(16460), AOM_ICDF(16794), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(26433), AOM_ICDF(28398), AOM_ICDF(32682), AOM_ICDF(32696), - AOM_ICDF(32768) }, - {AOM_ICDF(22977), AOM_ICDF(25086), AOM_ICDF(32367), AOM_ICDF(32412), - AOM_ICDF(32768) }, - {AOM_ICDF(16577), AOM_ICDF(17928), AOM_ICDF(30144), AOM_ICDF(30275), - AOM_ICDF(32768) }, - {AOM_ICDF(12481), AOM_ICDF(13352), AOM_ICDF(25993), AOM_ICDF(26211), - AOM_ICDF(32768) }, - {AOM_ICDF(7745), AOM_ICDF(8069), AOM_ICDF(20501), AOM_ICDF(20657), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), - AOM_ICDF(32768) } }, + { AOM_ICDF(26433), AOM_ICDF(28398), AOM_ICDF(32682), AOM_ICDF(32696), + AOM_ICDF(32768) }, + { AOM_ICDF(22977), AOM_ICDF(25086), AOM_ICDF(32367), AOM_ICDF(32412), + AOM_ICDF(32768) }, + { AOM_ICDF(16577), AOM_ICDF(17928), AOM_ICDF(30144), AOM_ICDF(30275), + AOM_ICDF(32768) }, + { AOM_ICDF(12481), AOM_ICDF(13352), AOM_ICDF(25993), AOM_ICDF(26211), + AOM_ICDF(32768) }, + { AOM_ICDF(7745), AOM_ICDF(8069), AOM_ICDF(20501), AOM_ICDF(20657), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(27841), AOM_ICDF(29700), AOM_ICDF(32721), AOM_ICDF(32730), - AOM_ICDF(32768) }, - {AOM_ICDF(23873), AOM_ICDF(26202), AOM_ICDF(32578), AOM_ICDF(32604), - AOM_ICDF(32768) }, - {AOM_ICDF(17729), AOM_ICDF(19046), AOM_ICDF(30448), AOM_ICDF(30568), - AOM_ICDF(32768) }, - {AOM_ICDF(13505), AOM_ICDF(14508), AOM_ICDF(26034), AOM_ICDF(26304), - AOM_ICDF(32768) }, - {AOM_ICDF(10049), AOM_ICDF(10494), AOM_ICDF(19945), AOM_ICDF(20233), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), - AOM_ICDF(32768) } } } }, + { AOM_ICDF(27841), AOM_ICDF(29700), AOM_ICDF(32721), AOM_ICDF(32730), + AOM_ICDF(32768) }, + { AOM_ICDF(23873), AOM_ICDF(26202), AOM_ICDF(32578), AOM_ICDF(32604), + AOM_ICDF(32768) }, + { AOM_ICDF(17729), AOM_ICDF(19046), AOM_ICDF(30448), AOM_ICDF(30568), + AOM_ICDF(32768) }, + { AOM_ICDF(13505), AOM_ICDF(14508), AOM_ICDF(26034), AOM_ICDF(26304), + AOM_ICDF(32768) }, + { AOM_ICDF(10049), AOM_ICDF(10494), AOM_ICDF(19945), AOM_ICDF(20233), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), + AOM_ICDF(32768) } } } }, { // UV plane { // Inter { // Band 0 @@ -4891,70 +1651,70 @@ static const coeff_cdf_model default_coef_head_cdf_16x16[PLANE_TYPES] = { { AOM_ICDF(2880), AOM_ICDF(9023), AOM_ICDF(11126), AOM_ICDF(20602), AOM_ICDF(21713), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(20161), AOM_ICDF(24785), AOM_ICDF(31070), AOM_ICDF(31430), - AOM_ICDF(32768) }, - {AOM_ICDF(17985), AOM_ICDF(22773), AOM_ICDF(30430), AOM_ICDF(30880), - AOM_ICDF(32768) }, - {AOM_ICDF(15937), AOM_ICDF(18802), AOM_ICDF(28265), AOM_ICDF(28788), - AOM_ICDF(32768) }, - {AOM_ICDF(11841), AOM_ICDF(13587), AOM_ICDF(24798), AOM_ICDF(25335), - AOM_ICDF(32768) }, - {AOM_ICDF(8769), AOM_ICDF(9160), AOM_ICDF(19316), AOM_ICDF(19566), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5357), AOM_ICDF(12874), AOM_ICDF(12932), - AOM_ICDF(32768) } }, + { AOM_ICDF(20161), AOM_ICDF(24785), AOM_ICDF(31070), AOM_ICDF(31430), + AOM_ICDF(32768) }, + { AOM_ICDF(17985), AOM_ICDF(22773), AOM_ICDF(30430), AOM_ICDF(30880), + AOM_ICDF(32768) }, + { AOM_ICDF(15937), AOM_ICDF(18802), AOM_ICDF(28265), AOM_ICDF(28788), + AOM_ICDF(32768) }, + { AOM_ICDF(11841), AOM_ICDF(13587), AOM_ICDF(24798), AOM_ICDF(25335), + AOM_ICDF(32768) }, + { AOM_ICDF(8769), AOM_ICDF(9160), AOM_ICDF(19316), AOM_ICDF(19566), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5357), AOM_ICDF(12874), AOM_ICDF(12932), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(24129), AOM_ICDF(26501), AOM_ICDF(31672), AOM_ICDF(31844), - AOM_ICDF(32768) }, - {AOM_ICDF(19649), AOM_ICDF(21553), AOM_ICDF(30130), AOM_ICDF(30370), - AOM_ICDF(32768) }, - {AOM_ICDF(11713), AOM_ICDF(13134), AOM_ICDF(25983), AOM_ICDF(26321), - AOM_ICDF(32768) }, - {AOM_ICDF(9409), AOM_ICDF(9948), AOM_ICDF(21408), AOM_ICDF(21663), - AOM_ICDF(32768) }, - {AOM_ICDF(5569), AOM_ICDF(5757), AOM_ICDF(14335), AOM_ICDF(14533), - AOM_ICDF(32768) }, - {AOM_ICDF(2241), AOM_ICDF(2305), AOM_ICDF(13152), AOM_ICDF(13209), - AOM_ICDF(32768) } }, + { AOM_ICDF(24129), AOM_ICDF(26501), AOM_ICDF(31672), AOM_ICDF(31844), + AOM_ICDF(32768) }, + { AOM_ICDF(19649), AOM_ICDF(21553), AOM_ICDF(30130), AOM_ICDF(30370), + AOM_ICDF(32768) }, + { AOM_ICDF(11713), AOM_ICDF(13134), AOM_ICDF(25983), AOM_ICDF(26321), + AOM_ICDF(32768) }, + { AOM_ICDF(9409), AOM_ICDF(9948), AOM_ICDF(21408), AOM_ICDF(21663), + AOM_ICDF(32768) }, + { AOM_ICDF(5569), AOM_ICDF(5757), AOM_ICDF(14335), AOM_ICDF(14533), + AOM_ICDF(32768) }, + { AOM_ICDF(2241), AOM_ICDF(2305), AOM_ICDF(13152), AOM_ICDF(13209), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(26817), AOM_ICDF(28135), AOM_ICDF(32130), AOM_ICDF(32209), - AOM_ICDF(32768) }, - {AOM_ICDF(20161), AOM_ICDF(21412), AOM_ICDF(30331), AOM_ICDF(30481), - AOM_ICDF(32768) }, - {AOM_ICDF(13377), AOM_ICDF(13798), AOM_ICDF(26065), AOM_ICDF(26176), - AOM_ICDF(32768) }, - {AOM_ICDF(8129), AOM_ICDF(8290), AOM_ICDF(19920), AOM_ICDF(20008), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(5751), AOM_ICDF(14950), AOM_ICDF(15002), - AOM_ICDF(32768) }, - {AOM_ICDF(5569), AOM_ICDF(5601), AOM_ICDF(11041), AOM_ICDF(11105), - AOM_ICDF(32768) } }, + { AOM_ICDF(26817), AOM_ICDF(28135), AOM_ICDF(32130), AOM_ICDF(32209), + AOM_ICDF(32768) }, + { AOM_ICDF(20161), AOM_ICDF(21412), AOM_ICDF(30331), AOM_ICDF(30481), + AOM_ICDF(32768) }, + { AOM_ICDF(13377), AOM_ICDF(13798), AOM_ICDF(26065), AOM_ICDF(26176), + AOM_ICDF(32768) }, + { AOM_ICDF(8129), AOM_ICDF(8290), AOM_ICDF(19920), AOM_ICDF(20008), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(5751), AOM_ICDF(14950), AOM_ICDF(15002), + AOM_ICDF(32768) }, + { AOM_ICDF(5569), AOM_ICDF(5601), AOM_ICDF(11041), AOM_ICDF(11105), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(28225), AOM_ICDF(29079), AOM_ICDF(32387), AOM_ICDF(32426), - AOM_ICDF(32768) }, - {AOM_ICDF(21185), AOM_ICDF(22046), AOM_ICDF(30982), AOM_ICDF(31061), - AOM_ICDF(32768) }, - {AOM_ICDF(13377), AOM_ICDF(13595), AOM_ICDF(25762), AOM_ICDF(25824), - AOM_ICDF(32768) }, - {AOM_ICDF(8001), AOM_ICDF(8123), AOM_ICDF(20530), AOM_ICDF(20590), - AOM_ICDF(32768) }, - {AOM_ICDF(4289), AOM_ICDF(4322), AOM_ICDF(9907), AOM_ICDF(9974), - AOM_ICDF(32768) }, - {AOM_ICDF(3393), AOM_ICDF(3412), AOM_ICDF(6663), AOM_ICDF(6739), - AOM_ICDF(32768) } }, + { AOM_ICDF(28225), AOM_ICDF(29079), AOM_ICDF(32387), AOM_ICDF(32426), + AOM_ICDF(32768) }, + { AOM_ICDF(21185), AOM_ICDF(22046), AOM_ICDF(30982), AOM_ICDF(31061), + AOM_ICDF(32768) }, + { AOM_ICDF(13377), AOM_ICDF(13595), AOM_ICDF(25762), AOM_ICDF(25824), + AOM_ICDF(32768) }, + { AOM_ICDF(8001), AOM_ICDF(8123), AOM_ICDF(20530), AOM_ICDF(20590), + AOM_ICDF(32768) }, + { AOM_ICDF(4289), AOM_ICDF(4322), AOM_ICDF(9907), AOM_ICDF(9974), + AOM_ICDF(32768) }, + { AOM_ICDF(3393), AOM_ICDF(3412), AOM_ICDF(6663), AOM_ICDF(6739), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(30529), AOM_ICDF(31014), AOM_ICDF(32651), AOM_ICDF(32664), - AOM_ICDF(32768) }, - {AOM_ICDF(23489), AOM_ICDF(24268), AOM_ICDF(31627), AOM_ICDF(31682), - AOM_ICDF(32768) }, - {AOM_ICDF(14017), AOM_ICDF(14239), AOM_ICDF(26653), AOM_ICDF(26707), - AOM_ICDF(32768) }, - {AOM_ICDF(11201), AOM_ICDF(11317), AOM_ICDF(23122), AOM_ICDF(23169), - AOM_ICDF(32768) }, - {AOM_ICDF(6721), AOM_ICDF(6768), AOM_ICDF(14810), AOM_ICDF(14863), - AOM_ICDF(32768) }, - {AOM_ICDF(6593), AOM_ICDF(6632), AOM_ICDF(13188), AOM_ICDF(13245), - AOM_ICDF(32768) } } }, + { AOM_ICDF(30529), AOM_ICDF(31014), AOM_ICDF(32651), AOM_ICDF(32664), + AOM_ICDF(32768) }, + { AOM_ICDF(23489), AOM_ICDF(24268), AOM_ICDF(31627), AOM_ICDF(31682), + AOM_ICDF(32768) }, + { AOM_ICDF(14017), AOM_ICDF(14239), AOM_ICDF(26653), AOM_ICDF(26707), + AOM_ICDF(32768) }, + { AOM_ICDF(11201), AOM_ICDF(11317), AOM_ICDF(23122), AOM_ICDF(23169), + AOM_ICDF(32768) }, + { AOM_ICDF(6721), AOM_ICDF(6768), AOM_ICDF(14810), AOM_ICDF(14863), + AOM_ICDF(32768) }, + { AOM_ICDF(6593), AOM_ICDF(6632), AOM_ICDF(13188), AOM_ICDF(13245), + AOM_ICDF(32768) } } }, { // Inter { // Band 0 { AOM_ICDF(29888), AOM_ICDF(30492), AOM_ICDF(32500), AOM_ICDF(32766), @@ -4964,70 +1724,70 @@ static const coeff_cdf_model default_coef_head_cdf_16x16[PLANE_TYPES] = { { AOM_ICDF(5568), AOM_ICDF(17762), AOM_ICDF(25039), AOM_ICDF(31213), AOM_ICDF(31651), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(26433), AOM_ICDF(29681), AOM_ICDF(32757), AOM_ICDF(32760), - AOM_ICDF(32768) }, - {AOM_ICDF(24769), AOM_ICDF(28761), AOM_ICDF(32722), AOM_ICDF(32734), - AOM_ICDF(32768) }, - {AOM_ICDF(22209), AOM_ICDF(26975), AOM_ICDF(32418), AOM_ICDF(32500), - AOM_ICDF(32768) }, - {AOM_ICDF(16321), AOM_ICDF(21333), AOM_ICDF(28368), AOM_ICDF(29283), - AOM_ICDF(32768) }, - {AOM_ICDF(12865), AOM_ICDF(14775), AOM_ICDF(22545), AOM_ICDF(23553), - AOM_ICDF(32768) }, - {AOM_ICDF(12353), AOM_ICDF(12354), AOM_ICDF(12473), AOM_ICDF(12532), - AOM_ICDF(32768) } }, + { AOM_ICDF(26433), AOM_ICDF(29681), AOM_ICDF(32757), AOM_ICDF(32760), + AOM_ICDF(32768) }, + { AOM_ICDF(24769), AOM_ICDF(28761), AOM_ICDF(32722), AOM_ICDF(32734), + AOM_ICDF(32768) }, + { AOM_ICDF(22209), AOM_ICDF(26975), AOM_ICDF(32418), AOM_ICDF(32500), + AOM_ICDF(32768) }, + { AOM_ICDF(16321), AOM_ICDF(21333), AOM_ICDF(28368), AOM_ICDF(29283), + AOM_ICDF(32768) }, + { AOM_ICDF(12865), AOM_ICDF(14775), AOM_ICDF(22545), AOM_ICDF(23553), + AOM_ICDF(32768) }, + { AOM_ICDF(12353), AOM_ICDF(12354), AOM_ICDF(12473), AOM_ICDF(12532), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(27457), AOM_ICDF(30005), AOM_ICDF(32738), AOM_ICDF(32745), - AOM_ICDF(32768) }, - {AOM_ICDF(24897), AOM_ICDF(27541), AOM_ICDF(32723), AOM_ICDF(32731), - AOM_ICDF(32768) }, - {AOM_ICDF(15297), AOM_ICDF(19106), AOM_ICDF(30414), AOM_ICDF(30711), - AOM_ICDF(32768) }, - {AOM_ICDF(6593), AOM_ICDF(8826), AOM_ICDF(19732), AOM_ICDF(20840), - AOM_ICDF(32768) }, - {AOM_ICDF(4161), AOM_ICDF(4233), AOM_ICDF(16509), AOM_ICDF(16557), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), - AOM_ICDF(32768) } }, + { AOM_ICDF(27457), AOM_ICDF(30005), AOM_ICDF(32738), AOM_ICDF(32745), + AOM_ICDF(32768) }, + { AOM_ICDF(24897), AOM_ICDF(27541), AOM_ICDF(32723), AOM_ICDF(32731), + AOM_ICDF(32768) }, + { AOM_ICDF(15297), AOM_ICDF(19106), AOM_ICDF(30414), AOM_ICDF(30711), + AOM_ICDF(32768) }, + { AOM_ICDF(6593), AOM_ICDF(8826), AOM_ICDF(19732), AOM_ICDF(20840), + AOM_ICDF(32768) }, + { AOM_ICDF(4161), AOM_ICDF(4233), AOM_ICDF(16509), AOM_ICDF(16557), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(28609), AOM_ICDF(30482), AOM_ICDF(32761), AOM_ICDF(32763), - AOM_ICDF(32768) }, - {AOM_ICDF(25665), AOM_ICDF(27830), AOM_ICDF(32727), AOM_ICDF(32733), - AOM_ICDF(32768) }, - {AOM_ICDF(21057), AOM_ICDF(23803), AOM_ICDF(30367), AOM_ICDF(30721), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(21878), AOM_ICDF(32726), AOM_ICDF(32737), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), - AOM_ICDF(32768) }, - {AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), - AOM_ICDF(32768) } }, + { AOM_ICDF(28609), AOM_ICDF(30482), AOM_ICDF(32761), AOM_ICDF(32763), + AOM_ICDF(32768) }, + { AOM_ICDF(25665), AOM_ICDF(27830), AOM_ICDF(32727), AOM_ICDF(32733), + AOM_ICDF(32768) }, + { AOM_ICDF(21057), AOM_ICDF(23803), AOM_ICDF(30367), AOM_ICDF(30721), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(21878), AOM_ICDF(32726), AOM_ICDF(32737), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(5750), AOM_ICDF(14739), AOM_ICDF(14792), + AOM_ICDF(32768) }, + { AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(28993), AOM_ICDF(30944), AOM_ICDF(32762), AOM_ICDF(32764), - AOM_ICDF(32768) }, - {AOM_ICDF(26561), AOM_ICDF(28695), AOM_ICDF(32733), AOM_ICDF(32739), - AOM_ICDF(32768) }, - {AOM_ICDF(17985), AOM_ICDF(19028), AOM_ICDF(31008), AOM_ICDF(31079), - AOM_ICDF(32768) }, - {AOM_ICDF(7873), AOM_ICDF(8039), AOM_ICDF(19981), AOM_ICDF(20068), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), - AOM_ICDF(32768) } }, + { AOM_ICDF(28993), AOM_ICDF(30944), AOM_ICDF(32762), AOM_ICDF(32764), + AOM_ICDF(32768) }, + { AOM_ICDF(26561), AOM_ICDF(28695), AOM_ICDF(32733), AOM_ICDF(32739), + AOM_ICDF(32768) }, + { AOM_ICDF(17985), AOM_ICDF(19028), AOM_ICDF(31008), AOM_ICDF(31079), + AOM_ICDF(32768) }, + { AOM_ICDF(7873), AOM_ICDF(8039), AOM_ICDF(19981), AOM_ICDF(20068), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5366), AOM_ICDF(14376), AOM_ICDF(14430), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(30273), AOM_ICDF(32029), AOM_ICDF(32764), AOM_ICDF(32766), - AOM_ICDF(32768) }, - {AOM_ICDF(28609), AOM_ICDF(30847), AOM_ICDF(32745), AOM_ICDF(32751), - AOM_ICDF(32768) }, - {AOM_ICDF(21313), AOM_ICDF(24377), AOM_ICDF(31986), AOM_ICDF(32098), - AOM_ICDF(32768) }, - {AOM_ICDF(32705), AOM_ICDF(32709), AOM_ICDF(32739), AOM_ICDF(32741), - AOM_ICDF(32768) }, - {AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), - AOM_ICDF(32768) }, - {AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), - AOM_ICDF(32768) } } } } + { AOM_ICDF(30273), AOM_ICDF(32029), AOM_ICDF(32764), AOM_ICDF(32766), + AOM_ICDF(32768) }, + { AOM_ICDF(28609), AOM_ICDF(30847), AOM_ICDF(32745), AOM_ICDF(32751), + AOM_ICDF(32768) }, + { AOM_ICDF(21313), AOM_ICDF(24377), AOM_ICDF(31986), AOM_ICDF(32098), + AOM_ICDF(32768) }, + { AOM_ICDF(32705), AOM_ICDF(32709), AOM_ICDF(32739), AOM_ICDF(32741), + AOM_ICDF(32768) }, + { AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), + AOM_ICDF(32768) }, + { AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), + AOM_ICDF(32768) } } } } }; static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = { { // Y plane @@ -5040,70 +1800,70 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = { { AOM_ICDF(192), AOM_ICDF(3061), AOM_ICDF(3557), AOM_ICDF(8701), AOM_ICDF(9762), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(11969), AOM_ICDF(15846), AOM_ICDF(25660), AOM_ICDF(26667), - AOM_ICDF(32768) }, - {AOM_ICDF(11713), AOM_ICDF(15794), AOM_ICDF(25737), AOM_ICDF(26760), - AOM_ICDF(32768) }, - {AOM_ICDF(9281), AOM_ICDF(12675), AOM_ICDF(23181), AOM_ICDF(24351), - AOM_ICDF(32768) }, - {AOM_ICDF(7105), AOM_ICDF(8757), AOM_ICDF(18383), AOM_ICDF(19437), - AOM_ICDF(32768) }, - {AOM_ICDF(4289), AOM_ICDF(4579), AOM_ICDF(11353), AOM_ICDF(11792), - AOM_ICDF(32768) }, - {AOM_ICDF(1857), AOM_ICDF(1874), AOM_ICDF(4695), AOM_ICDF(4777), - AOM_ICDF(32768) } }, + { AOM_ICDF(11969), AOM_ICDF(15846), AOM_ICDF(25660), AOM_ICDF(26667), + AOM_ICDF(32768) }, + { AOM_ICDF(11713), AOM_ICDF(15794), AOM_ICDF(25737), AOM_ICDF(26760), + AOM_ICDF(32768) }, + { AOM_ICDF(9281), AOM_ICDF(12675), AOM_ICDF(23181), AOM_ICDF(24351), + AOM_ICDF(32768) }, + { AOM_ICDF(7105), AOM_ICDF(8757), AOM_ICDF(18383), AOM_ICDF(19437), + AOM_ICDF(32768) }, + { AOM_ICDF(4289), AOM_ICDF(4579), AOM_ICDF(11353), AOM_ICDF(11792), + AOM_ICDF(32768) }, + { AOM_ICDF(1857), AOM_ICDF(1874), AOM_ICDF(4695), AOM_ICDF(4777), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(20929), AOM_ICDF(22297), AOM_ICDF(29370), AOM_ICDF(29646), - AOM_ICDF(32768) }, - {AOM_ICDF(17473), AOM_ICDF(18985), AOM_ICDF(28079), AOM_ICDF(28413), - AOM_ICDF(32768) }, - {AOM_ICDF(13121), AOM_ICDF(14064), AOM_ICDF(24902), AOM_ICDF(25217), - AOM_ICDF(32768) }, - {AOM_ICDF(9793), AOM_ICDF(10214), AOM_ICDF(20069), AOM_ICDF(20329), - AOM_ICDF(32768) }, - {AOM_ICDF(5825), AOM_ICDF(5987), AOM_ICDF(13350), AOM_ICDF(13559), - AOM_ICDF(32768) }, - {AOM_ICDF(2241), AOM_ICDF(2260), AOM_ICDF(5520), AOM_ICDF(5600), - AOM_ICDF(32768) } }, + { AOM_ICDF(20929), AOM_ICDF(22297), AOM_ICDF(29370), AOM_ICDF(29646), + AOM_ICDF(32768) }, + { AOM_ICDF(17473), AOM_ICDF(18985), AOM_ICDF(28079), AOM_ICDF(28413), + AOM_ICDF(32768) }, + { AOM_ICDF(13121), AOM_ICDF(14064), AOM_ICDF(24902), AOM_ICDF(25217), + AOM_ICDF(32768) }, + { AOM_ICDF(9793), AOM_ICDF(10214), AOM_ICDF(20069), AOM_ICDF(20329), + AOM_ICDF(32768) }, + { AOM_ICDF(5825), AOM_ICDF(5987), AOM_ICDF(13350), AOM_ICDF(13559), + AOM_ICDF(32768) }, + { AOM_ICDF(2241), AOM_ICDF(2260), AOM_ICDF(5520), AOM_ICDF(5600), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(25921), AOM_ICDF(26891), AOM_ICDF(31632), AOM_ICDF(31729), - AOM_ICDF(32768) }, - {AOM_ICDF(18241), AOM_ICDF(19463), AOM_ICDF(29222), AOM_ICDF(29419), - AOM_ICDF(32768) }, - {AOM_ICDF(11585), AOM_ICDF(12065), AOM_ICDF(23294), AOM_ICDF(23488), - AOM_ICDF(32768) }, - {AOM_ICDF(6593), AOM_ICDF(6686), AOM_ICDF(16153), AOM_ICDF(16234), - AOM_ICDF(32768) }, - {AOM_ICDF(3137), AOM_ICDF(3170), AOM_ICDF(8751), AOM_ICDF(8821), - AOM_ICDF(32768) }, - {AOM_ICDF(1345), AOM_ICDF(1359), AOM_ICDF(3739), AOM_ICDF(3824), - AOM_ICDF(32768) } }, + { AOM_ICDF(25921), AOM_ICDF(26891), AOM_ICDF(31632), AOM_ICDF(31729), + AOM_ICDF(32768) }, + { AOM_ICDF(18241), AOM_ICDF(19463), AOM_ICDF(29222), AOM_ICDF(29419), + AOM_ICDF(32768) }, + { AOM_ICDF(11585), AOM_ICDF(12065), AOM_ICDF(23294), AOM_ICDF(23488), + AOM_ICDF(32768) }, + { AOM_ICDF(6593), AOM_ICDF(6686), AOM_ICDF(16153), AOM_ICDF(16234), + AOM_ICDF(32768) }, + { AOM_ICDF(3137), AOM_ICDF(3170), AOM_ICDF(8751), AOM_ICDF(8821), + AOM_ICDF(32768) }, + { AOM_ICDF(1345), AOM_ICDF(1359), AOM_ICDF(3739), AOM_ICDF(3824), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(27713), AOM_ICDF(28504), AOM_ICDF(32068), AOM_ICDF(32132), - AOM_ICDF(32768) }, - {AOM_ICDF(19265), AOM_ICDF(20354), AOM_ICDF(29789), AOM_ICDF(29943), - AOM_ICDF(32768) }, - {AOM_ICDF(11201), AOM_ICDF(11538), AOM_ICDF(22701), AOM_ICDF(22848), - AOM_ICDF(32768) }, - {AOM_ICDF(6337), AOM_ICDF(6424), AOM_ICDF(15268), AOM_ICDF(15353), - AOM_ICDF(32768) }, - {AOM_ICDF(3649), AOM_ICDF(3681), AOM_ICDF(9052), AOM_ICDF(9121), - AOM_ICDF(32768) }, - {AOM_ICDF(1601), AOM_ICDF(1618), AOM_ICDF(4584), AOM_ICDF(4667), - AOM_ICDF(32768) } }, + { AOM_ICDF(27713), AOM_ICDF(28504), AOM_ICDF(32068), AOM_ICDF(32132), + AOM_ICDF(32768) }, + { AOM_ICDF(19265), AOM_ICDF(20354), AOM_ICDF(29789), AOM_ICDF(29943), + AOM_ICDF(32768) }, + { AOM_ICDF(11201), AOM_ICDF(11538), AOM_ICDF(22701), AOM_ICDF(22848), + AOM_ICDF(32768) }, + { AOM_ICDF(6337), AOM_ICDF(6424), AOM_ICDF(15268), AOM_ICDF(15353), + AOM_ICDF(32768) }, + { AOM_ICDF(3649), AOM_ICDF(3681), AOM_ICDF(9052), AOM_ICDF(9121), + AOM_ICDF(32768) }, + { AOM_ICDF(1601), AOM_ICDF(1618), AOM_ICDF(4584), AOM_ICDF(4667), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(30913), AOM_ICDF(31044), AOM_ICDF(32635), AOM_ICDF(32640), - AOM_ICDF(32768) }, - {AOM_ICDF(22081), AOM_ICDF(22261), AOM_ICDF(30452), AOM_ICDF(30477), - AOM_ICDF(32768) }, - {AOM_ICDF(10561), AOM_ICDF(10625), AOM_ICDF(21535), AOM_ICDF(21568), - AOM_ICDF(32768) }, - {AOM_ICDF(6081), AOM_ICDF(6130), AOM_ICDF(14369), AOM_ICDF(14423), - AOM_ICDF(32768) }, - {AOM_ICDF(3777), AOM_ICDF(3809), AOM_ICDF(9156), AOM_ICDF(9225), - AOM_ICDF(32768) }, - {AOM_ICDF(1857), AOM_ICDF(1875), AOM_ICDF(4936), AOM_ICDF(5018), - AOM_ICDF(32768) } } }, + { AOM_ICDF(30913), AOM_ICDF(31044), AOM_ICDF(32635), AOM_ICDF(32640), + AOM_ICDF(32768) }, + { AOM_ICDF(22081), AOM_ICDF(22261), AOM_ICDF(30452), AOM_ICDF(30477), + AOM_ICDF(32768) }, + { AOM_ICDF(10561), AOM_ICDF(10625), AOM_ICDF(21535), AOM_ICDF(21568), + AOM_ICDF(32768) }, + { AOM_ICDF(6081), AOM_ICDF(6130), AOM_ICDF(14369), AOM_ICDF(14423), + AOM_ICDF(32768) }, + { AOM_ICDF(3777), AOM_ICDF(3809), AOM_ICDF(9156), AOM_ICDF(9225), + AOM_ICDF(32768) }, + { AOM_ICDF(1857), AOM_ICDF(1875), AOM_ICDF(4936), AOM_ICDF(5018), + AOM_ICDF(32768) } } }, { // Intra { // Band 0 { AOM_ICDF(4672), AOM_ICDF(6927), AOM_ICDF(23534), AOM_ICDF(29846), @@ -5113,70 +1873,70 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = { { AOM_ICDF(1344), AOM_ICDF(5588), AOM_ICDF(12166), AOM_ICDF(20966), AOM_ICDF(23504), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(19393), AOM_ICDF(22016), AOM_ICDF(31280), AOM_ICDF(31444), - AOM_ICDF(32768) }, - {AOM_ICDF(21185), AOM_ICDF(24329), AOM_ICDF(31706), AOM_ICDF(31865), - AOM_ICDF(32768) }, - {AOM_ICDF(20673), AOM_ICDF(23240), AOM_ICDF(31186), AOM_ICDF(31379), - AOM_ICDF(32768) }, - {AOM_ICDF(17857), AOM_ICDF(20035), AOM_ICDF(29594), AOM_ICDF(29889), - AOM_ICDF(32768) }, - {AOM_ICDF(13633), AOM_ICDF(14929), AOM_ICDF(24883), AOM_ICDF(25337), - AOM_ICDF(32768) }, - {AOM_ICDF(7873), AOM_ICDF(8416), AOM_ICDF(17452), AOM_ICDF(17886), - AOM_ICDF(32768) } }, + { AOM_ICDF(19393), AOM_ICDF(22016), AOM_ICDF(31280), AOM_ICDF(31444), + AOM_ICDF(32768) }, + { AOM_ICDF(21185), AOM_ICDF(24329), AOM_ICDF(31706), AOM_ICDF(31865), + AOM_ICDF(32768) }, + { AOM_ICDF(20673), AOM_ICDF(23240), AOM_ICDF(31186), AOM_ICDF(31379), + AOM_ICDF(32768) }, + { AOM_ICDF(17857), AOM_ICDF(20035), AOM_ICDF(29594), AOM_ICDF(29889), + AOM_ICDF(32768) }, + { AOM_ICDF(13633), AOM_ICDF(14929), AOM_ICDF(24883), AOM_ICDF(25337), + AOM_ICDF(32768) }, + { AOM_ICDF(7873), AOM_ICDF(8416), AOM_ICDF(17452), AOM_ICDF(17886), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(25665), AOM_ICDF(27145), AOM_ICDF(32256), AOM_ICDF(32314), - AOM_ICDF(32768) }, - {AOM_ICDF(21057), AOM_ICDF(22826), AOM_ICDF(31465), AOM_ICDF(31576), - AOM_ICDF(32768) }, - {AOM_ICDF(13633), AOM_ICDF(14885), AOM_ICDF(27873), AOM_ICDF(28088), - AOM_ICDF(32768) }, - {AOM_ICDF(8769), AOM_ICDF(9515), AOM_ICDF(21941), AOM_ICDF(22248), - AOM_ICDF(32768) }, - {AOM_ICDF(6209), AOM_ICDF(6594), AOM_ICDF(15598), AOM_ICDF(15950), - AOM_ICDF(32768) }, - {AOM_ICDF(1985), AOM_ICDF(2014), AOM_ICDF(6855), AOM_ICDF(6931), - AOM_ICDF(32768) } }, + { AOM_ICDF(25665), AOM_ICDF(27145), AOM_ICDF(32256), AOM_ICDF(32314), + AOM_ICDF(32768) }, + { AOM_ICDF(21057), AOM_ICDF(22826), AOM_ICDF(31465), AOM_ICDF(31576), + AOM_ICDF(32768) }, + { AOM_ICDF(13633), AOM_ICDF(14885), AOM_ICDF(27873), AOM_ICDF(28088), + AOM_ICDF(32768) }, + { AOM_ICDF(8769), AOM_ICDF(9515), AOM_ICDF(21941), AOM_ICDF(22248), + AOM_ICDF(32768) }, + { AOM_ICDF(6209), AOM_ICDF(6594), AOM_ICDF(15598), AOM_ICDF(15950), + AOM_ICDF(32768) }, + { AOM_ICDF(1985), AOM_ICDF(2014), AOM_ICDF(6855), AOM_ICDF(6931), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(26817), AOM_ICDF(27824), AOM_ICDF(32362), AOM_ICDF(32399), - AOM_ICDF(32768) }, - {AOM_ICDF(21185), AOM_ICDF(22321), AOM_ICDF(31389), AOM_ICDF(31466), - AOM_ICDF(32768) }, - {AOM_ICDF(13761), AOM_ICDF(14154), AOM_ICDF(27163), AOM_ICDF(27245), - AOM_ICDF(32768) }, - {AOM_ICDF(8897), AOM_ICDF(9011), AOM_ICDF(20600), AOM_ICDF(20659), - AOM_ICDF(32768) }, - {AOM_ICDF(4673), AOM_ICDF(4774), AOM_ICDF(15044), AOM_ICDF(15131), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) } }, + { AOM_ICDF(26817), AOM_ICDF(27824), AOM_ICDF(32362), AOM_ICDF(32399), + AOM_ICDF(32768) }, + { AOM_ICDF(21185), AOM_ICDF(22321), AOM_ICDF(31389), AOM_ICDF(31466), + AOM_ICDF(32768) }, + { AOM_ICDF(13761), AOM_ICDF(14154), AOM_ICDF(27163), AOM_ICDF(27245), + AOM_ICDF(32768) }, + { AOM_ICDF(8897), AOM_ICDF(9011), AOM_ICDF(20600), AOM_ICDF(20659), + AOM_ICDF(32768) }, + { AOM_ICDF(4673), AOM_ICDF(4774), AOM_ICDF(15044), AOM_ICDF(15131), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(28865), AOM_ICDF(29687), AOM_ICDF(32655), AOM_ICDF(32667), - AOM_ICDF(32768) }, - {AOM_ICDF(23233), AOM_ICDF(24218), AOM_ICDF(32080), AOM_ICDF(32118), - AOM_ICDF(32768) }, - {AOM_ICDF(15041), AOM_ICDF(15444), AOM_ICDF(28787), AOM_ICDF(28845), - AOM_ICDF(32768) }, - {AOM_ICDF(9921), AOM_ICDF(10248), AOM_ICDF(22818), AOM_ICDF(22944), - AOM_ICDF(32768) }, - {AOM_ICDF(7745), AOM_ICDF(7866), AOM_ICDF(16591), AOM_ICDF(16702), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) } }, + { AOM_ICDF(28865), AOM_ICDF(29687), AOM_ICDF(32655), AOM_ICDF(32667), + AOM_ICDF(32768) }, + { AOM_ICDF(23233), AOM_ICDF(24218), AOM_ICDF(32080), AOM_ICDF(32118), + AOM_ICDF(32768) }, + { AOM_ICDF(15041), AOM_ICDF(15444), AOM_ICDF(28787), AOM_ICDF(28845), + AOM_ICDF(32768) }, + { AOM_ICDF(9921), AOM_ICDF(10248), AOM_ICDF(22818), AOM_ICDF(22944), + AOM_ICDF(32768) }, + { AOM_ICDF(7745), AOM_ICDF(7866), AOM_ICDF(16591), AOM_ICDF(16702), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(31169), AOM_ICDF(31559), AOM_ICDF(32741), AOM_ICDF(32744), - AOM_ICDF(32768) }, - {AOM_ICDF(24769), AOM_ICDF(25583), AOM_ICDF(32347), AOM_ICDF(32370), - AOM_ICDF(32768) }, - {AOM_ICDF(15937), AOM_ICDF(16169), AOM_ICDF(29120), AOM_ICDF(29152), - AOM_ICDF(32768) }, - {AOM_ICDF(7489), AOM_ICDF(7578), AOM_ICDF(22647), AOM_ICDF(22677), - AOM_ICDF(32768) }, - {AOM_ICDF(7617), AOM_ICDF(7689), AOM_ICDF(19849), AOM_ICDF(19887), - AOM_ICDF(32768) }, - {AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), - AOM_ICDF(32768) } } } }, + { AOM_ICDF(31169), AOM_ICDF(31559), AOM_ICDF(32741), AOM_ICDF(32744), + AOM_ICDF(32768) }, + { AOM_ICDF(24769), AOM_ICDF(25583), AOM_ICDF(32347), AOM_ICDF(32370), + AOM_ICDF(32768) }, + { AOM_ICDF(15937), AOM_ICDF(16169), AOM_ICDF(29120), AOM_ICDF(29152), + AOM_ICDF(32768) }, + { AOM_ICDF(7489), AOM_ICDF(7578), AOM_ICDF(22647), AOM_ICDF(22677), + AOM_ICDF(32768) }, + { AOM_ICDF(7617), AOM_ICDF(7689), AOM_ICDF(19849), AOM_ICDF(19887), + AOM_ICDF(32768) }, + { AOM_ICDF(2113), AOM_ICDF(2183), AOM_ICDF(7202), AOM_ICDF(7377), + AOM_ICDF(32768) } } } }, { // UV plane { // Inter { // Band 0 @@ -5187,70 +1947,70 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = { { AOM_ICDF(1344), AOM_ICDF(3989), AOM_ICDF(18125), AOM_ICDF(25340), AOM_ICDF(27820), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(15937), AOM_ICDF(29000), AOM_ICDF(32210), AOM_ICDF(32434), - AOM_ICDF(32768) }, - {AOM_ICDF(12353), AOM_ICDF(26626), AOM_ICDF(31533), AOM_ICDF(31993), - AOM_ICDF(32768) }, - {AOM_ICDF(11457), AOM_ICDF(29187), AOM_ICDF(30896), AOM_ICDF(31750), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(21278), AOM_ICDF(28169), AOM_ICDF(29764), - AOM_ICDF(32768) }, - {AOM_ICDF(7489), AOM_ICDF(8855), AOM_ICDF(13365), AOM_ICDF(15620), - AOM_ICDF(32768) }, - {AOM_ICDF(4289), AOM_ICDF(4833), AOM_ICDF(8572), AOM_ICDF(10108), - AOM_ICDF(32768) } }, + { AOM_ICDF(15937), AOM_ICDF(29000), AOM_ICDF(32210), AOM_ICDF(32434), + AOM_ICDF(32768) }, + { AOM_ICDF(12353), AOM_ICDF(26626), AOM_ICDF(31533), AOM_ICDF(31993), + AOM_ICDF(32768) }, + { AOM_ICDF(11457), AOM_ICDF(29187), AOM_ICDF(30896), AOM_ICDF(31750), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(21278), AOM_ICDF(28169), AOM_ICDF(29764), + AOM_ICDF(32768) }, + { AOM_ICDF(7489), AOM_ICDF(8855), AOM_ICDF(13365), AOM_ICDF(15620), + AOM_ICDF(32768) }, + { AOM_ICDF(4289), AOM_ICDF(4833), AOM_ICDF(8572), AOM_ICDF(10108), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(25025), AOM_ICDF(30783), AOM_ICDF(32603), AOM_ICDF(32666), - AOM_ICDF(32768) }, - {AOM_ICDF(24385), AOM_ICDF(29586), AOM_ICDF(31803), AOM_ICDF(32142), - AOM_ICDF(32768) }, - {AOM_ICDF(22337), AOM_ICDF(23002), AOM_ICDF(27573), AOM_ICDF(27903), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(12336), AOM_ICDF(21900), AOM_ICDF(22590), - AOM_ICDF(32768) }, - {AOM_ICDF(8257), AOM_ICDF(8830), AOM_ICDF(19986), AOM_ICDF(20298), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(10990), AOM_ICDF(18660), AOM_ICDF(18701), - AOM_ICDF(32768) } }, + { AOM_ICDF(25025), AOM_ICDF(30783), AOM_ICDF(32603), AOM_ICDF(32666), + AOM_ICDF(32768) }, + { AOM_ICDF(24385), AOM_ICDF(29586), AOM_ICDF(31803), AOM_ICDF(32142), + AOM_ICDF(32768) }, + { AOM_ICDF(22337), AOM_ICDF(23002), AOM_ICDF(27573), AOM_ICDF(27903), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(12336), AOM_ICDF(21900), AOM_ICDF(22590), + AOM_ICDF(32768) }, + { AOM_ICDF(8257), AOM_ICDF(8830), AOM_ICDF(19986), AOM_ICDF(20298), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(10990), AOM_ICDF(18660), AOM_ICDF(18701), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(29761), AOM_ICDF(31473), AOM_ICDF(32693), AOM_ICDF(32715), - AOM_ICDF(32768) }, - {AOM_ICDF(20417), AOM_ICDF(24512), AOM_ICDF(31394), AOM_ICDF(31650), - AOM_ICDF(32768) }, - {AOM_ICDF(11713), AOM_ICDF(13283), AOM_ICDF(25819), AOM_ICDF(26206), - AOM_ICDF(32768) }, - {AOM_ICDF(13121), AOM_ICDF(14099), AOM_ICDF(21909), AOM_ICDF(22514), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(248), AOM_ICDF(9546), AOM_ICDF(9614), - AOM_ICDF(32768) }, - {AOM_ICDF(2497), AOM_ICDF(2524), AOM_ICDF(7050), AOM_ICDF(7125), - AOM_ICDF(32768) } }, + { AOM_ICDF(29761), AOM_ICDF(31473), AOM_ICDF(32693), AOM_ICDF(32715), + AOM_ICDF(32768) }, + { AOM_ICDF(20417), AOM_ICDF(24512), AOM_ICDF(31394), AOM_ICDF(31650), + AOM_ICDF(32768) }, + { AOM_ICDF(11713), AOM_ICDF(13283), AOM_ICDF(25819), AOM_ICDF(26206), + AOM_ICDF(32768) }, + { AOM_ICDF(13121), AOM_ICDF(14099), AOM_ICDF(21909), AOM_ICDF(22514), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(248), AOM_ICDF(9546), AOM_ICDF(9614), + AOM_ICDF(32768) }, + { AOM_ICDF(2497), AOM_ICDF(2524), AOM_ICDF(7050), AOM_ICDF(7125), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(30657), AOM_ICDF(31885), AOM_ICDF(32691), AOM_ICDF(32715), - AOM_ICDF(32768) }, - {AOM_ICDF(19393), AOM_ICDF(26050), AOM_ICDF(31698), AOM_ICDF(31988), - AOM_ICDF(32768) }, - {AOM_ICDF(15809), AOM_ICDF(15863), AOM_ICDF(24985), AOM_ICDF(25008), - AOM_ICDF(32768) }, - {AOM_ICDF(23489), AOM_ICDF(28138), AOM_ICDF(32751), AOM_ICDF(32756), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), - AOM_ICDF(32768) }, - {AOM_ICDF(2369), AOM_ICDF(2395), AOM_ICDF(6822), AOM_ICDF(6898), - AOM_ICDF(32768) } }, + { AOM_ICDF(30657), AOM_ICDF(31885), AOM_ICDF(32691), AOM_ICDF(32715), + AOM_ICDF(32768) }, + { AOM_ICDF(19393), AOM_ICDF(26050), AOM_ICDF(31698), AOM_ICDF(31988), + AOM_ICDF(32768) }, + { AOM_ICDF(15809), AOM_ICDF(15863), AOM_ICDF(24985), AOM_ICDF(25008), + AOM_ICDF(32768) }, + { AOM_ICDF(23489), AOM_ICDF(28138), AOM_ICDF(32751), AOM_ICDF(32756), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(16450), AOM_ICDF(16545), AOM_ICDF(16593), + AOM_ICDF(32768) }, + { AOM_ICDF(2369), AOM_ICDF(2395), AOM_ICDF(6822), AOM_ICDF(6898), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(32705), AOM_ICDF(32744), AOM_ICDF(32766), AOM_ICDF(32767), - AOM_ICDF(32768) }, - {AOM_ICDF(21953), AOM_ICDF(24962), AOM_ICDF(32156), AOM_ICDF(32246), - AOM_ICDF(32768) }, - {AOM_ICDF(13121), AOM_ICDF(15358), AOM_ICDF(26284), AOM_ICDF(26835), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(7417), AOM_ICDF(20132), AOM_ICDF(20885), - AOM_ICDF(32768) }, - {AOM_ICDF(4417), AOM_ICDF(4939), AOM_ICDF(15104), AOM_ICDF(15535), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), - AOM_ICDF(32768) } } }, + { AOM_ICDF(32705), AOM_ICDF(32744), AOM_ICDF(32766), AOM_ICDF(32767), + AOM_ICDF(32768) }, + { AOM_ICDF(21953), AOM_ICDF(24962), AOM_ICDF(32156), AOM_ICDF(32246), + AOM_ICDF(32768) }, + { AOM_ICDF(13121), AOM_ICDF(15358), AOM_ICDF(26284), AOM_ICDF(26835), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(7417), AOM_ICDF(20132), AOM_ICDF(20885), + AOM_ICDF(32768) }, + { AOM_ICDF(4417), AOM_ICDF(4939), AOM_ICDF(15104), AOM_ICDF(15535), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2680), AOM_ICDF(8218), AOM_ICDF(8338), + AOM_ICDF(32768) } } }, { // Inter { // Band 0 { AOM_ICDF(25280), AOM_ICDF(25678), AOM_ICDF(32446), AOM_ICDF(32622), @@ -5260,84 +2020,74 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = { { AOM_ICDF(3264), AOM_ICDF(5170), AOM_ICDF(21779), AOM_ICDF(24026), AOM_ICDF(27905), AOM_ICDF(32768) } }, { // Band 1 - {AOM_ICDF(24257), AOM_ICDF(30554), AOM_ICDF(32719), AOM_ICDF(32738), - AOM_ICDF(32768) }, - {AOM_ICDF(17217), AOM_ICDF(27413), AOM_ICDF(32617), AOM_ICDF(32667), - AOM_ICDF(32768) }, - {AOM_ICDF(22977), AOM_ICDF(27600), AOM_ICDF(32482), AOM_ICDF(32552), - AOM_ICDF(32768) }, - {AOM_ICDF(16833), AOM_ICDF(24360), AOM_ICDF(30746), AOM_ICDF(31293), - AOM_ICDF(32768) }, - {AOM_ICDF(17089), AOM_ICDF(20060), AOM_ICDF(28880), AOM_ICDF(29370), - AOM_ICDF(32768) }, - {AOM_ICDF(10945), AOM_ICDF(11009), AOM_ICDF(21900), AOM_ICDF(21932), - AOM_ICDF(32768) } }, + { AOM_ICDF(24257), AOM_ICDF(30554), AOM_ICDF(32719), AOM_ICDF(32738), + AOM_ICDF(32768) }, + { AOM_ICDF(17217), AOM_ICDF(27413), AOM_ICDF(32617), AOM_ICDF(32667), + AOM_ICDF(32768) }, + { AOM_ICDF(22977), AOM_ICDF(27600), AOM_ICDF(32482), AOM_ICDF(32552), + AOM_ICDF(32768) }, + { AOM_ICDF(16833), AOM_ICDF(24360), AOM_ICDF(30746), AOM_ICDF(31293), + AOM_ICDF(32768) }, + { AOM_ICDF(17089), AOM_ICDF(20060), AOM_ICDF(28880), AOM_ICDF(29370), + AOM_ICDF(32768) }, + { AOM_ICDF(10945), AOM_ICDF(11009), AOM_ICDF(21900), AOM_ICDF(21932), + AOM_ICDF(32768) } }, { // Band 2 - {AOM_ICDF(27201), AOM_ICDF(30217), AOM_ICDF(32736), AOM_ICDF(32745), - AOM_ICDF(32768) }, - {AOM_ICDF(22721), AOM_ICDF(27676), AOM_ICDF(32749), AOM_ICDF(32754), - AOM_ICDF(32768) }, - {AOM_ICDF(5057), AOM_ICDF(12431), AOM_ICDF(25246), AOM_ICDF(26620), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(321), AOM_ICDF(22016), AOM_ICDF(22048), - AOM_ICDF(32768) }, - {AOM_ICDF(5313), AOM_ICDF(5363), AOM_ICDF(13839), AOM_ICDF(13894), - AOM_ICDF(32768) }, - {AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), - AOM_ICDF(32768) } }, + { AOM_ICDF(27201), AOM_ICDF(30217), AOM_ICDF(32736), AOM_ICDF(32745), + AOM_ICDF(32768) }, + { AOM_ICDF(22721), AOM_ICDF(27676), AOM_ICDF(32749), AOM_ICDF(32754), + AOM_ICDF(32768) }, + { AOM_ICDF(5057), AOM_ICDF(12431), AOM_ICDF(25246), AOM_ICDF(26620), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(321), AOM_ICDF(22016), AOM_ICDF(22048), + AOM_ICDF(32768) }, + { AOM_ICDF(5313), AOM_ICDF(5363), AOM_ICDF(13839), AOM_ICDF(13894), + AOM_ICDF(32768) }, + { AOM_ICDF(2625), AOM_ICDF(2652), AOM_ICDF(7276), AOM_ICDF(7351), + AOM_ICDF(32768) } }, { // Band 3 - {AOM_ICDF(27713), AOM_ICDF(30739), AOM_ICDF(32759), AOM_ICDF(32762), - AOM_ICDF(32768) }, - {AOM_ICDF(26177), AOM_ICDF(30430), AOM_ICDF(32756), AOM_ICDF(32760), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(384), AOM_ICDF(32706), AOM_ICDF(32707), - AOM_ICDF(32768) }, - {AOM_ICDF(9409), AOM_ICDF(9528), AOM_ICDF(21591), AOM_ICDF(21646), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) }, - {AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), - AOM_ICDF(32768) } }, + { AOM_ICDF(27713), AOM_ICDF(30739), AOM_ICDF(32759), AOM_ICDF(32762), + AOM_ICDF(32768) }, + { AOM_ICDF(26177), AOM_ICDF(30430), AOM_ICDF(32756), AOM_ICDF(32760), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(384), AOM_ICDF(32706), AOM_ICDF(32707), + AOM_ICDF(32768) }, + { AOM_ICDF(9409), AOM_ICDF(9528), AOM_ICDF(21591), AOM_ICDF(21646), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) }, + { AOM_ICDF(2881), AOM_ICDF(2913), AOM_ICDF(8427), AOM_ICDF(8498), + AOM_ICDF(32768) } }, { // Band 4 - {AOM_ICDF(28993), AOM_ICDF(31156), AOM_ICDF(32747), AOM_ICDF(32753), - AOM_ICDF(32768) }, - {AOM_ICDF(25153), AOM_ICDF(28701), AOM_ICDF(32754), AOM_ICDF(32758), - AOM_ICDF(32768) }, - {AOM_ICDF(16449), AOM_ICDF(16544), AOM_ICDF(32737), AOM_ICDF(32738), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(321), AOM_ICDF(22016), AOM_ICDF(22048), - AOM_ICDF(32768) }, - {AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), - AOM_ICDF(32768) }, - {AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), - AOM_ICDF(32768) } }, + { AOM_ICDF(28993), AOM_ICDF(31156), AOM_ICDF(32747), AOM_ICDF(32753), + AOM_ICDF(32768) }, + { AOM_ICDF(25153), AOM_ICDF(28701), AOM_ICDF(32754), AOM_ICDF(32758), + AOM_ICDF(32768) }, + { AOM_ICDF(16449), AOM_ICDF(16544), AOM_ICDF(32737), AOM_ICDF(32738), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(321), AOM_ICDF(22016), AOM_ICDF(22048), + AOM_ICDF(32768) }, + { AOM_ICDF(193), AOM_ICDF(194), AOM_ICDF(384), AOM_ICDF(479), + AOM_ICDF(32768) }, + { AOM_ICDF(2753), AOM_ICDF(2789), AOM_ICDF(8909), AOM_ICDF(8979), + AOM_ICDF(32768) } }, { // Band 5 - {AOM_ICDF(30785), AOM_ICDF(32088), AOM_ICDF(32765), AOM_ICDF(32766), - AOM_ICDF(32768) }, - {AOM_ICDF(22977), AOM_ICDF(26623), AOM_ICDF(32750), AOM_ICDF(32754), - AOM_ICDF(32768) }, - {AOM_ICDF(21953), AOM_ICDF(21954), AOM_ICDF(22017), AOM_ICDF(22049), - AOM_ICDF(32768) }, - {AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), - AOM_ICDF(32768) }, - {AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), - AOM_ICDF(32768) }, - {AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), - AOM_ICDF(32768) } } } } + { AOM_ICDF(30785), AOM_ICDF(32088), AOM_ICDF(32765), AOM_ICDF(32766), + AOM_ICDF(32768) }, + { AOM_ICDF(22977), AOM_ICDF(26623), AOM_ICDF(32750), AOM_ICDF(32754), + AOM_ICDF(32768) }, + { AOM_ICDF(21953), AOM_ICDF(21954), AOM_ICDF(22017), AOM_ICDF(22049), + AOM_ICDF(32768) }, + { AOM_ICDF(5697), AOM_ICDF(7486), AOM_ICDF(20238), AOM_ICDF(21009), + AOM_ICDF(32768) }, + { AOM_ICDF(4929), AOM_ICDF(5579), AOM_ICDF(16402), AOM_ICDF(16866), + AOM_ICDF(32768) }, + { AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533), + AOM_ICDF(32768) } } } } }; /* clang-format on */ - -static void extend_to_full_distribution(aom_prob *probs, aom_prob p) { - assert(p != 0); - memcpy(probs, av1_pareto8_full[p - 1], MODEL_NODES * sizeof(aom_prob)); -} - -void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) { - if (full != model) - memcpy(full, model, sizeof(aom_prob) * UNCONSTRAINED_NODES); - extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]); -} +#endif // !CONFIG_Q_ADAPT_PROBS static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)], aom_cdf_prob cdf_head[CDF_SIZE(ENTROPY_TOKENS)], @@ -5364,122 +2114,21 @@ static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)], } } -static void build_head_cdfs(const aom_prob *pdf_model, - const aom_prob *blockz_model, - aom_cdf_prob cdf_head[ENTROPY_TOKENS + 1]) { - int i, p, p1, p2, phead[6], prob_NZ, prob_EOB_1, prob_EOB_2p, prob_NEOB_1, - prob_NEOB_2p; - int prob8_blocknz; - // We have the first coefficient position and so an extended CDF - const int is_dc = blockz_model != NULL; - const int last_head_val = HEAD_TOKENS - 1 + is_dc; - - assert(pdf_model != NULL); - assert(pdf_model[2] != 0); - - /* FIXME: maintain true CDF counts. */ - - /* Values are 0=BLOCK_ZERO 1=ZERO_TOKEN, 2=ONE_TOKEN_EOB - 3=ONE_TOKEN_NEOB, 4=TWO_TOKEN_PLUS_EOB, 5=TWO_TOKEN_PLUS_NEOB - */ - // Block zero probability - if (is_dc) { - phead[0] = - ((*blockz_model) << (CDF_PROB_BITS - 8)) + (1 << (CDF_PROB_BITS - 9)); - phead[0] = AOMMIN(CDF_PROB_TOP - (HEAD_TOKENS + 1), AOMMAX(1, phead[0])); - } - - // Will scale the remaining probabilities by the probability of the block - // being non-zero - prob8_blocknz = is_dc ? (256 - *blockz_model) : 256; - - // Probability of zero - phead[is_dc + ZERO_TOKEN] = - (pdf_model[1] << (CDF_PROB_BITS - 8)) + (1 << (CDF_PROB_BITS - 9)); - - // Will scale the non-zero values - prob_NZ = CDF_PROB_TOP - phead[is_dc + ZERO_TOKEN]; - - // Will scale the EOBs by the probability of and EOB_TOKEN .. - prob_EOB_1 = - (pdf_model[0] << (CDF_PROB_BITS - 8)) + (1 << (CDF_PROB_BITS - 9)); - // .. use a lower probability of EOB for larger values - prob_EOB_2p = prob_EOB_1 / 2; - - prob_NEOB_1 = CDF_PROB_TOP - prob_EOB_1; - prob_NEOB_2p = CDF_PROB_TOP - prob_EOB_2p; - if (prob_NZ == 0 || prob_NZ == CDF_PROB_TOP) abort(); - if (prob_EOB_1 == 0 || prob_EOB_1 == CDF_PROB_TOP) abort(); - if (prob_EOB_2p == 0 || prob_EOB_2p == CDF_PROB_TOP) abort(); - - // ONE_CONTEXT_NODE prob - p = (pdf_model[2] << (CDF_PROB_BITS - 8)) + (1 << (CDF_PROB_BITS - 9)); - // Scale by the non-zero factor to get the probability of token = 1 - p1 = ROUND_POWER_OF_TWO(prob_NZ * p, 15); - - // Scale by the EOB factors - phead[is_dc + ONE_TOKEN_EOB] = ROUND_POWER_OF_TWO(p1 * prob_EOB_1, 15); - phead[is_dc + ONE_TOKEN_NEOB] = ROUND_POWER_OF_TWO(p1 * prob_NEOB_1, 15); - - // Probability token is 2 or more - p2 = CDF_PROB_TOP - p1 - phead[is_dc + ZERO_TOKEN]; - - phead[is_dc + TWO_TOKEN_PLUS_EOB] = ROUND_POWER_OF_TWO(p2 * prob_EOB_2p, 15); - phead[is_dc + TWO_TOKEN_PLUS_NEOB] = - ROUND_POWER_OF_TWO(p2 * prob_NEOB_2p, 15); - - // Now use block non-zerp prob to scale the values - for (i = is_dc; i < last_head_val; ++i) { - phead[i] = (prob8_blocknz * phead[i] + 128) >> 8; - } - - for (i = 0; i < last_head_val; ++i) { - int c0; - c0 = i > 0 ? AOM_ICDF(cdf_head[i - 1]) : 0; - p = AOMMAX(1, AOMMIN(CDF_PROB_TOP - (last_head_val - i) - c0, phead[i])); - cdf_head[i] = AOM_ICDF(c0 + p); - } - cdf_head[last_head_val] = AOM_ICDF(CDF_PROB_TOP); -} - +#if !CONFIG_Q_ADAPT_PROBS +// FIXME. Optimize for TX_2X2 and TX_64X64. static void av1_default_coef_cdfs(FRAME_CONTEXT *fc) { - int i, j, k, l; - for (i = 0; i < PLANE_TYPES; ++i) - for (j = 0; j < REF_TYPES; ++j) - for (k = 0; k < COEF_BANDS; ++k) - for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { #if CONFIG_CHROMA_2X2 - av1_copy(fc->coef_head_cdfs[TX_2X2][i][j][k][l], - default_coef_head_cdf_4x4[i][j][k][l]); -#endif - av1_copy(fc->coef_head_cdfs[TX_4X4][i][j][k][l], - default_coef_head_cdf_4x4[i][j][k][l]); - av1_copy(fc->coef_head_cdfs[TX_8X8][i][j][k][l], - default_coef_head_cdf_8x8[i][j][k][l]); - av1_copy(fc->coef_head_cdfs[TX_16X16][i][j][k][l], - default_coef_head_cdf_16x16[i][j][k][l]); - av1_copy(fc->coef_head_cdfs[TX_32X32][i][j][k][l], - default_coef_head_cdf_32x32[i][j][k][l]); + av1_copy(fc->coef_head_cdfs[TX_2X2], default_coef_head_cdf_4x4); +#endif // CONFIG_CHROMA_2X2 + av1_copy(fc->coef_head_cdfs[TX_4X4], default_coef_head_cdf_4x4); + av1_copy(fc->coef_head_cdfs[TX_8X8], default_coef_head_cdf_8x8); + av1_copy(fc->coef_head_cdfs[TX_16X16], default_coef_head_cdf_16x16); + av1_copy(fc->coef_head_cdfs[TX_32X32], default_coef_head_cdf_32x32); #if CONFIG_TX64X64 - av1_copy(fc->coef_head_cdfs[TX_64X64][i][j][k][l], - default_coef_head_cdf_32x32[i][j][k][l]); -#endif - } -} - -void av1_coef_head_cdfs(FRAME_CONTEXT *fc) { - TX_SIZE t; - int i, j, k, l; - for (t = 0; t < TX_SIZES; ++t) - for (i = 0; i < PLANE_TYPES; ++i) - for (j = 0; j < REF_TYPES; ++j) - for (k = 0; k < COEF_BANDS; ++k) - for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { - build_head_cdfs(fc->coef_probs[t][i][j][k][l], - k == 0 ? &fc->blockzero_probs[t][i][j][l] : NULL, - fc->coef_head_cdfs[t][i][j][k][l]); - } + av1_copy(fc->coef_head_cdfs[TX_64X64], default_coef_head_cdf_32x32); +#endif // CONFIG_TX64X64 } +#endif // !CONFIG_Q_ADAPT_PROBS void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) { /* Build the tail based on a Pareto distribution */ @@ -5496,83 +2145,33 @@ void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) { void av1_default_coef_probs(AV1_COMMON *cm) { #if CONFIG_Q_ADAPT_PROBS - const int index = AOMMIN( - ROUND_POWER_OF_TWO(cm->base_qindex, 8 - QCTX_BIN_BITS), QCTX_BINS - 1); - av1_copy(cm->fc->coef_probs, default_qctx_coef_probs[index]); -#else + const int index = AOMMIN(TOKEN_CDF_Q_CTXS - 1, cm->base_qindex / 64); #if CONFIG_CHROMA_2X2 - av1_copy(cm->fc->coef_probs[TX_2X2], default_coef_probs_4x4); -#endif - av1_copy(cm->fc->coef_probs[TX_4X4], default_coef_probs_4x4); - av1_copy(cm->fc->coef_probs[TX_8X8], default_coef_probs_8x8); - av1_copy(cm->fc->coef_probs[TX_16X16], default_coef_probs_16x16); - av1_copy(cm->fc->coef_probs[TX_32X32], default_coef_probs_32x32); + av1_copy(cm->fc->coef_head_cdfs[TX_2X2], + (*av1_default_qctx_coef_cdfs[index])[TX_4X4]); +#endif // CONFIG_CHROMA_2X2 + av1_copy(cm->fc->coef_head_cdfs[TX_4X4], + (*av1_default_qctx_coef_cdfs[index])[TX_4X4]); + av1_copy(cm->fc->coef_head_cdfs[TX_8X8], + (*av1_default_qctx_coef_cdfs[index])[TX_8X8]); + av1_copy(cm->fc->coef_head_cdfs[TX_16X16], + (*av1_default_qctx_coef_cdfs[index])[TX_16X16]); + av1_copy(cm->fc->coef_head_cdfs[TX_32X32], + (*av1_default_qctx_coef_cdfs[index])[TX_32X32]); #if CONFIG_TX64X64 - av1_copy(cm->fc->coef_probs[TX_64X64], default_coef_probs_64x64); + av1_copy(cm->fc->coef_head_cdfs[TX_64X64], + (*av1_default_qctx_coef_cdfs[index])[TX_32X32]); #endif // CONFIG_TX64X64 -#endif // CONFIG_Q_ADAPT_PROBS - av1_copy(cm->fc->blockzero_probs, av1_default_blockzero_probs); +#else /* Load the head tokens */ av1_default_coef_cdfs(cm->fc); +#endif // CONFIG_Q_ADAPT_PROBS av1_coef_pareto_cdfs(cm->fc); } -#if !CONFIG_LV_MAP -static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size, - unsigned int count_sat, - unsigned int update_factor) { - const FRAME_CONTEXT *pre_fc = cm->pre_fc; - av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size]; - const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size]; - const av1_coeff_count_model *const counts = - (const av1_coeff_count_model *)cm->counts.coef[tx_size]; - const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = - (const unsigned int(*)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]) - cm->counts.eob_branch[tx_size]; - const av1_blockz_probs_model *const pre_blockz_probs = - pre_fc->blockzero_probs[tx_size]; - av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size]; - const av1_blockz_count_model *const blockz_counts = - (const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0]; - int i, j, k, l, m; -#if CONFIG_RECT_TX - assert(!is_rect_tx(tx_size)); -#endif // CONFIG_RECT_TX - - for (i = 0; i < PLANE_TYPES; ++i) - for (j = 0; j < REF_TYPES; ++j) - for (k = 0; k < COEF_BANDS; ++k) - for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { - const int n0 = counts[i][j][k][l][ZERO_TOKEN]; - const int n1 = counts[i][j][k][l][ONE_TOKEN]; - const int n2 = counts[i][j][k][l][TWO_TOKEN]; - const int neob = counts[i][j][k][l][EOB_MODEL_TOKEN]; - const unsigned int branch_ct[UNCONSTRAINED_NODES][2] = { - { neob, eob_counts[i][j][k][l] - neob }, { n0, n1 + n2 }, { n1, n2 } - }; - for (m = 0; m < UNCONSTRAINED_NODES; ++m) - probs[i][j][k][l][m] = - av1_merge_probs(pre_probs[i][j][k][l][m], branch_ct[m], - count_sat, update_factor); - } - - for (i = 0; i < PLANE_TYPES; ++i) { - for (j = 0; j < REF_TYPES; ++j) { - for (k = 0; k < BLOCKZ_CONTEXTS; ++k) { - const int n0 = blockz_counts[i][j][k][0]; - const int n1 = blockz_counts[i][j][k][1]; - const unsigned int branch_ct[2] = { n0, n1 }; - blockz_probs[i][j][k] = av1_merge_probs( - pre_blockz_probs[i][j][k], branch_ct, count_sat, update_factor); - } - } - } -} -#endif // !CONFIG_LV_MAP - +#if CONFIG_LV_MAP void av1_adapt_coef_probs(AV1_COMMON *cm) { unsigned int count_sat, update_factor; - if (!frame_is_intra_only(cm) && cm->last_frame_type == KEY_FRAME) { update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */ count_sat = COEF_COUNT_SAT_AFTER_KEY; @@ -5580,15 +2179,9 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) { update_factor = COEF_MAX_UPDATE_FACTOR; count_sat = COEF_COUNT_SAT; } - -#if CONFIG_LV_MAP av1_adapt_txb_probs(cm, count_sat, update_factor); -#else - TX_SIZE tx_size; - for (tx_size = 0; tx_size < TX_SIZES; tx_size++) - adapt_coef_probs(cm, tx_size, count_sat, update_factor); -#endif } +#endif // CONFIG_LV_MAP static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr, int cdf_size, const int num_tiles) { @@ -5623,8 +2216,25 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], aom_cdf_prob *fc_cdf_ptr; +#if CONFIG_LV_MAP + AVERAGE_TILE_CDFS(txb_skip_cdf) + AVERAGE_TILE_CDFS(nz_map_cdf) + AVERAGE_TILE_CDFS(eob_flag_cdf) + AVERAGE_TILE_CDFS(dc_sign_cdf) + AVERAGE_TILE_CDFS(coeff_base_cdf) + AVERAGE_TILE_CDFS(coeff_lps_cdf) +#if BR_NODE + AVERAGE_TILE_CDFS(coeff_br_cdf) +#endif +#if CONFIG_CTX1D + AVERAGE_TILE_CDFS(eob_mode_cdf) + AVERAGE_TILE_CDFS(empty_line_cdf) + AVERAGE_TILE_CDFS(hv_eob_cdf) +#endif +#else AVERAGE_TILE_CDFS(coef_head_cdfs) AVERAGE_TILE_CDFS(coef_tail_cdfs) +#endif } void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], @@ -5645,6 +2255,7 @@ void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], AVERAGE_TILE_CDFS(nmvc[j].comps[k].hp_cdf) AVERAGE_TILE_CDFS(nmvc[j].comps[k].class0_hp_cdf) AVERAGE_TILE_CDFS(nmvc[j].comps[k].class0_cdf) + AVERAGE_TILE_CDFS(nmvc[j].comps[k].bits_cdf) #endif } } @@ -5668,17 +2279,16 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], AVERAGE_TILE_CDFS(uv_mode_cdf) #if CONFIG_CFL + AVERAGE_TILE_CDFS(cfl_sign_cdf) AVERAGE_TILE_CDFS(cfl_alpha_cdf) #endif AVERAGE_TILE_CDFS(partition_cdf) -#if CONFIG_DELTA_Q AVERAGE_TILE_CDFS(delta_q_cdf) #if CONFIG_EXT_DELTA_Q AVERAGE_TILE_CDFS(delta_lf_cdf) #endif -#endif #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP AVERAGE_TILE_CDFS(intra_filter_cdf) #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP @@ -5688,13 +2298,26 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], #if CONFIG_VAR_TX AVERAGE_TILE_CDFS(txfm_partition_cdf) #endif -#if CONFIG_PALETTE +#endif // CONFIG_NEW_MULTISYMBOL AVERAGE_TILE_CDFS(palette_y_size_cdf) AVERAGE_TILE_CDFS(palette_uv_size_cdf) AVERAGE_TILE_CDFS(palette_y_color_index_cdf) AVERAGE_TILE_CDFS(palette_uv_color_index_cdf) +#if CONFIG_MRC_TX + AVERAGE_TILE_CDFS(mrc_mask_intra_cdf) +#endif // CONFIG_MRC_TX +#if CONFIG_NEW_MULTISYMBOL + AVERAGE_TILE_CDFS(palette_y_mode_cdf) + AVERAGE_TILE_CDFS(palette_uv_mode_cdf) +#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) + AVERAGE_TILE_CDFS(quarter_tx_size_cdf) #endif -#endif // CONFIG_NEW_MULTISYMBOL +#endif +#if CONFIG_LPF_SB + AVERAGE_TILE_CDFS(lpf_reuse_cdf); + AVERAGE_TILE_CDFS(lpf_delta_cdf); + AVERAGE_TILE_CDFS(lpf_sign_cdf); +#endif // CONFIG_LPF_SB } void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc, @@ -5707,6 +2330,7 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc, #if CONFIG_NEW_MULTISYMBOL AVERAGE_TILE_CDFS(comp_inter_cdf) #if CONFIG_EXT_REFS + AVERAGE_TILE_CDFS(comp_ref_cdf) AVERAGE_TILE_CDFS(comp_bwdref_cdf) #endif #endif @@ -5718,14 +2342,19 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc, AVERAGE_TILE_CDFS(zeromv_cdf) AVERAGE_TILE_CDFS(refmv_cdf) AVERAGE_TILE_CDFS(drl_cdf) +#if CONFIG_EXT_COMP_REFS + AVERAGE_TILE_CDFS(uni_comp_ref_cdf) + AVERAGE_TILE_CDFS(comp_ref_type_cdf) +#endif #endif -// FIXME: cdfs not defined for super_tx + // FIXME: cdfs not defined for super_tx -#if CONFIG_EXT_INTER AVERAGE_TILE_CDFS(inter_compound_mode_cdf) +#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT AVERAGE_TILE_CDFS(compound_type_cdf) +#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SINGLEREF AVERAGE_TILE_CDFS(inter_singleref_comp_mode_cdf) #endif @@ -5737,7 +2366,6 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc, #endif AVERAGE_TILE_CDFS(interintra_mode_cdf) #endif -#endif // CONFIG_EXT_INTER /* NB: kf_y_cdf is discarded after use, so no need for backwards update */ @@ -5755,6 +2383,14 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc, #endif #endif #endif +#if CONFIG_MRC_TX + AVERAGE_TILE_CDFS(mrc_mask_inter_cdf) +#endif // CONFIG_MRC_TX +#if CONFIG_LPF_SB + AVERAGE_TILE_CDFS(lpf_reuse_cdf); + AVERAGE_TILE_CDFS(lpf_delta_cdf); + AVERAGE_TILE_CDFS(lpf_sign_cdf); +#endif // CONFIG_LPF_SB } #if CONFIG_PVQ diff --git a/third_party/aom/av1/common/entropy.h b/third_party/aom/av1/common/entropy.h index 190b792b5..679aae837 100644 --- a/third_party/aom/av1/common/entropy.h +++ b/third_party/aom/av1/common/entropy.h @@ -28,8 +28,7 @@ extern "C" { #define GROUP_DIFF_UPDATE_PROB 252 #if CONFIG_Q_ADAPT_PROBS -#define QCTX_BIN_BITS 2 -#define QCTX_BINS (1 << QCTX_BIN_BITS) +#define TOKEN_CDF_Q_CTXS 4 #endif // CONFIG_Q_ADAPT_PROBS // Coefficient token alphabet @@ -61,8 +60,25 @@ extern "C" { #if CONFIG_LV_MAP #define TXB_SKIP_CONTEXTS 13 -#define SIG_COEF_CONTEXTS 20 + +#if CONFIG_CTX1D +#define EOB_COEF_CONTEXTS_2D 25 +#define EOB_COEF_CONTEXTS_1D 25 +#define EOB_COEF_CONTEXTS \ + (EOB_COEF_CONTEXTS_2D + EOB_COEF_CONTEXTS_1D + EOB_COEF_CONTEXTS_1D) +#else // CONFIG_CTX1D #define EOB_COEF_CONTEXTS 25 +#endif // CONFIG_CTX1D + +#if CONFIG_EXT_TX +#define SIG_COEF_CONTEXTS_2D 16 +#define SIG_COEF_CONTEXTS_1D 16 +#define SIG_COEF_CONTEXTS \ + (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D) +#else // CONFIG_EXT_TX +#define SIG_COEF_CONTEXTS_2D 16 +#define SIG_COEF_CONTEXTS 16 +#endif // CONFIG_EXT_TX #define COEFF_BASE_CONTEXTS 42 #define DC_SIGN_CONTEXTS 3 @@ -71,10 +87,26 @@ extern "C" { #define LEVEL_CONTEXTS (BR_TMP_OFFSET * BR_REF_CAT) #define NUM_BASE_LEVELS 2 -#define COEFF_BASE_RANGE (15 - NUM_BASE_LEVELS) +#define COEFF_BASE_RANGE (16 - NUM_BASE_LEVELS) +#define BASE_RANGE_SETS 3 #define COEFF_CONTEXT_BITS 6 #define COEFF_CONTEXT_MASK ((1 << COEFF_CONTEXT_BITS) - 1) + +#define BASE_CONTEXT_POSITION_NUM 12 + +#if CONFIG_CTX1D +#define EMPTY_LINE_CONTEXTS 5 +#define HV_EOB_CONTEXTS 24 +#endif // CONFIG_CTX1D + +typedef enum TX_CLASS { + TX_CLASS_2D = 0, + TX_CLASS_HORIZ = 1, + TX_CLASS_VERT = 2, + TX_CLASSES = 3, +} TX_CLASS; + #endif DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]); @@ -169,26 +201,19 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size, distinct bands). */ #define COEFF_CONTEXTS 6 -#define BLOCKZ_CONTEXTS 3 #define COEFF_CONTEXTS0 3 // for band 0 #define BAND_COEFF_CONTEXTS(band) \ ((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS) -// #define ENTROPY_STATS - -typedef unsigned int av1_coeff_count[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] - [ENTROPY_TOKENS]; -typedef unsigned int av1_coeff_stats[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] - [ENTROPY_NODES][2]; - #define SUBEXP_PARAM 4 /* Subexponential code parameter */ #define MODULUS_PARAM 13 /* Modulus parameter */ struct AV1Common; struct frame_contexts; void av1_default_coef_probs(struct AV1Common *cm); +#if CONFIG_LV_MAP void av1_adapt_coef_probs(struct AV1Common *cm); -void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc); +#endif // CONFIG_LV_MAP // This is the index in the scan order beyond which all coefficients for // 8x8 transform and above are in the top band. @@ -221,26 +246,13 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) { #define UNCONSTRAINED_NODES 3 -#define PIVOT_NODE 2 // which node is pivot - #define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES) #define TAIL_NODES (MODEL_NODES + 1) extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)]; extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES]; -typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] - [UNCONSTRAINED_NODES]; - -typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS] - [COEFF_CONTEXTS] - [UNCONSTRAINED_NODES + 1]; - -void av1_model_to_full_probs(const aom_prob *model, aom_prob *full); - typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] [CDF_SIZE(ENTROPY_TOKENS)]; -typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS]; -typedef unsigned int av1_blockz_count_model[REF_TYPES][BLOCKZ_CONTEXTS][2]; extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS] [ENTROPY_TOKENS - 2]; extern const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS] @@ -314,6 +326,16 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a, left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) | *(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24)); break; + case TX_32X64: + above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8)); + left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) | + *(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24)); + break; + case TX_64X32: + above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8) | + *(const uint64_t *)(a + 16) | *(const uint64_t *)(a + 24)); + left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8)); + break; #endif // CONFIG_TX64X64 #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) case TX_4X16: @@ -384,6 +406,14 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a, above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8)); left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8)); break; + case TX_32X64: + above_ec = !!*(const uint64_t *)a; + left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8)); + break; + case TX_64X32: + above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8)); + left_ec = !!*(const uint64_t *)l; + break; #endif // CONFIG_TX64X64 #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) case TX_4X16: @@ -414,7 +444,7 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a, #define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128 #if CONFIG_ADAPT_SCAN -#define ADAPT_SCAN_PROB_PRECISION 16 +#define ADAPT_SCAN_PROB_PRECISION 10 // 1/8 update rate #define ADAPT_SCAN_UPDATE_LOG_RATE 3 #define ADAPT_SCAN_UPDATE_RATE \ diff --git a/third_party/aom/av1/common/entropymode.c b/third_party/aom/av1/common/entropymode.c index 9faa03e69..207f1e245 100644 --- a/third_party/aom/av1/common/entropymode.c +++ b/third_party/aom/av1/common/entropymode.c @@ -15,8 +15,12 @@ #include "av1/common/scan.h" #include "av1/common/onyxc_int.h" #include "av1/common/seg_common.h" +#if CONFIG_LV_MAP +#include "av1/common/txb_common.h" +#endif #if CONFIG_LV_MAP +#include "av1/common/txb_common.h" const aom_prob default_txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS] = { #if CONFIG_CHROMA_2X2 { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 }, @@ -168,40 +172,260 @@ const aom_prob default_coeff_base }; const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = { +#if CONFIG_EXT_TX #if CONFIG_CHROMA_2X2 + { { 56, 137, 82, 136, 83, 187, 124, 65, + 215, 118, 155, 97, 160, 111, 71, 55, + + 142, 156, 91, 226, 107, 231, 146, 65, + 105, 91, 232, 97, 185, 121, 90, 74, + + 153, 195, 123, 154, 106, 196, 143, 67, + 232, 125, 121, 105, 159, 113, 88, 66 }, + { 50, 124, 89, 135, 116, 189, 150, 81, + 202, 126, 130, 107, 149, 110, 85, 67, + + 139, 174, 112, 200, 94, 206, 146, 71, + 163, 164, 212, 99, 177, 143, 125, 85, + + 151, 181, 126, 168, 135, 186, 143, 94, + 207, 129, 142, 135, 145, 112, 98, 81 } }, +#endif + { { 56, 137, 82, 136, 83, 187, 124, 65, + 215, 118, 155, 97, 160, 111, 71, 55, + + 142, 156, 91, 226, 107, 231, 146, 65, + 105, 91, 232, 97, 185, 121, 90, 74, + + 153, 195, 123, 154, 106, 196, 143, 67, + 232, 125, 121, 105, 159, 113, 88, 66 }, + { 50, 124, 89, 135, 116, 189, 150, 81, + 202, 126, 130, 107, 149, 110, 85, 67, + + 139, 174, 112, 200, 94, 206, 146, 71, + 163, 164, 212, 99, 177, 143, 125, 85, + + 151, 181, 126, 168, 135, 186, 143, 94, + 207, 129, 142, 135, 145, 112, 98, 81 } }, + { { 57, 156, 91, 162, 99, 212, 149, 81, + 223, 128, 182, 121, 216, 163, 119, 94, + + 139, 183, 100, 206, 98, 242, 163, 79, + 200, 127, 234, 112, 230, 169, 115, 90, + + 156, 190, 130, 172, 117, 209, 163, 80, + 217, 145, 182, 135, 204, 163, 120, 88 }, + { 48, 133, 102, 143, 119, 190, 170, 109, + 197, 127, 176, 137, 214, 168, 130, 119, + + 139, 185, 129, 210, 84, 237, 177, 75, + 182, 165, 216, 121, 206, 177, 147, 102, + + 159, 192, 153, 182, 139, 203, 160, 125, + 193, 161, 176, 142, 173, 145, 131, 114 } }, + { { 33, 148, 81, 149, 84, 219, 152, 76, + 229, 127, 205, 120, 234, 170, 123, 88, + + 134, 197, 101, 213, 91, 244, 169, 85, + 220, 141, 234, 123, 242, 183, 130, 94, + + 141, 184, 121, 173, 98, 213, 156, 85, + 204, 156, 197, 119, 212, 174, 127, 92 }, + { 14, 75, 45, 98, 83, 197, 150, 90, + 235, 124, 242, 155, 246, 187, 143, 103, + + 78, 185, 111, 255, 116, 255, 224, 171, + 185, 157, 255, 85, 219, 122, 128, 128, + + 117, 187, 102, 181, 132, 233, 197, 93, + 207, 135, 191, 107, 222, 175, 130, 47 } }, { - { 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, - 75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, - { 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, - 109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, + { 14, 79, 44, 86, 59, 178, 124, 63, + 244, 106, 233, 117, 252, 185, 132, 92, + + 85, 225, 47, 236, 103, 255, 190, 116, + 235, 114, 247, 123, 250, 174, 122, 110, + + 109, 197, 78, 177, 76, 242, 148, 68, + 236, 123, 231, 103, 247, 171, 122, 91 }, + { 11, 40, 27, 92, 78, 183, 171, 70, + 216, 74, 251, 146, 252, 213, 171, 148, + + 85, 225, 47, 236, 103, 255, 190, 116, + 235, 114, 247, 123, 250, 174, 122, 110, + + 109, 197, 78, 177, 76, 242, 148, 68, + 236, 123, 231, 103, 247, 171, 122, 91 }, + }, +#else // CONFIG_EXT_TX +#if CONFIG_CHROMA_2X2 + { + { + 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129, 94, + 65, + }, + + { + 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134, + 109, 81, + }, }, #endif { - { 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, - 75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, - { 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, - 109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, + { + 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129, 94, + 65, + }, + + { + 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134, + 109, 81, + }, }, { - { 34, 127, 74, 124, 74, 204, 153, 76, 226, 162, - 92, 207, 126, 91, 227, 192, 149, 108, 85, 55 }, - { 43, 136, 115, 158, 130, 212, 187, 112, 231, 180, - 130, 202, 164, 130, 236, 204, 168, 139, 112, 114 }, + { + 34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192, 149, + 108, + }, + + { + 43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236, 204, + 168, 139, + }, }, { - { 25, 117, 70, 120, 77, 215, 171, 102, 234, 156, - 105, 235, 155, 109, 247, 220, 176, 127, 92, 72 }, - { 24, 88, 49, 100, 62, 202, 148, 62, 237, 178, - 102, 233, 168, 105, 244, 198, 162, 127, 103, 71 }, + { + 25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220, + 176, 127, + }, + + { + 24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198, 162, + 127, + }, }, { - { 11, 54, 17, 69, 26, 128, 125, 56, 232, 130, - 60, 237, 121, 66, 250, 168, 134, 114, 93, 53 }, - { 21, 52, 32, 95, 64, 171, 152, 70, 247, 159, - 81, 252, 177, 100, 252, 221, 192, 143, 195, 146 }, + { + 11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168, 134, + 114, + }, + + { + 21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221, 192, + 143, + }, }, +#endif // CONFIG_EXT_TX }; +#if CONFIG_CTX1D +const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = { +#if CONFIG_CHROMA_2X2 + { { 220, 225, 220, 216, 233, 225, 189, 178, 222, 199, 164, 112, 207, + 171, 115, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 147, 125, 104, 36, 117, 107, 26, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 156, 124, 128, 128, 146, 68, 128, 128, 131, 17, 128, 128, 64, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + + { 146, 150, 142, 144, 178, 167, 131, 116, 150, 123, 107, 63, 119, + 89, 74, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 117, 127, 105, 69, 53, 56, 30, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 86, 128, 128, 140, 72, 128, 128, 120, 44, 128, 128, 80, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, + { { 237, 242, 242, 219, 192, 246, 246, 243, 233, 184, 155, 234, 217, + 188, 152, 195, 167, 114, 89, 128, 128, 128, 128, 128, 128, + + 180, 173, 154, 133, 112, 147, 145, 142, 102, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 198, 173, 130, 200, 128, 208, 182, 160, 106, 171, 128, 144, 128, + 128, 128, 124, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + + { 140, 170, 162, 111, 94, 182, 195, 165, 153, 110, 81, 178, 169, + 158, 83, 133, 85, 85, 38, 128, 128, 128, 128, 128, 128, + + 112, 127, 107, 87, 31, 57, 49, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 160, 143, 99, 126, 128, 164, 133, 126, 59, 71, 128, 138, 128, + 128, 128, 99, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, +#endif + { { 220, 225, 220, 216, 233, 225, 189, 178, 222, 199, 164, 112, 207, + 171, 115, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 147, 125, 104, 36, 117, 107, 26, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 156, 124, 128, 128, 146, 68, 128, 128, 131, 17, 128, 128, 64, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + + { 146, 150, 142, 144, 178, 167, 131, 116, 150, 123, 107, 63, 119, + 89, 74, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 117, 127, 105, 69, 53, 56, 30, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 86, 128, 128, 140, 72, 128, 128, 120, 44, 128, 128, 80, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, + { { 237, 242, 242, 219, 192, 246, 246, 243, 233, 184, 155, 234, 217, + 188, 152, 195, 167, 114, 89, 128, 128, 128, 128, 128, 128, + + 180, 173, 154, 133, 112, 147, 145, 142, 102, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 198, 173, 130, 200, 128, 208, 182, 160, 106, 171, 128, 144, 128, + 128, 128, 124, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + + { 140, 170, 162, 111, 94, 182, 195, 165, 153, 110, 81, 178, 169, + 158, 83, 133, 85, 85, 38, 128, 128, 128, 128, 128, 128, + + 112, 127, 107, 87, 31, 57, 49, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 160, 143, 99, 126, 128, 164, 133, 126, 59, 71, 128, 138, 128, + 128, 128, 99, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, + { { 229, 241, 243, 245, 247, 247, 251, 248, 235, 210, 247, 235, 208, + 166, 245, 247, 244, 182, 236, 229, 180, 136, 128, 128, 128, + + 191, 197, 96, 70, 199, 128, 128, 191, 174, 117, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 211, 183, 215, 188, 138, 209, 136, 128, 170, 128, 191, 128, 161, + 128, 182, 128, 128, 128, 164, 128, 128, 128, 128, 128, 128 }, + + { 106, 153, 182, 191, 186, 202, 211, 203, 166, 147, 205, 205, 195, + 128, 206, 212, 182, 109, 192, 154, 139, 79, 128, 128, 128, + + 112, 133, 128, 255, 128, 128, 128, 130, 154, 98, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 144, 185, 169, 199, 85, 183, 128, 128, 64, 128, 146, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, + { { 169, 203, 224, 222, 220, 228, 229, 223, 234, 247, 242, 230, 222, + 238, 246, 234, 196, 245, 249, 245, 192, 240, 235, 199, 161, + + 176, 148, 158, 77, 178, 128, 128, 158, 128, 128, 196, 208, 155, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 232, 187, 191, 221, 116, 217, 154, 128, 203, 128, 128, 192, 128, + 201, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + + { 133, 182, 215, 204, 176, 220, 182, 168, 187, 197, 181, 145, 75, + 164, 136, 51, 57, 156, 128, 128, 128, 85, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }, +}; +#else // CONFIG_CTX1D const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = { #if CONFIG_CHROMA_2X2 { @@ -236,61 +460,290 @@ const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = { 236, 186, 182, 57, 209, 140, 128, 85, 184, 110, 128, 128 }, }, }; +#endif // CONFIG_CTX1D const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = { #if CONFIG_CHROMA_2X2 - { - { 164, 128, 134, 165, 128, 137, 168, 128, 97, 136, 167, 128, - 182, 205, 143, 172, 200, 145, 173, 193, 103, 137, 170, 191, - 198, 214, 162, 187, 209, 162, 187, 207, 128, 156, 183, 201, - 219, 230, 204, 210, 225, 201, 209, 225, 187, 190, 203, 214 }, - { 106, 128, 98, 126, 128, 87, 122, 128, 54, 89, 131, 128, - 142, 180, 123, 154, 189, 115, 149, 175, 79, 115, 157, 182, - 175, 197, 147, 174, 199, 145, 174, 201, 89, 135, 173, 194, - 212, 222, 206, 203, 223, 188, 201, 220, 128, 144, 202, 206 }, - }, + { { 96, 128, 86, 122, 128, 84, 125, 128, 88, 99, 126, 128, + 135, 159, 99, 130, 134, 100, 128, 144, 70, 97, 128, 139, + 157, 168, 127, 148, 162, 121, 149, 157, 118, 127, 143, 157, + 178, 186, 168, 171, 183, 165, 169, 180, 180, 169, 166, 177 }, + { 81, 128, 72, 95, 128, 64, 98, 128, 42, 66, 101, 128, + 129, 163, 97, 122, 130, 91, 119, 141, 70, 94, 118, 166, + 157, 168, 117, 143, 151, 111, 144, 154, 76, 113, 128, 158, + 177, 185, 165, 167, 179, 155, 166, 179, 110, 137, 115, 165 } }, #endif - { - { 164, 128, 134, 165, 128, 137, 168, 128, 97, 136, 167, 128, - 182, 205, 143, 172, 200, 145, 173, 193, 103, 137, 170, 191, - 198, 214, 162, 187, 209, 162, 187, 207, 128, 156, 183, 201, - 219, 230, 204, 210, 225, 201, 209, 225, 187, 190, 203, 214 }, - { 106, 128, 98, 126, 128, 87, 122, 128, 54, 89, 131, 128, - 142, 180, 123, 154, 189, 115, 149, 175, 79, 115, 157, 182, - 175, 197, 147, 174, 199, 145, 174, 201, 89, 135, 173, 194, - 212, 222, 206, 203, 223, 188, 201, 220, 128, 144, 202, 206 }, - }, - { - { 171, 128, 123, 169, 128, 121, 165, 128, 82, 125, 168, 128, - 191, 213, 143, 177, 199, 136, 170, 194, 95, 135, 171, 195, - 206, 222, 166, 191, 212, 154, 184, 207, 115, 149, 180, 204, - 223, 237, 196, 215, 231, 186, 209, 228, 158, 178, 201, 222 }, - { 115, 128, 115, 146, 128, 91, 147, 128, 55, 93, 139, 128, - 147, 190, 141, 176, 201, 123, 156, 173, 68, 114, 156, 195, - 186, 205, 153, 191, 214, 141, 179, 205, 107, 132, 166, 184, - 215, 225, 200, 212, 230, 102, 207, 222, 128, 119, 200, 212 }, - }, - { - { 185, 128, 134, 198, 128, 128, 195, 128, 58, 110, 162, 128, - 208, 227, 154, 196, 206, 144, 188, 209, 83, 130, 168, 198, - 219, 232, 167, 205, 222, 158, 196, 216, 107, 143, 178, 204, - 233, 244, 202, 226, 238, 191, 217, 234, 153, 178, 200, 223 }, - { 160, 128, 154, 197, 128, 129, 178, 128, 53, 112, 157, 128, - 185, 214, 169, 196, 221, 134, 179, 186, 82, 131, 168, 194, - 204, 220, 176, 209, 221, 173, 194, 209, 107, 154, 181, 203, - 230, 241, 202, 226, 237, 185, 223, 234, 162, 187, 203, 222 }, - }, - { - { 177, 128, 165, 226, 128, 152, 219, 128, 45, 129, 188, 128, - 198, 218, 179, 220, 228, 163, 214, 220, 72, 134, 181, 206, - 216, 225, 177, 218, 231, 158, 213, 223, 112, 150, 185, 210, - 245, 251, 204, 234, 247, 195, 231, 243, 163, 186, 213, 235 }, - { 161, 128, 174, 205, 128, 146, 182, 128, 59, 125, 179, 128, - 183, 208, 199, 220, 239, 184, 213, 217, 71, 141, 196, 217, - 213, 219, 215, 230, 237, 171, 224, 238, 112, 173, 193, 221, - 239, 246, 168, 243, 249, 93, 241, 247, 128, 195, 216, 233 }, - }, + { { 96, 128, 86, 122, 128, 84, 125, 128, 88, 99, 126, 128, + 135, 159, 99, 130, 134, 100, 128, 144, 70, 97, 128, 139, + 157, 168, 127, 148, 162, 121, 149, 157, 118, 127, 143, 157, + 178, 186, 168, 171, 183, 165, 169, 180, 180, 169, 166, 177 }, + { 81, 128, 72, 95, 128, 64, 98, 128, 42, 66, 101, 128, + 129, 163, 97, 122, 130, 91, 119, 141, 70, 94, 118, 166, + 157, 168, 117, 143, 151, 111, 144, 154, 76, 113, 128, 158, + 177, 185, 165, 167, 179, 155, 166, 179, 110, 137, 115, 165 } }, + { { 102, 128, 79, 125, 128, 74, 121, 128, 61, 98, 128, 128, + 141, 164, 96, 132, 150, 90, 128, 153, 62, 100, 128, 153, + 162, 172, 120, 146, 162, 113, 142, 154, 96, 113, 138, 155, + 181, 188, 151, 170, 179, 147, 167, 181, 158, 157, 163, 176 }, + { 103, 128, 80, 116, 128, 66, 94, 128, 35, 65, 109, 128, + 134, 163, 104, 137, 154, 92, 128, 104, 58, 94, 129, 132, + 156, 173, 137, 149, 165, 104, 143, 143, 112, 101, 133, 159, + 176, 186, 134, 172, 175, 155, 169, 177, 255, 107, 137, 168 } }, + { { 125, 128, 85, 157, 128, 82, 155, 128, 42, 83, 116, 128, + 155, 174, 101, 144, 155, 93, 140, 155, 57, 92, 124, 149, + 173, 178, 114, 148, 161, 111, 145, 161, 77, 101, 131, 153, + 190, 191, 140, 169, 183, 140, 169, 179, 108, 122, 150, 171 }, + { 136, 128, 108, 163, 128, 96, 140, 128, 48, 90, 85, 128, + 144, 164, 113, 158, 179, 107, 159, 128, 43, 75, 133, 160, + 157, 184, 144, 160, 189, 154, 152, 184, 128, 124, 137, 140, + 188, 196, 148, 170, 178, 128, 177, 159, 128, 179, 135, 135 } }, + { { 133, 128, 110, 153, 128, 101, 157, 128, 49, 91, 134, 128, + 151, 168, 129, 158, 162, 112, 154, 168, 63, 99, 130, 158, + 171, 178, 128, 160, 173, 111, 155, 171, 86, 108, 143, 159, + 194, 196, 162, 177, 185, 123, 172, 181, 101, 132, 156, 178 }, + { 133, 128, 129, 144, 128, 116, 135, 128, 43, 101, 100, 128, + 140, 163, 158, 173, 205, 128, 165, 171, 128, 128, 210, 163, + 172, 184, 192, 176, 201, 183, 177, 190, 128, 192, 199, 144, + 192, 192, 1, 196, 192, 255, 171, 178, 255, 128, 171, 179 } } +}; +#if BR_NODE +const aom_prob + default_coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS] = { +#if CONFIG_CHROMA_2X2 + { { { 62, 128, 54, 116, 128, 51, 97, 128, 59, 68, 107, 128, + 119, 158, 68, 115, 131, 65, 112, 138, 34, 71, 118, 137, + 171, 184, 110, 152, 178, 105, 146, 172, 89, 111, 145, 173, + 214, 226, 201, 198, 214, 196, 193, 210, 239, 196, 186, 202 }, + { 41, 128, 58, 52, 128, 51, 61, 128, 92, 54, 48, 128, + 67, 113, 36, 55, 75, 30, 56, 72, 12, 25, 50, 79, + 94, 131, 37, 75, 108, 42, 78, 103, 5, 31, 67, 103, + 172, 192, 131, 135, 167, 129, 136, 165, 149, 144, 120, 149 }, + { 35, 128, 74, 50, 128, 63, 59, 128, 87, 74, 38, 128, + 32, 53, 23, 34, 50, 18, 30, 41, 15, 13, 18, 18, + 52, 74, 18, 29, 36, 18, 31, 47, 51, 9, 15, 27, + 96, 134, 85, 70, 93, 96, 79, 100, 108, 100, 55, 65 } }, + { { 52, 128, 35, 79, 128, 29, 66, 128, 12, 30, 57, 128, + 113, 156, 64, 107, 172, 54, 103, 145, 23, 57, 96, 110, + 165, 184, 95, 138, 166, 95, 141, 184, 55, 80, 133, 165, + 212, 222, 134, 175, 206, 158, 177, 197, 102, 61, 154, 190 }, + { 36, 128, 18, 26, 128, 15, 29, 128, 4, 6, 30, 128, + 63, 113, 25, 44, 66, 22, 40, 67, 9, 14, 34, 55, + 90, 125, 26, 66, 82, 29, 73, 88, 1, 26, 34, 67, + 158, 179, 70, 121, 134, 69, 111, 129, 1, 85, 54, 105 }, + { 24, 128, 8, 31, 128, 15, 16, 128, 1, 1, 1, 128, + 32, 39, 16, 18, 43, 5, 17, 13, 1, 1, 22, 1, + 37, 65, 26, 20, 28, 16, 15, 24, 128, 1, 1, 1, + 83, 107, 57, 56, 74, 34, 29, 73, 128, 1, 37, 47 } } }, +#endif + { { { 62, 128, 54, 116, 128, 51, 97, 128, 59, 68, 107, 128, + 119, 158, 68, 115, 131, 65, 112, 138, 34, 71, 118, 137, + 171, 184, 110, 152, 178, 105, 146, 172, 89, 111, 145, 173, + 214, 226, 201, 198, 214, 196, 193, 210, 239, 196, 186, 202 }, + { 41, 128, 58, 52, 128, 51, 61, 128, 92, 54, 48, 128, + 67, 113, 36, 55, 75, 30, 56, 72, 12, 25, 50, 79, + 94, 131, 37, 75, 108, 42, 78, 103, 5, 31, 67, 103, + 172, 192, 131, 135, 167, 129, 136, 165, 149, 144, 120, 149 }, + { 35, 128, 74, 50, 128, 63, 59, 128, 87, 74, 38, 128, + 32, 53, 23, 34, 50, 18, 30, 41, 15, 13, 18, 18, + 52, 74, 18, 29, 36, 18, 31, 47, 51, 9, 15, 27, + 96, 134, 85, 70, 93, 96, 79, 100, 108, 100, 55, 65 } }, + { { 52, 128, 35, 79, 128, 29, 66, 128, 12, 30, 57, 128, + 113, 156, 64, 107, 172, 54, 103, 145, 23, 57, 96, 110, + 165, 184, 95, 138, 166, 95, 141, 184, 55, 80, 133, 165, + 212, 222, 134, 175, 206, 158, 177, 197, 102, 61, 154, 190 }, + { 36, 128, 18, 26, 128, 15, 29, 128, 4, 6, 30, 128, + 63, 113, 25, 44, 66, 22, 40, 67, 9, 14, 34, 55, + 90, 125, 26, 66, 82, 29, 73, 88, 1, 26, 34, 67, + 158, 179, 70, 121, 134, 69, 111, 129, 1, 85, 54, 105 }, + { 24, 128, 8, 31, 128, 15, 16, 128, 1, 1, 1, 128, + 32, 39, 16, 18, 43, 5, 17, 13, 1, 1, 22, 1, + 37, 65, 26, 20, 28, 16, 15, 24, 128, 1, 1, 1, + 83, 107, 57, 56, 74, 34, 29, 73, 128, 1, 37, 47 } } }, + { { { 72, 128, 45, 113, 128, 38, 100, 128, 26, 63, 112, 128, + 134, 177, 65, 121, 148, 57, 111, 143, 27, 68, 116, 152, + 181, 198, 98, 148, 173, 84, 136, 168, 53, 89, 134, 170, + 218, 230, 173, 194, 216, 160, 188, 213, 199, 177, 183, 204 }, + { 54, 128, 34, 55, 128, 32, 53, 128, 66, 45, 54, 128, + 81, 128, 33, 59, 102, 26, 55, 80, 7, 23, 49, 91, + 116, 145, 36, 79, 107, 35, 73, 102, 12, 28, 57, 95, + 170, 201, 102, 133, 173, 105, 127, 173, 166, 132, 114, 149 }, + { 40, 128, 25, 30, 128, 21, 31, 128, 24, 17, 24, 128, + 51, 67, 19, 28, 40, 17, 25, 42, 15, 13, 19, 19, + 61, 77, 19, 30, 48, 13, 33, 50, 11, 15, 21, 30, + 103, 147, 37, 69, 111, 37, 66, 105, 18, 18, 36, 76 } }, + { { 74, 128, 42, 99, 128, 32, 57, 128, 9, 28, 76, 128, + 115, 187, 70, 118, 120, 52, 109, 128, 19, 60, 93, 100, + 178, 197, 119, 147, 179, 92, 137, 178, 37, 87, 110, 158, + 216, 227, 169, 186, 201, 128, 178, 204, 1, 96, 155, 217 }, + { 59, 128, 26, 34, 128, 11, 20, 128, 7, 8, 24, 128, + 73, 125, 38, 74, 96, 23, 61, 79, 15, 9, 23, 110, + 96, 151, 49, 79, 164, 22, 70, 65, 1, 1, 9, 69, + 156, 196, 73, 105, 181, 17, 126, 155, 128, 1, 90, 111 }, + { 42, 128, 10, 11, 128, 13, 1, 128, 1, 1, 1, 128, + 55, 63, 13, 17, 85, 1, 16, 64, 1, 1, 1, 1, + 62, 58, 32, 21, 53, 1, 37, 91, 128, 128, 1, 1, + 81, 133, 51, 48, 79, 1, 25, 81, 128, 128, 1, 54 } } }, + { { { 103, 128, 52, 163, 128, 46, 155, 128, 12, 45, 97, 128, + 162, 196, 69, 140, 170, 60, 130, 158, 21, 58, 109, 150, + 205, 214, 93, 149, 178, 79, 143, 179, 38, 71, 120, 159, + 231, 240, 150, 192, 218, 140, 188, 220, 84, 112, 159, 196 }, + { 93, 128, 42, 143, 128, 41, 132, 128, 6, 15, 40, 128, + 113, 172, 39, 99, 113, 33, 91, 94, 5, 15, 42, 83, + 148, 172, 37, 91, 130, 28, 81, 121, 9, 20, 47, 87, + 201, 223, 75, 139, 183, 77, 132, 176, 23, 41, 82, 147 }, + { 92, 128, 45, 123, 128, 28, 88, 128, 1, 8, 20, 128, + 85, 94, 39, 95, 83, 33, 81, 61, 4, 5, 17, 25, + 84, 109, 17, 59, 76, 11, 46, 62, 1, 4, 13, 35, + 139, 184, 25, 86, 129, 25, 71, 123, 26, 13, 31, 84 } }, + { { 123, 128, 82, 169, 128, 62, 139, 128, 1, 28, 77, 128, + 139, 167, 92, 170, 146, 76, 149, 255, 19, 68, 160, 73, + 190, 209, 171, 165, 218, 57, 152, 209, 128, 61, 122, 164, + 237, 240, 146, 210, 227, 128, 224, 220, 128, 128, 196, 199 }, + { 130, 128, 52, 141, 128, 32, 101, 128, 128, 1, 85, 128, + 94, 155, 71, 121, 255, 30, 116, 85, 1, 8, 58, 255, + 105, 169, 110, 101, 132, 1, 77, 142, 128, 1, 54, 96, + 166, 214, 224, 154, 198, 255, 153, 230, 128, 85, 100, 146 }, + { 103, 128, 26, 83, 128, 20, 47, 128, 128, 128, 1, 128, + 91, 90, 19, 76, 128, 1, 42, 1, 128, 255, 64, 128, + 74, 77, 1, 72, 68, 128, 13, 77, 128, 128, 64, 1, + 71, 147, 37, 99, 171, 1, 104, 151, 128, 1, 1, 96 } } }, + { { { 113, 128, 79, 165, 128, 69, 149, 128, 14, 55, 116, 128, + 163, 202, 104, 169, 205, 82, 159, 180, 22, 64, 121, 165, + 207, 216, 113, 177, 215, 95, 166, 195, 35, 77, 132, 179, + 241, 244, 173, 207, 233, 128, 202, 227, 92, 121, 169, 209 }, + { 114, 128, 67, 136, 128, 54, 132, 128, 6, 26, 62, 128, + 85, 129, 85, 146, 173, 64, 129, 140, 7, 19, 65, 92, + 139, 169, 42, 147, 186, 40, 129, 170, 18, 18, 65, 117, + 213, 230, 74, 172, 213, 69, 165, 196, 1, 40, 103, 170 }, + { 101, 128, 61, 134, 128, 52, 97, 128, 1, 14, 26, 128, + 79, 72, 71, 135, 152, 56, 114, 117, 1, 10, 24, 58, + 64, 66, 60, 133, 148, 16, 126, 123, 1, 32, 26, 56, + 143, 197, 51, 141, 176, 59, 132, 162, 128, 17, 47, 106 } }, + { { 115, 128, 112, 135, 128, 89, 130, 128, 15, 49, 89, 128, + 143, 238, 154, 203, 255, 138, 172, 255, 1, 98, 196, 255, + 185, 203, 255, 211, 255, 192, 217, 235, 128, 128, 171, 255, + 233, 233, 255, 247, 255, 1, 239, 245, 1, 128, 255, 255 }, + { 75, 128, 76, 118, 128, 35, 74, 128, 1, 13, 23, 128, + 63, 138, 114, 164, 140, 91, 128, 128, 128, 1, 138, 64, + 96, 128, 255, 175, 236, 85, 166, 209, 128, 1, 128, 146, + 196, 217, 1, 204, 206, 128, 212, 221, 128, 128, 128, 219 }, + { 49, 128, 36, 62, 128, 37, 56, 128, 128, 1, 1, 128, + 45, 37, 68, 102, 128, 90, 56, 1, 128, 128, 37, 1, + 26, 27, 128, 126, 128, 255, 63, 142, 128, 128, 1, 1, + 125, 159, 128, 173, 212, 128, 85, 189, 128, 128, 255, 171 } } } + }; +#endif // BR_NODE +#if CONFIG_CTX1D +static const aom_prob default_eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES] = { +#if CONFIG_CHROMA_2X2 + { { 128, 176, 157 }, { 128, 222, 198 } }, +#endif + { { 128, 176, 157 }, { 128, 222, 198 } }, + { { 128, 35, 56 }, { 128, 203, 225 } }, + { { 128, 55, 136 }, { 128, 230, 253 } }, + { { 128, 101, 188 }, { 128, 128, 128 } } }; +static const aom_prob default_empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES] + [EMPTY_LINE_CONTEXTS] = { +#if CONFIG_CHROMA_2X2 + { { { 128, 128, 128, 128, 128 }, + { 142, 153, 211, 205, 128 }, + { 162, 142, 203, 197, 128 } }, + { { 128, 128, 128, 128, 128 }, + { 133, 116, 178, 123, 128 }, + { 139, 109, 159, 115, 128 } } }, +#endif + { { { 128, 128, 128, 128, 128 }, + { 142, 153, 211, 205, 128 }, + { 162, 142, 203, 197, 128 } }, + { { 128, 128, 128, 128, 128 }, + { 133, 116, 178, 123, 128 }, + { 139, 109, 159, 115, 128 } } }, + { { { 128, 128, 128, 128, 128 }, + { 185, 130, 183, 204, 227 }, + { 171, 81, 177, 200, 221 } }, + { { 128, 128, 128, 128, 128 }, + { 180, 127, 175, 189, 213 }, + { 120, 74, 129, 134, 156 } } }, + { { { 128, 128, 128, 128, 128 }, + { 202, 82, 183, 214, 248 }, + { 144, 41, 163, 185, 203 } }, + { { 128, 128, 128, 128, 128 }, + { 151, 93, 171, 224, 160 }, + { 128, 51, 171, 128, 1 } } }, + { { { 128, 128, 128, 128, 128 }, + { 154, 48, 174, 210, 233 }, + { 123, 16, 148, 189, 197 } }, + { { 128, 128, 128, 128, 128 }, + { 128, 128, 128, 128, 128 }, + { 128, 128, 128, 128, 128 } } } + }; +static const aom_prob + default_hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS] = { +#if CONFIG_CHROMA_2X2 + { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 151, 173, 114, 128, 128, 128, 128, 128, 128, 162, 198, 128, + 128, 128, 128, 128, 182, 198, 109, 128, 128, 128, 128, 128 }, + { 152, 173, 119, 128, 128, 128, 128, 128, 128, 164, 193, 128, + 128, 128, 128, 128, 198, 209, 121, 128, 128, 128, 128, 128 } }, + { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 123, 143, 70, 128, 128, 128, 128, 128, 128, 127, 154, 128, + 128, 128, 128, 128, 176, 148, 36, 128, 128, 128, 128, 128 }, + { 132, 152, 73, 128, 128, 128, 128, 128, 128, 127, 159, 128, + 128, 128, 128, 128, 186, 181, 48, 128, 128, 128, 128, 128 } } }, +#endif + { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 151, 173, 114, 128, 128, 128, 128, 128, 128, 162, 198, 128, + 128, 128, 128, 128, 182, 198, 109, 128, 128, 128, 128, 128 }, + { 152, 173, 119, 128, 128, 128, 128, 128, 128, 164, 193, 128, + 128, 128, 128, 128, 198, 209, 121, 128, 128, 128, 128, 128 } }, + { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 123, 143, 70, 128, 128, 128, 128, 128, 128, 127, 154, 128, + 128, 128, 128, 128, 176, 148, 36, 128, 128, 128, 128, 128 }, + { 132, 152, 73, 128, 128, 128, 128, 128, 128, 127, 159, 128, + 128, 128, 128, 128, 186, 181, 48, 128, 128, 128, 128, 128 } } }, + { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 109, 105, 78, 44, 128, 128, 128, 128, 128, 146, 185, 221, + 128, 128, 128, 128, 199, 188, 134, 69, 128, 128, 128, 128 }, + { 124, 127, 115, 82, 128, 128, 128, 128, 128, 162, 198, 224, + 128, 128, 128, 128, 206, 214, 177, 135, 128, 128, 128, 128 } }, + { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 95, 102, 65, 14, 128, 128, 128, 128, 128, 132, 164, 199, + 128, 128, 128, 128, 162, 163, 66, 27, 128, 128, 128, 128 }, + { 83, 141, 97, 38, 128, 128, 128, 128, 128, 154, 132, 184, + 128, 128, 128, 128, 194, 218, 112, 63, 128, 128, 128, 128 } } }, + { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 117, 107, 86, 61, 51, 104, 128, 128, 128, 160, 198, 238, + 252, 251, 128, 128, 221, 223, 209, 186, 99, 81, 128, 128 }, + { 118, 122, 121, 100, 91, 97, 128, 128, 128, 168, 190, 214, + 233, 235, 128, 128, 197, 216, 177, 165, 147, 126, 128, 128 } }, + { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 109, 102, 63, 51, 255, 85, 128, 128, 128, 163, 131, 175, + 128, 128, 128, 128, 183, 102, 40, 1, 128, 128, 128, 128 }, + { 255, 255, 1, 1, 128, 1, 128, 128, 128, 1, 128, 128, + 128, 128, 128, 128, 255, 1, 128, 128, 128, 128, 128, 128 } } }, + { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 114, 108, 83, 61, 53, 28, 77, 177, 128, 161, 187, 218, + 240, 237, 228, 234, 200, 207, 167, 136, 98, 78, 183, 128 }, + { 117, 138, 116, 77, 75, 85, 26, 1, 128, 197, 162, 200, + 184, 212, 225, 236, 189, 225, 168, 124, 144, 171, 128, 128 } }, + { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } } } + }; +#endif // CONFIG_CTX1D #endif // CONFIG_LV_MAP #if CONFIG_EXT_PARTITION_TYPES @@ -312,10 +765,10 @@ static const aom_prob { 52, 79, 25, 128, 128, 85, 128, 85, 128 }, // l split, a not split { 17, 14, 12, 128, 128, 85, 128, 85, 128 }, // a/l both split // 64x64 -> 32x32 - { 222, 34, 30, 128, 128, 128, 255, 128, 255 }, // a/l both not split - { 72, 16, 44, 128, 128, 128, 255, 128, 255 }, // a split, l not split - { 58, 32, 12, 128, 128, 128, 255, 128, 255 }, // l split, a not split - { 10, 7, 6, 128, 128, 128, 255, 128, 255 }, // a/l both split + { 222, 34, 30, 128, 128, 85, 128, 85, 128 }, // a/l both not split + { 72, 16, 44, 128, 128, 85, 128, 85, 128 }, // a split, l not split + { 58, 32, 12, 128, 128, 85, 128, 85, 128 }, // l split, a not split + { 10, 7, 6, 128, 128, 85, 128, 85, 128 }, // a/l both split #if CONFIG_EXT_PARTITION // 128x128 -> 64x64 { 222, 34, 30, 128, 128, 128, 255, 128, 255 }, // a/l both not split @@ -435,7 +888,6 @@ static const aom_cdf_prob default_drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)] = { }; #endif -#if CONFIG_EXT_INTER static const aom_prob default_inter_compound_mode_probs [INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES - 1] = { { 154, 167, 233, 165, 143, 170, 167 }, // 0 = both zero mv @@ -516,7 +968,11 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 255, 1 }, { 255, 1 }, { 255, 1 }, #endif // CONFIG_EXT_PARTITION - { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 }, + { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 1 }, + { 208, 1 }, +#if CONFIG_EXT_PARTITION + { 208, 1 }, { 208, 1 } +#endif // CONFIG_EXT_PARTITION }; #elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE static const aom_prob @@ -529,7 +985,10 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 255 }, { 255 }, { 255 }, #endif // CONFIG_EXT_PARTITION - { 208 }, { 208 }, { 208 }, { 208 }, + { 208 }, { 208 }, { 208 }, { 208 }, { 255 }, { 255 }, +#if CONFIG_EXT_PARTITION + { 255 }, { 255 } +#endif // CONFIG_EXT_PARTITION }; #elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE static const aom_prob @@ -542,7 +1001,10 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 255 }, { 255 }, { 255 }, #endif // CONFIG_EXT_PARTITION - { 208 }, { 208 }, { 208 }, { 208 }, + { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, +#if CONFIG_EXT_PARTITION + { 208 }, { 208 } +#endif // CONFIG_EXT_PARTITION }; #else static const aom_prob default_compound_type_probs[BLOCK_SIZES_ALL] @@ -575,10 +1037,16 @@ static const aom_cdf_prob { AOM_ICDF(32640), AOM_ICDF(32641), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32641), AOM_ICDF(32768), 0 }, #endif // CONFIG_EXT_PARTITION - { 16384, 8192, 0, 0 }, - { 16384, 8192, 0, 0 }, - { 16384, 8192, 0, 0 }, - { 16384, 8192, 0, 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 }, // 208, 1 + { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 }, +#endif }; #elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE static const aom_cdf_prob @@ -610,6 +1078,12 @@ static const aom_cdf_prob { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION }; #elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE static const aom_cdf_prob @@ -637,14 +1111,17 @@ static const aom_cdf_prob { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, #endif // CONFIG_EXT_PARTITION - { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, // 208 + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26624), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION }; -#else -static const aom_cdf_prob default_compound_type_cdf[BLOCK_SIZES_ALL] - [CDF_SIZE(COMPOUND_TYPES)]; #endif // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE #if CONFIG_INTERINTRA @@ -681,9 +1158,12 @@ static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES_ALL] = { #endif 128, 128, 128, 194, 213, 217, 222, 224, 226, 220, 128, 128, 128, #if CONFIG_EXT_PARTITION - 208, 208, 208, + 255, 255, 255, +#endif // CONFIG_EXT_PARTITION + 208, 208, 208, 208, 255, 255, +#if CONFIG_EXT_PARTITION + 255, 255 #endif // CONFIG_EXT_PARTITION - 208, 208, 208, 208, }; #if CONFIG_NEW_MULTISYMBOL @@ -708,55 +1188,160 @@ static const aom_cdf_prob { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, #if CONFIG_EXT_PARTITION - { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, #endif // CONFIG_EXT_PARTITION { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION }; #endif // CONFIG_NEW_MULTISYMBOL #endif // CONFIG_INTERINTRA -#endif // CONFIG_EXT_INTER #if CONFIG_NCOBMC_ADAPT_WEIGHT +#ifdef TWO_MODE const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)] = { - -NO_OVERLAP, 2, -NCOBMC_MODE_1, 4, - -NCOBMC_MODE_2, 6, -NCOBMC_MODE_3, 8, - -NCOBMC_MODE_4, 10, -NCOBMC_MODE_5, 12, - -NCOBMC_MODE_6, 14, -NCOBMC_MODE_7, -NCOBMC_MODE_8 + -NCOBMC_MODE_0, -NCOBMC_MODE_1 }; +#else +const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)] = { + -NCOBMC_MODE_0, 2, + -NCOBMC_MODE_1, 4, + -NCOBMC_MODE_2, 6, + -NCOBMC_MODE_3, 8, + -NCOBMC_MODE_4, 10, + -NCOBMC_MODE_5, 12, + -NCOBMC_MODE_6, -NCOBMC_MODE_7 +}; +#endif // TWO_MODE // TODO(weitinglin): find default prob +// right now setting the first mode with probability 1/255, +// the last eight modes with equal probabilities static const aom_prob default_ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1] = { - { 23, 37, 37, 38, 65, 71, 81, 86 }, // 8x8 - { 28, 32, 37, 43, 51, 64, 85, 128 }, // 16X16 equal prob - { 86, 22, 32, 25, 10, 40, 97, 65 }, // 32X32 - { 28, 32, 37, 43, 51, 64, 85, 128 } // 64X64 equal prob +#ifdef TWO_MODE + { 127 }, { 127 }, { 127 }, { 127 } +#else + { 32, 36, 43, 51, 64, 85, 128 }, // 8x8 + { 32, 36, 43, 51, 64, 85, 128 }, // 16X16 + { 32, 36, 43, 51, 64, 85, 128 }, // 32X32 + { 32, 36, 43, 51, 64, 85, 128 } // 64X64 +#endif // TWO_MODE }; static const aom_cdf_prob default_ncobmc_mode_cdf[ADAPT_OVERLAP_BLOCKS][CDF_SIZE(MAX_NCOBMC_MODES)] = - { { AOM_ICDF(127), AOM_ICDF(4207), AOM_ICDF(8287), AOM_ICDF(12367), - AOM_ICDF(16447), AOM_ICDF(20527), AOM_ICDF(24607), AOM_ICDF(28687), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(127), AOM_ICDF(4207), AOM_ICDF(8287), AOM_ICDF(12367), - AOM_ICDF(16447), AOM_ICDF(20527), AOM_ICDF(24607), AOM_ICDF(28687), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(127), AOM_ICDF(4207), AOM_ICDF(8287), AOM_ICDF(12367), - AOM_ICDF(16447), AOM_ICDF(20527), AOM_ICDF(24607), AOM_ICDF(28687), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(127), AOM_ICDF(4207), AOM_ICDF(8287), AOM_ICDF(12367), - AOM_ICDF(16447), AOM_ICDF(20527), AOM_ICDF(24607), AOM_ICDF(28687), - AOM_ICDF(32768), 0 } }; +#ifdef TWO_MODE + { { AOM_ICDF(16256), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16256), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16256), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16256), AOM_ICDF(32768), 0 } }; +#else + { { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384), + AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384), + AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384), + AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384), + AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768), + 0 } }; +#endif // TWO_MODEE #endif // CONFIG_NCOBMC_ADAPT_WEIGHT - // Change this section appropriately once warped motion is supported #if CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION -#if !CONFIG_NCOBMC_ADAPT_WEIGHT +#if CONFIG_NCOBMC_ADAPT_WEIGHT +const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { + -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT, +}; +static const aom_prob + default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { 255, 255 }, + { 255, 255 }, + { 255, 255 }, +#endif + { 255, 255 }, + { 255, 255 }, + { 255, 255 }, + /** Only these nine block sizes allow ncobmc_adapt_weight **/ + { 45, 207 }, + { 42, 211 }, + { 34, 207 }, + { 181, 123 }, + { 129, 141 }, + { 15, 209 }, + { 231, 122 }, + { 195, 190 }, + { 168, 190 }, + /** ----------------------------------------------------- **/ + { 244, 255 }, +#if CONFIG_EXT_PARTITION + { 252, 255 }, + { 252, 255 }, + { 252, 255 }, +#endif // CONFIG_EXT_PARTITION + { 255, 200 }, + { 255, 200 }, + { 255, 200 }, + { 255, 200 }, +#if CONFIG_EXT_PARTITION + { 252, 255 }, + { 252, 200 }, + { 252, 200 }, +#endif // CONFIG_EXT_PARTITION + }; +static const aom_cdf_prob + default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, +#endif + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 }, + /** Only these seven block sizes allow ncobmc_adapt_weight **/ + { AOM_ICDF(5702), AOM_ICDF(27555), AOM_ICDF(32768), 0 }, + { AOM_ICDF(5408), AOM_ICDF(27964), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4330), AOM_ICDF(27298), AOM_ICDF(32768), 0 }, + { AOM_ICDF(23107), AOM_ICDF(27760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16490), AOM_ICDF(25461), AOM_ICDF(32768), 0 }, + { AOM_ICDF(1959), AOM_ICDF(27153), AOM_ICDF(32768), 0 }, + { AOM_ICDF(29530), AOM_ICDF(31073), AOM_ICDF(32768), 0 }, + { AOM_ICDF(25057), AOM_ICDF(30840), AOM_ICDF(32768), 0 }, + { AOM_ICDF(21588), AOM_ICDF(29940), AOM_ICDF(32768), 0 }, + /** ----------------------------------------------------- **/ + { AOM_ICDF(244 * 128), AOM_ICDF(32768), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 }, +#endif + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 } +#if CONFIG_EXT_PARTITION + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, +#endif + }; +#else // CONFIG_NCOBMC_ADAPT_WEIGHT const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { -SIMPLE_TRANSLATION, -OBMC_CAUSAL }; @@ -771,7 +1356,10 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 252 }, { 252 }, { 252 }, #endif // CONFIG_EXT_PARTITION - { 208 }, { 208 }, { 208 }, { 208 }, + { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, +#if CONFIG_EXT_PARTITION + { 208 }, { 208 } +#endif // CONFIG_EXT_PARTITION }; static const aom_cdf_prob @@ -803,62 +1391,14 @@ static const aom_cdf_prob { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, - }; - -#else -// TODO(weitinglin): The default probability is copied from warped motion right -// now as a place holder. It needs to be fined tuned after -// NCOBMC_ADAPT_WEIGHT is actually implemented. Also needs to -// change this section appropriately once warped motion is -// supported. -const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { - -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT, -}; -static const aom_prob - default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = { -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - { 255, 200 }, { 255, 200 }, { 255, 200 }, -#endif - { 255, 200 }, { 255, 200 }, { 255, 200 }, { 151, 200 }, { 153, 200 }, - { 144, 200 }, { 178, 200 }, { 165, 200 }, { 160, 200 }, { 207, 200 }, - { 195, 200 }, { 168, 200 }, { 244, 200 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, #if CONFIG_EXT_PARTITION - { 252, 200 }, { 252, 200 }, { 252, 200 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, #endif // CONFIG_EXT_PARTITION - { 255, 200 }, { 255, 200 }, { 255, 200 }, { 255, 200 }, - }; -static const aom_cdf_prob - default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = { -#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, -#endif - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7936), AOM_ICDF(19091), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4991), AOM_ICDF(19205), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4992), AOM_ICDF(19314), AOM_ICDF(32768), 0 }, - { AOM_ICDF(15104), AOM_ICDF(21590), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9855), AOM_ICDF(21043), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12800), AOM_ICDF(22238), AOM_ICDF(32768), 0 }, - { AOM_ICDF(24320), AOM_ICDF(26498), AOM_ICDF(32768), 0 }, - { AOM_ICDF(26496), AOM_ICDF(28995), AOM_ICDF(32768), 0 }, - { AOM_ICDF(25216), AOM_ICDF(28166), AOM_ICDF(32768), 0 }, - { AOM_ICDF(30592), AOM_ICDF(31238), AOM_ICDF(32768), 0 }, -#if CONFIG_EXT_PARTITION - { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 }, -#endif - { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, }; #endif // CONFIG_NCOBMC_ADAPT_WEIGHT - #elif !CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { @@ -875,7 +1415,10 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 252 }, { 252 }, { 252 }, #endif // CONFIG_EXT_PARTITION - { 208 }, { 208 }, { 208 }, { 208 }, + { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, +#if CONFIG_EXT_PARTITION + { 252 }, { 252 } +#endif // CONFIG_EXT_PARTITION }; static const aom_cdf_prob @@ -907,10 +1450,122 @@ static const aom_cdf_prob { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION }; #elif CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION +#if CONFIG_NCOBMC_ADAPT_WEIGHT +const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { + -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, 4, -NCOBMC_ADAPT_WEIGHT, -WARPED_CAUSAL +}; +static const aom_prob default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - + 1] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { 128, 128, 255 }, { 128, 128, 128 }, { 128, 128, 128 }, +#endif + { 128, 128, 128 }, { 128, 128, 128 }, { 128, 128, 128 }, { 62, 115, 128 }, + { 39, 131, 128 }, { 39, 132, 128 }, { 118, 94, 128 }, { 77, 125, 128 }, + { 100, 121, 128 }, { 190, 66, 128 }, { 207, 102, 128 }, { 197, 100, 128 }, + { 239, 76, 128 }, +#if CONFIG_EXT_PARTITION + { 252, 200, 128 }, { 252, 200, 128 }, { 252, 200, 128 }, +#endif // CONFIG_EXT_PARTITION + { 208, 200, 128 }, { 208, 200, 128 }, { 208, 200, 128 }, { 208, 200, 128 } +}; +static const aom_cdf_prob + default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#endif + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + /** Only these nine block sizes allow ncobmc_adapt_weight **/ + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + { AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 }, + /***********************************************************/ + { AOM_ICDF(30592), AOM_ICDF(31238), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#endif + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32767), AOM_ICDF(32768), 0 } + }; + +const aom_tree_index av1_ncobmc_tree[TREE_SIZE(OBMC_FAMILY_MODES)] = { + -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT +}; + +static const aom_prob + default_ncobmc_prob[BLOCK_SIZES_ALL][OBMC_FAMILY_MODES - 1] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { 128, 255 }, { 128, 255 }, { 128, 255 }, +#endif + { 128, 255 }, { 128, 255 }, { 128, 255 }, { 45, 255 }, { 79, 255 }, + { 75, 255 }, { 130, 255 }, { 141, 255 }, { 144, 255 }, { 208, 255 }, + { 201, 255 }, { 186, 255 }, { 231, 255 }, +#if CONFIG_EXT_PARTITION + { 252, 255 }, { 252, 255 }, { 252, 255 }, +#endif // CONFIG_EXT_PARTITION + { 208, 255 }, { 208, 255 }, { 208, 255 }, { 208, 255 } + }; + +static const aom_cdf_prob + default_ncobmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(OBMC_FAMILY_MODES)] = { +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#endif + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + /** Only these nine block sizes allow ncobmc_adapt_weight **/ + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10922), AOM_ICDF(21845), AOM_ICDF(32768), 0 }, + /***********************************************************/ + { AOM_ICDF(231 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(252 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(252 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(252 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32767), AOM_ICDF(32768), 0 } + }; +#else const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -WARPED_CAUSAL, }; @@ -926,7 +1581,11 @@ static const aom_prob #if CONFIG_EXT_PARTITION { 252, 200 }, { 252, 200 }, { 252, 200 }, #endif // CONFIG_EXT_PARTITION - { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, + { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, + { 208, 200 }, +#if CONFIG_EXT_PARTITION + { 252, 200 }, { 252, 200 } +#endif // CONFIG_EXT_PARTITION }; static const aom_cdf_prob default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = { @@ -957,21 +1616,30 @@ static const aom_cdf_prob { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 }, +#endif }; - +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT // Probability for the case that only 1 additional motion mode is allowed static const aom_prob default_obmc_prob[BLOCK_SIZES_ALL] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 128, 128, 128, #endif - 128, 128, 128, 45, 79, 75, 130, 141, 144, 208, 201, 186, 231, + 128, 128, 128, 45, 79, 75, 130, 141, 144, 208, 201, 186, 231, #if CONFIG_EXT_PARTITION 252, 252, 252, #endif // CONFIG_EXT_PARTITION - 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, +#if CONFIG_EXT_PARTITION + 252, 252 +#endif // CONFIG_EXT_PARTITION }; -#if CONFIG_NEW_MULTISYMBOL +#if CONFIG_NEW_MULTISYMBOL || CONFIG_NCOBMC_ADAPT_WEIGHT static const aom_cdf_prob default_obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)] = { #if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, @@ -1000,59 +1668,46 @@ static const aom_cdf_prob default_obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)] = { { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, +#if CONFIG_EXT_PARTITION + { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 }, +#endif // CONFIG_EXT_PARTITION }; #endif // CONFIG_NEW_MULTISYMBOL #endif -#if CONFIG_DELTA_Q static const aom_prob default_delta_q_probs[DELTA_Q_PROBS] = { 220, 220, 220 }; static const aom_cdf_prob default_delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)] = { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL +static const aom_prob + default_delta_lf_multi_probs[FRAME_LF_COUNT][DELTA_LF_PROBS] = { + { 220, 220, 220 }, { 220, 220, 220 }, { 220, 220, 220 }, { 220, 220, 220 } + }; +static const aom_cdf_prob + default_delta_lf_multi_cdf[FRAME_LF_COUNT][CDF_SIZE(DELTA_LF_PROBS + 1)] = { + { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }, + { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }, + { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }, + { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 } + }; +#endif // CONFIG_LOOPFILTER_LEVEL static const aom_prob default_delta_lf_probs[DELTA_LF_PROBS] = { 220, 220, 220 }; static const aom_cdf_prob default_delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)] = { AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0 }; #endif -#endif -#if CONFIG_EXT_TX -int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES]; -int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES]; -int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES]; -int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES]; -#endif -#if CONFIG_ALT_INTRA -#if CONFIG_SMOOTH_HV -const int av1_intra_mode_ind[INTRA_MODES] = { 0, 2, 3, 6, 4, 5, 8, - 9, 7, 10, 11, 12, 1 }; -const int av1_intra_mode_inv[INTRA_MODES] = { 0, 12, 1, 2, 4, 5, 3, - 8, 6, 7, 9, 10, 11 }; -#else -const int av1_intra_mode_ind[INTRA_MODES] = { - 0, 2, 3, 6, 4, 5, 8, 9, 7, 10, 1 -}; -const int av1_intra_mode_inv[INTRA_MODES] = { - 0, 10, 1, 2, 4, 5, 3, 8, 6, 7, 9 -}; -#endif // CONFIG_SMOOTH_HV -#else -const int av1_intra_mode_ind[INTRA_MODES] = { 0, 2, 3, 6, 4, 5, 8, 9, 7, 1 }; -const int av1_intra_mode_inv[INTRA_MODES] = { 0, 9, 1, 2, 4, 5, 3, 8, 6, 7 }; -#endif // CONFIG_ALT_INTRA - -#if CONFIG_EXT_INTER /* clang-format off */ #if CONFIG_INTERINTRA const aom_tree_index av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)] = { -II_DC_PRED, 2, /* 0 = II_DC_NODE */ -#if CONFIG_ALT_INTRA -II_SMOOTH_PRED, 4, /* 1 = II_SMOOTH_PRED */ -#else - -II_TM_PRED, 4, /* 1 = II_TM_NODE */ -#endif -II_V_PRED, -II_H_PRED /* 2 = II_V_NODE */ }; #endif // CONFIG_INTERINTRA @@ -1105,7 +1760,6 @@ const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = { const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {}; #endif // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE /* clang-format on */ -#endif // CONFIG_EXT_INTER const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)] = { -PARTITION_NONE, 2, -PARTITION_HORZ, 4, -PARTITION_VERT, -PARTITION_SPLIT @@ -1144,30 +1798,16 @@ static const aom_cdf_prob #endif static const aom_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = { -#if !CONFIG_EXT_COMP_REFS - 216, 170, 131, 92, 42 -#else // CONFIG_EXT_COMP_REFS - 206, 182, 117, 104, 32 -#endif // !CONFIG_EXT_COMP_REFS + 190, 156, 91, 77, 22 }; #if CONFIG_NEW_MULTISYMBOL -static const aom_cdf_prob - default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)] = { -#if !CONFIG_EXT_COMP_REFS - { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(131 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(92 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(42 * 128), AOM_ICDF(32768), 0 } -#else // CONFIG_EXT_COMP_REFS - { AOM_ICDF(206 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(182 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(117 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(104 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(32 * 128), AOM_ICDF(32768), 0 } -#endif // !CONFIG_EXT_COMP_REFS - }; +static const aom_cdf_prob default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE( + 2)] = { { AOM_ICDF(24290), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19956), AOM_ICDF(32768), 0 }, + { AOM_ICDF(11641), AOM_ICDF(32768), 0 }, + { AOM_ICDF(9804), AOM_ICDF(32768), 0 }, + { AOM_ICDF(2842), AOM_ICDF(32768), 0 } }; #endif // CONFIG_NEW_MULTISYMBOL #if CONFIG_EXT_COMP_REFS @@ -1206,91 +1846,49 @@ static const aom_cdf_prob #if CONFIG_EXT_REFS static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1] = { -#if !CONFIG_EXT_COMP_REFS - { 33, 16, 16 }, - { 77, 74, 74 }, - { 142, 142, 142 }, - { 172, 170, 170 }, - { 238, 247, 247 } -#else // CONFIG_EXT_COMP_REFS - { 21, 7, 5 }, - { 68, 20, 16 }, - { 128, 56, 36 }, - { 197, 111, 139 }, - { 238, 131, 136 } -#endif // !CONFIG_EXT_COMP_REFS + { 28, 10, 8 }, + { 77, 27, 26 }, + { 127, 62, 56 }, + { 186, 126, 160 }, + { 236, 143, 172 } }; static const aom_prob default_comp_bwdref_p[REF_CONTEXTS][BWD_REFS - 1] = { -#if CONFIG_ALTREF2 - // TODO(zoeliu): ALTREF2 to work with EXT_COMP_REFS and NEW_MULTISYMBOL. - { 50, 50 }, - { 130, 130 }, - { 210, 210 }, - { 128, 128 }, - { 128, 128 } -#else // !CONFIG_ALTREF2 -#if !CONFIG_EXT_COMP_REFS - { 16 }, { 74 }, { 142 }, { 170 }, { 247 } -#else // CONFIG_EXT_COMP_REFS - { 7 }, { 56 }, { 29 }, { 230 }, { 220 } -#endif // CONFIG_EXT_COMP_REFS -#endif // CONFIG_ALTREF2 + { 22, 13 }, { 140, 124 }, { 241, 239 }, { 128, 128 }, { 128, 128 } }; #if CONFIG_NEW_MULTISYMBOL static const aom_cdf_prob default_comp_ref_cdf[REF_CONTEXTS][FWD_REFS - 1][CDF_SIZE(2)] = { -#if !CONFIG_EXT_COMP_REFS - { { AOM_ICDF(33 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(77 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(172 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(238 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 } } -#else // CONFIG_EXT_COMP_REFS - { { AOM_ICDF(21 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(68 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(20 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(56 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(36 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(197 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(111 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(139 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(238 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(131 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(136 * 128), AOM_ICDF(32768), 0 } } -#endif // !CONFIG_EXT_COMP_REFS + { { AOM_ICDF(3556), AOM_ICDF(32768), 0 }, + { AOM_ICDF(1217), AOM_ICDF(32768), 0 }, + { AOM_ICDF(988), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(9857), AOM_ICDF(32768), 0 }, + { AOM_ICDF(3394), AOM_ICDF(32768), 0 }, + { AOM_ICDF(3303), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(16237), AOM_ICDF(32768), 0 }, + { AOM_ICDF(7946), AOM_ICDF(32768), 0 }, + { AOM_ICDF(7195), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(23826), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16124), AOM_ICDF(32768), 0 }, + { AOM_ICDF(20536), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(30195), AOM_ICDF(32768), 0 }, + { AOM_ICDF(18344), AOM_ICDF(32768), 0 }, + { AOM_ICDF(21980), AOM_ICDF(32768), 0 } } }; static const aom_cdf_prob default_comp_bwdref_cdf[REF_CONTEXTS][BWD_REFS - 1][CDF_SIZE(2)] = { -#if !CONFIG_EXT_COMP_REFS - { { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 } } -#else // CONFIG_EXT_COMP_REFS - { { AOM_ICDF(7 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(56 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(29 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(230 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(220 * 128), AOM_ICDF(32768), 0 } } -#endif // !CONFIG_EXT_COMP_REFS + { { AOM_ICDF(2762), AOM_ICDF(32768), 0 }, + { AOM_ICDF(1614), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(17976), AOM_ICDF(32768), 0 }, + { AOM_ICDF(15912), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(30894), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30639), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 } } }; #endif // CONFIG_NEW_MULTISYMBOL @@ -1313,28 +1911,11 @@ static const aom_cdf_prob static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = { #if CONFIG_EXT_REFS -#if CONFIG_ALTREF2 - // TODO(zoeliu): ALTREF2 to work with EXT_COMP_REFS and NEW_MULTISYMBOL. - { 33, 50, 16, 16, 16, 50 }, - { 77, 130, 74, 74, 74, 130 }, - { 142, 210, 142, 142, 142, 210 }, - { 172, 128, 170, 170, 170, 128 }, - { 238, 128, 247, 247, 247, 128 } -#else // !CONFIG_ALTREF2 -#if !CONFIG_EXT_COMP_REFS - { 33, 16, 16, 16, 16 }, - { 77, 74, 74, 74, 74 }, - { 142, 142, 142, 142, 142 }, - { 172, 170, 170, 170, 170 }, - { 238, 247, 247, 247, 247 } -#else // CONFIG_EXT_COMP_REFS - { 36, 2, 28, 58, 9 }, - { 64, 22, 60, 122, 40 }, - { 153, 69, 126, 179, 71 }, - { 128, 174, 189, 216, 101 }, - { 233, 252, 228, 246, 200 } -#endif // !CONFIG_EXT_COMP_REFS -#endif // CONFIG_ALTREF2 + { 36, 16, 32, 57, 11, 14 }, + { 68, 128, 73, 128, 49, 124 }, + { 136, 236, 127, 170, 81, 238 }, + { 128, 128, 191, 211, 115, 128 }, + { 224, 128, 230, 242, 208, 128 } #else // !CONFIG_EXT_REFS { 31, 25 }, { 72, 80 }, { 147, 148 }, { 197, 191 }, { 235, 247 }, #endif // CONFIG_EXT_REFS @@ -1344,60 +1925,37 @@ static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = { static const aom_cdf_prob default_single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)] = { #if CONFIG_EXT_REFS -#if !CONFIG_EXT_COMP_REFS - { { AOM_ICDF(33 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(77 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(74 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(142 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(172 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(170 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(238 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 } } -#else // CONFIG_EXT_COMP_REFS - { { AOM_ICDF(36 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(2 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(28 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(58 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(64 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(22 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(60 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(122 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(40 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(153 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(69 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(126 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(179 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(71 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(174 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(189 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(101 * 128), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(233 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(228 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(246 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(200 * 128), AOM_ICDF(32768), 0 } } -#endif // !CONFIG_EXT_COMP_REFS -#else // CONFIG_EXT_REFS + { { AOM_ICDF(4623), AOM_ICDF(32768), 0 }, + { AOM_ICDF(2110), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4132), AOM_ICDF(32768), 0 }, + { AOM_ICDF(7309), AOM_ICDF(32768), 0 }, + { AOM_ICDF(1392), AOM_ICDF(32768), 0 }, + { AOM_ICDF(1781), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(8659), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16372), AOM_ICDF(32768), 0 }, + { AOM_ICDF(9371), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16322), AOM_ICDF(32768), 0 }, + { AOM_ICDF(6216), AOM_ICDF(32768), 0 }, + { AOM_ICDF(15834), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(17353), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30182), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16300), AOM_ICDF(32768), 0 }, + { AOM_ICDF(21702), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10365), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30486), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(24426), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26972), AOM_ICDF(32768), 0 }, + { AOM_ICDF(14760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(28634), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 }, + { AOM_ICDF(29425), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30969), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26676), AOM_ICDF(32768), 0 }, + { AOM_ICDF(32768), AOM_ICDF(32768), 0 } } +#else // !CONFIG_EXT_REFS { { AOM_ICDF(31 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(25 * 128), AOM_ICDF(32768), 0 } }, { { AOM_ICDF(72 * 128), AOM_ICDF(32768), 0 }, @@ -1412,15 +1970,14 @@ static const aom_cdf_prob }; #endif // CONFIG_NEW_MULTISYMBOL -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF // TODO(zoeliu): Default values to be further adjusted based on the collected // stats. static const aom_prob default_comp_inter_mode_p[COMP_INTER_MODE_CONTEXTS] = { 40, 110, 160, 220 }; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF -#if CONFIG_PALETTE // TODO(huisu): tune these cdfs const aom_cdf_prob default_palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)] = { @@ -1504,6 +2061,61 @@ const aom_prob av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS] = { 253, 229 }; +#if CONFIG_NEW_MULTISYMBOL +const aom_cdf_prob + default_palette_y_mode_cdf[PALETTE_BLOCK_SIZES][PALETTE_Y_MODE_CONTEXTS] + [CDF_SIZE(2)] = { + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, +#if CONFIG_EXT_PARTITION + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 180), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 100), AOM_ICDF(32768), 0 } }, +#endif // CONFIG_EXT_PARTITION + }; + +const aom_cdf_prob + default_palette_uv_mode_cdf[PALETTE_UV_MODE_CONTEXTS][CDF_SIZE(2)] = { + { AOM_ICDF(128 * 253), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 229), AOM_ICDF(32768), 0 } + }; + +#endif + const aom_cdf_prob default_palette_y_color_index_cdf [PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)] = { { @@ -1679,6 +2291,190 @@ const aom_cdf_prob default_palette_uv_color_index_cdf 0 }, } }; +#if CONFIG_MRC_TX +// TODO(sarahparker) Tune these cdfs +const aom_cdf_prob default_mrc_mask_intra_cdf + [PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)] = { + { + { AOM_ICDF(29568), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(16384), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(8832), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(28672), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(31872), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(28032), AOM_ICDF(30326), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(11647), AOM_ICDF(27405), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(4352), AOM_ICDF(30659), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(23552), AOM_ICDF(27800), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(32256), AOM_ICDF(32504), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + }, + { + { AOM_ICDF(26112), AOM_ICDF(28374), AOM_ICDF(30039), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(9472), AOM_ICDF(22576), AOM_ICDF(27712), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(6656), AOM_ICDF(26138), AOM_ICDF(29608), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(19328), AOM_ICDF(23791), AOM_ICDF(28946), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(31744), AOM_ICDF(31984), AOM_ICDF(32336), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(27904), AOM_ICDF(29215), AOM_ICDF(30075), AOM_ICDF(31190), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(9728), AOM_ICDF(22598), AOM_ICDF(26134), AOM_ICDF(29425), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(2688), AOM_ICDF(30066), AOM_ICDF(31058), AOM_ICDF(31933), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(22015), AOM_ICDF(25039), AOM_ICDF(27726), AOM_ICDF(29932), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(32383), AOM_ICDF(32482), AOM_ICDF(32554), AOM_ICDF(32660), + AOM_ICDF(32768), 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(24319), AOM_ICDF(26299), AOM_ICDF(27486), AOM_ICDF(28600), + AOM_ICDF(29804), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(7935), AOM_ICDF(18217), AOM_ICDF(21116), AOM_ICDF(25440), + AOM_ICDF(28589), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(6656), AOM_ICDF(25016), AOM_ICDF(27105), AOM_ICDF(28698), + AOM_ICDF(30399), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(19967), AOM_ICDF(24117), AOM_ICDF(26550), AOM_ICDF(28566), + AOM_ICDF(30224), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(31359), AOM_ICDF(31607), AOM_ICDF(31775), AOM_ICDF(31977), + AOM_ICDF(32258), AOM_ICDF(32768), 0, 0, 0 }, + }, + { + { AOM_ICDF(26368), AOM_ICDF(27768), AOM_ICDF(28588), AOM_ICDF(29274), + AOM_ICDF(29997), AOM_ICDF(30917), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(8960), AOM_ICDF(18260), AOM_ICDF(20810), AOM_ICDF(23986), + AOM_ICDF(26627), AOM_ICDF(28882), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(7295), AOM_ICDF(24111), AOM_ICDF(25836), AOM_ICDF(27515), + AOM_ICDF(29033), AOM_ICDF(30769), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(22016), AOM_ICDF(25208), AOM_ICDF(27305), AOM_ICDF(28159), + AOM_ICDF(29221), AOM_ICDF(30274), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(31744), AOM_ICDF(31932), AOM_ICDF(32050), AOM_ICDF(32199), + AOM_ICDF(32335), AOM_ICDF(32521), AOM_ICDF(32768), 0, 0 }, + }, + { + { AOM_ICDF(26624), AOM_ICDF(27872), AOM_ICDF(28599), AOM_ICDF(29153), + AOM_ICDF(29633), AOM_ICDF(30172), AOM_ICDF(30841), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(6655), AOM_ICDF(17569), AOM_ICDF(19587), AOM_ICDF(23345), + AOM_ICDF(25884), AOM_ICDF(28088), AOM_ICDF(29678), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(3584), AOM_ICDF(27296), AOM_ICDF(28429), AOM_ICDF(29158), + AOM_ICDF(30032), AOM_ICDF(30780), AOM_ICDF(31572), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(23551), AOM_ICDF(25855), AOM_ICDF(27070), AOM_ICDF(27893), + AOM_ICDF(28597), AOM_ICDF(29721), AOM_ICDF(30970), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(32128), AOM_ICDF(32173), AOM_ICDF(32245), AOM_ICDF(32337), + AOM_ICDF(32416), AOM_ICDF(32500), AOM_ICDF(32609), AOM_ICDF(32768), + 0 }, + }, + }; + +const aom_cdf_prob default_mrc_mask_inter_cdf + [PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][CDF_SIZE(PALETTE_COLORS)] = { + { + { AOM_ICDF(29568), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(16384), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(8832), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(28672), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + { AOM_ICDF(31872), AOM_ICDF(32768), 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(28032), AOM_ICDF(30326), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(11647), AOM_ICDF(27405), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(4352), AOM_ICDF(30659), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(23552), AOM_ICDF(27800), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + { AOM_ICDF(32256), AOM_ICDF(32504), AOM_ICDF(32768), 0, 0, 0, 0, 0, + 0 }, + }, + { + { AOM_ICDF(26112), AOM_ICDF(28374), AOM_ICDF(30039), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(9472), AOM_ICDF(22576), AOM_ICDF(27712), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(6656), AOM_ICDF(26138), AOM_ICDF(29608), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(19328), AOM_ICDF(23791), AOM_ICDF(28946), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + { AOM_ICDF(31744), AOM_ICDF(31984), AOM_ICDF(32336), AOM_ICDF(32768), + 0, 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(27904), AOM_ICDF(29215), AOM_ICDF(30075), AOM_ICDF(31190), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(9728), AOM_ICDF(22598), AOM_ICDF(26134), AOM_ICDF(29425), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(2688), AOM_ICDF(30066), AOM_ICDF(31058), AOM_ICDF(31933), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(22015), AOM_ICDF(25039), AOM_ICDF(27726), AOM_ICDF(29932), + AOM_ICDF(32768), 0, 0, 0, 0 }, + { AOM_ICDF(32383), AOM_ICDF(32482), AOM_ICDF(32554), AOM_ICDF(32660), + AOM_ICDF(32768), 0, 0, 0, 0 }, + }, + { + { AOM_ICDF(24319), AOM_ICDF(26299), AOM_ICDF(27486), AOM_ICDF(28600), + AOM_ICDF(29804), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(7935), AOM_ICDF(18217), AOM_ICDF(21116), AOM_ICDF(25440), + AOM_ICDF(28589), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(6656), AOM_ICDF(25016), AOM_ICDF(27105), AOM_ICDF(28698), + AOM_ICDF(30399), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(19967), AOM_ICDF(24117), AOM_ICDF(26550), AOM_ICDF(28566), + AOM_ICDF(30224), AOM_ICDF(32768), 0, 0, 0 }, + { AOM_ICDF(31359), AOM_ICDF(31607), AOM_ICDF(31775), AOM_ICDF(31977), + AOM_ICDF(32258), AOM_ICDF(32768), 0, 0, 0 }, + }, + { + { AOM_ICDF(26368), AOM_ICDF(27768), AOM_ICDF(28588), AOM_ICDF(29274), + AOM_ICDF(29997), AOM_ICDF(30917), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(8960), AOM_ICDF(18260), AOM_ICDF(20810), AOM_ICDF(23986), + AOM_ICDF(26627), AOM_ICDF(28882), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(7295), AOM_ICDF(24111), AOM_ICDF(25836), AOM_ICDF(27515), + AOM_ICDF(29033), AOM_ICDF(30769), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(22016), AOM_ICDF(25208), AOM_ICDF(27305), AOM_ICDF(28159), + AOM_ICDF(29221), AOM_ICDF(30274), AOM_ICDF(32768), 0, 0 }, + { AOM_ICDF(31744), AOM_ICDF(31932), AOM_ICDF(32050), AOM_ICDF(32199), + AOM_ICDF(32335), AOM_ICDF(32521), AOM_ICDF(32768), 0, 0 }, + }, + { + { AOM_ICDF(26624), AOM_ICDF(27872), AOM_ICDF(28599), AOM_ICDF(29153), + AOM_ICDF(29633), AOM_ICDF(30172), AOM_ICDF(30841), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(6655), AOM_ICDF(17569), AOM_ICDF(19587), AOM_ICDF(23345), + AOM_ICDF(25884), AOM_ICDF(28088), AOM_ICDF(29678), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(3584), AOM_ICDF(27296), AOM_ICDF(28429), AOM_ICDF(29158), + AOM_ICDF(30032), AOM_ICDF(30780), AOM_ICDF(31572), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(23551), AOM_ICDF(25855), AOM_ICDF(27070), AOM_ICDF(27893), + AOM_ICDF(28597), AOM_ICDF(29721), AOM_ICDF(30970), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(32128), AOM_ICDF(32173), AOM_ICDF(32245), AOM_ICDF(32337), + AOM_ICDF(32416), AOM_ICDF(32500), AOM_ICDF(32609), AOM_ICDF(32768), + 0 }, + }, + }; +#endif // CONFIG_MRC_TX + +#if CONFIG_INTRABC +static const aom_cdf_prob default_intrabc_cdf[CDF_SIZE(2)] = { + AOM_ICDF(192 * 128), AOM_ICDF(32768), 0, +}; +#endif // CONFIG_INTRABC #define MAX_COLOR_CONTEXT_HASH 8 // Negative values are invalid @@ -1686,59 +2482,13 @@ static const int palette_color_index_context_lookup[MAX_COLOR_CONTEXT_HASH + 1] = { -1, -1, 0, -1, -1, 4, 3, 2, 1 }; -#endif // CONFIG_PALETTE - -// The transform size is coded as an offset to the smallest transform -// block size. -const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)] = { - { - // Max tx_size is 8X8 - -0, -1, - }, - { - // Max tx_size is 16X16 - -0, 2, -1, -2, - }, - { - // Max tx_size is 32X32 - -0, 2, -1, 4, -2, -3, - }, -#if CONFIG_TX64X64 - { - // Max tx_size is 64X64 - -0, 2, -1, 4, -2, 6, -3, -4, - }, -#endif // CONFIG_TX64X64 -}; - -static const aom_prob default_tx_size_prob[MAX_TX_DEPTH][TX_SIZE_CONTEXTS] - [MAX_TX_DEPTH] = { - { - // Max tx_size is 8X8 - { 100 }, - { 66 }, - }, - { - // Max tx_size is 16X16 - { 20, 152 }, - { 15, 101 }, - }, - { - // Max tx_size is 32X32 - { 3, 136, 37 }, - { 5, 52, 13 }, - }, -#if CONFIG_TX64X64 - { - // Max tx_size is 64X64 - { 1, 64, 136, 127 }, - { 1, 32, 52, 67 }, - }, -#endif // CONFIG_TX64X64 - }; - #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) static const aom_prob default_quarter_tx_size_prob = 192; +#if CONFIG_NEW_MULTISYMBOL +static const aom_cdf_prob default_quarter_tx_size_cdf[CDF_SIZE(2)] = { + AOM_ICDF(192 * 128), AOM_ICDF(32768), 0 +}; +#endif #endif #if CONFIG_LOOP_RESTORATION @@ -1753,7 +2503,6 @@ static const aom_prob }; #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_PALETTE #define NUM_PALETTE_NEIGHBORS 3 // left, top-left and top. int av1_get_palette_color_index_context(const uint8_t *color_map, int stride, int r, int c, int palette_size, @@ -1838,15 +2587,42 @@ int av1_get_palette_color_index_context(const uint8_t *color_map, int stride, #undef NUM_PALETTE_NEIGHBORS #undef MAX_COLOR_CONTEXT_HASH -#endif // CONFIG_PALETTE - #if CONFIG_VAR_TX static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = { - 250, 231, 212, 241, 166, 66, 241, 230, 135, 243, 154, 64, 248, 161, 63, 128, +#if CONFIG_TX64X64 + 249, 240, 223, 249, 229, 177, 250, 243, 208, 226, 187, + 145, 236, 204, 150, 183, 149, 125, 181, 146, 113, 128 +#else + 250, 231, 212, 241, 166, 66, 241, 230, 135, 243, 154, 64, 248, 161, 63, 128 +#endif // CONFIG_TX64X64 }; #if CONFIG_NEW_MULTISYMBOL static const aom_cdf_prob default_txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)] = { +#if CONFIG_TX64X64 + { AOM_ICDF(249 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(240 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(223 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(249 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(229 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(177 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(250 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(243 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(226 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(187 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(145 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(236 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(204 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(150 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(183 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(149 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(125 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(181 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(146 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(113 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 } +#else { AOM_ICDF(250 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(231 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(212 * 128), AOM_ICDF(32768), 0 }, @@ -1862,10 +2638,11 @@ static const aom_cdf_prob { AOM_ICDF(248 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(161 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(63 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 } + { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, +#endif // CONFIG_TX64X64 }; #endif // CONFIG_NEW_MULTISYMBOL -#endif +#endif // CONFIG_VAR_TX static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 }; #if CONFIG_NEW_MULTISYMBOL @@ -1876,583 +2653,22 @@ static const aom_cdf_prob default_skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)] = { }; #endif -#if CONFIG_DUAL_FILTER -#if USE_EXTRA_FILTER -static const aom_prob default_switchable_interp_prob - [SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = { - { 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 }, - { 34, 16, 128 }, { 149, 160, 128 }, { 235, 192, 128 }, - { 36, 243, 48 }, { 34, 16, 128 }, { 34, 16, 128 }, - { 149, 160, 128 }, { 235, 192, 128 }, { 36, 243, 48 }, - { 34, 16, 128 }, { 34, 16, 128 }, { 149, 160, 128 }, - { 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 }, - { 34, 16, 128 }, { 149, 160, 128 }, - }; -#else // USE_EXTRA_FILTER -static const aom_prob default_switchable_interp_prob - [SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = { - { 252, 199 }, { 22, 255 }, { 4, 2 }, { 238, 146 }, - { 253, 66 }, { 24, 255 }, { 2, 1 }, { 198, 41 }, - { 250, 177 }, { 16, 255 }, { 3, 4 }, { 226, 162 }, - { 247, 38 }, { 33, 253 }, { 1, 1 }, { 136, 14 }, - }; -#endif // USE_EXTRA_FILTER -#else // CONFIG_DUAL_FILTER -static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] - [SWITCHABLE_FILTERS - 1] = { - { 235, 162 }, - { 36, 255 }, - { 34, 3 }, - { 149, 144 }, - }; -#endif // CONFIG_DUAL_FILTER - -#if CONFIG_EXT_TX -/* clang-format off */ -const aom_tree_index av1_ext_tx_inter_tree[EXT_TX_SETS_INTER] - [TREE_SIZE(TX_TYPES)] = { - { // ToDo(yaowu): remove used entry 0. - 0 - }, { - -IDTX, 2, - 4, 14, - 6, 8, - -V_DCT, -H_DCT, - 10, 12, - -V_ADST, -H_ADST, - -V_FLIPADST, -H_FLIPADST, - -DCT_DCT, 16, - 18, 24, - 20, 22, - -ADST_DCT, -DCT_ADST, - -FLIPADST_DCT, -DCT_FLIPADST, - 26, 28, - -ADST_ADST, -FLIPADST_FLIPADST, - -ADST_FLIPADST, -FLIPADST_ADST - }, { - -IDTX, 2, - 4, 6, - -V_DCT, -H_DCT, - -DCT_DCT, 8, - 10, 16, - 12, 14, - -ADST_DCT, -DCT_ADST, - -FLIPADST_DCT, -DCT_FLIPADST, - 18, 20, - -ADST_ADST, -FLIPADST_FLIPADST, - -ADST_FLIPADST, -FLIPADST_ADST - }, { - -IDTX, -DCT_DCT, - }, -#if CONFIG_MRC_TX - { - -IDTX, 2, -DCT_DCT, -MRC_DCT, - } -#endif // CONFIG_MRC_TX -}; - -const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA] - [TREE_SIZE(TX_TYPES)] = { - { // ToDo(yaowu): remove unused entry 0. - 0 - }, { - -IDTX, 2, - -DCT_DCT, 4, - 6, 8, - -V_DCT, -H_DCT, - -ADST_ADST, 10, - -ADST_DCT, -DCT_ADST, - }, { - -IDTX, 2, - -DCT_DCT, 4, - -ADST_ADST, 6, - -ADST_DCT, -DCT_ADST, - }, -#if CONFIG_MRC_TX - { - -DCT_DCT, -MRC_DCT, - } -#endif // CONFIG_MRC_TX -}; -/* clang-format on */ - -static const aom_prob - default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = { - { -// ToDo(yaowu): remove unused entry 0. -#if CONFIG_CHROMA_2X2 - { 0 }, -#endif - { 0 }, - { 0 }, - { 0 }, - { 0 }, - }, - { -#if CONFIG_CHROMA_2X2 - { 0 }, -#endif - { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, - 128 }, - { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, - 128 }, - { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, - 128 }, - { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, - 128 }, - }, - { -#if CONFIG_CHROMA_2X2 - { 0 }, -#endif - { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, - { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, - { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, - { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, - }, - { -#if CONFIG_CHROMA_2X2 - { 0 }, -#endif - { 12 }, - { 12 }, - { 12 }, - { 12 }, - }, -#if CONFIG_MRC_TX - { -#if CONFIG_CHROMA_2X2 - { 0 }, -#endif - { 12, 128 }, - { 12, 128 }, - { 12, 128 }, - { 12, 128 }, - } -#endif // CONFIG_MRC_TX - }; - -// TODO(urvang): 3rd context should be tx_type instead of intra mode just like -// the baseline. -static const aom_prob - default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] - [TX_TYPES - 1] = { - { -// ToDo(yaowu): remove unused entry 0. -#if CONFIG_CHROMA_2X2 - { - { 0 }, - }, -#endif - { - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, -#if CONFIG_ALT_INTRA - { 0 }, -#if CONFIG_SMOOTH_HV - { 0 }, - { 0 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 0 }, - }, - { - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, -#if CONFIG_ALT_INTRA - { 0 }, -#if CONFIG_SMOOTH_HV - { 0 }, - { 0 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 0 }, - }, - { - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, -#if CONFIG_ALT_INTRA - { 0 }, +#if CONFIG_LGT_FROM_PRED +static const aom_prob default_intra_lgt_prob[LGT_SIZES][INTRA_MODES] = { + { 255, 208, 208, 180, 230, 208, 194, 214, 220, 255, #if CONFIG_SMOOTH_HV - { 0 }, - { 0 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 0 }, - }, - { - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, -#if CONFIG_ALT_INTRA - { 0 }, -#if CONFIG_SMOOTH_HV - { 0 }, - { 0 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 0 }, - }, - }, - { -#if CONFIG_CHROMA_2X2 - { - { 0 }, - }, -#endif - { - { 8, 224, 32, 128, 64, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 9, 200, 32, 128, 64, 128 }, - { 8, 8, 32, 128, 224, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 10, 23, 32, 128, 80, 176 }, - { 10, 23, 32, 128, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 32, 128, 16, 64 }, - { 10, 32, 32, 128, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, - }, - { - { 8, 224, 32, 128, 64, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 9, 200, 32, 128, 64, 128 }, - { 8, 8, 32, 128, 224, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 10, 23, 32, 128, 80, 176 }, - { 10, 23, 32, 128, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 32, 128, 16, 64 }, - { 10, 32, 32, 128, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, - }, - { - { 8, 224, 32, 128, 64, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 9, 200, 32, 128, 64, 128 }, - { 8, 8, 32, 128, 224, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 10, 23, 32, 128, 80, 176 }, - { 10, 23, 32, 128, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 32, 128, 16, 64 }, - { 10, 32, 32, 128, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, - }, - { - { 8, 224, 32, 128, 64, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 9, 200, 32, 128, 64, 128 }, - { 8, 8, 32, 128, 224, 128 }, - { 10, 32, 32, 128, 16, 192 }, - { 10, 32, 32, 128, 16, 64 }, - { 10, 23, 32, 128, 80, 176 }, - { 10, 23, 32, 128, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 32, 128, 16, 64 }, - { 10, 32, 32, 128, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 32, 128, 16, 64 }, - }, - }, - { -#if CONFIG_CHROMA_2X2 - { - { 0 }, - }, -#endif - { - { 8, 224, 64, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 9, 200, 64, 128 }, - { 8, 8, 224, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 10, 23, 80, 176 }, - { 10, 23, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 16, 64 }, - { 10, 32, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, - }, - { - { 8, 224, 64, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 9, 200, 64, 128 }, - { 8, 8, 224, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 10, 23, 80, 176 }, - { 10, 23, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 16, 64 }, - { 10, 32, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, - }, - { - { 8, 224, 64, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 9, 200, 64, 128 }, - { 8, 8, 224, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 10, 23, 80, 176 }, - { 10, 23, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 16, 64 }, - { 10, 32, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, - }, - { - { 8, 224, 64, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 9, 200, 64, 128 }, - { 8, 8, 224, 128 }, - { 10, 32, 16, 192 }, - { 10, 32, 16, 64 }, - { 10, 23, 80, 176 }, - { 10, 23, 80, 176 }, -#if CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, -#if CONFIG_SMOOTH_HV - { 10, 32, 16, 64 }, - { 10, 32, 16, 64 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 10, 32, 16, 64 }, - }, - }, -#if CONFIG_MRC_TX - { -// ToDo(yaowu): remove unused entry 0. -#if CONFIG_CHROMA_2X2 - { - { 0 }, - }, + 220, 220, #endif - { - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, -#if CONFIG_ALT_INTRA - { 128 }, -#if CONFIG_SMOOTH_HV - { 128 }, - { 128 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 128 }, - }, - { - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, -#if CONFIG_ALT_INTRA - { 128 }, -#if CONFIG_SMOOTH_HV - { 128 }, - { 128 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 128 }, - }, - { - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, -#if CONFIG_ALT_INTRA - { 128 }, + 230 }, + { 255, 192, 216, 180, 180, 180, 180, 200, 200, 255, #if CONFIG_SMOOTH_HV - { 128 }, - { 128 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 128 }, - }, - { - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, - { 128 }, -#if CONFIG_ALT_INTRA - { 128 }, -#if CONFIG_SMOOTH_HV - { 128 }, - { 128 }, -#endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA - { 128 }, - }, - }, - -#endif // CONFIG_MRC_TX - }; -#else // !CONFIG_EXT_TX - -/* clang-format off */ -#if CONFIG_MRC_TX -const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)] = { - -DCT_DCT, 2, - -MRC_DCT, 4, - -ADST_ADST, 6, - -ADST_DCT, -DCT_ADST -}; -#else -const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)] = { - -DCT_DCT, 2, - -ADST_ADST, 4, - -ADST_DCT, -DCT_ADST -}; -#endif // CONFIG_MRC_TX -/* clang-format on */ - -int av1_ext_tx_ind[TX_TYPES]; -int av1_ext_tx_inv[TX_TYPES]; - -#if CONFIG_MRC_TX -static const aom_prob default_intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES] - [TX_TYPES - 1] = { -#if CONFIG_CHROMA_2X2 - { { 240, 1, 85, 128 }, - { 4, 1, 1, 248 }, - { 4, 1, 1, 8 }, - { 4, 1, 248, 128 }, - { 4, 1, 248, 128 } }, + 220, 220, #endif - { { 240, 1, 85, 128 }, - { 4, 1, 1, 248 }, - { 4, 1, 1, 8 }, - { 4, 1, 248, 128 }, - { 4, 1, 248, 128 } }, - { { 244, 1, 85, 128 }, - { 8, 1, 2, 248 }, - { 8, 1, 2, 8 }, - { 8, 1, 248, 128 }, - { 4, 1, 248, 128 } }, - { { 248, 128, 85, 128 }, - { 16, 128, 4, 248 }, - { 16, 128, 4, 8 }, - { 16, 128, 248, 128 }, - { 4, 1, 248, 128 } }, - }; - -static const aom_prob default_inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1] = { -#if CONFIG_CHROMA_2X2 - { 160, 1, 85, 128 }, -#endif - { 160, 1, 85, 128 }, - { 176, 1, 85, 128 }, - { 192, 128, 85, 128 }, + 222 }, }; -#else -static const aom_prob - default_intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES][TX_TYPES - 1] = { -#if CONFIG_CHROMA_2X2 - { { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } }, -#endif - { { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } }, - { { 244, 85, 128 }, { 8, 2, 248 }, { 8, 2, 8 }, { 8, 248, 128 } }, - { { 248, 85, 128 }, { 16, 4, 248 }, { 16, 4, 8 }, { 16, 248, 128 } }, - }; -static const aom_prob default_inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1] = { -#if CONFIG_CHROMA_2X2 - { 160, 85, 128 }, -#endif - { 160, 85, 128 }, - { 176, 85, 128 }, - { 192, 85, 128 }, -}; -#endif // CONFIG_MRC_TX -#endif // CONFIG_EXT_TX +static const aom_prob default_inter_lgt_prob[LGT_SIZES] = { 230, 230 }; +#endif // CONFIG_LGT_FROM_PRED #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP static const aom_prob @@ -2508,32 +2724,31 @@ static const aom_cdf_prob }; #endif // clang-format on - #if CONFIG_DUAL_FILTER #if USE_EXTRA_FILTER static const aom_cdf_prob default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE( SWITCHABLE_FILTERS)] = { - { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }, - { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }, - { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }, - { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 } + { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 }, + { AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 }, }; #else // USE_EXTRA_FILTER static const aom_cdf_prob @@ -2591,188 +2806,258 @@ static const aom_cdf_prob #endif }; -#if CONFIG_ALT_INTRA #if CONFIG_SMOOTH_HV static const aom_cdf_prob default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = { - { AOM_ICDF(7168), AOM_ICDF(8468), AOM_ICDF(11980), AOM_ICDF(15213), - AOM_ICDF(18579), AOM_ICDF(21075), AOM_ICDF(24090), AOM_ICDF(25954), - AOM_ICDF(27870), AOM_ICDF(29439), AOM_ICDF(31051), AOM_ICDF(31863), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(11776), AOM_ICDF(21616), AOM_ICDF(23663), AOM_ICDF(25147), - AOM_ICDF(26060), AOM_ICDF(26828), AOM_ICDF(27246), AOM_ICDF(28066), - AOM_ICDF(28654), AOM_ICDF(29474), AOM_ICDF(31353), AOM_ICDF(32038), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(14720), AOM_ICDF(21911), AOM_ICDF(23650), AOM_ICDF(25282), - AOM_ICDF(25740), AOM_ICDF(26108), AOM_ICDF(26316), AOM_ICDF(26896), - AOM_ICDF(27194), AOM_ICDF(27695), AOM_ICDF(30113), AOM_ICDF(31254), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(18944), AOM_ICDF(27422), AOM_ICDF(28403), AOM_ICDF(29386), - AOM_ICDF(29405), AOM_ICDF(29460), AOM_ICDF(29550), AOM_ICDF(29588), - AOM_ICDF(29600), AOM_ICDF(29637), AOM_ICDF(30542), AOM_ICDF(31298), - AOM_ICDF(32768), 0 }, + { + AOM_ICDF(7168), AOM_ICDF(10680), AOM_ICDF(13913), AOM_ICDF(16928), + AOM_ICDF(20294), AOM_ICDF(22790), AOM_ICDF(24706), AOM_ICDF(26275), + AOM_ICDF(28139), AOM_ICDF(29751), AOM_ICDF(30563), AOM_ICDF(31468), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11776), AOM_ICDF(13823), AOM_ICDF(15307), AOM_ICDF(15725), + AOM_ICDF(16638), AOM_ICDF(17406), AOM_ICDF(17994), AOM_ICDF(18814), + AOM_ICDF(19634), AOM_ICDF(21513), AOM_ICDF(22198), AOM_ICDF(22928), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(14720), AOM_ICDF(16459), AOM_ICDF(18091), AOM_ICDF(18299), + AOM_ICDF(18757), AOM_ICDF(19125), AOM_ICDF(19423), AOM_ICDF(19924), + AOM_ICDF(20504), AOM_ICDF(22922), AOM_ICDF(24063), AOM_ICDF(25577), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(18944), AOM_ICDF(19925), AOM_ICDF(20908), AOM_ICDF(20998), + AOM_ICDF(21017), AOM_ICDF(21072), AOM_ICDF(21084), AOM_ICDF(21121), + AOM_ICDF(21159), AOM_ICDF(22064), AOM_ICDF(22820), AOM_ICDF(24290), + AOM_ICDF(32768), 0, + }, }; +#if CONFIG_CFL static const aom_cdf_prob default_uv_mode_cdf[INTRA_MODES][CDF_SIZE(UV_INTRA_MODES)] = { - { AOM_ICDF(23552), AOM_ICDF(23660), AOM_ICDF(26044), AOM_ICDF(28731), - AOM_ICDF(29093), AOM_ICDF(29590), AOM_ICDF(30000), AOM_ICDF(30465), - AOM_ICDF(30825), AOM_ICDF(31478), AOM_ICDF(32088), AOM_ICDF(32401), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2944), AOM_ICDF(3294), AOM_ICDF(26781), AOM_ICDF(27903), - AOM_ICDF(28179), AOM_ICDF(29237), AOM_ICDF(29430), AOM_ICDF(30317), - AOM_ICDF(30441), AOM_ICDF(30614), AOM_ICDF(31556), AOM_ICDF(31963), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(5453), AOM_ICDF(28285), - AOM_ICDF(28641), AOM_ICDF(28927), AOM_ICDF(29092), AOM_ICDF(29279), - AOM_ICDF(30083), AOM_ICDF(31384), AOM_ICDF(32027), AOM_ICDF(32406), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(17664), AOM_ICDF(17841), AOM_ICDF(20465), AOM_ICDF(22016), - AOM_ICDF(22364), AOM_ICDF(22916), AOM_ICDF(27149), AOM_ICDF(29498), - AOM_ICDF(29766), AOM_ICDF(31091), AOM_ICDF(31871), AOM_ICDF(32260), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(16640), AOM_ICDF(16766), AOM_ICDF(18516), AOM_ICDF(20359), - AOM_ICDF(24964), AOM_ICDF(27591), AOM_ICDF(27915), AOM_ICDF(28389), - AOM_ICDF(29997), AOM_ICDF(30495), AOM_ICDF(31623), AOM_ICDF(32151), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(13952), AOM_ICDF(14173), AOM_ICDF(18168), AOM_ICDF(19139), - AOM_ICDF(21064), AOM_ICDF(30601), AOM_ICDF(30889), AOM_ICDF(31410), - AOM_ICDF(31803), AOM_ICDF(32059), AOM_ICDF(32358), AOM_ICDF(32563), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(15872), AOM_ICDF(15938), AOM_ICDF(17056), AOM_ICDF(21545), - AOM_ICDF(23947), AOM_ICDF(24667), AOM_ICDF(24920), AOM_ICDF(25196), - AOM_ICDF(30638), AOM_ICDF(31229), AOM_ICDF(31968), AOM_ICDF(32284), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(16256), AOM_ICDF(16385), AOM_ICDF(17409), AOM_ICDF(23210), - AOM_ICDF(23628), AOM_ICDF(24009), AOM_ICDF(24967), AOM_ICDF(25546), - AOM_ICDF(26054), AOM_ICDF(31037), AOM_ICDF(31875), AOM_ICDF(32335), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(14720), AOM_ICDF(14932), AOM_ICDF(19461), AOM_ICDF(20713), - AOM_ICDF(21073), AOM_ICDF(21852), AOM_ICDF(23430), AOM_ICDF(29631), - AOM_ICDF(29876), AOM_ICDF(30520), AOM_ICDF(31591), AOM_ICDF(32078), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(16768), AOM_ICDF(17018), AOM_ICDF(20217), AOM_ICDF(22624), - AOM_ICDF(23484), AOM_ICDF(23698), AOM_ICDF(24300), AOM_ICDF(25193), - AOM_ICDF(25785), AOM_ICDF(26903), AOM_ICDF(29835), AOM_ICDF(31187), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(16768), AOM_ICDF(17081), AOM_ICDF(21064), AOM_ICDF(23339), - AOM_ICDF(24047), AOM_ICDF(24264), AOM_ICDF(24829), AOM_ICDF(25759), - AOM_ICDF(26224), AOM_ICDF(27119), AOM_ICDF(29833), AOM_ICDF(31599), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(17536), AOM_ICDF(17774), AOM_ICDF(20293), AOM_ICDF(23203), - AOM_ICDF(23906), AOM_ICDF(24094), AOM_ICDF(24636), AOM_ICDF(25303), - AOM_ICDF(26003), AOM_ICDF(27271), AOM_ICDF(29912), AOM_ICDF(30927), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(17536), AOM_ICDF(18250), AOM_ICDF(23467), AOM_ICDF(27840), - AOM_ICDF(28058), AOM_ICDF(28626), AOM_ICDF(28853), AOM_ICDF(29541), - AOM_ICDF(29907), AOM_ICDF(30600), AOM_ICDF(31515), AOM_ICDF(32049), - AOM_ICDF(32768), 0 }, + { AOM_ICDF(18377), AOM_ICDF(18815), AOM_ICDF(19743), AOM_ICDF(20178), + AOM_ICDF(20560), AOM_ICDF(20889), AOM_ICDF(21359), AOM_ICDF(22098), + AOM_ICDF(22481), AOM_ICDF(24563), AOM_ICDF(25781), AOM_ICDF(26662), + AOM_ICDF(28396), AOM_ICDF(32768), 0 }, + { AOM_ICDF(5350), AOM_ICDF(16837), AOM_ICDF(17066), AOM_ICDF(17360), + AOM_ICDF(17692), AOM_ICDF(18778), AOM_ICDF(18969), AOM_ICDF(19206), + AOM_ICDF(20291), AOM_ICDF(22367), AOM_ICDF(23212), AOM_ICDF(24670), + AOM_ICDF(27912), AOM_ICDF(32768), 0 }, + { AOM_ICDF(6671), AOM_ICDF(6759), AOM_ICDF(17812), AOM_ICDF(17998), + AOM_ICDF(18260), AOM_ICDF(18384), AOM_ICDF(19408), AOM_ICDF(20667), + AOM_ICDF(20806), AOM_ICDF(22760), AOM_ICDF(24142), AOM_ICDF(24875), + AOM_ICDF(28072), AOM_ICDF(32768), 0 }, + { AOM_ICDF(7461), AOM_ICDF(8082), AOM_ICDF(8515), AOM_ICDF(15013), + AOM_ICDF(15583), AOM_ICDF(16098), AOM_ICDF(16522), AOM_ICDF(18519), + AOM_ICDF(20348), AOM_ICDF(22954), AOM_ICDF(24130), AOM_ICDF(25342), + AOM_ICDF(26548), AOM_ICDF(32768), 0 }, + { AOM_ICDF(3694), AOM_ICDF(4403), AOM_ICDF(5370), AOM_ICDF(5854), + AOM_ICDF(17841), AOM_ICDF(19639), AOM_ICDF(21625), AOM_ICDF(22224), + AOM_ICDF(22651), AOM_ICDF(24613), AOM_ICDF(25399), AOM_ICDF(26143), + AOM_ICDF(26599), AOM_ICDF(32768), 0 }, + { AOM_ICDF(3700), AOM_ICDF(5651), AOM_ICDF(6112), AOM_ICDF(6541), + AOM_ICDF(8929), AOM_ICDF(20623), AOM_ICDF(21213), AOM_ICDF(21640), + AOM_ICDF(22214), AOM_ICDF(24306), AOM_ICDF(25412), AOM_ICDF(26406), + AOM_ICDF(27249), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4649), AOM_ICDF(4947), AOM_ICDF(7128), AOM_ICDF(7432), + AOM_ICDF(9439), AOM_ICDF(9903), AOM_ICDF(21163), AOM_ICDF(21774), + AOM_ICDF(22056), AOM_ICDF(24426), AOM_ICDF(25403), AOM_ICDF(26324), + AOM_ICDF(27128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(7208), AOM_ICDF(7375), AOM_ICDF(8779), AOM_ICDF(9683), + AOM_ICDF(10072), AOM_ICDF(10284), AOM_ICDF(10796), AOM_ICDF(19786), + AOM_ICDF(20152), AOM_ICDF(22955), AOM_ICDF(24246), AOM_ICDF(25165), + AOM_ICDF(26589), AOM_ICDF(32768), 0 }, + { AOM_ICDF(5897), AOM_ICDF(7283), AOM_ICDF(7555), AOM_ICDF(8910), + AOM_ICDF(9391), AOM_ICDF(9937), AOM_ICDF(10276), AOM_ICDF(11044), + AOM_ICDF(19841), AOM_ICDF(22620), AOM_ICDF(23784), AOM_ICDF(25060), + AOM_ICDF(26418), AOM_ICDF(32768), 0 }, + { AOM_ICDF(12171), AOM_ICDF(12718), AOM_ICDF(13885), AOM_ICDF(14348), + AOM_ICDF(14925), AOM_ICDF(15394), AOM_ICDF(16108), AOM_ICDF(17075), + AOM_ICDF(17583), AOM_ICDF(21996), AOM_ICDF(23614), AOM_ICDF(25048), + AOM_ICDF(27011), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10192), AOM_ICDF(11222), AOM_ICDF(12318), AOM_ICDF(12877), + AOM_ICDF(13533), AOM_ICDF(14184), AOM_ICDF(14866), AOM_ICDF(15879), + AOM_ICDF(16650), AOM_ICDF(20419), AOM_ICDF(23265), AOM_ICDF(24295), + AOM_ICDF(26596), AOM_ICDF(32768), 0 }, + { AOM_ICDF(10776), AOM_ICDF(11387), AOM_ICDF(12899), AOM_ICDF(13471), + AOM_ICDF(14088), AOM_ICDF(14575), AOM_ICDF(15366), AOM_ICDF(16456), + AOM_ICDF(17040), AOM_ICDF(20815), AOM_ICDF(22009), AOM_ICDF(24448), + AOM_ICDF(26492), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4015), AOM_ICDF(6473), AOM_ICDF(9853), AOM_ICDF(10285), + AOM_ICDF(10655), AOM_ICDF(11032), AOM_ICDF(11431), AOM_ICDF(12199), + AOM_ICDF(12738), AOM_ICDF(14760), AOM_ICDF(16121), AOM_ICDF(17263), + AOM_ICDF(28612), AOM_ICDF(32768), 0 }, }; -#else // !CONFIG_SMOOTH_HV -static const aom_cdf_prob - default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = { - { AOM_ICDF(11264), AOM_ICDF(12608), AOM_ICDF(16309), AOM_ICDF(21086), - AOM_ICDF(23297), AOM_ICDF(24860), AOM_ICDF(27022), AOM_ICDF(28099), - AOM_ICDF(29631), AOM_ICDF(31126), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(11953), AOM_ICDF(16100), AOM_ICDF(20922), - AOM_ICDF(22756), AOM_ICDF(23913), AOM_ICDF(25435), AOM_ICDF(26724), - AOM_ICDF(28046), AOM_ICDF(29927), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(11540), AOM_ICDF(16515), AOM_ICDF(21763), - AOM_ICDF(23078), AOM_ICDF(23816), AOM_ICDF(24725), AOM_ICDF(25856), - AOM_ICDF(26720), AOM_ICDF(28208), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12288), AOM_ICDF(14448), AOM_ICDF(18026), AOM_ICDF(23346), - AOM_ICDF(23833), AOM_ICDF(24188), AOM_ICDF(24724), AOM_ICDF(25415), - AOM_ICDF(25817), AOM_ICDF(26876), AOM_ICDF(32768), 0 }, - }; - +#else static const aom_cdf_prob default_uv_mode_cdf[INTRA_MODES][CDF_SIZE(UV_INTRA_MODES)] = { - { AOM_ICDF(25472), AOM_ICDF(25558), AOM_ICDF(27783), AOM_ICDF(30779), - AOM_ICDF(30988), AOM_ICDF(31269), AOM_ICDF(31492), AOM_ICDF(31741), - AOM_ICDF(32014), AOM_ICDF(32420), AOM_ICDF(32768), 0 }, - { AOM_ICDF(2176), AOM_ICDF(2415), AOM_ICDF(28381), AOM_ICDF(29574), - AOM_ICDF(29832), AOM_ICDF(30712), AOM_ICDF(30881), AOM_ICDF(31662), - AOM_ICDF(31761), AOM_ICDF(31922), AOM_ICDF(32768), 0 }, - { AOM_ICDF(3328), AOM_ICDF(3443), AOM_ICDF(4016), AOM_ICDF(31099), - AOM_ICDF(31272), AOM_ICDF(31420), AOM_ICDF(31504), AOM_ICDF(31608), - AOM_ICDF(31916), AOM_ICDF(32598), AOM_ICDF(32768), 0 }, - { AOM_ICDF(23424), AOM_ICDF(23534), AOM_ICDF(25915), AOM_ICDF(27831), - AOM_ICDF(28058), AOM_ICDF(28431), AOM_ICDF(30142), AOM_ICDF(31209), - AOM_ICDF(31459), AOM_ICDF(32369), AOM_ICDF(32768), 0 }, - { AOM_ICDF(22784), AOM_ICDF(22862), AOM_ICDF(24255), AOM_ICDF(26287), - AOM_ICDF(28490), AOM_ICDF(29509), AOM_ICDF(29776), AOM_ICDF(30115), - AOM_ICDF(31203), AOM_ICDF(31674), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19712), AOM_ICDF(19865), AOM_ICDF(23141), AOM_ICDF(24428), - AOM_ICDF(25731), AOM_ICDF(31377), AOM_ICDF(31622), AOM_ICDF(32047), - AOM_ICDF(32458), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, - { AOM_ICDF(21376), AOM_ICDF(21421), AOM_ICDF(22130), AOM_ICDF(27688), - AOM_ICDF(28485), AOM_ICDF(28779), AOM_ICDF(28935), AOM_ICDF(29085), - AOM_ICDF(31962), AOM_ICDF(32450), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19712), AOM_ICDF(19814), AOM_ICDF(20725), AOM_ICDF(28510), - AOM_ICDF(28814), AOM_ICDF(29099), AOM_ICDF(29457), AOM_ICDF(29729), - AOM_ICDF(30133), AOM_ICDF(32408), AOM_ICDF(32768), 0 }, - { AOM_ICDF(19584), AOM_ICDF(19790), AOM_ICDF(23643), AOM_ICDF(25501), - AOM_ICDF(25913), AOM_ICDF(26673), AOM_ICDF(27578), AOM_ICDF(30923), - AOM_ICDF(31255), AOM_ICDF(31870), AOM_ICDF(32768), 0 }, - { AOM_ICDF(20864), AOM_ICDF(21004), AOM_ICDF(24129), AOM_ICDF(26308), - AOM_ICDF(27062), AOM_ICDF(27065), AOM_ICDF(27488), AOM_ICDF(28045), - AOM_ICDF(28506), AOM_ICDF(29272), AOM_ICDF(32768), 0 }, - { AOM_ICDF(23680), AOM_ICDF(23929), AOM_ICDF(27831), AOM_ICDF(30446), - AOM_ICDF(30598), AOM_ICDF(31129), AOM_ICDF(31244), AOM_ICDF(31655), - AOM_ICDF(31868), AOM_ICDF(32234), AOM_ICDF(32768), 0 }, + { + AOM_ICDF(23552), AOM_ICDF(25936), AOM_ICDF(28623), AOM_ICDF(29033), + AOM_ICDF(29395), AOM_ICDF(29892), AOM_ICDF(30252), AOM_ICDF(30905), + AOM_ICDF(31370), AOM_ICDF(31980), AOM_ICDF(32293), AOM_ICDF(32660), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(26431), AOM_ICDF(27553), AOM_ICDF(27746), + AOM_ICDF(28022), AOM_ICDF(29080), AOM_ICDF(29204), AOM_ICDF(29377), + AOM_ICDF(30264), AOM_ICDF(31206), AOM_ICDF(31613), AOM_ICDF(32418), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4352), AOM_ICDF(5120), AOM_ICDF(27952), AOM_ICDF(28117), + AOM_ICDF(28473), AOM_ICDF(28759), AOM_ICDF(29563), AOM_ICDF(30864), + AOM_ICDF(31051), AOM_ICDF(31694), AOM_ICDF(32073), AOM_ICDF(32435), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(17664), AOM_ICDF(20288), AOM_ICDF(21839), AOM_ICDF(26072), + AOM_ICDF(26420), AOM_ICDF(26972), AOM_ICDF(27240), AOM_ICDF(28565), + AOM_ICDF(30914), AOM_ICDF(31694), AOM_ICDF(32083), AOM_ICDF(32591), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(16640), AOM_ICDF(18390), AOM_ICDF(20233), AOM_ICDF(20557), + AOM_ICDF(25162), AOM_ICDF(27789), AOM_ICDF(29397), AOM_ICDF(29895), + AOM_ICDF(30369), AOM_ICDF(31497), AOM_ICDF(32025), AOM_ICDF(32642), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(13952), AOM_ICDF(17947), AOM_ICDF(18918), AOM_ICDF(19206), + AOM_ICDF(21131), AOM_ICDF(30668), AOM_ICDF(31061), AOM_ICDF(31317), + AOM_ICDF(31838), AOM_ICDF(32137), AOM_ICDF(32342), AOM_ICDF(32547), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(15872), AOM_ICDF(16990), AOM_ICDF(21479), AOM_ICDF(21732), + AOM_ICDF(24134), AOM_ICDF(24854), AOM_ICDF(30296), AOM_ICDF(30887), + AOM_ICDF(31163), AOM_ICDF(31902), AOM_ICDF(32218), AOM_ICDF(32702), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(16256), AOM_ICDF(17280), AOM_ICDF(23081), AOM_ICDF(24039), + AOM_ICDF(24457), AOM_ICDF(24838), AOM_ICDF(25346), AOM_ICDF(30329), + AOM_ICDF(30908), AOM_ICDF(31746), AOM_ICDF(32206), AOM_ICDF(32639), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(14720), AOM_ICDF(19249), AOM_ICDF(20501), AOM_ICDF(22079), + AOM_ICDF(22439), AOM_ICDF(23218), AOM_ICDF(23463), AOM_ICDF(24107), + AOM_ICDF(30308), AOM_ICDF(31379), AOM_ICDF(31866), AOM_ICDF(32556), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(16768), AOM_ICDF(19967), AOM_ICDF(22374), AOM_ICDF(22976), + AOM_ICDF(23836), AOM_ICDF(24050), AOM_ICDF(24642), AOM_ICDF(25760), + AOM_ICDF(26653), AOM_ICDF(29585), AOM_ICDF(30937), AOM_ICDF(32518), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(16768), AOM_ICDF(20751), AOM_ICDF(23026), AOM_ICDF(23591), + AOM_ICDF(24299), AOM_ICDF(24516), AOM_ICDF(24981), AOM_ICDF(25876), + AOM_ICDF(26806), AOM_ICDF(29520), AOM_ICDF(31286), AOM_ICDF(32455), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(17536), AOM_ICDF(20055), AOM_ICDF(22965), AOM_ICDF(23507), + AOM_ICDF(24210), AOM_ICDF(24398), AOM_ICDF(25098), AOM_ICDF(26366), + AOM_ICDF(27033), AOM_ICDF(29674), AOM_ICDF(30689), AOM_ICDF(32530), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(17536), AOM_ICDF(22753), AOM_ICDF(27126), AOM_ICDF(27353), + AOM_ICDF(27571), AOM_ICDF(28139), AOM_ICDF(28505), AOM_ICDF(29198), + AOM_ICDF(29886), AOM_ICDF(30801), AOM_ICDF(31335), AOM_ICDF(32054), + AOM_ICDF(32768), 0, + }, }; -#endif // CONFIG_SMOOTH_HV -#else // !CONFIG_ALT_INTRA +#endif // CONFIG_CFL +#else // !CONFIG_SMOOTH_HV static const aom_cdf_prob default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = { - { AOM_ICDF(8320), AOM_ICDF(11376), AOM_ICDF(12880), AOM_ICDF(19959), - AOM_ICDF(23072), AOM_ICDF(24067), AOM_ICDF(25461), AOM_ICDF(26917), - AOM_ICDF(29157), AOM_ICDF(32768), 0 }, - { AOM_ICDF(16896), AOM_ICDF(21112), AOM_ICDF(21932), AOM_ICDF(27852), - AOM_ICDF(28667), AOM_ICDF(28916), AOM_ICDF(29593), AOM_ICDF(30089), - AOM_ICDF(30905), AOM_ICDF(32768), 0 }, - { AOM_ICDF(22144), AOM_ICDF(25464), AOM_ICDF(26006), AOM_ICDF(30364), - AOM_ICDF(30583), AOM_ICDF(30655), AOM_ICDF(31183), AOM_ICDF(31400), - AOM_ICDF(31646), AOM_ICDF(32768), 0 }, - { AOM_ICDF(28288), AOM_ICDF(30650), AOM_ICDF(30964), AOM_ICDF(32288), - AOM_ICDF(32308), AOM_ICDF(32331), AOM_ICDF(32495), AOM_ICDF(32586), - AOM_ICDF(32607), AOM_ICDF(32768), 0 }, + { + AOM_ICDF(11264), AOM_ICDF(14965), AOM_ICDF(19742), AOM_ICDF(21904), + AOM_ICDF(24115), AOM_ICDF(25678), AOM_ICDF(27210), AOM_ICDF(28705), + AOM_ICDF(29782), AOM_ICDF(31424), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(13747), AOM_ICDF(18569), AOM_ICDF(20091), + AOM_ICDF(21925), AOM_ICDF(23082), AOM_ICDF(24404), AOM_ICDF(26285), + AOM_ICDF(27574), AOM_ICDF(30415), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9344), AOM_ICDF(14319), AOM_ICDF(19567), AOM_ICDF(20476), + AOM_ICDF(21791), AOM_ICDF(22529), AOM_ICDF(23393), AOM_ICDF(24881), + AOM_ICDF(26012), AOM_ICDF(30572), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12288), AOM_ICDF(15866), AOM_ICDF(21186), AOM_ICDF(21722), + AOM_ICDF(22209), AOM_ICDF(22564), AOM_ICDF(22966), AOM_ICDF(24025), + AOM_ICDF(24716), AOM_ICDF(30608), AOM_ICDF(32768), 0, + }, }; static const aom_cdf_prob default_uv_mode_cdf[INTRA_MODES][CDF_SIZE(UV_INTRA_MODES)] = { - { AOM_ICDF(15360), AOM_ICDF(15836), AOM_ICDF(20863), AOM_ICDF(27513), - AOM_ICDF(28269), AOM_ICDF(29048), AOM_ICDF(29455), AOM_ICDF(30154), - AOM_ICDF(31206), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6144), AOM_ICDF(7392), AOM_ICDF(22657), AOM_ICDF(25981), - AOM_ICDF(26965), AOM_ICDF(28779), AOM_ICDF(29309), AOM_ICDF(30890), - AOM_ICDF(31763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8576), AOM_ICDF(9143), AOM_ICDF(11450), AOM_ICDF(27575), - AOM_ICDF(28108), AOM_ICDF(28438), AOM_ICDF(28658), AOM_ICDF(28995), - AOM_ICDF(30410), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12416), AOM_ICDF(12814), AOM_ICDF(16244), AOM_ICDF(22057), - AOM_ICDF(23492), AOM_ICDF(24700), AOM_ICDF(26213), AOM_ICDF(27954), - AOM_ICDF(29778), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10624), AOM_ICDF(11057), AOM_ICDF(14619), AOM_ICDF(19415), - AOM_ICDF(23134), AOM_ICDF(25679), AOM_ICDF(26399), AOM_ICDF(27618), - AOM_ICDF(30676), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10240), AOM_ICDF(10680), AOM_ICDF(15684), AOM_ICDF(19118), - AOM_ICDF(21856), AOM_ICDF(27563), AOM_ICDF(28234), AOM_ICDF(29332), - AOM_ICDF(31278), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(11433), AOM_ICDF(14100), AOM_ICDF(22522), - AOM_ICDF(24365), AOM_ICDF(25330), AOM_ICDF(25737), AOM_ICDF(26341), - AOM_ICDF(30433), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10880), AOM_ICDF(11308), AOM_ICDF(13991), AOM_ICDF(23645), - AOM_ICDF(24679), AOM_ICDF(25433), AOM_ICDF(25977), AOM_ICDF(26746), - AOM_ICDF(28463), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(10483), AOM_ICDF(16054), AOM_ICDF(19959), - AOM_ICDF(21708), AOM_ICDF(23628), AOM_ICDF(24949), AOM_ICDF(28797), - AOM_ICDF(30658), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12928), AOM_ICDF(14556), AOM_ICDF(22168), AOM_ICDF(27789), - AOM_ICDF(28543), AOM_ICDF(29663), AOM_ICDF(29893), AOM_ICDF(30645), - AOM_ICDF(31682), AOM_ICDF(32768), 0 }, + { + AOM_ICDF(25472), AOM_ICDF(27697), AOM_ICDF(30693), AOM_ICDF(30916), + AOM_ICDF(31125), AOM_ICDF(31406), AOM_ICDF(31679), AOM_ICDF(32085), + AOM_ICDF(32334), AOM_ICDF(32682), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2176), AOM_ICDF(28142), AOM_ICDF(29335), AOM_ICDF(29504), + AOM_ICDF(29762), AOM_ICDF(30642), AOM_ICDF(30741), AOM_ICDF(30902), + AOM_ICDF(31683), AOM_ICDF(32529), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3328), AOM_ICDF(3901), AOM_ICDF(30984), AOM_ICDF(31068), + AOM_ICDF(31241), AOM_ICDF(31389), AOM_ICDF(31697), AOM_ICDF(32379), + AOM_ICDF(32483), AOM_ICDF(32653), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(23424), AOM_ICDF(25805), AOM_ICDF(27721), AOM_ICDF(29432), + AOM_ICDF(29659), AOM_ICDF(30032), AOM_ICDF(30282), AOM_ICDF(31192), + AOM_ICDF(32259), AOM_ICDF(32658), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(22784), AOM_ICDF(24177), AOM_ICDF(26209), AOM_ICDF(26476), + AOM_ICDF(28679), AOM_ICDF(29698), AOM_ICDF(30786), AOM_ICDF(31257), + AOM_ICDF(31596), AOM_ICDF(32690), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(19712), AOM_ICDF(22988), AOM_ICDF(24275), AOM_ICDF(24520), + AOM_ICDF(25823), AOM_ICDF(31469), AOM_ICDF(31880), AOM_ICDF(32189), + AOM_ICDF(32614), AOM_ICDF(32615), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(21376), AOM_ICDF(22085), AOM_ICDF(27643), AOM_ICDF(27799), + AOM_ICDF(28596), AOM_ICDF(28890), AOM_ICDF(31767), AOM_ICDF(32255), + AOM_ICDF(32405), AOM_ICDF(32723), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(19712), AOM_ICDF(20623), AOM_ICDF(28408), AOM_ICDF(28766), + AOM_ICDF(29070), AOM_ICDF(29355), AOM_ICDF(29759), AOM_ICDF(32034), + AOM_ICDF(32306), AOM_ICDF(32666), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(19584), AOM_ICDF(23437), AOM_ICDF(25295), AOM_ICDF(26200), + AOM_ICDF(26612), AOM_ICDF(27372), AOM_ICDF(27704), AOM_ICDF(28319), + AOM_ICDF(31664), AOM_ICDF(32562), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(20864), AOM_ICDF(23989), AOM_ICDF(26168), AOM_ICDF(26591), + AOM_ICDF(27345), AOM_ICDF(27348), AOM_ICDF(27809), AOM_ICDF(28575), + AOM_ICDF(29132), AOM_ICDF(32628), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(23680), AOM_ICDF(27582), AOM_ICDF(30197), AOM_ICDF(30312), + AOM_ICDF(30464), AOM_ICDF(30995), AOM_ICDF(31208), AOM_ICDF(31574), + AOM_ICDF(31985), AOM_ICDF(32519), AOM_ICDF(32768), 0, + }, }; -#endif // CONFIG_ALT_INTRA +#endif // CONFIG_SMOOTH_HV #if CONFIG_EXT_PARTITION_TYPES static const aom_cdf_prob @@ -2788,17 +3073,17 @@ static const aom_cdf_prob 0, 0, 0, 0, 0, 0 }, // 16x16 -> 8x8 { AOM_ICDF(22272), AOM_ICDF(23768), AOM_ICDF(25043), AOM_ICDF(29996), - AOM_ICDF(30744), AOM_ICDF(31493), AOM_ICDF(32130), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(30495), AOM_ICDF(30994), AOM_ICDF(31419), AOM_ICDF(31844), + AOM_ICDF(32343), AOM_ICDF(32768), 0 }, { AOM_ICDF(11776), AOM_ICDF(13457), AOM_ICDF(16315), AOM_ICDF(28229), - AOM_ICDF(29069), AOM_ICDF(29910), AOM_ICDF(31339), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(28789), AOM_ICDF(29349), AOM_ICDF(30302), AOM_ICDF(31255), + AOM_ICDF(31816), AOM_ICDF(32768), 0 }, { AOM_ICDF(10496), AOM_ICDF(14802), AOM_ICDF(16136), AOM_ICDF(27127), - AOM_ICDF(29280), AOM_ICDF(31434), AOM_ICDF(32101), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(28563), AOM_ICDF(29999), AOM_ICDF(30444), AOM_ICDF(30889), + AOM_ICDF(32324), AOM_ICDF(32768), 0 }, { AOM_ICDF(6784), AOM_ICDF(8763), AOM_ICDF(10440), AOM_ICDF(29110), - AOM_ICDF(30100), AOM_ICDF(31090), AOM_ICDF(31929), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(29770), AOM_ICDF(30430), AOM_ICDF(30989), AOM_ICDF(31548), + AOM_ICDF(32208), AOM_ICDF(32768), 0 }, // 32x32 -> 16x16 { AOM_ICDF(22656), AOM_ICDF(23801), AOM_ICDF(24702), AOM_ICDF(30721), AOM_ICDF(31103), AOM_ICDF(31485), AOM_ICDF(31785), AOM_ICDF(32085), @@ -2814,31 +3099,31 @@ static const aom_cdf_prob AOM_ICDF(32542), AOM_ICDF(32768), 0 }, // 64x64 -> 32x32 { AOM_ICDF(28416), AOM_ICDF(28705), AOM_ICDF(28926), AOM_ICDF(32258), - AOM_ICDF(32402), AOM_ICDF(32547), AOM_ICDF(32657), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(32354), AOM_ICDF(32450), AOM_ICDF(32523), AOM_ICDF(32596), + AOM_ICDF(32693), AOM_ICDF(32768), 0 }, { AOM_ICDF(9216), AOM_ICDF(9952), AOM_ICDF(11849), AOM_ICDF(30134), - AOM_ICDF(30502), AOM_ICDF(30870), AOM_ICDF(31819), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(30379), AOM_ICDF(30624), AOM_ICDF(31256), AOM_ICDF(31888), + AOM_ICDF(32134), AOM_ICDF(32768), 0 }, { AOM_ICDF(7424), AOM_ICDF(9008), AOM_ICDF(9528), AOM_ICDF(30664), - AOM_ICDF(31456), AOM_ICDF(32248), AOM_ICDF(32508), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(31192), AOM_ICDF(31720), AOM_ICDF(31893), AOM_ICDF(32066), + AOM_ICDF(32594), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(1710), AOM_ICDF(2069), AOM_ICDF(31978), - AOM_ICDF(32193), AOM_ICDF(32409), AOM_ICDF(32588), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(32121), AOM_ICDF(32264), AOM_ICDF(32383), AOM_ICDF(32502), + AOM_ICDF(32647), AOM_ICDF(32768), 0 }, #if CONFIG_EXT_PARTITION // 128x128 -> 64x64 { AOM_ICDF(28416), AOM_ICDF(28705), AOM_ICDF(28926), AOM_ICDF(32258), - AOM_ICDF(32402), AOM_ICDF(32547), AOM_ICDF(32548), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(32354), AOM_ICDF(32450), AOM_ICDF(32523), AOM_ICDF(32596), + AOM_ICDF(32693), AOM_ICDF(32768), 0 }, { AOM_ICDF(9216), AOM_ICDF(9952), AOM_ICDF(11849), AOM_ICDF(30134), - AOM_ICDF(30502), AOM_ICDF(30870), AOM_ICDF(30871), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(30379), AOM_ICDF(30624), AOM_ICDF(31256), AOM_ICDF(31888), + AOM_ICDF(32134), AOM_ICDF(32768), 0 }, { AOM_ICDF(7424), AOM_ICDF(9008), AOM_ICDF(9528), AOM_ICDF(30664), - AOM_ICDF(31456), AOM_ICDF(32248), AOM_ICDF(32249), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(31192), AOM_ICDF(31720), AOM_ICDF(31893), AOM_ICDF(32066), + AOM_ICDF(32594), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(1710), AOM_ICDF(2069), AOM_ICDF(31978), - AOM_ICDF(32193), AOM_ICDF(32409), AOM_ICDF(32410), AOM_ICDF(32768), 0, - 0, 0 }, + AOM_ICDF(32121), AOM_ICDF(32264), AOM_ICDF(32383), AOM_ICDF(32502), + AOM_ICDF(32647), AOM_ICDF(32768), 0 }, #endif }; #else @@ -2889,13 +3174,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { 0 }, { 0 }, { 0 }, -#if CONFIG_ALT_INTRA { 0 }, #if CONFIG_SMOOTH_HV { 0 }, { 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { 0 }, }, { @@ -2908,13 +3191,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { 0 }, { 0 }, { 0 }, -#if CONFIG_ALT_INTRA { 0 }, #if CONFIG_SMOOTH_HV { 0 }, { 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { 0 }, }, { @@ -2927,13 +3208,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { 0 }, { 0 }, { 0 }, -#if CONFIG_ALT_INTRA { 0 }, #if CONFIG_SMOOTH_HV { 0 }, { 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { 0 }, }, { @@ -2946,13 +3225,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { 0 }, { 0 }, { 0 }, -#if CONFIG_ALT_INTRA { 0 }, #if CONFIG_SMOOTH_HV { 0 }, { 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { 0 }, }, }, @@ -2978,7 +3255,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691), AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -2987,7 +3263,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, }, @@ -3012,7 +3287,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691), AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3021,7 +3295,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, }, @@ -3046,7 +3319,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691), AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3055,7 +3327,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, }, @@ -3080,7 +3351,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691), AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3089,7 +3359,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660), AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }, }, @@ -3114,7 +3383,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(26611), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3123,7 +3391,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, }, @@ -3146,7 +3413,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(26611), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3155,7 +3421,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, }, @@ -3178,7 +3443,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(26611), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3187,7 +3451,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, }, @@ -3210,7 +3473,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf AOM_ICDF(26611), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV @@ -3219,7 +3481,6 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396), AOM_ICDF(32768), 0 }, }, @@ -3236,13 +3497,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, }, { @@ -3255,13 +3514,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, }, { @@ -3274,13 +3531,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, }, { @@ -3293,13 +3548,11 @@ static const aom_cdf_prob default_intra_ext_tx_cdf { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, -#if CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #if CONFIG_SMOOTH_HV { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA { AOM_ICDF(1280), AOM_ICDF(32768), 0 }, }, } @@ -3417,7 +3670,7 @@ static const aom_cdf_prob { AOM_ICDF(1024), AOM_ICDF(1792), AOM_ICDF(31776), AOM_ICDF(32272), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(31744), AOM_ICDF(29440), AOM_ICDF(32084), AOM_ICDF(32426), + { { AOM_ICDF(31744), AOM_ICDF(31940), AOM_ICDF(32084), AOM_ICDF(32426), AOM_ICDF(32768), 0 }, { AOM_ICDF(2048), AOM_ICDF(2176), AOM_ICDF(2528), AOM_ICDF(31823), AOM_ICDF(32768), 0 }, @@ -3498,1423 +3751,1941 @@ static const aom_cdf_prob #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP #if CONFIG_CFL -static const aom_cdf_prob default_cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)] = { - AOM_ICDF(20492), AOM_ICDF(24094), AOM_ICDF(25679), AOM_ICDF(27242), - AOM_ICDF(28286), AOM_ICDF(29153), AOM_ICDF(29807), AOM_ICDF(30352), - AOM_ICDF(30866), AOM_ICDF(31295), AOM_ICDF(31703), AOM_ICDF(32046), - AOM_ICDF(32317), AOM_ICDF(32534), AOM_ICDF(32663), AOM_ICDF(32768) +static const aom_cdf_prob default_cfl_sign_cdf[CDF_SIZE(CFL_JOINT_SIGNS)] = { + AOM_ICDF(1892), AOM_ICDF(2229), AOM_ICDF(11464), + AOM_ICDF(14116), AOM_ICDF(25661), AOM_ICDF(26409), + AOM_ICDF(32508), AOM_ICDF(32768), 0 }; + +static const aom_cdf_prob + default_cfl_alpha_cdf[CFL_ALPHA_CONTEXTS][CDF_SIZE(CFL_ALPHABET_SIZE)] = { + { AOM_ICDF(16215), AOM_ICDF(27740), AOM_ICDF(31726), AOM_ICDF(32606), + AOM_ICDF(32736), AOM_ICDF(32751), AOM_ICDF(32757), AOM_ICDF(32759), + AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764), + AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(15213), AOM_ICDF(24615), AOM_ICDF(29704), AOM_ICDF(31974), + AOM_ICDF(32545), AOM_ICDF(32673), AOM_ICDF(32713), AOM_ICDF(32746), + AOM_ICDF(32753), AOM_ICDF(32756), AOM_ICDF(32758), AOM_ICDF(32761), + AOM_ICDF(32763), AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32768), 0 }, + { AOM_ICDF(13250), AOM_ICDF(24677), AOM_ICDF(29113), AOM_ICDF(31666), + AOM_ICDF(32408), AOM_ICDF(32578), AOM_ICDF(32628), AOM_ICDF(32711), + AOM_ICDF(32730), AOM_ICDF(32738), AOM_ICDF(32744), AOM_ICDF(32749), + AOM_ICDF(32752), AOM_ICDF(32756), AOM_ICDF(32759), AOM_ICDF(32768), 0 }, + { AOM_ICDF(24593), AOM_ICDF(30787), AOM_ICDF(32062), AOM_ICDF(32495), + AOM_ICDF(32656), AOM_ICDF(32707), AOM_ICDF(32735), AOM_ICDF(32747), + AOM_ICDF(32752), AOM_ICDF(32757), AOM_ICDF(32760), AOM_ICDF(32763), + AOM_ICDF(32764), AOM_ICDF(32765), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, + { AOM_ICDF(19883), AOM_ICDF(27419), AOM_ICDF(30100), AOM_ICDF(31392), + AOM_ICDF(31896), AOM_ICDF(32184), AOM_ICDF(32299), AOM_ICDF(32511), + AOM_ICDF(32568), AOM_ICDF(32602), AOM_ICDF(32628), AOM_ICDF(32664), + AOM_ICDF(32680), AOM_ICDF(32691), AOM_ICDF(32708), AOM_ICDF(32768), 0 }, + { AOM_ICDF(15939), AOM_ICDF(24151), AOM_ICDF(27754), AOM_ICDF(29680), + AOM_ICDF(30651), AOM_ICDF(31267), AOM_ICDF(31527), AOM_ICDF(31868), + AOM_ICDF(32001), AOM_ICDF(32090), AOM_ICDF(32181), AOM_ICDF(32284), + AOM_ICDF(32314), AOM_ICDF(32366), AOM_ICDF(32486), AOM_ICDF(32768), 0 } + }; #endif -// CDF version of 'av1_kf_y_mode_prob'. +#if CONFIG_KF_CTX +// TODO(jingning): This initial models are copied directly from the entries +// from the original table. The copied indexes are (0, 0), (0, 1), .. (4, 4). +// It is possible to re-train this model and bring back the 0.14% loss in CIF +// set key frame coding. This reduction in context model does not change the +// key frame coding stats for mid and high resolution sets. const aom_cdf_prob - av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)] = { -#if CONFIG_ALT_INTRA + default_kf_y_mode_cdf[KF_MODE_CONTEXTS][KF_MODE_CONTEXTS][CDF_SIZE( + INTRA_MODES)] = { + { + { + AOM_ICDF(14208), AOM_ICDF(17049), AOM_ICDF(20482), + AOM_ICDF(21400), AOM_ICDF(22520), AOM_ICDF(23261), + AOM_ICDF(23963), AOM_ICDF(25010), AOM_ICDF(25828), + AOM_ICDF(28398), AOM_ICDF(29394), AOM_ICDF(30738), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(18295), AOM_ICDF(19872), + AOM_ICDF(20945), AOM_ICDF(21933), AOM_ICDF(22818), + AOM_ICDF(23334), AOM_ICDF(24033), AOM_ICDF(24996), + AOM_ICDF(27652), AOM_ICDF(29060), AOM_ICDF(30071), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(6461), AOM_ICDF(19840), AOM_ICDF(20310), + AOM_ICDF(21151), AOM_ICDF(21506), AOM_ICDF(22535), + AOM_ICDF(23900), AOM_ICDF(24281), AOM_ICDF(26958), + AOM_ICDF(27680), AOM_ICDF(29636), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12544), AOM_ICDF(15177), AOM_ICDF(17666), + AOM_ICDF(19855), AOM_ICDF(21147), AOM_ICDF(22017), + AOM_ICDF(22797), AOM_ICDF(24514), AOM_ICDF(25779), + AOM_ICDF(28716), AOM_ICDF(29772), AOM_ICDF(31267), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7552), AOM_ICDF(9909), AOM_ICDF(11908), AOM_ICDF(13141), + AOM_ICDF(18765), AOM_ICDF(22029), AOM_ICDF(23872), + AOM_ICDF(24920), AOM_ICDF(25674), AOM_ICDF(29031), + AOM_ICDF(30244), AOM_ICDF(31684), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(3968), AOM_ICDF(17613), AOM_ICDF(19125), AOM_ICDF(19550), + AOM_ICDF(20305), AOM_ICDF(21908), AOM_ICDF(22274), + AOM_ICDF(22719), AOM_ICDF(23959), AOM_ICDF(26970), + AOM_ICDF(29013), AOM_ICDF(29843), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3072), AOM_ICDF(21231), AOM_ICDF(21863), AOM_ICDF(22306), + AOM_ICDF(22674), AOM_ICDF(23414), AOM_ICDF(23517), + AOM_ICDF(23798), AOM_ICDF(24770), AOM_ICDF(27032), + AOM_ICDF(29016), AOM_ICDF(29636), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2560), AOM_ICDF(9825), AOM_ICDF(15681), AOM_ICDF(16370), + AOM_ICDF(17054), AOM_ICDF(17687), AOM_ICDF(18236), + AOM_ICDF(19273), AOM_ICDF(20311), AOM_ICDF(24863), + AOM_ICDF(26825), AOM_ICDF(28756), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(15140), AOM_ICDF(16485), AOM_ICDF(18364), + AOM_ICDF(19181), AOM_ICDF(20394), AOM_ICDF(20663), + AOM_ICDF(22098), AOM_ICDF(23936), AOM_ICDF(27555), + AOM_ICDF(29704), AOM_ICDF(30849), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(13101), AOM_ICDF(14006), AOM_ICDF(14974), + AOM_ICDF(17818), AOM_ICDF(21093), AOM_ICDF(21930), + AOM_ICDF(22566), AOM_ICDF(24137), AOM_ICDF(27732), + AOM_ICDF(29814), AOM_ICDF(30904), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(11392), AOM_ICDF(12961), AOM_ICDF(20901), + AOM_ICDF(21544), AOM_ICDF(22490), AOM_ICDF(22928), + AOM_ICDF(23888), AOM_ICDF(25214), AOM_ICDF(25777), + AOM_ICDF(28256), AOM_ICDF(29102), AOM_ICDF(30513), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8064), AOM_ICDF(13595), AOM_ICDF(18888), AOM_ICDF(19616), + AOM_ICDF(20765), AOM_ICDF(21454), AOM_ICDF(21990), + AOM_ICDF(23103), AOM_ICDF(23980), AOM_ICDF(26772), + AOM_ICDF(28070), AOM_ICDF(29197), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4352), AOM_ICDF(5059), AOM_ICDF(21705), AOM_ICDF(22099), + AOM_ICDF(22703), AOM_ICDF(22846), AOM_ICDF(23679), + AOM_ICDF(25469), AOM_ICDF(25728), AOM_ICDF(27919), + AOM_ICDF(28484), AOM_ICDF(30215), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10752), AOM_ICDF(12277), AOM_ICDF(16471), + AOM_ICDF(18276), AOM_ICDF(19443), AOM_ICDF(19917), + AOM_ICDF(21158), AOM_ICDF(23881), AOM_ICDF(24892), + AOM_ICDF(27709), AOM_ICDF(28771), AOM_ICDF(30274), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8320), AOM_ICDF(10000), AOM_ICDF(14147), AOM_ICDF(15330), + AOM_ICDF(19197), AOM_ICDF(20923), AOM_ICDF(22954), + AOM_ICDF(24541), AOM_ICDF(25285), AOM_ICDF(28407), + AOM_ICDF(29431), AOM_ICDF(30953), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(10240), AOM_ICDF(12819), AOM_ICDF(15545), + AOM_ICDF(18248), AOM_ICDF(19779), AOM_ICDF(20932), + AOM_ICDF(21899), AOM_ICDF(23377), AOM_ICDF(25448), + AOM_ICDF(28730), AOM_ICDF(29936), AOM_ICDF(31536), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7552), AOM_ICDF(15309), AOM_ICDF(16645), AOM_ICDF(19760), + AOM_ICDF(20653), AOM_ICDF(21650), AOM_ICDF(22221), + AOM_ICDF(23273), AOM_ICDF(25509), AOM_ICDF(28683), + AOM_ICDF(30153), AOM_ICDF(31192), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5248), AOM_ICDF(6840), AOM_ICDF(16129), AOM_ICDF(17940), + AOM_ICDF(19069), AOM_ICDF(19660), AOM_ICDF(20588), + AOM_ICDF(22760), AOM_ICDF(23927), AOM_ICDF(27538), + AOM_ICDF(28397), AOM_ICDF(30725), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11008), AOM_ICDF(11903), AOM_ICDF(13794), + AOM_ICDF(21320), AOM_ICDF(21931), AOM_ICDF(22310), + AOM_ICDF(22546), AOM_ICDF(25375), AOM_ICDF(27347), + AOM_ICDF(29800), AOM_ICDF(30761), AOM_ICDF(31833), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(8678), AOM_ICDF(10313), AOM_ICDF(13073), + AOM_ICDF(16823), AOM_ICDF(19980), AOM_ICDF(21520), + AOM_ICDF(23242), AOM_ICDF(25344), AOM_ICDF(28797), + AOM_ICDF(30405), AOM_ICDF(31940), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(7296), AOM_ICDF(9304), AOM_ICDF(11772), AOM_ICDF(12529), + AOM_ICDF(18014), AOM_ICDF(20418), AOM_ICDF(23076), + AOM_ICDF(24662), AOM_ICDF(25549), AOM_ICDF(29074), + AOM_ICDF(30392), AOM_ICDF(31773), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(11687), AOM_ICDF(13541), AOM_ICDF(14431), + AOM_ICDF(18214), AOM_ICDF(20761), AOM_ICDF(22269), + AOM_ICDF(23320), AOM_ICDF(24633), AOM_ICDF(28339), + AOM_ICDF(30193), AOM_ICDF(31268), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3584), AOM_ICDF(4428), AOM_ICDF(13496), AOM_ICDF(14189), + AOM_ICDF(17372), AOM_ICDF(18617), AOM_ICDF(20609), + AOM_ICDF(22615), AOM_ICDF(23270), AOM_ICDF(27280), + AOM_ICDF(28305), AOM_ICDF(30602), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(8834), AOM_ICDF(10499), AOM_ICDF(14357), + AOM_ICDF(17671), AOM_ICDF(19150), AOM_ICDF(20460), + AOM_ICDF(23235), AOM_ICDF(24391), AOM_ICDF(28351), + AOM_ICDF(29843), AOM_ICDF(31481), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(5888), AOM_ICDF(7093), AOM_ICDF(7902), + AOM_ICDF(18290), AOM_ICDF(22123), AOM_ICDF(24511), + AOM_ICDF(25532), AOM_ICDF(26360), AOM_ICDF(29653), + AOM_ICDF(30954), AOM_ICDF(32215), AOM_ICDF(32768), 0, + }, + }, + }; +#else +const aom_cdf_prob default_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE( + INTRA_MODES)] = { #if CONFIG_SMOOTH_HV + { + { + AOM_ICDF(14208), AOM_ICDF(17049), AOM_ICDF(20482), AOM_ICDF(21400), + AOM_ICDF(22520), AOM_ICDF(23261), AOM_ICDF(23963), AOM_ICDF(25010), + AOM_ICDF(25828), AOM_ICDF(28398), AOM_ICDF(29394), AOM_ICDF(30738), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(18295), AOM_ICDF(19872), AOM_ICDF(20945), + AOM_ICDF(21933), AOM_ICDF(22818), AOM_ICDF(23334), AOM_ICDF(24033), + AOM_ICDF(24996), AOM_ICDF(27652), AOM_ICDF(29060), AOM_ICDF(30071), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(6461), AOM_ICDF(19840), AOM_ICDF(20310), + AOM_ICDF(21151), AOM_ICDF(21506), AOM_ICDF(22535), AOM_ICDF(23900), + AOM_ICDF(24281), AOM_ICDF(26958), AOM_ICDF(27680), AOM_ICDF(29636), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12544), AOM_ICDF(15177), AOM_ICDF(17666), AOM_ICDF(19855), + AOM_ICDF(21147), AOM_ICDF(22017), AOM_ICDF(22797), AOM_ICDF(24514), + AOM_ICDF(25779), AOM_ICDF(28716), AOM_ICDF(29772), AOM_ICDF(31267), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7552), AOM_ICDF(9909), AOM_ICDF(11908), AOM_ICDF(13141), + AOM_ICDF(18765), AOM_ICDF(22029), AOM_ICDF(23872), AOM_ICDF(24920), + AOM_ICDF(25674), AOM_ICDF(29031), AOM_ICDF(30244), AOM_ICDF(31684), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11008), AOM_ICDF(15004), AOM_ICDF(16534), AOM_ICDF(18158), + AOM_ICDF(21515), AOM_ICDF(26668), AOM_ICDF(27834), AOM_ICDF(28735), + AOM_ICDF(30471), AOM_ICDF(30839), AOM_ICDF(30969), AOM_ICDF(31068), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(7963), AOM_ICDF(11944), AOM_ICDF(12780), + AOM_ICDF(17944), AOM_ICDF(19198), AOM_ICDF(24071), AOM_ICDF(25295), + AOM_ICDF(25834), AOM_ICDF(29014), AOM_ICDF(29949), AOM_ICDF(31733), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8192), AOM_ICDF(10189), AOM_ICDF(14596), AOM_ICDF(15680), + AOM_ICDF(17143), AOM_ICDF(17909), AOM_ICDF(19201), AOM_ICDF(23711), + AOM_ICDF(24503), AOM_ICDF(28207), AOM_ICDF(29338), AOM_ICDF(31424), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10752), AOM_ICDF(13199), AOM_ICDF(15048), AOM_ICDF(17151), + AOM_ICDF(18445), AOM_ICDF(19604), AOM_ICDF(20363), AOM_ICDF(21782), + AOM_ICDF(24311), AOM_ICDF(28026), AOM_ICDF(29517), AOM_ICDF(30962), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(10301), AOM_ICDF(13245), AOM_ICDF(14307), + AOM_ICDF(16021), AOM_ICDF(16257), AOM_ICDF(17265), AOM_ICDF(18739), + AOM_ICDF(20080), AOM_ICDF(26066), AOM_ICDF(28325), AOM_ICDF(31184), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(10893), AOM_ICDF(13773), AOM_ICDF(14824), + AOM_ICDF(16540), AOM_ICDF(16926), AOM_ICDF(17748), AOM_ICDF(18876), + AOM_ICDF(20396), AOM_ICDF(25974), AOM_ICDF(28795), AOM_ICDF(30820), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(11005), AOM_ICDF(14320), AOM_ICDF(15349), + AOM_ICDF(16746), AOM_ICDF(16884), AOM_ICDF(17887), AOM_ICDF(19304), + AOM_ICDF(20265), AOM_ICDF(26115), AOM_ICDF(27672), AOM_ICDF(31358), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(9504), AOM_ICDF(15437), AOM_ICDF(16399), + AOM_ICDF(17355), AOM_ICDF(17948), AOM_ICDF(18814), AOM_ICDF(20270), + AOM_ICDF(21134), AOM_ICDF(23690), AOM_ICDF(24759), AOM_ICDF(26454), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(3968), AOM_ICDF(17613), AOM_ICDF(19125), AOM_ICDF(19550), + AOM_ICDF(20305), AOM_ICDF(21908), AOM_ICDF(22274), AOM_ICDF(22719), + AOM_ICDF(23959), AOM_ICDF(26970), AOM_ICDF(29013), AOM_ICDF(29843), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3072), AOM_ICDF(21231), AOM_ICDF(21863), AOM_ICDF(22306), + AOM_ICDF(22674), AOM_ICDF(23414), AOM_ICDF(23517), AOM_ICDF(23798), + AOM_ICDF(24770), AOM_ICDF(27032), AOM_ICDF(29016), AOM_ICDF(29636), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2560), AOM_ICDF(9825), AOM_ICDF(15681), AOM_ICDF(16370), + AOM_ICDF(17054), AOM_ICDF(17687), AOM_ICDF(18236), AOM_ICDF(19273), + AOM_ICDF(20311), AOM_ICDF(24863), AOM_ICDF(26825), AOM_ICDF(28756), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(15140), AOM_ICDF(16485), AOM_ICDF(18364), + AOM_ICDF(19181), AOM_ICDF(20394), AOM_ICDF(20663), AOM_ICDF(22098), + AOM_ICDF(23936), AOM_ICDF(27555), AOM_ICDF(29704), AOM_ICDF(30849), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(13101), AOM_ICDF(14006), AOM_ICDF(14974), + AOM_ICDF(17818), AOM_ICDF(21093), AOM_ICDF(21930), AOM_ICDF(22566), + AOM_ICDF(24137), AOM_ICDF(27732), AOM_ICDF(29814), AOM_ICDF(30904), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4352), AOM_ICDF(17824), AOM_ICDF(18715), AOM_ICDF(19632), + AOM_ICDF(21519), AOM_ICDF(26341), AOM_ICDF(26922), AOM_ICDF(27575), + AOM_ICDF(29863), AOM_ICDF(30432), AOM_ICDF(30769), AOM_ICDF(30881), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(11971), AOM_ICDF(13509), AOM_ICDF(14295), + AOM_ICDF(17202), AOM_ICDF(19005), AOM_ICDF(21605), AOM_ICDF(22458), + AOM_ICDF(23839), AOM_ICDF(27774), AOM_ICDF(29492), AOM_ICDF(30787), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4224), AOM_ICDF(13072), AOM_ICDF(15288), AOM_ICDF(16406), + AOM_ICDF(17285), AOM_ICDF(18362), AOM_ICDF(19003), AOM_ICDF(21378), + AOM_ICDF(22942), AOM_ICDF(27093), AOM_ICDF(29381), AOM_ICDF(30872), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(15375), AOM_ICDF(16188), AOM_ICDF(17415), + AOM_ICDF(18183), AOM_ICDF(19756), AOM_ICDF(20030), AOM_ICDF(20883), + AOM_ICDF(23935), AOM_ICDF(27428), AOM_ICDF(29627), AOM_ICDF(30608), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2816), AOM_ICDF(14999), AOM_ICDF(16352), AOM_ICDF(16969), + AOM_ICDF(17836), AOM_ICDF(18125), AOM_ICDF(18514), AOM_ICDF(19181), + AOM_ICDF(20650), AOM_ICDF(25773), AOM_ICDF(29172), AOM_ICDF(30662), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2560), AOM_ICDF(16158), AOM_ICDF(17320), AOM_ICDF(17839), + AOM_ICDF(18545), AOM_ICDF(18848), AOM_ICDF(19130), AOM_ICDF(19599), + AOM_ICDF(20863), AOM_ICDF(25449), AOM_ICDF(29304), AOM_ICDF(30408), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3328), AOM_ICDF(15146), AOM_ICDF(16880), AOM_ICDF(17523), + AOM_ICDF(18340), AOM_ICDF(18563), AOM_ICDF(18896), AOM_ICDF(19582), + AOM_ICDF(20944), AOM_ICDF(25914), AOM_ICDF(28759), AOM_ICDF(30583), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2560), AOM_ICDF(16618), AOM_ICDF(18460), AOM_ICDF(19207), + AOM_ICDF(19654), AOM_ICDF(20276), AOM_ICDF(20529), AOM_ICDF(21179), + AOM_ICDF(22355), AOM_ICDF(25423), AOM_ICDF(27696), AOM_ICDF(28638), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(11392), AOM_ICDF(12961), AOM_ICDF(20901), AOM_ICDF(21544), + AOM_ICDF(22490), AOM_ICDF(22928), AOM_ICDF(23888), AOM_ICDF(25214), + AOM_ICDF(25777), AOM_ICDF(28256), AOM_ICDF(29102), AOM_ICDF(30513), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8064), AOM_ICDF(13595), AOM_ICDF(18888), AOM_ICDF(19616), + AOM_ICDF(20765), AOM_ICDF(21454), AOM_ICDF(21990), AOM_ICDF(23103), + AOM_ICDF(23980), AOM_ICDF(26772), AOM_ICDF(28070), AOM_ICDF(29197), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4352), AOM_ICDF(5059), AOM_ICDF(21705), AOM_ICDF(22099), + AOM_ICDF(22703), AOM_ICDF(22846), AOM_ICDF(23679), AOM_ICDF(25469), + AOM_ICDF(25728), AOM_ICDF(27919), AOM_ICDF(28484), AOM_ICDF(30215), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10752), AOM_ICDF(12277), AOM_ICDF(16471), AOM_ICDF(18276), + AOM_ICDF(19443), AOM_ICDF(19917), AOM_ICDF(21158), AOM_ICDF(23881), + AOM_ICDF(24892), AOM_ICDF(27709), AOM_ICDF(28771), AOM_ICDF(30274), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8320), AOM_ICDF(10000), AOM_ICDF(14147), AOM_ICDF(15330), + AOM_ICDF(19197), AOM_ICDF(20923), AOM_ICDF(22954), AOM_ICDF(24541), + AOM_ICDF(25285), AOM_ICDF(28407), AOM_ICDF(29431), AOM_ICDF(30953), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11264), AOM_ICDF(14751), AOM_ICDF(18517), AOM_ICDF(20285), + AOM_ICDF(23172), AOM_ICDF(25970), AOM_ICDF(27312), AOM_ICDF(28684), + AOM_ICDF(29803), AOM_ICDF(30242), AOM_ICDF(30412), AOM_ICDF(30668), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(7509), AOM_ICDF(14190), AOM_ICDF(14953), + AOM_ICDF(17905), AOM_ICDF(18452), AOM_ICDF(23074), AOM_ICDF(24910), + AOM_ICDF(25374), AOM_ICDF(28605), AOM_ICDF(29542), AOM_ICDF(31640), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(7644), AOM_ICDF(15953), AOM_ICDF(17055), + AOM_ICDF(17945), AOM_ICDF(18242), AOM_ICDF(19351), AOM_ICDF(24705), + AOM_ICDF(25365), AOM_ICDF(28466), AOM_ICDF(29334), AOM_ICDF(31245), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8192), AOM_ICDF(9802), AOM_ICDF(14519), AOM_ICDF(15740), + AOM_ICDF(17351), AOM_ICDF(18084), AOM_ICDF(18962), AOM_ICDF(20908), + AOM_ICDF(22937), AOM_ICDF(26847), AOM_ICDF(28284), AOM_ICDF(29888), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5888), AOM_ICDF(7534), AOM_ICDF(14635), AOM_ICDF(15436), + AOM_ICDF(16710), AOM_ICDF(16830), AOM_ICDF(18000), AOM_ICDF(19760), + AOM_ICDF(20571), AOM_ICDF(25777), AOM_ICDF(27649), AOM_ICDF(30668), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5248), AOM_ICDF(7364), AOM_ICDF(14858), AOM_ICDF(15545), + AOM_ICDF(16861), AOM_ICDF(17016), AOM_ICDF(17859), AOM_ICDF(19384), + AOM_ICDF(20237), AOM_ICDF(25239), AOM_ICDF(27715), AOM_ICDF(29865), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(7989), AOM_ICDF(15472), AOM_ICDF(16265), + AOM_ICDF(17271), AOM_ICDF(17334), AOM_ICDF(18563), AOM_ICDF(20327), + AOM_ICDF(20916), AOM_ICDF(26173), AOM_ICDF(27350), AOM_ICDF(31034), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(6411), AOM_ICDF(17828), AOM_ICDF(18611), + AOM_ICDF(19399), AOM_ICDF(19684), AOM_ICDF(20504), AOM_ICDF(21782), + AOM_ICDF(22335), AOM_ICDF(25286), AOM_ICDF(26352), AOM_ICDF(28016), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(10240), AOM_ICDF(12819), AOM_ICDF(15545), AOM_ICDF(18248), + AOM_ICDF(19779), AOM_ICDF(20932), AOM_ICDF(21899), AOM_ICDF(23377), + AOM_ICDF(25448), AOM_ICDF(28730), AOM_ICDF(29936), AOM_ICDF(31536), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7552), AOM_ICDF(15309), AOM_ICDF(16645), AOM_ICDF(19760), + AOM_ICDF(20653), AOM_ICDF(21650), AOM_ICDF(22221), AOM_ICDF(23273), + AOM_ICDF(25509), AOM_ICDF(28683), AOM_ICDF(30153), AOM_ICDF(31192), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5248), AOM_ICDF(6840), AOM_ICDF(16129), AOM_ICDF(17940), + AOM_ICDF(19069), AOM_ICDF(19660), AOM_ICDF(20588), AOM_ICDF(22760), + AOM_ICDF(23927), AOM_ICDF(27538), AOM_ICDF(28397), AOM_ICDF(30725), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11008), AOM_ICDF(11903), AOM_ICDF(13794), AOM_ICDF(21320), + AOM_ICDF(21931), AOM_ICDF(22310), AOM_ICDF(22546), AOM_ICDF(25375), + AOM_ICDF(27347), AOM_ICDF(29800), AOM_ICDF(30761), AOM_ICDF(31833), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(8678), AOM_ICDF(10313), AOM_ICDF(13073), + AOM_ICDF(16823), AOM_ICDF(19980), AOM_ICDF(21520), AOM_ICDF(23242), + AOM_ICDF(25344), AOM_ICDF(28797), AOM_ICDF(30405), AOM_ICDF(31940), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(10835), AOM_ICDF(12653), AOM_ICDF(16345), + AOM_ICDF(19574), AOM_ICDF(24868), AOM_ICDF(25937), AOM_ICDF(27299), + AOM_ICDF(31104), AOM_ICDF(31448), AOM_ICDF(31580), AOM_ICDF(31679), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4992), AOM_ICDF(6458), AOM_ICDF(9945), AOM_ICDF(11961), + AOM_ICDF(16136), AOM_ICDF(17677), AOM_ICDF(20946), AOM_ICDF(23042), + AOM_ICDF(24475), AOM_ICDF(28304), AOM_ICDF(29748), AOM_ICDF(31791), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(11879), AOM_ICDF(14703), AOM_ICDF(17653), + AOM_ICDF(19176), AOM_ICDF(20185), AOM_ICDF(20880), AOM_ICDF(25194), + AOM_ICDF(26584), AOM_ICDF(29655), AOM_ICDF(30430), AOM_ICDF(32044), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9856), AOM_ICDF(11385), AOM_ICDF(13457), AOM_ICDF(18705), + AOM_ICDF(19577), AOM_ICDF(20266), AOM_ICDF(20746), AOM_ICDF(22207), + AOM_ICDF(26724), AOM_ICDF(29431), AOM_ICDF(30645), AOM_ICDF(31604), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(9318), AOM_ICDF(11569), AOM_ICDF(14812), + AOM_ICDF(16351), AOM_ICDF(16619), AOM_ICDF(17537), AOM_ICDF(19596), + AOM_ICDF(22025), AOM_ICDF(27384), AOM_ICDF(29277), AOM_ICDF(31422), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5888), AOM_ICDF(9348), AOM_ICDF(11416), AOM_ICDF(14690), + AOM_ICDF(16254), AOM_ICDF(16633), AOM_ICDF(17457), AOM_ICDF(19031), + AOM_ICDF(21875), AOM_ICDF(27080), AOM_ICDF(29442), AOM_ICDF(31193), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(9329), AOM_ICDF(12218), AOM_ICDF(15177), + AOM_ICDF(16806), AOM_ICDF(16998), AOM_ICDF(17991), AOM_ICDF(20005), + AOM_ICDF(21952), AOM_ICDF(27108), AOM_ICDF(28867), AOM_ICDF(31657), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(9098), AOM_ICDF(13132), AOM_ICDF(17701), + AOM_ICDF(18739), AOM_ICDF(19534), AOM_ICDF(20415), AOM_ICDF(22136), + AOM_ICDF(24213), AOM_ICDF(27199), AOM_ICDF(28504), AOM_ICDF(29960), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(7296), AOM_ICDF(9304), AOM_ICDF(11772), AOM_ICDF(12529), + AOM_ICDF(18014), AOM_ICDF(20418), AOM_ICDF(23076), AOM_ICDF(24662), + AOM_ICDF(25549), AOM_ICDF(29074), AOM_ICDF(30392), AOM_ICDF(31773), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(11687), AOM_ICDF(13541), AOM_ICDF(14431), + AOM_ICDF(18214), AOM_ICDF(20761), AOM_ICDF(22269), AOM_ICDF(23320), + AOM_ICDF(24633), AOM_ICDF(28339), AOM_ICDF(30193), AOM_ICDF(31268), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3584), AOM_ICDF(4428), AOM_ICDF(13496), AOM_ICDF(14189), + AOM_ICDF(17372), AOM_ICDF(18617), AOM_ICDF(20609), AOM_ICDF(22615), + AOM_ICDF(23270), AOM_ICDF(27280), AOM_ICDF(28305), AOM_ICDF(30602), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(8834), AOM_ICDF(10499), AOM_ICDF(14357), + AOM_ICDF(17671), AOM_ICDF(19150), AOM_ICDF(20460), AOM_ICDF(23235), + AOM_ICDF(24391), AOM_ICDF(28351), AOM_ICDF(29843), AOM_ICDF(31481), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(5888), AOM_ICDF(7093), AOM_ICDF(7902), + AOM_ICDF(18290), AOM_ICDF(22123), AOM_ICDF(24511), AOM_ICDF(25532), + AOM_ICDF(26360), AOM_ICDF(29653), AOM_ICDF(30954), AOM_ICDF(32215), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7296), AOM_ICDF(10176), AOM_ICDF(11780), AOM_ICDF(12824), + AOM_ICDF(19608), AOM_ICDF(25882), AOM_ICDF(28520), AOM_ICDF(29445), + AOM_ICDF(31106), AOM_ICDF(31573), AOM_ICDF(31775), AOM_ICDF(31872), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(4833), AOM_ICDF(7551), AOM_ICDF(8449), + AOM_ICDF(16668), AOM_ICDF(18614), AOM_ICDF(23952), AOM_ICDF(25668), + AOM_ICDF(26721), AOM_ICDF(29888), AOM_ICDF(30697), AOM_ICDF(32090), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(8011), AOM_ICDF(11083), AOM_ICDF(12427), + AOM_ICDF(16188), AOM_ICDF(17548), AOM_ICDF(19625), AOM_ICDF(23787), + AOM_ICDF(24792), AOM_ICDF(28649), AOM_ICDF(29872), AOM_ICDF(31845), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(9170), AOM_ICDF(10655), AOM_ICDF(12439), + AOM_ICDF(15550), AOM_ICDF(18128), AOM_ICDF(19565), AOM_ICDF(21412), + AOM_ICDF(23355), AOM_ICDF(28007), AOM_ICDF(30080), AOM_ICDF(31568), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5504), AOM_ICDF(7636), AOM_ICDF(10174), AOM_ICDF(11056), + AOM_ICDF(15562), AOM_ICDF(16252), AOM_ICDF(17931), AOM_ICDF(19598), + AOM_ICDF(20967), AOM_ICDF(26845), AOM_ICDF(29149), AOM_ICDF(31490), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5248), AOM_ICDF(7810), AOM_ICDF(10004), AOM_ICDF(11015), + AOM_ICDF(15359), AOM_ICDF(16310), AOM_ICDF(17834), AOM_ICDF(19185), + AOM_ICDF(20903), AOM_ICDF(26728), AOM_ICDF(29585), AOM_ICDF(31478), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(7322), AOM_ICDF(10592), AOM_ICDF(11694), + AOM_ICDF(15586), AOM_ICDF(16103), AOM_ICDF(17999), AOM_ICDF(19740), + AOM_ICDF(20950), AOM_ICDF(26894), AOM_ICDF(28912), AOM_ICDF(31591), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4608), AOM_ICDF(7276), AOM_ICDF(12153), AOM_ICDF(13388), + AOM_ICDF(16091), AOM_ICDF(17970), AOM_ICDF(19548), AOM_ICDF(21175), + AOM_ICDF(22481), AOM_ICDF(26543), AOM_ICDF(28212), AOM_ICDF(29908), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(6656), AOM_ICDF(12225), AOM_ICDF(14441), AOM_ICDF(15158), + AOM_ICDF(19600), AOM_ICDF(27127), AOM_ICDF(28221), AOM_ICDF(29186), + AOM_ICDF(30439), AOM_ICDF(30913), AOM_ICDF(31135), AOM_ICDF(31238), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6400), AOM_ICDF(14608), AOM_ICDF(15920), AOM_ICDF(16643), + AOM_ICDF(20149), AOM_ICDF(27328), AOM_ICDF(27896), AOM_ICDF(28672), + AOM_ICDF(30227), AOM_ICDF(30778), AOM_ICDF(31053), AOM_ICDF(31120), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(6925), AOM_ICDF(14671), AOM_ICDF(15709), + AOM_ICDF(19830), AOM_ICDF(24216), AOM_ICDF(25507), AOM_ICDF(27459), + AOM_ICDF(28552), AOM_ICDF(29569), AOM_ICDF(29808), AOM_ICDF(30169), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(13604), AOM_ICDF(15202), AOM_ICDF(17530), + AOM_ICDF(20878), AOM_ICDF(24279), AOM_ICDF(25278), AOM_ICDF(28255), + AOM_ICDF(30651), AOM_ICDF(31170), AOM_ICDF(31343), AOM_ICDF(31410), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4608), AOM_ICDF(8535), AOM_ICDF(9588), AOM_ICDF(10740), + AOM_ICDF(18673), AOM_ICDF(27664), AOM_ICDF(28826), AOM_ICDF(29828), + AOM_ICDF(31081), AOM_ICDF(31503), AOM_ICDF(31680), AOM_ICDF(31778), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4864), AOM_ICDF(10543), AOM_ICDF(11313), AOM_ICDF(12197), + AOM_ICDF(16785), AOM_ICDF(27858), AOM_ICDF(28556), AOM_ICDF(29480), + AOM_ICDF(30892), AOM_ICDF(31486), AOM_ICDF(31722), AOM_ICDF(31787), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3968), AOM_ICDF(7492), AOM_ICDF(10283), AOM_ICDF(11318), + AOM_ICDF(18486), AOM_ICDF(24061), AOM_ICDF(26761), AOM_ICDF(28456), + AOM_ICDF(30126), AOM_ICDF(30872), AOM_ICDF(31088), AOM_ICDF(31305), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(10246), AOM_ICDF(12999), AOM_ICDF(15083), + AOM_ICDF(18769), AOM_ICDF(22398), AOM_ICDF(23584), AOM_ICDF(27098), + AOM_ICDF(29574), AOM_ICDF(30609), AOM_ICDF(30898), AOM_ICDF(31200), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7808), AOM_ICDF(13404), AOM_ICDF(14723), AOM_ICDF(16413), + AOM_ICDF(20186), AOM_ICDF(24739), AOM_ICDF(25407), AOM_ICDF(27106), + AOM_ICDF(29929), AOM_ICDF(30507), AOM_ICDF(30827), AOM_ICDF(30915), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2816), AOM_ICDF(6530), AOM_ICDF(8123), AOM_ICDF(9240), + AOM_ICDF(12536), AOM_ICDF(17593), AOM_ICDF(18754), AOM_ICDF(20319), + AOM_ICDF(22070), AOM_ICDF(27037), AOM_ICDF(29332), AOM_ICDF(30779), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2432), AOM_ICDF(6577), AOM_ICDF(8010), AOM_ICDF(9215), + AOM_ICDF(12657), AOM_ICDF(18898), AOM_ICDF(19588), AOM_ICDF(20953), + AOM_ICDF(22766), AOM_ICDF(27231), AOM_ICDF(29927), AOM_ICDF(31109), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3200), AOM_ICDF(6974), AOM_ICDF(9162), AOM_ICDF(10450), + AOM_ICDF(13818), AOM_ICDF(17757), AOM_ICDF(19119), AOM_ICDF(20842), + AOM_ICDF(22269), AOM_ICDF(27170), AOM_ICDF(29271), AOM_ICDF(30804), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(10689), AOM_ICDF(15307), AOM_ICDF(16589), + AOM_ICDF(19738), AOM_ICDF(24416), AOM_ICDF(25332), AOM_ICDF(26541), + AOM_ICDF(28634), AOM_ICDF(29711), AOM_ICDF(29913), AOM_ICDF(30116), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(9600), AOM_ICDF(11066), AOM_ICDF(15832), AOM_ICDF(16515), + AOM_ICDF(18844), AOM_ICDF(19883), AOM_ICDF(24302), AOM_ICDF(25759), + AOM_ICDF(26358), AOM_ICDF(29290), AOM_ICDF(30262), AOM_ICDF(31682), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8832), AOM_ICDF(12814), AOM_ICDF(16171), AOM_ICDF(17041), + AOM_ICDF(19066), AOM_ICDF(20145), AOM_ICDF(22933), AOM_ICDF(24074), + AOM_ICDF(25006), AOM_ICDF(28115), AOM_ICDF(29722), AOM_ICDF(30991), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(4486), AOM_ICDF(15821), AOM_ICDF(16330), + AOM_ICDF(18461), AOM_ICDF(18879), AOM_ICDF(22436), AOM_ICDF(25051), + AOM_ICDF(25443), AOM_ICDF(28637), AOM_ICDF(29396), AOM_ICDF(31412), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9856), AOM_ICDF(10863), AOM_ICDF(14050), AOM_ICDF(15920), + AOM_ICDF(18783), AOM_ICDF(19531), AOM_ICDF(22502), AOM_ICDF(24577), + AOM_ICDF(25361), AOM_ICDF(28559), AOM_ICDF(29600), AOM_ICDF(31336), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(7620), AOM_ICDF(10182), AOM_ICDF(11199), + AOM_ICDF(17281), AOM_ICDF(19946), AOM_ICDF(23885), AOM_ICDF(25333), + AOM_ICDF(26130), AOM_ICDF(29425), AOM_ICDF(30332), AOM_ICDF(31948), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9728), AOM_ICDF(11821), AOM_ICDF(13954), AOM_ICDF(15233), + AOM_ICDF(19855), AOM_ICDF(24478), AOM_ICDF(28675), AOM_ICDF(29878), + AOM_ICDF(31238), AOM_ICDF(31741), AOM_ICDF(31874), AOM_ICDF(32048), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(5753), AOM_ICDF(9673), AOM_ICDF(10149), + AOM_ICDF(14343), AOM_ICDF(15190), AOM_ICDF(24967), AOM_ICDF(26378), + AOM_ICDF(26841), AOM_ICDF(29749), AOM_ICDF(30527), AOM_ICDF(32120), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5888), AOM_ICDF(6606), AOM_ICDF(11498), AOM_ICDF(12538), + AOM_ICDF(14737), AOM_ICDF(15425), AOM_ICDF(19549), AOM_ICDF(24047), + AOM_ICDF(24765), AOM_ICDF(28711), AOM_ICDF(29822), AOM_ICDF(32138), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10368), AOM_ICDF(11757), AOM_ICDF(14126), AOM_ICDF(15474), + AOM_ICDF(18311), AOM_ICDF(19358), AOM_ICDF(21539), AOM_ICDF(23451), + AOM_ICDF(25034), AOM_ICDF(28791), AOM_ICDF(30035), AOM_ICDF(31280), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(7623), AOM_ICDF(11378), AOM_ICDF(12248), + AOM_ICDF(15171), AOM_ICDF(15459), AOM_ICDF(18958), AOM_ICDF(20875), + AOM_ICDF(21955), AOM_ICDF(27411), AOM_ICDF(29196), AOM_ICDF(31723), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(7469), AOM_ICDF(11399), AOM_ICDF(12323), + AOM_ICDF(15165), AOM_ICDF(15528), AOM_ICDF(18804), AOM_ICDF(20769), + AOM_ICDF(21767), AOM_ICDF(27129), AOM_ICDF(29435), AOM_ICDF(31502), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7040), AOM_ICDF(8295), AOM_ICDF(12298), AOM_ICDF(13035), + AOM_ICDF(15194), AOM_ICDF(15357), AOM_ICDF(18976), AOM_ICDF(21100), + AOM_ICDF(21805), AOM_ICDF(26978), AOM_ICDF(28342), AOM_ICDF(31763), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5632), AOM_ICDF(7465), AOM_ICDF(14220), AOM_ICDF(15035), + AOM_ICDF(17014), AOM_ICDF(18105), AOM_ICDF(21111), AOM_ICDF(23027), + AOM_ICDF(23934), AOM_ICDF(27207), AOM_ICDF(28293), AOM_ICDF(30330), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(11008), AOM_ICDF(13089), AOM_ICDF(17144), AOM_ICDF(18425), + AOM_ICDF(19954), AOM_ICDF(20624), AOM_ICDF(21658), AOM_ICDF(24229), + AOM_ICDF(25290), AOM_ICDF(28803), AOM_ICDF(29938), AOM_ICDF(31493), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(14218), AOM_ICDF(16378), AOM_ICDF(17699), + AOM_ICDF(18935), AOM_ICDF(19928), AOM_ICDF(20524), AOM_ICDF(22781), + AOM_ICDF(24155), AOM_ICDF(27523), AOM_ICDF(29068), AOM_ICDF(30270), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6144), AOM_ICDF(7194), AOM_ICDF(17912), AOM_ICDF(18991), + AOM_ICDF(19879), AOM_ICDF(20151), AOM_ICDF(21170), AOM_ICDF(23938), + AOM_ICDF(24712), AOM_ICDF(27763), AOM_ICDF(28556), AOM_ICDF(30584), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(11614), AOM_ICDF(13652), AOM_ICDF(16928), + AOM_ICDF(18425), AOM_ICDF(18967), AOM_ICDF(19724), AOM_ICDF(23817), + AOM_ICDF(25594), AOM_ICDF(28685), AOM_ICDF(29734), AOM_ICDF(30941), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7296), AOM_ICDF(8915), AOM_ICDF(11163), AOM_ICDF(13821), + AOM_ICDF(16951), AOM_ICDF(18507), AOM_ICDF(20180), AOM_ICDF(22423), + AOM_ICDF(24017), AOM_ICDF(28294), AOM_ICDF(29614), AOM_ICDF(31673), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9728), AOM_ICDF(13441), AOM_ICDF(15858), AOM_ICDF(18860), + AOM_ICDF(21713), AOM_ICDF(24478), AOM_ICDF(25995), AOM_ICDF(28233), + AOM_ICDF(30347), AOM_ICDF(30853), AOM_ICDF(31081), AOM_ICDF(31328), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6400), AOM_ICDF(7480), AOM_ICDF(11482), AOM_ICDF(13206), + AOM_ICDF(16199), AOM_ICDF(16908), AOM_ICDF(20436), AOM_ICDF(23507), + AOM_ICDF(24650), AOM_ICDF(28360), AOM_ICDF(29438), AOM_ICDF(31532), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9856), AOM_ICDF(10979), AOM_ICDF(13430), AOM_ICDF(15195), + AOM_ICDF(15957), AOM_ICDF(16350), AOM_ICDF(16871), AOM_ICDF(26198), + AOM_ICDF(26991), AOM_ICDF(29612), AOM_ICDF(30438), AOM_ICDF(31962), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(10529), AOM_ICDF(12640), AOM_ICDF(15350), + AOM_ICDF(16987), AOM_ICDF(17859), AOM_ICDF(18590), AOM_ICDF(21400), + AOM_ICDF(23812), AOM_ICDF(28188), AOM_ICDF(29589), AOM_ICDF(31280), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(8877), AOM_ICDF(12393), AOM_ICDF(14015), + AOM_ICDF(15655), AOM_ICDF(15794), AOM_ICDF(16814), AOM_ICDF(19923), + AOM_ICDF(21086), AOM_ICDF(26723), AOM_ICDF(28669), AOM_ICDF(31468), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6400), AOM_ICDF(8900), AOM_ICDF(12241), AOM_ICDF(13828), + AOM_ICDF(15513), AOM_ICDF(15671), AOM_ICDF(16500), AOM_ICDF(19257), + AOM_ICDF(20456), AOM_ICDF(25984), AOM_ICDF(28658), AOM_ICDF(31017), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7296), AOM_ICDF(8820), AOM_ICDF(12885), AOM_ICDF(14441), + AOM_ICDF(15813), AOM_ICDF(15911), AOM_ICDF(16954), AOM_ICDF(20026), + AOM_ICDF(20950), AOM_ICDF(26563), AOM_ICDF(28140), AOM_ICDF(31673), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(8455), AOM_ICDF(13328), AOM_ICDF(15907), + AOM_ICDF(17026), AOM_ICDF(17464), AOM_ICDF(18267), AOM_ICDF(21436), + AOM_ICDF(22712), AOM_ICDF(26403), AOM_ICDF(27660), AOM_ICDF(29559), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(6784), AOM_ICDF(11216), AOM_ICDF(13269), AOM_ICDF(15677), + AOM_ICDF(16931), AOM_ICDF(18445), AOM_ICDF(19097), AOM_ICDF(20082), + AOM_ICDF(24298), AOM_ICDF(28236), AOM_ICDF(30118), AOM_ICDF(31448), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(13240), AOM_ICDF(14110), AOM_ICDF(16966), + AOM_ICDF(17743), AOM_ICDF(18916), AOM_ICDF(19281), AOM_ICDF(19848), + AOM_ICDF(25552), AOM_ICDF(28646), AOM_ICDF(30444), AOM_ICDF(31291), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4352), AOM_ICDF(6870), AOM_ICDF(14660), AOM_ICDF(16597), + AOM_ICDF(17361), AOM_ICDF(18126), AOM_ICDF(18852), AOM_ICDF(20765), + AOM_ICDF(23526), AOM_ICDF(27670), AOM_ICDF(29096), AOM_ICDF(31214), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9472), AOM_ICDF(11736), AOM_ICDF(13172), AOM_ICDF(18192), + AOM_ICDF(19070), AOM_ICDF(19651), AOM_ICDF(19991), AOM_ICDF(21793), + AOM_ICDF(26005), AOM_ICDF(29291), AOM_ICDF(30500), AOM_ICDF(31767), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(7252), AOM_ICDF(8651), AOM_ICDF(12379), + AOM_ICDF(14936), AOM_ICDF(17493), AOM_ICDF(18326), AOM_ICDF(19527), + AOM_ICDF(23655), AOM_ICDF(28031), AOM_ICDF(29960), AOM_ICDF(31773), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(11561), AOM_ICDF(12864), AOM_ICDF(15793), + AOM_ICDF(18765), AOM_ICDF(23040), AOM_ICDF(23640), AOM_ICDF(24415), + AOM_ICDF(31040), AOM_ICDF(31473), AOM_ICDF(31740), AOM_ICDF(31827), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(6825), AOM_ICDF(8810), AOM_ICDF(11269), + AOM_ICDF(14257), AOM_ICDF(15716), AOM_ICDF(18397), AOM_ICDF(20006), + AOM_ICDF(24020), AOM_ICDF(28230), AOM_ICDF(29780), AOM_ICDF(31773), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(9466), AOM_ICDF(11717), AOM_ICDF(15159), + AOM_ICDF(16237), AOM_ICDF(17145), AOM_ICDF(17814), AOM_ICDF(21258), + AOM_ICDF(24754), AOM_ICDF(28864), AOM_ICDF(30313), AOM_ICDF(32061), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7680), AOM_ICDF(10517), AOM_ICDF(11381), AOM_ICDF(16202), + AOM_ICDF(16809), AOM_ICDF(17425), AOM_ICDF(17774), AOM_ICDF(18764), + AOM_ICDF(26842), AOM_ICDF(29600), AOM_ICDF(31073), AOM_ICDF(31886), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4992), AOM_ICDF(8626), AOM_ICDF(10531), AOM_ICDF(13103), + AOM_ICDF(14495), AOM_ICDF(14784), AOM_ICDF(15365), AOM_ICDF(16657), + AOM_ICDF(21051), AOM_ICDF(27011), AOM_ICDF(29685), AOM_ICDF(31574), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4736), AOM_ICDF(9433), AOM_ICDF(10981), AOM_ICDF(13494), + AOM_ICDF(14644), AOM_ICDF(15043), AOM_ICDF(15396), AOM_ICDF(16378), + AOM_ICDF(21506), AOM_ICDF(26869), AOM_ICDF(29824), AOM_ICDF(31454), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(9526), AOM_ICDF(11905), AOM_ICDF(14476), + AOM_ICDF(15722), AOM_ICDF(16103), AOM_ICDF(16768), AOM_ICDF(18070), + AOM_ICDF(21630), AOM_ICDF(27401), AOM_ICDF(29592), AOM_ICDF(31818), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(9947), AOM_ICDF(12386), AOM_ICDF(15909), + AOM_ICDF(16496), AOM_ICDF(17397), AOM_ICDF(17866), AOM_ICDF(18927), + AOM_ICDF(24408), AOM_ICDF(27750), AOM_ICDF(29614), AOM_ICDF(30889), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(7424), AOM_ICDF(10538), AOM_ICDF(14098), AOM_ICDF(14891), + AOM_ICDF(16486), AOM_ICDF(16756), AOM_ICDF(17607), AOM_ICDF(18952), + AOM_ICDF(20168), AOM_ICDF(26275), AOM_ICDF(28617), AOM_ICDF(31580), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(13070), AOM_ICDF(14969), AOM_ICDF(15848), + AOM_ICDF(17197), AOM_ICDF(17447), AOM_ICDF(17954), AOM_ICDF(18747), + AOM_ICDF(20137), AOM_ICDF(25628), AOM_ICDF(28753), AOM_ICDF(30628), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3584), AOM_ICDF(5287), AOM_ICDF(16141), AOM_ICDF(16840), + AOM_ICDF(17670), AOM_ICDF(17760), AOM_ICDF(18532), AOM_ICDF(20387), + AOM_ICDF(21102), AOM_ICDF(26118), AOM_ICDF(27535), AOM_ICDF(30830), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(9594), AOM_ICDF(11770), AOM_ICDF(14505), + AOM_ICDF(16234), AOM_ICDF(16365), AOM_ICDF(17201), AOM_ICDF(20286), + AOM_ICDF(22128), AOM_ICDF(27371), AOM_ICDF(29426), AOM_ICDF(31580), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5632), AOM_ICDF(8393), AOM_ICDF(10566), AOM_ICDF(11917), + AOM_ICDF(16025), AOM_ICDF(16697), AOM_ICDF(18123), AOM_ICDF(19541), + AOM_ICDF(21135), AOM_ICDF(27059), AOM_ICDF(29325), AOM_ICDF(31814), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(7916), AOM_ICDF(9526), AOM_ICDF(11010), + AOM_ICDF(14114), AOM_ICDF(18169), AOM_ICDF(19510), AOM_ICDF(21031), + AOM_ICDF(23083), AOM_ICDF(27769), AOM_ICDF(29782), AOM_ICDF(31299), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(7338), AOM_ICDF(10657), AOM_ICDF(11699), + AOM_ICDF(14780), AOM_ICDF(15070), AOM_ICDF(18291), AOM_ICDF(20170), + AOM_ICDF(21347), AOM_ICDF(26985), AOM_ICDF(28811), AOM_ICDF(31805), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5632), AOM_ICDF(7669), AOM_ICDF(11558), AOM_ICDF(12653), + AOM_ICDF(13962), AOM_ICDF(14116), AOM_ICDF(15074), AOM_ICDF(19886), + AOM_ICDF(21123), AOM_ICDF(26953), AOM_ICDF(28755), AOM_ICDF(31708), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(9739), AOM_ICDF(11612), AOM_ICDF(13211), + AOM_ICDF(14992), AOM_ICDF(15237), AOM_ICDF(16016), AOM_ICDF(17677), + AOM_ICDF(20588), AOM_ICDF(26647), AOM_ICDF(29116), AOM_ICDF(31435), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(8346), AOM_ICDF(11022), AOM_ICDF(11976), + AOM_ICDF(13541), AOM_ICDF(13749), AOM_ICDF(14520), AOM_ICDF(16173), + AOM_ICDF(17567), AOM_ICDF(25182), AOM_ICDF(28111), AOM_ICDF(31591), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4736), AOM_ICDF(8894), AOM_ICDF(11294), AOM_ICDF(12220), + AOM_ICDF(13753), AOM_ICDF(14029), AOM_ICDF(14645), AOM_ICDF(16065), + AOM_ICDF(17621), AOM_ICDF(24911), AOM_ICDF(28655), AOM_ICDF(31344), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(8193), AOM_ICDF(11667), AOM_ICDF(12461), + AOM_ICDF(13880), AOM_ICDF(14040), AOM_ICDF(14946), AOM_ICDF(16537), + AOM_ICDF(17642), AOM_ICDF(25117), AOM_ICDF(27333), AOM_ICDF(31713), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4096), AOM_ICDF(8479), AOM_ICDF(13751), AOM_ICDF(14813), + AOM_ICDF(15994), AOM_ICDF(16157), AOM_ICDF(16905), AOM_ICDF(18314), + AOM_ICDF(19575), AOM_ICDF(25132), AOM_ICDF(27445), AOM_ICDF(30192), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(7936), AOM_ICDF(12263), AOM_ICDF(15558), AOM_ICDF(16331), + AOM_ICDF(17779), AOM_ICDF(18148), AOM_ICDF(18810), AOM_ICDF(19794), + AOM_ICDF(21046), AOM_ICDF(26644), AOM_ICDF(29417), AOM_ICDF(31507), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(15025), AOM_ICDF(16457), AOM_ICDF(17074), + AOM_ICDF(18079), AOM_ICDF(18299), AOM_ICDF(18648), AOM_ICDF(19240), + AOM_ICDF(20612), AOM_ICDF(25687), AOM_ICDF(29392), AOM_ICDF(30842), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(6037), AOM_ICDF(17465), AOM_ICDF(18089), + AOM_ICDF(18869), AOM_ICDF(18953), AOM_ICDF(19688), AOM_ICDF(21223), + AOM_ICDF(21816), AOM_ICDF(26562), AOM_ICDF(28195), AOM_ICDF(30621), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(11255), AOM_ICDF(13307), AOM_ICDF(15676), + AOM_ICDF(17392), AOM_ICDF(17603), AOM_ICDF(18268), AOM_ICDF(20783), + AOM_ICDF(22646), AOM_ICDF(27628), AOM_ICDF(29737), AOM_ICDF(31628), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(9119), AOM_ICDF(11015), AOM_ICDF(12269), + AOM_ICDF(16280), AOM_ICDF(17023), AOM_ICDF(18282), AOM_ICDF(19418), + AOM_ICDF(21325), AOM_ICDF(27309), AOM_ICDF(30004), AOM_ICDF(31818), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3968), AOM_ICDF(9094), AOM_ICDF(10606), AOM_ICDF(12007), + AOM_ICDF(14218), AOM_ICDF(18911), AOM_ICDF(20089), AOM_ICDF(20924), + AOM_ICDF(23587), AOM_ICDF(27808), AOM_ICDF(30253), AOM_ICDF(31305), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(8627), AOM_ICDF(11201), AOM_ICDF(12200), + AOM_ICDF(15305), AOM_ICDF(15671), AOM_ICDF(18639), AOM_ICDF(20185), + AOM_ICDF(21627), AOM_ICDF(26990), AOM_ICDF(29449), AOM_ICDF(31723), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6272), AOM_ICDF(8768), AOM_ICDF(12320), AOM_ICDF(13296), + AOM_ICDF(14643), AOM_ICDF(14970), AOM_ICDF(15760), AOM_ICDF(20545), + AOM_ICDF(21863), AOM_ICDF(27473), AOM_ICDF(29535), AOM_ICDF(31836), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(10905), AOM_ICDF(12656), AOM_ICDF(14084), + AOM_ICDF(15705), AOM_ICDF(16069), AOM_ICDF(16674), AOM_ICDF(17779), + AOM_ICDF(21041), AOM_ICDF(26586), AOM_ICDF(29539), AOM_ICDF(31253), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5248), AOM_ICDF(9672), AOM_ICDF(12113), AOM_ICDF(12871), + AOM_ICDF(14423), AOM_ICDF(14710), AOM_ICDF(15376), AOM_ICDF(16708), + AOM_ICDF(18092), AOM_ICDF(25260), AOM_ICDF(28991), AOM_ICDF(31585), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4736), AOM_ICDF(10789), AOM_ICDF(13029), AOM_ICDF(13750), + AOM_ICDF(15040), AOM_ICDF(15385), AOM_ICDF(15840), AOM_ICDF(16887), + AOM_ICDF(18393), AOM_ICDF(25230), AOM_ICDF(29558), AOM_ICDF(31454), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(9916), AOM_ICDF(12938), AOM_ICDF(13741), + AOM_ICDF(15030), AOM_ICDF(15297), AOM_ICDF(16116), AOM_ICDF(17333), + AOM_ICDF(18672), AOM_ICDF(25954), AOM_ICDF(28498), AOM_ICDF(31618), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4608), AOM_ICDF(10266), AOM_ICDF(15450), AOM_ICDF(16299), + AOM_ICDF(17114), AOM_ICDF(17288), AOM_ICDF(17775), AOM_ICDF(18835), + AOM_ICDF(20227), AOM_ICDF(25199), AOM_ICDF(28098), AOM_ICDF(30018), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(7296), AOM_ICDF(9951), AOM_ICDF(14124), AOM_ICDF(14806), + AOM_ICDF(16181), AOM_ICDF(16377), AOM_ICDF(17485), AOM_ICDF(19069), + AOM_ICDF(20078), AOM_ICDF(26051), AOM_ICDF(27777), AOM_ICDF(31574), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(13823), AOM_ICDF(15889), AOM_ICDF(16620), + AOM_ICDF(17709), AOM_ICDF(17881), AOM_ICDF(18327), AOM_ICDF(19140), + AOM_ICDF(20374), AOM_ICDF(25685), AOM_ICDF(28160), AOM_ICDF(30521), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3200), AOM_ICDF(4602), AOM_ICDF(16404), AOM_ICDF(17042), + AOM_ICDF(17780), AOM_ICDF(17829), AOM_ICDF(18706), AOM_ICDF(20608), + AOM_ICDF(21115), AOM_ICDF(25884), AOM_ICDF(26960), AOM_ICDF(30804), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7040), AOM_ICDF(9444), AOM_ICDF(11770), AOM_ICDF(14321), + AOM_ICDF(15951), AOM_ICDF(16074), AOM_ICDF(17033), AOM_ICDF(20352), + AOM_ICDF(22301), AOM_ICDF(27567), AOM_ICDF(29151), AOM_ICDF(31662), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6016), AOM_ICDF(8316), AOM_ICDF(10849), AOM_ICDF(12136), + AOM_ICDF(15860), AOM_ICDF(16430), AOM_ICDF(17935), AOM_ICDF(19659), + AOM_ICDF(21083), AOM_ICDF(26968), AOM_ICDF(28839), AOM_ICDF(31618), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(7472), AOM_ICDF(9436), AOM_ICDF(11038), + AOM_ICDF(13625), AOM_ICDF(17596), AOM_ICDF(18959), AOM_ICDF(20543), + AOM_ICDF(22879), AOM_ICDF(27487), AOM_ICDF(29351), AOM_ICDF(31186), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(7117), AOM_ICDF(11424), AOM_ICDF(12381), + AOM_ICDF(14823), AOM_ICDF(15053), AOM_ICDF(18656), AOM_ICDF(20818), + AOM_ICDF(21722), AOM_ICDF(27042), AOM_ICDF(28233), AOM_ICDF(31591), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(7281), AOM_ICDF(11910), AOM_ICDF(12912), + AOM_ICDF(14229), AOM_ICDF(14391), AOM_ICDF(15474), AOM_ICDF(20113), + AOM_ICDF(21128), AOM_ICDF(26627), AOM_ICDF(28077), AOM_ICDF(31713), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(9452), AOM_ICDF(11526), AOM_ICDF(13288), + AOM_ICDF(14861), AOM_ICDF(15062), AOM_ICDF(15909), AOM_ICDF(17695), + AOM_ICDF(20429), AOM_ICDF(26225), AOM_ICDF(28603), AOM_ICDF(31340), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5376), AOM_ICDF(7722), AOM_ICDF(10921), AOM_ICDF(11813), + AOM_ICDF(13222), AOM_ICDF(13348), AOM_ICDF(14211), AOM_ICDF(15976), + AOM_ICDF(17110), AOM_ICDF(24634), AOM_ICDF(27176), AOM_ICDF(31484), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4736), AOM_ICDF(8226), AOM_ICDF(11137), AOM_ICDF(11988), + AOM_ICDF(13518), AOM_ICDF(13706), AOM_ICDF(14332), AOM_ICDF(16016), + AOM_ICDF(17301), AOM_ICDF(24641), AOM_ICDF(27704), AOM_ICDF(31016), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(7592), AOM_ICDF(11880), AOM_ICDF(12612), + AOM_ICDF(13738), AOM_ICDF(13813), AOM_ICDF(14681), AOM_ICDF(16392), + AOM_ICDF(17306), AOM_ICDF(24619), AOM_ICDF(26334), AOM_ICDF(31818), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4096), AOM_ICDF(8524), AOM_ICDF(14316), AOM_ICDF(15392), + AOM_ICDF(16295), AOM_ICDF(16433), AOM_ICDF(17197), AOM_ICDF(18718), + AOM_ICDF(19924), AOM_ICDF(25123), AOM_ICDF(26953), AOM_ICDF(29856), + AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(6528), AOM_ICDF(13383), AOM_ICDF(17642), AOM_ICDF(18342), + AOM_ICDF(19224), AOM_ICDF(20209), AOM_ICDF(20899), AOM_ICDF(21944), + AOM_ICDF(23137), AOM_ICDF(25966), AOM_ICDF(27429), AOM_ICDF(28463), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4480), AOM_ICDF(16901), AOM_ICDF(18876), AOM_ICDF(19560), + AOM_ICDF(20257), AOM_ICDF(20912), AOM_ICDF(21169), AOM_ICDF(21959), + AOM_ICDF(23036), AOM_ICDF(25781), AOM_ICDF(27676), AOM_ICDF(28569), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2688), AOM_ICDF(5337), AOM_ICDF(18178), AOM_ICDF(18829), + AOM_ICDF(19344), AOM_ICDF(19628), AOM_ICDF(20267), AOM_ICDF(22135), + AOM_ICDF(22671), AOM_ICDF(25817), AOM_ICDF(26914), AOM_ICDF(28773), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8192), AOM_ICDF(11378), AOM_ICDF(14742), AOM_ICDF(17269), + AOM_ICDF(18230), AOM_ICDF(19001), AOM_ICDF(19655), AOM_ICDF(22949), + AOM_ICDF(24337), AOM_ICDF(28025), AOM_ICDF(29503), AOM_ICDF(30848), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5120), AOM_ICDF(10133), AOM_ICDF(13144), AOM_ICDF(14374), + AOM_ICDF(17020), AOM_ICDF(18920), AOM_ICDF(20235), AOM_ICDF(21677), + AOM_ICDF(23142), AOM_ICDF(27131), AOM_ICDF(28671), AOM_ICDF(30284), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(15588), AOM_ICDF(18431), AOM_ICDF(19723), + AOM_ICDF(21455), AOM_ICDF(24705), AOM_ICDF(25461), AOM_ICDF(26753), + AOM_ICDF(28923), AOM_ICDF(29475), AOM_ICDF(29729), AOM_ICDF(29897), + AOM_ICDF(32768), 0, + }, { - { AOM_ICDF(14208), AOM_ICDF(16238), AOM_ICDF(19079), AOM_ICDF(22512), - AOM_ICDF(23632), AOM_ICDF(24373), AOM_ICDF(25291), AOM_ICDF(26109), - AOM_ICDF(26811), AOM_ICDF(27858), AOM_ICDF(30428), AOM_ICDF(31424), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(10496), AOM_ICDF(13193), AOM_ICDF(20992), AOM_ICDF(22569), - AOM_ICDF(23557), AOM_ICDF(24442), AOM_ICDF(25515), AOM_ICDF(26478), - AOM_ICDF(26994), AOM_ICDF(27693), AOM_ICDF(30349), AOM_ICDF(31757), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(8252), AOM_ICDF(9593), AOM_ICDF(22972), - AOM_ICDF(23813), AOM_ICDF(24168), AOM_ICDF(24638), AOM_ICDF(25019), - AOM_ICDF(26048), AOM_ICDF(27413), AOM_ICDF(30090), AOM_ICDF(30812), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(12544), AOM_ICDF(14045), AOM_ICDF(16678), AOM_ICDF(19167), - AOM_ICDF(20459), AOM_ICDF(21329), AOM_ICDF(23518), AOM_ICDF(24783), - AOM_ICDF(25563), AOM_ICDF(27280), AOM_ICDF(30217), AOM_ICDF(31273), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7552), AOM_ICDF(8636), AOM_ICDF(10993), AOM_ICDF(12992), - AOM_ICDF(18616), AOM_ICDF(21880), AOM_ICDF(23113), AOM_ICDF(23867), - AOM_ICDF(25710), AOM_ICDF(26758), AOM_ICDF(30115), AOM_ICDF(31328), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(12708), AOM_ICDF(16704), AOM_ICDF(18234), - AOM_ICDF(21591), AOM_ICDF(26744), AOM_ICDF(28368), AOM_ICDF(30104), - AOM_ICDF(31270), AOM_ICDF(32171), AOM_ICDF(32539), AOM_ICDF(32669), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(7307), AOM_ICDF(8998), AOM_ICDF(12979), - AOM_ICDF(18143), AOM_ICDF(19397), AOM_ICDF(20233), AOM_ICDF(20772), - AOM_ICDF(25645), AOM_ICDF(26869), AOM_ICDF(30049), AOM_ICDF(30984), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8192), AOM_ICDF(9536), AOM_ICDF(11533), AOM_ICDF(15940), - AOM_ICDF(17403), AOM_ICDF(18169), AOM_ICDF(19253), AOM_ICDF(20045), - AOM_ICDF(21337), AOM_ICDF(25847), AOM_ICDF(29551), AOM_ICDF(30682), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(10752), AOM_ICDF(12558), AOM_ICDF(15005), AOM_ICDF(16854), - AOM_ICDF(18148), AOM_ICDF(19307), AOM_ICDF(21410), AOM_ICDF(23939), - AOM_ICDF(24698), AOM_ICDF(26117), AOM_ICDF(29832), AOM_ICDF(31323), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(9008), AOM_ICDF(11885), AOM_ICDF(14829), - AOM_ICDF(16543), AOM_ICDF(16779), AOM_ICDF(17841), AOM_ICDF(19182), - AOM_ICDF(20190), AOM_ICDF(21664), AOM_ICDF(27650), AOM_ICDF(29909), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(8476), AOM_ICDF(12841), AOM_ICDF(15721), - AOM_ICDF(17437), AOM_ICDF(17823), AOM_ICDF(18874), AOM_ICDF(20394), - AOM_ICDF(21216), AOM_ICDF(22344), AOM_ICDF(27922), AOM_ICDF(30743), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(10114), AOM_ICDF(12415), AOM_ICDF(15730), - AOM_ICDF(17127), AOM_ICDF(17265), AOM_ICDF(18294), AOM_ICDF(19255), - AOM_ICDF(20258), AOM_ICDF(21675), AOM_ICDF(27525), AOM_ICDF(29082), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(12586), AOM_ICDF(15818), AOM_ICDF(21751), - AOM_ICDF(22707), AOM_ICDF(23300), AOM_ICDF(24262), AOM_ICDF(25126), - AOM_ICDF(25992), AOM_ICDF(27448), AOM_ICDF(30004), AOM_ICDF(31073), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(3968), AOM_ICDF(6893), AOM_ICDF(20538), AOM_ICDF(22050), - AOM_ICDF(22805), AOM_ICDF(24408), AOM_ICDF(24833), AOM_ICDF(26073), - AOM_ICDF(26439), AOM_ICDF(26884), AOM_ICDF(29895), AOM_ICDF(31938), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3072), AOM_ICDF(6204), AOM_ICDF(24363), AOM_ICDF(24995), - AOM_ICDF(25363), AOM_ICDF(26103), AOM_ICDF(26546), AOM_ICDF(27518), - AOM_ICDF(27621), AOM_ICDF(27902), AOM_ICDF(30164), AOM_ICDF(32148), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2560), AOM_ICDF(6572), AOM_ICDF(13837), AOM_ICDF(19693), - AOM_ICDF(20377), AOM_ICDF(21010), AOM_ICDF(21699), AOM_ICDF(22737), - AOM_ICDF(23286), AOM_ICDF(24323), AOM_ICDF(28875), AOM_ICDF(30837), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(8831), AOM_ICDF(17059), AOM_ICDF(18404), - AOM_ICDF(19221), AOM_ICDF(20434), AOM_ICDF(22313), AOM_ICDF(24151), - AOM_ICDF(24420), AOM_ICDF(25855), AOM_ICDF(29474), AOM_ICDF(31623), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2944), AOM_ICDF(4808), AOM_ICDF(14965), AOM_ICDF(15870), - AOM_ICDF(18714), AOM_ICDF(21989), AOM_ICDF(22957), AOM_ICDF(24528), - AOM_ICDF(25365), AOM_ICDF(26001), AOM_ICDF(29596), AOM_ICDF(31678), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(6239), AOM_ICDF(19711), AOM_ICDF(20602), - AOM_ICDF(22489), AOM_ICDF(27311), AOM_ICDF(28228), AOM_ICDF(30516), - AOM_ICDF(31097), AOM_ICDF(31750), AOM_ICDF(32319), AOM_ICDF(32656), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2944), AOM_ICDF(4925), AOM_ICDF(13952), AOM_ICDF(15490), - AOM_ICDF(18397), AOM_ICDF(20200), AOM_ICDF(20986), AOM_ICDF(22367), - AOM_ICDF(24967), AOM_ICDF(25820), AOM_ICDF(29755), AOM_ICDF(31473), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4224), AOM_ICDF(6120), AOM_ICDF(14968), AOM_ICDF(17184), - AOM_ICDF(18063), AOM_ICDF(19140), AOM_ICDF(20258), AOM_ICDF(21822), - AOM_ICDF(22463), AOM_ICDF(24838), AOM_ICDF(28989), AOM_ICDF(31277), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(7280), AOM_ICDF(17535), AOM_ICDF(18348), - AOM_ICDF(19116), AOM_ICDF(20689), AOM_ICDF(21916), AOM_ICDF(24968), - AOM_ICDF(25242), AOM_ICDF(26095), AOM_ICDF(29588), AOM_ICDF(31787), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2816), AOM_ICDF(4922), AOM_ICDF(17105), AOM_ICDF(18458), - AOM_ICDF(19325), AOM_ICDF(19614), AOM_ICDF(20231), AOM_ICDF(21700), - AOM_ICDF(22089), AOM_ICDF(22756), AOM_ICDF(27879), AOM_ICDF(31278), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2560), AOM_ICDF(4920), AOM_ICDF(18518), AOM_ICDF(19680), - AOM_ICDF(20386), AOM_ICDF(20689), AOM_ICDF(21208), AOM_ICDF(22472), - AOM_ICDF(22754), AOM_ICDF(23223), AOM_ICDF(27809), AOM_ICDF(31664), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3328), AOM_ICDF(5513), AOM_ICDF(17331), AOM_ICDF(19065), - AOM_ICDF(19882), AOM_ICDF(20105), AOM_ICDF(20748), AOM_ICDF(22110), - AOM_ICDF(22443), AOM_ICDF(23129), AOM_ICDF(28099), AOM_ICDF(30944), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2560), AOM_ICDF(6690), AOM_ICDF(20748), AOM_ICDF(22590), - AOM_ICDF(23037), AOM_ICDF(23659), AOM_ICDF(24406), AOM_ICDF(25582), - AOM_ICDF(25835), AOM_ICDF(26485), AOM_ICDF(29553), AOM_ICDF(31826), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(11392), AOM_ICDF(13647), AOM_ICDF(15216), AOM_ICDF(23156), - AOM_ICDF(24102), AOM_ICDF(24540), AOM_ICDF(25183), AOM_ICDF(25746), - AOM_ICDF(26706), AOM_ICDF(28032), AOM_ICDF(30511), AOM_ICDF(31357), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8064), AOM_ICDF(11635), AOM_ICDF(17166), AOM_ICDF(22459), - AOM_ICDF(23608), AOM_ICDF(24297), AOM_ICDF(25025), AOM_ICDF(25902), - AOM_ICDF(26438), AOM_ICDF(27551), AOM_ICDF(30343), AOM_ICDF(31641), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(6905), AOM_ICDF(7612), AOM_ICDF(24258), - AOM_ICDF(24862), AOM_ICDF(25005), AOM_ICDF(25399), AOM_ICDF(25658), - AOM_ICDF(26491), AOM_ICDF(28281), AOM_ICDF(30472), AOM_ICDF(31037), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(10752), AOM_ICDF(13246), AOM_ICDF(14771), AOM_ICDF(18965), - AOM_ICDF(20132), AOM_ICDF(20606), AOM_ICDF(22411), AOM_ICDF(23422), - AOM_ICDF(24663), AOM_ICDF(27386), AOM_ICDF(30203), AOM_ICDF(31265), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8320), AOM_ICDF(10135), AOM_ICDF(11815), AOM_ICDF(15962), - AOM_ICDF(19829), AOM_ICDF(21555), AOM_ICDF(22738), AOM_ICDF(23482), - AOM_ICDF(25513), AOM_ICDF(27100), AOM_ICDF(30222), AOM_ICDF(31246), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(11264), AOM_ICDF(13364), AOM_ICDF(16851), AOM_ICDF(20617), - AOM_ICDF(23504), AOM_ICDF(26302), AOM_ICDF(28070), AOM_ICDF(29189), - AOM_ICDF(30531), AOM_ICDF(31903), AOM_ICDF(32342), AOM_ICDF(32512), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(7656), AOM_ICDF(8637), AOM_ICDF(15318), - AOM_ICDF(18270), AOM_ICDF(18817), AOM_ICDF(19580), AOM_ICDF(20044), - AOM_ICDF(24666), AOM_ICDF(26502), AOM_ICDF(29733), AOM_ICDF(30670), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8307), AOM_ICDF(9167), AOM_ICDF(17476), - AOM_ICDF(18366), AOM_ICDF(18663), AOM_ICDF(19765), AOM_ICDF(20425), - AOM_ICDF(21534), AOM_ICDF(26888), AOM_ICDF(29989), AOM_ICDF(30857), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8192), AOM_ICDF(11072), AOM_ICDF(12682), AOM_ICDF(17399), - AOM_ICDF(19010), AOM_ICDF(19743), AOM_ICDF(20964), AOM_ICDF(22993), - AOM_ICDF(23871), AOM_ICDF(25817), AOM_ICDF(29727), AOM_ICDF(31164), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(7988), AOM_ICDF(9634), AOM_ICDF(16735), - AOM_ICDF(18009), AOM_ICDF(18129), AOM_ICDF(18930), AOM_ICDF(19741), - AOM_ICDF(20911), AOM_ICDF(22671), AOM_ICDF(27877), AOM_ICDF(29749), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5248), AOM_ICDF(8151), AOM_ICDF(10267), AOM_ICDF(17761), - AOM_ICDF(19077), AOM_ICDF(19232), AOM_ICDF(19919), AOM_ICDF(20772), - AOM_ICDF(21615), AOM_ICDF(23140), AOM_ICDF(28142), AOM_ICDF(30618), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(8390), AOM_ICDF(9723), AOM_ICDF(17206), - AOM_ICDF(18212), AOM_ICDF(18275), AOM_ICDF(19068), AOM_ICDF(19657), - AOM_ICDF(20886), AOM_ICDF(22650), AOM_ICDF(27907), AOM_ICDF(29084), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(9232), AOM_ICDF(11163), AOM_ICDF(22580), - AOM_ICDF(23368), AOM_ICDF(23653), AOM_ICDF(24436), AOM_ICDF(24989), - AOM_ICDF(25809), AOM_ICDF(27087), AOM_ICDF(30038), AOM_ICDF(31104), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(10240), AOM_ICDF(11472), AOM_ICDF(14051), AOM_ICDF(16777), - AOM_ICDF(18308), AOM_ICDF(19461), AOM_ICDF(22164), AOM_ICDF(24235), - AOM_ICDF(25202), AOM_ICDF(26680), AOM_ICDF(29962), AOM_ICDF(31168), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7552), AOM_ICDF(9128), AOM_ICDF(16885), AOM_ICDF(18221), - AOM_ICDF(19114), AOM_ICDF(20111), AOM_ICDF(23226), AOM_ICDF(25462), - AOM_ICDF(26033), AOM_ICDF(27085), AOM_ICDF(30259), AOM_ICDF(31729), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5248), AOM_ICDF(7291), AOM_ICDF(8883), AOM_ICDF(18172), - AOM_ICDF(19301), AOM_ICDF(19892), AOM_ICDF(21703), AOM_ICDF(22870), - AOM_ICDF(23798), AOM_ICDF(25970), AOM_ICDF(29581), AOM_ICDF(30440), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(11943), AOM_ICDF(12838), AOM_ICDF(14729), - AOM_ICDF(15340), AOM_ICDF(15719), AOM_ICDF(23245), AOM_ICDF(25217), - AOM_ICDF(25453), AOM_ICDF(28282), AOM_ICDF(30735), AOM_ICDF(31696), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(7100), AOM_ICDF(9506), AOM_ICDF(11141), - AOM_ICDF(14891), AOM_ICDF(18048), AOM_ICDF(20808), AOM_ICDF(22910), - AOM_ICDF(24450), AOM_ICDF(26172), AOM_ICDF(29625), AOM_ICDF(31233), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(8513), AOM_ICDF(11924), AOM_ICDF(13742), - AOM_ICDF(16971), AOM_ICDF(22265), AOM_ICDF(25957), AOM_ICDF(29762), - AOM_ICDF(30831), AOM_ICDF(32193), AOM_ICDF(32537), AOM_ICDF(32669), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4992), AOM_ICDF(5969), AOM_ICDF(7435), AOM_ICDF(10922), - AOM_ICDF(15097), AOM_ICDF(16638), AOM_ICDF(18654), AOM_ICDF(20087), - AOM_ICDF(23356), AOM_ICDF(25452), AOM_ICDF(29281), AOM_ICDF(30725), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(10324), AOM_ICDF(12603), AOM_ICDF(15427), - AOM_ICDF(16950), AOM_ICDF(17959), AOM_ICDF(20909), AOM_ICDF(22299), - AOM_ICDF(22994), AOM_ICDF(27308), AOM_ICDF(30379), AOM_ICDF(31154), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(11020), AOM_ICDF(12549), AOM_ICDF(14621), - AOM_ICDF(15493), AOM_ICDF(16182), AOM_ICDF(21430), AOM_ICDF(25947), - AOM_ICDF(26427), AOM_ICDF(27888), AOM_ICDF(30595), AOM_ICDF(31809), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(7618), AOM_ICDF(10664), AOM_ICDF(12915), - AOM_ICDF(14454), AOM_ICDF(14722), AOM_ICDF(17965), AOM_ICDF(20394), - AOM_ICDF(21312), AOM_ICDF(23371), AOM_ICDF(28730), AOM_ICDF(30623), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(7463), AOM_ICDF(10923), AOM_ICDF(12991), - AOM_ICDF(14555), AOM_ICDF(14934), AOM_ICDF(18208), AOM_ICDF(21052), - AOM_ICDF(21876), AOM_ICDF(23450), AOM_ICDF(28655), AOM_ICDF(31017), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(8023), AOM_ICDF(10440), AOM_ICDF(13329), - AOM_ICDF(14958), AOM_ICDF(15150), AOM_ICDF(18109), AOM_ICDF(20056), - AOM_ICDF(21049), AOM_ICDF(23063), AOM_ICDF(28219), AOM_ICDF(29978), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(7928), AOM_ICDF(11906), AOM_ICDF(15940), - AOM_ICDF(16978), AOM_ICDF(17773), AOM_ICDF(22342), AOM_ICDF(24419), - AOM_ICDF(25300), AOM_ICDF(27021), AOM_ICDF(30007), AOM_ICDF(31312), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(7296), AOM_ICDF(8291), AOM_ICDF(10299), AOM_ICDF(12767), - AOM_ICDF(18252), AOM_ICDF(20656), AOM_ICDF(21413), AOM_ICDF(22300), - AOM_ICDF(24958), AOM_ICDF(26544), AOM_ICDF(30069), AOM_ICDF(31387), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(8668), AOM_ICDF(13187), AOM_ICDF(15041), - AOM_ICDF(18824), AOM_ICDF(21371), AOM_ICDF(22261), AOM_ICDF(23574), - AOM_ICDF(25082), AOM_ICDF(26133), AOM_ICDF(29839), AOM_ICDF(31693), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3584), AOM_ICDF(5750), AOM_ICDF(6594), AOM_ICDF(15662), - AOM_ICDF(18845), AOM_ICDF(20090), AOM_ICDF(20783), AOM_ICDF(21438), - AOM_ICDF(23430), AOM_ICDF(25436), AOM_ICDF(29446), AOM_ICDF(30471), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(8711), AOM_ICDF(10121), AOM_ICDF(11786), - AOM_ICDF(15100), AOM_ICDF(16579), AOM_ICDF(20437), AOM_ICDF(21593), - AOM_ICDF(22903), AOM_ICDF(25678), AOM_ICDF(29638), AOM_ICDF(31130), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(5033), AOM_ICDF(6441), AOM_ICDF(7646), - AOM_ICDF(18034), AOM_ICDF(21867), AOM_ICDF(22676), AOM_ICDF(23504), - AOM_ICDF(25892), AOM_ICDF(26913), AOM_ICDF(30206), AOM_ICDF(31507), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7296), AOM_ICDF(8192), AOM_ICDF(11072), AOM_ICDF(12676), - AOM_ICDF(19460), AOM_ICDF(25734), AOM_ICDF(26778), AOM_ICDF(28439), - AOM_ICDF(31077), AOM_ICDF(32002), AOM_ICDF(32469), AOM_ICDF(32671), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(4518), AOM_ICDF(5511), AOM_ICDF(8229), - AOM_ICDF(16448), AOM_ICDF(18394), AOM_ICDF(19292), AOM_ICDF(20345), - AOM_ICDF(25683), AOM_ICDF(27399), AOM_ICDF(30566), AOM_ICDF(31375), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(7451), AOM_ICDF(8934), AOM_ICDF(12006), - AOM_ICDF(15767), AOM_ICDF(17127), AOM_ICDF(18471), AOM_ICDF(19476), - AOM_ICDF(21553), AOM_ICDF(25715), AOM_ICDF(29572), AOM_ICDF(30795), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(8368), AOM_ICDF(10370), AOM_ICDF(11855), - AOM_ICDF(14966), AOM_ICDF(17544), AOM_ICDF(19328), AOM_ICDF(21271), - AOM_ICDF(22708), AOM_ICDF(24555), AOM_ICDF(29207), AOM_ICDF(31280), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5504), AOM_ICDF(6782), AOM_ICDF(8914), AOM_ICDF(11452), - AOM_ICDF(15958), AOM_ICDF(16648), AOM_ICDF(17530), AOM_ICDF(18899), - AOM_ICDF(20578), AOM_ICDF(22245), AOM_ICDF(28123), AOM_ICDF(30427), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5248), AOM_ICDF(6538), AOM_ICDF(9100), AOM_ICDF(11294), - AOM_ICDF(15638), AOM_ICDF(16589), AOM_ICDF(17600), AOM_ICDF(19318), - AOM_ICDF(20842), AOM_ICDF(22193), AOM_ICDF(28018), AOM_ICDF(30875), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(8499), AOM_ICDF(11769), - AOM_ICDF(15661), AOM_ICDF(16178), AOM_ICDF(17280), AOM_ICDF(18490), - AOM_ICDF(20386), AOM_ICDF(22127), AOM_ICDF(28071), AOM_ICDF(30089), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(7468), AOM_ICDF(10136), AOM_ICDF(15013), - AOM_ICDF(17716), AOM_ICDF(19595), AOM_ICDF(20830), AOM_ICDF(22136), - AOM_ICDF(23714), AOM_ICDF(25341), AOM_ICDF(29403), AOM_ICDF(31072), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(6656), AOM_ICDF(8186), AOM_ICDF(13755), AOM_ICDF(15971), - AOM_ICDF(20413), AOM_ICDF(27940), AOM_ICDF(28657), AOM_ICDF(29910), - AOM_ICDF(31004), AOM_ICDF(31969), AOM_ICDF(32443), AOM_ICDF(32665), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6400), AOM_ICDF(8048), AOM_ICDF(16256), AOM_ICDF(17568), - AOM_ICDF(21074), AOM_ICDF(28253), AOM_ICDF(28976), AOM_ICDF(30531), - AOM_ICDF(31099), AOM_ICDF(31875), AOM_ICDF(32426), AOM_ICDF(32701), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(6439), AOM_ICDF(9524), AOM_ICDF(17270), - AOM_ICDF(21391), AOM_ICDF(25777), AOM_ICDF(26815), AOM_ICDF(27908), - AOM_ICDF(29199), AOM_ICDF(31151), AOM_ICDF(32168), AOM_ICDF(32407), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(10958), AOM_ICDF(14962), AOM_ICDF(16560), - AOM_ICDF(19908), AOM_ICDF(23309), AOM_ICDF(25637), AOM_ICDF(28033), - AOM_ICDF(29032), AOM_ICDF(32009), AOM_ICDF(32528), AOM_ICDF(32701), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(5598), AOM_ICDF(9525), AOM_ICDF(10578), - AOM_ICDF(18511), AOM_ICDF(27502), AOM_ICDF(28654), AOM_ICDF(29907), - AOM_ICDF(31069), AOM_ICDF(32071), AOM_ICDF(32493), AOM_ICDF(32670), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4864), AOM_ICDF(5845), AOM_ICDF(11524), AOM_ICDF(12294), - AOM_ICDF(16882), AOM_ICDF(27955), AOM_ICDF(28839), AOM_ICDF(30251), - AOM_ICDF(30949), AOM_ICDF(31873), AOM_ICDF(32467), AOM_ICDF(32703), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3968), AOM_ICDF(5431), AOM_ICDF(8955), AOM_ICDF(11746), - AOM_ICDF(18914), AOM_ICDF(24489), AOM_ICDF(25524), AOM_ICDF(27194), - AOM_ICDF(29894), AOM_ICDF(31589), AOM_ICDF(32335), AOM_ICDF(32551), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(7584), AOM_ICDF(11814), AOM_ICDF(14567), - AOM_ICDF(18253), AOM_ICDF(21882), AOM_ICDF(23966), AOM_ICDF(26442), - AOM_ICDF(27628), AOM_ICDF(31142), AOM_ICDF(32177), AOM_ICDF(32466), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7808), AOM_ICDF(9661), AOM_ICDF(15257), AOM_ICDF(16576), - AOM_ICDF(20349), AOM_ICDF(24902), AOM_ICDF(26592), AOM_ICDF(29415), - AOM_ICDF(30083), AOM_ICDF(31782), AOM_ICDF(32360), AOM_ICDF(32680), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2816), AOM_ICDF(4805), AOM_ICDF(8519), AOM_ICDF(10112), - AOM_ICDF(13408), AOM_ICDF(18465), AOM_ICDF(19582), AOM_ICDF(21333), - AOM_ICDF(22494), AOM_ICDF(24059), AOM_ICDF(29026), AOM_ICDF(31321), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2432), AOM_ICDF(4091), AOM_ICDF(8236), AOM_ICDF(9669), - AOM_ICDF(13111), AOM_ICDF(19352), AOM_ICDF(20557), AOM_ICDF(22370), - AOM_ICDF(23060), AOM_ICDF(24425), AOM_ICDF(28890), AOM_ICDF(31586), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3200), AOM_ICDF(5164), AOM_ICDF(8938), AOM_ICDF(11126), - AOM_ICDF(14494), AOM_ICDF(18433), AOM_ICDF(19721), AOM_ICDF(21148), - AOM_ICDF(22510), AOM_ICDF(24233), AOM_ICDF(29134), AOM_ICDF(31235), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(7132), AOM_ICDF(13341), AOM_ICDF(17959), - AOM_ICDF(21108), AOM_ICDF(25786), AOM_ICDF(27068), AOM_ICDF(29161), - AOM_ICDF(30077), AOM_ICDF(31286), AOM_ICDF(32363), AOM_ICDF(32565), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(9600), AOM_ICDF(10686), AOM_ICDF(12152), AOM_ICDF(16918), - AOM_ICDF(19247), AOM_ICDF(20286), AOM_ICDF(20969), AOM_ICDF(21568), - AOM_ICDF(25987), AOM_ICDF(27444), AOM_ICDF(30376), AOM_ICDF(31348), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8832), AOM_ICDF(10609), AOM_ICDF(14591), AOM_ICDF(17948), - AOM_ICDF(19973), AOM_ICDF(21052), AOM_ICDF(21922), AOM_ICDF(22854), - AOM_ICDF(25642), AOM_ICDF(26783), AOM_ICDF(29892), AOM_ICDF(31499), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(5196), AOM_ICDF(5842), AOM_ICDF(17177), - AOM_ICDF(19308), AOM_ICDF(19726), AOM_ICDF(20235), AOM_ICDF(20627), - AOM_ICDF(24184), AOM_ICDF(26799), AOM_ICDF(29993), AOM_ICDF(30752), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(11288), AOM_ICDF(12295), AOM_ICDF(15482), - AOM_ICDF(18345), AOM_ICDF(19093), AOM_ICDF(20963), AOM_ICDF(21747), - AOM_ICDF(24718), AOM_ICDF(26793), AOM_ICDF(29991), AOM_ICDF(31032), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(7348), AOM_ICDF(8440), AOM_ICDF(11002), - AOM_ICDF(17084), AOM_ICDF(19749), AOM_ICDF(20766), AOM_ICDF(21563), - AOM_ICDF(25502), AOM_ICDF(26950), AOM_ICDF(30245), AOM_ICDF(31152), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9728), AOM_ICDF(10448), AOM_ICDF(12541), AOM_ICDF(14674), - AOM_ICDF(19296), AOM_ICDF(23919), AOM_ICDF(25198), AOM_ICDF(26558), - AOM_ICDF(30755), AOM_ICDF(31958), AOM_ICDF(32461), AOM_ICDF(32594), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(5768), AOM_ICDF(6401), AOM_ICDF(10321), - AOM_ICDF(14515), AOM_ICDF(15362), AOM_ICDF(15838), AOM_ICDF(16301), - AOM_ICDF(26078), AOM_ICDF(27489), AOM_ICDF(30397), AOM_ICDF(31175), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(6518), AOM_ICDF(7236), AOM_ICDF(12128), - AOM_ICDF(14327), AOM_ICDF(15015), AOM_ICDF(16055), AOM_ICDF(16773), - AOM_ICDF(20897), AOM_ICDF(25395), AOM_ICDF(29341), AOM_ICDF(30452), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(10368), AOM_ICDF(11856), AOM_ICDF(13245), AOM_ICDF(15614), - AOM_ICDF(18451), AOM_ICDF(19498), AOM_ICDF(20846), AOM_ICDF(22429), - AOM_ICDF(24610), AOM_ICDF(26522), AOM_ICDF(30279), AOM_ICDF(31523), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(7061), AOM_ICDF(8668), AOM_ICDF(12423), - AOM_ICDF(15346), AOM_ICDF(15634), AOM_ICDF(16504), AOM_ICDF(17584), - AOM_ICDF(21083), AOM_ICDF(23000), AOM_ICDF(28456), AOM_ICDF(30241), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(7026), AOM_ICDF(8735), AOM_ICDF(12665), - AOM_ICDF(15507), AOM_ICDF(15870), AOM_ICDF(16794), AOM_ICDF(17792), - AOM_ICDF(21068), AOM_ICDF(23033), AOM_ICDF(28395), AOM_ICDF(30701), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(8045), AOM_ICDF(9300), AOM_ICDF(13303), - AOM_ICDF(15462), AOM_ICDF(15625), AOM_ICDF(16362), AOM_ICDF(17067), - AOM_ICDF(20686), AOM_ICDF(22810), AOM_ICDF(27983), AOM_ICDF(29347), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(8070), AOM_ICDF(9903), AOM_ICDF(16658), - AOM_ICDF(18637), AOM_ICDF(19728), AOM_ICDF(20543), AOM_ICDF(21450), - AOM_ICDF(24456), AOM_ICDF(26372), AOM_ICDF(29645), AOM_ICDF(30731), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(11008), AOM_ICDF(12283), AOM_ICDF(14364), AOM_ICDF(18419), - AOM_ICDF(19948), AOM_ICDF(20618), AOM_ICDF(21899), AOM_ICDF(22960), - AOM_ICDF(23994), AOM_ICDF(26565), AOM_ICDF(30078), AOM_ICDF(31213), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(11586), AOM_ICDF(16716), AOM_ICDF(18876), - AOM_ICDF(20112), AOM_ICDF(21105), AOM_ICDF(22426), AOM_ICDF(23800), - AOM_ICDF(24396), AOM_ICDF(26653), AOM_ICDF(30021), AOM_ICDF(31566), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6144), AOM_ICDF(8328), AOM_ICDF(9378), AOM_ICDF(20096), - AOM_ICDF(20984), AOM_ICDF(21256), AOM_ICDF(22335), AOM_ICDF(23109), - AOM_ICDF(24128), AOM_ICDF(26896), AOM_ICDF(29947), AOM_ICDF(30740), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(10496), AOM_ICDF(12323), AOM_ICDF(13441), AOM_ICDF(15479), - AOM_ICDF(16976), AOM_ICDF(17518), AOM_ICDF(20794), AOM_ICDF(22571), - AOM_ICDF(23328), AOM_ICDF(27421), AOM_ICDF(30512), AOM_ICDF(31561), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7296), AOM_ICDF(8391), AOM_ICDF(10010), AOM_ICDF(12258), - AOM_ICDF(15388), AOM_ICDF(16944), AOM_ICDF(19602), AOM_ICDF(21196), - AOM_ICDF(22869), AOM_ICDF(25112), AOM_ICDF(29389), AOM_ICDF(30709), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9728), AOM_ICDF(11168), AOM_ICDF(14881), AOM_ICDF(17298), - AOM_ICDF(20151), AOM_ICDF(22916), AOM_ICDF(25918), AOM_ICDF(28032), - AOM_ICDF(29549), AOM_ICDF(31787), AOM_ICDF(32293), AOM_ICDF(32521), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6400), AOM_ICDF(7636), AOM_ICDF(8716), AOM_ICDF(12718), - AOM_ICDF(15711), AOM_ICDF(16420), AOM_ICDF(18144), AOM_ICDF(19287), - AOM_ICDF(22815), AOM_ICDF(25886), AOM_ICDF(29596), AOM_ICDF(30674), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(10662), AOM_ICDF(11785), AOM_ICDF(14236), - AOM_ICDF(14998), AOM_ICDF(15391), AOM_ICDF(17156), AOM_ICDF(17949), - AOM_ICDF(18470), AOM_ICDF(27797), AOM_ICDF(30418), AOM_ICDF(31244), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(10448), AOM_ICDF(12017), AOM_ICDF(14128), - AOM_ICDF(15765), AOM_ICDF(16637), AOM_ICDF(19347), AOM_ICDF(21759), - AOM_ICDF(22490), AOM_ICDF(25300), AOM_ICDF(29676), AOM_ICDF(31077), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(8468), AOM_ICDF(10177), AOM_ICDF(13693), - AOM_ICDF(15333), AOM_ICDF(15472), AOM_ICDF(17094), AOM_ICDF(18257), - AOM_ICDF(19277), AOM_ICDF(22386), AOM_ICDF(28023), AOM_ICDF(29969), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6400), AOM_ICDF(8151), AOM_ICDF(10651), AOM_ICDF(13992), - AOM_ICDF(15677), AOM_ICDF(15835), AOM_ICDF(17422), AOM_ICDF(18621), - AOM_ICDF(19450), AOM_ICDF(22207), AOM_ICDF(27735), AOM_ICDF(30409), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7296), AOM_ICDF(8391), AOM_ICDF(9915), AOM_ICDF(13980), - AOM_ICDF(15352), AOM_ICDF(15450), AOM_ICDF(17006), AOM_ICDF(17930), - AOM_ICDF(18973), AOM_ICDF(22045), AOM_ICDF(27658), AOM_ICDF(29235), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(9481), AOM_ICDF(11664), AOM_ICDF(16537), - AOM_ICDF(17656), AOM_ICDF(18094), AOM_ICDF(20673), AOM_ICDF(21949), - AOM_ICDF(22752), AOM_ICDF(25921), AOM_ICDF(29612), AOM_ICDF(30869), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(6784), AOM_ICDF(8104), AOM_ICDF(12536), AOM_ICDF(14589), - AOM_ICDF(15843), AOM_ICDF(17357), AOM_ICDF(19765), AOM_ICDF(23981), - AOM_ICDF(24633), AOM_ICDF(25618), AOM_ICDF(29556), AOM_ICDF(31438), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(7237), AOM_ICDF(14717), AOM_ICDF(15587), - AOM_ICDF(16364), AOM_ICDF(17537), AOM_ICDF(20393), AOM_ICDF(26097), - AOM_ICDF(26462), AOM_ICDF(27029), AOM_ICDF(30123), AOM_ICDF(31921), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(5906), AOM_ICDF(8424), AOM_ICDF(16214), - AOM_ICDF(16978), AOM_ICDF(17743), AOM_ICDF(19680), AOM_ICDF(22441), - AOM_ICDF(23167), AOM_ICDF(25080), AOM_ICDF(29224), AOM_ICDF(30650), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(9472), AOM_ICDF(10473), AOM_ICDF(12737), AOM_ICDF(14173), - AOM_ICDF(15051), AOM_ICDF(15632), AOM_ICDF(20652), AOM_ICDF(24864), - AOM_ICDF(25204), AOM_ICDF(27006), AOM_ICDF(30292), AOM_ICDF(31501), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(5475), AOM_ICDF(8247), AOM_ICDF(9646), - AOM_ICDF(12203), AOM_ICDF(14760), AOM_ICDF(18488), AOM_ICDF(22616), - AOM_ICDF(23449), AOM_ICDF(24650), AOM_ICDF(29026), AOM_ICDF(30955), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(6957), AOM_ICDF(12502), AOM_ICDF(13805), - AOM_ICDF(16777), AOM_ICDF(21052), AOM_ICDF(23981), AOM_ICDF(30606), - AOM_ICDF(31206), AOM_ICDF(31981), AOM_ICDF(32414), AOM_ICDF(32681), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(5475), AOM_ICDF(7820), AOM_ICDF(9805), - AOM_ICDF(12793), AOM_ICDF(14252), AOM_ICDF(16711), AOM_ICDF(20725), - AOM_ICDF(23406), AOM_ICDF(25015), AOM_ICDF(29225), AOM_ICDF(30775), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(7619), AOM_ICDF(10173), AOM_ICDF(12424), - AOM_ICDF(13502), AOM_ICDF(14410), AOM_ICDF(17852), AOM_ICDF(21348), - AOM_ICDF(22017), AOM_ICDF(25461), AOM_ICDF(29571), AOM_ICDF(31020), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7680), AOM_ICDF(8562), AOM_ICDF(11399), AOM_ICDF(12263), - AOM_ICDF(12870), AOM_ICDF(13486), AOM_ICDF(18307), AOM_ICDF(26385), - AOM_ICDF(26734), AOM_ICDF(27724), AOM_ICDF(30482), AOM_ICDF(31955), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4992), AOM_ICDF(6186), AOM_ICDF(9820), AOM_ICDF(11725), - AOM_ICDF(13117), AOM_ICDF(13406), AOM_ICDF(15978), AOM_ICDF(20372), - AOM_ICDF(20953), AOM_ICDF(22245), AOM_ICDF(28205), AOM_ICDF(30879), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(6050), AOM_ICDF(10747), AOM_ICDF(12295), - AOM_ICDF(13445), AOM_ICDF(13844), AOM_ICDF(16357), AOM_ICDF(21485), - AOM_ICDF(21838), AOM_ICDF(22820), AOM_ICDF(28183), AOM_ICDF(31138), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(10476), AOM_ICDF(12855), - AOM_ICDF(14101), AOM_ICDF(14482), AOM_ICDF(17053), AOM_ICDF(20613), - AOM_ICDF(21278), AOM_ICDF(22580), AOM_ICDF(28351), AOM_ICDF(30542), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(6359), AOM_ICDF(11826), AOM_ICDF(14265), - AOM_ICDF(14852), AOM_ICDF(15753), AOM_ICDF(19276), AOM_ICDF(24757), - AOM_ICDF(25226), AOM_ICDF(26287), AOM_ICDF(29629), AOM_ICDF(31493), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(7424), AOM_ICDF(8612), AOM_ICDF(11726), AOM_ICDF(15286), - AOM_ICDF(16881), AOM_ICDF(17151), AOM_ICDF(17944), AOM_ICDF(19160), - AOM_ICDF(20011), AOM_ICDF(21356), AOM_ICDF(27463), AOM_ICDF(29805), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(7516), AOM_ICDF(15210), AOM_ICDF(17109), - AOM_ICDF(18458), AOM_ICDF(18708), AOM_ICDF(19587), AOM_ICDF(20977), - AOM_ICDF(21484), AOM_ICDF(22277), AOM_ICDF(27768), AOM_ICDF(30893), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3584), AOM_ICDF(5522), AOM_ICDF(7225), AOM_ICDF(18079), - AOM_ICDF(18909), AOM_ICDF(18999), AOM_ICDF(19698), AOM_ICDF(20413), - AOM_ICDF(21185), AOM_ICDF(23040), AOM_ICDF(28056), AOM_ICDF(29473), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(8612), AOM_ICDF(10782), AOM_ICDF(12958), - AOM_ICDF(14687), AOM_ICDF(14818), AOM_ICDF(17553), AOM_ICDF(19395), - AOM_ICDF(20231), AOM_ICDF(23316), AOM_ICDF(28559), AOM_ICDF(30614), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(6586), AOM_ICDF(9347), AOM_ICDF(11520), - AOM_ICDF(15628), AOM_ICDF(16300), AOM_ICDF(17651), AOM_ICDF(19245), - AOM_ICDF(20671), AOM_ICDF(22089), AOM_ICDF(28013), AOM_ICDF(30279), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(5309), AOM_ICDF(9385), AOM_ICDF(10995), - AOM_ICDF(14099), AOM_ICDF(18154), AOM_ICDF(19638), AOM_ICDF(21690), - AOM_ICDF(23031), AOM_ICDF(24552), AOM_ICDF(29238), AOM_ICDF(31251), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(6339), AOM_ICDF(8301), AOM_ICDF(11620), - AOM_ICDF(14701), AOM_ICDF(14991), AOM_ICDF(16033), AOM_ICDF(17210), - AOM_ICDF(20431), AOM_ICDF(22310), AOM_ICDF(27948), AOM_ICDF(29774), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(6692), AOM_ICDF(8729), AOM_ICDF(12618), - AOM_ICDF(13927), AOM_ICDF(14081), AOM_ICDF(15176), AOM_ICDF(16413), - AOM_ICDF(17371), AOM_ICDF(22183), AOM_ICDF(28013), AOM_ICDF(29815), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(7861), AOM_ICDF(11072), AOM_ICDF(12945), - AOM_ICDF(14726), AOM_ICDF(14971), AOM_ICDF(16570), AOM_ICDF(19481), - AOM_ICDF(20260), AOM_ICDF(21921), AOM_ICDF(27980), AOM_ICDF(30449), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(9523), AOM_ICDF(12199), - AOM_ICDF(13764), AOM_ICDF(13972), AOM_ICDF(14926), AOM_ICDF(16320), - AOM_ICDF(17091), AOM_ICDF(18744), AOM_ICDF(26359), AOM_ICDF(29288), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(6160), AOM_ICDF(10318), AOM_ICDF(12718), - AOM_ICDF(14251), AOM_ICDF(14527), AOM_ICDF(15453), AOM_ICDF(17009), - AOM_ICDF(17625), AOM_ICDF(19045), AOM_ICDF(26335), AOM_ICDF(30079), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(6815), AOM_ICDF(9248), AOM_ICDF(12722), - AOM_ICDF(14141), AOM_ICDF(14301), AOM_ICDF(15095), AOM_ICDF(16200), - AOM_ICDF(17106), AOM_ICDF(18697), AOM_ICDF(26172), AOM_ICDF(28388), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4096), AOM_ICDF(6672), AOM_ICDF(11055), AOM_ICDF(16327), - AOM_ICDF(17508), AOM_ICDF(17671), AOM_ICDF(18733), AOM_ICDF(19994), - AOM_ICDF(20742), AOM_ICDF(22151), AOM_ICDF(27708), AOM_ICDF(30021), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(7936), AOM_ICDF(9197), AOM_ICDF(13524), AOM_ICDF(16819), - AOM_ICDF(18267), AOM_ICDF(18636), AOM_ICDF(19409), AOM_ICDF(20661), - AOM_ICDF(21323), AOM_ICDF(22307), AOM_ICDF(27905), AOM_ICDF(30678), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(7302), AOM_ICDF(16951), AOM_ICDF(18383), - AOM_ICDF(19388), AOM_ICDF(19608), AOM_ICDF(20225), AOM_ICDF(21597), - AOM_ICDF(21946), AOM_ICDF(22538), AOM_ICDF(27613), AOM_ICDF(31318), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(5987), AOM_ICDF(8184), AOM_ICDF(19612), - AOM_ICDF(20392), AOM_ICDF(20476), AOM_ICDF(21100), AOM_ICDF(21693), - AOM_ICDF(22428), AOM_ICDF(23963), AOM_ICDF(28709), AOM_ICDF(30342), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(9588), AOM_ICDF(12395), AOM_ICDF(14447), - AOM_ICDF(16163), AOM_ICDF(16374), AOM_ICDF(18743), AOM_ICDF(20606), - AOM_ICDF(21271), AOM_ICDF(23786), AOM_ICDF(28768), AOM_ICDF(30877), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(10069), AOM_ICDF(11965), - AOM_ICDF(15976), AOM_ICDF(16719), AOM_ICDF(17973), AOM_ICDF(19880), - AOM_ICDF(21139), AOM_ICDF(22275), AOM_ICDF(28259), AOM_ICDF(30954), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3968), AOM_ICDF(5431), AOM_ICDF(10557), AOM_ICDF(12069), - AOM_ICDF(14280), AOM_ICDF(18973), AOM_ICDF(20374), AOM_ICDF(23037), - AOM_ICDF(24215), AOM_ICDF(25050), AOM_ICDF(29271), AOM_ICDF(31716), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(7061), AOM_ICDF(9672), AOM_ICDF(12246), - AOM_ICDF(15351), AOM_ICDF(15717), AOM_ICDF(16716), AOM_ICDF(18158), - AOM_ICDF(21126), AOM_ICDF(22672), AOM_ICDF(28035), AOM_ICDF(30494), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(7204), AOM_ICDF(9700), AOM_ICDF(13252), - AOM_ICDF(14599), AOM_ICDF(14926), AOM_ICDF(15902), AOM_ICDF(17220), - AOM_ICDF(18010), AOM_ICDF(22795), AOM_ICDF(28405), AOM_ICDF(30467), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(8427), AOM_ICDF(12420), AOM_ICDF(14171), - AOM_ICDF(15792), AOM_ICDF(16156), AOM_ICDF(17584), AOM_ICDF(20846), - AOM_ICDF(21451), AOM_ICDF(22556), AOM_ICDF(28101), AOM_ICDF(31054), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5248), AOM_ICDF(6431), AOM_ICDF(10855), AOM_ICDF(13296), - AOM_ICDF(14848), AOM_ICDF(15135), AOM_ICDF(15893), AOM_ICDF(17277), - AOM_ICDF(17943), AOM_ICDF(19275), AOM_ICDF(26443), AOM_ICDF(30174), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(6050), AOM_ICDF(12103), AOM_ICDF(14343), - AOM_ICDF(15633), AOM_ICDF(15978), AOM_ICDF(16699), AOM_ICDF(18205), - AOM_ICDF(18660), AOM_ICDF(19707), AOM_ICDF(26544), AOM_ICDF(30872), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(7166), AOM_ICDF(11066), AOM_ICDF(14088), - AOM_ICDF(15377), AOM_ICDF(15644), AOM_ICDF(16447), AOM_ICDF(17786), - AOM_ICDF(18605), AOM_ICDF(19822), AOM_ICDF(27104), AOM_ICDF(29648), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(7358), AOM_ICDF(13016), AOM_ICDF(18200), - AOM_ICDF(19015), AOM_ICDF(19189), AOM_ICDF(20038), AOM_ICDF(21430), - AOM_ICDF(21917), AOM_ICDF(22977), AOM_ICDF(27949), AOM_ICDF(30848), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(7296), AOM_ICDF(8490), AOM_ICDF(11145), AOM_ICDF(15318), - AOM_ICDF(16693), AOM_ICDF(16889), AOM_ICDF(17571), AOM_ICDF(18580), - AOM_ICDF(19688), AOM_ICDF(21272), AOM_ICDF(27245), AOM_ICDF(28971), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(7623), AOM_ICDF(16070), AOM_ICDF(18136), - AOM_ICDF(19225), AOM_ICDF(19397), AOM_ICDF(20128), AOM_ICDF(21362), - AOM_ICDF(21808), AOM_ICDF(22621), AOM_ICDF(27932), AOM_ICDF(30407), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3200), AOM_ICDF(5164), AOM_ICDF(6566), AOM_ICDF(18368), - AOM_ICDF(19106), AOM_ICDF(19155), AOM_ICDF(19793), AOM_ICDF(20300), - AOM_ICDF(21177), AOM_ICDF(23079), AOM_ICDF(27848), AOM_ICDF(28924), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(8146), AOM_ICDF(10550), AOM_ICDF(12876), - AOM_ICDF(14506), AOM_ICDF(14629), AOM_ICDF(17180), AOM_ICDF(19129), - AOM_ICDF(20088), AOM_ICDF(23407), AOM_ICDF(28673), AOM_ICDF(30257), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(7166), AOM_ICDF(9466), AOM_ICDF(11999), - AOM_ICDF(15723), AOM_ICDF(16293), AOM_ICDF(17580), AOM_ICDF(19004), - AOM_ICDF(20509), AOM_ICDF(22233), AOM_ICDF(28118), AOM_ICDF(29989), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(5422), AOM_ICDF(9054), AOM_ICDF(11018), - AOM_ICDF(13605), AOM_ICDF(17576), AOM_ICDF(19178), AOM_ICDF(21514), - AOM_ICDF(22877), AOM_ICDF(24461), AOM_ICDF(29069), AOM_ICDF(30933), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(8294), AOM_ICDF(12601), - AOM_ICDF(15043), AOM_ICDF(15273), AOM_ICDF(16230), AOM_ICDF(17134), - AOM_ICDF(20737), AOM_ICDF(22899), AOM_ICDF(28219), AOM_ICDF(29410), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(6815), AOM_ICDF(8336), AOM_ICDF(12965), - AOM_ICDF(14282), AOM_ICDF(14444), AOM_ICDF(15446), AOM_ICDF(16461), - AOM_ICDF(17544), AOM_ICDF(22183), AOM_ICDF(27682), AOM_ICDF(29132), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(8084), AOM_ICDF(10880), AOM_ICDF(12954), - AOM_ICDF(14527), AOM_ICDF(14728), AOM_ICDF(16490), AOM_ICDF(19224), - AOM_ICDF(20071), AOM_ICDF(21857), AOM_ICDF(27653), AOM_ICDF(30031), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(6660), AOM_ICDF(9006), AOM_ICDF(12205), - AOM_ICDF(13614), AOM_ICDF(13740), AOM_ICDF(14632), AOM_ICDF(15766), - AOM_ICDF(16629), AOM_ICDF(18394), AOM_ICDF(25918), AOM_ICDF(28460), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(6488), AOM_ICDF(9978), AOM_ICDF(12889), - AOM_ICDF(14419), AOM_ICDF(14607), AOM_ICDF(15458), AOM_ICDF(16743), - AOM_ICDF(17369), AOM_ICDF(19053), AOM_ICDF(26393), AOM_ICDF(29456), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(8542), AOM_ICDF(12830), - AOM_ICDF(13956), AOM_ICDF(14031), AOM_ICDF(14763), AOM_ICDF(15677), - AOM_ICDF(16545), AOM_ICDF(18256), AOM_ICDF(25569), AOM_ICDF(27284), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4096), AOM_ICDF(7008), AOM_ICDF(11436), AOM_ICDF(17228), - AOM_ICDF(18131), AOM_ICDF(18269), AOM_ICDF(19345), AOM_ICDF(20551), - AOM_ICDF(21315), AOM_ICDF(22836), AOM_ICDF(28035), AOM_ICDF(29865), - AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(6528), AOM_ICDF(10833), AOM_ICDF(17688), AOM_ICDF(21947), - AOM_ICDF(22829), AOM_ICDF(23814), AOM_ICDF(24514), AOM_ICDF(25707), - AOM_ICDF(26397), AOM_ICDF(27442), AOM_ICDF(30271), AOM_ICDF(31734), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(8679), AOM_ICDF(21100), AOM_ICDF(23075), - AOM_ICDF(23772), AOM_ICDF(24427), AOM_ICDF(25111), AOM_ICDF(26188), - AOM_ICDF(26445), AOM_ICDF(27235), AOM_ICDF(29980), AOM_ICDF(31875), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(2688), AOM_ICDF(6683), AOM_ICDF(9332), AOM_ICDF(22173), - AOM_ICDF(22688), AOM_ICDF(22972), AOM_ICDF(23623), AOM_ICDF(24159), - AOM_ICDF(24798), AOM_ICDF(26666), AOM_ICDF(29812), AOM_ICDF(30909), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(8192), AOM_ICDF(10112), AOM_ICDF(13298), AOM_ICDF(16662), - AOM_ICDF(17623), AOM_ICDF(18394), AOM_ICDF(20921), AOM_ICDF(22309), - AOM_ICDF(22963), AOM_ICDF(26257), AOM_ICDF(29945), AOM_ICDF(31423), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(7604), AOM_ICDF(12617), AOM_ICDF(15628), - AOM_ICDF(18274), AOM_ICDF(20174), AOM_ICDF(21404), AOM_ICDF(22869), - AOM_ICDF(24184), AOM_ICDF(25626), AOM_ICDF(29615), AOM_ICDF(31155), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(10295), AOM_ICDF(18459), AOM_ICDF(21302), - AOM_ICDF(23034), AOM_ICDF(26284), AOM_ICDF(27576), AOM_ICDF(29746), - AOM_ICDF(30502), AOM_ICDF(31794), AOM_ICDF(32346), AOM_ICDF(32600), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4224), AOM_ICDF(6789), AOM_ICDF(11254), AOM_ICDF(15589), - AOM_ICDF(18568), AOM_ICDF(19238), AOM_ICDF(19872), AOM_ICDF(20880), - AOM_ICDF(24409), AOM_ICDF(26238), AOM_ICDF(29580), AOM_ICDF(30875), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(7388), AOM_ICDF(10164), AOM_ICDF(15886), - AOM_ICDF(16694), AOM_ICDF(17139), AOM_ICDF(18421), AOM_ICDF(19262), - AOM_ICDF(20106), AOM_ICDF(26734), AOM_ICDF(29987), AOM_ICDF(31160), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(8292), AOM_ICDF(13837), AOM_ICDF(16201), - AOM_ICDF(17303), AOM_ICDF(18422), AOM_ICDF(20215), AOM_ICDF(23059), - AOM_ICDF(23628), AOM_ICDF(25449), AOM_ICDF(29537), AOM_ICDF(31455), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4224), AOM_ICDF(7235), AOM_ICDF(12521), AOM_ICDF(16798), - AOM_ICDF(17964), AOM_ICDF(18136), AOM_ICDF(18936), AOM_ICDF(20233), - AOM_ICDF(20821), AOM_ICDF(22501), AOM_ICDF(27955), AOM_ICDF(30493), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3840), AOM_ICDF(7117), AOM_ICDF(13329), AOM_ICDF(17383), - AOM_ICDF(18323), AOM_ICDF(18492), AOM_ICDF(19273), AOM_ICDF(20538), - AOM_ICDF(21064), AOM_ICDF(22481), AOM_ICDF(27785), AOM_ICDF(30938), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(7474), AOM_ICDF(12414), AOM_ICDF(17230), - AOM_ICDF(18246), AOM_ICDF(18457), AOM_ICDF(19128), AOM_ICDF(20087), - AOM_ICDF(20830), AOM_ICDF(22602), AOM_ICDF(27923), AOM_ICDF(29929), - AOM_ICDF(32768), 0 }, - { AOM_ICDF(3584), AOM_ICDF(9626), AOM_ICDF(15412), AOM_ICDF(20788), - AOM_ICDF(21676), AOM_ICDF(22192), AOM_ICDF(23266), AOM_ICDF(24342), - AOM_ICDF(24836), AOM_ICDF(26447), AOM_ICDF(29583), AOM_ICDF(31300), - AOM_ICDF(32768), 0 }, + AOM_ICDF(4224), AOM_ICDF(8689), AOM_ICDF(13024), AOM_ICDF(13658), + AOM_ICDF(16637), AOM_ICDF(17307), AOM_ICDF(20836), AOM_ICDF(22665), + AOM_ICDF(23673), AOM_ICDF(27015), AOM_ICDF(28310), AOM_ICDF(30203), + AOM_ICDF(32768), 0, }, + { + AOM_ICDF(5120), AOM_ICDF(7896), AOM_ICDF(13618), AOM_ICDF(14900), + AOM_ICDF(15708), AOM_ICDF(16153), AOM_ICDF(16997), AOM_ICDF(23625), + AOM_ICDF(24466), AOM_ICDF(27719), AOM_ICDF(28892), AOM_ICDF(30500), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5760), AOM_ICDF(11305), AOM_ICDF(13669), AOM_ICDF(15462), + AOM_ICDF(16564), AOM_ICDF(17683), AOM_ICDF(18252), AOM_ICDF(20073), + AOM_ICDF(22917), AOM_ICDF(27005), AOM_ICDF(28923), AOM_ICDF(30236), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4224), AOM_ICDF(9510), AOM_ICDF(13787), AOM_ICDF(14587), + AOM_ICDF(15753), AOM_ICDF(15925), AOM_ICDF(16513), AOM_ICDF(18193), + AOM_ICDF(19490), AOM_ICDF(24944), AOM_ICDF(27482), AOM_ICDF(29757), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3840), AOM_ICDF(10052), AOM_ICDF(14106), AOM_ICDF(14887), + AOM_ICDF(15827), AOM_ICDF(15996), AOM_ICDF(16522), AOM_ICDF(17939), + AOM_ICDF(19204), AOM_ICDF(24508), AOM_ICDF(27661), AOM_ICDF(29491), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(4736), AOM_ICDF(9676), AOM_ICDF(14492), AOM_ICDF(15163), + AOM_ICDF(16179), AOM_ICDF(16390), AOM_ICDF(17133), AOM_ICDF(18905), + AOM_ICDF(19864), AOM_ICDF(25185), AOM_ICDF(27191), AOM_ICDF(30030), + AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(3584), AOM_ICDF(9370), AOM_ICDF(14746), AOM_ICDF(15820), + AOM_ICDF(16708), AOM_ICDF(17224), AOM_ICDF(17718), AOM_ICDF(19329), + AOM_ICDF(20405), AOM_ICDF(23541), AOM_ICDF(25258), AOM_ICDF(26726), + AOM_ICDF(32768), 0, + }, + }, #else + { + { + AOM_ICDF(15488), AOM_ICDF(18706), AOM_ICDF(22561), AOM_ICDF(23619), + AOM_ICDF(24954), AOM_ICDF(25782), AOM_ICDF(26710), AOM_ICDF(27861), + AOM_ICDF(28656), AOM_ICDF(30743), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11648), AOM_ICDF(18744), AOM_ICDF(20846), AOM_ICDF(22100), + AOM_ICDF(23332), AOM_ICDF(24337), AOM_ICDF(25093), AOM_ICDF(26104), + AOM_ICDF(27097), AOM_ICDF(29633), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(10732), AOM_ICDF(22507), AOM_ICDF(23254), + AOM_ICDF(24382), AOM_ICDF(24876), AOM_ICDF(25827), AOM_ICDF(27488), + AOM_ICDF(28040), AOM_ICDF(30108), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(13568), AOM_ICDF(16981), AOM_ICDF(19885), AOM_ICDF(22014), + AOM_ICDF(23543), AOM_ICDF(24658), AOM_ICDF(25641), AOM_ICDF(27378), + AOM_ICDF(28625), AOM_ICDF(31043), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(12225), AOM_ICDF(14408), AOM_ICDF(16033), + AOM_ICDF(19544), AOM_ICDF(22318), AOM_ICDF(23960), AOM_ICDF(25617), + AOM_ICDF(26522), AOM_ICDF(30596), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12160), AOM_ICDF(15078), AOM_ICDF(16990), AOM_ICDF(18964), + AOM_ICDF(22725), AOM_ICDF(25793), AOM_ICDF(27133), AOM_ICDF(28447), + AOM_ICDF(30831), AOM_ICDF(30836), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(11274), AOM_ICDF(15818), AOM_ICDF(16940), + AOM_ICDF(21178), AOM_ICDF(22338), AOM_ICDF(26171), AOM_ICDF(27754), + AOM_ICDF(28503), AOM_ICDF(31473), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10880), AOM_ICDF(13846), AOM_ICDF(18649), AOM_ICDF(20252), + AOM_ICDF(22157), AOM_ICDF(22992), AOM_ICDF(24396), AOM_ICDF(27581), + AOM_ICDF(28501), AOM_ICDF(31400), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11008), AOM_ICDF(13462), AOM_ICDF(15747), AOM_ICDF(18378), + AOM_ICDF(20085), AOM_ICDF(21663), AOM_ICDF(22766), AOM_ICDF(24635), + AOM_ICDF(27476), AOM_ICDF(30643), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10112), AOM_ICDF(13147), AOM_ICDF(16135), AOM_ICDF(17577), + AOM_ICDF(19681), AOM_ICDF(19689), AOM_ICDF(20856), AOM_ICDF(22374), + AOM_ICDF(24454), AOM_ICDF(30555), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(12176), AOM_ICDF(17582), AOM_ICDF(18905), + AOM_ICDF(19994), AOM_ICDF(20669), AOM_ICDF(21635), AOM_ICDF(23564), + AOM_ICDF(24741), AOM_ICDF(27222), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(8448), AOM_ICDF(18738), AOM_ICDF(21694), AOM_ICDF(22413), + AOM_ICDF(23358), AOM_ICDF(24675), AOM_ICDF(25193), AOM_ICDF(26119), + AOM_ICDF(27310), AOM_ICDF(30773), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(22027), AOM_ICDF(23242), AOM_ICDF(23986), + AOM_ICDF(24529), AOM_ICDF(25363), AOM_ICDF(25646), AOM_ICDF(26087), + AOM_ICDF(27130), AOM_ICDF(30218), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(13862), AOM_ICDF(21137), AOM_ICDF(22124), + AOM_ICDF(23036), AOM_ICDF(23803), AOM_ICDF(24458), AOM_ICDF(26390), + AOM_ICDF(27342), AOM_ICDF(30968), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(17409), AOM_ICDF(19830), AOM_ICDF(21521), + AOM_ICDF(22580), AOM_ICDF(23726), AOM_ICDF(24377), AOM_ICDF(25679), + AOM_ICDF(27269), AOM_ICDF(30867), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(15832), AOM_ICDF(17559), AOM_ICDF(18777), + AOM_ICDF(20425), AOM_ICDF(22719), AOM_ICDF(23447), AOM_ICDF(24952), + AOM_ICDF(26527), AOM_ICDF(30950), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7808), AOM_ICDF(18730), AOM_ICDF(20143), AOM_ICDF(21445), + AOM_ICDF(23347), AOM_ICDF(26267), AOM_ICDF(27229), AOM_ICDF(28315), + AOM_ICDF(30911), AOM_ICDF(30915), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(14299), AOM_ICDF(17264), AOM_ICDF(18505), + AOM_ICDF(20765), AOM_ICDF(22440), AOM_ICDF(24331), AOM_ICDF(26038), + AOM_ICDF(27481), AOM_ICDF(31448), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8832), AOM_ICDF(15726), AOM_ICDF(19455), AOM_ICDF(20668), + AOM_ICDF(21607), AOM_ICDF(22655), AOM_ICDF(23384), AOM_ICDF(26356), + AOM_ICDF(27697), AOM_ICDF(31459), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8192), AOM_ICDF(17385), AOM_ICDF(18866), AOM_ICDF(20120), + AOM_ICDF(21273), AOM_ICDF(22853), AOM_ICDF(23470), AOM_ICDF(24881), + AOM_ICDF(27216), AOM_ICDF(31040), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(16341), AOM_ICDF(18497), AOM_ICDF(19439), + AOM_ICDF(20706), AOM_ICDF(20711), AOM_ICDF(21234), AOM_ICDF(22307), + AOM_ICDF(23950), AOM_ICDF(30728), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6400), AOM_ICDF(17625), AOM_ICDF(20326), AOM_ICDF(21821), + AOM_ICDF(22568), AOM_ICDF(23415), AOM_ICDF(23854), AOM_ICDF(24896), + AOM_ICDF(26171), AOM_ICDF(29575), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(12032), AOM_ICDF(14259), AOM_ICDF(22597), AOM_ICDF(23443), + AOM_ICDF(24581), AOM_ICDF(25079), AOM_ICDF(26399), AOM_ICDF(27862), + AOM_ICDF(28509), AOM_ICDF(30419), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9216), AOM_ICDF(14883), AOM_ICDF(20941), AOM_ICDF(21958), + AOM_ICDF(23597), AOM_ICDF(24328), AOM_ICDF(25208), AOM_ICDF(26590), + AOM_ICDF(27377), AOM_ICDF(29364), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(8088), AOM_ICDF(24407), AOM_ICDF(25006), + AOM_ICDF(25777), AOM_ICDF(25950), AOM_ICDF(26882), AOM_ICDF(28811), + AOM_ICDF(29159), AOM_ICDF(30636), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11904), AOM_ICDF(14425), AOM_ICDF(18729), AOM_ICDF(20730), + AOM_ICDF(21998), AOM_ICDF(22686), AOM_ICDF(23856), AOM_ICDF(26580), + AOM_ICDF(27613), AOM_ICDF(29834), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10752), AOM_ICDF(12784), AOM_ICDF(16305), AOM_ICDF(17624), + AOM_ICDF(20320), AOM_ICDF(22450), AOM_ICDF(24380), AOM_ICDF(26773), + AOM_ICDF(27837), AOM_ICDF(30016), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(14090), AOM_ICDF(18314), AOM_ICDF(20621), + AOM_ICDF(23539), AOM_ICDF(25261), AOM_ICDF(26953), AOM_ICDF(28692), + AOM_ICDF(30064), AOM_ICDF(30071), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(10229), AOM_ICDF(16542), AOM_ICDF(17725), + AOM_ICDF(21504), AOM_ICDF(22332), AOM_ICDF(26006), AOM_ICDF(27895), + AOM_ICDF(28487), AOM_ICDF(31248), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9728), AOM_ICDF(11162), AOM_ICDF(19379), AOM_ICDF(20981), + AOM_ICDF(22356), AOM_ICDF(22926), AOM_ICDF(24318), AOM_ICDF(28364), + AOM_ICDF(29020), AOM_ICDF(31328), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9216), AOM_ICDF(10861), AOM_ICDF(14850), AOM_ICDF(16471), + AOM_ICDF(18611), AOM_ICDF(19674), AOM_ICDF(21009), AOM_ICDF(23454), + AOM_ICDF(26078), AOM_ICDF(29272), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7808), AOM_ICDF(10132), AOM_ICDF(17327), AOM_ICDF(18472), + AOM_ICDF(20126), AOM_ICDF(20132), AOM_ICDF(21599), AOM_ICDF(23338), + AOM_ICDF(24514), AOM_ICDF(29843), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(9210), AOM_ICDF(19309), AOM_ICDF(20715), + AOM_ICDF(21833), AOM_ICDF(22262), AOM_ICDF(23353), AOM_ICDF(24942), + AOM_ICDF(25800), AOM_ICDF(28200), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(12288), AOM_ICDF(15040), AOM_ICDF(18401), AOM_ICDF(21071), + AOM_ICDF(22800), AOM_ICDF(23945), AOM_ICDF(25274), AOM_ICDF(26939), + AOM_ICDF(28554), AOM_ICDF(31328), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9344), AOM_ICDF(17170), AOM_ICDF(19325), AOM_ICDF(22119), + AOM_ICDF(23284), AOM_ICDF(24378), AOM_ICDF(24911), AOM_ICDF(26095), + AOM_ICDF(27781), AOM_ICDF(31121), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9344), AOM_ICDF(11650), AOM_ICDF(19788), AOM_ICDF(21928), + AOM_ICDF(22916), AOM_ICDF(23571), AOM_ICDF(24362), AOM_ICDF(26633), + AOM_ICDF(27946), AOM_ICDF(31212), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12928), AOM_ICDF(14428), AOM_ICDF(17080), AOM_ICDF(20882), + AOM_ICDF(22104), AOM_ICDF(23149), AOM_ICDF(23715), AOM_ICDF(27167), + AOM_ICDF(28932), AOM_ICDF(31218), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(11962), AOM_ICDF(13849), AOM_ICDF(16880), + AOM_ICDF(19818), AOM_ICDF(21895), AOM_ICDF(23000), AOM_ICDF(25923), + AOM_ICDF(27961), AOM_ICDF(31380), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10240), AOM_ICDF(13336), AOM_ICDF(15505), AOM_ICDF(18844), + AOM_ICDF(21646), AOM_ICDF(24723), AOM_ICDF(25832), AOM_ICDF(27802), + AOM_ICDF(31088), AOM_ICDF(31096), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(10683), AOM_ICDF(14446), AOM_ICDF(17035), + AOM_ICDF(20211), AOM_ICDF(21577), AOM_ICDF(24370), AOM_ICDF(26477), + AOM_ICDF(28223), AOM_ICDF(31734), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12928), AOM_ICDF(17358), AOM_ICDF(19982), AOM_ICDF(22123), + AOM_ICDF(23335), AOM_ICDF(23948), AOM_ICDF(24890), AOM_ICDF(28884), + AOM_ICDF(30197), AOM_ICDF(32148), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(12429), AOM_ICDF(16401), AOM_ICDF(20493), + AOM_ICDF(21471), AOM_ICDF(22433), AOM_ICDF(23162), AOM_ICDF(24686), + AOM_ICDF(29027), AOM_ICDF(31115), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(12157), AOM_ICDF(14796), AOM_ICDF(17676), + AOM_ICDF(19754), AOM_ICDF(19762), AOM_ICDF(20641), AOM_ICDF(23274), + AOM_ICDF(25569), AOM_ICDF(31058), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7296), AOM_ICDF(11083), AOM_ICDF(15313), AOM_ICDF(20550), + AOM_ICDF(21783), AOM_ICDF(22727), AOM_ICDF(23461), AOM_ICDF(25072), + AOM_ICDF(27195), AOM_ICDF(30380), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(10880), AOM_ICDF(13214), AOM_ICDF(15829), AOM_ICDF(16866), + AOM_ICDF(20613), AOM_ICDF(22316), AOM_ICDF(24539), AOM_ICDF(27077), + AOM_ICDF(28116), AOM_ICDF(31485), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9984), AOM_ICDF(13868), AOM_ICDF(16397), AOM_ICDF(17486), + AOM_ICDF(20011), AOM_ICDF(22071), AOM_ICDF(23357), AOM_ICDF(24990), + AOM_ICDF(26336), AOM_ICDF(30276), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(8637), AOM_ICDF(17963), AOM_ICDF(18813), + AOM_ICDF(21065), AOM_ICDF(22052), AOM_ICDF(23502), AOM_ICDF(25702), + AOM_ICDF(26745), AOM_ICDF(30668), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(10682), AOM_ICDF(12496), AOM_ICDF(18240), + AOM_ICDF(20500), AOM_ICDF(21585), AOM_ICDF(23387), AOM_ICDF(25795), + AOM_ICDF(27119), AOM_ICDF(31001), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9856), AOM_ICDF(12056), AOM_ICDF(13722), AOM_ICDF(15196), + AOM_ICDF(19276), AOM_ICDF(21891), AOM_ICDF(23643), AOM_ICDF(25538), + AOM_ICDF(26854), AOM_ICDF(31515), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9984), AOM_ICDF(12963), AOM_ICDF(14960), AOM_ICDF(16734), + AOM_ICDF(21279), AOM_ICDF(25616), AOM_ICDF(27638), AOM_ICDF(28950), + AOM_ICDF(31161), AOM_ICDF(31166), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(8604), AOM_ICDF(12044), AOM_ICDF(13632), + AOM_ICDF(18931), AOM_ICDF(20553), AOM_ICDF(23452), AOM_ICDF(25800), + AOM_ICDF(27754), AOM_ICDF(31668), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11520), AOM_ICDF(13372), AOM_ICDF(16642), AOM_ICDF(18137), + AOM_ICDF(20232), AOM_ICDF(21510), AOM_ICDF(23052), AOM_ICDF(26792), + AOM_ICDF(27974), AOM_ICDF(31274), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10240), AOM_ICDF(12483), AOM_ICDF(14364), AOM_ICDF(16168), + AOM_ICDF(18668), AOM_ICDF(20707), AOM_ICDF(22158), AOM_ICDF(24410), + AOM_ICDF(26370), AOM_ICDF(30744), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8064), AOM_ICDF(10798), AOM_ICDF(13829), AOM_ICDF(15128), + AOM_ICDF(19136), AOM_ICDF(19152), AOM_ICDF(21057), AOM_ICDF(22583), + AOM_ICDF(24513), AOM_ICDF(30645), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(11025), AOM_ICDF(16073), AOM_ICDF(17603), + AOM_ICDF(20094), AOM_ICDF(21468), AOM_ICDF(22971), AOM_ICDF(24628), + AOM_ICDF(26015), AOM_ICDF(29728), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(10368), AOM_ICDF(15372), AOM_ICDF(18442), AOM_ICDF(19576), + AOM_ICDF(22674), AOM_ICDF(27128), AOM_ICDF(28232), AOM_ICDF(29624), + AOM_ICDF(31363), AOM_ICDF(31368), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9472), AOM_ICDF(16687), AOM_ICDF(18957), AOM_ICDF(20272), + AOM_ICDF(22852), AOM_ICDF(27082), AOM_ICDF(27839), AOM_ICDF(28995), + AOM_ICDF(30943), AOM_ICDF(30948), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8064), AOM_ICDF(12334), AOM_ICDF(19197), AOM_ICDF(20956), + AOM_ICDF(24804), AOM_ICDF(26553), AOM_ICDF(27556), AOM_ICDF(29877), + AOM_ICDF(31311), AOM_ICDF(31320), AOM_ICDF(32768), 0, + }, { - { AOM_ICDF(15488), AOM_ICDF(17513), AOM_ICDF(20731), AOM_ICDF(24586), - AOM_ICDF(25921), AOM_ICDF(26749), AOM_ICDF(27807), AOM_ICDF(28602), - AOM_ICDF(29530), AOM_ICDF(30681), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11648), AOM_ICDF(14783), AOM_ICDF(21879), AOM_ICDF(23981), - AOM_ICDF(25213), AOM_ICDF(26218), AOM_ICDF(27472), AOM_ICDF(28465), - AOM_ICDF(29221), AOM_ICDF(30232), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(11108), AOM_ICDF(13392), AOM_ICDF(25167), - AOM_ICDF(26295), AOM_ICDF(26789), AOM_ICDF(27536), AOM_ICDF(28088), - AOM_ICDF(29039), AOM_ICDF(30700), AOM_ICDF(32768), 0 }, - { AOM_ICDF(13568), AOM_ICDF(15293), AOM_ICDF(18706), AOM_ICDF(21610), - AOM_ICDF(23139), AOM_ICDF(24254), AOM_ICDF(26383), AOM_ICDF(27630), - AOM_ICDF(28613), AOM_ICDF(30350), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(11772), AOM_ICDF(14397), AOM_ICDF(16580), - AOM_ICDF(20091), AOM_ICDF(22865), AOM_ICDF(24490), AOM_ICDF(25395), - AOM_ICDF(27037), AOM_ICDF(28694), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12160), AOM_ICDF(14092), AOM_ICDF(17010), AOM_ICDF(18922), - AOM_ICDF(22683), AOM_ICDF(25751), AOM_ICDF(27725), AOM_ICDF(30109), - AOM_ICDF(31449), AOM_ICDF(32763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(10383), AOM_ICDF(12569), AOM_ICDF(17113), - AOM_ICDF(21351), AOM_ICDF(22511), AOM_ICDF(23633), AOM_ICDF(24382), - AOM_ICDF(28215), AOM_ICDF(29798), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10880), AOM_ICDF(12248), AOM_ICDF(15214), AOM_ICDF(20017), - AOM_ICDF(21922), AOM_ICDF(22757), AOM_ICDF(24360), AOM_ICDF(25280), - AOM_ICDF(26684), AOM_ICDF(29869), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(13133), AOM_ICDF(15587), AOM_ICDF(17872), - AOM_ICDF(19579), AOM_ICDF(21157), AOM_ICDF(23788), AOM_ICDF(26629), - AOM_ICDF(27732), AOM_ICDF(29601), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10112), AOM_ICDF(12325), AOM_ICDF(15360), AOM_ICDF(18348), - AOM_ICDF(20452), AOM_ICDF(20460), AOM_ICDF(21902), AOM_ICDF(23982), - AOM_ICDF(25149), AOM_ICDF(26667), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(14250), AOM_ICDF(17722), AOM_ICDF(23128), - AOM_ICDF(24217), AOM_ICDF(24892), AOM_ICDF(26215), AOM_ICDF(27392), - AOM_ICDF(28358), AOM_ICDF(30287), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(8448), AOM_ICDF(10443), AOM_ICDF(20733), AOM_ICDF(23689), - AOM_ICDF(24634), AOM_ICDF(25951), AOM_ICDF(26670), AOM_ICDF(27861), - AOM_ICDF(28379), AOM_ICDF(29305), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(9206), AOM_ICDF(24577), AOM_ICDF(25792), - AOM_ICDF(26335), AOM_ICDF(27169), AOM_ICDF(27913), AOM_ICDF(28956), - AOM_ICDF(29239), AOM_ICDF(29680), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(8968), AOM_ICDF(15662), AOM_ICDF(22937), - AOM_ICDF(23849), AOM_ICDF(24616), AOM_ICDF(25603), AOM_ICDF(26555), - AOM_ICDF(27210), AOM_ICDF(29142), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(11501), AOM_ICDF(19310), AOM_ICDF(21731), - AOM_ICDF(22790), AOM_ICDF(23936), AOM_ICDF(25627), AOM_ICDF(27217), - AOM_ICDF(27868), AOM_ICDF(29170), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(8730), AOM_ICDF(17650), AOM_ICDF(19377), - AOM_ICDF(21025), AOM_ICDF(23319), AOM_ICDF(24537), AOM_ICDF(26112), - AOM_ICDF(26840), AOM_ICDF(28345), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7808), AOM_ICDF(9661), AOM_ICDF(20583), AOM_ICDF(21996), - AOM_ICDF(23898), AOM_ICDF(26818), AOM_ICDF(28120), AOM_ICDF(30716), - AOM_ICDF(31678), AOM_ICDF(32764), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8104), AOM_ICDF(15619), AOM_ICDF(18584), - AOM_ICDF(20844), AOM_ICDF(22519), AOM_ICDF(23760), AOM_ICDF(25203), - AOM_ICDF(27094), AOM_ICDF(28801), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8832), AOM_ICDF(10141), AOM_ICDF(17035), AOM_ICDF(20764), - AOM_ICDF(21703), AOM_ICDF(22751), AOM_ICDF(23964), AOM_ICDF(25305), - AOM_ICDF(26034), AOM_ICDF(29006), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8192), AOM_ICDF(9920), AOM_ICDF(19113), AOM_ICDF(20594), - AOM_ICDF(21747), AOM_ICDF(23327), AOM_ICDF(24581), AOM_ICDF(26916), - AOM_ICDF(27533), AOM_ICDF(28944), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(8696), AOM_ICDF(18381), AOM_ICDF(20537), - AOM_ICDF(21804), AOM_ICDF(21809), AOM_ICDF(22751), AOM_ICDF(24394), - AOM_ICDF(24917), AOM_ICDF(25990), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6400), AOM_ICDF(9593), AOM_ICDF(20818), AOM_ICDF(23519), - AOM_ICDF(24266), AOM_ICDF(25113), AOM_ICDF(26608), AOM_ICDF(27883), - AOM_ICDF(28322), AOM_ICDF(29364), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(12032), AOM_ICDF(14381), AOM_ICDF(16608), AOM_ICDF(24946), - AOM_ICDF(26084), AOM_ICDF(26582), AOM_ICDF(27428), AOM_ICDF(28075), - AOM_ICDF(29395), AOM_ICDF(30858), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9216), AOM_ICDF(12620), AOM_ICDF(18287), AOM_ICDF(24345), - AOM_ICDF(25984), AOM_ICDF(26715), AOM_ICDF(27732), AOM_ICDF(28519), - AOM_ICDF(29399), AOM_ICDF(30781), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8916), AOM_ICDF(10220), AOM_ICDF(26539), - AOM_ICDF(27310), AOM_ICDF(27483), AOM_ICDF(28082), AOM_ICDF(28430), - AOM_ICDF(29362), AOM_ICDF(31291), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11904), AOM_ICDF(14838), AOM_ICDF(17359), AOM_ICDF(21663), - AOM_ICDF(22931), AOM_ICDF(23619), AOM_ICDF(25620), AOM_ICDF(26653), - AOM_ICDF(27823), AOM_ICDF(30547), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10752), AOM_ICDF(13504), AOM_ICDF(15536), AOM_ICDF(19057), - AOM_ICDF(21753), AOM_ICDF(23883), AOM_ICDF(25202), AOM_ICDF(26266), - AOM_ICDF(28196), AOM_ICDF(30589), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10496), AOM_ICDF(13193), AOM_ICDF(16787), AOM_ICDF(21011), - AOM_ICDF(23929), AOM_ICDF(25651), AOM_ICDF(27958), AOM_ICDF(29330), - AOM_ICDF(31022), AOM_ICDF(32761), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(9968), AOM_ICDF(11749), AOM_ICDF(18062), - AOM_ICDF(21841), AOM_ICDF(22669), AOM_ICDF(23852), AOM_ICDF(24444), - AOM_ICDF(28118), AOM_ICDF(30007), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9728), AOM_ICDF(11168), AOM_ICDF(12602), AOM_ICDF(20819), - AOM_ICDF(22194), AOM_ICDF(22764), AOM_ICDF(24366), AOM_ICDF(25022), - AOM_ICDF(26414), AOM_ICDF(30460), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9216), AOM_ICDF(12712), AOM_ICDF(14357), AOM_ICDF(18346), - AOM_ICDF(20486), AOM_ICDF(21549), AOM_ICDF(23170), AOM_ICDF(25794), - AOM_ICDF(27129), AOM_ICDF(29574), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7808), AOM_ICDF(10733), AOM_ICDF(13057), AOM_ICDF(20252), - AOM_ICDF(21906), AOM_ICDF(21912), AOM_ICDF(23057), AOM_ICDF(24233), - AOM_ICDF(25700), AOM_ICDF(27439), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(11352), AOM_ICDF(13778), AOM_ICDF(23877), - AOM_ICDF(24995), AOM_ICDF(25424), AOM_ICDF(26830), AOM_ICDF(27688), - AOM_ICDF(28779), AOM_ICDF(30368), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(12288), AOM_ICDF(13728), AOM_ICDF(16480), AOM_ICDF(19841), - AOM_ICDF(21570), AOM_ICDF(22715), AOM_ICDF(25385), AOM_ICDF(27000), - AOM_ICDF(28329), AOM_ICDF(29994), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(10991), AOM_ICDF(18817), AOM_ICDF(20972), - AOM_ICDF(22137), AOM_ICDF(23231), AOM_ICDF(26025), AOM_ICDF(27711), - AOM_ICDF(28244), AOM_ICDF(29428), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(10900), AOM_ICDF(13206), AOM_ICDF(21344), - AOM_ICDF(22332), AOM_ICDF(22987), AOM_ICDF(25127), AOM_ICDF(26440), - AOM_ICDF(27231), AOM_ICDF(29502), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12928), AOM_ICDF(14478), AOM_ICDF(15978), AOM_ICDF(18630), - AOM_ICDF(19852), AOM_ICDF(20897), AOM_ICDF(24699), AOM_ICDF(26464), - AOM_ICDF(27030), AOM_ICDF(30482), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(10476), AOM_ICDF(13350), AOM_ICDF(15237), - AOM_ICDF(18175), AOM_ICDF(20252), AOM_ICDF(23283), AOM_ICDF(25321), - AOM_ICDF(26426), AOM_ICDF(29349), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10240), AOM_ICDF(11912), AOM_ICDF(15008), AOM_ICDF(17177), - AOM_ICDF(19979), AOM_ICDF(23056), AOM_ICDF(26395), AOM_ICDF(29681), - AOM_ICDF(30790), AOM_ICDF(32760), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(9738), AOM_ICDF(11717), AOM_ICDF(15480), - AOM_ICDF(18656), AOM_ICDF(20022), AOM_ICDF(22611), AOM_ICDF(24357), - AOM_ICDF(27150), AOM_ICDF(29257), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12928), AOM_ICDF(13548), AOM_ICDF(17978), AOM_ICDF(20602), - AOM_ICDF(21814), AOM_ICDF(22427), AOM_ICDF(24568), AOM_ICDF(25881), - AOM_ICDF(26823), AOM_ICDF(30817), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10496), AOM_ICDF(12149), AOM_ICDF(14082), AOM_ICDF(18054), - AOM_ICDF(19032), AOM_ICDF(19994), AOM_ICDF(24086), AOM_ICDF(28427), - AOM_ICDF(29156), AOM_ICDF(30680), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(10158), AOM_ICDF(13867), AOM_ICDF(16506), - AOM_ICDF(18584), AOM_ICDF(18592), AOM_ICDF(21472), AOM_ICDF(23767), - AOM_ICDF(24646), AOM_ICDF(27279), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7296), AOM_ICDF(9684), AOM_ICDF(13471), AOM_ICDF(17701), - AOM_ICDF(18934), AOM_ICDF(19878), AOM_ICDF(25115), AOM_ICDF(27238), - AOM_ICDF(27972), AOM_ICDF(29583), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(10880), AOM_ICDF(12163), AOM_ICDF(14497), AOM_ICDF(17112), - AOM_ICDF(20859), AOM_ICDF(22562), AOM_ICDF(23599), AOM_ICDF(24638), - AOM_ICDF(26861), AOM_ICDF(29399), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(12476), AOM_ICDF(16360), AOM_ICDF(18889), - AOM_ICDF(21414), AOM_ICDF(23474), AOM_ICDF(24563), AOM_ICDF(25909), - AOM_ICDF(27195), AOM_ICDF(28828), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(9268), AOM_ICDF(10737), AOM_ICDF(20063), - AOM_ICDF(22315), AOM_ICDF(23302), AOM_ICDF(24152), AOM_ICDF(25195), - AOM_ICDF(26645), AOM_ICDF(28845), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(10727), AOM_ICDF(12449), AOM_ICDF(14263), - AOM_ICDF(16523), AOM_ICDF(17608), AOM_ICDF(23352), AOM_ICDF(24676), - AOM_ICDF(26478), AOM_ICDF(28886), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(11109), AOM_ICDF(13309), AOM_ICDF(14975), - AOM_ICDF(19055), AOM_ICDF(21670), AOM_ICDF(23144), AOM_ICDF(24460), - AOM_ICDF(26212), AOM_ICDF(28107), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(11586), AOM_ICDF(14565), AOM_ICDF(16562), - AOM_ICDF(21107), AOM_ICDF(25444), AOM_ICDF(27218), AOM_ICDF(29429), - AOM_ICDF(31451), AOM_ICDF(32763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(8268), AOM_ICDF(9704), AOM_ICDF(13144), - AOM_ICDF(18443), AOM_ICDF(20065), AOM_ICDF(21653), AOM_ICDF(23607), - AOM_ICDF(26506), AOM_ICDF(28854), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11520), AOM_ICDF(13014), AOM_ICDF(14866), AOM_ICDF(18136), - AOM_ICDF(20231), AOM_ICDF(21509), AOM_ICDF(23004), AOM_ICDF(24186), - AOM_ICDF(25728), AOM_ICDF(29468), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10240), AOM_ICDF(12264), AOM_ICDF(14507), AOM_ICDF(16388), - AOM_ICDF(18888), AOM_ICDF(20927), AOM_ICDF(22731), AOM_ICDF(24691), - AOM_ICDF(26142), AOM_ICDF(28394), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8064), AOM_ICDF(10187), AOM_ICDF(12921), AOM_ICDF(15952), - AOM_ICDF(19960), AOM_ICDF(19976), AOM_ICDF(21275), AOM_ICDF(23205), - AOM_ICDF(25110), AOM_ICDF(26636), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(11488), AOM_ICDF(14065), AOM_ICDF(19113), - AOM_ICDF(21604), AOM_ICDF(22978), AOM_ICDF(24508), AOM_ICDF(25895), - AOM_ICDF(27398), AOM_ICDF(29055), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(10368), AOM_ICDF(11768), AOM_ICDF(16772), AOM_ICDF(19842), - AOM_ICDF(22940), AOM_ICDF(27394), AOM_ICDF(28528), AOM_ICDF(30267), - AOM_ICDF(31371), AOM_ICDF(32763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9472), AOM_ICDF(11292), AOM_ICDF(18507), AOM_ICDF(20777), - AOM_ICDF(23357), AOM_ICDF(27587), AOM_ICDF(28902), AOM_ICDF(30850), - AOM_ICDF(31607), AOM_ICDF(32763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8064), AOM_ICDF(9512), AOM_ICDF(13782), AOM_ICDF(20645), - AOM_ICDF(24493), AOM_ICDF(26242), AOM_ICDF(28001), AOM_ICDF(29435), - AOM_ICDF(30438), AOM_ICDF(32759), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(10541), AOM_ICDF(15664), AOM_ICDF(17639), - AOM_ICDF(19646), AOM_ICDF(22145), AOM_ICDF(25216), AOM_ICDF(28815), - AOM_ICDF(30050), AOM_ICDF(32757), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(11141), AOM_ICDF(15365), AOM_ICDF(16746), - AOM_ICDF(21186), AOM_ICDF(25766), AOM_ICDF(27817), AOM_ICDF(30022), - AOM_ICDF(31309), AOM_ICDF(32762), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9216), AOM_ICDF(10688), AOM_ICDF(16639), AOM_ICDF(17735), - AOM_ICDF(21499), AOM_ICDF(26657), AOM_ICDF(28161), AOM_ICDF(30572), - AOM_ICDF(31490), AOM_ICDF(32763), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(9303), AOM_ICDF(13611), AOM_ICDF(16636), - AOM_ICDF(20555), AOM_ICDF(23414), AOM_ICDF(24912), AOM_ICDF(27613), - AOM_ICDF(29727), AOM_ICDF(32756), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(11052), AOM_ICDF(16142), AOM_ICDF(19312), - AOM_ICDF(21680), AOM_ICDF(23870), AOM_ICDF(25504), AOM_ICDF(28200), - AOM_ICDF(29324), AOM_ICDF(32755), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10496), AOM_ICDF(12323), AOM_ICDF(16955), AOM_ICDF(18839), - AOM_ICDF(21144), AOM_ICDF(24861), AOM_ICDF(26838), AOM_ICDF(29988), - AOM_ICDF(30976), AOM_ICDF(32761), AOM_ICDF(32768), 0 }, - { AOM_ICDF(2944), AOM_ICDF(5973), AOM_ICDF(8904), AOM_ICDF(11875), - AOM_ICDF(14864), AOM_ICDF(17853), AOM_ICDF(20824), AOM_ICDF(23810), - AOM_ICDF(26784), AOM_ICDF(29776), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(10097), AOM_ICDF(15588), AOM_ICDF(20217), - AOM_ICDF(23899), AOM_ICDF(26460), AOM_ICDF(28308), AOM_ICDF(30155), - AOM_ICDF(30951), AOM_ICDF(32761), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(11648), AOM_ICDF(13133), AOM_ICDF(15050), AOM_ICDF(20481), - AOM_ICDF(22470), AOM_ICDF(23425), AOM_ICDF(24337), AOM_ICDF(25160), - AOM_ICDF(28964), AOM_ICDF(30480), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10240), AOM_ICDF(12616), AOM_ICDF(16631), AOM_ICDF(20485), - AOM_ICDF(22290), AOM_ICDF(23628), AOM_ICDF(25235), AOM_ICDF(26353), - AOM_ICDF(28107), AOM_ICDF(29655), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8002), AOM_ICDF(9066), AOM_ICDF(20038), - AOM_ICDF(22926), AOM_ICDF(23324), AOM_ICDF(23951), AOM_ICDF(24537), - AOM_ICDF(26916), AOM_ICDF(30231), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11904), AOM_ICDF(14105), AOM_ICDF(15782), AOM_ICDF(19896), - AOM_ICDF(22283), AOM_ICDF(23147), AOM_ICDF(24763), AOM_ICDF(25983), - AOM_ICDF(27812), AOM_ICDF(29980), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10624), AOM_ICDF(11922), AOM_ICDF(13632), AOM_ICDF(15941), - AOM_ICDF(20469), AOM_ICDF(22453), AOM_ICDF(24065), AOM_ICDF(25187), - AOM_ICDF(27349), AOM_ICDF(29296), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12032), AOM_ICDF(13085), AOM_ICDF(15468), AOM_ICDF(17768), - AOM_ICDF(20613), AOM_ICDF(24388), AOM_ICDF(26385), AOM_ICDF(28430), - AOM_ICDF(30938), AOM_ICDF(32761), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9728), AOM_ICDF(10538), AOM_ICDF(11493), AOM_ICDF(14765), - AOM_ICDF(18460), AOM_ICDF(19471), AOM_ICDF(20302), AOM_ICDF(20935), - AOM_ICDF(28192), AOM_ICDF(29926), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(9890), AOM_ICDF(10962), AOM_ICDF(16685), - AOM_ICDF(18880), AOM_ICDF(19480), AOM_ICDF(20674), AOM_ICDF(21477), - AOM_ICDF(23815), AOM_ICDF(29341), AOM_ICDF(32768), 0 }, - { AOM_ICDF(14592), AOM_ICDF(16367), AOM_ICDF(17712), AOM_ICDF(20293), - AOM_ICDF(22544), AOM_ICDF(23829), AOM_ICDF(24877), AOM_ICDF(26326), - AOM_ICDF(27660), AOM_ICDF(29875), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(10448), AOM_ICDF(12279), AOM_ICDF(16206), - AOM_ICDF(18672), AOM_ICDF(18682), AOM_ICDF(20058), AOM_ICDF(21547), - AOM_ICDF(25097), AOM_ICDF(27165), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11136), AOM_ICDF(13840), AOM_ICDF(15762), AOM_ICDF(21710), - AOM_ICDF(23038), AOM_ICDF(23734), AOM_ICDF(24863), AOM_ICDF(25882), - AOM_ICDF(27765), AOM_ICDF(30071), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(12544), AOM_ICDF(14124), AOM_ICDF(16964), AOM_ICDF(21907), - AOM_ICDF(23808), AOM_ICDF(24496), AOM_ICDF(25724), AOM_ICDF(26715), - AOM_ICDF(27992), AOM_ICDF(30455), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10368), AOM_ICDF(13606), AOM_ICDF(18247), AOM_ICDF(20869), - AOM_ICDF(22590), AOM_ICDF(23749), AOM_ICDF(25088), AOM_ICDF(26378), - AOM_ICDF(27277), AOM_ICDF(29808), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(11031), AOM_ICDF(12899), AOM_ICDF(23497), - AOM_ICDF(24465), AOM_ICDF(24851), AOM_ICDF(25995), AOM_ICDF(26815), - AOM_ICDF(27885), AOM_ICDF(30555), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11520), AOM_ICDF(14342), AOM_ICDF(15710), AOM_ICDF(19196), - AOM_ICDF(21250), AOM_ICDF(21907), AOM_ICDF(24665), AOM_ICDF(26153), - AOM_ICDF(27212), AOM_ICDF(30750), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(11764), AOM_ICDF(13979), AOM_ICDF(16405), - AOM_ICDF(19279), AOM_ICDF(20658), AOM_ICDF(23354), AOM_ICDF(25266), - AOM_ICDF(26702), AOM_ICDF(29380), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10112), AOM_ICDF(12325), AOM_ICDF(15918), AOM_ICDF(19060), - AOM_ICDF(21829), AOM_ICDF(23882), AOM_ICDF(26277), AOM_ICDF(27697), - AOM_ICDF(30114), AOM_ICDF(32758), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(10534), AOM_ICDF(12184), AOM_ICDF(16208), - AOM_ICDF(19764), AOM_ICDF(20627), AOM_ICDF(22524), AOM_ICDF(23644), - AOM_ICDF(26887), AOM_ICDF(29782), AOM_ICDF(32768), 0 }, - { AOM_ICDF(12928), AOM_ICDF(14013), AOM_ICDF(15625), AOM_ICDF(19107), - AOM_ICDF(20654), AOM_ICDF(21451), AOM_ICDF(22910), AOM_ICDF(23873), - AOM_ICDF(24776), AOM_ICDF(30239), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10368), AOM_ICDF(12818), AOM_ICDF(14610), AOM_ICDF(17350), - AOM_ICDF(19568), AOM_ICDF(20710), AOM_ICDF(22971), AOM_ICDF(25114), - AOM_ICDF(26340), AOM_ICDF(29127), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(11192), AOM_ICDF(13720), AOM_ICDF(18429), - AOM_ICDF(20409), AOM_ICDF(20417), AOM_ICDF(22250), AOM_ICDF(23318), - AOM_ICDF(24647), AOM_ICDF(27248), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7808), AOM_ICDF(11416), AOM_ICDF(13918), AOM_ICDF(19028), - AOM_ICDF(20181), AOM_ICDF(20839), AOM_ICDF(24380), AOM_ICDF(26018), - AOM_ICDF(26967), AOM_ICDF(29845), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(9856), AOM_ICDF(11020), AOM_ICDF(14928), AOM_ICDF(18159), - AOM_ICDF(19421), AOM_ICDF(20921), AOM_ICDF(23466), AOM_ICDF(26664), - AOM_ICDF(27475), AOM_ICDF(28881), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(10302), AOM_ICDF(17323), AOM_ICDF(18907), - AOM_ICDF(19868), AOM_ICDF(21184), AOM_ICDF(24171), AOM_ICDF(28033), - AOM_ICDF(28625), AOM_ICDF(29353), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7936), AOM_ICDF(9197), AOM_ICDF(12604), AOM_ICDF(20616), - AOM_ICDF(21514), AOM_ICDF(22371), AOM_ICDF(24239), AOM_ICDF(26138), - AOM_ICDF(26863), AOM_ICDF(29239), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11264), AOM_ICDF(12524), AOM_ICDF(16083), AOM_ICDF(18574), - AOM_ICDF(19858), AOM_ICDF(20841), AOM_ICDF(24242), AOM_ICDF(27606), - AOM_ICDF(28352), AOM_ICDF(29853), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(10208), AOM_ICDF(13292), AOM_ICDF(15170), - AOM_ICDF(17277), AOM_ICDF(19226), AOM_ICDF(22083), AOM_ICDF(25046), - AOM_ICDF(26041), AOM_ICDF(27802), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(10568), AOM_ICDF(15511), AOM_ICDF(17246), - AOM_ICDF(20170), AOM_ICDF(22791), AOM_ICDF(25558), AOM_ICDF(30740), - AOM_ICDF(31635), AOM_ICDF(32764), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(8045), AOM_ICDF(10653), AOM_ICDF(13145), - AOM_ICDF(15286), AOM_ICDF(16614), AOM_ICDF(19075), AOM_ICDF(23140), - AOM_ICDF(26224), AOM_ICDF(28652), AOM_ICDF(32768), 0 }, - { AOM_ICDF(10240), AOM_ICDF(11032), AOM_ICDF(14258), AOM_ICDF(17629), - AOM_ICDF(18914), AOM_ICDF(19898), AOM_ICDF(22412), AOM_ICDF(24961), - AOM_ICDF(25815), AOM_ICDF(29156), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(12028), AOM_ICDF(14702), AOM_ICDF(16147), - AOM_ICDF(17209), AOM_ICDF(18160), AOM_ICDF(21812), AOM_ICDF(27547), - AOM_ICDF(28709), AOM_ICDF(30120), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(9068), AOM_ICDF(14160), AOM_ICDF(16937), - AOM_ICDF(18515), AOM_ICDF(18521), AOM_ICDF(20636), AOM_ICDF(24617), - AOM_ICDF(25317), AOM_ICDF(26365), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8510), AOM_ICDF(14195), AOM_ICDF(17148), - AOM_ICDF(18158), AOM_ICDF(19201), AOM_ICDF(23070), AOM_ICDF(27351), - AOM_ICDF(27901), AOM_ICDF(29422), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(10112), AOM_ICDF(11528), AOM_ICDF(15345), AOM_ICDF(19296), - AOM_ICDF(21394), AOM_ICDF(21402), AOM_ICDF(22379), AOM_ICDF(23840), - AOM_ICDF(24851), AOM_ICDF(26150), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8064), AOM_ICDF(10187), AOM_ICDF(17949), AOM_ICDF(20052), - AOM_ICDF(22051), AOM_ICDF(22059), AOM_ICDF(23147), AOM_ICDF(24688), - AOM_ICDF(25351), AOM_ICDF(26365), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(8373), AOM_ICDF(11041), AOM_ICDF(21963), - AOM_ICDF(23089), AOM_ICDF(23093), AOM_ICDF(24076), AOM_ICDF(24925), - AOM_ICDF(25691), AOM_ICDF(27764), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9600), AOM_ICDF(11229), AOM_ICDF(14847), AOM_ICDF(17527), - AOM_ICDF(19738), AOM_ICDF(19747), AOM_ICDF(21629), AOM_ICDF(23761), - AOM_ICDF(24957), AOM_ICDF(27673), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8960), AOM_ICDF(10262), AOM_ICDF(13339), AOM_ICDF(15480), - AOM_ICDF(19925), AOM_ICDF(19942), AOM_ICDF(21445), AOM_ICDF(23037), - AOM_ICDF(24329), AOM_ICDF(25977), AOM_ICDF(32768), 0 }, - { AOM_ICDF(2944), AOM_ICDF(5973), AOM_ICDF(8904), AOM_ICDF(11875), - AOM_ICDF(14864), AOM_ICDF(17853), AOM_ICDF(20824), AOM_ICDF(23810), - AOM_ICDF(26784), AOM_ICDF(29776), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9472), AOM_ICDF(10564), AOM_ICDF(13426), AOM_ICDF(16561), - AOM_ICDF(19685), AOM_ICDF(19697), AOM_ICDF(21076), AOM_ICDF(22583), - AOM_ICDF(24891), AOM_ICDF(26983), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(9493), AOM_ICDF(12221), AOM_ICDF(16542), - AOM_ICDF(18394), AOM_ICDF(18401), AOM_ICDF(19580), AOM_ICDF(20971), - AOM_ICDF(22031), AOM_ICDF(26770), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(10772), AOM_ICDF(14209), AOM_ICDF(16381), - AOM_ICDF(18911), AOM_ICDF(18921), AOM_ICDF(20436), AOM_ICDF(23374), - AOM_ICDF(24475), AOM_ICDF(26095), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7680), AOM_ICDF(9444), AOM_ICDF(13453), AOM_ICDF(16320), - AOM_ICDF(18650), AOM_ICDF(18659), AOM_ICDF(19651), AOM_ICDF(21291), - AOM_ICDF(22277), AOM_ICDF(23916), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(9920), AOM_ICDF(14740), AOM_ICDF(19864), - AOM_ICDF(21495), AOM_ICDF(21501), AOM_ICDF(22953), AOM_ICDF(24372), - AOM_ICDF(25192), AOM_ICDF(26760), AOM_ICDF(32768), 0 }, - }, - { - { AOM_ICDF(9728), AOM_ICDF(13958), AOM_ICDF(18881), AOM_ICDF(23624), - AOM_ICDF(24754), AOM_ICDF(25553), AOM_ICDF(26709), AOM_ICDF(27940), - AOM_ICDF(28977), AOM_ICDF(30413), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8832), AOM_ICDF(12572), AOM_ICDF(22433), AOM_ICDF(24653), - AOM_ICDF(25676), AOM_ICDF(26551), AOM_ICDF(27571), AOM_ICDF(28688), - AOM_ICDF(29198), AOM_ICDF(30174), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(8828), AOM_ICDF(11353), AOM_ICDF(23482), - AOM_ICDF(24310), AOM_ICDF(24737), AOM_ICDF(25804), AOM_ICDF(26375), - AOM_ICDF(27174), AOM_ICDF(29840), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9984), AOM_ICDF(13099), AOM_ICDF(16249), AOM_ICDF(19443), - AOM_ICDF(20990), AOM_ICDF(22637), AOM_ICDF(24576), AOM_ICDF(25952), - AOM_ICDF(26884), AOM_ICDF(29435), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8448), AOM_ICDF(11108), AOM_ICDF(15085), AOM_ICDF(18134), - AOM_ICDF(20319), AOM_ICDF(21992), AOM_ICDF(23549), AOM_ICDF(24989), - AOM_ICDF(27177), AOM_ICDF(29208), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(13168), AOM_ICDF(18987), AOM_ICDF(22481), - AOM_ICDF(24282), AOM_ICDF(26200), AOM_ICDF(27868), AOM_ICDF(30203), - AOM_ICDF(31085), AOM_ICDF(32761), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(9119), AOM_ICDF(12629), AOM_ICDF(16877), - AOM_ICDF(20262), AOM_ICDF(21125), AOM_ICDF(22307), AOM_ICDF(23615), - AOM_ICDF(27727), AOM_ICDF(29972), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8320), AOM_ICDF(10230), AOM_ICDF(12783), AOM_ICDF(19005), - AOM_ICDF(20213), AOM_ICDF(20668), AOM_ICDF(22039), AOM_ICDF(23045), - AOM_ICDF(24146), AOM_ICDF(30478), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9088), AOM_ICDF(11308), AOM_ICDF(15416), AOM_ICDF(18118), - AOM_ICDF(19762), AOM_ICDF(20906), AOM_ICDF(22574), AOM_ICDF(25162), - AOM_ICDF(25994), AOM_ICDF(28455), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6912), AOM_ICDF(10548), AOM_ICDF(15148), AOM_ICDF(20026), - AOM_ICDF(21612), AOM_ICDF(21618), AOM_ICDF(22707), AOM_ICDF(24200), - AOM_ICDF(24869), AOM_ICDF(26844), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(12164), AOM_ICDF(16993), AOM_ICDF(21568), - AOM_ICDF(22933), AOM_ICDF(23648), AOM_ICDF(25322), AOM_ICDF(26602), - AOM_ICDF(27806), AOM_ICDF(29841), AOM_ICDF(32768), 0 }, + AOM_ICDF(8960), AOM_ICDF(14083), AOM_ICDF(16058), AOM_ICDF(19129), + AOM_ICDF(21136), AOM_ICDF(23635), AOM_ICDF(24870), AOM_ICDF(27577), + AOM_ICDF(31176), AOM_ICDF(31187), AOM_ICDF(32768), 0, }, + { + AOM_ICDF(9984), AOM_ICDF(14208), AOM_ICDF(15589), AOM_ICDF(17640), + AOM_ICDF(22080), AOM_ICDF(26660), AOM_ICDF(27947), AOM_ICDF(29400), + AOM_ICDF(31605), AOM_ICDF(31611), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9216), AOM_ICDF(15167), AOM_ICDF(16263), AOM_ICDF(17767), + AOM_ICDF(21531), AOM_ICDF(26689), AOM_ICDF(27607), AOM_ICDF(28880), + AOM_ICDF(31291), AOM_ICDF(31296), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(12756), AOM_ICDF(15781), AOM_ICDF(17279), + AOM_ICDF(21198), AOM_ICDF(24057), AOM_ICDF(26171), AOM_ICDF(29200), + AOM_ICDF(31901), AOM_ICDF(31913), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9984), AOM_ICDF(15074), AOM_ICDF(18244), AOM_ICDF(19878), + AOM_ICDF(22246), AOM_ICDF(24436), AOM_ICDF(25560), AOM_ICDF(28991), + AOM_ICDF(31687), AOM_ICDF(31700), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10496), AOM_ICDF(15128), AOM_ICDF(17012), AOM_ICDF(18989), + AOM_ICDF(21294), AOM_ICDF(25011), AOM_ICDF(25999), AOM_ICDF(27784), + AOM_ICDF(30934), AOM_ICDF(30941), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(5875), AOM_ICDF(8846), AOM_ICDF(11817), + AOM_ICDF(14806), AOM_ICDF(17795), AOM_ICDF(20769), AOM_ICDF(23761), + AOM_ICDF(26747), AOM_ICDF(29739), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7424), AOM_ICDF(12915), AOM_ICDF(17544), AOM_ICDF(19392), + AOM_ICDF(23074), AOM_ICDF(25635), AOM_ICDF(26431), AOM_ICDF(28241), + AOM_ICDF(30088), AOM_ICDF(30095), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(11648), AOM_ICDF(13565), AOM_ICDF(18996), AOM_ICDF(19908), + AOM_ICDF(21897), AOM_ICDF(22852), AOM_ICDF(26656), AOM_ICDF(28172), + AOM_ICDF(28995), AOM_ICDF(31283), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10240), AOM_ICDF(14255), AOM_ICDF(18109), AOM_ICDF(19716), + AOM_ICDF(21521), AOM_ICDF(22859), AOM_ICDF(24613), AOM_ICDF(26161), + AOM_ICDF(27279), AOM_ICDF(30392), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(7848), AOM_ICDF(18820), AOM_ICDF(19447), + AOM_ICDF(22335), AOM_ICDF(22733), AOM_ICDF(25112), AOM_ICDF(28427), + AOM_ICDF(29013), AOM_ICDF(31550), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11904), AOM_ICDF(13581), AOM_ICDF(17695), AOM_ICDF(19311), + AOM_ICDF(21698), AOM_ICDF(22562), AOM_ICDF(24391), AOM_ICDF(26559), + AOM_ICDF(27779), AOM_ICDF(30567), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10624), AOM_ICDF(12334), AOM_ICDF(14643), AOM_ICDF(16255), + AOM_ICDF(20783), AOM_ICDF(22767), AOM_ICDF(24929), AOM_ICDF(26876), + AOM_ICDF(27998), AOM_ICDF(31470), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12032), AOM_ICDF(14415), AOM_ICDF(16715), AOM_ICDF(18712), + AOM_ICDF(21557), AOM_ICDF(25332), AOM_ICDF(27840), AOM_ICDF(29663), + AOM_ICDF(31708), AOM_ICDF(31715), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9728), AOM_ICDF(10683), AOM_ICDF(13955), AOM_ICDF(14786), + AOM_ICDF(18481), AOM_ICDF(19492), AOM_ICDF(26749), AOM_ICDF(28483), + AOM_ICDF(29116), AOM_ICDF(31958), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(10032), AOM_ICDF(15755), AOM_ICDF(16949), + AOM_ICDF(19144), AOM_ICDF(19744), AOM_ICDF(22082), AOM_ICDF(27608), + AOM_ICDF(28411), AOM_ICDF(31838), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(14592), AOM_ICDF(15937), AOM_ICDF(18518), AOM_ICDF(19566), + AOM_ICDF(21817), AOM_ICDF(23102), AOM_ICDF(24436), AOM_ICDF(26651), + AOM_ICDF(28100), AOM_ICDF(30993), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(10791), AOM_ICDF(14718), AOM_ICDF(16094), + AOM_ICDF(18560), AOM_ICDF(18570), AOM_ICDF(22120), AOM_ICDF(24188), + AOM_ICDF(25677), AOM_ICDF(31280), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11136), AOM_ICDF(13058), AOM_ICDF(19006), AOM_ICDF(20135), + AOM_ICDF(21463), AOM_ICDF(22159), AOM_ICDF(24042), AOM_ICDF(26348), + AOM_ICDF(27367), AOM_ICDF(30064), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(12544), AOM_ICDF(15384), AOM_ICDF(20327), AOM_ICDF(21555), + AOM_ICDF(23456), AOM_ICDF(24144), AOM_ICDF(25421), AOM_ICDF(27884), + AOM_ICDF(28875), AOM_ICDF(31188), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10368), AOM_ICDF(15009), AOM_ICDF(17631), AOM_ICDF(18970), + AOM_ICDF(20691), AOM_ICDF(21850), AOM_ICDF(22749), AOM_ICDF(25280), + AOM_ICDF(26570), AOM_ICDF(29530), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(10956), AOM_ICDF(21554), AOM_ICDF(22698), + AOM_ICDF(23666), AOM_ICDF(24052), AOM_ICDF(25122), AOM_ICDF(27792), + AOM_ICDF(28612), AOM_ICDF(30825), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11520), AOM_ICDF(12888), AOM_ICDF(16374), AOM_ICDF(19132), + AOM_ICDF(21186), AOM_ICDF(21843), AOM_ICDF(22902), AOM_ICDF(26440), + AOM_ICDF(27928), AOM_ICDF(29946), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9984), AOM_ICDF(12199), AOM_ICDF(14625), AOM_ICDF(17321), + AOM_ICDF(20195), AOM_ICDF(21574), AOM_ICDF(23010), AOM_ICDF(25688), + AOM_ICDF(27600), AOM_ICDF(30988), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10112), AOM_ICDF(13705), AOM_ICDF(16847), AOM_ICDF(19242), + AOM_ICDF(22011), AOM_ICDF(24064), AOM_ICDF(26481), AOM_ICDF(29125), + AOM_ICDF(30545), AOM_ICDF(30555), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9344), AOM_ICDF(10994), AOM_ICDF(15018), AOM_ICDF(16915), + AOM_ICDF(20471), AOM_ICDF(21334), AOM_ICDF(24577), AOM_ICDF(27472), + AOM_ICDF(28592), AOM_ICDF(31578), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(12928), AOM_ICDF(14540), AOM_ICDF(18022), AOM_ICDF(19481), + AOM_ICDF(21028), AOM_ICDF(21825), AOM_ICDF(22728), AOM_ICDF(28191), + AOM_ICDF(29154), AOM_ICDF(31683), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10368), AOM_ICDF(12160), AOM_ICDF(14900), AOM_ICDF(17161), + AOM_ICDF(19379), AOM_ICDF(20521), AOM_ICDF(21747), AOM_ICDF(24534), + AOM_ICDF(26677), AOM_ICDF(30318), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(11488), AOM_ICDF(16197), AOM_ICDF(18030), + AOM_ICDF(20010), AOM_ICDF(20018), AOM_ICDF(21347), AOM_ICDF(23948), + AOM_ICDF(25016), AOM_ICDF(30536), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7808), AOM_ICDF(10310), AOM_ICDF(15420), AOM_ICDF(18961), + AOM_ICDF(20114), AOM_ICDF(20772), AOM_ICDF(21721), AOM_ICDF(24599), + AOM_ICDF(26237), AOM_ICDF(29160), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(9856), AOM_ICDF(13764), AOM_ICDF(16995), AOM_ICDF(19540), + AOM_ICDF(20802), AOM_ICDF(22302), AOM_ICDF(23113), AOM_ICDF(24519), + AOM_ICDF(27717), AOM_ICDF(31604), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(15725), AOM_ICDF(17309), AOM_ICDF(20296), + AOM_ICDF(21257), AOM_ICDF(22573), AOM_ICDF(23165), AOM_ICDF(23893), + AOM_ICDF(27755), AOM_ICDF(31170), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7936), AOM_ICDF(11343), AOM_ICDF(19355), AOM_ICDF(21223), + AOM_ICDF(22121), AOM_ICDF(22978), AOM_ICDF(23703), AOM_ICDF(26079), + AOM_ICDF(27978), AOM_ICDF(31507), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11264), AOM_ICDF(14823), AOM_ICDF(17314), AOM_ICDF(20715), + AOM_ICDF(21999), AOM_ICDF(22982), AOM_ICDF(23728), AOM_ICDF(25229), + AOM_ICDF(28593), AOM_ICDF(31508), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(11788), AOM_ICDF(13666), AOM_ICDF(16523), + AOM_ICDF(18630), AOM_ICDF(20579), AOM_ICDF(21574), AOM_ICDF(23335), + AOM_ICDF(26298), AOM_ICDF(31264), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(14031), AOM_ICDF(15766), AOM_ICDF(18533), + AOM_ICDF(21457), AOM_ICDF(24078), AOM_ICDF(24973), AOM_ICDF(26102), + AOM_ICDF(31284), AOM_ICDF(31288), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7040), AOM_ICDF(9648), AOM_ICDF(12140), AOM_ICDF(14601), + AOM_ICDF(16742), AOM_ICDF(18070), AOM_ICDF(21154), AOM_ICDF(23582), + AOM_ICDF(27647), AOM_ICDF(31763), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(10240), AOM_ICDF(13466), AOM_ICDF(16837), AOM_ICDF(19351), + AOM_ICDF(20636), AOM_ICDF(21620), AOM_ICDF(22474), AOM_ICDF(25815), + AOM_ICDF(28364), AOM_ICDF(31976), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(11008), AOM_ICDF(13682), AOM_ICDF(15127), AOM_ICDF(18779), + AOM_ICDF(19841), AOM_ICDF(20792), AOM_ICDF(21954), AOM_ICDF(23365), + AOM_ICDF(29100), AOM_ICDF(31748), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7168), AOM_ICDF(12260), AOM_ICDF(15037), AOM_ICDF(17152), + AOM_ICDF(18730), AOM_ICDF(18736), AOM_ICDF(19436), AOM_ICDF(20484), + AOM_ICDF(24465), AOM_ICDF(30868), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(12469), AOM_ICDF(15422), AOM_ICDF(19291), + AOM_ICDF(20301), AOM_ICDF(21344), AOM_ICDF(21894), AOM_ICDF(23415), + AOM_ICDF(27696), AOM_ICDF(31042), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(10112), AOM_ICDF(13929), AOM_ICDF(17880), AOM_ICDF(18857), + AOM_ICDF(20955), AOM_ICDF(20963), AOM_ICDF(21974), AOM_ICDF(23273), + AOM_ICDF(24734), AOM_ICDF(31352), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8064), AOM_ICDF(15826), AOM_ICDF(17929), AOM_ICDF(19017), + AOM_ICDF(21016), AOM_ICDF(21024), AOM_ICDF(21687), AOM_ICDF(22701), + AOM_ICDF(24242), AOM_ICDF(30645), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6528), AOM_ICDF(9196), AOM_ICDF(20118), AOM_ICDF(21101), + AOM_ICDF(22227), AOM_ICDF(22231), AOM_ICDF(22997), AOM_ICDF(25070), + AOM_ICDF(25919), AOM_ICDF(30923), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9600), AOM_ICDF(13218), AOM_ICDF(15898), AOM_ICDF(17780), + AOM_ICDF(19991), AOM_ICDF(20000), AOM_ICDF(21196), AOM_ICDF(23912), + AOM_ICDF(26044), AOM_ICDF(31139), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8960), AOM_ICDF(12037), AOM_ICDF(14178), AOM_ICDF(15681), + AOM_ICDF(20126), AOM_ICDF(20143), AOM_ICDF(21435), AOM_ICDF(23083), + AOM_ICDF(24675), AOM_ICDF(31466), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(2944), AOM_ICDF(5875), AOM_ICDF(8846), AOM_ICDF(11817), + AOM_ICDF(14806), AOM_ICDF(17795), AOM_ICDF(20769), AOM_ICDF(23761), + AOM_ICDF(26747), AOM_ICDF(29739), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9472), AOM_ICDF(12334), AOM_ICDF(15469), AOM_ICDF(16848), + AOM_ICDF(19972), AOM_ICDF(19984), AOM_ICDF(22292), AOM_ICDF(24384), + AOM_ICDF(25891), AOM_ICDF(31676), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(11176), AOM_ICDF(15497), AOM_ICDF(16676), + AOM_ICDF(18528), AOM_ICDF(18535), AOM_ICDF(19595), AOM_ICDF(24334), + AOM_ICDF(25725), AOM_ICDF(31723), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8704), AOM_ICDF(12141), AOM_ICDF(14313), AOM_ICDF(15828), + AOM_ICDF(18358), AOM_ICDF(18368), AOM_ICDF(19469), AOM_ICDF(21089), + AOM_ICDF(24027), AOM_ICDF(30700), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(7680), AOM_ICDF(11689), AOM_ICDF(14556), AOM_ICDF(15548), + AOM_ICDF(17878), AOM_ICDF(17887), AOM_ICDF(18873), AOM_ICDF(20512), + AOM_ICDF(22152), AOM_ICDF(31004), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(11476), AOM_ICDF(16600), AOM_ICDF(18052), + AOM_ICDF(19683), AOM_ICDF(19689), AOM_ICDF(20509), AOM_ICDF(22077), + AOM_ICDF(23496), AOM_ICDF(29504), AOM_ICDF(32768), 0, + }, + }, + { + { + AOM_ICDF(9728), AOM_ICDF(14651), AOM_ICDF(19394), AOM_ICDF(20550), + AOM_ICDF(21680), AOM_ICDF(22479), AOM_ICDF(23516), AOM_ICDF(24952), + AOM_ICDF(26183), AOM_ICDF(28538), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8832), AOM_ICDF(18693), AOM_ICDF(20913), AOM_ICDF(21933), + AOM_ICDF(22956), AOM_ICDF(23831), AOM_ICDF(24341), AOM_ICDF(25317), + AOM_ICDF(26434), AOM_ICDF(29028), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(5888), AOM_ICDF(8413), AOM_ICDF(20542), AOM_ICDF(21609), + AOM_ICDF(22437), AOM_ICDF(22864), AOM_ICDF(23663), AOM_ICDF(26329), + AOM_ICDF(26900), AOM_ICDF(29828), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9984), AOM_ICDF(13134), AOM_ICDF(16328), AOM_ICDF(18267), + AOM_ICDF(19814), AOM_ICDF(21461), AOM_ICDF(22393), AOM_ICDF(24944), + AOM_ICDF(26320), AOM_ICDF(29653), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8448), AOM_ICDF(12425), AOM_ICDF(15474), AOM_ICDF(17031), + AOM_ICDF(19216), AOM_ICDF(20889), AOM_ICDF(23077), AOM_ICDF(25108), + AOM_ICDF(26548), AOM_ICDF(30108), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9856), AOM_ICDF(15675), AOM_ICDF(19169), AOM_ICDF(20837), + AOM_ICDF(22638), AOM_ICDF(24556), AOM_ICDF(25438), AOM_ICDF(27114), + AOM_ICDF(29449), AOM_ICDF(29456), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6784), AOM_ICDF(10294), AOM_ICDF(14542), AOM_ICDF(15724), + AOM_ICDF(19109), AOM_ICDF(19972), AOM_ICDF(24084), AOM_ICDF(26329), + AOM_ICDF(27637), AOM_ICDF(30433), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(8320), AOM_ICDF(10873), AOM_ICDF(17095), AOM_ICDF(18466), + AOM_ICDF(19674), AOM_ICDF(20129), AOM_ICDF(21230), AOM_ICDF(27562), + AOM_ICDF(28568), AOM_ICDF(30858), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(9088), AOM_ICDF(13196), AOM_ICDF(15898), AOM_ICDF(17566), + AOM_ICDF(19210), AOM_ICDF(20354), AOM_ICDF(21186), AOM_ICDF(23647), + AOM_ICDF(26235), AOM_ICDF(30548), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6912), AOM_ICDF(11512), AOM_ICDF(16390), AOM_ICDF(17479), + AOM_ICDF(19065), AOM_ICDF(19071), AOM_ICDF(19740), AOM_ICDF(21715), + AOM_ICDF(23208), AOM_ICDF(29132), AOM_ICDF(32768), 0, + }, + { + AOM_ICDF(6656), AOM_ICDF(11485), AOM_ICDF(16060), AOM_ICDF(17734), + AOM_ICDF(19099), AOM_ICDF(19814), AOM_ICDF(21018), AOM_ICDF(23053), + AOM_ICDF(24333), AOM_ICDF(27260), AOM_ICDF(32768), 0, + }, + }, #endif // CONFIG_SMOOTH_HV -#else // CONFIG_ALT_INTRA - { { AOM_ICDF(17536), AOM_ICDF(19321), AOM_ICDF(21527), AOM_ICDF(25360), - AOM_ICDF(27516), AOM_ICDF(28026), AOM_ICDF(29323), AOM_ICDF(30023), - AOM_ICDF(30999), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11776), AOM_ICDF(15466), AOM_ICDF(22360), AOM_ICDF(24865), - AOM_ICDF(26991), AOM_ICDF(27889), AOM_ICDF(29299), AOM_ICDF(30519), - AOM_ICDF(31398), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(12272), AOM_ICDF(13793), AOM_ICDF(25813), - AOM_ICDF(27359), AOM_ICDF(27654), AOM_ICDF(28573), AOM_ICDF(29130), - AOM_ICDF(30551), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11648), AOM_ICDF(14123), AOM_ICDF(16454), AOM_ICDF(19948), - AOM_ICDF(22780), AOM_ICDF(23846), AOM_ICDF(27087), AOM_ICDF(28995), - AOM_ICDF(30380), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9216), AOM_ICDF(12436), AOM_ICDF(15295), AOM_ICDF(17996), - AOM_ICDF(24006), AOM_ICDF(25465), AOM_ICDF(27405), AOM_ICDF(28725), - AOM_ICDF(30383), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9344), AOM_ICDF(12181), AOM_ICDF(14433), AOM_ICDF(16634), - AOM_ICDF(20355), AOM_ICDF(24317), AOM_ICDF(26133), AOM_ICDF(29295), - AOM_ICDF(31344), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8576), AOM_ICDF(10750), AOM_ICDF(12556), AOM_ICDF(17996), - AOM_ICDF(22315), AOM_ICDF(23609), AOM_ICDF(25040), AOM_ICDF(26157), - AOM_ICDF(30573), AOM_ICDF(32768), 0 }, - { AOM_ICDF(11008), AOM_ICDF(13303), AOM_ICDF(15432), AOM_ICDF(20646), - AOM_ICDF(23506), AOM_ICDF(24100), AOM_ICDF(25624), AOM_ICDF(26824), - AOM_ICDF(28055), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9472), AOM_ICDF(12384), AOM_ICDF(14534), AOM_ICDF(17094), - AOM_ICDF(20257), AOM_ICDF(22155), AOM_ICDF(24767), AOM_ICDF(28955), - AOM_ICDF(30474), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7552), AOM_ICDF(14152), AOM_ICDF(17352), AOM_ICDF(22654), - AOM_ICDF(25123), AOM_ICDF(25783), AOM_ICDF(27911), AOM_ICDF(29182), - AOM_ICDF(30849), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(8064), AOM_ICDF(11538), AOM_ICDF(21987), AOM_ICDF(24941), - AOM_ICDF(26913), AOM_ICDF(28136), AOM_ICDF(29222), AOM_ICDF(30469), - AOM_ICDF(31331), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5504), AOM_ICDF(10403), AOM_ICDF(25080), AOM_ICDF(26762), - AOM_ICDF(27933), AOM_ICDF(29104), AOM_ICDF(30092), AOM_ICDF(31576), - AOM_ICDF(32004), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(8706), AOM_ICDF(15097), AOM_ICDF(23714), - AOM_ICDF(25344), AOM_ICDF(26072), AOM_ICDF(27380), AOM_ICDF(28580), - AOM_ICDF(29840), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(11186), AOM_ICDF(17593), AOM_ICDF(20154), - AOM_ICDF(22974), AOM_ICDF(24351), AOM_ICDF(26916), AOM_ICDF(29956), - AOM_ICDF(30967), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(10193), AOM_ICDF(16895), AOM_ICDF(19031), - AOM_ICDF(23735), AOM_ICDF(25576), AOM_ICDF(27514), AOM_ICDF(29813), - AOM_ICDF(30471), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4864), AOM_ICDF(8352), AOM_ICDF(16459), AOM_ICDF(18062), - AOM_ICDF(21263), AOM_ICDF(25378), AOM_ICDF(26937), AOM_ICDF(30376), - AOM_ICDF(31619), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4992), AOM_ICDF(7922), AOM_ICDF(13842), AOM_ICDF(18004), - AOM_ICDF(21779), AOM_ICDF(23527), AOM_ICDF(25115), AOM_ICDF(27357), - AOM_ICDF(30232), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(9716), AOM_ICDF(16379), AOM_ICDF(20053), - AOM_ICDF(22487), AOM_ICDF(23613), AOM_ICDF(25437), AOM_ICDF(27270), - AOM_ICDF(28516), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(9674), AOM_ICDF(16891), AOM_ICDF(18684), - AOM_ICDF(21147), AOM_ICDF(23093), AOM_ICDF(25512), AOM_ICDF(30132), - AOM_ICDF(30894), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(11318), AOM_ICDF(21038), AOM_ICDF(23650), - AOM_ICDF(25303), AOM_ICDF(26262), AOM_ICDF(28295), AOM_ICDF(30479), - AOM_ICDF(31212), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(10496), AOM_ICDF(12758), AOM_ICDF(14790), AOM_ICDF(24547), - AOM_ICDF(26342), AOM_ICDF(26799), AOM_ICDF(27825), AOM_ICDF(28443), - AOM_ICDF(30217), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(11462), AOM_ICDF(17121), AOM_ICDF(24215), - AOM_ICDF(26504), AOM_ICDF(27267), AOM_ICDF(28492), AOM_ICDF(29444), - AOM_ICDF(30846), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(8158), AOM_ICDF(9215), AOM_ICDF(26451), - AOM_ICDF(27407), AOM_ICDF(27524), AOM_ICDF(27995), AOM_ICDF(28275), - AOM_ICDF(29767), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(12652), AOM_ICDF(14145), AOM_ICDF(20101), - AOM_ICDF(22879), AOM_ICDF(23675), AOM_ICDF(25629), AOM_ICDF(27079), - AOM_ICDF(28923), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(12374), AOM_ICDF(14366), AOM_ICDF(18855), - AOM_ICDF(23842), AOM_ICDF(24358), AOM_ICDF(25639), AOM_ICDF(27087), - AOM_ICDF(29706), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6400), AOM_ICDF(10005), AOM_ICDF(12939), AOM_ICDF(17753), - AOM_ICDF(22206), AOM_ICDF(24790), AOM_ICDF(26785), AOM_ICDF(28164), - AOM_ICDF(30520), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(8176), AOM_ICDF(9713), AOM_ICDF(19053), - AOM_ICDF(22343), AOM_ICDF(23222), AOM_ICDF(24453), AOM_ICDF(25070), - AOM_ICDF(29761), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(9754), AOM_ICDF(10833), AOM_ICDF(21229), - AOM_ICDF(23540), AOM_ICDF(23943), AOM_ICDF(24839), AOM_ICDF(25675), - AOM_ICDF(27033), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(11758), AOM_ICDF(13481), AOM_ICDF(17236), - AOM_ICDF(20210), AOM_ICDF(21768), AOM_ICDF(24303), AOM_ICDF(26948), - AOM_ICDF(28676), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4864), AOM_ICDF(12712), AOM_ICDF(14201), AOM_ICDF(23863), - AOM_ICDF(25952), AOM_ICDF(26386), AOM_ICDF(27632), AOM_ICDF(28635), - AOM_ICDF(30362), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(13184), AOM_ICDF(15173), AOM_ICDF(17647), AOM_ICDF(21576), - AOM_ICDF(24474), AOM_ICDF(25267), AOM_ICDF(27699), AOM_ICDF(29283), - AOM_ICDF(30549), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7552), AOM_ICDF(11295), AOM_ICDF(18257), AOM_ICDF(20811), - AOM_ICDF(23213), AOM_ICDF(24606), AOM_ICDF(27731), AOM_ICDF(30407), - AOM_ICDF(31237), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7936), AOM_ICDF(10846), AOM_ICDF(12816), AOM_ICDF(22436), - AOM_ICDF(24614), AOM_ICDF(25130), AOM_ICDF(26890), AOM_ICDF(28199), - AOM_ICDF(29091), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8576), AOM_ICDF(11411), AOM_ICDF(13830), AOM_ICDF(15918), - AOM_ICDF(18996), AOM_ICDF(20044), AOM_ICDF(25114), AOM_ICDF(27835), - AOM_ICDF(28972), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13646), AOM_ICDF(15966), - AOM_ICDF(21162), AOM_ICDF(22012), AOM_ICDF(24701), AOM_ICDF(27506), - AOM_ICDF(29644), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(9423), AOM_ICDF(12524), AOM_ICDF(14773), - AOM_ICDF(19447), AOM_ICDF(22804), AOM_ICDF(26073), AOM_ICDF(29211), - AOM_ICDF(30642), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8916), AOM_ICDF(11059), AOM_ICDF(15861), - AOM_ICDF(21174), AOM_ICDF(22338), AOM_ICDF(24620), AOM_ICDF(27071), - AOM_ICDF(30899), AOM_ICDF(32768), 0 }, - { AOM_ICDF(9856), AOM_ICDF(11557), AOM_ICDF(13960), AOM_ICDF(18525), - AOM_ICDF(21788), AOM_ICDF(22189), AOM_ICDF(24462), AOM_ICDF(26603), - AOM_ICDF(27470), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7808), AOM_ICDF(10636), AOM_ICDF(13143), AOM_ICDF(15844), - AOM_ICDF(18698), AOM_ICDF(20272), AOM_ICDF(24323), AOM_ICDF(30096), - AOM_ICDF(31787), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(10928), AOM_ICDF(14596), AOM_ICDF(18926), - AOM_ICDF(21586), AOM_ICDF(22688), AOM_ICDF(26626), AOM_ICDF(29001), - AOM_ICDF(30399), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(8832), AOM_ICDF(10983), AOM_ICDF(13451), AOM_ICDF(16582), - AOM_ICDF(21656), AOM_ICDF(23109), AOM_ICDF(24845), AOM_ICDF(26207), - AOM_ICDF(28796), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(10844), AOM_ICDF(15554), AOM_ICDF(18073), - AOM_ICDF(22954), AOM_ICDF(24901), AOM_ICDF(26776), AOM_ICDF(28649), - AOM_ICDF(30419), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(8252), AOM_ICDF(10072), AOM_ICDF(20108), - AOM_ICDF(23535), AOM_ICDF(24346), AOM_ICDF(25761), AOM_ICDF(26418), - AOM_ICDF(28675), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7680), AOM_ICDF(11012), AOM_ICDF(12627), AOM_ICDF(14595), - AOM_ICDF(19462), AOM_ICDF(20888), AOM_ICDF(23348), AOM_ICDF(25703), - AOM_ICDF(28159), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(9818), AOM_ICDF(11790), AOM_ICDF(13813), - AOM_ICDF(22731), AOM_ICDF(24737), AOM_ICDF(26557), AOM_ICDF(28061), - AOM_ICDF(29697), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(8918), AOM_ICDF(11620), AOM_ICDF(13802), - AOM_ICDF(19950), AOM_ICDF(23764), AOM_ICDF(25734), AOM_ICDF(28537), - AOM_ICDF(31809), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(6580), AOM_ICDF(7808), AOM_ICDF(12281), - AOM_ICDF(19375), AOM_ICDF(20970), AOM_ICDF(22860), AOM_ICDF(24602), - AOM_ICDF(29929), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(9553), AOM_ICDF(11457), AOM_ICDF(15102), - AOM_ICDF(20291), AOM_ICDF(21280), AOM_ICDF(22985), AOM_ICDF(24475), - AOM_ICDF(26613), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(10423), AOM_ICDF(12605), AOM_ICDF(14621), - AOM_ICDF(19031), AOM_ICDF(21505), AOM_ICDF(24585), AOM_ICDF(27558), - AOM_ICDF(29532), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(11659), AOM_ICDF(14463), AOM_ICDF(18867), - AOM_ICDF(23653), AOM_ICDF(24903), AOM_ICDF(27115), AOM_ICDF(29389), - AOM_ICDF(31382), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(8192), AOM_ICDF(10016), AOM_ICDF(13304), AOM_ICDF(16362), - AOM_ICDF(21107), AOM_ICDF(25165), AOM_ICDF(26620), AOM_ICDF(28901), - AOM_ICDF(30910), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(8723), AOM_ICDF(16237), AOM_ICDF(18318), - AOM_ICDF(22002), AOM_ICDF(25923), AOM_ICDF(27394), AOM_ICDF(29934), - AOM_ICDF(31428), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(7138), AOM_ICDF(9841), AOM_ICDF(18442), - AOM_ICDF(22447), AOM_ICDF(24618), AOM_ICDF(26337), AOM_ICDF(27945), - AOM_ICDF(30168), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6784), AOM_ICDF(8916), AOM_ICDF(12270), AOM_ICDF(14851), - AOM_ICDF(19886), AOM_ICDF(22759), AOM_ICDF(25105), AOM_ICDF(28368), - AOM_ICDF(29760), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(7928), AOM_ICDF(11324), AOM_ICDF(13340), - AOM_ICDF(21205), AOM_ICDF(24224), AOM_ICDF(25926), AOM_ICDF(28518), - AOM_ICDF(30560), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(6580), AOM_ICDF(10058), AOM_ICDF(11237), - AOM_ICDF(16807), AOM_ICDF(25937), AOM_ICDF(27218), AOM_ICDF(30015), - AOM_ICDF(31348), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(6808), AOM_ICDF(9445), AOM_ICDF(12446), - AOM_ICDF(18461), AOM_ICDF(21835), AOM_ICDF(23244), AOM_ICDF(26109), - AOM_ICDF(30115), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(7659), AOM_ICDF(10798), AOM_ICDF(14720), - AOM_ICDF(19157), AOM_ICDF(21955), AOM_ICDF(23645), AOM_ICDF(26460), - AOM_ICDF(28702), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5760), AOM_ICDF(8503), AOM_ICDF(11157), AOM_ICDF(13071), - AOM_ICDF(17594), AOM_ICDF(22047), AOM_ICDF(24099), AOM_ICDF(29077), - AOM_ICDF(30850), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4864), AOM_ICDF(9660), AOM_ICDF(14264), AOM_ICDF(17105), - AOM_ICDF(21528), AOM_ICDF(24094), AOM_ICDF(26025), AOM_ICDF(28580), - AOM_ICDF(30559), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(9600), AOM_ICDF(11139), AOM_ICDF(12998), AOM_ICDF(18660), - AOM_ICDF(22158), AOM_ICDF(23501), AOM_ICDF(24659), AOM_ICDF(25736), - AOM_ICDF(30296), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(11068), AOM_ICDF(15984), AOM_ICDF(19969), - AOM_ICDF(23169), AOM_ICDF(24704), AOM_ICDF(26216), AOM_ICDF(27572), - AOM_ICDF(31368), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4480), AOM_ICDF(6801), AOM_ICDF(8018), AOM_ICDF(20908), - AOM_ICDF(23071), AOM_ICDF(23583), AOM_ICDF(24301), AOM_ICDF(25062), - AOM_ICDF(29427), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(10068), AOM_ICDF(11753), AOM_ICDF(15843), - AOM_ICDF(19742), AOM_ICDF(21358), AOM_ICDF(23809), AOM_ICDF(26189), - AOM_ICDF(29067), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(9047), AOM_ICDF(10622), AOM_ICDF(13931), - AOM_ICDF(22462), AOM_ICDF(23858), AOM_ICDF(25911), AOM_ICDF(27277), - AOM_ICDF(29722), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(7568), AOM_ICDF(9931), AOM_ICDF(13533), - AOM_ICDF(18431), AOM_ICDF(22063), AOM_ICDF(23777), AOM_ICDF(26025), - AOM_ICDF(30555), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4352), AOM_ICDF(6239), AOM_ICDF(7379), AOM_ICDF(13739), - AOM_ICDF(16917), AOM_ICDF(18090), AOM_ICDF(18835), AOM_ICDF(19651), - AOM_ICDF(30360), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(8988), AOM_ICDF(10288), AOM_ICDF(15534), - AOM_ICDF(19495), AOM_ICDF(20386), AOM_ICDF(21934), AOM_ICDF(23034), - AOM_ICDF(26988), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7040), AOM_ICDF(10055), AOM_ICDF(11652), AOM_ICDF(14757), - AOM_ICDF(19622), AOM_ICDF(21715), AOM_ICDF(23615), AOM_ICDF(26761), - AOM_ICDF(29483), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4736), AOM_ICDF(10102), AOM_ICDF(12315), AOM_ICDF(19078), - AOM_ICDF(21348), AOM_ICDF(22621), AOM_ICDF(24246), AOM_ICDF(26044), - AOM_ICDF(29931), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(10496), AOM_ICDF(12410), AOM_ICDF(14955), AOM_ICDF(19891), - AOM_ICDF(23137), AOM_ICDF(23792), AOM_ICDF(25159), AOM_ICDF(26378), - AOM_ICDF(28125), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7936), AOM_ICDF(12204), AOM_ICDF(17104), AOM_ICDF(20191), - AOM_ICDF(23468), AOM_ICDF(24630), AOM_ICDF(26156), AOM_ICDF(27628), - AOM_ICDF(28913), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(8629), AOM_ICDF(10232), AOM_ICDF(23591), - AOM_ICDF(25349), AOM_ICDF(25637), AOM_ICDF(26306), AOM_ICDF(27063), - AOM_ICDF(28980), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(12088), AOM_ICDF(13461), AOM_ICDF(16646), - AOM_ICDF(20516), AOM_ICDF(21455), AOM_ICDF(24062), AOM_ICDF(26579), - AOM_ICDF(28368), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7296), AOM_ICDF(11177), AOM_ICDF(13117), AOM_ICDF(16196), - AOM_ICDF(23378), AOM_ICDF(24708), AOM_ICDF(26440), AOM_ICDF(27997), - AOM_ICDF(29078), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(9377), AOM_ICDF(12575), AOM_ICDF(15616), - AOM_ICDF(20919), AOM_ICDF(23697), AOM_ICDF(26603), AOM_ICDF(27566), - AOM_ICDF(29903), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6528), AOM_ICDF(9091), AOM_ICDF(10478), AOM_ICDF(16445), - AOM_ICDF(21081), AOM_ICDF(22320), AOM_ICDF(23871), AOM_ICDF(25087), - AOM_ICDF(29258), AOM_ICDF(32768), 0 }, - { AOM_ICDF(8704), AOM_ICDF(11148), AOM_ICDF(12499), AOM_ICDF(17340), - AOM_ICDF(20656), AOM_ICDF(21288), AOM_ICDF(22588), AOM_ICDF(23701), - AOM_ICDF(24693), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7552), AOM_ICDF(11394), AOM_ICDF(12980), AOM_ICDF(15562), - AOM_ICDF(19942), AOM_ICDF(21792), AOM_ICDF(25093), AOM_ICDF(28211), - AOM_ICDF(28959), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(11708), AOM_ICDF(13847), AOM_ICDF(19377), - AOM_ICDF(22421), AOM_ICDF(23160), AOM_ICDF(25449), AOM_ICDF(27136), - AOM_ICDF(29182), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(9984), AOM_ICDF(12031), AOM_ICDF(15190), AOM_ICDF(18673), - AOM_ICDF(21422), AOM_ICDF(22812), AOM_ICDF(25690), AOM_ICDF(29118), - AOM_ICDF(30458), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6144), AOM_ICDF(9680), AOM_ICDF(17436), AOM_ICDF(19610), - AOM_ICDF(21820), AOM_ICDF(23485), AOM_ICDF(26313), AOM_ICDF(30826), - AOM_ICDF(31843), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6016), AOM_ICDF(8315), AOM_ICDF(10607), AOM_ICDF(19333), - AOM_ICDF(21572), AOM_ICDF(22553), AOM_ICDF(25266), AOM_ICDF(27288), - AOM_ICDF(28551), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7168), AOM_ICDF(9668), AOM_ICDF(12646), AOM_ICDF(16257), - AOM_ICDF(19648), AOM_ICDF(20899), AOM_ICDF(25304), AOM_ICDF(30465), - AOM_ICDF(31625), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6144), AOM_ICDF(9368), AOM_ICDF(11836), AOM_ICDF(14130), - AOM_ICDF(19153), AOM_ICDF(21157), AOM_ICDF(24876), AOM_ICDF(28452), - AOM_ICDF(29396), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5504), AOM_ICDF(8486), AOM_ICDF(11996), AOM_ICDF(14412), - AOM_ICDF(17968), AOM_ICDF(21814), AOM_ICDF(24424), AOM_ICDF(30682), - AOM_ICDF(32059), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(7195), AOM_ICDF(9592), AOM_ICDF(13331), - AOM_ICDF(17569), AOM_ICDF(19460), AOM_ICDF(22371), AOM_ICDF(25458), - AOM_ICDF(28942), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(9206), AOM_ICDF(11783), AOM_ICDF(16456), - AOM_ICDF(19253), AOM_ICDF(20390), AOM_ICDF(23775), AOM_ICDF(27007), - AOM_ICDF(28425), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5888), AOM_ICDF(8303), AOM_ICDF(11361), AOM_ICDF(13440), - AOM_ICDF(15848), AOM_ICDF(17549), AOM_ICDF(21532), AOM_ICDF(29564), - AOM_ICDF(30665), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4608), AOM_ICDF(8788), AOM_ICDF(13284), AOM_ICDF(16621), - AOM_ICDF(18983), AOM_ICDF(20286), AOM_ICDF(24577), AOM_ICDF(28960), - AOM_ICDF(30314), AOM_ICDF(32768), 0 } }, - { { AOM_ICDF(8320), AOM_ICDF(15005), AOM_ICDF(19168), AOM_ICDF(24282), - AOM_ICDF(26707), AOM_ICDF(27402), AOM_ICDF(28681), AOM_ICDF(29639), - AOM_ICDF(30629), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5632), AOM_ICDF(13900), AOM_ICDF(22376), AOM_ICDF(24867), - AOM_ICDF(26804), AOM_ICDF(27734), AOM_ICDF(29130), AOM_ICDF(30722), - AOM_ICDF(31465), AOM_ICDF(32768), 0 }, - { AOM_ICDF(4992), AOM_ICDF(9115), AOM_ICDF(11055), AOM_ICDF(24893), - AOM_ICDF(26316), AOM_ICDF(26661), AOM_ICDF(27663), AOM_ICDF(28301), - AOM_ICDF(29418), AOM_ICDF(32768), 0 }, - { AOM_ICDF(7424), AOM_ICDF(12077), AOM_ICDF(14987), AOM_ICDF(19596), - AOM_ICDF(22615), AOM_ICDF(23600), AOM_ICDF(26465), AOM_ICDF(28484), - AOM_ICDF(29789), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6272), AOM_ICDF(11447), AOM_ICDF(14362), AOM_ICDF(18204), - AOM_ICDF(23418), AOM_ICDF(24715), AOM_ICDF(26697), AOM_ICDF(28547), - AOM_ICDF(29520), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5248), AOM_ICDF(10946), AOM_ICDF(15379), AOM_ICDF(18167), - AOM_ICDF(22197), AOM_ICDF(25432), AOM_ICDF(27295), AOM_ICDF(30031), - AOM_ICDF(30576), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5120), AOM_ICDF(9008), AOM_ICDF(11607), AOM_ICDF(18210), - AOM_ICDF(22327), AOM_ICDF(23427), AOM_ICDF(24887), AOM_ICDF(26580), - AOM_ICDF(29892), AOM_ICDF(32768), 0 }, - { AOM_ICDF(6656), AOM_ICDF(10124), AOM_ICDF(12689), AOM_ICDF(19922), - AOM_ICDF(22480), AOM_ICDF(22807), AOM_ICDF(24441), AOM_ICDF(25579), - AOM_ICDF(26787), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5376), AOM_ICDF(10084), AOM_ICDF(13983), AOM_ICDF(17113), - AOM_ICDF(19996), AOM_ICDF(21614), AOM_ICDF(24403), AOM_ICDF(28651), - AOM_ICDF(29938), AOM_ICDF(32768), 0 }, - { AOM_ICDF(5504), AOM_ICDF(14131), AOM_ICDF(17989), AOM_ICDF(23324), - AOM_ICDF(25513), AOM_ICDF(26071), AOM_ICDF(27850), AOM_ICDF(29464), - AOM_ICDF(30393), AOM_ICDF(32768), 0 } }, -#endif // CONFIG_ALT_INTRA +}; +#endif // CONFIG_KF_CTX + +#if CONFIG_LPF_SB +static const aom_cdf_prob default_lpf_reuse_cdf[LPF_REUSE_CONTEXT][CDF_SIZE( + 2)] = { { AOM_ICDF(8192), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(32768), 0 } }; + +static const aom_cdf_prob + default_lpf_delta_cdf[LPF_DELTA_CONTEXT][CDF_SIZE(DELTA_RANGE)] = { + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 }, + { AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560), + AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(32768), 0 } }; +static const aom_cdf_prob + default_lpf_sign_cdf[LPF_REUSE_CONTEXT][LPF_SIGN_CONTEXT][CDF_SIZE(2)] = { + { { AOM_ICDF(6554), AOM_ICDF(32768), 0 }, + { AOM_ICDF(26214), AOM_ICDF(32768), 0 } }, + { { AOM_ICDF(16384), AOM_ICDF(32768), 0 }, + { AOM_ICDF(16384), AOM_ICDF(32768), 0 } } + }; +#endif // CONFIG_LPF_SB + static void init_mode_probs(FRAME_CONTEXT *fc) { - av1_copy(fc->switchable_interp_prob, default_switchable_interp_prob); av1_copy(fc->partition_prob, default_partition_probs); av1_copy(fc->intra_inter_prob, default_intra_inter_p); av1_copy(fc->comp_inter_prob, default_comp_inter_p); -#if CONFIG_PALETTE av1_copy(fc->palette_y_size_cdf, default_palette_y_size_cdf); av1_copy(fc->palette_uv_size_cdf, default_palette_uv_size_cdf); av1_copy(fc->palette_y_color_index_cdf, default_palette_y_color_index_cdf); av1_copy(fc->palette_uv_color_index_cdf, default_palette_uv_color_index_cdf); -#endif // CONFIG_PALETTE + av1_copy(fc->kf_y_cdf, default_kf_y_mode_cdf); +#if CONFIG_MRC_TX + av1_copy(fc->mrc_mask_inter_cdf, default_mrc_mask_inter_cdf); + av1_copy(fc->mrc_mask_intra_cdf, default_mrc_mask_intra_cdf); +#endif // CONFIG_MRC_TX #if CONFIG_NEW_MULTISYMBOL av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf); #endif // CONFIG_NEW_MULTISYMBOL @@ -4928,6 +5699,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #endif // CONFIG_EXT_COMP_REFS av1_copy(fc->comp_ref_prob, default_comp_ref_p); #if CONFIG_NEW_MULTISYMBOL + av1_copy(fc->palette_y_mode_cdf, default_palette_y_mode_cdf); + av1_copy(fc->palette_uv_mode_cdf, default_palette_uv_mode_cdf); av1_copy(fc->comp_ref_cdf, default_comp_ref_cdf); #endif #if CONFIG_LV_MAP @@ -4937,6 +5710,18 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { av1_copy(fc->dc_sign, default_dc_sign); av1_copy(fc->coeff_base, default_coeff_base); av1_copy(fc->coeff_lps, default_coeff_lps); +#if BR_NODE + av1_copy(fc->coeff_br, default_coeff_br); +#endif +#if CONFIG_CTX1D + av1_copy(fc->eob_mode, default_eob_mode); + av1_copy(fc->empty_line, default_empty_line); + av1_copy(fc->hv_eob, default_hv_eob); +#endif // CONFIG_CTX1D + +#if LV_MAP_PROB + av1_init_txb_probs(fc); +#endif // LV_MAP_PROB #endif #if CONFIG_EXT_REFS av1_copy(fc->comp_bwdref_prob, default_comp_bwdref_p); @@ -4948,12 +5733,14 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #if CONFIG_NEW_MULTISYMBOL av1_copy(fc->single_ref_cdf, default_single_ref_cdf); #endif -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF av1_copy(fc->comp_inter_mode_prob, default_comp_inter_mode_p); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - av1_copy(fc->tx_size_probs, default_tx_size_prob); +#endif // CONFIG_COMPOUND_SINGLEREF #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) fc->quarter_tx_size_prob = default_quarter_tx_size_prob; +#if CONFIG_NEW_MULTISYMBOL + av1_copy(fc->quarter_tx_size_cdf, default_quarter_tx_size_cdf); +#endif // CONFIG_NEW_MULTISYMBOL #endif #if CONFIG_VAR_TX av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs); @@ -4981,12 +5768,15 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #endif #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION av1_copy(fc->obmc_prob, default_obmc_prob); -#if CONFIG_NEW_MULTISYMBOL +#if CONFIG_NEW_MULTISYMBOL || CONFIG_NCOBMC_ADAPT_WEIGHT av1_copy(fc->obmc_cdf, default_obmc_cdf); #endif +#if CONFIG_NCOBMC_ADAPT_WEIGHT + av1_copy(fc->ncobmc_prob, default_ncobmc_prob); + av1_copy(fc->ncobmc_cdf, default_ncobmc_cdf); +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION -#if CONFIG_EXT_INTER av1_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs); av1_copy(fc->inter_compound_mode_cdf, default_inter_compound_mode_cdf); #if CONFIG_COMPOUND_SINGLEREF @@ -4996,7 +5786,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { default_inter_singleref_comp_mode_cdf); #endif // CONFIG_COMPOUND_SINGLEREF av1_copy(fc->compound_type_prob, default_compound_type_probs); +#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT av1_copy(fc->compound_type_cdf, default_compound_type_cdf); +#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT #if CONFIG_INTERINTRA av1_copy(fc->interintra_prob, default_interintra_prob); av1_copy(fc->wedge_interintra_prob, default_wedge_interintra_prob); @@ -5007,7 +5799,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { av1_copy(fc->interintra_mode_prob, default_interintra_mode_prob); av1_copy(fc->interintra_mode_cdf, default_interintra_mode_cdf); #endif // CONFIG_INTERINTRA -#endif // CONFIG_EXT_INTER #if CONFIG_SUPERTX av1_copy(fc->supertx_prob, default_supertx_prob); #endif // CONFIG_SUPERTX @@ -5024,8 +5815,10 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #if CONFIG_FILTER_INTRA av1_copy(fc->filter_intra_probs, default_filter_intra_probs); #endif // CONFIG_FILTER_INTRA - av1_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob); - av1_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob); +#if CONFIG_LGT_FROM_PRED + av1_copy(fc->intra_lgt_prob, default_intra_lgt_prob); + av1_copy(fc->inter_lgt_prob, default_inter_lgt_prob); +#endif // CONFIG_LGT_FROM_PRED #if CONFIG_LOOP_RESTORATION av1_copy(fc->switchable_restore_prob, default_switchable_restore_prob); #endif // CONFIG_LOOP_RESTORATION @@ -5044,36 +5837,29 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP av1_copy(fc->seg.tree_cdf, default_seg_tree_cdf); av1_copy(fc->tx_size_cdf, default_tx_size_cdf); -#if CONFIG_DELTA_Q av1_copy(fc->delta_q_prob, default_delta_q_probs); av1_copy(fc->delta_q_cdf, default_delta_q_cdf); #if CONFIG_EXT_DELTA_Q av1_copy(fc->delta_lf_prob, default_delta_lf_probs); av1_copy(fc->delta_lf_cdf, default_delta_lf_cdf); +#if CONFIG_LOOPFILTER_LEVEL + av1_copy(fc->delta_lf_multi_cdf, default_delta_lf_multi_cdf); +#endif // CONFIG_LOOPFILTER_LEVEL #endif -#endif // CONFIG_DELTA_Q #if CONFIG_CFL + av1_copy(fc->cfl_sign_cdf, default_cfl_sign_cdf); av1_copy(fc->cfl_alpha_cdf, default_cfl_alpha_cdf); #endif #if CONFIG_INTRABC - fc->intrabc_prob = INTRABC_PROB_DEFAULT; + av1_copy(fc->intrabc_cdf, default_intrabc_cdf); #endif +#if CONFIG_LPF_SB + av1_copy(fc->lpf_reuse_cdf, default_lpf_reuse_cdf); + av1_copy(fc->lpf_delta_cdf, default_lpf_delta_cdf); + av1_copy(fc->lpf_sign_cdf, default_lpf_sign_cdf); +#endif // CONFIG_LPF_SB } -int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; -int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; - -#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER -const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] = - { - -EIGHTTAP_REGULAR, 2, 4, -MULTITAP_SHARP, -EIGHTTAP_SMOOTH, - -EIGHTTAP_SMOOTH2, - }; -#else -const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] = - { -EIGHTTAP_REGULAR, 2, -EIGHTTAP_SMOOTH, -MULTITAP_SHARP }; -#endif // CONFIG_DUAL_FILTER - void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { int i, j; FRAME_CONTEXT *fc = cm->fc; @@ -5120,12 +5906,12 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { fc->single_ref_prob[i][j] = av1_mode_mv_merge_probs( pre_fc->single_ref_prob[i][j], counts->single_ref[i][j]); -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF for (i = 0; i < COMP_INTER_MODE_CONTEXTS; i++) fc->comp_inter_mode_prob[i] = av1_mode_mv_merge_probs( pre_fc->comp_inter_mode_prob[i], counts->comp_inter_mode[i]); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) fc->newmv_prob[i] = @@ -5149,7 +5935,12 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { for (i = 0; i < ADAPT_OVERLAP_BLOCKS; ++i) aom_tree_merge_probs(av1_ncobmc_mode_tree, pre_fc->ncobmc_mode_prob[i], counts->ncobmc_mode[i], fc->ncobmc_mode_prob[i]); +#if CONFIG_WARPED_MOTION + for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; ++i) + aom_tree_merge_probs(av1_ncobmc_tree, pre_fc->ncobmc_prob[i], + counts->ncobmc[i], fc->ncobmc_prob[i]); #endif +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; ++i) fc->obmc_prob[i] = @@ -5166,7 +5957,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { } #endif // CONFIG_SUPERTX -#if CONFIG_EXT_INTER for (i = 0; i < INTER_MODE_CONTEXTS; i++) aom_tree_merge_probs( av1_inter_compound_mode_tree, pre_fc->inter_compound_mode_probs[i], @@ -5209,28 +5999,15 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { } } #endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE -#endif // CONFIG_EXT_INTER - - if (cm->interp_filter == SWITCHABLE) { - for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) - aom_tree_merge_probs( - av1_switchable_interp_tree, pre_fc->switchable_interp_prob[i], - counts->switchable_interp[i], fc->switchable_interp_prob[i]); - } } void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { - int i, j; + int i; FRAME_CONTEXT *fc = cm->fc; const FRAME_CONTEXT *pre_fc = cm->pre_fc; const FRAME_COUNTS *counts = &cm->counts; if (cm->tx_mode == TX_MODE_SELECT) { - for (i = 0; i < MAX_TX_DEPTH; ++i) { - for (j = 0; j < TX_SIZE_CONTEXTS; ++j) - aom_tree_merge_probs(av1_tx_size_tree[i], pre_fc->tx_size_probs[i][j], - counts->tx_size[i][j], fc->tx_size_probs[i][j]); - } #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) fc->quarter_tx_size_prob = av1_mode_mv_merge_probs( pre_fc->quarter_tx_size_prob, counts->quarter_tx_size); @@ -5249,38 +6026,22 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { fc->skip_probs[i] = av1_mode_mv_merge_probs(pre_fc->skip_probs[i], counts->skip[i]); -#if CONFIG_EXT_TX - for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { - int s; - for (s = 1; s < EXT_TX_SETS_INTER; ++s) { - if (use_inter_ext_tx_for_txsize[s][i]) { - aom_tree_merge_probs( - av1_ext_tx_inter_tree[s], pre_fc->inter_ext_tx_prob[s][i], - counts->inter_ext_tx[s][i], fc->inter_ext_tx_prob[s][i]); - } - } - for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { - if (use_intra_ext_tx_for_txsize[s][i]) { - for (j = 0; j < INTRA_MODES; ++j) - aom_tree_merge_probs( - av1_ext_tx_intra_tree[s], pre_fc->intra_ext_tx_prob[s][i][j], - counts->intra_ext_tx[s][i][j], fc->intra_ext_tx_prob[s][i][j]); - } +#if CONFIG_LGT_FROM_PRED + int j; + if (LGT_FROM_PRED_INTRA) { + for (i = TX_4X4; i < LGT_SIZES; ++i) { + for (j = 0; j < INTRA_MODES; ++j) + fc->intra_lgt_prob[i][j] = av1_mode_mv_merge_probs( + pre_fc->intra_lgt_prob[i][j], counts->intra_lgt[i][j]); } } -#else - for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { - for (j = 0; j < TX_TYPES; ++j) { - aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->intra_ext_tx_prob[i][j], - counts->intra_ext_tx[i][j], - fc->intra_ext_tx_prob[i][j]); + if (LGT_FROM_PRED_INTER) { + for (i = TX_4X4; i < LGT_SIZES; ++i) { + fc->inter_lgt_prob[i] = av1_mode_mv_merge_probs(pre_fc->inter_lgt_prob[i], + counts->inter_lgt[i]); } } - for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { - aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->inter_ext_tx_prob[i], - counts->inter_ext_tx[i], fc->inter_ext_tx_prob[i]); - } -#endif // CONFIG_EXT_TX +#endif // CONFIG_LGT_FROM_PRED if (cm->seg.temporal_update) { for (i = 0; i < PREDICTION_PROBS; i++) @@ -5331,16 +6092,20 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { av1_mode_mv_merge_probs(pre_fc->partition_prob[i][PARTITION_HORZ], ct); } #endif -#if CONFIG_DELTA_Q for (i = 0; i < DELTA_Q_PROBS; ++i) fc->delta_q_prob[i] = mode_mv_merge_probs(pre_fc->delta_q_prob[i], counts->delta_q[i]); #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + for (i = 0; i < FRAME_LF_COUNT; ++i) + for (int j = 0; j < DELTA_LF_PROBS; ++j) + fc->delta_lf_multi_prob[i][j] = mode_mv_merge_probs( + pre_fc->delta_lf_multi_prob[i][j], counts->delta_lf_multi[i][j]); +#endif // CONFIG_LOOPFILTER_LEVEL for (i = 0; i < DELTA_LF_PROBS; ++i) fc->delta_lf_prob[i] = mode_mv_merge_probs(pre_fc->delta_lf_prob[i], counts->delta_lf[i]); #endif // CONFIG_EXT_DELTA_Q -#endif #if CONFIG_EXT_INTRA #if CONFIG_INTRA_INTERP for (i = 0; i < INTRA_FILTERS + 1; ++i) { @@ -5369,13 +6134,16 @@ static void set_default_lf_deltas(struct loopfilter *lf) { lf->ref_deltas[BWDREF_FRAME] = lf->ref_deltas[LAST_FRAME]; #endif // CONFIG_EXT_REFS lf->ref_deltas[GOLDEN_FRAME] = -1; -#if CONFIG_ALTREF2 +#if CONFIG_EXT_REFS lf->ref_deltas[ALTREF2_FRAME] = -1; -#endif // CONFIG_ALTREF2 +#endif // CONFIG_EXT_REFS lf->ref_deltas[ALTREF_FRAME] = -1; lf->mode_deltas[0] = 0; lf->mode_deltas[1] = 0; + + av1_copy(lf->last_ref_deltas, lf->ref_deltas); + av1_copy(lf->last_mode_deltas, lf->mode_deltas); } void av1_setup_past_independence(AV1_COMMON *cm) { @@ -5404,6 +6172,9 @@ void av1_setup_past_independence(AV1_COMMON *cm) { av1_default_coef_probs(cm); init_mode_probs(cm->fc); av1_init_mv_probs(cm); +#if CONFIG_LV_MAP + av1_init_lv_map(cm); +#endif #if CONFIG_PVQ av1_default_pvq_probs(cm); #endif // CONFIG_PVQ @@ -5413,19 +6184,34 @@ void av1_setup_past_independence(AV1_COMMON *cm) { av1_convolve_init(cm); cm->fc->initialized = 1; +#if CONFIG_NO_FRAME_CONTEXT_SIGNALING + if (cm->frame_type == KEY_FRAME) { + // Reset all frame contexts, as all reference frames will be lost. + for (i = 0; i < FRAME_CONTEXTS; ++i) cm->frame_contexts[i] = *cm->fc; + } +#else if (cm->frame_type == KEY_FRAME || cm->error_resilient_mode || cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL) { // Reset all frame contexts. for (i = 0; i < FRAME_CONTEXTS; ++i) cm->frame_contexts[i] = *cm->fc; } else if (cm->reset_frame_context == RESET_FRAME_CONTEXT_CURRENT) { +#if CONFIG_NO_FRAME_CONTEXT_SIGNALING + // Reset the frame context of the first specified ref frame. + if (cm->frame_refs[0].idx >= 0) { + cm->frame_contexts[cm->frame_refs[0].idx] = *cm->fc; + } +#else // Reset only the frame context specified in the frame header. cm->frame_contexts[cm->frame_context_idx] = *cm->fc; +#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING } +#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING // prev_mip will only be allocated in encoder. if (frame_is_intra_only(cm) && cm->prev_mip && !cm->frame_parallel_decode) memset(cm->prev_mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->prev_mip)); - +#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->frame_context_idx = 0; +#endif // !CONFIG_NO_FRAME_CONTEXT_SIGNALING } diff --git a/third_party/aom/av1/common/entropymode.h b/third_party/aom/av1/common/entropymode.h index 32532471a..3452241b0 100644 --- a/third_party/aom/av1/common/entropymode.h +++ b/third_party/aom/av1/common/entropymode.h @@ -33,14 +33,11 @@ extern "C" { #define TX_SIZE_CONTEXTS 2 #define INTER_OFFSET(mode) ((mode)-NEARESTMV) -#if CONFIG_EXT_INTER #if CONFIG_COMPOUND_SINGLEREF #define INTER_SINGLEREF_COMP_OFFSET(mode) ((mode)-SR_NEAREST_NEARMV) #endif // CONFIG_COMPOUND_SINGLEREF #define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV) -#endif // CONFIG_EXT_INTER -#if CONFIG_PALETTE // Number of possible contexts for a color index. // As can be seen from av1_get_palette_color_index_context(), the possible // contexts are (2,0,0), (2,2,1), (3,2,0), (4,1,0), (5,0,0). These are mapped to @@ -70,11 +67,10 @@ extern "C" { #define PALETTE_UV_MODE_CONTEXTS 2 #define PALETTE_MAX_BLOCK_SIZE (64 * 64) -#endif // CONFIG_PALETTE -#if CONFIG_INTRABC -#define INTRABC_PROB_DEFAULT 192 -#endif // CONFIG_INTRABC +#if CONFIG_KF_CTX +#define KF_MODE_CONTEXTS 5 +#endif struct AV1Common; @@ -98,12 +94,8 @@ typedef struct frame_contexts { #else aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; #endif - av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES]; coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES]; - aom_prob blockzero_probs[TX_SIZES][PLANE_TYPES][REF_TYPES][BLOCKZ_CONTEXTS]; - aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] - [SWITCHABLE_FILTERS - 1]; #if CONFIG_ADAPT_SCAN // TODO(angiebird): try aom_prob #if CONFIG_CHROMA_2X2 @@ -179,6 +171,38 @@ typedef struct frame_contexts { aom_prob coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS] [COEFF_BASE_CONTEXTS]; aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]; +#if BR_NODE + aom_prob coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS]; +#endif +#if CONFIG_CTX1D + aom_prob eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES]; + aom_prob empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES][EMPTY_LINE_CONTEXTS]; + aom_prob hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS]; +#endif // CONFIG_CTX1D + +#if LV_MAP_PROB + aom_cdf_prob txb_skip_cdf[TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)]; + aom_cdf_prob nz_map_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] + [CDF_SIZE(2)]; + aom_cdf_prob eob_flag_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] + [CDF_SIZE(2)]; + aom_cdf_prob dc_sign_cdf[PLANE_TYPES][DC_SIGN_CONTEXTS][CDF_SIZE(2)]; + aom_cdf_prob coeff_base_cdf[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS] + [COEFF_BASE_CONTEXTS][CDF_SIZE(2)]; + aom_cdf_prob coeff_lps_cdf[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] + [CDF_SIZE(2)]; +#if BR_NODE + aom_cdf_prob coeff_br_cdf[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS] + [LEVEL_CONTEXTS][CDF_SIZE(2)]; +#endif +#if CONFIG_CTX1D + aom_cdf_prob eob_mode_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES][CDF_SIZE(2)]; + aom_cdf_prob empty_line_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES] + [EMPTY_LINE_CONTEXTS][CDF_SIZE(2)]; + aom_cdf_prob hv_eob_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS] + [CDF_SIZE(2)]; +#endif // CONFIG_CTX1D +#endif // LV_MAP_PROB #endif aom_prob newmv_prob[NEWMV_MODE_CONTEXTS]; @@ -192,7 +216,6 @@ typedef struct frame_contexts { aom_cdf_prob drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)]; #endif -#if CONFIG_EXT_INTER aom_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS] [INTER_COMPOUND_MODES - 1]; aom_cdf_prob inter_compound_mode_cdf[INTER_MODE_CONTEXTS] @@ -204,7 +227,9 @@ typedef struct frame_contexts { INTER_SINGLEREF_COMP_MODES)]; #endif // CONFIG_COMPOUND_SINGLEREF aom_prob compound_type_prob[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1]; +#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)]; +#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT #if CONFIG_INTERINTRA aom_prob interintra_prob[BLOCK_SIZE_GROUPS]; aom_prob wedge_interintra_prob[BLOCK_SIZES_ALL]; @@ -216,7 +241,6 @@ typedef struct frame_contexts { aom_cdf_prob interintra_mode_cdf[BLOCK_SIZE_GROUPS] [CDF_SIZE(INTERINTRA_MODES)]; #endif // CONFIG_INTERINTRA -#endif // CONFIG_EXT_INTER #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION aom_prob motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1]; aom_cdf_prob motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)]; @@ -226,15 +250,18 @@ typedef struct frame_contexts { [CDF_SIZE(MAX_NCOBMC_MODES)]; #endif #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION +#if CONFIG_NCOBMC_ADAPT_WEIGHT + aom_prob ncobmc_prob[BLOCK_SIZES_ALL][OBMC_FAMILY_MODES - 1]; + aom_cdf_prob ncobmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(OBMC_FAMILY_MODES)]; +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT aom_prob obmc_prob[BLOCK_SIZES_ALL]; -#if CONFIG_NEW_MULTISYMBOL +#if CONFIG_NEW_MULTISYMBOL || CONFIG_NCOBMC_ADAPT_WEIGHT aom_cdf_prob obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)]; #endif // CONFIG_NEW_MULTISYMBOL #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS]; aom_prob comp_inter_prob[COMP_INTER_CONTEXTS]; -#if CONFIG_PALETTE aom_cdf_prob palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)]; aom_cdf_prob palette_uv_size_cdf[PALETTE_BLOCK_SIZES] [CDF_SIZE(PALETTE_SIZES)]; @@ -244,8 +271,16 @@ typedef struct frame_contexts { aom_cdf_prob palette_uv_color_index_cdf[PALETTE_SIZES] [PALETTE_COLOR_INDEX_CONTEXTS] [CDF_SIZE(PALETTE_COLORS)]; -#endif // CONFIG_PALETTE +#if CONFIG_MRC_TX + aom_cdf_prob mrc_mask_inter_cdf[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] + [CDF_SIZE(PALETTE_COLORS)]; + aom_cdf_prob mrc_mask_intra_cdf[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] + [CDF_SIZE(PALETTE_COLORS)]; +#endif // CONFIG_MRC_TX #if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob palette_y_mode_cdf[PALETTE_BLOCK_SIZES][PALETTE_Y_MODE_CONTEXTS] + [CDF_SIZE(2)]; + aom_cdf_prob palette_uv_mode_cdf[PALETTE_UV_MODE_CONTEXTS][CDF_SIZE(2)]; aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)]; aom_cdf_prob single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)]; #endif @@ -273,12 +308,14 @@ typedef struct frame_contexts { aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][COMP_REFS - 1][CDF_SIZE(2)]; #endif // CONFIG_EXT_REFS #endif -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - aom_prob tx_size_probs[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH]; +#endif // CONFIG_COMPOUND_SINGLEREF #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) aom_prob quarter_tx_size_prob; +#if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob quarter_tx_size_cdf[CDF_SIZE(2)]; +#endif #endif #if CONFIG_VAR_TX aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS]; @@ -294,17 +331,9 @@ typedef struct frame_contexts { nmv_context nmvc[NMV_CONTEXTS]; #if CONFIG_INTRABC nmv_context ndvc; - aom_prob intrabc_prob; + aom_cdf_prob intrabc_cdf[CDF_SIZE(2)]; #endif int initialized; -#if CONFIG_EXT_TX - aom_prob inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1]; - aom_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] - [TX_TYPES - 1]; -#else - aom_prob intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES][TX_TYPES - 1]; - aom_prob inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1]; -#endif // CONFIG_EXT_TX #if CONFIG_SUPERTX aom_prob supertx_prob[PARTITION_SUPERTX_CONTEXTS][TX_SIZES]; #endif // CONFIG_SUPERTX @@ -329,19 +358,25 @@ typedef struct frame_contexts { #endif aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] [CDF_SIZE(SWITCHABLE_FILTERS)]; - /* kf_y_cdf is discarded after use, so does not require persistent storage. - However, we keep it with the other CDFs in this struct since it needs to - be copied to each tile to support parallelism just like the others. - */ +/* kf_y_cdf is discarded after use, so does not require persistent storage. + However, we keep it with the other CDFs in this struct since it needs to + be copied to each tile to support parallelism just like the others. +*/ +#if CONFIG_KF_CTX + aom_cdf_prob kf_y_cdf[KF_MODE_CONTEXTS][KF_MODE_CONTEXTS] + [CDF_SIZE(INTRA_MODES)]; +#else aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)]; +#endif aom_cdf_prob tx_size_cdf[MAX_TX_DEPTH][TX_SIZE_CONTEXTS] [CDF_SIZE(MAX_TX_DEPTH + 1)]; -#if CONFIG_DELTA_Q aom_cdf_prob delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)]; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + aom_cdf_prob delta_lf_multi_cdf[FRAME_LF_COUNT][CDF_SIZE(DELTA_LF_PROBS + 1)]; +#endif // CONFIG_LOOPFILTER_LEVEL aom_cdf_prob delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)]; #endif -#endif // CONFIG_DELTA_Q #if CONFIG_EXT_TX aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] [CDF_SIZE(TX_TYPES)]; @@ -351,23 +386,34 @@ typedef struct frame_contexts { aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)]; aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)]; #endif // CONFIG_EXT_TX +#if CONFIG_LGT_FROM_PRED + aom_prob intra_lgt_prob[LGT_SIZES][INTRA_MODES]; + aom_prob inter_lgt_prob[LGT_SIZES]; +#endif // CONFIG_LGT_FROM_PRED #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)]; #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP -#if CONFIG_DELTA_Q aom_prob delta_q_prob[DELTA_Q_PROBS]; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + aom_prob delta_lf_multi_prob[FRAME_LF_COUNT][DELTA_LF_PROBS]; +#endif // CONFIG_LOOPFILTER_LEVEL aom_prob delta_lf_prob[DELTA_LF_PROBS]; #endif -#endif #if CONFIG_PVQ // TODO(any): If PVQ is enabled, most of coefficient related cdf, // such as coef_cdfs[], coef_tail_cdfs[], and coef_heaf_cdfs[] can be removed. od_adapt_ctx pvq_context; #endif // CONFIG_PVQ #if CONFIG_CFL - aom_cdf_prob cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)]; -#endif + aom_cdf_prob cfl_sign_cdf[CDF_SIZE(CFL_JOINT_SIGNS)]; + aom_cdf_prob cfl_alpha_cdf[CFL_ALPHA_CONTEXTS][CDF_SIZE(CFL_ALPHABET_SIZE)]; +#endif +#if CONFIG_LPF_SB + aom_cdf_prob lpf_reuse_cdf[LPF_REUSE_CONTEXT][CDF_SIZE(2)]; + aom_cdf_prob lpf_delta_cdf[LPF_DELTA_CONTEXT][CDF_SIZE(DELTA_RANGE)]; + aom_cdf_prob lpf_sign_cdf[LPF_REUSE_CONTEXT][LPF_SIGN_CONTEXT][CDF_SIZE(2)]; +#endif // CONFIG_LPF_SB } FRAME_CONTEXT; typedef struct FRAME_COUNTS { @@ -383,9 +429,6 @@ typedef struct FRAME_COUNTS { #else unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES]; #endif - av1_coeff_count_model coef[TX_SIZES][PLANE_TYPES]; - unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS] - [COEFF_CONTEXTS]; unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS] [SWITCHABLE_FILTERS]; #if CONFIG_ADAPT_SCAN @@ -415,16 +458,26 @@ typedef struct FRAME_COUNTS { unsigned int coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS] [COEFF_BASE_CONTEXTS][2]; unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2]; + unsigned int coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS] + [2]; +#if CONFIG_CTX1D + unsigned int eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES][2]; + unsigned int empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES] + [EMPTY_LINE_CONTEXTS][2]; + unsigned int hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS][2]; +#endif // CONFIG_CTX1D #endif // CONFIG_LV_MAP - av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES]; +#if CONFIG_SYMBOLRATE + unsigned int coeff_num[2]; // 0: zero coeff 1: non-zero coeff + unsigned int symbol_num[2]; // 0: entropy symbol 1: non-entropy symbol +#endif unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2]; unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2]; unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2]; unsigned int drl_mode[DRL_MODE_CONTEXTS][2]; -#if CONFIG_EXT_INTER unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES]; #if CONFIG_COMPOUND_SINGLEREF unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS] @@ -436,13 +489,15 @@ typedef struct FRAME_COUNTS { unsigned int wedge_interintra[BLOCK_SIZES_ALL][2]; #endif // CONFIG_INTERINTRA unsigned int compound_interinter[BLOCK_SIZES_ALL][COMPOUND_TYPES]; -#endif // CONFIG_EXT_INTER #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION unsigned int motion_mode[BLOCK_SIZES_ALL][MOTION_MODES]; #if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR unsigned int ncobmc_mode[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES]; #endif #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION +#if CONFIG_NCOBMC_ADAPT_WEIGHT + unsigned int ncobmc[BLOCK_SIZES_ALL][OBMC_FAMILY_MODES]; +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT unsigned int obmc[BLOCK_SIZES_ALL][2]; #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION @@ -459,13 +514,11 @@ typedef struct FRAME_COUNTS { #else unsigned int comp_ref[REF_CONTEXTS][COMP_REFS - 1][2]; #endif // CONFIG_EXT_REFS -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF unsigned int comp_inter_mode[COMP_INTER_MODE_CONTEXTS][2]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - // TODO(any): tx_size_totals is only used by the encoder to decide whether - // to use forward updates for the coeff probs, and as such it does not really - // belong into this structure. - unsigned int tx_size_totals[TX_SIZES]; +#endif // CONFIG_COMPOUND_SINGLEREF + // TODO(urvang): Only needed for !CONFIG_VAR_TX case. So can be removed when + // CONFIG_VAR_TX flag is removed. unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1]; #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX) unsigned int quarter_tx_size[2]; @@ -479,16 +532,22 @@ typedef struct FRAME_COUNTS { unsigned int intrabc[2]; nmv_context_counts dv; #endif -#if CONFIG_DELTA_Q +#if CONFIG_LGT_FROM_PRED + unsigned int intra_lgt[LGT_SIZES][INTRA_MODES][2]; + unsigned int inter_lgt[LGT_SIZES][2]; +#endif // CONFIG_LGT_FROM_PRED unsigned int delta_q[DELTA_Q_PROBS][2]; #if CONFIG_EXT_DELTA_Q +#if CONFIG_LOOPFILTER_LEVEL + unsigned int delta_lf_multi[FRAME_LF_COUNT][DELTA_LF_PROBS][2]; +#endif // CONFIG_LOOPFILTER_LEVEL unsigned int delta_lf[DELTA_LF_PROBS][2]; #endif -#endif -#if CONFIG_EXT_TX -#if CONFIG_RECT_TX +#if CONFIG_EXT_TX && CONFIG_RECT_TX unsigned int tx_size_implied[TX_SIZES][TX_SIZES]; -#endif // CONFIG_RECT_TX +#endif // CONFIG_EXT_TX && CONFIG_RECT_TX +#if CONFIG_ENTROPY_STATS +#if CONFIG_EXT_TX unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES]; unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] [TX_TYPES]; @@ -496,6 +555,7 @@ typedef struct FRAME_COUNTS { unsigned int intra_ext_tx[EXT_TX_SIZES][TX_TYPES][TX_TYPES]; unsigned int inter_ext_tx[EXT_TX_SIZES][TX_TYPES]; #endif // CONFIG_EXT_TX +#endif // CONFIG_ENTROPY_STATS #if CONFIG_SUPERTX unsigned int supertx[PARTITION_SUPERTX_CONTEXTS][TX_SIZES][2]; unsigned int supertx_size[TX_SIZES]; @@ -509,29 +569,103 @@ typedef struct FRAME_COUNTS { #if CONFIG_FILTER_INTRA unsigned int filter_intra[PLANE_TYPES][2]; #endif // CONFIG_FILTER_INTRA +#if CONFIG_LPF_SB + unsigned int lpf_reuse[LPF_REUSE_CONTEXT][2]; + unsigned int lpf_delta[LPF_DELTA_CONTEXT][DELTA_RANGE]; + unsigned int lpf_sign[LPF_SIGN_CONTEXT][2]; +#endif // CONFIG_LPF_SB } FRAME_COUNTS; -// CDF version of 'av1_kf_y_mode_prob'. -extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES] - [CDF_SIZE(INTRA_MODES)]; +#if CONFIG_KF_CTX +extern const aom_cdf_prob default_kf_y_mode_cdf[KF_MODE_CONTEXTS] + [KF_MODE_CONTEXTS] + [CDF_SIZE(INTRA_MODES)]; +#else +extern const aom_cdf_prob default_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES] + [CDF_SIZE(INTRA_MODES)]; +#endif -#if CONFIG_PALETTE extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES] [PALETTE_Y_MODE_CONTEXTS]; extern const aom_prob av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS]; -#endif // CONFIG_PALETTE -extern const int av1_intra_mode_ind[INTRA_MODES]; -extern const int av1_intra_mode_inv[INTRA_MODES]; #if CONFIG_EXT_TX -extern int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES]; -extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES]; -extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES]; -extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES]; -#endif +static const int av1_ext_tx_ind[EXT_TX_SET_TYPES][TX_TYPES] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, +#if CONFIG_MRC_TX + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + }, + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + }, +#endif // CONFIG_MRC_TX + { + 1, 3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 1, 5, 6, 4, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, + }, + { + 3, 4, 5, 8, 6, 7, 9, 10, 11, 0, 1, 2, 0, 0, 0, 0, + }, + { + 7, 8, 9, 12, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, + }, +}; + +static const int av1_ext_tx_inv[EXT_TX_SET_TYPES][TX_TYPES] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, +#if CONFIG_MRC_TX + { + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 9, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, +#endif // CONFIG_MRC_TX + { + 9, 0, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 9, 0, 10, 11, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 9, 10, 11, 0, 1, 2, 4, 5, 3, 6, 7, 8, 0, 0, 0, 0, + }, + { + 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 4, 5, 3, 6, 7, 8, + }, +}; +#else +#if CONFIG_MRC_TX +static const int av1_ext_tx_ind[TX_TYPES] = { + 0, 3, 4, 2, 1, +}; +static const int av1_ext_tx_inv[TX_TYPES] = { + 0, 4, 3, 1, 2, +}; +#else +static const int av1_ext_tx_ind[TX_TYPES] = { + 0, 2, 3, 1, +}; +static const int av1_ext_tx_inv[TX_TYPES] = { + 0, 3, 1, 2, +}; +#endif // CONFIG_MRC_TX +#endif // CONFIG_EXT_TX -#if CONFIG_EXT_INTER #if CONFIG_INTERINTRA extern const aom_tree_index av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)]; @@ -543,36 +677,31 @@ extern const aom_tree_index av1_inter_singleref_comp_mode_tree[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)]; #endif // CONFIG_COMPOUND_SINGLEREF extern const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)]; -#endif // CONFIG_EXT_INTER extern const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)]; #if CONFIG_EXT_PARTITION_TYPES extern const aom_tree_index av1_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)]; #endif extern const aom_tree_index - av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)]; -#if CONFIG_PALETTE -extern const aom_tree_index av1_palette_color_index_tree[PALETTE_SIZES][TREE_SIZE(PALETTE_COLORS)]; -#endif // CONFIG_PALETTE -extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)]; #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)]; #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP #if CONFIG_EXT_TX -extern const aom_tree_index av1_ext_tx_inter_tree[EXT_TX_SETS_INTER] - [TREE_SIZE(TX_TYPES)]; -extern const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA] - [TREE_SIZE(TX_TYPES)]; +extern const aom_tree_index av1_ext_tx_tree[EXT_TX_SET_TYPES] + [TREE_SIZE(TX_TYPES)]; #else extern const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)]; #endif // CONFIG_EXT_TX #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)]; #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION -#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR +#if CONFIG_NCOBMC_ADAPT_WEIGHT extern const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)]; -#endif +#if CONFIG_WARPED_MOTION +extern const aom_tree_index av1_ncobmc_tree[TREE_SIZE(OBMC_FAMILY_MODES)]; +#endif // CONFIG_WARPED_MOTION +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT #if CONFIG_LOOP_RESTORATION #define RESTORE_NONE_SGRPROJ_PROB 64 #define RESTORE_NONE_BILATERAL_PROB 16 @@ -581,17 +710,11 @@ extern const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)]; extern const aom_tree_index av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)]; #endif // CONFIG_LOOP_RESTORATION -extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; -extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; void av1_setup_past_independence(struct AV1Common *cm); void av1_adapt_intra_frame_probs(struct AV1Common *cm); void av1_adapt_inter_frame_probs(struct AV1Common *cm); -#if !CONFIG_EXT_TX -extern int av1_ext_tx_ind[TX_TYPES]; -extern int av1_ext_tx_inv[TX_TYPES]; -#endif static INLINE int av1_ceil_log2(int n) { int i = 1, p = 2; @@ -602,14 +725,12 @@ static INLINE int av1_ceil_log2(int n) { return i; } -#if CONFIG_PALETTE // Returns the context for palette color index at row 'r' and column 'c', // along with the 'color_order' of neighbors and the 'color_idx'. // The 'color_map' is a 2D array with the given 'stride'. int av1_get_palette_color_index_context(const uint8_t *color_map, int stride, int r, int c, int palette_size, uint8_t *color_order, int *color_idx); -#endif // CONFIG_PALETTE #ifdef __cplusplus } // extern "C" diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 4737915a4..2d0191366 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -68,6 +68,12 @@ static const nmv_context default_nmv_context = { { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, + { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf #endif }, { @@ -93,6 +99,12 @@ static const nmv_context default_nmv_context = { { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, + { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf #endif } }, }; @@ -169,7 +181,7 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, if (c == MV_CLASS_0) { comp_counts->class0[d] += incr; -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR if (precision > MV_SUBPEL_NONE) #endif comp_counts->class0_fp[d][f] += incr; @@ -178,7 +190,7 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, int i; int b = c + CLASS0_BITS - 1; // number of bits for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr; -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR if (precision > MV_SUBPEL_NONE) #endif comp_counts->fp[f] += incr; @@ -222,18 +234,23 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { for (j = 0; j < MV_OFFSET_BITS; ++j) comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]); +#if CONFIG_AMVR + if (cm->cur_frame_mv_precision_level == 0) { +#endif + for (j = 0; j < CLASS0_SIZE; ++j) + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], + c->class0_fp[j], comp->class0_fp[j]); - for (j = 0; j < CLASS0_SIZE; ++j) - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], - c->class0_fp[j], comp->class0_fp[j]); - - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); - if (allow_hp) { - comp->class0_hp = - av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); - comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); + if (allow_hp) { + comp->class0_hp = + av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); + comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); + } +#if CONFIG_AMVR } +#endif } } } diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h index bea5c6724..9ce089f7d 100644 --- a/third_party/aom/av1/common/entropymv.h +++ b/third_party/aom/av1/common/entropymv.h @@ -66,6 +66,9 @@ typedef enum { #define CLASS0_BITS 1 /* bits at integer precision for class 0 */ #define CLASS0_SIZE (1 << CLASS0_BITS) #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) +#if CONFIG_NEW_MULTISYMBOL +#define MV_BITS_CONTEXTS 6 +#endif #define MV_FP_SIZE 4 #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) @@ -97,6 +100,7 @@ typedef struct { aom_cdf_prob class0_hp_cdf[CDF_SIZE(2)]; aom_cdf_prob hp_cdf[CDF_SIZE(2)]; aom_cdf_prob class0_cdf[CDF_SIZE(CLASS0_SIZE)]; + aom_cdf_prob bits_cdf[MV_BITS_CONTEXTS][CDF_SIZE(2)]; #endif } nmv_component; @@ -133,7 +137,7 @@ typedef struct { } nmv_context_counts; typedef enum { -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR MV_SUBPEL_NONE = -1, #endif MV_SUBPEL_LOW_PRECISION = 0, diff --git a/third_party/aom/av1/common/enums.h b/third_party/aom/av1/common/enums.h index 2b18d32a9..e8c4003cc 100644 --- a/third_party/aom/av1/common/enums.h +++ b/third_party/aom/av1/common/enums.h @@ -22,6 +22,16 @@ extern "C" { #undef MAX_SB_SIZE +#if CONFIG_NCOBMC_ADAPT_WEIGHT +#define TWO_MODE +#endif + +#if CONFIG_NCOBMC || CONFIG_NCOBMC_ADAPT_WEIGHT +#define NC_MODE_INFO 1 +#else +#define NC_MODE_INFO 0 +#endif + // Max superblock size #if CONFIG_EXT_PARTITION #define MAX_SB_SIZE_LOG2 7 @@ -57,16 +67,45 @@ extern "C" { #define MAX_TILE_ROWS 1024 #define MAX_TILE_COLS 1024 #else +#if CONFIG_MAX_TILE +#define MAX_TILE_ROWS 64 +#define MAX_TILE_COLS 64 +#else #define MAX_TILE_ROWS 4 #define MAX_TILE_COLS 64 +#endif #endif // CONFIG_EXT_TILE #if CONFIG_VAR_TX #define MAX_VARTX_DEPTH 2 +#define SQR_VARTX_DEPTH_INIT 0 +#define RECT_VARTX_DEPTH_INIT 0 #endif #define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2) +#if CONFIG_LOOPFILTER_LEVEL +// 4 frame filter levels: y plane vertical, y plane horizontal, +// u plane, and v plane +#define FRAME_LF_COUNT 4 +#define DEFAULT_DELTA_LF_MULTI 0 +#endif // CONFIG_LOOPFILTER_LEVEL + +#if CONFIG_LPF_SB +#define LPF_DELTA_BITS 3 +#define LPF_STEP 2 +#define DELTA_RANGE (1 << LPF_DELTA_BITS) +#define MAX_LPF_OFFSET (LPF_STEP * ((1 << LPF_DELTA_BITS) - 1)) + +#define LPF_REUSE_CONTEXT 2 +#define LPF_DELTA_CONTEXT DELTA_RANGE +#define LPF_SIGN_CONTEXT 2 + +// Half of maximum loop filter length (15-tap) +#define FILT_BOUNDARY_OFFSET 8 +#define FILT_BOUNDARY_MI_OFFSET (FILT_BOUNDARY_OFFSET >> MI_SIZE_LOG2) +#endif // CONFIG_LPF_SB + // Bitstream profiles indicated by 2-3 bits in the uncompressed header. // 00: Profile 0. 8-bit 4:2:0 only. // 10: Profile 1. 8-bit 4:4:4, 4:2:2, and 4:4:0. @@ -113,6 +152,12 @@ typedef enum ATTRIBUTE_PACKED { BLOCK_16X4, BLOCK_8X32, BLOCK_32X8, + BLOCK_16X64, + BLOCK_64X16, +#if CONFIG_EXT_PARTITION + BLOCK_32X128, + BLOCK_128X32, +#endif // CONFIG_EXT_PARTITION BLOCK_SIZES_ALL, BLOCK_SIZES = BLOCK_4X16, BLOCK_INVALID = 255, @@ -125,10 +170,10 @@ typedef enum { PARTITION_VERT, PARTITION_SPLIT, #if CONFIG_EXT_PARTITION_TYPES - PARTITION_HORZ_A, // HORZ split and the left partition is split again - PARTITION_HORZ_B, // HORZ split and the right partition is split again - PARTITION_VERT_A, // VERT split and the top partition is split again - PARTITION_VERT_B, // VERT split and the bottom partition is split again + PARTITION_HORZ_A, // HORZ split and the top partition is split again + PARTITION_HORZ_B, // HORZ split and the bottom partition is split again + PARTITION_VERT_A, // VERT split and the left partition is split again + PARTITION_VERT_B, // VERT split and the right partition is split again PARTITION_HORZ_4, // 4:1 horizontal partition PARTITION_VERT_4, // 4:1 vertical partition EXT_PARTITION_TYPES, @@ -142,6 +187,7 @@ typedef char PARTITION_CONTEXT; #define PARTITION_BLOCK_SIZES (4 + CONFIG_EXT_PARTITION) #define PARTITION_CONTEXTS_PRIMARY (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET) #if CONFIG_UNPOISON_PARTITION_CTX +#define INVALID_PARTITION_CTX (-1) #define PARTITION_CONTEXTS \ (PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES) #else @@ -158,14 +204,18 @@ typedef enum ATTRIBUTE_PACKED { TX_16X16, // 16x16 transform TX_32X32, // 32x32 transform #if CONFIG_TX64X64 - TX_64X64, // 64x64 transform + TX_64X64, // 64x64 transform +#endif // CONFIG_TX64X64 + TX_4X8, // 4x8 transform + TX_8X4, // 8x4 transform + TX_8X16, // 8x16 transform + TX_16X8, // 16x8 transform + TX_16X32, // 16x32 transform + TX_32X16, // 32x16 transform +#if CONFIG_TX64X64 + TX_32X64, // 32x64 transform + TX_64X32, // 64x32 transform #endif // CONFIG_TX64X64 - TX_4X8, // 4x8 transform - TX_8X4, // 8x4 transform - TX_8X16, // 8x16 transform - TX_16X8, // 16x8 transform - TX_16X32, // 16x32 transform - TX_32X16, // 32x16 transform TX_4X16, // 4x16 transform TX_16X4, // 16x4 transform TX_8X32, // 8x32 transform @@ -182,6 +232,10 @@ typedef enum ATTRIBUTE_PACKED { #define MAX_TX_DEPTH (TX_SIZES - TX_SIZE_CTX_MIN) +#if CONFIG_CTX1D +#define MAX_HVTX_SIZE (1 << 5) +#endif // CONFIG_CTX1D + #define MAX_TX_SIZE_LOG2 (5 + CONFIG_TX64X64) #define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2) #define MIN_TX_SIZE_LOG2 2 @@ -192,11 +246,9 @@ typedef enum ATTRIBUTE_PACKED { #define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2) #define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2) -#define MAX_NUM_TXB (1 << (MAX_SB_SIZE_LOG2 - MIN_TX_SIZE_LOG2)) - -#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR +#if CONFIG_NCOBMC_ADAPT_WEIGHT typedef enum ATTRIBUTE_PACKED { - NO_OVERLAP, + NCOBMC_MODE_0, NCOBMC_MODE_1, NCOBMC_MODE_2, NCOBMC_MODE_3, @@ -204,20 +256,33 @@ typedef enum ATTRIBUTE_PACKED { NCOBMC_MODE_5, NCOBMC_MODE_6, NCOBMC_MODE_7, - NCOBMC_MODE_8, - MAX_NCOBMC_MODES -} NCOBMC_MODE; -// #define MAX_INTRPL_MODES 9 + ALL_NCOBMC_MODES, +#ifdef TWO_MODE + MAX_NCOBMC_MODES = NCOBMC_MODE_1 + 1, +#else + MAX_NCOBMC_MODES = ALL_NCOBMC_MODES, #endif + NO_OVERLAP = MAX_NCOBMC_MODES + 1 +} NCOBMC_MODE; + +typedef enum { + ADAPT_OVERLAP_BLOCK_8X8, + ADAPT_OVERLAP_BLOCK_16X16, + ADAPT_OVERLAP_BLOCK_32X32, + ADAPT_OVERLAP_BLOCK_64X64, + ADAPT_OVERLAP_BLOCKS, + ADAPT_OVERLAP_BLOCK_INVALID = 255 +} ADAPT_OVERLAP_BLOCK; +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT // frame transform mode typedef enum { - ONLY_4X4 = 0, // only 4x4 transform used - ALLOW_8X8 = 1, // allow block transform size up to 8x8 - ALLOW_16X16 = 2, // allow block transform size up to 16x16 - ALLOW_32X32 = 3, // allow block transform size up to 32x32 + ONLY_4X4, // only 4x4 transform used + ALLOW_8X8, // allow block transform size up to 8x8 + ALLOW_16X16, // allow block transform size up to 16x16 + ALLOW_32X32, // allow block transform size up to 32x32 #if CONFIG_TX64X64 - ALLOW_64X64 = 4, // allow block transform size up to 64x64 + ALLOW_64X64, // allow block transform size up to 64x64 #endif TX_MODE_SELECT, // transform specified for each block TX_MODES, @@ -225,33 +290,33 @@ typedef enum { // 1D tx types typedef enum { - DCT_1D = 0, - ADST_1D = 1, - FLIPADST_1D = 2, - IDTX_1D = 3, + DCT_1D, + ADST_1D, + FLIPADST_1D, + IDTX_1D, // TODO(sarahparker) need to eventually put something here for the // mrc experiment to make this work with the ext-tx pruning functions - TX_TYPES_1D = 4, + TX_TYPES_1D, } TX_TYPE_1D; typedef enum { - DCT_DCT = 0, // DCT in both horizontal and vertical - ADST_DCT = 1, // ADST in vertical, DCT in horizontal - DCT_ADST = 2, // DCT in vertical, ADST in horizontal - ADST_ADST = 3, // ADST in both directions + DCT_DCT, // DCT in both horizontal and vertical + ADST_DCT, // ADST in vertical, DCT in horizontal + DCT_ADST, // DCT in vertical, ADST in horizontal + ADST_ADST, // ADST in both directions #if CONFIG_EXT_TX - FLIPADST_DCT = 4, - DCT_FLIPADST = 5, - FLIPADST_FLIPADST = 6, - ADST_FLIPADST = 7, - FLIPADST_ADST = 8, - IDTX = 9, - V_DCT = 10, - H_DCT = 11, - V_ADST = 12, - H_ADST = 13, - V_FLIPADST = 14, - H_FLIPADST = 15, + FLIPADST_DCT, + DCT_FLIPADST, + FLIPADST_FLIPADST, + ADST_FLIPADST, + FLIPADST_ADST, + IDTX, + V_DCT, + H_DCT, + V_ADST, + H_ADST, + V_FLIPADST, + H_FLIPADST, #endif // CONFIG_EXT_TX #if CONFIG_MRC_TX MRC_DCT, // DCT in both directions with mrc based bitmask @@ -260,6 +325,28 @@ typedef enum { } TX_TYPE; #if CONFIG_EXT_TX +typedef enum { + // DCT only + EXT_TX_SET_DCTONLY, + // DCT + Identity only + EXT_TX_SET_DCT_IDTX, +#if CONFIG_MRC_TX + // DCT + MRC_DCT + EXT_TX_SET_MRC_DCT, + // DCT + MRC_DCT + IDTX + EXT_TX_SET_MRC_DCT_IDTX, +#endif // CONFIG_MRC_TX + // Discrete Trig transforms w/o flip (4) + Identity (1) + EXT_TX_SET_DTT4_IDTX, + // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2) + EXT_TX_SET_DTT4_IDTX_1DDCT, + // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2) + EXT_TX_SET_DTT9_IDTX_1DDCT, + // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6) + EXT_TX_SET_ALL16, + EXT_TX_SET_TYPES +} TxSetType; + #define IS_2D_TRANSFORM(tx_type) (tx_type < IDTX) #else #define IS_2D_TRANSFORM(tx_type) 1 @@ -304,14 +391,9 @@ typedef enum { AOM_LAST3_FLAG = 1 << 2, AOM_GOLD_FLAG = 1 << 3, AOM_BWD_FLAG = 1 << 4, -#if CONFIG_ALTREF2 AOM_ALT2_FLAG = 1 << 5, AOM_ALT_FLAG = 1 << 6, AOM_REFFRAME_ALL = (1 << 7) - 1 -#else // !CONFIG_ALTREF2 - AOM_ALT_FLAG = 1 << 5, - AOM_REFFRAME_ALL = (1 << 6) - 1 -#endif // CONFIG_ALTREF2 #else // !CONFIG_EXT_REFS AOM_GOLD_FLAG = 1 << 1, AOM_ALT_FLAG = 1 << 2, @@ -323,28 +405,56 @@ typedef enum { #define USE_UNI_COMP_REFS 1 typedef enum { - UNIDIR_COMP_REFERENCE = 0, - BIDIR_COMP_REFERENCE = 1, - COMP_REFERENCE_TYPES = 2, + UNIDIR_COMP_REFERENCE, + BIDIR_COMP_REFERENCE, + COMP_REFERENCE_TYPES, } COMP_REFERENCE_TYPE; #else // !CONFIG_EXT_COMP_REFS #define USE_UNI_COMP_REFS 0 #endif // CONFIG_EXT_COMP_REFS -typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE; +typedef enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } PLANE_TYPE; #if CONFIG_CFL -// TODO(ltrudeau) this should change based on QP size -#define CB_ALPHABET_SIZE 4 -#define CR_ALPHABET_SIZE 4 -#define CFL_ALPHABET_SIZE (CB_ALPHABET_SIZE * CR_ALPHABET_SIZE) -#define CFL_MAGS_SIZE 7 - -typedef enum { CFL_PRED_U = 0, CFL_PRED_V = 1, CFL_PRED_PLANES } CFL_PRED_TYPE; -typedef enum { CFL_SIGN_NEG = 0, CFL_SIGN_POS = 1, CFL_SIGNS } CFL_SIGN_TYPE; +#define CFL_ALPHABET_SIZE_LOG2 4 +#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2) +#define CFL_MAGS_SIZE ((2 << CFL_ALPHABET_SIZE_LOG2) + 1) +#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2) +#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1)) + +typedef enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } CFL_PRED_TYPE; + +typedef enum { + CFL_SIGN_ZERO, + CFL_SIGN_NEG, + CFL_SIGN_POS, + CFL_SIGNS +} CFL_SIGN_TYPE; + +// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid +#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1) +// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8 +#define CFL_SIGN_U(js) (((js + 1) * 11) >> 5) +// CFL_SIGN_V is equivalent to (js + 1) % 3 for js in 0 to 8 +#define CFL_SIGN_V(js) ((js + 1) - CFL_SIGNS * CFL_SIGN_U(js)) + +// There is no context when the alpha for a given plane is zero. +// So there are 2 fewer contexts than joint signs. +#define CFL_ALPHA_CONTEXTS (CFL_JOINT_SIGNS + 1 - CFL_SIGNS) +#define CFL_CONTEXT_U(js) (js + 1 - CFL_SIGNS) +// Also, the contexts are symmetric under swapping the planes. +#define CFL_CONTEXT_V(js) \ + (CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS) #endif -#if CONFIG_PALETTE +typedef enum { + PALETTE_MAP, +#if CONFIG_MRC_TX + MRC_MAP, +#endif // CONFIG_MRC_TX + COLOR_MAP_TYPES, +} COLOR_MAP_TYPE; + typedef enum { TWO_COLORS, THREE_COLORS, @@ -367,33 +477,29 @@ typedef enum { PALETTE_COLOR_EIGHT, PALETTE_COLORS } PALETTE_COLOR; -#endif // CONFIG_PALETTE // Note: All directional predictors must be between V_PRED and D63_PRED (both // inclusive). typedef enum ATTRIBUTE_PACKED { - DC_PRED, // Average of above and left pixels - V_PRED, // Vertical - H_PRED, // Horizontal - D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi) - D135_PRED, // Directional 135 deg = 180 - 45 - D117_PRED, // Directional 117 deg = 180 - 63 - D153_PRED, // Directional 153 deg = 180 - 27 - D207_PRED, // Directional 207 deg = 180 + 27 - D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi) -#if CONFIG_ALT_INTRA + DC_PRED, // Average of above and left pixels + V_PRED, // Vertical + H_PRED, // Horizontal + D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi) + D135_PRED, // Directional 135 deg = 180 - 45 + D117_PRED, // Directional 117 deg = 180 - 63 + D153_PRED, // Directional 153 deg = 180 - 27 + D207_PRED, // Directional 207 deg = 180 + 27 + D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi) SMOOTH_PRED, // Combination of horizontal and vertical interpolation #if CONFIG_SMOOTH_HV SMOOTH_V_PRED, // Vertical interpolation SMOOTH_H_PRED, // Horizontal interpolation #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA TM_PRED, // True-motion NEARESTMV, NEARMV, ZEROMV, NEWMV, -#if CONFIG_EXT_INTER #if CONFIG_COMPOUND_SINGLEREF // Single ref compound modes SR_NEAREST_NEARMV, @@ -411,7 +517,6 @@ typedef enum ATTRIBUTE_PACKED { NEW_NEARMV, ZERO_ZEROMV, NEW_NEWMV, -#endif // CONFIG_EXT_INTER MB_MODE_COUNT, INTRA_MODES = TM_PRED + 1, // TM_PRED has to be the last intra mode. INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks @@ -421,23 +526,22 @@ typedef enum ATTRIBUTE_PACKED { // TODO(ltrudeau) Do we really want to pack this? // TODO(ltrudeau) Do we match with PREDICTION_MODE? typedef enum ATTRIBUTE_PACKED { - UV_DC_PRED, // Average of above and left pixels - UV_V_PRED, // Vertical - UV_H_PRED, // Horizontal - UV_D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi) - UV_D135_PRED, // Directional 135 deg = 180 - 45 - UV_D117_PRED, // Directional 117 deg = 180 - 63 - UV_D153_PRED, // Directional 153 deg = 180 - 27 - UV_D207_PRED, // Directional 207 deg = 180 + 27 - UV_D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi) -#if CONFIG_ALT_INTRA + UV_DC_PRED, // Average of above and left pixels + UV_V_PRED, // Vertical + UV_H_PRED, // Horizontal + UV_D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi) + UV_D135_PRED, // Directional 135 deg = 180 - 45 + UV_D117_PRED, // Directional 117 deg = 180 - 63 + UV_D153_PRED, // Directional 153 deg = 180 - 27 + UV_D207_PRED, // Directional 207 deg = 180 + 27 + UV_D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi) UV_SMOOTH_PRED, // Combination of horizontal and vertical interpolation #if CONFIG_SMOOTH_HV UV_SMOOTH_V_PRED, // Vertical interpolation UV_SMOOTH_H_PRED, // Horizontal interpolation #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA UV_TM_PRED, // True-motion + UV_CFL_PRED, // Chroma-from-Luma UV_INTRA_MODES, UV_MODE_INVALID, // For uv_mode in inter blocks } UV_PREDICTION_MODE; @@ -449,47 +553,35 @@ typedef enum ATTRIBUTE_PACKED { #endif // CONFIG_CFL typedef enum { - SIMPLE_TRANSLATION = 0, + SIMPLE_TRANSLATION, #if CONFIG_MOTION_VAR OBMC_CAUSAL, // 2-sided OBMC -#endif // CONFIG_MOTION_VAR +#if CONFIG_NCOBMC_ADAPT_WEIGHT + NCOBMC_ADAPT_WEIGHT, +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT +#endif // CONFIG_MOTION_VAR #if CONFIG_WARPED_MOTION WARPED_CAUSAL, // 2-sided WARPED #endif // CONFIG_WARPED_MOTION -#if CONFIG_NCOBMC_ADAPT_WEIGHT - NCOBMC_ADAPT_WEIGHT, -#endif MOTION_MODES -} MOTION_MODE; - -#if CONFIG_NCOBMC_ADAPT_WEIGHT -typedef enum { - ADAPT_OVERLAP_BLOCK_8X8, - ADAPT_OVERLAP_BLOCK_16X16, - ADAPT_OVERLAP_BLOCK_32X32, - ADAPT_OVERLAP_BLOCK_64X64, - ADAPT_OVERLAP_BLOCKS, - ADAPT_OVERLAP_BLOCK_INVALID = 255 -} ADAPT_OVERLAP_BLOCK; +#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_WARPED_MOTION + , + OBMC_FAMILY_MODES = NCOBMC_ADAPT_WEIGHT + 1 #endif +} MOTION_MODE; -#if CONFIG_EXT_INTER #if CONFIG_INTERINTRA typedef enum { - II_DC_PRED = 0, + II_DC_PRED, II_V_PRED, II_H_PRED, -#if CONFIG_ALT_INTRA II_SMOOTH_PRED, -#else - II_TM_PRED, -#endif // CONFIG_ALT_INTRA INTERINTRA_MODES } INTERINTRA_MODE; #endif typedef enum { - COMPOUND_AVERAGE = 0, + COMPOUND_AVERAGE, #if CONFIG_WEDGE COMPOUND_WEDGE, #endif // CONFIG_WEDGE @@ -498,7 +590,6 @@ typedef enum { #endif // CONFIG_COMPOUND_SEGMENT COMPOUND_TYPES, } COMPOUND_TYPE; -#endif // CONFIG_EXT_INTER // TODO(huisu): Consider adding FILTER_SMOOTH_PRED to "FILTER_INTRA_MODE". #if CONFIG_FILTER_INTRA @@ -523,13 +614,11 @@ typedef enum { #define INTER_MODES (1 + NEWMV - NEARESTMV) -#if CONFIG_EXT_INTER #if CONFIG_COMPOUND_SINGLEREF #define INTER_SINGLEREF_COMP_MODES (1 + SR_NEW_NEWMV - SR_NEAREST_NEARMV) #endif // CONFIG_COMPOUND_SINGLEREF #define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV) -#endif // CONFIG_EXT_INTER #define SKIP_CONTEXTS 3 @@ -553,7 +642,6 @@ typedef enum { #define SKIP_NEARESTMV_SUB8X8_OFFSET 11 #define INTER_MODE_CONTEXTS 7 -#if CONFIG_DELTA_Q #define DELTA_Q_SMALL 3 #define DELTA_Q_PROBS (DELTA_Q_SMALL) #define DEFAULT_DELTA_Q_RES 4 @@ -562,7 +650,6 @@ typedef enum { #define DELTA_LF_PROBS (DELTA_LF_SMALL) #define DEFAULT_DELTA_LF_RES 2 #endif -#endif /* Segment Feature Masks */ #define MAX_MV_REF_CANDIDATES 2 @@ -583,9 +670,9 @@ typedef enum { #define UNI_COMP_REF_CONTEXTS 3 #endif // CONFIG_EXT_COMP_REFS -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF #define COMP_INTER_MODE_CONTEXTS 4 -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF #if CONFIG_VAR_TX #define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 2) @@ -601,14 +688,8 @@ typedef uint8_t TXFM_CONTEXT; #define LAST3_FRAME 3 #define GOLDEN_FRAME 4 #define BWDREF_FRAME 5 - -#if CONFIG_ALTREF2 #define ALTREF2_FRAME 6 #define ALTREF_FRAME 7 -#else // !CONFIG_ALTREF2 -#define ALTREF_FRAME 6 -#endif // CONFIG_ALTREF2 - #define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1) #else // !CONFIG_EXT_REFS #define GOLDEN_FRAME 2 @@ -651,9 +732,9 @@ typedef enum { #if CONFIG_LOOP_RESTORATION typedef enum { - RESTORE_NONE = 0, - RESTORE_WIENER = 1, - RESTORE_SGRPROJ = 2, + RESTORE_NONE, + RESTORE_WIENER, + RESTORE_SGRPROJ, RESTORE_SWITCHABLE, RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE, RESTORE_TYPES, @@ -662,7 +743,7 @@ typedef enum { #if CONFIG_FRAME_SUPERRES #define SUPERRES_SCALE_BITS 3 -#define SUPERRES_SCALE_NUMERATOR_MIN 8 +#define SUPERRES_SCALE_DENOMINATOR_MIN 8 #endif // CONFIG_FRAME_SUPERRES #if CONFIG_LPF_DIRECT @@ -678,6 +759,27 @@ typedef enum { } FILTER_DEGREE; #endif // CONFIG_LPF_DIRECT +#if CONFIG_OBU +// R19 +typedef enum { + OBU_SEQUENCE_HEADER = 1, + OBU_TD = 2, + OBU_FRAME_HEADER = 3, + OBU_TILE_GROUP = 4, + OBU_METADATA = 5, + OBU_PADDING = 15, +} OBU_TYPE; +#endif + +#if CONFIG_LGT_FROM_PRED +#define LGT_SIZES 2 +// Note: at least one of LGT_FROM_PRED_INTRA and LGT_FROM_PRED_INTER must be 1 +#define LGT_FROM_PRED_INTRA 1 +#define LGT_FROM_PRED_INTER 1 +// LGT_SL_INTRA: LGTs with a mode-dependent first self-loop and a break point +#define LGT_SL_INTRA 0 +#endif // CONFIG_LGT_FROM_PRED + #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/filter.c b/third_party/aom/av1/common/filter.c index c5555e34e..135132316 100644 --- a/third_party/aom/av1/common/filter.c +++ b/third_party/aom/av1/common/filter.c @@ -51,7 +51,6 @@ DECLARE_ALIGNED(16, static const int16_t, #if USE_EXTRA_FILTER DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 }, { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 }, { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 }, @@ -60,22 +59,10 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 }, { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 }, { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 } -#else - // intfilt 0.575 - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 }, - { -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 }, - { -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 }, - { -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 }, - { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 }, - { -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 }, - { -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 }, - { -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 }, -#endif }; DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_regular_uv[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 }, { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 }, { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 }, @@ -84,17 +71,6 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 }, { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 }, { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 } -#else - // intfilt 0.575 - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 }, - { -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 }, - { -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 }, - { -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 }, - { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 }, - { -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 }, - { -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 }, - { -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 }, -#endif }; #if USE_12TAP_FILTER @@ -134,7 +110,6 @@ DECLARE_ALIGNED(256, static const int16_t, #else DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 }, { -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 }, { -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 }, @@ -143,16 +118,6 @@ DECLARE_ALIGNED(256, static const InterpKernel, { -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 }, { -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 }, { -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 } -#else - { 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 }, - { -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 }, - { -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 }, - { -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 }, - { -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 }, - { -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 }, - { -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 }, - { -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 } -#endif }; #endif @@ -184,7 +149,6 @@ DECLARE_ALIGNED(256, static const InterpKernel, DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 }, { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 }, { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 }, @@ -193,22 +157,10 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 }, { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 }, { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 } -#else - // freqmultiplier = 0.8 - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 }, - { 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 }, - { 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 }, - { 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 }, - { 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 }, - { 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 }, - { 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 }, - { 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 }, -#endif }; DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_smooth_uv[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 }, { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 }, { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 }, @@ -217,23 +169,11 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 }, { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 }, { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 } -#else - // freqmultiplier = 0.8 - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 }, - { 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 }, - { 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 }, - { 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 }, - { 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 }, - { 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 }, - { 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 }, - { 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 }, -#endif }; -#else // USE_EXTRA_FILTER +#else // USE_EXTRA_FILTER DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 }, { 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 }, { 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 }, @@ -242,21 +182,10 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 }, { 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 }, { 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 } -#else - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 }, - { -1, 3, -10, 122, 18, -6, 2, 0 }, { -1, 4, -13, 118, 27, -9, 3, -1 }, - { -1, 4, -16, 112, 37, -11, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 }, - { -1, 5, -19, 97, 58, -16, 5, -1 }, { -1, 6, -19, 88, 68, -18, 5, -1 }, - { -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 5, -18, 68, 88, -19, 6, -1 }, - { -1, 5, -16, 58, 97, -19, 5, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 }, - { -1, 4, -11, 37, 112, -16, 4, -1 }, { -1, 3, -9, 27, 118, -13, 4, -1 }, - { 0, 2, -6, 18, 122, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 } -#endif }; DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 }, { -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 }, { -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 }, @@ -265,21 +194,10 @@ DECLARE_ALIGNED(256, static const InterpKernel, { -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 }, { -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 }, { -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 } -#else - { 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 }, - { -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 }, - { -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 }, - { -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 }, - { -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 }, - { -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 }, - { -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 }, - { -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 } -#endif }; DECLARE_ALIGNED(256, static const InterpKernel, sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = { -#if CONFIG_FILTER_7BIT { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 }, { 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 }, { 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 }, @@ -288,16 +206,6 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 }, { 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 }, { 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 } -#else - { 0, 0, 0, 128, 0, 0, 0, 0 }, { -3, -1, 32, 64, 38, 1, -3, 0 }, - { -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 26, 63, 43, 4, -4, 0 }, - { -2, -3, 24, 62, 46, 5, -4, 0 }, { -2, -3, 21, 60, 49, 7, -4, 0 }, - { -1, -4, 18, 59, 51, 9, -4, 0 }, { -1, -4, 16, 57, 53, 12, -4, -1 }, - { -1, -4, 14, 55, 55, 14, -4, -1 }, { -1, -4, 12, 53, 57, 16, -4, -1 }, - { 0, -4, 9, 51, 59, 18, -4, -1 }, { 0, -4, 7, 49, 60, 21, -3, -2 }, - { 0, -4, 5, 46, 62, 24, -3, -2 }, { 0, -4, 4, 43, 63, 26, -2, -2 }, - { 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 } -#endif }; #endif // USE_EXTRA_FILTER diff --git a/third_party/aom/av1/common/filter.h b/third_party/aom/av1/common/filter.h index d791af173..343e87560 100644 --- a/third_party/aom/av1/common/filter.h +++ b/third_party/aom/av1/common/filter.h @@ -12,6 +12,8 @@ #ifndef AV1_COMMON_FILTER_H_ #define AV1_COMMON_FILTER_H_ +#include <assert.h> + #include "./aom_config.h" #include "aom/aom_integer.h" #include "aom_dsp/aom_filter.h" @@ -30,10 +32,10 @@ extern "C" { typedef enum { EIGHTTAP_REGULAR, EIGHTTAP_SMOOTH, - MULTITAP_SHARP, #if USE_EXTRA_FILTER EIGHTTAP_SMOOTH2, #endif // USE_EXTRA_FILTER + MULTITAP_SHARP, BILINEAR, #if USE_EXTRA_FILTER EIGHTTAP_SHARP, @@ -51,6 +53,49 @@ typedef enum { #endif } InterpFilter; +// With CONFIG_DUAL_FILTER, pack two InterpFilter's into a uint32_t: since +// there are at most 10 filters, we can use 16 bits for each and have more than +// enough space. This reduces argument passing and unifies the operation of +// setting a (pair of) filters. +// +// Without CONFIG_DUAL_FILTER, +#if CONFIG_DUAL_FILTER +typedef uint32_t InterpFilters; +static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters, + int x_filter) { + return (InterpFilter)((filters >> (x_filter ? 16 : 0)) & 0xffff); +} + +static INLINE InterpFilters av1_make_interp_filters(InterpFilter y_filter, + InterpFilter x_filter) { + uint16_t y16 = y_filter & 0xffff; + uint16_t x16 = x_filter & 0xffff; + return y16 | ((uint32_t)x16 << 16); +} + +static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) { + return av1_make_interp_filters(filter, filter); +} +#else +typedef InterpFilter InterpFilters; +static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters, + int x_filter) { +#ifdef NDEBUG + (void)x_filter; +#endif + assert(!x_filter); + return filters; +} + +static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) { + return filter; +} +#endif + +static INLINE InterpFilter av1_unswitchable_filter(InterpFilter filter) { + return filter == SWITCHABLE ? EIGHTTAP_REGULAR : filter; +} + #if USE_EXTRA_FILTER #define LOG_SWITCHABLE_FILTERS \ 3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */ diff --git a/third_party/aom/av1/common/idct.c b/third_party/aom/av1/common/idct.c index 7915b7034..53c2ba1f0 100644 --- a/third_party/aom/av1/common/idct.c +++ b/third_party/aom/av1/common/idct.c @@ -19,15 +19,14 @@ #include "av1/common/blockd.h" #include "av1/common/enums.h" #include "av1/common/idct.h" +#if CONFIG_DAALA_DCT4 || CONFIG_DAALA_DCT8 || CONFIG_DAALA_DCT16 || \ + CONFIG_DAALA_DCT32 || CONFIG_DAALA_DCT64 +#include "av1/common/daala_tx.h" +#endif int av1_get_tx_scale(const TX_SIZE tx_size) { - if (txsize_sqr_up_map[tx_size] == TX_32X32) return 1; -#if CONFIG_TX64X64 - else if (txsize_sqr_up_map[tx_size] == TX_64X64) - return 2; -#endif // CONFIG_TX64X64 - else - return 0; + const int pels = tx_size_2d[tx_size]; + return (pels > 256) + (pels > 1024) + (pels > 4096); } // NOTE: The implementation of all inverses need to be aware of the fact @@ -37,41 +36,37 @@ int av1_get_tx_scale(const TX_SIZE tx_size) { static void iidtx4_c(const tran_low_t *input, tran_low_t *output) { int i; for (i = 0; i < 4; ++i) { -#if CONFIG_DAALA_DCT4 - output[i] = input[i]; -#else output[i] = (tran_low_t)dct_const_round_shift(input[i] * Sqrt2); -#endif } } static void iidtx8_c(const tran_low_t *input, tran_low_t *output) { int i; for (i = 0; i < 8; ++i) { -#if CONFIG_DAALA_DCT8 - output[i] = input[i]; -#else output[i] = input[i] * 2; -#endif } } static void iidtx16_c(const tran_low_t *input, tran_low_t *output) { int i; - for (i = 0; i < 16; ++i) + for (i = 0; i < 16; ++i) { output[i] = (tran_low_t)dct_const_round_shift(input[i] * 2 * Sqrt2); + } } static void iidtx32_c(const tran_low_t *input, tran_low_t *output) { int i; - for (i = 0; i < 32; ++i) output[i] = input[i] * 4; + for (i = 0; i < 32; ++i) { + output[i] = input[i] * 4; + } } -#if CONFIG_TX64X64 +#if CONFIG_TX64X64 && !CONFIG_DAALA_DCT64 static void iidtx64_c(const tran_low_t *input, tran_low_t *output) { int i; - for (i = 0; i < 64; ++i) + for (i = 0; i < 64; ++i) { output[i] = (tran_low_t)dct_const_round_shift(input[i] * 4 * Sqrt2); + } } #endif // CONFIG_TX64X64 #endif // CONFIG_EXT_TX @@ -91,7 +86,7 @@ static void ihalfright32_c(const tran_low_t *input, tran_low_t *output) { // Note overall scaling factor is 4 times orthogonal } -#if CONFIG_TX64X64 +#if CONFIG_TX64X64 && !CONFIG_DAALA_DCT64 static void idct64_col_c(const tran_low_t *input, tran_low_t *output) { int32_t in[64], out[64]; int i; @@ -127,15 +122,16 @@ static void ihalfright64_c(const tran_low_t *input, tran_low_t *output) { // Inverse identity transform and add. #if CONFIG_EXT_TX static void inv_idtx_add_c(const tran_low_t *input, uint8_t *dest, int stride, - int bs, int tx_type) { + int bsx, int bsy, TX_TYPE tx_type) { int r, c; - const int shift = bs < 32 ? 3 : (bs < 64 ? 2 : 1); + const int pels = bsx * bsy; + const int shift = 3 - ((pels > 256) + (pels > 1024)); if (tx_type == IDTX) { - for (r = 0; r < bs; ++r) { - for (c = 0; c < bs; ++c) + for (r = 0; r < bsy; ++r) { + for (c = 0; c < bsx; ++c) dest[c] = clip_pixel_add(dest[c], input[c] >> shift); dest += stride; - input += bs; + input += bsx; } } } @@ -149,7 +145,7 @@ static void inv_idtx_add_c(const tran_low_t *input, uint8_t *dest, int stride, #if CONFIG_EXT_TX static void maybe_flip_strides(uint8_t **dst, int *dstride, tran_low_t **src, - int *sstride, int tx_type, int sizey, + int *sstride, TX_TYPE tx_type, int sizey, int sizex) { // Note that the transpose of src will be added to dst. In order to LR // flip the addends (in dst coordinates), we UD flip the src. To UD flip @@ -190,32 +186,41 @@ static void maybe_flip_strides(uint8_t **dst, int *dstride, tran_low_t **src, #if CONFIG_HIGHBITDEPTH #if CONFIG_EXT_TX && CONFIG_TX64X64 static void highbd_inv_idtx_add_c(const tran_low_t *input, uint8_t *dest8, - int stride, int bs, int tx_type, int bd) { + int stride, int bsx, int bsy, TX_TYPE tx_type, + int bd) { int r, c; - const int shift = bs < 32 ? 3 : 2; + const int pels = bsx * bsy; + const int shift = 3 - ((pels > 256) + (pels > 1024)); uint16_t *dest = CONVERT_TO_SHORTPTR(dest8); if (tx_type == IDTX) { - for (r = 0; r < bs; ++r) { - for (c = 0; c < bs; ++c) + for (r = 0; r < bsy; ++r) { + for (c = 0; c < bsx; ++c) dest[c] = highbd_clip_pixel_add(dest[c], input[c] >> shift, bd); dest += stride; - input += bs; + input += bsx; } } } #endif // CONFIG_EXT_TX && CONFIG_TX64X64 #endif // CONFIG_HIGHBITDEPTH -#if CONFIG_LGT +#if CONFIG_LGT || CONFIG_LGT_FROM_PRED void ilgt4(const tran_low_t *input, tran_low_t *output, const tran_high_t *lgtmtx) { - if (!(input[0] | input[1] | input[2] | input[3])) { - output[0] = output[1] = output[2] = output[3] = 0; + if (!lgtmtx) assert(0); +#if CONFIG_LGT_FROM_PRED + // For DCT/ADST, use butterfly implementations + if (lgtmtx[0] == DCT4) { + aom_idct4_c(input, output); + return; + } else if (lgtmtx[0] == ADST4) { + aom_iadst4_c(input, output); return; } +#endif // CONFIG_LGT_FROM_PRED - // evaluate s[j] = sum of all lgtmtx[i][j]*input[i] over i=1,...,4 + // evaluate s[j] = sum of all lgtmtx[j]*input[i] over i=1,...,4 tran_high_t s[4] = { 0 }; for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) s[j] += lgtmtx[i * 4 + j] * input[i]; @@ -225,41 +230,485 @@ void ilgt4(const tran_low_t *input, tran_low_t *output, void ilgt8(const tran_low_t *input, tran_low_t *output, const tran_high_t *lgtmtx) { - // evaluate s[j] = sum of all lgtmtx[i][j]*input[i] over i=1,...,8 + if (!lgtmtx) assert(0); +#if CONFIG_LGT_FROM_PRED + // For DCT/ADST, use butterfly implementations + if (lgtmtx[0] == DCT8) { + aom_idct8_c(input, output); + return; + } else if (lgtmtx[0] == ADST8) { + aom_iadst8_c(input, output); + return; + } +#endif // CONFIG_LGT_FROM_PRED + + // evaluate s[j] = sum of all lgtmtx[j]*input[i] over i=1,...,8 tran_high_t s[8] = { 0 }; for (int i = 0; i < 8; ++i) for (int j = 0; j < 8; ++j) s[j] += lgtmtx[i * 8 + j] * input[i]; for (int i = 0; i < 8; ++i) output[i] = WRAPLOW(dct_const_round_shift(s[i])); } +#endif // CONFIG_LGT || CONFIG_LGT_FROM_PRED -// The get_inv_lgt functions return 1 if LGT is chosen to apply, and 0 otherwise -int get_inv_lgt4(transform_1d tx_orig, const TxfmParam *txfm_param, - const tran_high_t *lgtmtx[], int ntx) { - // inter/intra split - if (tx_orig == &aom_iadst4_c) { - for (int i = 0; i < ntx; ++i) - lgtmtx[i] = txfm_param->is_inter ? &lgt4_170[0][0] : &lgt4_140[0][0]; +#if CONFIG_LGT +// get_lgt4 and get_lgt8 return 1 and pick a lgt matrix if LGT is chosen to +// apply. Otherwise they return 0 +int get_lgt4(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx) { + if (is_col && (vtx_tab[txfm_param->tx_type] == ADST_1D || + vtx_tab[txfm_param->tx_type] == FLIPADST_1D)) { + lgtmtx[0] = txfm_param->is_inter ? &lgt4_170[0][0] : &lgt4_140[0][0]; + return 1; + } else if (!is_col && (htx_tab[txfm_param->tx_type] == ADST_1D || + htx_tab[txfm_param->tx_type] == FLIPADST_1D)) { + lgtmtx[0] = txfm_param->is_inter ? &lgt4_170[0][0] : &lgt4_140[0][0]; return 1; } + lgtmtx[0] = NULL; return 0; } -int get_inv_lgt8(transform_1d tx_orig, const TxfmParam *txfm_param, - const tran_high_t *lgtmtx[], int ntx) { - // inter/intra split - if (tx_orig == &aom_iadst8_c) { - for (int i = 0; i < ntx; ++i) - lgtmtx[i] = txfm_param->is_inter ? &lgt8_170[0][0] : &lgt8_150[0][0]; +int get_lgt8(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx) { + if (is_col && (vtx_tab[txfm_param->tx_type] == ADST_1D || + vtx_tab[txfm_param->tx_type] == FLIPADST_1D)) { + lgtmtx[0] = txfm_param->is_inter ? &lgt8_170[0][0] : &lgt8_150[0][0]; + return 1; + } else if (!is_col && (htx_tab[txfm_param->tx_type] == ADST_1D || + htx_tab[txfm_param->tx_type] == FLIPADST_1D)) { + lgtmtx[0] = txfm_param->is_inter ? &lgt8_170[0][0] : &lgt8_150[0][0]; return 1; } + lgtmtx[0] = NULL; return 0; } #endif // CONFIG_LGT +#if CONFIG_LGT_FROM_PRED +void ilgt16up(const tran_low_t *input, tran_low_t *output, + const tran_high_t *lgtmtx) { + if (lgtmtx[0] == DCT16) { + aom_idct16_c(input, output); + return; + } else if (lgtmtx[0] == ADST16) { + aom_iadst16_c(input, output); + return; + } else if (lgtmtx[0] == DCT32) { + aom_idct32_c(input, output); + return; + } else if (lgtmtx[0] == ADST32) { + ihalfright32_c(input, output); + return; + } else { + assert(0); + } +} + +void get_discontinuity_1d(uint8_t *arr, int n, int *idx_max_diff) { + *idx_max_diff = -1; + + int temp = 0, max_diff = 0, min_diff = INT_MAX; + for (int i = 1; i < n; ++i) { + temp = abs(arr[i] - arr[i - 1]); + if (temp > max_diff) { + max_diff = temp; + *idx_max_diff = i; + } + if (temp < min_diff) min_diff = temp; + } +} + +void get_discontinuity_2d(uint8_t *dst, int stride, int n, int is_col, + int *idx_max_diff, int ntx) { + *idx_max_diff = -1; + + int diff = 0, temp = 0, max_diff = 0, min_diff = INT_MAX; + for (int i = 1; i < n; ++i) { + temp = 0; + for (int j = 0; j < ntx; ++j) { + if (is_col) // vertical diff + diff = dst[i * stride + j] - dst[(i - 1) * stride + j]; + else // horizontal diff + diff = dst[j * stride + i] - dst[j * stride + i - 1]; + temp += diff * diff; + } + // temp/w is the i-th avg square diff + if (temp > max_diff) { + max_diff = temp; + *idx_max_diff = i; + } + if (temp < min_diff) min_diff = temp; + } +} + +int idx_selfloop_wrt_mode(PREDICTION_MODE mode, int is_col) { + // 0: no self-loop + // 1: small self-loop + // 2: medium self-loop + // 3: large self-loop + switch (mode) { + case DC_PRED: + case SMOOTH_PRED: + // predition is good for both directions: large SLs for row and col + return 3; + case TM_PRED: return 0; +#if CONFIG_SMOOTH_HV + case SMOOTH_H_PRED: +#endif + case H_PRED: + // prediction is good for H direction: large SL for row only + return is_col ? 0 : 3; +#if CONFIG_SMOOTH_HV + case SMOOTH_V_PRED: +#endif + case V_PRED: + // prediction is good for V direction: large SL for col only + return is_col ? 3 : 0; +#if LGT_SL_INTRA + // directional mode: choose SL based on the direction + case D45_PRED: return is_col ? 2 : 0; + case D63_PRED: return is_col ? 3 : 0; + case D117_PRED: return is_col ? 3 : 1; + case D135_PRED: return 2; + case D153_PRED: return is_col ? 1 : 3; + case D207_PRED: return is_col ? 0 : 3; +#else + case D45_PRED: + case D63_PRED: + case D117_PRED: return is_col ? 3 : 0; + case D135_PRED: + case D153_PRED: + case D207_PRED: return is_col ? 0 : 3; +#endif + // inter: no SL + default: return 0; + } +} + +void get_lgt4_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx) { + PREDICTION_MODE mode = txfm_param->mode; + int stride = txfm_param->stride; + uint8_t *dst = txfm_param->dst; + int bp = -1; + uint8_t arr[4]; + + // Each lgt4mtx_arr[k][i] corresponds to a line graph with a self-loop on + // the first node, and possibly a weak edge within the line graph. i is + // the index of the weak edge (between the i-th and (i+1)-th pixels, i=0 + // means no weak edge). k corresponds to the first self-loop's weight + const tran_high_t *lgt4mtx_arr[4][4] = { + { &lgt4_000[0][0], &lgt4_000w1[0][0], &lgt4_000w2[0][0], + &lgt4_000w3[0][0] }, + { &lgt4_060[0][0], &lgt4_060_000w1[0][0], &lgt4_060_000w2[0][0], + &lgt4_060_000w3[0][0] }, + { &lgt4_100[0][0], &lgt4_100_000w1[0][0], &lgt4_100_000w2[0][0], + &lgt4_100_000w3[0][0] }, + { &lgt4_150[0][0], &lgt4_150_000w1[0][0], &lgt4_150_000w2[0][0], + &lgt4_150_000w3[0][0] }, + }; + + // initialize to DCT or some LGTs, and then change later if necessary + int idx_sl = idx_selfloop_wrt_mode(mode, is_col); + lgtmtx[0] = lgt4mtx_arr[idx_sl][0]; + + // find the break point and replace the line graph by the one with a + // break point + if (mode == DC_PRED || mode == SMOOTH_PRED) { + // Do not use break point, since 1) is_left_available and is_top_available + // in DC_PRED are not known by txfm_param for now, so accessing + // both boundaries anyway may cause a mismatch 2) DC prediciton + // typically yields very smooth residues so having the break point + // does not usually improve the RD result. + return; + } else if (mode == TM_PRED) { + // TM_PRED: use both 1D top boundary and 1D left boundary + if (is_col) + for (int i = 0; i < 4; ++i) arr[i] = dst[i * stride]; + else + for (int i = 0; i < 4; ++i) arr[i] = dst[i]; + get_discontinuity_1d(&arr[0], 4, &bp); + } else if (mode == V_PRED) { + // V_PRED: use 1D top boundary only + if (is_col) return; + for (int i = 0; i < 4; ++i) arr[i] = dst[i]; + get_discontinuity_1d(&arr[0], 4, &bp); + } else if (mode == H_PRED) { + // H_PRED: use 1D left boundary only + if (!is_col) return; + for (int i = 0; i < 4; ++i) arr[i] = dst[i * stride]; + get_discontinuity_1d(&arr[0], 4, &bp); +#if CONFIG_SMOOTH_HV + } else if (mode == SMOOTH_V_PRED) { + if (is_col) return; + for (int i = 0; i < 4; ++i) arr[i] = dst[-stride + i]; + get_discontinuity_1d(&arr[0], 4, &bp); + } else if (mode == SMOOTH_H_PRED) { + if (!is_col) return; + for (int i = 0; i < 4; ++i) arr[i] = dst[i * stride - 1]; + get_discontinuity_1d(&arr[0], 4, &bp); +#endif + } else if (mode == D45_PRED || mode == D63_PRED || mode == D117_PRED) { + // directional modes closer to vertical (maybe include D135 later) + if (!is_col) get_discontinuity_2d(dst, stride, 4, 0, &bp, ntx); + } else if (mode == D135_PRED || mode == D153_PRED || mode == D207_PRED) { + // directional modes closer to horizontal + if (is_col) get_discontinuity_2d(dst, stride, 4, 1, &bp, ntx); + } else if (mode > TM_PRED) { + // inter + get_discontinuity_2d(dst, stride, 4, is_col, &bp, ntx); + } + +#if LGT_SL_INTRA + if (bp != -1) lgtmtx[0] = lgt4mtx_arr[idx_sl][bp]; +#else + if (bp != -1) lgtmtx[0] = lgt4mtx_arr[0][bp]; +#endif +} + +void get_lgt8_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx) { + PREDICTION_MODE mode = txfm_param->mode; + int stride = txfm_param->stride; + uint8_t *dst = txfm_param->dst; + int bp = -1; + uint8_t arr[8]; + + const tran_high_t *lgt8mtx_arr[4][8] = { + { &lgt8_000[0][0], &lgt8_000w1[0][0], &lgt8_000w2[0][0], &lgt8_000w3[0][0], + &lgt8_000w4[0][0], &lgt8_000w5[0][0], &lgt8_000w6[0][0], + &lgt8_000w7[0][0] }, + { &lgt8_060[0][0], &lgt8_060_000w1[0][0], &lgt8_060_000w2[0][0], + &lgt8_060_000w3[0][0], &lgt8_060_000w4[0][0], &lgt8_060_000w5[0][0], + &lgt8_060_000w6[0][0], &lgt8_060_000w7[0][0] }, + { &lgt8_100[0][0], &lgt8_100_000w1[0][0], &lgt8_100_000w2[0][0], + &lgt8_100_000w3[0][0], &lgt8_100_000w4[0][0], &lgt8_100_000w5[0][0], + &lgt8_100_000w6[0][0], &lgt8_100_000w7[0][0] }, + { &lgt8_150[0][0], &lgt8_150_000w1[0][0], &lgt8_150_000w2[0][0], + &lgt8_150_000w3[0][0], &lgt8_150_000w4[0][0], &lgt8_150_000w5[0][0], + &lgt8_150_000w6[0][0], &lgt8_150_000w7[0][0] }, + }; + + int idx_sl = idx_selfloop_wrt_mode(mode, is_col); + lgtmtx[0] = lgt8mtx_arr[idx_sl][0]; + + if (mode == DC_PRED || mode == SMOOTH_PRED) { + return; + } else if (mode == TM_PRED) { + if (is_col) + for (int i = 0; i < 8; ++i) arr[i] = dst[i * stride]; + else + for (int i = 0; i < 8; ++i) arr[i] = dst[i]; + get_discontinuity_1d(&arr[0], 8, &bp); + } else if (mode == V_PRED) { + if (is_col) return; + for (int i = 0; i < 8; ++i) arr[i] = dst[i]; + get_discontinuity_1d(&arr[0], 8, &bp); + } else if (mode == H_PRED) { + if (!is_col) return; + for (int i = 0; i < 8; ++i) arr[i] = dst[i * stride]; + get_discontinuity_1d(&arr[0], 8, &bp); +#if CONFIG_SMOOTH_HV + } else if (mode == SMOOTH_V_PRED) { + if (is_col) return; + for (int i = 0; i < 8; ++i) arr[i] = dst[-stride + i]; + get_discontinuity_1d(&arr[0], 8, &bp); + } else if (mode == SMOOTH_H_PRED) { + if (!is_col) return; + for (int i = 0; i < 8; ++i) arr[i] = dst[i * stride - 1]; + get_discontinuity_1d(&arr[0], 8, &bp); +#endif + } else if (mode == D45_PRED || mode == D63_PRED || mode == D117_PRED) { + if (!is_col) get_discontinuity_2d(dst, stride, 8, 0, &bp, ntx); + } else if (mode == D135_PRED || mode == D153_PRED || mode == D207_PRED) { + if (is_col) get_discontinuity_2d(dst, stride, 8, 1, &bp, ntx); + } else if (mode > TM_PRED) { + get_discontinuity_2d(dst, stride, 8, is_col, &bp, ntx); + } + +#if LGT_SL_INTRA + if (bp != -1) lgtmtx[0] = lgt8mtx_arr[idx_sl][bp]; +#else + if (bp != -1) lgtmtx[0] = lgt8mtx_arr[0][bp]; +#endif +} + +// Since LGTs with length >8 are not implemented now, the following function +// will just call DCT or ADST +void get_lgt16up_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx) { + int tx_length = is_col ? tx_size_high[txfm_param->tx_size] + : tx_size_wide[txfm_param->tx_size]; + assert(tx_length == 16 || tx_length == 32); + PREDICTION_MODE mode = txfm_param->mode; + + (void)ntx; + const tran_high_t *dctmtx = + tx_length == 16 ? &lgt16_000[0][0] : &lgt32_000[0][0]; + const tran_high_t *adstmtx = + tx_length == 16 ? &lgt16_200[0][0] : &lgt32_200[0][0]; + + switch (mode) { + case DC_PRED: + case TM_PRED: + case SMOOTH_PRED: + // prediction from both top and left -> ADST + lgtmtx[0] = adstmtx; + break; + case V_PRED: + case D45_PRED: + case D63_PRED: + case D117_PRED: +#if CONFIG_SMOOTH_HV + case SMOOTH_V_PRED: +#endif + // prediction from the top more than from the left -> ADST + lgtmtx[0] = is_col ? adstmtx : dctmtx; + break; + case H_PRED: + case D135_PRED: + case D153_PRED: + case D207_PRED: +#if CONFIG_SMOOTH_HV + case SMOOTH_H_PRED: +#endif + // prediction from the left more than from the top -> DCT + lgtmtx[0] = is_col ? dctmtx : adstmtx; + break; + default: lgtmtx[0] = dctmtx; break; + } +} + +typedef void (*IlgtFunc)(const tran_low_t *input, tran_low_t *output, + const tran_high_t *lgtmtx); + +static IlgtFunc ilgt_func[4] = { ilgt4, ilgt8, ilgt16up, ilgt16up }; + +typedef void (*GetLgtFunc)(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx); + +static GetLgtFunc get_lgt_func[4] = { get_lgt4_from_pred, get_lgt8_from_pred, + get_lgt16up_from_pred, + get_lgt16up_from_pred }; + +// this inline function corresponds to the up scaling before the transpose +// operation in the av1_iht* functions +static INLINE tran_low_t inv_upscale_wrt_txsize(const tran_high_t val, + const TX_SIZE tx_size) { + switch (tx_size) { + case TX_4X4: + case TX_8X8: + case TX_4X16: + case TX_16X4: + case TX_8X32: + case TX_32X8: return (tran_low_t)val; + case TX_4X8: + case TX_8X4: + case TX_8X16: + case TX_16X8: return (tran_low_t)dct_const_round_shift(val * Sqrt2); + default: assert(0); break; + } + return 0; +} + +// This inline function corresponds to the bit shift before summing with the +// destination in the av1_iht* functions +static INLINE tran_low_t inv_downscale_wrt_txsize(const tran_low_t val, + const TX_SIZE tx_size) { + switch (tx_size) { + case TX_4X4: return ROUND_POWER_OF_TWO(val, 4); + case TX_4X8: + case TX_8X4: + case TX_8X8: + case TX_4X16: + case TX_16X4: return ROUND_POWER_OF_TWO(val, 5); + case TX_8X16: + case TX_16X8: + case TX_8X32: + case TX_32X8: return ROUND_POWER_OF_TWO(val, 6); + default: assert(0); break; + } + return 0; +} + +void ilgt2d_from_pred_add(const tran_low_t *input, uint8_t *dest, int stride, + const TxfmParam *txfm_param) { + const TX_SIZE tx_size = txfm_param->tx_size; + const int w = tx_size_wide[tx_size]; + const int h = tx_size_high[tx_size]; + const int wlog2 = tx_size_wide_log2[tx_size]; + const int hlog2 = tx_size_high_log2[tx_size]; + assert(w <= 8 || h <= 8); + + int i, j; + // largest 1D size allowed for LGT: 32 + // largest 2D size allowed for LGT: 8x32=256 + tran_low_t tmp[256], out[256], temp1d[32]; + const tran_high_t *lgtmtx_col[1]; + const tran_high_t *lgtmtx_row[1]; + get_lgt_func[hlog2 - 2](txfm_param, 1, lgtmtx_col, w); + get_lgt_func[wlog2 - 2](txfm_param, 0, lgtmtx_row, h); + +// for inverse transform, to be consistent with av1_iht functions, we always +// apply row transforms first and column transforms second, but both +// row-first and column-first versions are implemented here for future +// tests (use different lgtmtx_col[i], and choose row or column tx first +// depending on transforms). +#if 1 + // inverse column transforms + for (i = 0; i < w; ++i) { + // transpose + for (j = 0; j < h; ++j) tmp[i * h + j] = input[j * w + i]; + ilgt_func[hlog2 - 2](&tmp[i * h], temp1d, lgtmtx_col[0]); + // upscale, and store in place + for (j = 0; j < h; ++j) + tmp[i * h + j] = inv_upscale_wrt_txsize(temp1d[j], tx_size); + } + // inverse row transforms + for (i = 0; i < h; ++i) { + for (j = 0; j < w; ++j) temp1d[j] = tmp[j * h + i]; + ilgt_func[wlog2 - 2](temp1d, &out[i * w], lgtmtx_row[0]); + } + // downscale + sum with the destination + for (i = 0; i < h; ++i) { + for (j = 0; j < w; ++j) { + int d = i * stride + j; + int s = i * w + j; + dest[d] = + clip_pixel_add(dest[d], inv_downscale_wrt_txsize(out[s], tx_size)); + } + } +#else + // inverse row transforms + for (i = 0; i < h; ++i) { + ilgt_func[wlog2 - 2](input, temp1d, lgtmtx_row[0]); + // upscale and transpose (tmp[j*h+i] <--> tmp[j][i]) + for (j = 0; j < w; ++j) + tmp[j * h + i] = inv_upscale_wrt_txsize(temp1d[j], tx_size); + input += w; + } + // inverse column transforms + for (i = 0; i < w; ++i) + ilgt_func[hlog2 - 2](&tmp[i * h], &out[i * h], lgtmtx_col[0]); + // here, out[] is the transpose of 2D block of transform coefficients + + // downscale + transform + sum with dest + for (i = 0; i < h; ++i) { + for (j = 0; j < w; ++j) { + int d = i * stride + j; + int s = j * h + i; + dest[d] = + clip_pixel_add(dest[d], inv_downscale_wrt_txsize(out[s], tx_size)); + } + } +#endif +} +#endif // CONFIG_LGT_FROM_PRED + void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -270,6 +719,26 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, } #endif static const transform_2d IHT_4[] = { +#if CONFIG_DAALA_DCT4 + { daala_idct4, daala_idct4 }, // DCT_DCT = 0 + { daala_idst4, daala_idct4 }, // ADST_DCT = 1 + { daala_idct4, daala_idst4 }, // DCT_ADST = 2 + { daala_idst4, daala_idst4 }, // ADST_ADST = 3 +#if CONFIG_EXT_TX + { daala_idst4, daala_idct4 }, // FLIPADST_DCT + { daala_idct4, daala_idst4 }, // DCT_FLIPADST + { daala_idst4, daala_idst4 }, // FLIPADST_FLIPADST + { daala_idst4, daala_idst4 }, // ADST_FLIPADST + { daala_idst4, daala_idst4 }, // FLIPADST_ADST + { daala_idtx4, daala_idtx4 }, // IDTX + { daala_idct4, daala_idtx4 }, // V_DCT + { daala_idtx4, daala_idct4 }, // H_DCT + { daala_idst4, daala_idtx4 }, // V_ADST + { daala_idtx4, daala_idst4 }, // H_ADST + { daala_idst4, daala_idtx4 }, // V_FLIPADST + { daala_idtx4, daala_idst4 }, // H_FLIPADST +#endif +#else { aom_idct4_c, aom_idct4_c }, // DCT_DCT = 0 { aom_iadst4_c, aom_idct4_c }, // ADST_DCT = 1 { aom_idct4_c, aom_iadst4_c }, // DCT_ADST = 2 @@ -288,6 +757,7 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, { aom_iadst4_c, iidtx4_c }, // V_FLIPADST { iidtx4_c, aom_iadst4_c }, // H_FLIPADST #endif +#endif }; int i, j; @@ -301,24 +771,22 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, #endif #if CONFIG_LGT - const tran_high_t *lgtmtx_col[4]; - const tran_high_t *lgtmtx_row[4]; - int use_lgt_col = - get_inv_lgt4(IHT_4[tx_type].cols, txfm_param, lgtmtx_col, 4); - int use_lgt_row = - get_inv_lgt4(IHT_4[tx_type].rows, txfm_param, lgtmtx_row, 4); + const tran_high_t *lgtmtx_col[1]; + const tran_high_t *lgtmtx_row[1]; + int use_lgt_col = get_lgt4(txfm_param, 1, lgtmtx_col); + int use_lgt_row = get_lgt4(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors for (i = 0; i < 4; ++i) { #if CONFIG_DAALA_DCT4 tran_low_t temp_in[4]; - for (j = 0; j < 4; j++) temp_in[j] = input[j] << 1; + for (j = 0; j < 4; j++) temp_in[j] = input[j] * 2; IHT_4[tx_type].rows(temp_in, out[i]); #else #if CONFIG_LGT if (use_lgt_row) - ilgt4(input, out[i], lgtmtx_row[i]); + ilgt4(input, out[i], lgtmtx_row[0]); else #endif IHT_4[tx_type].rows(input, out[i]); @@ -337,7 +805,7 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < 4; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt4(tmp[i], out[i], lgtmtx_col[i]); + ilgt4(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_4[tx_type].cols(tmp[i], out[i]); @@ -363,7 +831,7 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -399,19 +867,17 @@ void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n2; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[4]; - const tran_high_t *lgtmtx_row[8]; - int use_lgt_col = - get_inv_lgt8(IHT_4x8[tx_type].cols, txfm_param, lgtmtx_col, 4); - int use_lgt_row = - get_inv_lgt4(IHT_4x8[tx_type].rows, txfm_param, lgtmtx_row, 8); + const tran_high_t *lgtmtx_col[1]; + const tran_high_t *lgtmtx_row[1]; + int use_lgt_col = get_lgt8(txfm_param, 1, lgtmtx_col); + int use_lgt_row = get_lgt4(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors and transpose for (i = 0; i < n2; ++i) { #if CONFIG_LGT if (use_lgt_row) - ilgt4(input, outtmp, lgtmtx_row[i]); + ilgt4(input, outtmp, lgtmtx_row[0]); else #endif IHT_4x8[tx_type].rows(input, outtmp); @@ -424,7 +890,7 @@ void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < n; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt8(tmp[i], out[i], lgtmtx_col[i]); + ilgt8(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_4x8[tx_type].cols(tmp[i], out[i]); @@ -446,7 +912,7 @@ void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -483,19 +949,17 @@ void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[8]; - const tran_high_t *lgtmtx_row[4]; - int use_lgt_col = - get_inv_lgt4(IHT_8x4[tx_type].cols, txfm_param, lgtmtx_col, 8); - int use_lgt_row = - get_inv_lgt8(IHT_8x4[tx_type].rows, txfm_param, lgtmtx_row, 4); + const tran_high_t *lgtmtx_col[1]; + const tran_high_t *lgtmtx_row[1]; + int use_lgt_col = get_lgt4(txfm_param, 1, lgtmtx_col); + int use_lgt_row = get_lgt8(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors and transpose for (i = 0; i < n; ++i) { #if CONFIG_LGT if (use_lgt_row) - ilgt8(input, outtmp, lgtmtx_row[i]); + ilgt8(input, outtmp, lgtmtx_row[0]); else #endif IHT_8x4[tx_type].rows(input, outtmp); @@ -508,7 +972,7 @@ void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < n2; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt4(tmp[i], out[i], lgtmtx_col[i]); + ilgt4(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_8x4[tx_type].cols(tmp[i], out[i]); @@ -530,7 +994,7 @@ void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -566,16 +1030,15 @@ void av1_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n4; #if CONFIG_LGT - const tran_high_t *lgtmtx_row[16]; - int use_lgt_row = - get_inv_lgt4(IHT_4x16[tx_type].rows, txfm_param, lgtmtx_row, 16); + const tran_high_t *lgtmtx_row[1]; + int use_lgt_row = get_lgt4(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors and transpose for (i = 0; i < n4; ++i) { #if CONFIG_LGT if (use_lgt_row) - ilgt4(input, outtmp, lgtmtx_row[i]); + ilgt4(input, outtmp, lgtmtx_row[0]); else #endif IHT_4x16[tx_type].rows(input, outtmp); @@ -604,7 +1067,7 @@ void av1_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -641,9 +1104,8 @@ void av1_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[16]; - int use_lgt_col = - get_inv_lgt4(IHT_16x4[tx_type].cols, txfm_param, lgtmtx_col, 16); + const tran_high_t *lgtmtx_col[1]; + int use_lgt_col = get_lgt4(txfm_param, 1, lgtmtx_col); #endif // inverse transform row vectors and transpose @@ -657,7 +1119,7 @@ void av1_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < n4; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt4(tmp[i], out[i], lgtmtx_col[i]); + ilgt4(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_16x4[tx_type].cols(tmp[i], out[i]); @@ -679,7 +1141,7 @@ void av1_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -715,16 +1177,15 @@ void av1_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n2; #if CONFIG_LGT - const tran_high_t *lgtmtx_row[16]; - int use_lgt_row = - get_inv_lgt8(IHT_8x16[tx_type].rows, txfm_param, lgtmtx_row, 16); + const tran_high_t *lgtmtx_row[1]; + int use_lgt_row = get_lgt8(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors and transpose for (i = 0; i < n2; ++i) { #if CONFIG_LGT if (use_lgt_row) - ilgt8(input, outtmp, lgtmtx_row[i]); + ilgt8(input, outtmp, lgtmtx_row[0]); else #endif IHT_8x16[tx_type].rows(input, outtmp); @@ -754,7 +1215,7 @@ void av1_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -791,9 +1252,8 @@ void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[16]; - int use_lgt_col = - get_inv_lgt8(IHT_16x8[tx_type].cols, txfm_param, lgtmtx_col, 16); + const tran_high_t *lgtmtx_col[1]; + int use_lgt_col = get_lgt8(txfm_param, 1, lgtmtx_col); #endif // inverse transform row vectors and transpose @@ -808,7 +1268,7 @@ void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < n2; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt8(tmp[i], out[i], lgtmtx_col[i]); + ilgt8(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_16x8[tx_type].cols(tmp[i], out[i]); @@ -830,7 +1290,7 @@ void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -866,16 +1326,15 @@ void av1_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n4; #if CONFIG_LGT - const tran_high_t *lgtmtx_row[32]; - int use_lgt_row = - get_inv_lgt8(IHT_8x32[tx_type].rows, txfm_param, lgtmtx_row, 32); + const tran_high_t *lgtmtx_row[1]; + int use_lgt_row = get_lgt8(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors and transpose for (i = 0; i < n4; ++i) { #if CONFIG_LGT if (use_lgt_row) - ilgt8(input, outtmp, lgtmtx_row[i]); + ilgt8(input, outtmp, lgtmtx_row[0]); else #endif IHT_8x32[tx_type].rows(input, outtmp); @@ -904,7 +1363,7 @@ void av1_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -941,9 +1400,8 @@ void av1_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = n; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[32]; - int use_lgt_col = - get_inv_lgt4(IHT_32x8[tx_type].cols, txfm_param, lgtmtx_col, 32); + const tran_high_t *lgtmtx_col[1]; + int use_lgt_col = get_lgt4(txfm_param, 1, lgtmtx_col); #endif // inverse transform row vectors and transpose @@ -957,7 +1415,7 @@ void av1_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < n4; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt8(tmp[i], out[i], lgtmtx_col[i]); + ilgt8(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_32x8[tx_type].cols(tmp[i], out[i]); @@ -979,7 +1437,7 @@ void av1_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -1041,7 +1499,7 @@ void av1_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -1103,7 +1561,7 @@ void av1_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -1111,6 +1569,26 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, assert(tx_type == DCT_DCT); #endif static const transform_2d IHT_8[] = { +#if CONFIG_DAALA_DCT8 + { daala_idct8, daala_idct8 }, // DCT_DCT = 0 + { daala_idst8, daala_idct8 }, // ADST_DCT = 1 + { daala_idct8, daala_idst8 }, // DCT_ADST = 2 + { daala_idst8, daala_idst8 }, // ADST_ADST = 3 +#if CONFIG_EXT_TX + { daala_idst8, daala_idct8 }, // FLIPADST_DCT + { daala_idct8, daala_idst8 }, // DCT_FLIPADST + { daala_idst8, daala_idst8 }, // FLIPADST_FLIPADST + { daala_idst8, daala_idst8 }, // ADST_FLIPADST + { daala_idst8, daala_idst8 }, // FLIPADST_ADST + { daala_idtx8, daala_idtx8 }, // IDTX + { daala_idct8, daala_idtx8 }, // V_DCT + { daala_idtx8, daala_idct8 }, // H_DCT + { daala_idst8, daala_idtx8 }, // V_ADST + { daala_idtx8, daala_idst8 }, // H_ADST + { daala_idst8, daala_idtx8 }, // V_FLIPADST + { daala_idtx8, daala_idst8 }, // H_FLIPADST +#endif +#else { aom_idct8_c, aom_idct8_c }, // DCT_DCT = 0 { aom_iadst8_c, aom_idct8_c }, // ADST_DCT = 1 { aom_idct8_c, aom_iadst8_c }, // DCT_ADST = 2 @@ -1129,6 +1607,7 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, { aom_iadst8_c, iidtx8_c }, // V_FLIPADST { iidtx8_c, aom_iadst8_c }, // H_FLIPADST #endif +#endif }; int i, j; @@ -1138,12 +1617,10 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, int outstride = 8; #if CONFIG_LGT - const tran_high_t *lgtmtx_col[8]; - const tran_high_t *lgtmtx_row[8]; - int use_lgt_col = - get_inv_lgt8(IHT_8[tx_type].cols, txfm_param, lgtmtx_col, 8); - int use_lgt_row = - get_inv_lgt8(IHT_8[tx_type].rows, txfm_param, lgtmtx_row, 8); + const tran_high_t *lgtmtx_col[1]; + const tran_high_t *lgtmtx_row[1]; + int use_lgt_col = get_lgt8(txfm_param, 1, lgtmtx_col); + int use_lgt_row = get_lgt8(txfm_param, 0, lgtmtx_row); #endif // inverse transform row vectors @@ -1155,7 +1632,7 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, #else #if CONFIG_LGT if (use_lgt_row) - ilgt8(input, out[i], lgtmtx_row[i]); + ilgt8(input, out[i], lgtmtx_row[0]); else #endif IHT_8[tx_type].rows(input, out[i]); @@ -1174,7 +1651,7 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (i = 0; i < 8; ++i) { #if CONFIG_LGT if (use_lgt_col) - ilgt8(tmp[i], out[i], lgtmtx_col[i]); + ilgt8(tmp[i], out[i], lgtmtx_col[0]); else #endif IHT_8[tx_type].cols(tmp[i], out[i]); @@ -1200,7 +1677,7 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride, void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -1208,6 +1685,26 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, assert(tx_type == DCT_DCT); #endif static const transform_2d IHT_16[] = { +#if CONFIG_DAALA_DCT16 + { daala_idct16, daala_idct16 }, // DCT_DCT = 0 + { daala_idst16, daala_idct16 }, // ADST_DCT = 1 + { daala_idct16, daala_idst16 }, // DCT_ADST = 2 + { daala_idst16, daala_idst16 }, // ADST_ADST = 3 +#if CONFIG_EXT_TX + { daala_idst16, daala_idct16 }, // FLIPADST_DCT + { daala_idct16, daala_idst16 }, // DCT_FLIPADST + { daala_idst16, daala_idst16 }, // FLIPADST_FLIPADST + { daala_idst16, daala_idst16 }, // ADST_FLIPADST + { daala_idst16, daala_idst16 }, // FLIPADST_ADST + { daala_idtx16, daala_idtx16 }, // IDTX + { daala_idct16, daala_idtx16 }, // V_DCT + { daala_idtx16, daala_idct16 }, // H_DCT + { daala_idst16, daala_idtx16 }, // V_ADST + { daala_idtx16, daala_idst16 }, // H_ADST + { daala_idst16, daala_idtx16 }, // V_FLIPADST + { daala_idtx16, daala_idst16 }, // H_FLIPADST +#endif +#else { aom_idct16_c, aom_idct16_c }, // DCT_DCT = 0 { aom_iadst16_c, aom_idct16_c }, // ADST_DCT = 1 { aom_idct16_c, aom_iadst16_c }, // DCT_ADST = 2 @@ -1226,6 +1723,7 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, { aom_iadst16_c, iidtx16_c }, // V_FLIPADST { iidtx16_c, aom_iadst16_c }, // H_FLIPADST #endif +#endif }; int i, j; @@ -1236,7 +1734,13 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, // inverse transform row vectors for (i = 0; i < 16; ++i) { +#if CONFIG_DAALA_DCT16 + tran_low_t temp_in[16]; + for (j = 0; j < 16; j++) temp_in[j] = input[j] * 2; + IHT_16[tx_type].rows(temp_in, out[i]); +#else IHT_16[tx_type].rows(input, out[i]); +#endif input += 16; } @@ -1259,20 +1763,45 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (j = 0; j < 16; ++j) { int d = i * stride + j; int s = j * outstride + i; +#if CONFIG_DAALA_DCT16 + dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 4)); +#else dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 6)); +#endif } } } -#if CONFIG_EXT_TX +#if CONFIG_EXT_TX || CONFIG_DAALA_DCT32 void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_DCT_ONLY assert(tx_type == DCT_DCT); #endif static const transform_2d IHT_32[] = { +#if CONFIG_DAALA_DCT32 + { daala_idct32, daala_idct32 }, // DCT_DCT +#if CONFIG_EXT_TX + { daala_idst32, daala_idct32 }, // ADST_DCT + { daala_idct32, daala_idst32 }, // DCT_ADST + { daala_idst32, daala_idst32 }, // ADST_ADST + { daala_idst32, daala_idct32 }, // FLIPADST_DCT + { daala_idct32, daala_idst32 }, // DCT_FLIPADST + { daala_idst32, daala_idst32 }, // FLIPADST_FLIPADST + { daala_idst32, daala_idst32 }, // ADST_FLIPADST + { daala_idst32, daala_idst32 }, // FLIPADST_ADST + { daala_idtx32, daala_idtx32 }, // IDTX + { daala_idct32, daala_idtx32 }, // V_DCT + { daala_idtx32, daala_idct32 }, // H_DCT + { daala_idst32, daala_idtx32 }, // V_ADST + { daala_idtx32, daala_idst32 }, // H_ADST + { daala_idst32, daala_idtx32 }, // V_FLIPADST + { daala_idtx32, daala_idst32 }, // H_FLIPADST +#endif +#else { aom_idct32_c, aom_idct32_c }, // DCT_DCT +#if CONFIG_EXT_TX { ihalfright32_c, aom_idct32_c }, // ADST_DCT { aom_idct32_c, ihalfright32_c }, // DCT_ADST { ihalfright32_c, ihalfright32_c }, // ADST_ADST @@ -1288,6 +1817,8 @@ void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride, { iidtx32_c, ihalfright32_c }, // H_ADST { ihalfright32_c, iidtx32_c }, // V_FLIPADST { iidtx32_c, ihalfright32_c }, // H_FLIPADST +#endif +#endif }; int i, j; @@ -1298,14 +1829,24 @@ void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride, // inverse transform row vectors for (i = 0; i < 32; ++i) { +#if CONFIG_DAALA_DCT32 + tran_low_t temp_in[32]; + for (j = 0; j < 32; j++) temp_in[j] = input[j] * 2; + IHT_32[tx_type].rows(temp_in, out[i]); +#else IHT_32[tx_type].rows(input, out[i]); +#endif input += 32; } // transpose for (i = 0; i < 32; i++) { for (j = 0; j < 32; j++) { +#if CONFIG_DAALA_DCT32 + tmp[j][i] = out[i][j] * 4; +#else tmp[j][i] = out[i][j]; +#endif } } @@ -1319,16 +1860,20 @@ void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (j = 0; j < 32; ++j) { int d = i * stride + j; int s = j * outstride + i; +#if CONFIG_DAALA_DCT32 + dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 5)); +#else dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 6)); +#endif } } } -#endif // CONFIG_EXT_TX +#endif // CONFIG_EXT_TX || CONFIG_DAALA_DCT32 #if CONFIG_TX64X64 void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; #if CONFIG_MRC_TX assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); #endif // CONFIG_MRC_TX @@ -1336,6 +1881,26 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride, assert(tx_type == DCT_DCT); #endif static const transform_2d IHT_64[] = { +#if CONFIG_DAALA_DCT64 + { daala_idct64, daala_idct64 }, // DCT_DCT + { daala_idst64, daala_idct64 }, // ADST_DCT + { daala_idct64, daala_idst64 }, // DCT_ADST + { daala_idst64, daala_idst64 }, // ADST_ADST +#if CONFIG_EXT_TX + { daala_idst64, daala_idct64 }, // FLIPADST_DCT + { daala_idct64, daala_idst64 }, // DCT_FLIPADST + { daala_idst64, daala_idst64 }, // FLIPADST_FLIPADST + { daala_idst64, daala_idst64 }, // ADST_FLIPADST + { daala_idst64, daala_idst64 }, // FLIPADST_ADST + { daala_idtx64, daala_idtx64 }, // IDTX + { daala_idct64, daala_idtx64 }, // V_DCT + { daala_idtx64, daala_idct64 }, // H_DCT + { daala_idst64, daala_idtx64 }, // V_ADST + { daala_idtx64, daala_idst64 }, // H_ADST + { daala_idst64, daala_idtx64 }, // V_FLIPADST + { daala_idtx64, daala_idst64 }, // H_FLIPADST +#endif +#else { idct64_col_c, idct64_row_c }, // DCT_DCT { ihalfright64_c, idct64_row_c }, // ADST_DCT { idct64_col_c, ihalfright64_c }, // DCT_ADST @@ -1354,6 +1919,7 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride, { ihalfright64_c, iidtx64_c }, // V_FLIPADST { iidtx64_c, ihalfright64_c }, // H_FLIPADST #endif +#endif }; int i, j; @@ -1364,8 +1930,15 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride, // inverse transform row vectors for (i = 0; i < 64; ++i) { +#if CONFIG_DAALA_DCT64 + tran_low_t temp_in[64]; + for (j = 0; j < 64; j++) temp_in[j] = input[j] * 2; + IHT_64[tx_type].rows(temp_in, out[i]); +// Do not rescale intermediate for Daala +#else IHT_64[tx_type].rows(input, out[i]); for (j = 0; j < 64; ++j) out[i][j] = ROUND_POWER_OF_TWO(out[i][j], 1); +#endif input += 64; } @@ -1388,10 +1961,139 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride, for (j = 0; j < 64; ++j) { int d = i * stride + j; int s = j * outstride + i; +#if CONFIG_DAALA_DCT64 + dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 2)); +#else dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 5)); +#endif } } } + +void av1_iht64x32_2048_add_c(const tran_low_t *input, uint8_t *dest, int stride, + const TxfmParam *txfm_param) { + const TX_TYPE tx_type = txfm_param->tx_type; +#if CONFIG_MRC_TX + assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); +#endif // CONFIG_MRC_TX +#if CONFIG_DCT_ONLY + assert(tx_type == DCT_DCT); +#endif + static const transform_2d IHT_64x32[] = { + { aom_idct32_c, idct64_row_c }, // DCT_DCT + { ihalfright32_c, idct64_row_c }, // ADST_DCT + { aom_idct32_c, ihalfright64_c }, // DCT_ADST + { ihalfright32_c, ihalfright64_c }, // ADST_ADST +#if CONFIG_EXT_TX + { ihalfright32_c, idct64_row_c }, // FLIPADST_DCT + { aom_idct32_c, ihalfright64_c }, // DCT_FLIPADST + { ihalfright32_c, ihalfright64_c }, // FLIPADST_FLIPADST + { ihalfright32_c, ihalfright64_c }, // ADST_FLIPADST + { ihalfright32_c, ihalfright64_c }, // FLIPADST_ADST + { iidtx32_c, iidtx64_c }, // IDTX + { aom_idct32_c, iidtx64_c }, // V_DCT + { iidtx32_c, idct64_row_c }, // H_DCT + { ihalfright32_c, iidtx64_c }, // V_ADST + { iidtx32_c, ihalfright64_c }, // H_ADST + { ihalfright32_c, iidtx64_c }, // V_FLIPADST + { iidtx32_c, ihalfright64_c }, // H_FLIPADST +#endif + }; + const int n = 32; + const int n2 = 64; + + int i, j; + tran_low_t out[64][32], tmp[64][32], outtmp[64]; + tran_low_t *outp = &out[0][0]; + int outstride = n; + + // inverse transform row vectors and transpose + for (i = 0; i < n; ++i) { + IHT_64x32[tx_type].rows(input, outtmp); + for (j = 0; j < n2; ++j) + tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * InvSqrt2); + input += n2; + } + + // inverse transform column vectors + for (i = 0; i < n2; ++i) IHT_64x32[tx_type].cols(tmp[i], out[i]); + +#if CONFIG_EXT_TX + maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n, n2); +#endif + + // Sum with the destination + for (i = 0; i < n; ++i) { + for (j = 0; j < n2; ++j) { + int d = i * stride + j; + int s = j * outstride + i; + dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 5)); + } + } +} + +void av1_iht32x64_2048_add_c(const tran_low_t *input, uint8_t *dest, int stride, + const TxfmParam *txfm_param) { + const TX_TYPE tx_type = txfm_param->tx_type; +#if CONFIG_MRC_TX + assert(tx_type != MRC_DCT && "Invalid tx type for tx size"); +#endif // CONFIG_MRC_TX +#if CONFIG_DCT_ONLY + assert(tx_type == DCT_DCT); +#endif + static const transform_2d IHT_32x64[] = { + { idct64_col_c, aom_idct32_c }, // DCT_DCT + { ihalfright64_c, aom_idct32_c }, // ADST_DCT + { idct64_col_c, ihalfright32_c }, // DCT_ADST + { ihalfright64_c, ihalfright32_c }, // ADST_ADST +#if CONFIG_EXT_TX + { ihalfright64_c, aom_idct32_c }, // FLIPADST_DCT + { idct64_col_c, ihalfright32_c }, // DCT_FLIPADST + { ihalfright64_c, ihalfright32_c }, // FLIPADST_FLIPADST + { ihalfright64_c, ihalfright32_c }, // ADST_FLIPADST + { ihalfright64_c, ihalfright32_c }, // FLIPADST_ADST + { iidtx64_c, iidtx32_c }, // IDTX + { idct64_col_c, iidtx32_c }, // V_DCT + { iidtx64_c, aom_idct32_c }, // H_DCT + { ihalfright64_c, iidtx32_c }, // V_ADST + { iidtx64_c, ihalfright32_c }, // H_ADST + { ihalfright64_c, iidtx32_c }, // V_FLIPADST + { iidtx64_c, ihalfright32_c }, // H_FLIPADST +#endif + }; + + const int n = 32; + const int n2 = 64; + int i, j; + tran_low_t out[32][64], tmp[32][64], outtmp[32]; + tran_low_t *outp = &out[0][0]; + int outstride = n2; + + // inverse transform row vectors and transpose + for (i = 0; i < n2; ++i) { + IHT_32x64[tx_type].rows(input, outtmp); + for (j = 0; j < n; ++j) + tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * InvSqrt2); + input += n; + } + + // inverse transform column vectors + for (i = 0; i < n; ++i) IHT_32x64[tx_type].cols(tmp[i], out[i]); + +#if CONFIG_EXT_TX + maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n2, n); +#endif + + // Sum with the destination + for (i = 0; i < n2; ++i) { + for (j = 0; j < n; ++j) { + int d = i * stride + j; + int s = j * outstride + i; + dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 5)); + } + } +} + #endif // CONFIG_TX64X64 // idct @@ -1440,6 +2142,7 @@ static void idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride, } #endif +#if !CONFIG_DAALA_DCT16 static void idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { // The calculation can be simplified if there are not many non-zero dct @@ -1462,6 +2165,7 @@ static void idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride, else aom_idct16x16_256_add(input, dest, stride); } +#endif #if CONFIG_MRC_TX static void imrc32x32_add_c(const tran_low_t *input, uint8_t *dest, int stride, @@ -1475,11 +2179,23 @@ static void imrc32x32_add_c(const tran_low_t *input, uint8_t *dest, int stride, #endif const int eob = txfm_param->eob; + int n_masked_vals = 0; + uint8_t *mask; + uint8_t mask_tmp[32 * 32]; if (eob == 1) { aom_idct32x32_1_add_c(input, dest, stride); } else { - tran_low_t mask[32 * 32]; - get_mrc_mask(txfm_param->dst, txfm_param->stride, mask, 32, 32, 32); + if ((txfm_param->is_inter && SIGNAL_MRC_MASK_INTER) || + (!txfm_param->is_inter && SIGNAL_MRC_MASK_INTRA)) { + mask = txfm_param->mask; + } else { + n_masked_vals = + get_mrc_pred_mask(txfm_param->dst, txfm_param->stride, mask_tmp, 32, + 32, 32, txfm_param->is_inter); + if (!is_valid_mrc_mask(n_masked_vals, 32, 32)) + assert(0 && "Invalid MRC mask"); + mask = mask_tmp; + } if (eob <= quarter) // non-zero coeff only in upper-left 8x8 aom_imrc32x32_34_add_c(input, dest, stride, mask); @@ -1492,6 +2208,7 @@ static void imrc32x32_add_c(const tran_low_t *input, uint8_t *dest, int stride, } #endif // CONFIG_MRC_TX +#if !CONFIG_DAALA_DCT32 static void idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { #if CONFIG_ADAPT_SCAN @@ -1514,14 +2231,15 @@ static void idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride, else aom_idct32x32_1024_add(input, dest, stride); } +#endif -#if CONFIG_TX64X64 +#if CONFIG_TX64X64 && !CONFIG_DAALA_DCT64 static void idct64x64_add(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { (void)txfm_param; - av1_iht64x64_4096_add(input, dest, stride, DCT_DCT); + av1_iht64x64_4096_add(input, dest, stride, txfm_param); } -#endif // CONFIG_TX64X64 +#endif // CONFIG_TX64X64 && !CONFIG_DAALA_DCT64 #if CONFIG_CHROMA_2X2 static void inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, int stride, @@ -1568,7 +2286,7 @@ static void inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride, case ADST_DCT: case DCT_ADST: case ADST_ADST: -#if CONFIG_LGT +#if CONFIG_LGT || CONFIG_DAALA_DCT4 // LGT only exists in C verson av1_iht4x4_16_add_c(input, dest, stride, txfm_param); break; @@ -1582,7 +2300,7 @@ static void inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: -#if CONFIG_LGT +#if CONFIG_LGT || CONFIG_DAALA_DCT4 av1_iht4x4_16_add_c(input, dest, stride, txfm_param); break; #else @@ -1598,7 +2316,7 @@ static void inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride, // Use C version since DST only exists in C code av1_iht4x4_16_add_c(input, dest, stride, txfm_param); break; - case IDTX: inv_idtx_add_c(input, dest, stride, 4, tx_type); break; + case IDTX: inv_idtx_add_c(input, dest, stride, 4, 4, tx_type); break; #endif // CONFIG_EXT_TX default: assert(0); break; } @@ -1689,6 +2407,18 @@ static void inv_txfm_add_32x16(const tran_low_t *input, uint8_t *dest, av1_iht32x16_512_add(input, dest, stride, txfm_param); } +#if CONFIG_TX64X64 +static void inv_txfm_add_32x64(const tran_low_t *input, uint8_t *dest, + int stride, const TxfmParam *txfm_param) { + av1_iht32x64_2048_add(input, dest, stride, txfm_param); +} + +static void inv_txfm_add_64x32(const tran_low_t *input, uint8_t *dest, + int stride, const TxfmParam *txfm_param) { + av1_iht64x32_2048_add(input, dest, stride, txfm_param); +} +#endif // CONFIG_TX64X64 + static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { const TX_TYPE tx_type = txfm_param->tx_type; @@ -1701,7 +2431,7 @@ static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, case ADST_DCT: case DCT_ADST: case ADST_ADST: -#if CONFIG_LGT +#if CONFIG_LGT || CONFIG_DAALA_DCT8 av1_iht8x8_64_add_c(input, dest, stride, txfm_param); break; #else @@ -1714,7 +2444,7 @@ static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: -#if CONFIG_LGT +#if CONFIG_LGT || CONFIG_DAALA_DCT8 av1_iht8x8_64_add_c(input, dest, stride, txfm_param); break; #else @@ -1730,7 +2460,7 @@ static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, // Use C version since DST only exists in C code av1_iht8x8_64_add_c(input, dest, stride, txfm_param); break; - case IDTX: inv_idtx_add_c(input, dest, stride, 8, tx_type); break; + case IDTX: inv_idtx_add_c(input, dest, stride, 8, 8, tx_type); break; #endif // CONFIG_EXT_TX default: assert(0); break; } @@ -1740,11 +2470,19 @@ static void inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { const TX_TYPE tx_type = txfm_param->tx_type; switch (tx_type) { +#if !CONFIG_DAALA_DCT16 case DCT_DCT: idct16x16_add(input, dest, stride, txfm_param); break; +#else + case DCT_DCT: +#endif case ADST_DCT: case DCT_ADST: case ADST_ADST: +#if CONFIG_DAALA_DCT16 + av1_iht16x16_256_add_c(input, dest, stride, txfm_param); +#else av1_iht16x16_256_add(input, dest, stride, txfm_param); +#endif // CONFIG_DAALA_DCT16 break; #if CONFIG_EXT_TX case FLIPADST_DCT: @@ -1758,9 +2496,13 @@ static void inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, case H_ADST: case V_FLIPADST: case H_FLIPADST: +#if CONFIG_DAALA_DCT16 + av1_iht16x16_256_add_c(input, dest, stride, txfm_param); +#else av1_iht16x16_256_add(input, dest, stride, txfm_param); +#endif // CONFIG_DAALA_DCT16 break; - case IDTX: inv_idtx_add_c(input, dest, stride, 16, tx_type); break; + case IDTX: inv_idtx_add_c(input, dest, stride, 16, 16, tx_type); break; #endif // CONFIG_EXT_TX #if CONFIG_MRC_TX case MRC_DCT: assert(0 && "Invalid tx type for tx size"); @@ -1773,7 +2515,13 @@ static void inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { const TX_TYPE tx_type = txfm_param->tx_type; switch (tx_type) { +#if !CONFIG_DAALA_DCT32 case DCT_DCT: idct32x32_add(input, dest, stride, txfm_param); break; +#else + case DCT_DCT: + av1_iht32x32_1024_add_c(input, dest, stride, txfm_param); + break; +#endif #if CONFIG_EXT_TX case ADST_DCT: case DCT_ADST: @@ -1791,7 +2539,7 @@ static void inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, case H_FLIPADST: av1_iht32x32_1024_add_c(input, dest, stride, txfm_param); break; - case IDTX: inv_idtx_add_c(input, dest, stride, 32, tx_type); break; + case IDTX: inv_idtx_add_c(input, dest, stride, 32, 32, tx_type); break; #endif // CONFIG_EXT_TX #if CONFIG_MRC_TX case MRC_DCT: imrc32x32_add_c(input, dest, stride, txfm_param); break; @@ -1804,8 +2552,13 @@ static void inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { const TX_TYPE tx_type = txfm_param->tx_type; + assert(tx_type == DCT_DCT); switch (tx_type) { +#if !CONFIG_DAALA_DCT64 case DCT_DCT: idct64x64_add(input, dest, stride, txfm_param); break; +#else + case DCT_DCT: +#endif #if CONFIG_EXT_TX case ADST_DCT: case DCT_ADST: @@ -1823,7 +2576,7 @@ static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, case H_FLIPADST: av1_iht64x64_4096_add_c(input, dest, stride, txfm_param); break; - case IDTX: inv_idtx_add_c(input, dest, stride, 64, tx_type); break; + case IDTX: inv_idtx_add_c(input, dest, stride, 64, 64, tx_type); break; #endif // CONFIG_EXT_TX #if CONFIG_MRC_TX case MRC_DCT: assert(0 && "Invalid tx type for tx size"); @@ -1847,7 +2600,7 @@ static void highbd_inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, int eob = txfm_param->eob; int bd = txfm_param->bd; int lossless = txfm_param->lossless; - TX_TYPE tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; tran_high_t a1 = input[0] >> UNIT_QUANT_SHIFT; tran_high_t b1 = input[1] >> UNIT_QUANT_SHIFT; tran_high_t c1 = input[2] >> UNIT_QUANT_SHIFT; @@ -1876,13 +2629,18 @@ static void highbd_inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, } #endif +static const int32_t *cast_to_int32(const tran_low_t *input) { + assert(sizeof(int32_t) == sizeof(tran_low_t)); + return (const int32_t *)input; +} + void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { int eob = txfm_param->eob; int bd = txfm_param->bd; int lossless = txfm_param->lossless; - const int32_t *src = (const int32_t *)input; - TX_TYPE tx_type = txfm_param->tx_type; + const int32_t *src = cast_to_int32(input); + const TX_TYPE tx_type = txfm_param->tx_type; if (lossless) { assert(tx_type == DCT_DCT); av1_highbd_iwht4x4_add(input, dest, stride, eob, bd); @@ -1923,51 +2681,67 @@ 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, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_4x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_8x4_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } static void highbd_inv_txfm_add_8x16(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_8x16_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } static void highbd_inv_txfm_add_16x8(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_16x8_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } static void highbd_inv_txfm_add_16x32(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_16x32_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } static void highbd_inv_txfm_add_32x16(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { - const int32_t *src = (const int32_t *)input; + const int32_t *src = cast_to_int32(input); av1_inv_txfm2d_add_32x16_c(src, CONVERT_TO_SHORTPTR(dest), stride, txfm_param->tx_type, txfm_param->bd); } +#if CONFIG_TX64X64 +static void highbd_inv_txfm_add_32x64(const tran_low_t *input, uint8_t *dest, + int stride, const TxfmParam *txfm_param) { + const int32_t *src = cast_to_int32(input); + av1_inv_txfm2d_add_32x64_c(src, CONVERT_TO_SHORTPTR(dest), stride, + txfm_param->tx_type, txfm_param->bd); +} + +static void highbd_inv_txfm_add_64x32(const tran_low_t *input, uint8_t *dest, + int stride, const TxfmParam *txfm_param) { + const int32_t *src = cast_to_int32(input); + av1_inv_txfm2d_add_64x32_c(src, CONVERT_TO_SHORTPTR(dest), stride, + txfm_param->tx_type, txfm_param->bd); +} +#endif // CONFIG_TX64X64 + static void highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { int bd = txfm_param->bd; - TX_TYPE tx_type = txfm_param->tx_type; - const int32_t *src = (const int32_t *)input; + const TX_TYPE tx_type = txfm_param->tx_type; + const int32_t *src = cast_to_int32(input); switch (tx_type) { case DCT_DCT: case ADST_DCT: @@ -2004,8 +2778,8 @@ static void highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, static void highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { int bd = txfm_param->bd; - TX_TYPE tx_type = txfm_param->tx_type; - const int32_t *src = (const int32_t *)input; + const TX_TYPE tx_type = txfm_param->tx_type; + const int32_t *src = cast_to_int32(input); switch (tx_type) { case DCT_DCT: case ADST_DCT: @@ -2042,37 +2816,37 @@ static void highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, static void highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { int bd = txfm_param->bd; - TX_TYPE tx_type = txfm_param->tx_type; - const int32_t *src = (const int32_t *)input; + const TX_TYPE tx_type = txfm_param->tx_type; + const int32_t *src = cast_to_int32(input); switch (tx_type) { case DCT_DCT: - case ADST_DCT: - case DCT_ADST: - case ADST_ADST: av1_inv_txfm2d_add_32x32(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; + + // The optimised version only supports DCT_DCT, so force use of + // the C version for all other transform types. + case ADST_DCT: + case DCT_ADST: + case ADST_ADST: #if CONFIG_EXT_TX case FLIPADST_DCT: case DCT_FLIPADST: case FLIPADST_FLIPADST: case ADST_FLIPADST: case FLIPADST_ADST: - 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 IDTX: case V_DCT: case H_DCT: case V_ADST: case H_ADST: case V_FLIPADST: case H_FLIPADST: - case IDTX: +#endif // CONFIG_EXT_TX av1_inv_txfm2d_add_32x32_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd); break; -#endif // CONFIG_EXT_TX + default: assert(0); } } @@ -2081,8 +2855,8 @@ static void highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { int bd = txfm_param->bd; - TX_TYPE tx_type = txfm_param->tx_type; - const int32_t *src = (const int32_t *)input; + const TX_TYPE tx_type = txfm_param->tx_type; + const int32_t *src = cast_to_int32(input); switch (tx_type) { case DCT_DCT: av1_inv_txfm2d_add_64x64(src, CONVERT_TO_SHORTPTR(dest), stride, DCT_DCT, @@ -2113,7 +2887,7 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, DCT_DCT, bd); break; case IDTX: - highbd_inv_idtx_add_c(input, dest, stride, 64, tx_type, bd); + highbd_inv_idtx_add_c(input, dest, stride, 64, 64, tx_type, bd); break; #endif // CONFIG_EXT_TX default: assert(0); break; @@ -2124,6 +2898,13 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest, void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, TxfmParam *txfm_param) { const TX_SIZE tx_size = txfm_param->tx_size; +#if CONFIG_LGT_FROM_PRED + if (txfm_param->use_lgt) { + assert(is_lgt_allowed(txfm_param->mode, tx_size)); + ilgt2d_from_pred_add(input, dest, stride, txfm_param); + return; + } +#endif // CONFIG_LGT_FROM_PRED switch (tx_size) { #if CONFIG_TX64X64 case TX_64X64: inv_txfm_add_64x64(input, dest, stride, txfm_param); break; @@ -2137,6 +2918,10 @@ void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, case TX_16X8: inv_txfm_add_16x8(input, dest, stride, txfm_param); break; case TX_16X32: inv_txfm_add_16x32(input, dest, stride, txfm_param); break; case TX_32X16: inv_txfm_add_32x16(input, dest, stride, txfm_param); break; +#if CONFIG_TX64X64 + case TX_64X32: inv_txfm_add_64x32(input, dest, stride, txfm_param); break; + case TX_32X64: inv_txfm_add_32x64(input, dest, stride, txfm_param); break; +#endif // CONFIG_TX64X64 case TX_4X4: // this is like av1_short_idct4x4 but has a special case around eob<=1 // which is significant (not just an optimization) for the lossless @@ -2162,32 +2947,35 @@ static void init_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size, txfm_param->tx_size = tx_size; txfm_param->eob = eob; txfm_param->lossless = xd->lossless[xd->mi[0]->mbmi.segment_id]; -#if CONFIG_HIGHBITDEPTH txfm_param->bd = xd->bd; -#endif #if CONFIG_LGT txfm_param->is_inter = is_inter_block(&xd->mi[0]->mbmi); #endif +#if CONFIG_LGT_FROM_PRED + txfm_param->use_lgt = xd->mi[0]->mbmi.use_lgt; +#endif #if CONFIG_ADAPT_SCAN txfm_param->eob_threshold = (const int16_t *)&xd->eob_threshold_md[tx_size][tx_type][0]; #endif } +#if !CONFIG_TXMG typedef void (*InvTxfmFunc)(const tran_low_t *dqcoeff, uint8_t *dst, int stride, TxfmParam *txfm_param); static InvTxfmFunc inv_txfm_func[2] = { av1_inv_txfm_add, av1_highbd_inv_txfm_add }; +#endif -// TODO(kslu) Change input arguments to TxfmParam, which contains mode, -// tx_type, tx_size, dst, stride, eob. Thus, the additional argument when LGT -// is on will no longer be needed. void av1_inverse_transform_block(const MACROBLOCKD *xd, const tran_low_t *dqcoeff, -#if CONFIG_LGT +#if CONFIG_LGT_FROM_PRED PREDICTION_MODE mode, #endif +#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + uint8_t *mrc_mask, +#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK TX_TYPE tx_type, TX_SIZE tx_size, uint8_t *dst, int stride, int eob) { if (!eob) return; @@ -2195,38 +2983,67 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd, const BLOCK_SIZE tx_bsize = txsize_to_bsize[tx_size]; const int txb_width = block_size_wide[tx_bsize]; const int txb_height = block_size_high[tx_bsize]; - int r, c; -#if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - for (r = 0; r < txb_height; r++) - for (c = 0; c < txb_width; c++) + for (int r = 0; r < txb_height; r++) + for (int c = 0; c < txb_width; c++) CONVERT_TO_SHORTPTR(dst)[r * stride + c] = 0; } else { -#endif // CONFIG_HIGHBITDEPTH - for (r = 0; r < txb_height; r++) - for (c = 0; c < txb_width; c++) dst[r * stride + c] = 0; -#if CONFIG_HIGHBITDEPTH + for (int r = 0; r < txb_height; r++) + for (int c = 0; c < txb_width; c++) dst[r * stride + c] = 0; } -#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_PVQ TxfmParam txfm_param; init_txfm_param(xd, tx_size, tx_type, eob, &txfm_param); #if CONFIG_LGT || CONFIG_MRC_TX + txfm_param.is_inter = is_inter_block(&xd->mi[0]->mbmi); +#endif // CONFIG_LGT || CONFIG_MRC_TX +#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + txfm_param.mask = mrc_mask; +#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK +#if CONFIG_LGT_FROM_PRED || CONFIG_MRC_TX txfm_param.dst = dst; txfm_param.stride = stride; -#endif // CONFIG_LGT || CONFIG_MRC_TX -#if CONFIG_LGT +#if CONFIG_LGT_FROM_PRED txfm_param.mode = mode; -#endif +#endif // CONFIG_LGT_FROM_PRED +#endif // CONFIG_LGT_FROM_PRED || CONFIG_MRC_TX const int is_hbd = get_bitdepth_data_path_index(xd); +#if CONFIG_TXMG + if (is_hbd) { + av1_highbd_inv_txfm_add(dqcoeff, dst, stride, &txfm_param); + } else { + DECLARE_ALIGNED(16, uint16_t, tmp[MAX_TX_SQUARE]); + int tmp_stride = MAX_TX_SIZE; + int w = tx_size_wide[tx_size]; + int h = tx_size_high[tx_size]; + for (int r = 0; r < h; ++r) { + for (int c = 0; c < w; ++c) { + tmp[r * tmp_stride + c] = dst[r * stride + c]; + } + } + + av1_highbd_inv_txfm_add(dqcoeff, CONVERT_TO_BYTEPTR(tmp), tmp_stride, + &txfm_param); + + for (int r = 0; r < h; ++r) { + for (int c = 0; c < w; ++c) { + dst[r * stride + c] = (uint8_t)tmp[r * tmp_stride + c]; + } + } + } +#else // CONFIG_TXMG inv_txfm_func[is_hbd](dqcoeff, dst, stride, &txfm_param); +#endif // CONFIG_TXMG } void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, int blk_row, int blk_col, int eob) { struct macroblockd_plane *const pd = &xd->plane[plane]; tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); +#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + uint8_t *mrc_mask = BLOCK_OFFSET(xd->mrc_mask, block); +#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK const PLANE_TYPE plane_type = get_plane_type(plane); const TX_SIZE tx_size = av1_get_tx_size(plane, xd); const TX_TYPE tx_type = @@ -2234,14 +3051,14 @@ void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, const int dst_stride = pd->dst.stride; uint8_t *dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]]; -#if CONFIG_LGT - PREDICTION_MODE mode = get_prediction_mode(xd->mi[0], plane, tx_size, block); - av1_inverse_transform_block(xd, dqcoeff, mode, tx_type, tx_size, dst, - dst_stride, eob); -#else - av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride, - eob); -#endif // CONFIG_LGT + av1_inverse_transform_block(xd, dqcoeff, +#if CONFIG_LGT_FROM_PRED + xd->mi[0]->mbmi.mode, +#endif // CONFIG_LGT_FROM_PRED +#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + mrc_mask, +#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + tx_type, tx_size, dst, dst_stride, eob); } void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, @@ -2280,6 +3097,14 @@ void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, case TX_32X16: highbd_inv_txfm_add_32x16(input, dest, stride, txfm_param); break; +#if CONFIG_TX64X64 + case TX_64X32: + highbd_inv_txfm_add_64x32(input, dest, stride, txfm_param); + break; + case TX_32X64: + highbd_inv_txfm_add_32x64(input, dest, stride, txfm_param); + break; +#endif // CONFIG_TX64X64 case TX_4X4: // this is like av1_short_idct4x4 but has a special case around eob<=1 // which is significant (not just an optimization) for the lossless @@ -2294,193 +3119,3 @@ void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, default: assert(0 && "Invalid transform size"); break; } } - -#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) { - assert(tx_type < TX_TYPES_1D); - static const transform_1d IHT[] = { aom_idct4_c, aom_iadst4_c, aom_iadst4_c, - iidtx4_c }; - const transform_1d inv_tx = IHT[tx_type]; - tran_low_t out[4]; - inv_tx(input, out); - for (int i = 0; i < 4; ++i) { - out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2); - dest[i * stride] = - clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4)); - } -} - -void av1_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest) { - assert(tx_type < TX_TYPES_1D); - static const transform_1d IHT[] = { aom_idct8_c, aom_iadst8_c, aom_iadst8_c, - iidtx8_c }; - const transform_1d inv_tx = IHT[tx_type]; - tran_low_t out[8]; - inv_tx(input, out); - for (int i = 0; i < 8; ++i) { - dest[i * stride] = - clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4)); - } -} - -void av1_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest) { - assert(tx_type < TX_TYPES_1D); - static const transform_1d IHT[] = { aom_idct16_c, aom_iadst16_c, - aom_iadst16_c, iidtx16_c }; - const transform_1d inv_tx = IHT[tx_type]; - tran_low_t out[16]; - inv_tx(input, out); - for (int i = 0; i < 16; ++i) { - out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2); - dest[i * stride] = - clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 5)); - } -} - -void av1_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest) { - assert(tx_type < TX_TYPES_1D); - static const transform_1d IHT[] = { aom_idct32_c, ihalfright32_c, - ihalfright32_c, iidtx32_c }; - const transform_1d inv_tx = IHT[tx_type]; - tran_low_t out[32]; - inv_tx(input, out); - for (int i = 0; i < 32; ++i) { - dest[i * stride] = - clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4)); - } -} - -dpcm_inv_txfm_add_func av1_get_dpcm_inv_txfm_add_func(int tx_length) { - switch (tx_length) { - case 4: return av1_dpcm_inv_txfm_add_4_c; - case 8: return av1_dpcm_inv_txfm_add_8_c; - case 16: return av1_dpcm_inv_txfm_add_16_c; - case 32: - return av1_dpcm_inv_txfm_add_32_c; - // TODO(huisu): add support for TX_64X64. - default: assert(0); return NULL; - } -} - -#if CONFIG_HIGHBITDEPTH -// TODO(sarahparker) I am adding a quick workaround for these functions -// to remove the old hbd transforms. This will be cleaned up in a followup. -void av1_hbd_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir) { - assert(tx_type < TX_TYPES_1D); - static const TxfmFunc IHT[] = { av1_idct4_new, av1_iadst4_new, av1_iadst4_new, - av1_iidentity4_c }; - // In order { horizontal, vertical } - static const TXFM_1D_CFG *inv_txfm_cfg_ls[TX_TYPES_1D][2] = { - { &inv_txfm_1d_row_cfg_dct_4, &inv_txfm_1d_col_cfg_dct_4 }, - { &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_4 }, - { &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_4 }, - { &inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_4 } - }; - - const TXFM_1D_CFG *inv_txfm_cfg = inv_txfm_cfg_ls[tx_type][dir]; - const TxfmFunc inv_tx = IHT[tx_type]; - - tran_low_t out[4]; - inv_tx(input, out, inv_txfm_cfg->cos_bit, inv_txfm_cfg->stage_range); - for (int i = 0; i < 4; ++i) { - out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2); - dest[i * stride] = highbd_clip_pixel_add(dest[i * stride], - ROUND_POWER_OF_TWO(out[i], 4), bd); - } -} - -void av1_hbd_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir) { - assert(tx_type < TX_TYPES_1D); - static const TxfmFunc IHT[] = { av1_idct4_new, av1_iadst4_new, av1_iadst4_new, - av1_iidentity4_c }; - // In order { horizontal, vertical } - static const TXFM_1D_CFG *inv_txfm_cfg_ls[TX_TYPES_1D][2] = { - { &inv_txfm_1d_row_cfg_dct_8, &inv_txfm_1d_col_cfg_dct_8 }, - { &inv_txfm_1d_row_cfg_adst_8, &inv_txfm_1d_col_cfg_adst_8 }, - { &inv_txfm_1d_row_cfg_adst_8, &inv_txfm_1d_col_cfg_adst_8 }, - { &inv_txfm_1d_cfg_identity_8, &inv_txfm_1d_cfg_identity_8 } - }; - - const TXFM_1D_CFG *inv_txfm_cfg = inv_txfm_cfg_ls[tx_type][dir]; - const TxfmFunc inv_tx = IHT[tx_type]; - - tran_low_t out[8]; - inv_tx(input, out, inv_txfm_cfg->cos_bit, inv_txfm_cfg->stage_range); - for (int i = 0; i < 8; ++i) { - dest[i * stride] = highbd_clip_pixel_add(dest[i * stride], - ROUND_POWER_OF_TWO(out[i], 4), bd); - } -} - -void av1_hbd_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir) { - assert(tx_type < TX_TYPES_1D); - static const TxfmFunc IHT[] = { av1_idct4_new, av1_iadst4_new, av1_iadst4_new, - av1_iidentity4_c }; - // In order { horizontal, vertical } - static const TXFM_1D_CFG *inv_txfm_cfg_ls[TX_TYPES_1D][2] = { - { &inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_16 }, - { &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_16 }, - { &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_16 }, - { &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_16 } - }; - - const TXFM_1D_CFG *inv_txfm_cfg = inv_txfm_cfg_ls[tx_type][dir]; - const TxfmFunc inv_tx = IHT[tx_type]; - - tran_low_t out[16]; - inv_tx(input, out, inv_txfm_cfg->cos_bit, inv_txfm_cfg->stage_range); - for (int i = 0; i < 16; ++i) { - out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2); - dest[i * stride] = highbd_clip_pixel_add(dest[i * stride], - ROUND_POWER_OF_TWO(out[i], 5), bd); - } -} - -void av1_hbd_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir) { - assert(tx_type < TX_TYPES_1D); - static const TxfmFunc IHT[] = { av1_idct4_new, av1_iadst4_new, av1_iadst4_new, - av1_iidentity4_c }; - // In order { horizontal, vertical } - static const TXFM_1D_CFG *inv_txfm_cfg_ls[TX_TYPES_1D][2] = { - { &inv_txfm_1d_row_cfg_dct_32, &inv_txfm_1d_col_cfg_dct_32 }, - { &inv_txfm_1d_row_cfg_adst_32, &inv_txfm_1d_col_cfg_adst_32 }, - { &inv_txfm_1d_row_cfg_adst_32, &inv_txfm_1d_col_cfg_adst_32 }, - { &inv_txfm_1d_cfg_identity_32, &inv_txfm_1d_cfg_identity_32 } - }; - - const TXFM_1D_CFG *inv_txfm_cfg = inv_txfm_cfg_ls[tx_type][dir]; - const TxfmFunc inv_tx = IHT[tx_type]; - - tran_low_t out[32]; - inv_tx(input, out, inv_txfm_cfg->cos_bit, inv_txfm_cfg->stage_range); - for (int i = 0; i < 32; ++i) { - dest[i * stride] = highbd_clip_pixel_add(dest[i * stride], - ROUND_POWER_OF_TWO(out[i], 4), bd); - } -} - -hbd_dpcm_inv_txfm_add_func av1_get_hbd_dpcm_inv_txfm_add_func(int tx_length) { - switch (tx_length) { - case 4: return av1_hbd_dpcm_inv_txfm_add_4_c; - case 8: return av1_hbd_dpcm_inv_txfm_add_8_c; - case 16: return av1_hbd_dpcm_inv_txfm_add_16_c; - case 32: - return av1_hbd_dpcm_inv_txfm_add_32_c; - // TODO(huisu): add support for TX_64X64. - default: assert(0); return NULL; - } -} -#endif // CONFIG_HIGHBITDEPTH -#endif // CONFIG_DPCM_INTRA diff --git a/third_party/aom/av1/common/idct.h b/third_party/aom/av1/common/idct.h index c2ca69b54..e4e4ad671 100644 --- a/third_party/aom/av1/common/idct.h +++ b/third_party/aom/av1/common/idct.h @@ -26,13 +26,28 @@ extern "C" { #endif -// TODO(kslu) move the common stuff in idct.h to av1_txfm.h or txfm_common.h typedef void (*transform_1d)(const tran_low_t *, tran_low_t *); typedef struct { transform_1d cols, rows; // vertical and horizontal } transform_2d; +#if CONFIG_LGT +int get_lgt4(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx); +int get_lgt8(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx); +#endif // CONFIG_LGT + +#if CONFIG_LGT_FROM_PRED +void get_lgt4_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx); +void get_lgt8_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx); +void get_lgt16up_from_pred(const TxfmParam *txfm_param, int is_col, + const tran_high_t **lgtmtx, int ntx); +#endif // CONFIG_LGT_FROM_PRED + #if CONFIG_HIGHBITDEPTH typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *, int bd); @@ -53,9 +68,12 @@ void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, TxfmParam *txfm_param); void av1_inverse_transform_block(const MACROBLOCKD *xd, const tran_low_t *dqcoeff, -#if CONFIG_LGT +#if CONFIG_LGT_FROM_PRED PREDICTION_MODE mode, #endif +#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK + uint8_t *mrc_mask, +#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK TX_TYPE tx_type, TX_SIZE tx_size, uint8_t *dst, int stride, int eob); void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, @@ -72,37 +90,6 @@ void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride, TxfmParam *txfm_param); -#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); -void av1_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest); -void av1_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest); -void av1_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest); -typedef void (*dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, uint8_t *dest); -dpcm_inv_txfm_add_func av1_get_dpcm_inv_txfm_add_func(int tx_length); -#if CONFIG_HIGHBITDEPTH -void av1_hbd_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir); -void av1_hbd_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir); -void av1_hbd_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir); -void av1_hbd_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, uint16_t *dest, - int dir); -typedef void (*hbd_dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride, - TX_TYPE_1D tx_type, int bd, - uint16_t *dest, int dir); -hbd_dpcm_inv_txfm_add_func av1_get_hbd_dpcm_inv_txfm_add_func(int tx_length); -#endif // CONFIG_HIGHBITDEPTH -#endif // CONFIG_DPCM_INTRA #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/mips/dspr2/av1_itrans16_dspr2.c b/third_party/aom/av1/common/mips/dspr2/av1_itrans16_dspr2.c deleted file mode 100644 index 1b3343155..000000000 --- a/third_party/aom/av1/common/mips/dspr2/av1_itrans16_dspr2.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <assert.h> -#include <stdio.h> - -#include "./aom_config.h" -#include "./av1_rtcd.h" -#include "av1/common/common.h" -#include "av1/common/blockd.h" -#include "aom_dsp/mips/inv_txfm_dspr2.h" -#include "aom_dsp/txfm_common.h" -#include "aom_ports/mem.h" - -#if HAVE_DSPR2 -void av1_iht16x16_256_add_dspr2(const int16_t *input, uint8_t *dest, int pitch, - TxfmParam *txfm_param) { - int i, j; - DECLARE_ALIGNED(32, int16_t, out[16 * 16]); - int16_t *outptr = out; - int16_t temp_out[16]; - uint32_t pos = 45; - int tx_type = txfm_param->tx_type; - - /* bit positon for extract from acc */ - __asm__ __volatile__("wrdsp %[pos], 1 \n\t" : : [pos] "r"(pos)); - - switch (tx_type) { - case DCT_DCT: // DCT in both horizontal and vertical - idct16_rows_dspr2(input, outptr, 16); - idct16_cols_add_blk_dspr2(out, dest, pitch); - break; - case ADST_DCT: // ADST in vertical, DCT in horizontal - idct16_rows_dspr2(input, outptr, 16); - - outptr = out; - - for (i = 0; i < 16; ++i) { - iadst16_dspr2(outptr, temp_out); - - for (j = 0; j < 16; ++j) - dest[j * pitch + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) + - dest[j * pitch + i]); - outptr += 16; - } - break; - case DCT_ADST: // DCT in vertical, ADST in horizontal - { - int16_t temp_in[16 * 16]; - - for (i = 0; i < 16; ++i) { - /* prefetch row */ - prefetch_load((const uint8_t *)(input + 16)); - - iadst16_dspr2(input, outptr); - input += 16; - outptr += 16; - } - - for (i = 0; i < 16; ++i) - for (j = 0; j < 16; ++j) temp_in[j * 16 + i] = out[i * 16 + j]; - - idct16_cols_add_blk_dspr2(temp_in, dest, pitch); - } break; - case ADST_ADST: // ADST in both directions - { - int16_t temp_in[16]; - - for (i = 0; i < 16; ++i) { - /* prefetch row */ - prefetch_load((const uint8_t *)(input + 16)); - - iadst16_dspr2(input, outptr); - input += 16; - outptr += 16; - } - - for (i = 0; i < 16; ++i) { - for (j = 0; j < 16; ++j) temp_in[j] = out[j * 16 + i]; - iadst16_dspr2(temp_in, temp_out); - for (j = 0; j < 16; ++j) - dest[j * pitch + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) + - dest[j * pitch + i]); - } - } break; - default: printf("av1_short_iht16x16_add_dspr2 : Invalid tx_type\n"); break; - } -} -#endif // #if HAVE_DSPR2 diff --git a/third_party/aom/av1/common/mips/dspr2/av1_itrans4_dspr2.c b/third_party/aom/av1/common/mips/dspr2/av1_itrans4_dspr2.c deleted file mode 100644 index d9da3a1e7..000000000 --- a/third_party/aom/av1/common/mips/dspr2/av1_itrans4_dspr2.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <assert.h> -#include <stdio.h> - -#include "./aom_config.h" -#include "./av1_rtcd.h" -#include "av1/common/common.h" -#include "av1/common/blockd.h" -#include "aom_dsp/mips/inv_txfm_dspr2.h" -#include "aom_dsp/txfm_common.h" -#include "aom_ports/mem.h" - -#if HAVE_DSPR2 -void av1_iht4x4_16_add_dspr2(const int16_t *input, uint8_t *dest, - int dest_stride, TxfmParam *txfm_param) { - int i, j; - DECLARE_ALIGNED(32, int16_t, out[4 * 4]); - int16_t *outptr = out; - int16_t temp_in[4 * 4], temp_out[4]; - uint32_t pos = 45; - int tx_type = txfm_param->tx_type; - - /* bit positon for extract from acc */ - __asm__ __volatile__("wrdsp %[pos], 1 \n\t" - : - : [pos] "r"(pos)); - - switch (tx_type) { - case DCT_DCT: // DCT in both horizontal and vertical - aom_idct4_rows_dspr2(input, outptr); - aom_idct4_columns_add_blk_dspr2(&out[0], dest, dest_stride); - break; - case ADST_DCT: // ADST in vertical, DCT in horizontal - aom_idct4_rows_dspr2(input, outptr); - - outptr = out; - - for (i = 0; i < 4; ++i) { - iadst4_dspr2(outptr, temp_out); - - for (j = 0; j < 4; ++j) - dest[j * dest_stride + i] = clip_pixel( - ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]); - - outptr += 4; - } - break; - case DCT_ADST: // DCT in vertical, ADST in horizontal - for (i = 0; i < 4; ++i) { - iadst4_dspr2(input, outptr); - input += 4; - outptr += 4; - } - - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) { - temp_in[i * 4 + j] = out[j * 4 + i]; - } - } - aom_idct4_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride); - break; - case ADST_ADST: // ADST in both directions - for (i = 0; i < 4; ++i) { - iadst4_dspr2(input, outptr); - input += 4; - outptr += 4; - } - - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) temp_in[j] = out[j * 4 + i]; - iadst4_dspr2(temp_in, temp_out); - - for (j = 0; j < 4; ++j) - dest[j * dest_stride + i] = clip_pixel( - ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]); - } - break; - default: printf("av1_short_iht4x4_add_dspr2 : Invalid tx_type\n"); break; - } -} -#endif // #if HAVE_DSPR2 diff --git a/third_party/aom/av1/common/mips/dspr2/av1_itrans8_dspr2.c b/third_party/aom/av1/common/mips/dspr2/av1_itrans8_dspr2.c deleted file mode 100644 index f62d5faef..000000000 --- a/third_party/aom/av1/common/mips/dspr2/av1_itrans8_dspr2.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <assert.h> -#include <stdio.h> - -#include "./aom_config.h" -#include "./av1_rtcd.h" -#include "av1/common/common.h" -#include "av1/common/blockd.h" -#include "aom_dsp/mips/inv_txfm_dspr2.h" -#include "aom_dsp/txfm_common.h" -#include "aom_ports/mem.h" - -#if HAVE_DSPR2 -void av1_iht8x8_64_add_dspr2(const int16_t *input, uint8_t *dest, - int dest_stride, TxfmParam *txfm_param) { - int i, j; - DECLARE_ALIGNED(32, int16_t, out[8 * 8]); - int16_t *outptr = out; - int16_t temp_in[8 * 8], temp_out[8]; - uint32_t pos = 45; - int tx_type = txfm_param->tx_type; - - /* bit positon for extract from acc */ - __asm__ __volatile__("wrdsp %[pos], 1 \n\t" : : [pos] "r"(pos)); - - switch (tx_type) { - case DCT_DCT: // DCT in both horizontal and vertical - idct8_rows_dspr2(input, outptr, 8); - idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride); - break; - case ADST_DCT: // ADST in vertical, DCT in horizontal - idct8_rows_dspr2(input, outptr, 8); - - for (i = 0; i < 8; ++i) { - iadst8_dspr2(&out[i * 8], temp_out); - - for (j = 0; j < 8; ++j) - dest[j * dest_stride + i] = clip_pixel( - ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]); - } - break; - case DCT_ADST: // DCT in vertical, ADST in horizontal - for (i = 0; i < 8; ++i) { - iadst8_dspr2(input, outptr); - input += 8; - outptr += 8; - } - - for (i = 0; i < 8; ++i) { - for (j = 0; j < 8; ++j) { - temp_in[i * 8 + j] = out[j * 8 + i]; - } - } - idct8_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride); - break; - case ADST_ADST: // ADST in both directions - for (i = 0; i < 8; ++i) { - iadst8_dspr2(input, outptr); - input += 8; - outptr += 8; - } - - for (i = 0; i < 8; ++i) { - for (j = 0; j < 8; ++j) temp_in[j] = out[j * 8 + i]; - - iadst8_dspr2(temp_in, temp_out); - - for (j = 0; j < 8; ++j) - dest[j * dest_stride + i] = clip_pixel( - ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]); - } - break; - default: printf("av1_short_iht8x8_add_dspr2 : Invalid tx_type\n"); break; - } -} -#endif // #if HAVE_DSPR2 diff --git a/third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c b/third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c index 522cce0f4..ff461b914 100644 --- a/third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c +++ b/third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c @@ -19,7 +19,7 @@ void av1_iht16x16_256_add_msa(const int16_t *input, uint8_t *dst, int32_t i; DECLARE_ALIGNED(32, int16_t, out[16 * 16]); int16_t *out_ptr = &out[0]; - int32_t tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; switch (tx_type) { case DCT_DCT: diff --git a/third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c b/third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c index 7a68dbbe6..37f7fd77b 100644 --- a/third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c +++ b/third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c @@ -17,7 +17,7 @@ void av1_iht4x4_16_add_msa(const int16_t *input, uint8_t *dst, int32_t dst_stride, TxfmParam *txfm_param) { v8i16 in0, in1, in2, in3; - int32_t tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; /* load vector elements of 4x4 block */ LD4x4_SH(input, in0, in1, in2, in3); diff --git a/third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c b/third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c index c6ef61e1a..7410f7b98 100644 --- a/third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c +++ b/third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c @@ -17,7 +17,7 @@ void av1_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst, int32_t dst_stride, TxfmParam *txfm_param) { v8i16 in0, in1, in2, in3, in4, in5, in6, in7; - int32_t tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; /* load vector elements of 8x8 block */ LD_SH8(input, 8, in0, in1, in2, in3, in4, in5, in6, in7); diff --git a/third_party/aom/av1/common/mv.h b/third_party/aom/av1/common/mv.h index dabfc0ead..65f0f7eda 100644 --- a/third_party/aom/av1/common/mv.h +++ b/third_party/aom/av1/common/mv.h @@ -20,6 +20,8 @@ extern "C" { #endif +#define INVALID_MV 0x80008000 + typedef struct mv { int16_t row; int16_t col; @@ -88,10 +90,12 @@ typedef enum { // GLOBAL_TRANS_TYPES 7 - up to full homography #define GLOBAL_TRANS_TYPES 4 +#if GLOBAL_TRANS_TYPES > 4 // First bit indicates whether using identity or not // GLOBAL_TYPE_BITS=ceiling(log2(GLOBAL_TRANS_TYPES-1)) is the // number of bits needed to cover the remaining possibilities #define GLOBAL_TYPE_BITS (get_msb(2 * GLOBAL_TRANS_TYPES - 3)) +#endif // GLOBAL_TRANS_TYPES > 4 typedef struct { #if CONFIG_GLOBAL_MOTION @@ -116,14 +120,14 @@ typedef struct { int16_t alpha, beta, gamma, delta; } WarpedMotionParams; -static INLINE void set_default_warp_params(WarpedMotionParams *wm) { - static const int32_t default_wm_mat[8] = { - 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0 - }; - memset(wm, 0, sizeof(*wm)); - memcpy(wm->wmmat, default_wm_mat, sizeof(wm->wmmat)); - wm->wmtype = IDENTITY; -} +/* clang-format off */ +static const WarpedMotionParams default_warp_params = { + IDENTITY, + { 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, + 0 }, + 0, 0, 0, 0 +}; +/* clang-format on */ #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_GLOBAL_MOTION @@ -202,21 +206,70 @@ static INLINE int convert_to_trans_prec(int allow_hp, int coor) { else return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 2) * 2; } +#if CONFIG_AMVR +static INLINE void integer_mv_precision(MV *mv) { + int mod = (mv->row % 8); + if (mod != 0) { + mv->row -= mod; + if (abs(mod) > 4) { + if (mod > 0) { + mv->row += 8; + } else { + mv->row -= 8; + } + } + } -// Convert a global motion translation vector (which may have more bits than a -// regular motion vector) into a motion vector + mod = (mv->col % 8); + if (mod != 0) { + mv->col -= mod; + if (abs(mod) > 4) { + if (mod > 0) { + mv->col += 8; + } else { + mv->col -= 8; + } + } + } +} +#endif +// Convert a global motion vector into a motion vector at the centre of the +// given block. +// +// The resulting motion vector will have three fractional bits of precision. If +// allow_hp is zero, the bottom bit will always be zero. If CONFIG_AMVR and +// is_integer is true, the bottom three bits will be zero (so the motion vector +// represents an integer) static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm, int allow_hp, BLOCK_SIZE bsize, - int mi_col, int mi_row, - int block_idx) { + int mi_col, int mi_row, int block_idx +#if CONFIG_AMVR + , + int is_integer +#endif + ) { const int unify_bsize = CONFIG_CB4X4; int_mv res; const int32_t *mat = gm->wmmat; int x, y, tx, ty; if (gm->wmtype == TRANSLATION) { + // All global motion vectors are stored with WARPEDMODEL_PREC_BITS (16) + // bits of fractional precision. The offset for a translation is stored in + // entries 0 and 1. For translations, all but the top three (two if + // cm->allow_high_precision_mv is false) fractional bits are always zero. + // + // After the right shifts, there are 3 fractional bits of precision. If + // allow_hp is false, the bottom bit is always zero (so we don't need a + // call to convert_to_trans_prec here) res.as_mv.row = gm->wmmat[0] >> GM_TRANS_ONLY_PREC_DIFF; res.as_mv.col = gm->wmmat[1] >> GM_TRANS_ONLY_PREC_DIFF; + assert(IMPLIES(1 & (res.as_mv.row | res.as_mv.col), allow_hp)); +#if CONFIG_AMVR + if (is_integer) { + integer_mv_precision(&res.as_mv); + } +#endif return res; } @@ -256,6 +309,12 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm, res.as_mv.row = ty; res.as_mv.col = tx; + +#if CONFIG_AMVR + if (is_integer) { + integer_mv_precision(&res.as_mv); + } +#endif return res; } diff --git a/third_party/aom/av1/common/mvref_common.c b/third_party/aom/av1/common/mvref_common.c index fdbcebcd1..891396e9b 100644 --- a/third_party/aom/av1/common/mvref_common.c +++ b/third_party/aom/av1/common/mvref_common.c @@ -14,10 +14,56 @@ #include "av1/common/warped_motion.h" #endif // CONFIG_WARPED_MOTION +#if CONFIG_GLOBAL_MOTION +#define USE_CUR_GM_REFMV 1 +#endif // CONFIG_GLOBAL_MOTION + +void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row, + int mi_col, int x_mis, int y_mis) { +#if CONFIG_TMV + const int frame_mvs_stride = ROUND_POWER_OF_TWO(cm->mi_cols, 1); + MV_REF *frame_mvs = cm->cur_frame->mvs + + ((mi_row & 0xfffe) >> 1) * frame_mvs_stride + + ((mi_col & 0xfffe) >> 1); + x_mis = ROUND_POWER_OF_TWO(x_mis, 1); + y_mis = ROUND_POWER_OF_TWO(y_mis, 1); +#else + const int frame_mvs_stride = cm->mi_cols; + MV_REF *frame_mvs = cm->cur_frame->mvs + + (mi_row & 0xfffe) * frame_mvs_stride + (mi_col & 0xfffe); + x_mis = AOMMAX(x_mis, 2); + y_mis = AOMMAX(y_mis, 2); +#endif // CONFIG_TMV + int w, h; + + for (h = 0; h < y_mis; h++) { + MV_REF *const frame_mv = frame_mvs + h * frame_mvs_stride; + for (w = 0; w < x_mis; w++) { + MV_REF *const mv = frame_mv + w; + mv->ref_frame[0] = mi->mbmi.ref_frame[0]; + mv->ref_frame[1] = mi->mbmi.ref_frame[1]; + mv->mv[0].as_int = mi->mbmi.mv[0].as_int; + mv->mv[1].as_int = mi->mbmi.mv[1].as_int; + // (TODO:yunqing) The following 2 lines won't be used and can be removed. + mv->pred_mv[0].as_int = mi->mbmi.pred_mv[0].as_int; + mv->pred_mv[1].as_int = mi->mbmi.pred_mv[1].as_int; + } + } +} + static uint8_t add_ref_mv_candidate( const MODE_INFO *const candidate_mi, const MB_MODE_INFO *const candidate, const MV_REFERENCE_FRAME rf[2], uint8_t *refmv_count, - CANDIDATE_MV *ref_mv_stack, const int use_hp, int len, int block, int col) { + CANDIDATE_MV *ref_mv_stack, const int use_hp, int len, int block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int col, int weight +#if CONFIG_AMVR + , + int is_integer +#endif + ) { int index = 0, ref; int newmv_count = 0; #if CONFIG_CB4X4 @@ -25,25 +71,36 @@ static uint8_t add_ref_mv_candidate( #else const int unify_bsize = 0; #endif + assert(weight % 2 == 0); if (rf[1] == NONE_FRAME) { // single reference frame for (ref = 0; ref < 2; ++ref) { if (candidate->ref_frame[ref] == rf[0]) { - int_mv this_refmv = get_sub_block_mv(candidate_mi, ref, col, block); + int_mv this_refmv; +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + if (is_global_mv_block(candidate_mi, block, gm_params[rf[0]].wmtype)) + this_refmv = gm_mv_candidates[0]; + else +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + this_refmv = get_sub_block_mv(candidate_mi, ref, col, block); +#if CONFIG_AMVR + lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer); +#else lower_mv_precision(&this_refmv.as_mv, use_hp); +#endif // CONFIG_AMVR for (index = 0; index < *refmv_count; ++index) if (ref_mv_stack[index].this_mv.as_int == this_refmv.as_int) break; - if (index < *refmv_count) ref_mv_stack[index].weight += 2 * len; + if (index < *refmv_count) ref_mv_stack[index].weight += weight * len; // Add a new item to the list. if (index == *refmv_count) { ref_mv_stack[index].this_mv = this_refmv; ref_mv_stack[index].pred_diff[0] = av1_get_pred_diff_ctx( get_sub_block_pred_mv(candidate_mi, ref, col, block), this_refmv); - ref_mv_stack[index].weight = 2 * len; + ref_mv_stack[index].weight = weight * len; ++(*refmv_count); if (candidate->mode == NEWMV) ++newmv_count; @@ -53,8 +110,11 @@ static uint8_t add_ref_mv_candidate( !unify_bsize) { int alt_block = 3 - block; this_refmv = get_sub_block_mv(candidate_mi, ref, col, alt_block); +#if CONFIG_AMVR + lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer); +#else lower_mv_precision(&this_refmv.as_mv, use_hp); - +#endif for (index = 0; index < *refmv_count; ++index) if (ref_mv_stack[index].this_mv.as_int == this_refmv.as_int) break; @@ -80,8 +140,17 @@ static uint8_t add_ref_mv_candidate( int_mv this_refmv[2]; for (ref = 0; ref < 2; ++ref) { - this_refmv[ref] = get_sub_block_mv(candidate_mi, ref, col, block); +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + if (is_global_mv_block(candidate_mi, block, gm_params[rf[ref]].wmtype)) + this_refmv[ref] = gm_mv_candidates[ref]; + else +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + this_refmv[ref] = get_sub_block_mv(candidate_mi, ref, col, block); +#if CONFIG_AMVR + lower_mv_precision(&this_refmv[ref].as_mv, use_hp, is_integer); +#else lower_mv_precision(&this_refmv[ref].as_mv, use_hp); +#endif } for (index = 0; index < *refmv_count; ++index) @@ -89,7 +158,7 @@ static uint8_t add_ref_mv_candidate( (ref_mv_stack[index].comp_mv.as_int == this_refmv[1].as_int)) break; - if (index < *refmv_count) ref_mv_stack[index].weight += 2 * len; + if (index < *refmv_count) ref_mv_stack[index].weight += weight * len; // Add a new item to the list. if (index == *refmv_count) { @@ -99,15 +168,10 @@ static uint8_t add_ref_mv_candidate( get_sub_block_pred_mv(candidate_mi, 0, col, block), this_refmv[0]); ref_mv_stack[index].pred_diff[1] = av1_get_pred_diff_ctx( get_sub_block_pred_mv(candidate_mi, 1, col, block), this_refmv[1]); - ref_mv_stack[index].weight = 2 * len; + ref_mv_stack[index].weight = weight * len; ++(*refmv_count); -#if CONFIG_EXT_INTER - if (candidate->mode == NEW_NEWMV) -#else - if (candidate->mode == NEWMV) -#endif // CONFIG_EXT_INTER - ++newmv_count; + if (candidate->mode == NEW_NEWMV) ++newmv_count; } if (candidate_mi->mbmi.sb_type < BLOCK_8X8 && block >= 0 && @@ -116,9 +180,13 @@ static uint8_t add_ref_mv_candidate( this_refmv[0] = get_sub_block_mv(candidate_mi, 0, col, alt_block); this_refmv[1] = get_sub_block_mv(candidate_mi, 1, col, alt_block); - for (ref = 0; ref < 2; ++ref) + for (ref = 0; ref < 2; ++ref) { +#if CONFIG_AMVR + lower_mv_precision(&this_refmv[ref].as_mv, use_hp, is_integer); +#else lower_mv_precision(&this_refmv[ref].as_mv, use_hp); - +#endif + } for (index = 0; index < *refmv_count; ++index) if (ref_mv_stack[index].this_mv.as_int == this_refmv[0].as_int && ref_mv_stack[index].comp_mv.as_int == this_refmv[1].as_int) @@ -139,12 +207,7 @@ static uint8_t add_ref_mv_candidate( ref_mv_stack[index].weight = len; ++(*refmv_count); -#if CONFIG_EXT_INTER - if (candidate->mode == NEW_NEWMV) -#else - if (candidate->mode == NEWMV) -#endif // CONFIG_EXT_INTER - ++newmv_count; + if (candidate->mode == NEW_NEWMV) ++newmv_count; } } } @@ -153,95 +216,144 @@ static uint8_t add_ref_mv_candidate( } static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, - const int mi_row, const int mi_col, int block, + const int mi_col, int block, const MV_REFERENCE_FRAME rf[2], int row_offset, - CANDIDATE_MV *ref_mv_stack, uint8_t *refmv_count) { - const TileInfo *const tile = &xd->tile; + CANDIDATE_MV *ref_mv_stack, uint8_t *refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int_mv *gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int max_row_offset, int *processed_rows) { + const int end_mi = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); + const int n8_w_8 = mi_size_wide[BLOCK_8X8]; + const int n8_w_16 = mi_size_wide[BLOCK_16X16]; int i; uint8_t newmv_count = 0; + int col_offset = 0; #if CONFIG_CB4X4 - const int bsize = xd->mi[0]->mbmi.sb_type; - const int mi_offset = - bsize < BLOCK_8X8 ? mi_size_wide[BLOCK_4X4] : mi_size_wide[BLOCK_8X8]; + const int shift = 0; // TODO(jingning): Revisit this part after cb4x4 is stable. - if (bsize >= BLOCK_8X8) row_offset *= 2; + if (abs(row_offset) > 1) { + col_offset = 1; + if (mi_col & 0x01 && xd->n8_w < n8_w_8) --col_offset; + } + const int use_step_16 = (xd->n8_w >= 16); #else - const int mi_offset = mi_size_wide[BLOCK_8X8]; + const int shift = 1; + const int use_step_16 = (xd->n8_w >= 8); #endif + MODE_INFO **const candidate_mi0 = xd->mi + row_offset * xd->mi_stride; - for (i = 0; i < xd->n8_w && *refmv_count < MAX_REF_MV_STACK_SIZE;) { - POSITION mi_pos; -#if CONFIG_CB4X4 - const int use_step_16 = (xd->n8_w >= 16); + for (i = 0; i < end_mi && *refmv_count < MAX_REF_MV_STACK_SIZE;) { + const MODE_INFO *const candidate_mi = candidate_mi0[col_offset + i]; + const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; + const int candidate_bsize = candidate->sb_type; + const int n8_w = mi_size_wide[candidate_bsize]; + int len = AOMMIN(xd->n8_w, n8_w); + if (use_step_16) + len = AOMMAX(n8_w_16, len); + else if (abs(row_offset) > 1) + len = AOMMAX(len, n8_w_8); + + int weight = 2; + if (xd->n8_w >= n8_w_8 && xd->n8_w <= n8_w) { + int inc = AOMMIN(-max_row_offset + row_offset + 1, + mi_size_high[candidate_bsize]); + // Obtain range used in weight calculation. + weight = AOMMAX(weight, (inc << shift)); + // Update processed rows. + *processed_rows = inc - row_offset - 1; + } + +#if CONFIG_AMVR + newmv_count += add_ref_mv_candidate( + candidate_mi, candidate, rf, refmv_count, ref_mv_stack, + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + col_offset + i, weight, cm->cur_frame_mv_precision_level); #else - const int use_step_16 = (xd->n8_w >= 8); + newmv_count += add_ref_mv_candidate(candidate_mi, candidate, rf, + refmv_count, ref_mv_stack, + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + col_offset + i, weight); #endif - mi_pos.row = row_offset; - mi_pos.col = i; - if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) { - const MODE_INFO *const candidate_mi = - xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col]; - const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; - int len = AOMMIN(xd->n8_w, mi_size_wide[candidate->sb_type]); - if (use_step_16) len = AOMMAX(mi_size_wide[BLOCK_16X16], len); - newmv_count += add_ref_mv_candidate( - candidate_mi, candidate, rf, refmv_count, ref_mv_stack, - cm->allow_high_precision_mv, len, block, mi_pos.col); - i += len; - } else { - if (use_step_16) - i += (mi_offset << 1); - else - i += mi_offset; - } + i += len; } return newmv_count; } static uint8_t scan_col_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, - const int mi_row, const int mi_col, int block, + const int mi_row, int block, const MV_REFERENCE_FRAME rf[2], int col_offset, - CANDIDATE_MV *ref_mv_stack, uint8_t *refmv_count) { - const TileInfo *const tile = &xd->tile; + CANDIDATE_MV *ref_mv_stack, uint8_t *refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int_mv *gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int max_col_offset, int *processed_cols) { + const int end_mi = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); + const int n8_h_8 = mi_size_high[BLOCK_8X8]; + const int n8_h_16 = mi_size_high[BLOCK_16X16]; int i; uint8_t newmv_count = 0; + int row_offset = 0; #if CONFIG_CB4X4 - const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; - const int mi_offset = - (bsize < BLOCK_8X8) ? mi_size_high[BLOCK_4X4] : mi_size_high[BLOCK_8X8]; - if (bsize >= BLOCK_8X8) col_offset *= 2; + const int shift = 0; + if (abs(col_offset) > 1) { + row_offset = 1; + if (mi_row & 0x01 && xd->n8_h < n8_h_8) --row_offset; + } + const int use_step_16 = (xd->n8_h >= 16); #else - const int mi_offset = mi_size_wide[BLOCK_8X8]; + const int shift = 1; + const int use_step_16 = (xd->n8_h >= 8); #endif - for (i = 0; i < xd->n8_h && *refmv_count < MAX_REF_MV_STACK_SIZE;) { - POSITION mi_pos; -#if CONFIG_CB4X4 - const int use_step_16 = (xd->n8_h >= 16); + for (i = 0; i < end_mi && *refmv_count < MAX_REF_MV_STACK_SIZE;) { + const MODE_INFO *const candidate_mi = + xd->mi[(row_offset + i) * xd->mi_stride + col_offset]; + const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; + const int candidate_bsize = candidate->sb_type; + const int n8_h = mi_size_high[candidate_bsize]; + int len = AOMMIN(xd->n8_h, n8_h); + if (use_step_16) + len = AOMMAX(n8_h_16, len); + else if (abs(col_offset) > 1) + len = AOMMAX(len, n8_h_8); + + int weight = 2; + if (xd->n8_h >= n8_h_8 && xd->n8_h <= n8_h) { + int inc = AOMMIN(-max_col_offset + col_offset + 1, + mi_size_wide[candidate_bsize]); + // Obtain range used in weight calculation. + weight = AOMMAX(weight, (inc << shift)); + // Update processed cols. + *processed_cols = inc - col_offset - 1; + } + +#if CONFIG_AMVR + newmv_count += add_ref_mv_candidate( + candidate_mi, candidate, rf, refmv_count, ref_mv_stack, + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + col_offset, weight, cm->cur_frame_mv_precision_level); #else - const int use_step_16 = (xd->n8_h >= 8); + newmv_count += add_ref_mv_candidate(candidate_mi, candidate, rf, + refmv_count, ref_mv_stack, + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + col_offset, weight); #endif - - mi_pos.row = i; - mi_pos.col = col_offset; - if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) { - const MODE_INFO *const candidate_mi = - xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col]; - const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; - int len = AOMMIN(xd->n8_h, mi_size_high[candidate->sb_type]); - if (use_step_16) len = AOMMAX(mi_size_high[BLOCK_16X16], len); - newmv_count += add_ref_mv_candidate( - candidate_mi, candidate, rf, refmv_count, ref_mv_stack, - cm->allow_high_precision_mv, len, block, mi_pos.col); - i += len; - } else { - if (use_step_16) - i += (mi_offset << 1); - else - i += mi_offset; - } + i += len; } return newmv_count; @@ -251,6 +363,9 @@ static uint8_t scan_blk_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, const int mi_row, const int mi_col, int block, const MV_REFERENCE_FRAME rf[2], int row_offset, int col_offset, CANDIDATE_MV *ref_mv_stack, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int_mv *gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV uint8_t *refmv_count) { const TileInfo *const tile = &xd->tile; POSITION mi_pos; @@ -266,18 +381,33 @@ static uint8_t scan_blk_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; const int len = mi_size_wide[BLOCK_8X8]; +#if CONFIG_AMVR newmv_count += add_ref_mv_candidate( candidate_mi, candidate, rf, refmv_count, ref_mv_stack, - cm->allow_high_precision_mv, len, block, mi_pos.col); + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + mi_pos.col, 2, cm->cur_frame_mv_precision_level); +#else + newmv_count += add_ref_mv_candidate(candidate_mi, candidate, rf, + refmv_count, ref_mv_stack, + cm->allow_high_precision_mv, len, block, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, cm->global_motion, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + mi_pos.col, 2); +#endif } // Analyze a single 8x8 block motion information. return newmv_count; } -static int has_top_right(const MACROBLOCKD *xd, int mi_row, int mi_col, - int bs) { - const int mask_row = mi_row & MAX_MIB_MASK; - const int mask_col = mi_col & MAX_MIB_MASK; +static int has_top_right(const AV1_COMMON *cm, const MACROBLOCKD *xd, + int mi_row, int mi_col, int bs) { + const int sb_mi_size = mi_size_wide[cm->sb_size]; + const int mask_row = mi_row & (sb_mi_size - 1); + const int mask_col = mi_col & (sb_mi_size - 1); // In a split partition all apart from the bottom right has a top right int has_tr = !((mask_row & bs) && (mask_col & bs)); @@ -288,7 +418,7 @@ static int has_top_right(const MACROBLOCKD *xd, int mi_row, int mi_col, // For each 4x4 group of blocks, when the bottom right is decoded the blocks // to the right have not been decoded therefore the bottom right does // not have a top right - while (bs < MAX_MIB_SIZE) { + while (bs < sb_mi_size) { if (mask_col & bs) { if ((mask_col & (2 * bs)) && (mask_row & (2 * bs))) { has_tr = 0; @@ -310,9 +440,10 @@ static int has_top_right(const MACROBLOCKD *xd, int mi_row, int mi_col, if (xd->n8_w > xd->n8_h) if (xd->is_sec_rect) has_tr = 0; -#if CONFIG_EXT_PARTITION_TYPES - // The bottom left square of a Vertical A does not have a top right as it is - // decoded before the right hand rectangle of the partition +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB + // The bottom left square of a Vertical A (in the old format) does + // not have a top right as it is decoded before the right hand + // rectangle of the partition if (xd->mi[0]->mbmi.partition == PARTITION_VERT_A) if ((mask_row & bs) && !(mask_col & bs)) has_tr = 0; #endif // CONFIG_EXT_PARTITION_TYPES @@ -320,19 +451,156 @@ static int has_top_right(const MACROBLOCKD *xd, int mi_row, int mi_col, return has_tr; } -static int add_col_ref_mv(const AV1_COMMON *cm, +#if CONFIG_MFMV +static int check_sb_border(const AV1_COMMON *cm, const int mi_row, + const int mi_col, const int row_offset, + const int col_offset) { + const int sb_mi_size = mi_size_wide[cm->sb_size]; + const int row = mi_row & (sb_mi_size - 1); + const int col = mi_col & (sb_mi_size - 1); + + if (row + row_offset < 0 || row + row_offset >= sb_mi_size || + col + col_offset < 0 || col + col_offset >= sb_mi_size) + return 0; + + return 1; +} + +static int add_tpl_ref_mv(const AV1_COMMON *cm, const MV_REF *prev_frame_mvs_base, const MACROBLOCKD *xd, int mi_row, int mi_col, MV_REFERENCE_FRAME ref_frame, int blk_row, int blk_col, uint8_t *refmv_count, CANDIDATE_MV *ref_mv_stack, int16_t *mode_context) { + (void)prev_frame_mvs_base; + POSITION mi_pos; + int idx; + int coll_blk_count = 0; + const int weight_unit = 1; // mi_size_wide[BLOCK_8X8]; + +#if CONFIG_MV_COMPRESS + mi_pos.row = (mi_row & 0x01) ? blk_row : blk_row + 1; + mi_pos.col = (mi_col & 0x01) ? blk_col : blk_col + 1; +#else + mi_pos.row = blk_row; + mi_pos.col = blk_col; +#endif + + if (!is_inside(&xd->tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) + return coll_blk_count; + + const TPL_MV_REF *prev_frame_mvs = cm->cur_frame->tpl_mvs + + (mi_row + mi_pos.row) * cm->mi_stride + + (mi_col + mi_pos.col); + + MV_REFERENCE_FRAME rf[2]; + av1_set_ref_frame(rf, ref_frame); + + if (rf[1] == NONE_FRAME) { + for (int i = 0; i < MFMV_STACK_SIZE; ++i) { + if (prev_frame_mvs->mfmv[ref_frame - LAST_FRAME][i].as_int != + INVALID_MV) { + int_mv this_refmv = prev_frame_mvs->mfmv[ref_frame - LAST_FRAME][i]; + lower_mv_precision(&this_refmv.as_mv, cm->allow_high_precision_mv); + + if (blk_row == 0 && blk_col == 0) + if (abs(this_refmv.as_mv.row) >= 16 || + abs(this_refmv.as_mv.col) >= 16) + mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); + + for (idx = 0; idx < *refmv_count; ++idx) + if (abs(this_refmv.as_mv.row - ref_mv_stack[idx].this_mv.as_mv.row) < + 4 && + abs(this_refmv.as_mv.col - ref_mv_stack[idx].this_mv.as_mv.col) < + 4) + break; + + if (idx < *refmv_count) ref_mv_stack[idx].weight += 2 * weight_unit; + + if (idx == *refmv_count && *refmv_count < MAX_REF_MV_STACK_SIZE) { + ref_mv_stack[idx].this_mv.as_int = this_refmv.as_int; + // TODO(jingning): Hard coded context number. Need to make it better + // sense. + ref_mv_stack[idx].pred_diff[0] = 1; + ref_mv_stack[idx].weight = 2 * weight_unit; + ++(*refmv_count); + } + + ++coll_blk_count; + } + } + } else { + // Process compound inter mode + for (int i = 0; i < MFMV_STACK_SIZE; ++i) { + if (prev_frame_mvs->mfmv[rf[0] - LAST_FRAME][i].as_int != INVALID_MV && + prev_frame_mvs->mfmv[rf[1] - LAST_FRAME][i].as_int != INVALID_MV) { + int_mv this_refmv = prev_frame_mvs->mfmv[rf[0] - LAST_FRAME][i]; + int_mv comp_refmv = prev_frame_mvs->mfmv[rf[1] - LAST_FRAME][i]; + lower_mv_precision(&this_refmv.as_mv, cm->allow_high_precision_mv); + lower_mv_precision(&comp_refmv.as_mv, cm->allow_high_precision_mv); + + if (blk_row == 0 && blk_col == 0) + if (abs(this_refmv.as_mv.row) >= 16 || + abs(this_refmv.as_mv.col) >= 16 || + abs(comp_refmv.as_mv.row) >= 16 || + abs(comp_refmv.as_mv.col) >= 16) + mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); + + for (idx = 0; idx < *refmv_count; ++idx) + if (abs(this_refmv.as_mv.row - ref_mv_stack[idx].this_mv.as_mv.row) < + 4 && + abs(this_refmv.as_mv.col - ref_mv_stack[idx].this_mv.as_mv.col) < + 4 && + abs(comp_refmv.as_mv.row - ref_mv_stack[idx].comp_mv.as_mv.row) < + 4 && + abs(comp_refmv.as_mv.col - ref_mv_stack[idx].comp_mv.as_mv.col) < + 4) + break; + + if (idx < *refmv_count) ref_mv_stack[idx].weight += 2 * weight_unit; + + if (idx == *refmv_count && *refmv_count < MAX_REF_MV_STACK_SIZE) { + ref_mv_stack[idx].this_mv.as_int = this_refmv.as_int; + ref_mv_stack[idx].comp_mv.as_int = comp_refmv.as_int; + // TODO(jingning): Hard coded context number. Need to make it better + // sense. + ref_mv_stack[idx].pred_diff[0] = 1; + ref_mv_stack[idx].pred_diff[1] = 1; + ref_mv_stack[idx].weight = 2 * weight_unit; + ++(*refmv_count); + } + + ++coll_blk_count; + } + } + } + + return coll_blk_count; +} +#else +static int add_col_ref_mv(const AV1_COMMON *cm, + const MV_REF *prev_frame_mvs_base, + int prev_frame_mvs_stride, const MACROBLOCKD *xd, + int mi_row, int mi_col, MV_REFERENCE_FRAME ref_frame, + int blk_row, int blk_col, uint8_t *refmv_count, + CANDIDATE_MV *ref_mv_stack, int16_t *mode_context) { +#if CONFIG_TMV + const MV_REF *prev_frame_mvs = prev_frame_mvs_base + + ((blk_row + 1) >> 1) * prev_frame_mvs_stride + + ((blk_col + 1) >> 1); +#else const MV_REF *prev_frame_mvs = - prev_frame_mvs_base + blk_row * cm->mi_cols + blk_col; + prev_frame_mvs_base + blk_row * prev_frame_mvs_stride + blk_col; +#endif POSITION mi_pos; int ref, idx; int coll_blk_count = 0; const int weight_unit = mi_size_wide[BLOCK_8X8]; +#if CONFIG_TMV + mi_pos.row = blk_row; + mi_pos.col = blk_col; +#else #if CONFIG_MV_COMPRESS mi_pos.row = (mi_row & 0x01) ? blk_row : blk_row + 1; mi_pos.col = (mi_col & 0x01) ? blk_col : blk_col + 1; @@ -340,16 +608,27 @@ static int add_col_ref_mv(const AV1_COMMON *cm, mi_pos.row = blk_row; mi_pos.col = blk_col; #endif +#endif // CONFIG_TMV if (!is_inside(&xd->tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) return coll_blk_count; for (ref = 0; ref < 2; ++ref) { if (prev_frame_mvs->ref_frame[ref] == ref_frame) { int_mv this_refmv = prev_frame_mvs->mv[ref]; +#if CONFIG_AMVR + lower_mv_precision(&this_refmv.as_mv, cm->allow_high_precision_mv, + cm->cur_frame_mv_precision_level); +#else lower_mv_precision(&this_refmv.as_mv, cm->allow_high_precision_mv); +#endif - if (abs(this_refmv.as_mv.row) >= 16 || abs(this_refmv.as_mv.col) >= 16) - mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); +#if CONFIG_OPT_REF_MV + if (blk_row == 0 && blk_col == 0) +#endif + { + if (abs(this_refmv.as_mv.row) >= 16 || abs(this_refmv.as_mv.col) >= 16) + mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); + } for (idx = 0; idx < *refmv_count; ++idx) if (this_refmv.as_int == ref_mv_stack[idx].this_mv.as_int) break; @@ -370,60 +649,161 @@ static int add_col_ref_mv(const AV1_COMMON *cm, return coll_blk_count; } +#endif static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref_frame, uint8_t *refmv_count, CANDIDATE_MV *ref_mv_stack, - int_mv *mv_ref_list, int block, int mi_row, - int mi_col, int16_t *mode_context) { + int_mv *mv_ref_list, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int_mv *gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + int block, int mi_row, int mi_col, + int16_t *mode_context) { int idx, nearest_refmv_count = 0; uint8_t newmv_count = 0; CANDIDATE_MV tmp_mv; int len, nr_len; +#if CONFIG_TMV + const int prev_frame_mvs_stride = ROUND_POWER_OF_TWO(cm->mi_cols, 1); + const int tmi_row = mi_row & 0xfffe; + const int tmi_col = mi_col & 0xfffe; + const MV_REF *const prev_frame_mvs_base = + cm->use_prev_frame_mvs + ? cm->prev_frame->mvs + (tmi_row >> 1) * prev_frame_mvs_stride + + (tmi_col >> 1) + : NULL; +#else + const int prev_frame_mvs_stride = cm->mi_cols; #if CONFIG_MV_COMPRESS const MV_REF *const prev_frame_mvs_base = cm->use_prev_frame_mvs - ? cm->prev_frame->mvs + (((mi_row >> 1) << 1) + 1) * cm->mi_cols + + ? cm->prev_frame->mvs + + (((mi_row >> 1) << 1) + 1) * prev_frame_mvs_stride + ((mi_col >> 1) << 1) + 1 : NULL; #else const MV_REF *const prev_frame_mvs_base = cm->use_prev_frame_mvs - ? cm->prev_frame->mvs + mi_row * cm->mi_cols + mi_col + ? cm->prev_frame->mvs + mi_row * prev_frame_mvs_stride + mi_col : NULL; #endif +#endif // CONFIG_TMV const int bs = AOMMAX(xd->n8_w, xd->n8_h); - const int has_tr = has_top_right(xd, mi_row, mi_col, bs); + const int has_tr = has_top_right(cm, xd, mi_row, mi_col, bs); MV_REFERENCE_FRAME rf[2]; + const TileInfo *const tile = &xd->tile; + int max_row_offset = 0, max_col_offset = 0; +#if CONFIG_CB4X4 + const int row_adj = (xd->n8_h < mi_size_high[BLOCK_8X8]) && (mi_row & 0x01); + const int col_adj = (xd->n8_w < mi_size_wide[BLOCK_8X8]) && (mi_col & 0x01); +#endif + int processed_rows = 0; + int processed_cols = 0; + int row_offset, col_offset; + av1_set_ref_frame(rf, ref_frame); mode_context[ref_frame] = 0; *refmv_count = 0; - // Scan the first above row mode info. - newmv_count += scan_row_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, - ref_mv_stack, refmv_count); - // Scan the first left column mode info. - newmv_count += scan_col_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, - ref_mv_stack, refmv_count); + // Find valid maximum row/col offset. + if (xd->up_available) { +#if CONFIG_CB4X4 + max_row_offset = -(MVREF_ROWS << 1) + row_adj; +#else + max_row_offset = -MVREF_ROWS; +#endif + max_row_offset = + find_valid_row_offset(tile, mi_row, cm->mi_rows, cm, max_row_offset); + } + if (xd->left_available) { +#if CONFIG_CB4X4 + max_col_offset = -(MVREF_COLS << 1) + col_adj; +#else + max_col_offset = -MVREF_COLS; +#endif + max_col_offset = find_valid_col_offset(tile, mi_col, max_col_offset); + } + + // Scan the first above row mode info. row_offset = -1; + if (abs(max_row_offset) >= 1) + newmv_count += + scan_row_mbmi(cm, xd, mi_col, block, rf, -1, ref_mv_stack, refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + max_row_offset, &processed_rows); + // Scan the first left column mode info. col_offset = -1; + if (abs(max_col_offset) >= 1) + newmv_count += + scan_col_mbmi(cm, xd, mi_row, block, rf, -1, ref_mv_stack, refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + max_col_offset, &processed_cols); // Check top-right boundary if (has_tr) newmv_count += scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, - xd->n8_w, ref_mv_stack, refmv_count); + xd->n8_w, ref_mv_stack, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + refmv_count); nearest_refmv_count = *refmv_count; for (idx = 0; idx < nearest_refmv_count; ++idx) ref_mv_stack[idx].weight += REF_CAT_LEVEL; + +#if CONFIG_MFMV + int blk_row, blk_col; + int coll_blk_count = 0; + int voffset = AOMMAX(mi_size_high[BLOCK_8X8], xd->n8_h); + int hoffset = AOMMAX(mi_size_wide[BLOCK_8X8], xd->n8_w); + + int tpl_sample_pos[9][2] = { + { -2, hoffset }, { 0, hoffset }, { voffset, hoffset }, + { voffset, 0 }, { voffset, -2 }, { voffset, -4 }, + { -4, hoffset }, { voffset, 4 }, { 2, hoffset + 4 }, + }; + int i; + + for (blk_row = 0; blk_row < xd->n8_h; blk_row += mi_size_high[BLOCK_8X8]) { + for (blk_col = 0; blk_col < xd->n8_w; blk_col += mi_size_wide[BLOCK_8X8]) { + // (TODO: yunqing) prev_frame_mvs_base is not used here, tpl_mvs is used. + // Can be modified the same way. + int is_available = add_tpl_ref_mv( + cm, prev_frame_mvs_base, xd, mi_row, mi_col, ref_frame, blk_row, + blk_col, refmv_count, ref_mv_stack, mode_context); + if (blk_row == 0 && blk_col == 0) coll_blk_count = is_available; + } + } + + if (coll_blk_count == 0) mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); + + for (i = 0; i < 9; ++i) { + blk_row = tpl_sample_pos[i][0]; + blk_col = tpl_sample_pos[i][1]; + + if (!check_sb_border(cm, mi_row, mi_col, blk_row, blk_col)) continue; + // (TODO: yunqing) prev_frame_mvs_base is not used here, tpl_mvs is used. + // Can be modified the same way. + coll_blk_count += add_tpl_ref_mv(cm, prev_frame_mvs_base, xd, mi_row, + mi_col, ref_frame, blk_row, blk_col, + refmv_count, ref_mv_stack, mode_context); + } +#else #if CONFIG_TEMPMV_SIGNALING - if (cm->use_prev_frame_mvs && rf[1] == NONE_FRAME) { + if (cm->use_prev_frame_mvs && rf[1] == NONE_FRAME) #else if (prev_frame_mvs_base && cm->show_frame && cm->last_show_frame && - rf[1] == NONE_FRAME) { + rf[1] == NONE_FRAME) #endif + { int blk_row, blk_col; int coll_blk_count = 0; #if CONFIG_CB4X4 @@ -435,6 +815,8 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, #endif #if CONFIG_TPL_MV + // Modified sample positions to be consistent with frame_mvs + // spatial resolution. int tpl_sample_pos[5][2] = { { -1, xd->n8_w }, { 0, xd->n8_w }, { xd->n8_h, xd->n8_w }, @@ -445,9 +827,22 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, for (blk_row = 0; blk_row < xd->n8_h; blk_row += mi_step) { for (blk_col = 0; blk_col < xd->n8_w; blk_col += mi_step) { - coll_blk_count += add_col_ref_mv( - cm, prev_frame_mvs_base, xd, mi_row, mi_col, ref_frame, blk_row, - blk_col, refmv_count, ref_mv_stack, mode_context); +#if CONFIG_TMV + int is_available = + add_col_ref_mv(cm, prev_frame_mvs_base, prev_frame_mvs_stride, xd, + tmi_row, tmi_col, ref_frame, blk_row, blk_col, + refmv_count, ref_mv_stack, mode_context); +#else + int is_available = + add_col_ref_mv(cm, prev_frame_mvs_base, prev_frame_mvs_stride, xd, + mi_row, mi_col, ref_frame, blk_row, blk_col, + refmv_count, ref_mv_stack, mode_context); +#endif // CONFIG_TMV +#if CONFIG_OPT_REF_MV + if (blk_row == 0 && blk_col == 0) coll_blk_count = is_available; +#else + coll_blk_count += is_available; +#endif } } @@ -455,9 +850,15 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, for (i = 0; i < 5; ++i) { blk_row = tpl_sample_pos[i][0]; blk_col = tpl_sample_pos[i][1]; - coll_blk_count += add_col_ref_mv(cm, prev_frame_mvs_base, xd, mi_row, - mi_col, ref_frame, blk_row, blk_col, - refmv_count, ref_mv_stack, mode_context); +#if CONFIG_TMV + coll_blk_count += add_col_ref_mv( + cm, prev_frame_mvs_base, prev_frame_mvs_stride, xd, tmi_row, tmi_col, + ref_frame, blk_row, blk_col, refmv_count, ref_mv_stack, mode_context); +#else + coll_blk_count += add_col_ref_mv( + cm, prev_frame_mvs_base, prev_frame_mvs_stride, xd, mi_row, mi_col, + ref_frame, blk_row, blk_col, refmv_count, ref_mv_stack, mode_context); +#endif // CONFIG_TMV } #endif @@ -465,36 +866,75 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, } else { mode_context[ref_frame] |= (1 << ZEROMV_OFFSET); } +#endif // Scan the second outer area. scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, -1, ref_mv_stack, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV refmv_count); - for (idx = 2; idx <= 3; ++idx) { - scan_row_mbmi(cm, xd, mi_row, mi_col, block, rf, -idx, ref_mv_stack, - refmv_count); - scan_col_mbmi(cm, xd, mi_row, mi_col, block, rf, -idx, ref_mv_stack, - refmv_count); + for (idx = 2; idx <= MVREF_ROWS; ++idx) { +#if CONFIG_CB4X4 + row_offset = -(idx << 1) + 1 + row_adj; + col_offset = -(idx << 1) + 1 + col_adj; +#else + row_offset = -idx; + col_offset = -idx; +#endif + + if (abs(row_offset) <= abs(max_row_offset) && + abs(row_offset) > processed_rows) + scan_row_mbmi(cm, xd, mi_col, block, rf, row_offset, ref_mv_stack, + refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + max_row_offset, &processed_rows); + + if (abs(col_offset) <= abs(max_col_offset) && + abs(col_offset) > processed_cols) + scan_col_mbmi(cm, xd, mi_row, block, rf, col_offset, ref_mv_stack, + refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + max_col_offset, &processed_cols); } - scan_col_mbmi(cm, xd, mi_row, mi_col, block, rf, -4, ref_mv_stack, - refmv_count); + +#if CONFIG_CB4X4 + col_offset = -(MVREF_COLS << 1) + 1 + col_adj; +#else + col_offset = -MVREF_COLS; +#endif + if (abs(col_offset) <= abs(max_col_offset) && + abs(col_offset) > processed_cols) + scan_col_mbmi(cm, xd, mi_row, block, rf, col_offset, ref_mv_stack, + refmv_count, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + gm_mv_candidates, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + max_col_offset, &processed_cols); switch (nearest_refmv_count) { - case 0: - mode_context[ref_frame] |= 0; + case 0: mode_context[ref_frame] |= 0; +#if !CONFIG_OPT_REF_MV if (*refmv_count >= 1) mode_context[ref_frame] |= 1; - if (*refmv_count == 1) mode_context[ref_frame] |= (1 << REFMV_OFFSET); else if (*refmv_count >= 2) mode_context[ref_frame] |= (2 << REFMV_OFFSET); +#endif break; - case 1: - mode_context[ref_frame] |= (newmv_count > 0) ? 2 : 3; - + case 1: mode_context[ref_frame] |= (newmv_count > 0) ? 2 : 3; +#if CONFIG_OPT_REF_MV + mode_context[ref_frame] |= (3 << REFMV_OFFSET); +#else if (*refmv_count == 1) mode_context[ref_frame] |= (3 << REFMV_OFFSET); else if (*refmv_count >= 2) mode_context[ref_frame] |= (4 << REFMV_OFFSET); +#endif break; case 2: @@ -564,9 +1004,22 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd, void *const data, int16_t *mode_context, int_mv zeromv) { const int *ref_sign_bias = cm->ref_frame_sign_bias; + const int sb_mi_size = mi_size_wide[cm->sb_size]; int i, refmv_count = 0; int different_ref_found = 0; int context_counter = 0; + +#if CONFIG_TMV + int tmi_row = mi_row & 0xfffe; + int tmi_col = mi_col & 0xfffe; + POSITION mi_pos = { 0, 0 }; + int inside = is_inside(&xd->tile, tmi_col, tmi_row, cm->mi_rows, cm, &mi_pos); + const MV_REF *const prev_frame_mvs = + cm->use_prev_frame_mvs && inside + ? cm->prev_frame->mvs + (tmi_row >> 1) * ((cm->mi_cols + 1) >> 1) + + (tmi_col >> 1) + : NULL; +#else #if CONFIG_MV_COMPRESS const TileInfo *const tile_ = &xd->tile; int mi_row_end = tile_->mi_row_end; @@ -586,6 +1039,8 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd, ? cm->prev_frame->mvs + mi_row * cm->mi_cols + mi_col : NULL; #endif +#endif // CONFIG_TMV + #if CONFIG_INTRABC assert(IMPLIES(ref_frame == INTRA_FRAME, cm->use_prev_frame_mvs == 0)); #endif @@ -669,8 +1124,8 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd, ? NULL : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi; if (candidate == NULL) continue; - if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE || - (mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE) + if ((mi_row & (sb_mi_size - 1)) + mv_ref->row >= sb_mi_size || + (mi_col & (sb_mi_size - 1)) + mv_ref->col >= sb_mi_size) continue; different_ref_found = 1; @@ -721,8 +1176,8 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd, ? NULL : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi; if (candidate == NULL) continue; - if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE || - (mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE) + if ((mi_row & (sb_mi_size - 1)) + mv_ref->row >= sb_mi_size || + (mi_col & (sb_mi_size - 1)) + mv_ref->col >= sb_mi_size) continue; // If the candidate is INTRA we don't want to consider its mv. @@ -764,7 +1219,6 @@ Done: mv_ref_list[i].as_int = zeromv.as_int; } -#if CONFIG_EXT_INTER // This function keeps a mode count for a given MB/SB void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, @@ -814,17 +1268,13 @@ Done: if (mode_context) mode_context[ref_frame] = counter_to_context[context_counter]; } -#endif // CONFIG_EXT_INTER void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack, -#if CONFIG_EXT_INTER - int16_t *compound_mode_context, -#endif // CONFIG_EXT_INTER - int_mv *mv_ref_list, int mi_row, int mi_col, - find_mv_refs_sync sync, void *const data, - int16_t *mode_context) { + int16_t *compound_mode_context, int_mv *mv_ref_list, + int mi_row, int mi_col, find_mv_refs_sync sync, + void *const data, int16_t *mode_context) { int_mv zeromv[2]; #if CONFIG_GLOBAL_MOTION BLOCK_SIZE bsize = mi->mbmi.sb_type; @@ -834,24 +1284,33 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MV_REFERENCE_FRAME rf[2]; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_EXT_INTER av1_update_mv_context(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col, compound_mode_context); -#endif // CONFIG_EXT_INTER #if CONFIG_GLOBAL_MOTION if (!CONFIG_INTRABC || ref_frame != INTRA_FRAME) { av1_set_ref_frame(rf, ref_frame); zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[rf[0]], cm->allow_high_precision_mv, bsize, - mi_col, mi_row, 0) + mi_col, mi_row, 0 +#if CONFIG_AMVR + , + cm->cur_frame_mv_precision_level +#endif + ) .as_int; - zeromv[1].as_int = (rf[1] != NONE_FRAME) - ? gm_get_motion_vector(&cm->global_motion[rf[1]], - cm->allow_high_precision_mv, - bsize, mi_col, mi_row, 0) - .as_int - : 0; + zeromv[1].as_int = + (rf[1] != NONE_FRAME) + ? gm_get_motion_vector(&cm->global_motion[rf[1]], + cm->allow_high_precision_mv, bsize, mi_col, + mi_row, 0 +#if CONFIG_AMVR + , + cm->cur_frame_mv_precision_level +#endif + ) + .as_int + : 0; } else { zeromv[0].as_int = zeromv[1].as_int = 0; } @@ -864,6 +1323,9 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, sync, data, mode_context, zeromv[0]); setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + zeromv, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV -1, mi_row, mi_col, mode_context); /* Note: If global motion is enabled, then we want to set the ALL_ZERO flag iff all of the MVs we could generate with NEARMV/NEARESTMV are equivalent @@ -880,26 +1342,38 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, zero, so sets the ALL_ZERO flag. * This leads to an encode/decode mismatch. */ - if (*ref_mv_count >= 2) { - for (idx = 0; idx < AOMMIN(3, *ref_mv_count); ++idx) { - if (ref_mv_stack[idx].this_mv.as_int != zeromv[0].as_int) all_zero = 0; - if (ref_frame > ALTREF_FRAME) - if (ref_mv_stack[idx].comp_mv.as_int != zeromv[1].as_int) all_zero = 0; - } - } else if (ref_frame <= ALTREF_FRAME) { + for (idx = 0; idx < AOMMIN(3, *ref_mv_count); ++idx) { + if (ref_mv_stack[idx].this_mv.as_int != zeromv[0].as_int) all_zero = 0; + if (ref_frame > ALTREF_FRAME) + if (ref_mv_stack[idx].comp_mv.as_int != zeromv[1].as_int) all_zero = 0; + } + if (*ref_mv_count < 2 && ref_frame <= ALTREF_FRAME) { for (idx = 0; idx < MAX_MV_REF_CANDIDATES; ++idx) if (mv_ref_list[idx].as_int != zeromv[0].as_int) all_zero = 0; } +#if !CONFIG_OPT_REF_MV if (all_zero) mode_context[ref_frame] |= (1 << ALL_ZERO_FLAG_OFFSET); +#else + (void)all_zero; +#endif } void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, - int_mv *near_mv) { + int_mv *near_mv +#if CONFIG_AMVR + , + int is_integer +#endif + ) { int i; // Make sure all the candidates are properly clamped etc for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { +#if CONFIG_AMVR + lower_mv_precision(&mvlist[i].as_mv, allow_hp, is_integer); +#else lower_mv_precision(&mvlist[i].as_mv, allow_hp); +#endif } *nearest_mv = mvlist[0]; *near_mv = mvlist[1]; @@ -908,14 +1382,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, int block, int ref, int mi_row, int mi_col, CANDIDATE_MV *ref_mv_stack, - uint8_t *ref_mv_count, -#if CONFIG_EXT_INTER - int_mv *mv_list, -#endif // CONFIG_EXT_INTER + uint8_t *ref_mv_count, int_mv *mv_list, int_mv *nearest_mv, int_mv *near_mv) { -#if !CONFIG_EXT_INTER - int_mv mv_list[MAX_MV_REF_CANDIDATES]; -#endif // !CONFIG_EXT_INTER MODE_INFO *const mi = xd->mi[0]; b_mode_info *bmi = mi->bmi; int n; @@ -931,7 +1399,12 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, #if CONFIG_GLOBAL_MOTION zeromv.as_int = gm_get_motion_vector(&cm->global_motion[rf[0]], cm->allow_high_precision_mv, - mi->mbmi.sb_type, mi_col, mi_row, block) + mi->mbmi.sb_type, mi_col, mi_row, block +#if CONFIG_AMVR + , + cm->cur_frame_mv_precision_level +#endif + ) .as_int; #else zeromv.as_int = 0; @@ -940,10 +1413,16 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, mi_col, NULL, NULL, NULL, zeromv); scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, 0, ref_mv_stack, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + &zeromv, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV ref_mv_count); above_count = *ref_mv_count; scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, 0, -1, ref_mv_stack, +#if CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV + &zeromv, +#endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV ref_mv_count); left_count = *ref_mv_count - above_count; @@ -994,6 +1473,526 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, } } +#if CONFIG_FRAME_MARKER +void av1_setup_frame_buf_refs(AV1_COMMON *cm) { + cm->cur_frame->cur_frame_offset = cm->frame_offset; + int alt_buf_idx = cm->frame_refs[ALTREF_FRAME - LAST_FRAME].idx; + int lst_buf_idx = cm->frame_refs[LAST_FRAME - LAST_FRAME].idx; + int gld_buf_idx = cm->frame_refs[GOLDEN_FRAME - LAST_FRAME].idx; + +#if CONFIG_EXT_REFS + int lst2_buf_idx = cm->frame_refs[LAST2_FRAME - LAST_FRAME].idx; + int lst3_buf_idx = cm->frame_refs[LAST3_FRAME - LAST_FRAME].idx; + int bwd_buf_idx = cm->frame_refs[BWDREF_FRAME - LAST_FRAME].idx; + int alt2_buf_idx = cm->frame_refs[ALTREF2_FRAME - LAST_FRAME].idx; +#endif + + if (alt_buf_idx >= 0) + cm->cur_frame->alt_frame_offset = + cm->buffer_pool->frame_bufs[alt_buf_idx].cur_frame_offset; + + if (lst_buf_idx >= 0) + cm->cur_frame->lst_frame_offset = + cm->buffer_pool->frame_bufs[lst_buf_idx].cur_frame_offset; + + if (gld_buf_idx >= 0) + cm->cur_frame->gld_frame_offset = + cm->buffer_pool->frame_bufs[gld_buf_idx].cur_frame_offset; + +#if CONFIG_EXT_REFS + if (lst2_buf_idx >= 0) + cm->cur_frame->lst2_frame_offset = + cm->buffer_pool->frame_bufs[lst2_buf_idx].cur_frame_offset; + + if (lst3_buf_idx >= 0) + cm->cur_frame->lst3_frame_offset = + cm->buffer_pool->frame_bufs[lst3_buf_idx].cur_frame_offset; + + if (bwd_buf_idx >= 0) + cm->cur_frame->bwd_frame_offset = + cm->buffer_pool->frame_bufs[bwd_buf_idx].cur_frame_offset; + + if (alt2_buf_idx >= 0) + cm->cur_frame->alt2_frame_offset = + cm->buffer_pool->frame_bufs[alt2_buf_idx].cur_frame_offset; +#endif +} + +#if CONFIG_FRAME_SIGN_BIAS +void av1_setup_frame_sign_bias(AV1_COMMON *cm) { + MV_REFERENCE_FRAME ref_frame; + for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { + const int buf_idx = cm->frame_refs[ref_frame - LAST_FRAME].idx; + if (buf_idx != INVALID_IDX) { + const int ref_frame_offset = + cm->buffer_pool->frame_bufs[buf_idx].cur_frame_offset; + cm->ref_frame_sign_bias[ref_frame] = + (ref_frame_offset <= (int)cm->frame_offset) ? 0 : 1; + } else { + cm->ref_frame_sign_bias[ref_frame] = 0; + } + } +} +#endif // CONFIG_FRAME_SIGN_BIAS +#endif // CONFIG_FRAME_MARKER + +#if CONFIG_MFMV +// Although we assign 32 bit integers, all the values are strictly under 14 +// bits. +static int div_mult[32] = { + 0, 16384, 8192, 5461, 4096, 3276, 2730, 2340, 2048, 1820, 1638, + 1489, 1365, 1260, 1170, 1092, 1024, 963, 910, 862, 819, 780, + 744, 712, 682, 655, 630, 606, 585, 564, 546, 528, +}; + +// TODO(jingning): Consider the use of lookup table for (num / den) +// altogether. +static void get_mv_projection(MV *output, MV ref, int num, int den) { + output->row = + (int16_t)(ROUND_POWER_OF_TWO(ref.row * num * div_mult[den], 14)); + output->col = + (int16_t)(ROUND_POWER_OF_TWO(ref.col * num * div_mult[den], 14)); +} + +#define MAX_OFFSET_WIDTH 64 +#define MAX_OFFSET_HEIGHT 32 + +static int get_block_position(AV1_COMMON *cm, int *mi_r, int *mi_c, int blk_row, + int blk_col, MV mv, int sign_bias) { + if ((abs(mv.row) >> 3) > MAX_OFFSET_HEIGHT || + (abs(mv.col) >> 3) > MAX_OFFSET_WIDTH) + return 0; + + int row = (sign_bias == 1) ? blk_row - (mv.row >> (3 + MI_SIZE_LOG2)) + : blk_row + (mv.row >> (3 + MI_SIZE_LOG2)); + int col = (sign_bias == 1) ? blk_col - (mv.col >> (3 + MI_SIZE_LOG2)) + : blk_col + (mv.col >> (3 + MI_SIZE_LOG2)); + + if (row < 0 || row >= cm->mi_rows || col < 0 || col >= cm->mi_cols) return 0; + + *mi_r = row; + *mi_c = col; + + return 1; +} + +static uint32_t mv_sign_reverse(int_mv ref) { + int_mv this_mv; + this_mv.as_mv.row = -ref.as_mv.row; + this_mv.as_mv.col = -ref.as_mv.col; + + return this_mv.as_int; +} + +void av1_setup_motion_field(AV1_COMMON *cm) { + int cur_frame_index = cm->cur_frame->cur_frame_offset; + int lst_frame_index = 0, alt_frame_index = 0, gld_frame_index = 0; +#if CONFIG_EXT_REFS + int lst2_frame_index = 0, lst3_frame_index = 0; + int bwd_frame_index = 0, alt2_frame_index = 0; +#endif + TPL_MV_REF *tpl_mvs_base = cm->cur_frame->tpl_mvs; + + for (int ref_frame = 0; ref_frame < INTER_REFS_PER_FRAME; ++ref_frame) { + int size = (cm->mi_rows + 16) * cm->mi_stride; + for (int idx = 0; idx < size; ++idx) { + for (int i = 0; i < MFMV_STACK_SIZE; ++i) + tpl_mvs_base[idx].mfmv[ref_frame][i].as_int = INVALID_MV; + } + } + + int alt_buf_idx = cm->frame_refs[ALTREF_FRAME - LAST_FRAME].idx; + int lst_buf_idx = cm->frame_refs[LAST_FRAME - LAST_FRAME].idx; + int gld_buf_idx = cm->frame_refs[GOLDEN_FRAME - LAST_FRAME].idx; +#if CONFIG_EXT_REFS + int lst2_buf_idx = cm->frame_refs[LAST2_FRAME - LAST_FRAME].idx; + int lst3_buf_idx = cm->frame_refs[LAST3_FRAME - LAST_FRAME].idx; + int bwd_buf_idx = cm->frame_refs[BWDREF_FRAME - LAST_FRAME].idx; + int alt2_buf_idx = cm->frame_refs[ALTREF2_FRAME - LAST_FRAME].idx; +#endif + + if (alt_buf_idx >= 0) + alt_frame_index = cm->buffer_pool->frame_bufs[alt_buf_idx].cur_frame_offset; + + if (lst_buf_idx >= 0) + lst_frame_index = cm->buffer_pool->frame_bufs[lst_buf_idx].cur_frame_offset; + + if (gld_buf_idx >= 0) + gld_frame_index = cm->buffer_pool->frame_bufs[gld_buf_idx].cur_frame_offset; + +#if CONFIG_EXT_REFS + if (lst2_buf_idx >= 0) + lst2_frame_index = + cm->buffer_pool->frame_bufs[lst2_buf_idx].cur_frame_offset; + + if (lst3_buf_idx >= 0) + lst3_frame_index = + cm->buffer_pool->frame_bufs[lst3_buf_idx].cur_frame_offset; + + if (bwd_buf_idx >= 0) + bwd_frame_index = cm->buffer_pool->frame_bufs[bwd_buf_idx].cur_frame_offset; + + if (alt2_buf_idx >= 0) + alt2_frame_index = + cm->buffer_pool->frame_bufs[alt2_buf_idx].cur_frame_offset; +#endif + + if (alt_frame_index < cur_frame_index) return; + + // ====================== + // Process last frame + // ====================== + if (lst_buf_idx >= 0) { + MV_REF *mv_ref_base = cm->buffer_pool->frame_bufs[lst_buf_idx].mvs; + const int lst_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].lst_frame_offset; + const int alt_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].alt_frame_offset; + const int gld_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].gld_frame_offset; +#if CONFIG_EXT_REFS + const int lst2_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].lst2_frame_offset; + const int lst3_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].lst3_frame_offset; + const int bwd_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].bwd_frame_offset; + const int alt2_frame_idx = + cm->buffer_pool->frame_bufs[lst_buf_idx].alt2_frame_offset; +#endif + + int alt_offset = AOMMAX(1, alt_frame_idx - lst_frame_index); + int lst_offset = AOMMAX(1, lst_frame_index - lst_frame_idx); + int gld_offset = AOMMAX(1, lst_frame_index - gld_frame_idx); + int cur_to_lst = cur_frame_index - lst_frame_index; + int cur_to_alt = alt_frame_index - cur_frame_index; + int cur_to_gld = cur_frame_index - gld_frame_index; + +#if CONFIG_EXT_REFS + int bwd_offset = AOMMAX(1, bwd_frame_idx - lst_frame_index); + int alt2_offset = AOMMAX(1, alt2_frame_idx - lst_frame_index); + int lst2_offset = AOMMAX(1, lst_frame_index - lst2_frame_idx); + int lst3_offset = AOMMAX(1, lst_frame_index - lst3_frame_idx); + int cur_to_lst2 = cur_frame_index - lst2_frame_index; + int cur_to_lst3 = cur_frame_index - lst3_frame_index; + int cur_to_bwd = bwd_frame_index - cur_frame_index; + int cur_to_alt2 = alt2_frame_index - cur_frame_index; +#endif + + const int is_lst_overlay = (alt_frame_idx == gld_frame_index); + // clang-format off + const int ref_frame_offset_buffer[TOTAL_REFS_PER_FRAME] = { +#if CONFIG_EXT_REFS + 0, lst_offset, lst2_offset, lst3_offset, gld_offset, + bwd_offset, alt2_offset, alt_offset +#else + 0, lst_offset, gld_offset, alt_offset +#endif + }; + // clang-format on + + for (int blk_row = 0; blk_row < cm->mi_rows && !is_lst_overlay; ++blk_row) { + for (int blk_col = 0; blk_col < cm->mi_cols; ++blk_col) { + MV_REF *mv_ref = &mv_ref_base[blk_row * cm->mi_cols + blk_col]; + MV fwd_mv = mv_ref->mv[0].as_mv; + MV_REFERENCE_FRAME ref_frame[2] = { mv_ref->ref_frame[0], + mv_ref->ref_frame[1] }; + + // Derive motion vectors toward last reference frame. + if (ref_frame[0] <= GOLDEN_FRAME && ref_frame[0] > INTRA_FRAME) { + int_mv this_mv; + int mi_r, mi_c; + + const int ref_frame_offset = ref_frame_offset_buffer[ref_frame[0]]; + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst, + ref_frame_offset); + int pos_valid = get_block_position(cm, &mi_r, &mi_c, blk_row, blk_col, + this_mv.as_mv, 1); + + if (pos_valid) { + int mi_offset = mi_r * cm->mi_stride + mi_c; + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST_FRAME)][0].as_int = + this_mv.as_int; + +#if CONFIG_EXT_REFS + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst2, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST2_FRAME)][0].as_int = + this_mv.as_int; + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst3, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST3_FRAME)][0].as_int = + this_mv.as_int; +#endif + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_gld, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(GOLDEN_FRAME)] + [0].as_int = this_mv.as_int; + } + } + + for (int idx = 0; idx < 2; ++idx) { + if (ref_frame[idx] <= GOLDEN_FRAME) continue; + + int_mv this_mv; + int mi_r, mi_c; + fwd_mv = mv_ref->mv[idx].as_mv; + + const int ref_frame_offset = ref_frame_offset_buffer[ref_frame[idx]]; + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst, + ref_frame_offset); + int pos_valid = get_block_position(cm, &mi_r, &mi_c, blk_row, blk_col, + this_mv.as_mv, 0); + + if (pos_valid) { + int mi_offset = mi_r * cm->mi_stride + mi_c; + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_alt, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(ALTREF_FRAME)] + [0].as_int = this_mv.as_int; + +#if CONFIG_EXT_REFS + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_bwd, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(BWDREF_FRAME)] + [0].as_int = this_mv.as_int; + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_alt2, + ref_frame_offset); + tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(ALTREF2_FRAME)] + [0].as_int = this_mv.as_int; +#endif + } + } + } + } + } + + // ======================= + // Process ARF frame + // ======================= + if (alt_buf_idx >= 0) { + MV_REF *mv_ref_base = cm->buffer_pool->frame_bufs[alt_buf_idx].mvs; + const int lst_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].lst_frame_offset; + const int gld_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].gld_frame_offset; +#if CONFIG_EXT_REFS + const int lst2_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].lst2_frame_offset; + const int lst3_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].lst3_frame_offset; + const int bwd_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].bwd_frame_offset; + const int alt2_frame_idx = + cm->buffer_pool->frame_bufs[alt_buf_idx].alt2_frame_offset; +#endif + + int lst_offset = AOMMAX(1, alt_frame_index - lst_frame_idx); + int gld_offset = AOMMAX(1, alt_frame_index - gld_frame_idx); + int cur_to_alt = alt_frame_index - cur_frame_index; + int cur_to_lst = cur_frame_index - lst_frame_index; + int cur_to_gld = cur_frame_index - gld_frame_index; +#if CONFIG_EXT_REFS + int bwd_offset = AOMMAX(1, alt_frame_index - bwd_frame_idx); + int alt2_offset = AOMMAX(1, alt_frame_index - alt2_frame_idx); + int lst2_offset = AOMMAX(1, alt_frame_index - lst2_frame_idx); + int lst3_offset = AOMMAX(1, alt_frame_index - lst3_frame_idx); + int cur_to_lst2 = cur_frame_index - lst2_frame_index; + int cur_to_lst3 = cur_frame_index - lst3_frame_index; + int cur_to_bwd = bwd_frame_index - cur_frame_index; + int cur_to_alt2 = alt2_frame_index - cur_frame_index; +#endif + const int ref_stamp = FWD_RF_OFFSET(ALTREF_FRAME); + // clang-format off + const int ref_frame_offset_buffer[TOTAL_REFS_PER_FRAME] = { +#if CONFIG_EXT_REFS + 0, lst_offset, lst2_offset, lst3_offset, gld_offset, + bwd_offset, alt2_offset, 0, +#else + 0, lst_offset, gld_offset, 0, +#endif + }; + // clang-format on + + for (int blk_row = 0; blk_row < cm->mi_rows; ++blk_row) { + for (int blk_col = 0; blk_col < cm->mi_cols; ++blk_col) { + MV_REF *mv_ref = &mv_ref_base[blk_row * cm->mi_cols + blk_col]; + MV fwd_mv = mv_ref->mv[0].as_mv; + MV_REFERENCE_FRAME ref_frame[2] = { mv_ref->ref_frame[0], + mv_ref->ref_frame[1] }; + + const int ref_frame_offset = ref_frame_offset_buffer[ref_frame[0]]; + + if (ref_frame[0] <= GOLDEN_FRAME && ref_frame[0] > INTRA_FRAME) { + int_mv this_mv; + int mi_r, mi_c; + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_alt, + ref_frame_offset); + int pos_valid = get_block_position(cm, &mi_r, &mi_c, blk_row, blk_col, + this_mv.as_mv, 0); + + if (pos_valid) { + int mi_offset = mi_r * cm->mi_stride + mi_c; + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(ALTREF_FRAME)][ref_stamp] + .as_int = mv_sign_reverse(this_mv); + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + +#if CONFIG_EXT_REFS + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_bwd, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(BWDREF_FRAME)][ref_stamp] + .as_int = mv_sign_reverse(this_mv); + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_alt2, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(ALTREF2_FRAME)][ref_stamp] + .as_int = mv_sign_reverse(this_mv); + + if (ref_frame[0] >= LAST2_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst2, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST2_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } + + if (ref_frame[0] >= LAST3_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst3, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST3_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } +#endif + if (ref_frame[0] >= GOLDEN_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_gld, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(GOLDEN_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } + } + } + } + } + } + +// ========================================== +// Process BWD reference frame +// ========================================== +#if CONFIG_EXT_REFS + if (bwd_buf_idx >= 0) { + MV_REF *mv_ref_base = cm->buffer_pool->frame_bufs[bwd_buf_idx].mvs; + const int lst_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].lst_frame_offset; + const int gld_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].gld_frame_offset; + const int lst2_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].lst2_frame_offset; + const int lst3_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].lst3_frame_offset; + const int bwd_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].bwd_frame_offset; + const int alt2_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].alt2_frame_offset; + const int alt_frame_idx = + cm->buffer_pool->frame_bufs[bwd_buf_idx].alt_frame_offset; + + int lst_offset = AOMMAX(1, bwd_frame_index - lst_frame_idx); + int gld_offset = AOMMAX(1, bwd_frame_index - gld_frame_idx); + int cur_to_lst = cur_frame_index - lst_frame_index; + + int lst2_offset = AOMMAX(1, bwd_frame_index - lst2_frame_idx); + int lst3_offset = AOMMAX(1, bwd_frame_index - lst3_frame_idx); + int bwd_offset = AOMMAX(1, bwd_frame_idx - bwd_frame_index); + int alt2_offset = AOMMAX(1, alt2_frame_idx - bwd_frame_index); + int alt_offset = AOMMAX(1, alt_frame_idx - bwd_frame_index); + int cur_to_lst2 = cur_frame_index - lst2_frame_index; + int cur_to_lst3 = cur_frame_index - lst3_frame_index; + int cur_to_gld = cur_frame_index - gld_frame_index; + int cur_to_bwd = bwd_frame_index - cur_frame_index; + + const int ref_stamp = FWD_RF_OFFSET(BWDREF_FRAME); + const int ref_frame_offset_buffer[TOTAL_REFS_PER_FRAME] = { + 0, lst_offset, lst2_offset, lst3_offset, + gld_offset, bwd_offset, alt2_offset, alt_offset, + }; + + for (int blk_row = 0; blk_row < cm->mi_rows; ++blk_row) { + for (int blk_col = 0; blk_col < cm->mi_cols; ++blk_col) { + MV_REF *mv_ref = &mv_ref_base[blk_row * cm->mi_cols + blk_col]; + MV fwd_mv = mv_ref->mv[0].as_mv; + MV_REFERENCE_FRAME ref_frame[2] = { mv_ref->ref_frame[0], + mv_ref->ref_frame[1] }; + + if (ref_frame[0] <= GOLDEN_FRAME && ref_frame[0] > INTRA_FRAME) { + const int ref_frame_offset = ref_frame_offset_buffer[ref_frame[0]]; + int_mv this_mv; + int mi_r, mi_c; + + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_bwd, + ref_frame_offset); + int pos_valid = get_block_position(cm, &mi_r, &mi_c, blk_row, blk_col, + this_mv.as_mv, 0); + + if (pos_valid) { + int mi_offset = mi_r * cm->mi_stride + mi_c; + + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(BWDREF_FRAME)][ref_stamp] + .as_int = mv_sign_reverse(this_mv); + + // Project the motion vector onto last reference frame + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + + if (ref_frame[0] >= LAST2_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst2, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST2_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } + + if (ref_frame[0] >= LAST3_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst3, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(LAST3_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } + + if (ref_frame[0] >= GOLDEN_FRAME) { + get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_gld, + ref_frame_offset); + tpl_mvs_base[mi_offset] + .mfmv[FWD_RF_OFFSET(GOLDEN_FRAME)][ref_stamp] + .as_int = this_mv.as_int; + } + } + } + } + } + } +#endif +} +#endif // CONFIG_MFMV + #if CONFIG_WARPED_MOTION #if WARPED_MOTION_SORT_SAMPLES static INLINE void record_samples(MB_MODE_INFO *mbmi, int *pts, int *pts_inref, @@ -1072,71 +2071,49 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col, int ref_frame = mbmi0->ref_frame[0]; int up_available = xd->up_available; int left_available = xd->left_available; - int i, mi_step = 1, np = 0, n, j, k; + int i, mi_step = 1, np = 0; int global_offset_c = mi_col * MI_SIZE; int global_offset_r = mi_row * MI_SIZE; const TileInfo *const tile = &xd->tile; - // Search nb range in the unit of mi - int bs = - (AOMMAX(xd->n8_w, xd->n8_h) > 1) ? (AOMMAX(xd->n8_w, xd->n8_h) >> 1) : 1; - int marked[16 * 32]; // max array size for 128x128 int do_tl = 1; int do_tr = 1; - // scan the above rows + // scan the nearest above rows if (up_available) { - for (n = 0; n < bs; n++) { - int mi_row_offset = -1 * (n + 1); - - if (!n) { - MODE_INFO *mi = xd->mi[mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *mbmi = &mi->mbmi; - uint8_t n8_w = mi_size_wide[mbmi->sb_type]; - - // Handle "current block width <= above block width" case. - if (xd->n8_w <= n8_w) { - int col_offset = -mi_col % n8_w; - - if (col_offset < 0) do_tl = 0; - if (col_offset + n8_w > xd->n8_w) do_tr = 0; - - if (mbmi->ref_frame[0] == ref_frame && - mbmi->ref_frame[1] == NONE_FRAME) { - record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, - global_offset_c, 0, -1, col_offset, 1); - pts += 2; - pts_inref += 2; - pts_mv += 2; - np++; - } - break; - } - } + int mi_row_offset = -1; + MODE_INFO *mi = xd->mi[mi_row_offset * xd->mi_stride]; + MB_MODE_INFO *mbmi = &mi->mbmi; + uint8_t n8_w = mi_size_wide[mbmi->sb_type]; - // Handle "current block width > above block width" case. - if (!n) memset(marked, 0, bs * xd->n8_w * sizeof(*marked)); + if (xd->n8_w <= n8_w) { + // Handle "current block width <= above block width" case. + int col_offset = -mi_col % n8_w; + if (col_offset < 0) do_tl = 0; + if (col_offset + n8_w > xd->n8_w) do_tr = 0; + + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) { + record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, + global_offset_c, 0, -1, col_offset, 1); + pts += 2; + pts_inref += 2; + pts_mv += 2; + np++; + } + } else { + // Handle "current block width > above block width" case. for (i = 0; i < AOMMIN(xd->n8_w, cm->mi_cols - mi_col); i += mi_step) { int mi_col_offset = i; - MODE_INFO *mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *mbmi = &mi->mbmi; - uint8_t n8_w = mi_size_wide[mbmi->sb_type]; - uint8_t n8_h = mi_size_high[mbmi->sb_type]; - + mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + mbmi = &mi->mbmi; + n8_w = mi_size_wide[mbmi->sb_type]; mi_step = AOMMIN(xd->n8_w, n8_w); - // Processed already - if (marked[n * xd->n8_w + i]) continue; - - for (j = 0; j < AOMMIN(bs, n8_h); j++) - for (k = 0; k < AOMMIN(xd->n8_w, n8_w); k++) - marked[(n + j) * xd->n8_w + i + k] = 1; - if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) { record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, - global_offset_c, -n, -1, i, 1); + global_offset_c, 0, -1, i, 1); pts += 2; pts_inref += 2; pts_mv += 2; @@ -1147,58 +2124,41 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col, } assert(2 * np <= SAMPLES_ARRAY_SIZE); - // scan the left columns + // scan the nearest left columns if (left_available) { - for (n = 0; n < bs; n++) { - int mi_col_offset = -1 * (n + 1); - - if (!n) { - MODE_INFO *mi = xd->mi[mi_col_offset]; - MB_MODE_INFO *mbmi = &mi->mbmi; - uint8_t n8_h = mi_size_high[mbmi->sb_type]; - - // Handle "current block height <= above block height" case. - if (xd->n8_h <= n8_h) { - int row_offset = -mi_row % n8_h; - - if (row_offset < 0) do_tl = 0; - - if (mbmi->ref_frame[0] == ref_frame && - mbmi->ref_frame[1] == NONE_FRAME) { - record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, - global_offset_c, row_offset, 1, 0, -1); - pts += 2; - pts_inref += 2; - pts_mv += 2; - np++; - } - break; - } - } + int mi_col_offset = -1; - // Handle "current block height > above block height" case. - if (!n) memset(marked, 0, bs * xd->n8_h * sizeof(*marked)); + MODE_INFO *mi = xd->mi[mi_col_offset]; + MB_MODE_INFO *mbmi = &mi->mbmi; + uint8_t n8_h = mi_size_high[mbmi->sb_type]; + if (xd->n8_h <= n8_h) { + // Handle "current block height <= above block height" case. + int row_offset = -mi_row % n8_h; + + if (row_offset < 0) do_tl = 0; + + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) { + record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, + global_offset_c, row_offset, 1, 0, -1); + pts += 2; + pts_inref += 2; + pts_mv += 2; + np++; + } + } else { + // Handle "current block height > above block height" case. for (i = 0; i < AOMMIN(xd->n8_h, cm->mi_rows - mi_row); i += mi_step) { int mi_row_offset = i; - MODE_INFO *mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *mbmi = &mi->mbmi; - uint8_t n8_w = mi_size_wide[mbmi->sb_type]; - uint8_t n8_h = mi_size_high[mbmi->sb_type]; - + mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + mbmi = &mi->mbmi; + n8_h = mi_size_high[mbmi->sb_type]; mi_step = AOMMIN(xd->n8_h, n8_h); - // Processed already - if (marked[n * xd->n8_h + i]) continue; - - for (j = 0; j < AOMMIN(bs, n8_w); j++) - for (k = 0; k < AOMMIN(xd->n8_h, n8_h); k++) - marked[(n + j) * xd->n8_h + i + k] = 1; - if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) { record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r, - global_offset_c, i, 1, -n, -1); + global_offset_c, i, 1, 0, -1); pts += 2; pts_inref += 2; pts_mv += 2; @@ -1229,7 +2189,8 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col, assert(2 * np <= SAMPLES_ARRAY_SIZE); // Top-right block - if (do_tr && has_top_right(xd, mi_row, mi_col, AOMMAX(xd->n8_w, xd->n8_h))) { + if (do_tr && + has_top_right(cm, xd, mi_row, mi_col, AOMMAX(xd->n8_w, xd->n8_h))) { POSITION trb_pos = { -1, xd->n8_w }; if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &trb_pos)) { diff --git a/third_party/aom/av1/common/mvref_common.h b/third_party/aom/av1/common/mvref_common.h index 8caa74535..348887e43 100644 --- a/third_party/aom/av1/common/mvref_common.h +++ b/third_party/aom/av1/common/mvref_common.h @@ -19,6 +19,8 @@ extern "C" { #endif #define MVREF_NEIGHBOURS 9 +#define MVREF_ROWS 3 +#define MVREF_COLS 4 typedef struct position { int row; @@ -51,19 +53,16 @@ static const int mode_2_counter[] = { 9, // D153_PRED 9, // D207_PRED 9, // D63_PRED -#if CONFIG_ALT_INTRA 9, // SMOOTH_PRED #if CONFIG_SMOOTH_HV 9, // SMOOTH_V_PRED 9, // SMOOTH_H_PRED #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA 9, // TM_PRED 0, // NEARESTMV 0, // NEARMV 3, // ZEROMV 1, // NEWMV -#if CONFIG_EXT_INTER #if CONFIG_COMPOUND_SINGLEREF 0, // SR_NEAREST_NEARMV // 1, // SR_NEAREST_NEWMV @@ -79,7 +78,6 @@ static const int mode_2_counter[] = { 1, // NEW_NEARMV 3, // ZERO_ZEROMV 1, // NEW_NEWMV -#endif // CONFIG_EXT_INTER }; // There are 3^3 different combinations of 3 counts that can be either 0,1 or @@ -209,11 +207,46 @@ static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row, } } -static INLINE void lower_mv_precision(MV *mv, int allow_hp) { - if (!allow_hp) { - if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1); - if (mv->col & 1) mv->col += (mv->col > 0 ? -1 : 1); +static INLINE int find_valid_row_offset(const TileInfo *const tile, int mi_row, + int mi_rows, const AV1_COMMON *cm, + int row_offset) { +#if CONFIG_DEPENDENT_HORZTILES + const int dependent_horz_tile_flag = cm->dependent_horz_tiles; +#else + const int dependent_horz_tile_flag = 0; + (void)cm; +#endif + if (dependent_horz_tile_flag && !tile->tg_horz_boundary) + return clamp(row_offset, -mi_row, mi_rows - mi_row - 1); + else + return clamp(row_offset, tile->mi_row_start - mi_row, + tile->mi_row_end - mi_row - 1); +} + +static INLINE int find_valid_col_offset(const TileInfo *const tile, int mi_col, + int col_offset) { + return clamp(col_offset, tile->mi_col_start - mi_col, + tile->mi_col_end - mi_col - 1); +} + +static INLINE void lower_mv_precision(MV *mv, int allow_hp +#if CONFIG_AMVR + , + int is_integer +#endif + ) { +#if CONFIG_AMVR + if (is_integer) { + integer_mv_precision(mv); + } else { +#endif + if (!allow_hp) { + if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1); + if (mv->col & 1) mv->col += (mv->col > 0 ? -1 : 1); + } +#if CONFIG_AMVR } +#endif } static INLINE uint8_t av1_get_pred_diff_ctx(const int_mv pred_mv, @@ -280,10 +313,8 @@ static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = { { LAST_FRAME, BWDREF_FRAME }, { LAST2_FRAME, BWDREF_FRAME }, { LAST3_FRAME, BWDREF_FRAME }, { GOLDEN_FRAME, BWDREF_FRAME }, -#if CONFIG_ALTREF2 { LAST_FRAME, ALTREF2_FRAME }, { LAST2_FRAME, ALTREF2_FRAME }, { LAST3_FRAME, ALTREF2_FRAME }, { GOLDEN_FRAME, ALTREF2_FRAME }, -#endif // CONFIG_ALTREF2 { LAST_FRAME, ALTREF_FRAME }, { LAST2_FRAME, ALTREF_FRAME }, { LAST3_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME } @@ -357,39 +388,49 @@ static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack, return 0; } +#if CONFIG_FRAME_MARKER +void av1_setup_frame_buf_refs(AV1_COMMON *cm); +#if CONFIG_FRAME_SIGN_BIAS +void av1_setup_frame_sign_bias(AV1_COMMON *cm); +#endif // CONFIG_FRAME_SIGN_BIAS +#if CONFIG_MFMV +void av1_setup_motion_field(AV1_COMMON *cm); +#endif // CONFIG_MFMV +#endif // CONFIG_FRAME_MARKER + +void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row, + int mi_col, int x_mis, int y_mis); + typedef void (*find_mv_refs_sync)(void *const data, int mi_row); void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack, -#if CONFIG_EXT_INTER - int16_t *compound_mode_context, -#endif // CONFIG_EXT_INTER - int_mv *mv_ref_list, int mi_row, int mi_col, - find_mv_refs_sync sync, void *const data, - int16_t *mode_context); + int16_t *compound_mode_context, int_mv *mv_ref_list, + int mi_row, int mi_col, find_mv_refs_sync sync, + void *const data, int16_t *mode_context); // check a list of motion vectors by sad score using a number rows of pixels // above and a number cols of pixels in the left to select the one with best // score to use as ref motion vector +#if CONFIG_AMVR +void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, + int_mv *near_mv, int is_integer); +#else void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, int_mv *near_mv); +#endif void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, int block, int ref, int mi_row, int mi_col, CANDIDATE_MV *ref_mv_stack, - uint8_t *ref_mv_count, -#if CONFIG_EXT_INTER - int_mv *mv_list, -#endif // CONFIG_EXT_INTER + uint8_t *ref_mv_count, int_mv *mv_list, int_mv *nearest_mv, int_mv *near_mv); -#if CONFIG_EXT_INTER // This function keeps a mode count for a given MB/SB void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, int_mv *mv_ref_list, int block, int mi_row, int mi_col, int16_t *mode_context); -#endif // CONFIG_EXT_INTER #if CONFIG_WARPED_MOTION #if WARPED_MOTION_SORT_SAMPLES diff --git a/third_party/aom/av1/common/ncobmc_kernels.c b/third_party/aom/av1/common/ncobmc_kernels.c new file mode 100644 index 000000000..af951398b --- /dev/null +++ b/third_party/aom/av1/common/ncobmc_kernels.c @@ -0,0 +1,1181 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include "av1/common/ncobmc_kernels.h" + +// The kernels are only used in the experiment "ncobmc-adapt-weight", which +// blends four predictions to form a final prediction for an inter-block +// The indices of the default kernels correspond to +// 1. the index of the size of the kernels (ADAPT_OVERLAP_BLOCKS ) +// 2. the interpolation modes (NCOBMC_MODE) +// 3. the prediction the kernels applies to + +static int16_t default_ncobmc_krnl_0_0_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5684, 3601, 1367, 364, 1509, 2313, 4007, 5080 }, + { 3728, 2486, 827, 196, 1434, 2034, 2868, 3000 }, + { 1643, 1465, 726, 208, 890, 1386, 1242, 1293 }, + { 794, 723, 277, -237, 206, 487, 749, 896 }, + { 1176, 730, 286, 136, 281, 262, 724, 953 }, + { 2086, 1958, 783, 539, 751, 984, 1143, 1491 }, + { 2665, 2520, 1402, 1037, 939, 1223, 1593, 1937 }, + { 3451, 3172, 2350, 1291, 1069, 1916, 2672, 3223 } +}; +static int16_t default_ncobmc_krnl_0_0_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5541, 8123, 10470, 11908, 11291, 10382, 8800, 6446 }, + { 3338, 5536, 7249, 8080, 7671, 6428, 5280, 3900 }, + { 1732, 3087, 3842, 4325, 4034, 2929, 2318, 1800 }, + { 744, 1217, 1559, 2215, 1957, 1352, 707, 322 }, + { 685, 1082, 1792, 2300, 1975, 1350, 738, 671 }, + { 1168, 2336, 3303, 3965, 3790, 3098, 2909, 2141 }, + { 3005, 4370, 5806, 6716, 6282, 5553, 4782, 3453 }, + { 4748, 6650, 7779, 9010, 9208, 8184, 6987, 5197 } +}; +static int16_t default_ncobmc_krnl_0_0_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 6026, 4784, 2400, 1250, 1002, 2371, 3320, 5285 }, + { 8638, 6094, 3257, 1498, 1297, 3145, 5252, 7625 }, + { 10859, 7249, 3868, 1871, 1813, 3569, 6577, 8858 }, + { 11432, 8123, 4216, 1786, 2477, 4370, 6669, 9366 }, + { 11894, 8466, 4870, 1917, 2479, 4656, 7057, 9383 }, + { 11109, 7432, 3924, 1288, 2018, 3946, 6660, 9877 }, + { 10138, 6548, 2830, 461, 2087, 3810, 6170, 9255 }, + { 8613, 5163, 1658, 279, 1694, 3082, 4807, 7897 } +}; +static int16_t default_ncobmc_krnl_0_0_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { -833, -80, 2193, 2907, 2623, 1359, 298, -383 }, + { 705, 2300, 5090, 6649, 6024, 4820, 3020, 1892 }, + { 2189, 4625, 7990, 10015, 9679, 8539, 6284, 4464 }, + { 3445, 6356, 10371, 12660, 11773, 10205, 8287, 5828 }, + { 2664, 6149, 9483, 12064, 11681, 10156, 7908, 5409 }, + { 2040, 4690, 8405, 10631, 9862, 8396, 5711, 2909 }, + { 626, 2993, 6387, 8212, 7123, 5840, 3877, 1788 }, + { -402, 1431, 4636, 5850, 4461, 3246, 1964, 122 } +}; +static int16_t default_ncobmc_krnl_0_1_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 1465, 553, -76, 10, 635, 756, 1843, 3144 }, + { 687, 117, -404, -300, 238, 280, 696, 1415 }, + { 49, -38, -224, -241, -135, -209, -237, 382 }, + { 48, 37, -266, -273, -235, -137, -208, -94 }, + { 555, -3, -132, -172, -98, 93, 347, 313 }, + { 887, 256, -266, -307, 304, 222, -98, 82 }, + { 1701, 816, 454, 501, 119, 230, 450, 551 }, + { 2732, 1502, 1174, 540, 323, 709, 1002, 936 } +}; +static int16_t default_ncobmc_krnl_0_1_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 7707, 10467, 11036, 10942, 10165, 9420, 8728, 5835 }, + { 3167, 5146, 5854, 5771, 4914, 4684, 4357, 3154 }, + { 900, 1646, 2412, 2014, 1974, 1986, 1776, 1005 }, + { -198, -179, 488, 737, 866, 784, 828, 236 }, + { -469, 32, 402, 574, 738, 495, 242, -187 }, + { 186, 1078, 1378, 1480, 1226, 1506, 1656, 745 }, + { 1531, 2525, 3139, 3367, 3535, 3519, 3095, 2171 }, + { 3152, 5453, 6176, 7089, 7310, 6879, 6483, 4916 } +}; +static int16_t default_ncobmc_krnl_0_1_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 7378, 3775, 1232, 453, 133, 936, 1688, 4950 }, + { 10336, 5944, 2400, 1175, 168, 954, 2894, 6436 }, + { 11176, 6145, 2051, 829, 543, 1193, 3403, 6517 }, + { 10387, 6062, 2036, 646, 507, 1077, 2998, 6029 }, + { 10768, 6277, 2226, 677, 321, 982, 2845, 6378 }, + { 10072, 5808, 1937, 873, 372, 1396, 3498, 7298 }, + { 8951, 4724, 1216, 104, 656, 1830, 3722, 7558 }, + { 7447, 3372, 468, -135, 99, 1177, 2980, 7260 } +}; +static int16_t default_ncobmc_krnl_0_1_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { -229, 1545, 4135, 4921, 5405, 5226, 4081, 2418 }, + { 2120, 5121, 8485, 9692, 11018, 10406, 8380, 5338 }, + { 4205, 8593, 12099, 13717, 13936, 13366, 11402, 8436 }, + { 6068, 10382, 14047, 15190, 15155, 14577, 12684, 10145 }, + { 5458, 10012, 13836, 15243, 15361, 14752, 12876, 9818 }, + { 5153, 9162, 13256, 14256, 14385, 13170, 11245, 8186 }, + { 4140, 8257, 11521, 12362, 12028, 10762, 9062, 6053 }, + { 2966, 5975, 8490, 8807, 8561, 7529, 5836, 3204 } +}; +static int16_t default_ncobmc_krnl_1_0_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 4414, 2642, 2518, 1763, 1089, 644, 355, 254, -234, 454, 399, 228, 525, 785, + 558, 919 }, + { 2989, 3035, 2685, 1476, 1872, 768, 820, -309, -107, 273, 87, 286, 499, 638, + 929, 1025 }, + { 1779, 1672, 1713, 645, 953, 151, 617, 79, -91, 185, 18, 307, 794, 681, 484, + 521 }, + { 1429, 1571, 1893, 1493, 949, 288, -232, -248, -152, 179, -50, 74, 107, 329, + 539, 822 }, + { 1444, 852, 1022, 688, 850, 205, 135, -629, 334, 96, 106, 337, 259, 300, 150, + 680 }, + { 962, 367, 329, 921, 591, -79, 146, 201, 296, 179, -190, 143, 46, -107, 215, + 853 }, + { 915, 865, 463, 169, 498, -390, 12, 202, 225, 490, 410, 483, 52, 99, 293, + 569 }, + { 728, -135, 241, 383, 288, -69, 33, 421, 523, 506, 376, 58, 143, -4, 151, + 218 }, + { 337, 65, 255, 282, 173, 267, 237, 15, 38, 114, 253, 110, 32, 227, 92, -48 }, + { 317, 115, 295, 231, 380, 435, 331, -97, 392, 393, 51, 59, 276, 41, -33, + 46 }, + { 31, -14, 86, 250, -36, -214, 210, -79, -117, 401, 193, 440, 171, 200, 8, + 112 }, + { 46, 19, 165, -6, 75, 180, 266, -98, 76, 276, 6, 29, 230, -49, 177, 168 }, + { 104, -243, -121, 295, -8, 180, 16, -44, 232, 315, 176, 10, 0, -95, -154, + 141 }, + { 248, 201, 361, 430, -20, -45, 209, -44, 222, 540, 527, 297, 240, 625, 531, + 409 }, + { 91, 37, 193, 177, 233, 210, -299, 120, 327, 214, 293, 189, 86, 123, 206, + 356 }, + { 501, 779, 295, 199, 148, 81, -31, 70, 211, 309, 300, 110, 227, 30, 242, + 261 } +}; +static int16_t default_ncobmc_krnl_1_0_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 6603, 7905, 7762, 8159, 8426, 10334, 10792, 10984, 12097, 10534, 11216, + 10624, 9514, 8715, 8672, 8846 }, + { 5897, 6238, 6272, 7323, 7162, 8091, 9465, 9845, 9929, 9747, 10562, 10737, + 9059, 7651, 7330, 7314 }, + { 5572, 6017, 5568, 7112, 6617, 6501, 7334, 8494, 8900, 8826, 9852, 8034, + 6956, 7691, 7513, 6106 }, + { 4564, 3877, 4682, 4586, 5135, 5795, 7968, 7859, 7720, 6548, 6306, 5639, + 6357, 6514, 6493, 5609 }, + { 4142, 4154, 3332, 4193, 3873, 4977, 4685, 5787, 5707, 5300, 5854, 4720, + 5452, 5642, 4810, 4250 }, + { 2993, 3176, 3012, 2637, 2664, 4336, 4207, 3687, 4627, 4487, 4847, 4120, + 4079, 3931, 3730, 3205 }, + { 2479, 2268, 1858, 1737, 2266, 2806, 2919, 3017, 3231, 2964, 3181, 3423, + 3096, 3025, 2684, 2353 }, + { 1969, 2001, 1997, 1959, 1323, 1565, 1963, 1351, 1957, 1711, 2093, 2057, + 1762, 1926, 1118, 1367 }, + { 1473, 816, 655, 1628, 1252, 1764, 1723, 1675, 2559, 3029, 1951, 2160, 2305, + 2299, 1688, 1048 }, + { 3073, 1667, 1324, 1360, 1562, 1774, 2154, 2740, 3281, 3434, 3258, 4095, + 2823, 2443, 2894, 2449 }, + { 3813, 2830, 3352, 2125, 2627, 2974, 3847, 3720, 4592, 4846, 4787, 5066, + 4598, 4229, 4032, 3478 }, + { 3415, 2733, 3827, 3637, 3381, 3743, 3768, 4732, 5055, 5445, 5870, 5937, + 5734, 5980, 5010, 4954 }, + { 4878, 3604, 5532, 4558, 4210, 4880, 4847, 5771, 5136, 6486, 7096, 6426, + 5765, 6824, 6094, 5753 }, + { 6076, 5817, 5318, 5268, 5784, 5482, 6453, 6582, 6803, 7077, 8113, 8173, + 8329, 7653, 6448, 6476 }, + { 7549, 5758, 5554, 6383, 7113, 7664, 7123, 6712, 8539, 8997, 9047, 8794, + 8700, 8760, 7600, 7995 }, + { 7698, 7133, 7048, 7498, 7821, 8401, 9152, 8647, 8934, 8874, 8595, 8789, + 8828, 8766, 9019, 8783 } +}; +static int16_t default_ncobmc_krnl_1_0_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5573, 5972, 5705, 5033, 5738, 3189, 2009, 1476, 2057, 2178, 1869, 2927, + 3305, 4036, 4017, 5328 }, + { 7539, 7568, 7302, 5564, 4410, 3954, 2153, 2693, 622, 1831, 1753, 1636, 3552, + 4374, 4319, 6015 }, + { 8753, 7544, 6620, 5710, 6142, 5819, 2731, 2898, 1702, 1487, 2249, 1688, + 4110, 4483, 5108, 5621 }, + { 9273, 7922, 6245, 6310, 6442, 5272, 3068, 2649, 1599, 2693, 3219, 4501, + 4588, 4310, 5647, 6894 }, + { 9697, 8245, 7267, 6551, 5199, 4626, 3466, 3256, 2099, 3125, 3608, 4297, + 3944, 5468, 6056, 7545 }, + { 8831, 8583, 7466, 6937, 6056, 5482, 3407, 3324, 1802, 3128, 3078, 4560, + 4560, 5901, 6131, 7612 }, + { 9556, 7457, 6602, 7342, 5370, 4431, 3573, 3339, 1668, 3172, 3779, 4564, + 5744, 7244, 8522, 8407 }, + { 10238, 8809, 7064, 6643, 4885, 4246, 2737, 2684, 2501, 3443, 3761, 6174, + 5891, 6882, 7585, 8821 }, + { 10151, 10001, 8289, 6859, 6054, 4903, 3809, 3540, 2644, 3424, 3542, 4649, + 5389, 5384, 6733, 8360 }, + { 9635, 9516, 7609, 7438, 6181, 4529, 4140, 3439, 2568, 3338, 3789, 5195, + 5510, 6181, 7566, 8512 }, + { 9988, 8848, 6807, 6731, 6139, 5355, 3797, 4097, 3364, 3319, 4230, 5136, + 5581, 6125, 7748, 8229 }, + { 10252, 9244, 7204, 7260, 6478, 6040, 4659, 3920, 2869, 3263, 4068, 5475, + 5714, 7183, 7153, 8318 }, + { 9682, 9366, 7096, 6059, 6036, 4463, 3898, 3477, 2065, 2704, 4434, 5167, + 5502, 6743, 8002, 7443 }, + { 9252, 8211, 6399, 6747, 6498, 5626, 4016, 3880, 2172, 2557, 3576, 4270, + 4968, 5115, 6840, 7550 }, + { 8753, 8157, 7097, 6500, 5779, 5174, 4190, 2645, 2380, 3239, 4155, 5263, + 5437, 5337, 5663, 6667 }, + { 9680, 7710, 6921, 5657, 4863, 3990, 3485, 2172, 2620, 3003, 3328, 4112, + 4806, 6020, 6833, 7212 } +}; +static int16_t default_ncobmc_krnl_1_0_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { -219, -121, 416, 1445, 1150, 2238, 3251, 3695, 2496, 3247, 2925, 2639, 3064, + 2869, 3167, 1320 }, + { -68, -450, 130, 2039, 2952, 3584, 3966, 4171, 5961, 4555, 3995, 3732, 3281, + 3731, 3827, 2052 }, + { 262, 1161, 2497, 2934, 2690, 3939, 5735, 4938, 5906, 5924, 4296, 6388, 4553, + 3551, 3297, 4164 }, + { 1091, 3025, 3566, 4005, 3874, 5040, 5600, 6151, 7241, 6990, 6924, 6186, + 5356, 5256, 3726, 3083 }, + { 1079, 3140, 4769, 4958, 6480, 6589, 8111, 7988, 8255, 7879, 6838, 7052, + 6751, 5005, 5393, 3931 }, + { 3566, 4255, 5572, 5909, 7098, 6653, 8641, 9199, 9689, 8617, 8673, 7591, + 7733, 6676, 6324, 4737 }, + { 3411, 5802, 7481, 7149, 8259, 9553, 9900, 9854, 11285, 9779, 9040, 7939, + 7515, 6037, 4902, 5075 }, + { 3417, 5718, 7095, 7425, 9913, 10666, 11679, 11951, 11429, 10749, 10173, + 8116, 8610, 7605, 7548, 5992 }, + { 4408, 5515, 7201, 7627, 8922, 9470, 10636, 11166, 11159, 9844, 10673, 9502, + 8693, 8503, 7905, 7046 }, + { 3340, 5097, 7171, 7366, 8273, 9660, 9784, 10332, 10155, 9232, 9301, 7056, + 7798, 7746, 5981, 5402 }, + { 2531, 4732, 6148, 7284, 7672, 8287, 8551, 8672, 8567, 7846, 7199, 5757, + 6057, 5863, 4613, 4578 }, + { 2646, 4394, 5195, 5511, 6471, 6443, 7713, 7854, 8408, 7427, 6461, 4968, + 4731, 3294, 4066, 2960 }, + { 1692, 3664, 3881, 5480, 6162, 6871, 7635, 7198, 8963, 6891, 4694, 4801, + 5141, 2932, 2459, 3060 }, + { 769, 2144, 4310, 3945, 4125, 5329, 5712, 5975, 7200, 6220, 4179, 3662, 2868, + 3007, 2579, 1958 }, + { -45, 2434, 3549, 3335, 3273, 3357, 5394, 6931, 5159, 3956, 2912, 2164, 2187, + 2187, 2935, 1388 }, + { -1514, 786, 2135, 3045, 3561, 3922, 3800, 5515, 4650, 4225, 4169, 3387, + 2539, 1590, 317, 161 } +}; +static int16_t default_ncobmc_krnl_1_1_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 2375, 1912, 1469, 213, 933, -507, -173, -369, -333, 187, -128, 427, 999, + 1166, 1515, 2728 }, + { 1857, 1085, 817, 454, 598, 479, 53, -218, -611, 240, 76, 31, 284, 1347, + 1738, 1317 }, + { 1911, 531, 453, 89, 639, -361, -331, -605, -162, 63, -154, 259, 446, 390, + 708, 1113 }, + { 818, 1304, 871, 665, 1006, -114, -405, -407, 331, 203, 304, 506, 476, 1053, + 1155, 879 }, + { 1054, 874, 714, -162, 624, -144, -306, -541, 30, -281, 296, 812, 418, 858, + 755, 252 }, + { 967, 388, 354, 878, 31, -691, -244, -307, 425, 281, 0, -50, 110, -107, 279, + 255 }, + { 152, -53, 156, 266, 192, -864, -236, -110, 397, 484, -129, 14, 22, 44, -90, + 278 }, + { 203, -54, 103, -142, -598, -741, -546, -26, 545, 253, -43, -234, -391, -504, + -158, -143 }, + { 387, 275, 136, 69, -289, -9, -210, -364, 39, 3, 4, 61, -66, -102, -94, + -215 }, + { 195, 213, 433, 158, 128, -131, -203, -266, -132, -285, -301, -367, -315, + -249, -144, -9 }, + { 600, 145, 418, 277, 156, -118, 85, -20, 119, 260, 41, 72, -85, 316, -97, + -41 }, + { 682, 610, 356, 880, 527, 272, 90, 92, -124, 314, -204, -339, -590, -384, + -248, -192 }, + { 999, 423, 208, 752, 623, 409, 91, -57, -3, -124, 148, 255, -7, 112, -128, + -144 }, + { 1007, 710, 609, 766, 264, -163, 324, 291, 219, -61, 24, 507, 74, 109, 127, + 629 }, + { 2211, 878, 853, 462, 86, 203, -71, 122, -36, 131, 308, 267, 210, 369, 50, + -96 }, + { 1810, 1630, 1123, 645, 610, 217, -93, -37, -220, -341, -250, -110, 135, 0, + 112, 93 } +}; +static int16_t default_ncobmc_krnl_1_1_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5824, 7106, 8063, 8929, 8632, 9731, 10164, 11047, 11088, 10239, 10606, 8987, + 8411, 7117, 6115, 5322 }, + { 4980, 6239, 7135, 7245, 7418, 8526, 9440, 9438, 8119, 8336, 7993, 8057, + 6686, 5210, 4193, 4841 }, + { 2436, 4500, 5019, 5908, 5578, 7270, 7391, 7974, 7281, 6871, 6705, 6327, + 4867, 4521, 4286, 3605 }, + { 2298, 3501, 4714, 4692, 4835, 5278, 5830, 4968, 4435, 4824, 4373, 4085, + 3825, 2657, 2539, 2557 }, + { 1643, 2741, 2604, 2664, 1877, 3334, 2995, 3162, 3367, 3104, 3356, 2827, + 3577, 2359, 1755, 2140 }, + { 742, 1397, 1315, 1332, 1864, 3032, 2472, 2253, 1692, 2071, 2260, 2426, 1951, + 1610, 1189, 1275 }, + { 482, 869, 598, 288, 769, 1490, 1284, 1692, 883, 1061, 1259, 1239, 1118, 585, + 219, 571 }, + { 178, 278, 580, 915, 717, 873, 1012, 721, 52, 348, 624, 540, 691, 102, -108, + 383 }, + { -718, -648, -223, -520, -1000, -754, -688, -639, -528, -414, -440, -365, + -268, -546, -672, -332 }, + { -256, -226, -395, -158, -311, -325, -66, 87, 533, 705, 261, 344, 484, 692, + 155, 507 }, + { 204, 448, 131, -571, 889, 712, 626, 349, 261, 578, 240, 1012, 849, 900, 889, + 977 }, + { 132, 1395, 1847, 1181, 845, 1203, 1920, 2068, 2141, 2071, 1834, 2191, 2130, + 2522, 1537, 1326 }, + { 140, 1278, 2440, 2063, 1581, 2204, 2781, 2532, 1677, 2426, 2538, 2210, 1568, + 2564, 2394, 1945 }, + { 2943, 3776, 3833, 3310, 3900, 4118, 4161, 3571, 4059, 4143, 4145, 4273, + 4034, 3940, 3720, 2418 }, + { 3437, 3906, 4106, 4294, 5303, 5257, 4956, 4027, 5935, 5373, 4102, 4853, + 5331, 5251, 3964, 4748 }, + { 5493, 5799, 5966, 6535, 7015, 7397, 8011, 6526, 5832, 6257, 6247, 7097, + 6499, 6272, 5963, 5593 } +}; +static int16_t default_ncobmc_krnl_1_1_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 6049, 4906, 3617, 2960, 2187, 1950, 556, 497, 688, 355, 503, 1054, 1170, + 1641, 2343, 4226 }, + { 7459, 6408, 4326, 3635, 2042, 1565, 492, 572, 746, 338, 719, 797, 2540, + 2283, 2301, 4089 }, + { 8025, 6914, 5072, 4249, 2793, 1910, 430, 1137, -150, 451, 1061, 872, 1515, + 2805, 3823, 4550 }, + { 9615, 6936, 5226, 3388, 2611, 2061, 801, 1003, -537, 72, 736, 1347, 2215, + 3509, 4262, 5097 }, + { 9677, 6521, 5633, 5223, 2996, 2449, 1300, 1136, 160, 918, 488, 801, 2306, + 3781, 4818, 6441 }, + { 9988, 7509, 6019, 4950, 3376, 2777, 1427, 1395, -118, 310, 393, 1626, 3387, + 3649, 4737, 7431 }, + { 10542, 7745, 5192, 4494, 1637, 1960, 1212, 1056, -309, 383, 1166, 2107, + 4048, 4030, 7206, 7851 }, + { 9350, 7480, 4343, 3589, 1748, 1687, 1057, 898, 592, 776, 680, 1960, 3804, + 4598, 5688, 7834 }, + { 8769, 7236, 5518, 4182, 2776, 2412, 915, 1370, 789, 561, 520, 1146, 3139, + 4730, 5542, 7514 }, + { 9580, 7116, 5910, 4623, 3085, 2450, 1703, 745, 419, 600, 1077, 1208, 3256, + 4261, 5611, 6709 }, + { 9725, 7053, 5594, 4217, 2573, 1834, 562, 512, 496, 356, 883, 1360, 3323, + 4866, 5632, 7594 }, + { 10110, 7367, 5622, 3858, 3720, 2398, 1075, 1687, 616, 461, 1082, 1786, 2570, + 4242, 5731, 8319 }, + { 9416, 7582, 6054, 3915, 3283, 2035, 1335, 1138, 317, 92, 253, 483, 1715, + 3597, 5613, 8103 }, + { 8693, 6881, 4626, 3505, 2663, 1949, 751, 792, -343, 55, 303, 460, 2027, + 3584, 6230, 8704 }, + { 7368, 6609, 5087, 3861, 2790, 1746, 1487, 518, 497, -165, 439, 904, 2514, + 3735, 6082, 6914 }, + { 7004, 5321, 3472, 2621, 1221, 999, 1172, 377, 850, 864, 866, 647, 2574, + 3977, 6416, 7777 } +}; +static int16_t default_ncobmc_krnl_1_1_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 2085, 2421, 3201, 4245, 4593, 5179, 5800, 5172, 4904, 5558, 5357, 5889, + 5769, 6415, 6377, 4080 }, + { 2031, 2607, 4062, 5018, 6279, 5766, 6373, 6562, 8085, 7434, 7557, 7449, + 6834, 7509, 8119, 6106 }, + { 3960, 4394, 5800, 6108, 7339, 7531, 8876, 7849, 9371, 8973, 8753, 8896, + 9525, 8636, 7540, 7092 }, + { 3599, 4610, 5527, 7597, 7898, 9121, 10115, 10783, 12123, 11248, 10928, + 10406, 9827, 9129, 8401, 7814 }, + { 3953, 6203, 7382, 8619, 10852, 10722, 12369, 12580, 12777, 12605, 12198, + 11899, 10047, 9350, 9018, 7521 }, + { 4615, 7038, 8644, 9190, 11073, 11216, 12685, 13003, 14345, 13679, 13689, + 12344, 10902, 11188, 10148, 7399 }, + { 5141, 7775, 10402, 11309, 13751, 13759, 14094, 13720, 15371, 14418, 14061, + 12988, 11166, 11692, 9019, 7665 }, + { 6591, 8644, 11320, 11985, 14476, 14526, 14816, 14745, 15159, 14966, 15071, + 14071, 12238, 12154, 10931, 8266 }, + { 7897, 9483, 10910, 12615, 14865, 14701, 16336, 15966, 16036, 16200, 16266, + 15506, 13546, 12270, 11580, 9377 }, + { 6808, 9239, 10394, 11719, 13438, 14348, 14923, 15789, 15519, 15341, 15316, + 15166, 12927, 11656, 10736, 9138 }, + { 5796, 8696, 10198, 12417, 12722, 13926, 15077, 15506, 15468, 15155, 15184, + 13906, 12262, 10270, 9924, 7815 }, + { 5386, 6960, 8500, 10429, 11262, 12474, 13263, 12505, 13713, 13502, 13632, + 12702, 12233, 9964, 9329, 6889 }, + { 5768, 7049, 7630, 9626, 10868, 11697, 12128, 12718, 14351, 13953, 13402, + 13389, 13063, 10072, 8470, 6445 }, + { 3665, 4962, 7272, 8760, 9507, 10431, 11095, 11676, 12400, 12216, 11874, + 11099, 10214, 8725, 6279, 4598 }, + { 3293, 4948, 6288, 7711, 8156, 9140, 9976, 11683, 9946, 11003, 11496, 10325, + 8287, 6988, 6251, 4796 }, + { 2010, 3599, 5789, 6548, 7490, 7725, 7264, 9488, 9893, 9573, 9487, 8725, + 7145, 6110, 3858, 2891 } +}; +static int16_t default_ncobmc_krnl_2_0_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 3437, 3490, 4578, 2066, 1672, 1354, 1502, 2345, 2273, -600, 52, + 272, 484, 2214, -1553, -197, 165, 278, 306, 384, 73, 415, + -213, 357, 497, 288, 714, 6, -82, -118, 170, 181 }, + { 2505, 3488, 306, 3011, 2631, 181, 636, 2608, 1663, -964, 594, + -1455, 1057, -1198, -1647, 187, 404, 412, 177, -32, 269, -24, + 148, 233, -290, -359, -178, -164, -362, -19, -408, 106 }, + { 2588, 3528, 3391, 3134, 1812, 2387, -34, -298, -13, -955, 40, + -475, 1243, 283, -247, -484, 200, -46, 36, -642, -386, -438, + 34, 295, 93, -528, -13, 412, -8, 41, -457, 28 }, + { 796, 3353, 435, 3473, 458, 1851, 519, 1061, 259, 942, 416, + 195, 390, -151, -1141, -710, 716, -401, 33, -771, -759, -336, + 88, -124, -139, -372, -223, -505, -164, -100, -512, -465 }, + { 3233, 3990, 2698, -107, -448, 297, 331, -13, -530, -383, -464, + -1530, 715, -899, -1978, -879, 43, 93, -77, -138, -425, -97, + -167, -348, -460, -95, 280, -45, 235, 172, -357, -200 }, + { 868, 4162, 1417, 487, -1446, -355, 392, -159, 202, 704, -814, + -3095, -1052, -1482, -745, -1403, -199, -27, -38, -387, -208, 20, + -64, -130, -265, 81, -20, 238, 49, 121, -137, 495 }, + { 2774, 3478, 2072, 1229, 819, 1359, 106, -222, -1445, -1559, 924, + -98, 44, -347, 455, -862, -318, -288, -31, 281, -144, -107, + 148, 103, -171, -239, -134, 25, 125, 108, -142, -129 }, + { 610, 990, -703, 1003, 437, -275, -179, -233, -2041, -445, -1145, + -488, 335, -2684, -1339, -294, -176, -195, -36, -65, -276, 10, + -111, -277, -134, -222, -51, 31, -369, -279, -105, 69 }, + { 420, 2773, 375, -372, 489, 989, -900, 1075, 182, 119, -529, + -470, -504, -2225, 225, 101, -264, -417, -253, -459, -317, -205, + -528, -7, -43, -268, -116, -857, -608, -208, -216, 220 }, + { 2969, 1927, -314, -476, 402, -637, -838, 835, 1229, 1200, 135, + -299, -324, -2136, 340, -1563, -309, -98, -408, -137, -154, 668, + 101, -90, 245, 112, -51, -37, -525, -254, -244, -126 }, + { 1404, -258, 2333, 2019, 309, -29, -2468, 18, -494, 70, -260, + 245, 515, -1984, -1759, -1003, -504, 104, 472, 197, -38, 265, + 378, 6, 50, -183, -204, -17, -383, -318, -396, 142 }, + { 807, 637, 712, 1237, -971, -176, -1160, -210, -2072, -782, -959, + -372, -590, -1159, -1017, -889, -750, -399, -98, -15, 2, -172, + -48, -488, -628, -12, -25, 136, 229, -200, -212, -472 }, + { -1464, 333, -1978, -1394, -281, -1820, -124, 385, 97, -297, -1497, + -3, -916, -660, -949, -504, 117, 11, 86, 88, 2, 219, + 333, -120, -224, 71, 237, -507, 13, -381, -207, -113 }, + { 1100, -717, -1827, -1908, -1030, -1562, 404, 794, 4, -682, -1306, + -612, -1197, 8, -131, 525, 159, -345, -91, 9, -222, -482, + -69, 482, 593, -32, -239, -408, -522, -692, -126, 712 }, + { -798, -735, -174, -1695, 819, -737, -15, -426, -750, 876, 34, + -622, 448, -71, -950, -2094, 74, 170, 18, 57, 156, 443, + -85, -374, -416, -537, -348, -126, 62, -381, 399, -53 }, + { -552, -1352, 536, -1, -322, -1094, -428, 309, -142, -752, 354, + 900, 473, -137, -1263, -370, -731, -864, -30, -101, 354, -321, + -523, 377, 9, -415, -87, -145, -154, -286, 100, 23 }, + { 44, 607, 316, -268, -246, -497, 267, 154, 160, 717, 324, + 240, -130, -218, -107, -252, -64, 4, 113, -57, -162, 123, + -5, 143, -312, -66, -230, -33, -57, 60, 153, 85 }, + { 158, 14, -307, -240, -85, -416, 304, -402, -461, -221, 193, + -123, 384, -142, 48, -77, -378, 36, -56, 20, 2, -240, + -88, -1, -185, 87, 6, 94, -22, 82, 191, 194 }, + { 417, 259, -85, -170, -45, -151, -402, 136, 28, -40, 101, + 224, -337, 97, 98, 51, -401, 95, -77, -153, 357, -99, + -473, -142, -289, -80, -349, -76, -87, 97, 40, 198 }, + { -236, 62, -104, -8, 98, 68, 128, 116, 47, 54, -121, + -150, -20, -120, 196, -80, 37, 290, 231, 247, 131, -113, + -126, -87, 65, 250, 260, 102, -68, 234, 76, -87 }, + { 245, 486, 38, -10, -135, 106, 217, -187, -200, 96, 20, + 117, -40, -97, 68, -139, 276, 8, -55, -53, -187, -20, + -41, 1, -145, -246, -106, -45, -145, -353, 185, -35 }, + { 448, -172, -496, -63, -84, -106, 151, 9, -143, -180, -38, + -276, -223, 269, 100, 38, -236, -66, 124, -59, 475, -78, + -407, -20, -119, -19, 162, -4, -226, 101, 247, 78 }, + { -348, -156, -324, -260, -173, 0, -41, 63, 235, -114, 109, + -362, -96, 279, -277, 36, 394, 394, 240, 30, -88, 209, + 29, 176, 59, -20, -244, 50, -104, 192, -157, 48 }, + { -376, -176, 269, -426, -159, -108, -18, -163, 93, 130, -222, + -40, 539, 176, 164, -62, -709, -354, 502, 664, 243, -414, + -51, 192, 33, 54, -10, -57, -141, -3, 144, 71 }, + { -137, -636, 627, 6, -129, -159, -45, -150, -15, 402, 207, + 20, 202, 1, -203, 88, 183, 62, -76, 120, 418, -196, + -104, -154, -433, -338, -73, 1, -79, -14, -200, 84 }, + { 184, -334, 175, 114, -274, -60, -429, 176, 36, 373, 468, + 134, 110, -11, -201, -94, 352, 109, 115, 91, 187, -83, + 21, 0, -154, -180, 288, 0, -61, -197, -246, 42 }, + { -143, 26, 190, -110, -335, -385, -357, 27, 103, -66, -96, + -189, -337, -150, 129, -104, -176, -418, -216, -118, 28, 126, + -112, -130, 110, 17, 141, 111, -82, 238, 22, -50 }, + { 104, -95, 48, -239, -40, -148, -327, 244, 323, -102, 244, + 151, 113, -150, -74, 223, -81, -328, -178, 140, -233, -165, + 182, 514, 216, -129, -8, 141, -81, 451, -110, -71 }, + { -116, 84, -228, 177, 318, 62, 134, -3, 239, 14, 338, + 278, -439, -254, 3, -82, -210, -62, -236, -124, 5, -60, + 112, -18, -115, -31, 5, -65, 278, 4, -19, -130 }, + { 236, -64, -147, -519, 147, -27, 71, -567, -133, 24, -199, + 229, -107, 126, -141, -148, -35, -34, 68, 230, 8, 72, + 40, -148, 203, 97, 84, 107, 32, 17, -58, -18 }, + { -43, -408, -101, 120, 118, 168, -170, -233, -323, -120, -339, + 80, -294, -151, 85, 52, -420, 79, -162, -233, -237, -47, + -131, -53, -199, 14, 85, -80, 93, -150, -15, 318 }, + { -106, 107, -6, 189, 53, -109, 22, -474, -335, -102, -279, + -321, -66, 186, -65, -13, 61, 167, 43, -159, -57, -13, + 37, -125, -137, 132, 161, -156, -27, -276, -89, 15 } +}; +static int16_t default_ncobmc_krnl_2_0_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5401, 5987, 4279, 6550, 4858, 4986, 5733, 7172, 8194, 7631, 7549, + 6971, 9288, 7485, 8583, 9244, 12058, 11530, 10461, 8453, 8304, 11724, + 8999, 9457, 5018, 6922, 8375, 7860, 7915, 6921, 7703, 8963 }, + { 2308, 2670, 5018, 5298, 3883, 6449, 4267, 4119, 9252, 10082, 7844, + 7414, 9050, 9261, 8739, 7808, 10974, 10279, 8627, 8840, 9203, 9406, + 9360, 10574, 10156, 7673, 6238, 8876, 6800, 6423, 6931, 8589 }, + { 6608, 4325, 3372, 5227, 6182, 3670, 5595, 5758, 8575, 8025, 8251, + 10711, 5449, 6965, 5443, 7178, 9099, 8842, 7132, 7830, 5795, 9882, + 8939, 8323, 7507, 7248, 8750, 6786, 6940, 4942, 7125, 6399 }, + { 3977, 3060, 4962, 7094, 7211, 6388, 6256, 3960, 7672, 7814, 7711, + 7237, 7088, 7232, 5716, 6040, 9565, 6643, 8113, 7841, 9849, 10144, + 8297, 7676, 6792, 8447, 7805, 5475, 5499, 4728, 5379, 7645 }, + { 4598, 4391, 3660, 6284, 6694, 8302, 5610, 5341, 7466, 6298, 6406, + 7734, 5743, 5155, 5257, 6958, 9035, 11566, 9636, 7825, 8147, 9427, + 6612, 5526, 7635, 7259, 7696, 7853, 5505, 6744, 9265, 5394 }, + { 5980, 2356, 2746, 5955, 4045, 4283, 5117, 3799, 5386, 5594, 7671, + 6984, 6232, 6028, 3101, 3391, 5757, 9530, 7408, 6206, 5512, 7867, + 5144, 8011, 6690, 6994, 4877, 5063, 6175, 5205, 1965, 859 }, + { 2619, 4096, 4225, 4712, 5637, 6418, 6649, 3904, 5463, 5102, 4785, + 4100, 5127, 3858, 3419, 5301, 6002, 7649, 8260, 6241, 4168, 4551, + 6153, 5016, 7113, 7845, 5201, 5455, 5069, 2335, 3311, 5194 }, + { 1278, 4942, 4441, 3456, 3791, 5620, 5275, 2243, 5080, 4619, 5834, + 4859, 4320, 5092, 1481, 846, 4969, 4835, 3646, 5940, 5736, 5862, + 3628, 5918, 5865, 4945, 4385, 4699, 4342, 5415, 8383, 4711 }, + { 3855, 1678, 2560, 4631, 2765, 1444, 1449, 1895, 4494, 5706, 4813, + 4882, 3532, 2264, 3222, 5444, 4097, 5236, 5036, 3713, 6547, 4371, + 5311, 2363, 5113, 6290, 3743, 5343, 5369, 2813, 2486, 1647 }, + { -651, 1098, 2116, 3495, 2289, 1836, 4507, 4057, 5225, 4553, 2631, + 2791, 2984, 3605, 3416, 3611, 4358, 4719, 3450, 4146, 3973, 3263, + 3826, 5881, 6402, 4584, 4396, 3689, 2020, 1960, 2100, 4304 }, + { -622, 1848, 379, 112, -1474, 1013, 6023, 260, 1035, 1984, 3811, + 2362, 1394, 2546, 3347, 2472, 1865, 755, 2251, 1139, 1933, 2252, + 1163, 3003, 4091, 4792, 3801, 3517, 4247, 3798, 5216, 4543 }, + { 1342, 2229, 1014, 1212, 260, 432, 1975, 99, 2798, 818, 2455, + 3858, 2231, 3773, 136, 857, 2171, 815, 1966, 1825, 1711, 964, + 2142, 2514, 5367, 3539, 3241, 3116, 3982, 3839, 3553, 3535 }, + { 1800, 27, 321, 111, 1003, 528, 254, 979, 2444, 2413, 3807, + 961, 1961, 1173, 2156, 3935, 259, 263, 1815, 1979, 1218, 2393, + 3738, 1109, 4444, 3726, 3647, 3428, 2966, 4602, 4903, 5851 }, + { 1340, 753, 317, 1318, 738, 1880, -500, -691, 1108, 38, 412, + 890, 494, 291, -131, 759, -111, 221, -95, 2575, 3099, 3223, + 3140, 3156, 3952, 1942, 2615, -2313, 2991, 6367, 5744, 4528 }, + { 752, 490, 1255, 2396, 14, 3819, 1319, 1239, 3491, 2464, 3243, + 3083, 392, 1273, 1712, -226, -931, -2130, 710, 864, 385, 265, + 1431, 1796, 3063, 3531, 3879, 3986, 3503, 4045, 2539, 3489 }, + { 1943, 170, 358, 1884, 2344, 1566, 92, 1721, 1381, 1115, 723, + 1670, 2294, 1497, 1697, 973, 1286, 2306, 381, 2582, 2551, 3852, + 2481, 3432, 2273, 3079, 2076, 3014, 3365, 3906, 2241, 2250 }, + { 1741, -705, 595, 956, 2038, 793, 1518, 148, -524, -881, -487, + 711, 720, 773, 431, 2181, -435, -841, -1106, -552, 434, -2007, + -41, -234, -960, -23, 394, -655, 792, 934, 1495, 1947 }, + { 2086, 1360, 97, 1352, -95, 1800, -729, -916, -152, 956, 196, + 1746, -1973, -690, 472, 1788, -28, 385, 781, 589, -320, 1167, + -484, 66, 1136, 1038, 1741, 888, 3056, 2114, 3495, 1297 }, + { 1900, 1373, 983, 3718, 1409, 2096, 932, -604, -1370, 1153, 109, + 58, 104, 2851, 602, -2071, 252, -888, 1428, 2724, 1344, 1567, + 563, 1902, 1370, 519, -294, 393, 1153, -1032, 2129, 335 }, + { 2652, 2620, 3178, 2344, 2466, 2241, 1145, -101, -635, 306, -1036, + 638, -2606, -1921, -1098, -328, -324, 2598, 1092, 1832, 493, 2507, + 1152, 1461, -796, 2126, -742, 1182, 2078, 1549, 2665, 2366 }, + { 1080, 798, 1934, 568, 1218, 3206, 155, 1844, 2313, 3509, 1090, + 650, 1166, 2515, 1846, 1025, 259, 720, 1587, 3010, 4955, 6457, + 2952, 2764, -396, 1937, 1563, 673, 828, 4062, 2711, 1548 }, + { 871, 657, 2761, 1756, 2349, 198, -1003, -1105, -1181, -69, 146, + 3201, -27, 1493, 13, 291, -2260, -468, 1178, 928, 2665, 3887, + 3140, 1334, 1969, 2687, 544, 3842, 2885, 733, 3419, 1963 }, + { 1491, 1698, 302, 2127, 1256, 907, 1607, 1833, 2061, -536, 988, + 4380, 2723, -195, 962, 1769, 2466, 1735, 2707, -369, -713, 1599, + 3031, 2924, 2023, 2045, 5259, 1733, 3517, 4274, 440, 412 }, + { 2163, 1, 167, 1755, 5694, 3272, 739, 4235, 6123, 3811, 4611, + 5800, 2424, 2409, 1458, 2152, 104, 115, 466, -998, -806, 2824, + 4473, 2511, 4878, 3258, 5014, 3559, 1003, 2074, -2091, 1403 }, + { 964, 1051, -1527, 1266, 3883, 2349, 1054, 1972, 1929, -249, 3796, + 2861, 1542, 449, 539, 1942, -16, 58, 2080, 56, 1106, 4248, + 580, 2540, 3095, 4536, 152, 354, 4067, -2246, 1505, 1981 }, + { 1081, 1440, 324, 736, 2839, 2597, 3712, 2282, 3717, 2483, 1247, + 4456, 3604, 3415, 2487, 3715, 2073, 2928, 2372, 828, -2700, 2054, + 4315, -125, 1777, 2211, 2992, 7336, 4216, 3571, 2657, 6780 }, + { 1997, 2104, 1255, 1942, 1335, 1450, 3567, 1447, 3812, 6083, 5233, + 4484, 3536, 3564, 3290, 4062, 2589, 2816, 3971, 4406, 3481, 2664, + 1245, 1759, 3353, 1036, 2054, 1299, 2263, 4010, 4171, 3972 }, + { 1519, 4826, -750, 988, 1338, 2999, 212, 3858, 5202, 5306, 5717, + 3066, 2629, 6461, 6043, 6637, 8388, 7252, 4890, 4161, -1056, 4615, + 2538, 5633, 3389, 6439, 2985, 7148, 5149, 4509, 8001, 8863 }, + { 1047, 876, 2713, 3913, 2232, 1084, 1702, 2626, 1983, 3744, 2044, + 3690, 2087, 4497, 2656, 5592, 6247, 4584, 4218, 6097, 6884, 6277, + 2412, 5097, 7400, 2789, 6089, 6157, 7247, 9712, 11393, 5627 }, + { 2876, 4288, 2443, 3081, 1569, 1823, 1050, 2325, 2558, 2591, 4223, + 6300, 4237, 4354, 4411, 7502, 4175, 3350, 4208, 1100, 6473, 6664, + 5460, 4207, 5297, 8047, 6850, 6496, 7866, 10375, 7455, 2868 }, + { 3282, 5838, 6486, 6479, 3474, 4665, 3790, 2882, 5116, 4457, 4649, + 4208, 4520, 7271, 4363, 7125, 8799, 6540, 10158, 5716, 6794, 5762, + 6462, 8561, 2742, 7002, 9454, 8451, 8560, 7973, 7759, 6679 }, + { 5957, 7221, 5126, 7057, 5824, 4274, 5374, 6023, 7549, 6239, 7666, + 6368, 4014, 5338, 7150, 9793, 10608, 9838, 6748, 9691, 5465, 4631, + 7964, 7692, 8173, 9362, 8989, 11677, 10282, 9960, 6666, 9276 } +}; +static int16_t default_ncobmc_krnl_2_0_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 7499, 5941, 5384, 4566, 4006, 3634, 2288, 4112, 2127, 3001, 2639, + 1927, 467, -1639, 1484, 1143, 66, -316, 626, 1721, 1208, 193, + 1591, 3903, 8472, 3945, 1882, 4378, 6453, 8972, 11867, 10110 }, + { 7919, 6226, 8601, 3825, 4644, 4380, 3957, 2964, 1316, 3586, 2268, + 2802, 2193, 1427, 1479, 1353, -55, 373, 271, 979, 526, 1827, + 2463, 1938, 3963, 4851, 5040, 4192, 3731, 4522, 8903, 6733 }, + { 6373, 4994, 6414, 4822, 4923, 4881, 4383, 6117, 3342, 5068, 2353, + 2370, 2231, 758, 1768, 1338, 742, 1498, 454, 1453, 1466, -213, + 177, 1223, 512, 5366, 2462, 4667, 5671, 5039, 6065, 6874 }, + { 9299, 8698, 12939, 6170, 7063, 3147, 3256, 3492, 2696, 4498, 3705, + 3176, 2797, 1099, 2852, 1331, 527, 1272, -388, 1619, 110, -406, + 390, 3801, 4468, 3193, 2944, 7284, 7144, 4560, 6320, 8073 }, + { 5937, 4572, 5212, 6678, 5291, 2561, 2752, 4892, 2713, 5203, 4202, + 1527, -470, 2424, 2850, 1217, 401, 587, 191, 1122, 1314, 1854, + 3860, 4579, 2455, 5427, 1614, 5037, 5073, 5074, 3101, 7734 }, + { 7035, 5229, 7515, 6523, 7587, 5653, 5311, 4945, 4097, 4237, 2836, + 2667, 1959, 4095, 1669, 1484, 57, 467, 1028, 642, 2843, 2782, + 3604, -825, 1592, 4305, 2202, 4432, 4683, 3867, 3520, 9281 }, + { 7248, 3787, 4243, 4710, 3288, 1975, 2766, 4057, 1506, 2644, 1436, + 818, 1150, 2159, 787, 920, 98, 137, 1065, 306, 3880, 537, + 3871, 1060, 3821, 3395, 2484, 3532, 4072, 3339, 2638, 3982 }, + { 8810, 5802, 5538, 4090, 3659, 3742, 3818, 6827, 6474, 4756, 4093, + 3735, 4063, 4586, -1945, 470, 328, -163, 958, 511, 2541, 3057, + 2972, 4349, 4754, 5115, 5847, 6843, 7299, 6652, 5891, 5655 }, + { 9091, 5007, 6438, 4749, 5610, 3664, 6151, 5188, 3686, 2005, 2670, + -245, 1788, 3724, 2626, 679, -52, -839, -145, 356, 3488, 1970, + 1988, 2126, 1099, 2578, 5401, 6965, 4908, 5526, 6748, 5968 }, + { 6412, 7516, 8029, 8748, 6742, 7509, 6552, 4078, 4300, 5066, 4786, + 3270, 4270, 3875, 2319, 4282, 1640, -843, -439, 427, 1587, 520, + -28, 2251, 3358, 3049, 4407, 7286, 8994, 7802, 5924, 6824 }, + { 8467, 6838, 3934, 2952, 7200, 5407, 4593, 5882, 3353, 3865, 1870, + 1535, 2130, 4121, 3527, 1799, -637, -937, 513, 247, 169, 607, + 2947, 3530, 3717, 6082, 9703, 6867, 2729, 6292, 3084, 4879 }, + { 9934, 8638, 7508, 6894, 7343, 5306, 6208, 6136, 5240, 7136, 3958, + 1811, 3171, 1064, 2246, 882, 1681, 727, 1694, 769, 1700, 1370, + 1901, 5812, 3852, 6468, 5875, 5416, 6007, 3348, 3600, 6661 }, + { 10978, 9383, 9741, 10746, 5208, 8469, 4608, 5824, 4424, 3460, 3841, + 4037, 3687, 1582, 3784, 988, 1974, 1292, 2272, 2128, 2210, 2888, + -967, 5864, 5568, 4693, 3796, 6361, 4816, 2697, 4559, 6437 }, + { 8329, 9809, 8672, 9375, 7503, 5775, 3454, 4596, 5093, 5033, 4021, + 2860, 2833, 2782, 3056, -617, 1644, 1759, 2434, 2570, 3312, 3807, + 3518, 3521, 1126, 2830, 3378, 4432, 3261, 5211, 4073, 10050 }, + { 9992, 8148, 7951, 7194, 5624, 5032, 3296, 2981, 5388, 3910, 2274, + 1436, 1425, 1053, 2111, 2806, 1606, 1446, 1681, -211, 1877, 1541, + 1700, 2736, 2088, 2551, 1045, 2977, 2632, 1719, 4896, 5378 }, + { 9403, 8846, 8061, 7478, 5269, 6655, 6312, 4110, 3529, 5802, 3108, + 3246, 1943, 909, 2436, 1678, 1513, 1243, 797, 213, 3888, 4015, + 2775, 2082, 2395, 2792, 2136, 2475, 1657, 2156, 1878, 2587 }, + { 9499, 9075, 5426, 6962, 8206, 8057, 3968, 5184, 2759, 2277, 2744, + 3531, 2518, 367, 1075, 2118, 900, 901, 2964, 3641, 5282, 2186, + 2416, 2312, 2366, 2149, 1024, 1912, 1119, 220, 401, 727 }, + { 7615, 8271, 8148, 7699, 7063, 7658, 5473, 7497, 7302, 5841, 4165, + 3092, 734, 2215, 3316, 2226, 1197, 1236, 2996, 5007, 2872, 3460, + 2371, 1898, 1917, 1442, 853, 1412, 700, 620, 317, 1237 }, + { 8331, 8530, 8633, 7185, 6863, 9076, 5328, 5045, 5378, 4004, 4089, + 1469, 1341, -333, 2689, 1982, 115, -1158, 383, 1548, 1118, 2864, + 3154, 1803, 2079, 1676, 1450, 1165, 967, 795, 136, 1184 }, + { 8763, 9102, 6716, 8961, 5448, 6366, 3438, 5722, 5374, 5651, 5422, + 1728, 1751, 2444, 1024, 1118, 424, 2288, 3655, 2719, 2254, 1313, + 3476, 1983, 1975, 1502, 1172, 2333, 937, 594, 122, 149 }, + { 8146, 9931, 7629, 8882, 6328, 7491, 5646, 5494, 7238, 7355, 4478, + 2019, 2646, 3486, 4193, 1121, 562, 1823, 2787, 1720, 2228, 3627, + 4470, 3351, 2439, 2214, 1926, 2118, 1771, 767, 353, 1062 }, + { 10816, 9814, 10917, 7424, 8207, 9717, 8537, 8728, 7356, 7376, 7246, + 3223, 1981, 277, 1282, 951, 515, 222, 1392, 789, 4372, 2112, + 4083, 2706, 3234, 2414, 2655, 1407, 702, 1369, 121, 676 }, + { 11362, 10078, 7520, 7828, 10705, 7300, 7358, 6559, 8337, 7569, 5067, + 3465, 2417, 1956, 2165, 759, -106, -1282, 1822, 3225, 4767, 5619, + 4119, 3383, 3877, 2702, 2410, 2459, 1441, 1392, 945, 216 }, + { 10112, 8115, 3762, 5107, 7443, 7676, 7498, 7380, 6235, 7523, 6246, + 3574, 2749, 3853, 303, 1558, 1896, 1107, 462, 2172, 2388, 4222, + 2000, 1688, 3560, 2297, 1593, 3679, 3628, 1507, 1549, -188 }, + { 7794, 6437, 6605, 5381, 6404, 4410, 6677, 4233, 4949, 3000, 2812, + 3756, 1805, 2877, 2098, 1737, 1809, 1427, 378, 2031, 2115, 5006, + 3159, 3602, 6343, 3503, 3356, 5971, 3138, 3932, 1028, 699 }, + { 6757, 7738, 6538, 8248, 6959, 6557, 5264, 3092, 3765, 1895, 1865, + 901, 2485, 2217, 1699, 1946, 3573, 1501, 2141, 2177, 180, 1003, + 1816, 4793, 2112, 4560, 3820, 2881, 4376, 2091, 681, 623 }, + { 9057, 8917, 7385, 7072, 6324, 5492, 5283, 5053, 5785, 4277, 3322, + 1267, 1946, 1894, 3701, 472, 1658, 1154, 777, 2193, 2349, 3611, + 3129, 3719, 1781, 5389, 3418, 2463, 3734, 3644, 3365, 2247 }, + { 9444, 9439, 8598, 9152, 6982, 8451, 8279, 6129, 5172, 3730, 2416, + 2483, 2775, 1913, 1041, -1110, -392, 1068, 556, 598, 4171, 2377, + 1870, 1906, 5449, 5413, 2589, 3564, 6473, 6692, 3140, 2665 }, + { 10567, 10001, 8225, 8289, 6898, 6856, 3920, 4547, 4297, 1456, 2348, + 1526, 2343, 2863, 1429, 312, 57, 930, 1619, 1189, 596, 1815, + 2589, 3141, 1662, 3349, 1311, 4091, 4596, 7321, 5911, 6965 }, + { 9593, 9214, 9132, 8273, 8030, 8135, 5179, 5564, 4052, 4155, 4052, + 2249, 2178, 1680, 439, 822, -378, -1210, -1149, 3709, 2830, 747, + 2987, 5873, 795, 5124, 4233, 3887, 5573, 5312, 7258, 11014 }, + { 8373, 8033, 8934, 7880, 7434, 6144, 7528, 5163, 2591, 4301, 2489, + 4137, 1295, 760, 703, 805, -308, -320, 2205, -1113, 362, 581, + 2567, 689, 5949, 2652, 1996, 2138, 7469, 4835, 8058, 11132 }, + { 8586, 6026, 7656, 7201, 8141, 7249, 5995, 4896, 3152, 4255, 1711, + 3498, 3933, 1852, 1444, 715, -104, -695, 4021, 3937, 6478, 1755, + 935, 384, 1002, 2595, 3359, 4532, 7103, 5192, 12241, 14373 } +}; +static int16_t default_ncobmc_krnl_2_0_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { -18, 921, 2116, 3151, 5822, 6391, 6844, 2748, 3794, 6358, 6115, + 7194, 6145, 8324, 7847, 6181, 4052, 4867, 4967, 5823, 6786, 4035, + 5989, 2636, 2376, 5222, 5409, 4121, 2105, 626, -3363, -2857 }, + { 3594, 3991, 2433, 4231, 5187, 5335, 7496, 6672, 4132, 3625, 5649, + 7621, 4052, 6868, 7772, 7010, 5041, 5311, 7273, 6593, 6376, 5150, + 4421, 3618, 2523, 4188, 5275, 3469, 6209, 5459, 953, 947 }, + { 786, 3510, 3161, 3162, 3435, 5439, 6415, 4784, 4467, 4232, 5708, + 3775, 7437, 8362, 9398, 8331, 6300, 6049, 8740, 7748, 9508, 7139, + 7232, 6528, 8257, 4296, 5180, 4497, 3755, 6329, 3620, 3050 }, + { 2273, 1239, -1997, -385, 1641, 4987, 6332, 7869, 5742, 3115, 4523, + 5739, 6076, 8184, 8936, 9733, 5577, 8872, 8635, 7679, 7192, 6961, + 7586, 5022, 5256, 5107, 5842, 4127, 3898, 7191, 5184, 1097 }, + { 2576, 3444, 4787, 3494, 4843, 5213, 7669, 6154, 6713, 5224, 6221, + 8653, 10387, 9676, 10219, 9062, 6899, 4115, 6617, 7548, 7319, 5169, + 6051, 6609, 6735, 3759, 6779, 3520, 5518, 4355, 4386, 3459 }, + { 2457, 4623, 4686, 3390, 6167, 6776, 5546, 7755, 6678, 5831, 6667, + 9797, 9222, 7728, 12319, 12899, 10764, 6383, 7947, 9907, 8225, 5677, + 7690, 9312, 8324, 4971, 9288, 6616, 5448, 7180, 11014, 5709 }, + { 3687, 5015, 5834, 5702, 6619, 6602, 6844, 8607, 10828, 10170, 9206, + 11527, 10057, 10677, 11683, 11009, 10585, 8869, 7057, 9542, 8465, 11391, + 6180, 10182, 5594, 5353, 8810, 7358, 7118, 10591, 10569, 7318 }, + { 5659, 4619, 7090, 7819, 8483, 7258, 7446, 7530, 6847, 7424, 7586, + 8261, 7644, 9373, 18173, 15351, 11259, 11899, 11787, 9977, 8370, 7422, + 9853, 6375, 5873, 6503, 6194, 4792, 5082, 4563, 2192, 5942 }, + { 3004, 6927, 6994, 7359, 7505, 10247, 9661, 8199, 7979, 8529, 9388, + 12192, 11555, 12591, 10308, 10143, 12579, 12379, 11700, 12735, 6629, 10209, + 9592, 11878, 10187, 7755, 7344, 4922, 6699, 8240, 7341, 8532 }, + { 7590, 5795, 6512, 4587, 6933, 7660, 6141, 7410, 5605, 5542, 8790, + 10597, 9438, 10999, 10270, 10028, 10678, 12591, 13767, 11933, 10966, 11898, + 12452, 8305, 6352, 8621, 7598, 5409, 5869, 6860, 8606, 5371 }, + { 7095, 7927, 9729, 11290, 10321, 9966, 8226, 10211, 12468, 10459, 10959, + 12232, 12326, 11686, 11247, 13106, 15660, 16448, 13119, 14772, 14295, 13233, + 11880, 9805, 8498, 5650, 3043, 5995, 9756, 6592, 8450, 6801 }, + { 4251, 4844, 7130, 7033, 9742, 10794, 9341, 10350, 10410, 9188, 10907, + 11059, 11547, 12685, 14995, 15511, 13256, 15229, 12788, 13792, 12937, 14179, + 12355, 8519, 7767, 6376, 7293, 7706, 6134, 9392, 9423, 6656 }, + { 5032, 6597, 8267, 6875, 10431, 9182, 11606, 9174, 9394, 10754, 10214, + 11384, 11633, 14256, 11377, 11933, 13999, 14801, 12182, 12170, 12927, 10856, + 13248, 9493, 6586, 7871, 8697, 7094, 8561, 9451, 7116, 4183 }, + { 5550, 6479, 9188, 7562, 9126, 10236, 12984, 11667, 10146, 11981, 13257, + 13227, 14228, 13278, 13571, 15730, 14696, 14740, 14122, 11230, 10186, 9795, + 9766, 9187, 10707, 11612, 10594, 14651, 10618, 5465, 6640, 1085 }, + { 6402, 8472, 7318, 8449, 9884, 8237, 11776, 12579, 8248, 9119, 10813, + 12464, 14087, 14122, 13487, 15884, 15630, 16883, 13968, 15663, 13943, 14099, + 13309, 12222, 11647, 10827, 11813, 9543, 10171, 10991, 8523, 7564 }, + { 5558, 8716, 7398, 7003, 9081, 9234, 10389, 10222, 11602, 10189, 12165, + 10551, 11676, 14110, 13499, 14107, 14297, 13673, 15239, 13669, 9564, 8809, + 11609, 10482, 11688, 10885, 12257, 11025, 11490, 10586, 12134, 11499 }, + { 5054, 7370, 10001, 8690, 6346, 7990, 10600, 10877, 13977, 14230, 13786, + 11880, 13256, 15455, 14951, 12311, 15970, 16289, 14385, 13318, 10806, 16058, + 14004, 14150, 15275, 14285, 15169, 15124, 14484, 15130, 14320, 13627 }, + { 6472, 6714, 8422, 7520, 9468, 7309, 11310, 10173, 9680, 9775, 11809, + 11641, 17217, 14973, 12511, 12431, 15565, 14706, 12653, 10736, 13799, 11984, + 14576, 14406, 13494, 13775, 13748, 13952, 12627, 13551, 12343, 13637 }, + { 5691, 6196, 6840, 5618, 8130, 5337, 10502, 11764, 12309, 11243, 12058, + 14603, 15254, 13730, 12988, 16426, 16398, 18336, 14653, 12258, 13528, 12015, + 13122, 12816, 13238, 14265, 15564, 14875, 14346, 16501, 14057, 14664 }, + { 5142, 4576, 6578, 5068, 8343, 7665, 11649, 10611, 11541, 10331, 12078, + 14129, 17221, 15930, 16224, 15649, 16231, 11200, 11389, 11572, 13476, 12629, + 11861, 13013, 15114, 12486, 15663, 12735, 13401, 13979, 13507, 13952 }, + { 6851, 5162, 6778, 6922, 8951, 5567, 10360, 9216, 7036, 5410, 10771, + 13577, 12588, 10477, 10248, 14359, 15261, 13795, 12048, 11716, 9361, 6278, + 8997, 10237, 14438, 12459, 12976, 13600, 13892, 11879, 13127, 13802 }, + { 4195, 6070, 3151, 7247, 5889, 6549, 8672, 8715, 10338, 9229, 9026, + 10246, 14651, 14345, 15001, 15116, 18364, 16684, 13657, 14718, 8840, 10437, + 9581, 12367, 11264, 11291, 13002, 11111, 13027, 14172, 12590, 13651 }, + { 3818, 4756, 8879, 6693, 4570, 8158, 7459, 7913, 5727, 9446, 10204, + 8887, 11326, 14337, 13524, 13813, 13628, 15506, 11578, 13470, 12391, 8927, + 9166, 9882, 10411, 11665, 8963, 12141, 11521, 10521, 15132, 15679 }, + { 4425, 8428, 12163, 9947, 3396, 5526, 8133, 4898, 3913, 4891, 5711, + 7034, 10657, 9932, 14435, 12716, 15058, 15501, 14937, 14530, 14536, 9746, + 9923, 11968, 7869, 10734, 9735, 9164, 11842, 12786, 16768, 15073 }, + { 7712, 9515, 10650, 9707, 6201, 9752, 8700, 10334, 9503, 13202, 9555, + 9748, 12814, 13027, 13920, 12593, 14370, 14808, 13965, 14154, 12735, 7319, + 12721, 10395, 7361, 8678, 12937, 10057, 9234, 14695, 14044, 13613 }, + { 8309, 7528, 9323, 7254, 6829, 7276, 7831, 10824, 8851, 11605, 12763, + 10865, 10153, 10736, 12379, 10799, 10370, 11817, 11734, 13290, 18692, 13378, + 10209, 11690, 12616, 9779, 9257, 6142, 7818, 10903, 13276, 8893 }, + { 5420, 5315, 7529, 7453, 9027, 9825, 7865, 9813, 6673, 6090, 7914, + 10790, 11205, 11064, 9239, 11947, 12306, 12802, 11856, 9896, 10502, 9968, + 12099, 11011, 11103, 9920, 10747, 12477, 10458, 8485, 8805, 10199 }, + { 5275, 2169, 8448, 6454, 8077, 5060, 8189, 6133, 5673, 7424, 7993, + 10659, 10836, 8138, 9347, 10570, 8447, 8359, 11071, 11453, 13480, 9521, + 11755, 8294, 7308, 4637, 10781, 5515, 4843, 4737, 5330, 4893 }, + { 4846, 5401, 5671, 3987, 6910, 8363, 10605, 9189, 9832, 11154, 11632, + 10874, 12377, 9266, 12273, 10543, 10287, 10912, 10745, 9206, 8851, 8327, + 11242, 8123, 7431, 10266, 8947, 6186, 4259, -682, -920, 3901 }, + { 3634, 2920, 4925, 5515, 6626, 6450, 10063, 9047, 9880, 9577, 8277, + 7582, 10044, 10186, 11630, 8182, 12589, 14249, 13236, 11328, 7042, 8880, + 7868, 6442, 10067, 3096, 5190, 5874, 2890, 668, 1718, 2480 }, + { 4732, 2901, 1056, 1878, 5356, 5406, 5212, 8538, 8974, 7742, 9588, + 7933, 10867, 8487, 11203, 8392, 8301, 10070, 4166, 11993, 9436, 10071, + 7464, 7158, 7848, 6669, 4825, 5838, 236, 3720, 562, -1751 }, + { 1899, 3004, 3605, 1918, 2347, 4957, 5010, 5918, 6020, 5972, 7291, + 6820, 8455, 8985, 7833, 5877, 5796, 7048, 5548, 2886, 4467, 10008, + 7443, 8399, 7314, 4277, 3852, 296, -983, 1487, -2474, -7290 } +}; +static int16_t default_ncobmc_krnl_2_1_0[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 4140, 3361, 5678, 1978, 3443, 3453, 2905, 2131, 4836, 2612, 1530, + -831, -257, 584, -1193, -391, 107, -47, 32, 125, 282, 684, + 161, 23, -22, -95, 555, -405, 569, -268, -92, 105 }, + { 4680, 4183, 4456, 4730, 4264, 4681, 2310, 2034, 3081, 2493, 2012, + 1397, 1521, -881, -976, -668, -606, -768, -273, 256, -4, -290, + 64, -55, -444, -989, -316, -496, 206, -169, -158, -87 }, + { 3199, 3846, 3775, 632, 2359, 3492, 3355, 53, -1201, 145, 263, + -93, -1435, 415, -844, 954, -241, -483, -165, -191, -561, -185, + -300, -258, -154, -654, 308, -64, -36, -150, 95, 146 }, + { 680, 2863, 889, 1721, 3444, 2472, -27, 2458, 816, -186, 123, + 3214, 2029, 2485, -631, 323, 1030, -275, 196, -532, -537, 153, + 274, 61, -453, -283, -533, -1062, -145, -388, 158, 0 }, + { 1962, 4004, 1406, -535, 1315, 2669, 2522, 654, 3394, 4205, 2731, + -40, -118, 599, -511, 618, 162, 840, 43, 253, -59, 222, + 64, -21, -671, -179, 241, 283, 902, 226, 305, -204 }, + { 516, 1205, 3201, -5, 1479, 945, 2129, -628, 3181, 900, 1439, + 1128, 799, -158, -431, 347, -118, 527, 389, 268, -73, 2, + 534, 133, -287, -19, 561, 329, 394, -120, 38, -461 }, + { 2130, 2022, 1966, 210, 447, 402, 1249, 1677, 2353, 1113, 1723, + 1300, 2060, -144, 420, 2008, -417, -74, -197, 135, 217, 310, + 152, 339, -99, -81, 279, 44, 54, -160, -82, 4 }, + { 2134, -1849, -990, -93, 1932, 2119, 2954, -371, -1021, -831, 1662, + 1330, 1634, 246, -777, 852, 130, -67, 191, -316, -429, -240, + -147, -198, 92, -15, 310, 141, -10, 146, 35, 85 }, + { 2763, 4779, 994, 1054, 2625, 2031, 1784, -161, 1142, 1052, 2300, + 2462, 1943, 516, 816, 27, 18, 171, 158, -311, -636, 20, + -463, -235, 145, 339, 240, -354, -110, 41, 404, 353 }, + { 3625, 3557, 2333, 950, 2020, 2445, 2562, 1506, 2571, 1559, 4781, + 2030, 1325, 2507, 2045, 1896, -526, -22, -272, -143, -189, 17, + 10, 405, 143, 414, -95, -229, -215, 0, -347, 83 }, + { 2808, 1062, 1502, 411, 1139, 998, 1577, 1233, 1637, 998, 1846, + 2487, 3868, 2225, 533, -51, -6, -180, -30, 186, -175, 247, + 352, 57, 83, 290, 330, 160, 165, 354, -465, 131 }, + { 2809, 2966, 2929, 1435, 2875, 1948, 130, 1168, 252, 1276, 2838, + 3507, 3001, 1410, 312, 1941, -336, -431, -190, -194, -130, -336, + 238, 75, -472, -189, 123, 61, -583, 147, 305, 200 }, + { -23, 2306, 2169, 33, 1848, 1832, 2721, 49, 1435, 585, 1036, + 2116, 1658, 1011, 815, 920, 101, 108, 262, 299, 283, 357, + 268, 141, -71, -285, 205, 142, -71, 224, 252, 156 }, + { 1447, 2625, 4643, 2096, -847, -154, 2876, 1050, 104, -873, -327, + 146, -596, 622, -337, 1317, -61, 9, -201, 110, 90, 644, + 337, 204, 155, 278, 320, -306, -504, 357, -108, 132 }, + { -16, 2815, 1344, -2044, 2236, -549, 586, 409, 30, 152, 1588, + 243, -115, 291, -30, -170, -96, -10, 433, 205, -134, 17, + 528, -16, -22, -198, -43, -143, -224, 270, 153, 37 }, + { 1478, 829, 628, 1055, 1323, -406, -282, -12, 418, 40, -795, + -286, -627, -41, -448, 454, -267, -258, -129, -57, -44, -406, + -260, -67, 134, -196, -236, -125, 35, -62, -137, -5 }, + { 220, 26, -380, -257, -90, -453, -196, -56, -193, 37, 131, + 151, -88, -695, 66, -113, -200, -144, 132, -48, -244, -207, + -178, 268, -107, -1, 69, 337, -84, -197, 87, 119 }, + { 7, 3, -85, -185, 334, -86, -69, 152, -320, -239, 587, + 415, 246, 290, -146, -134, -9, -69, -66, -148, -41, -206, + -148, 283, -144, -287, -73, 93, -23, 247, 398, 174 }, + { 46, -256, -114, -61, -532, 103, 32, -223, 24, -20, 132, + 339, 61, -381, -711, -160, -200, -334, 78, 173, -281, -139, + -27, 134, -120, 96, 110, -251, -114, -32, -299, -183 }, + { -193, 28, -134, 200, 155, -316, -363, 285, 268, 665, 233, + -127, 436, -20, -536, -163, 51, -40, 162, 78, -27, 192, + -34, -40, -17, -205, 203, 106, -62, -211, -84, 60 }, + { -440, 312, -195, 221, 251, -388, -116, -252, -101, 92, -244, + -694, -27, 198, -3, 255, -257, -17, 0, 143, -20, 48, + -68, 110, -130, -340, 136, -45, -138, 251, -111, -2 }, + { 325, 219, -68, 215, -177, -206, 14, 108, -291, 211, 92, + -62, -166, -218, -158, -220, -279, 199, 113, -263, 271, 153, + -433, -16, 19, -322, -28, 258, -295, -300, -285, -123 }, + { -345, 543, 356, -541, -726, -205, -332, -397, -10, -132, 232, + 132, 308, 324, 229, 79, -151, 161, 143, -40, -144, -464, + 32, -364, -11, -99, -285, 61, -258, 182, -28, 107 }, + { -55, 70, -78, -269, -709, -52, 351, 94, 80, 268, 249, + -56, 189, -191, -60, -88, 15, -205, 111, -62, 21, 85, + 77, -107, -35, -13, -107, -472, -546, -197, 5, 115 }, + { -363, -297, 246, -84, -419, -230, 283, -128, 34, -27, 112, + 125, 166, 163, 176, -422, 14, -238, -80, -153, 313, -366, + -208, -54, -260, 48, -176, 21, -91, -295, -270, 40 }, + { 85, 242, 107, -41, -283, -390, -105, 360, 181, -720, -582, + 27, -96, -350, -217, -189, -135, -12, 280, 86, 3, 25, + -126, -213, -384, 41, -15, 101, -68, 143, -211, 86 }, + { -183, 13, 274, -46, -86, -633, 181, -232, -90, -106, -22, + 332, -12, -16, -30, 87, 5, 46, 37, -99, 27, 292, + -74, -94, -237, -16, -145, 76, -106, 227, -52, 168 }, + { 40, -258, -140, -6, 203, 146, -64, -88, -183, 221, 62, + 67, 114, -216, -307, -560, -197, -46, 149, -126, -120, -316, + -36, -227, -200, 115, -41, -51, 97, 123, -47, 103 }, + { -51, 44, -99, -230, -156, -46, -145, -412, -56, 48, -239, + 222, 83, -339, -196, -64, 175, 149, -140, -316, 6, -62, + -27, -56, -21, -269, 229, -7, 122, -18, -129, 86 }, + { -372, 106, 18, 172, 364, 19, -245, -73, -124, 164, -9, + 14, 214, -67, -217, -175, -45, 119, -194, 36, 18, -83, + 126, 196, 112, -297, -102, 104, -74, -152, 19, 199 }, + { 314, 81, -49, -188, 48, -82, -4, 107, -221, -4, 207, + -245, 197, -37, -185, -50, -56, -214, 100, -231, -31, -2, + 21, -53, -215, -77, 168, -23, 82, 5, 155, 169 }, + { 258, 188, -27, -27, 165, 29, -17, 100, -27, -80, -80, + 196, 23, -391, -533, -171, 84, -137, 0, 14, 251, 99, + 35, 88, -28, 1, 144, -96, -235, 176, 103, -85 } +}; +static int16_t default_ncobmc_krnl_2_1_1[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 5724, 6155, 5101, 6937, 3616, 3940, 3066, 5662, 7104, 5021, 4979, + 5907, 4968, 7085, 6582, 7719, 9143, 4128, 6447, 4879, 7061, 11362, + 7837, 9965, 7152, 6477, 6581, 5803, 1819, 5309, 8559, 10776 }, + { 1775, 3231, 4026, 2629, 4438, 6309, 5114, 2895, 5657, 6541, 6734, + 5994, 7468, 4555, 9911, 5200, 5402, 1698, 4298, 6112, 6417, 6691, + 4816, 6195, 4139, 5856, 3358, 1993, 1542, 661, 1660, 4762 }, + { 1953, 726, 336, 2519, 4189, -753, 2993, 4957, 5850, 4298, 3651, + 5353, 3255, 5491, 7815, 3406, 3928, 2987, 4148, 4276, 3530, 8058, + 5079, 5821, 4622, 3354, 3146, 2460, 489, 1550, 1587, 1399 }, + { -801, 328, 103, 886, 1381, 2280, 4320, 2452, 1215, 6261, 2206, + 4849, 4488, 3829, 6128, 5213, 1739, 3173, 4425, 4567, 5845, 5197, + 5910, 6147, 4260, 3730, 4240, 5420, 307, 672, 963, 3278 }, + { -1721, -2596, -155, 3029, 3428, 2390, 2321, 3757, 1383, -1283, -1621, + 1418, 2475, 4188, 5570, 3575, 799, 4017, 2856, 1426, 2012, 2722, + 3669, 4104, 3800, 4116, 3275, 3739, 326, 95, 2421, 3075 }, + { -551, -927, -520, 2944, 2518, -722, -215, 1875, 137, 2182, 2761, + 159, 762, 3693, 1681, 2600, 880, 3273, 4470, 5007, 4272, 3074, + 2474, 4254, 6828, 4219, 3671, 2407, 1044, 129, -478, 2814 }, + { -2686, -1229, 1372, 4761, 4668, 1462, 509, 2727, 930, 2438, 3542, + 1456, 1961, 541, 1063, 1426, 3603, 2873, 2412, 2999, 2101, 3739, + 2385, 5494, 5444, 5655, 5034, 381, 321, 90, 2585, 4160 }, + { -4203, 479, 1122, 2688, 2124, 942, -2136, -1643, -491, 2581, -2155, + -2375, 559, 582, 2202, 2081, 3774, 3330, 1101, 894, 3410, 3691, + 2509, 5195, 6226, 5471, 5022, 2525, 778, 1212, 2736, 3350 }, + { -2415, -2903, 4719, 5860, 4006, 2692, 4035, 4143, 2498, 4377, 2058, + 488, 1429, 3199, -11, 2009, 2087, 2903, 155, 522, 4521, 2221, + 2310, 3124, 2870, 1941, 3262, 2258, 1515, 2257, 1584, 1048 }, + { -1469, -2652, -561, 2135, 389, -522, -589, 447, -847, 268, -1641, + -1540, -1513, -1334, -599, -581, 2848, 2828, 1416, 2157, 2198, 925, + 2421, 1437, 1963, 369, 2195, -548, 2051, 868, 824, 2683 }, + { -2620, -3631, -4548, -885, 629, 523, -528, -2178, -1743, 1644, 353, + -2687, -3041, -1722, 283, 178, 1594, 1190, 968, -386, 2305, 1317, + 245, 1443, 968, 800, 471, 521, 1564, 669, 903, 243 }, + { -1791, -3282, -4140, -1753, -1006, -374, 1027, -176, -1477, -891, 191, + -912, 497, 96, 359, 1045, 1467, 172, 1303, 2510, 3516, 3671, + 789, -807, 2670, 1483, 547, -521, -1219, -1856, 1008, 1053 }, + { -1427, -2698, -3949, -436, 801, -614, -1548, 523, -176, -683, 423, + -871, 820, -2279, -143, 375, 768, 2306, 5249, 1302, -338, -396, + -1590, -608, 1469, 2344, -187, -693, 599, -661, -458, 160 }, + { -3491, -3877, -2952, 1252, 767, -3037, -3638, 188, 587, 710, 1416, + 1176, -319, -473, 1873, -1997, 725, 596, -94, 1875, 2992, -519, + -139, 1938, 1025, 521, 760, 1090, 3648, 392, 564, 902 }, + { -2186, -3264, -1742, 2634, -36, -51, -1253, -314, -908, -459, -1701, + -1437, -991, 84, 1265, -964, 402, 1454, -772, -927, 1765, 1543, + 484, 2346, 3310, 1887, 1754, 3058, 1474, 728, -466, -1646 }, + { -1826, -332, 48, 744, -618, -97, -165, -155, -908, -143, 1285, + 1739, 1185, 885, 1134, -531, -15, -526, 543, 1438, 2026, 3022, + 558, 1827, -139, 1792, 2022, 769, 2400, 444, -1572, 598 }, + { 165, -357, 15, 666, 1315, 1155, 376, -7, 991, 213, 1687, + -34, 452, 352, 203, 1605, 1484, -498, 581, 533, 467, 1744, + 1315, 874, 82, 900, 1437, -692, -417, 456, -271, -1132 }, + { 646, 210, 320, 1208, 145, 971, 396, -448, 557, 1876, -1791, + 913, -1288, -452, 1015, 925, -1197, -49, -285, 442, 1093, -410, + 125, 519, -52, 513, 1497, -1337, 298, -402, 820, 732 }, + { -796, 627, -1017, 2972, 4463, 2331, 1387, 1496, 1796, 1608, 1681, + -877, 881, -160, -581, -433, 949, 471, 307, 140, -946, -597, + 247, 650, 1143, 694, 10, -682, 890, 409, 617, 810 }, + { 1653, 4435, 2388, 294, 2578, 1229, 1072, 1871, 465, 1650, 1524, + -430, -1195, -3427, -116, 1117, 217, 967, -254, 259, -55, 1425, + 1583, -1261, -1773, 1232, 2886, 646, 1346, 1518, 2090, -837 }, + { 2020, 728, 2038, 316, 5725, 4193, 890, 1490, 584, 2705, 694, + -892, 34, 2041, 972, 332, -295, -218, -756, 2193, 1672, 1440, + 2310, -2136, -2204, 399, -753, 743, 3155, 2521, 3534, 166 }, + { 824, 1664, 991, 853, 700, -80, 148, -908, -194, -620, 1053, + -368, 1616, 1250, 1449, 3140, -1065, 286, 2226, -590, -570, -1131, + 477, -61, -708, 519, 586, 1148, 898, 1653, 4697, 1581 }, + { 2014, 1921, -210, 556, 686, -561, -1239, -1345, -664, -138, -215, + -343, 1019, 1294, 519, -179, 212, -299, -2160, -1450, -329, 293, + 691, 162, -645, 1079, 2005, 1466, 1127, 2263, 730, 179 }, + { 5629, 4670, 597, 2030, 3873, 3698, 54, 2714, 62, 352, 2177, + 908, 1306, 1504, 1464, -288, -106, -69, -179, -900, -1340, -4, + 877, 487, 2606, 358, 2055, 1131, 1421, 931, -477, 1173 }, + { 757, -493, 1510, 2513, 4514, 4649, -478, 2069, 124, -1186, 2855, + 1906, 1420, 1738, 19, 1916, 1195, -519, 32, 512, 230, 528, + 43, -263, 1314, 1350, 137, -256, 939, 256, 168, -201 }, + { 663, 947, 699, 3239, 4730, 5279, 1739, 1659, 2774, -1660, -1677, + 185, 3745, 1319, 2347, 477, 364, 531, 608, -520, -783, -123, + -59, -345, 1202, 1766, 88, 883, 654, 1399, -1082, 658 }, + { 4534, 5694, 5332, 4909, 4828, 4761, 7376, 3834, 2327, 4737, 7135, + 5306, 6337, 5240, 5578, 4321, 2107, -205, 1387, 597, 1112, 904, + 1567, 610, 461, 371, 250, 602, 358, 1807, -617, -59 }, + { 6124, 8363, 9624, 5674, 7043, 4437, 3846, 3121, 3477, 2818, 5445, + 3618, 5067, 3996, 5759, 7185, 2150, 785, 1581, 2084, 3321, 4828, + -545, 510, 2309, 2501, 1594, 2028, 528, 113, 248, 550 }, + { 8154, 9890, 6292, 6421, 8295, 4403, 7503, 5496, 7256, 3699, 2845, + 3725, 5365, 5905, 7170, 2903, 733, 4614, 3856, 4346, 7099, -902, + -1492, 1703, 2321, 1842, 3488, 1690, 982, 524, -467, -687 }, + { 5338, 10331, 7754, 7014, 3581, 5660, 5471, 5420, 3976, 2548, 6486, + 9144, 6584, 5442, 6795, 4845, 5182, 2855, 8246, 3660, 5417, 1845, + 1803, 288, 1434, 639, 1404, 2752, 923, 1055, 741, -984 }, + { 4457, 7110, 5195, 5959, 6818, 8562, 5548, 2071, 5544, 8734, 7080, + 4737, 9481, 7672, 8374, 7638, 4204, 3562, 3758, 3598, 5016, 2863, + 3927, 5001, 4677, 4444, 2481, 1773, 2525, 3142, 4840, 3965 }, + { 1134, 3249, 4702, 5483, 4471, 7234, 7281, 6240, 5891, 7577, 3826, + 5886, 4798, 7117, 6319, 7264, 4115, 5613, 4674, 4999, 4518, 2501, + 6830, 4913, 2356, 789, 1926, 2190, 1914, 1434, 987, 1761 } +}; +static int16_t default_ncobmc_krnl_2_1_2[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 6131, 7769, 6548, 6297, 4967, 4708, 3127, 5937, 697, 748, 1850, + 2290, 2945, -80, 216, 377, 318, 1009, 2112, 2962, -886, 849, + 510, 4160, 2257, 2875, 4589, 5345, 7363, 5350, 6815, 1644 }, + { 6949, 8044, 7295, 7318, 3142, 2084, 1819, 3048, 1654, 1831, 1344, + 3344, 2065, 2889, -88, 3746, 696, 1143, 232, 1444, 1587, 4125, + 3991, 3840, 5642, 4933, 3560, 6540, 5865, 6663, 6729, 5520 }, + { 7816, 4894, 7089, 7533, 4271, 6814, 1972, 3845, 3755, 3498, 3571, + 1884, 3171, 1843, 70, 2358, 2622, 1241, 143, 2657, 3804, 2968, + 1781, 262, 2864, 4345, 1302, 5434, 7815, 10560, 9211, 8202 }, + { 10656, 7490, 8639, 7975, 4318, 7432, 6148, 3321, 3776, 2781, 3544, + 246, 2350, 793, 1600, 1266, 2372, -1382, -983, 1926, 493, 447, + 2275, 3510, 4789, 3766, 878, 2353, 3314, 6282, 5853, 3709 }, + { 11083, 7270, 6211, 6170, 4927, 4198, 3939, 4605, 1734, 2009, 2950, + 546, 722, 99, 550, 597, 2350, 41, 1314, 1148, -183, 1143, + 5392, 3550, 3102, 1161, -556, 1700, 7598, 8412, 6019, 9654 }, + { 10358, 7350, 6589, 5975, 3587, 6201, 4603, 3974, 2262, 886, 1815, + 1899, 1642, 2894, 1557, 228, 1625, 1879, 838, 182, 919, 1168, + 3272, 1155, 889, 2292, 128, 4478, 5205, 7668, 8767, 10921 }, + { 8569, 4702, 5397, 5147, 2577, 4301, 2139, 1630, 721, 1721, -218, + 1595, 275, 1133, 1051, -777, 1556, -245, 972, 106, 2205, 385, + 1410, 366, 3348, 2139, -164, 3111, 2656, 5036, 6021, 4847 }, + { 7654, 5535, 5975, 4580, 3005, 5483, 4637, 5560, 6252, 4946, 4508, + 3600, 1824, 1528, 338, 131, 1290, 309, 344, 3110, 3607, 2484, + 1062, 1267, 1426, -860, 1155, 6137, 2415, 5482, 6846, 4916 }, + { 8060, 5296, 4396, 2040, 867, 1189, 3555, 3397, 3438, 664, -1931, + -1938, -1414, 1317, 762, -312, -655, -801, -243, 2795, 1663, 1314, + 1478, 2856, 562, 1075, 3211, 7482, 2988, 3880, 4156, 3289 }, + { 8146, 7596, 7056, 7622, 5755, 7181, 7862, 4736, 4932, 3146, 1043, + -422, -813, -2152, 1444, 441, 3599, 395, 2173, 755, 4245, 3047, + 1545, 1062, 1159, 1621, 209, 6521, 7385, 7730, 6511, 8959 }, + { 9567, 8044, 7535, 6969, 3284, 4284, 4734, 4758, 5177, 2342, 230, + -1852, -839, -769, 222, 255, -315, -16, 1101, -28, 3561, 2004, + -260, 789, 1856, 1960, 4962, 4207, 2425, 8406, 6771, 7796 }, + { 8019, 7612, 8357, 5521, 4711, 3374, 4391, 7093, 5013, 3608, 238, + -1564, -1662, -1373, -198, -1045, 100, 2694, 1251, 489, 2110, 1670, + 188, -1362, 953, 2340, 3361, 3595, 6405, 7676, 1634, 7730 }, + { 10177, 6488, 5822, 5121, 2615, 2725, 3372, 4849, 2232, 2548, 2841, + 874, 895, 307, 1293, -150, 411, -981, -815, -24, 936, -2339, + 254, 3019, 5892, 4302, -2171, 6747, 7198, 5638, 4832, 9538 }, + { 7260, 9945, 2818, 1106, 6179, 6331, 5106, 1814, 5997, 4045, 1456, + -230, 297, 1045, 1918, -126, 752, 1014, 999, -506, 198, -732, + -1900, 139, 749, 3999, 5614, 5241, 6339, 8316, 3673, 7681 }, + { 11101, 6954, 7475, 5729, 4242, 6118, 4569, 2348, 5307, 3762, 2933, + -1610, 988, -1178, -104, -151, -507, 491, -906, 1236, 3075, 1525, + 1631, 2901, 2758, 1303, 1578, 6405, 3807, 7189, 8468, 9262 }, + { 6835, 4602, 5501, 5568, 4338, 6143, 4304, 3557, 3258, 3797, 1242, + 968, 1683, -251, 1218, 301, 1257, 1924, 985, 1251, 3051, 433, + 1756, 167, -660, 3884, 3450, 7202, 6544, 5184, 7556, 9366 }, + { 5991, 6762, 3854, 4856, 6714, 5701, 4072, 2489, 422, -365, 1488, + 1660, 725, 1157, -778, 654, 313, -18, 3162, 3065, 2925, 2391, + 827, 5547, 461, 2487, 1492, 5810, 7042, 5284, 3995, 6870 }, + { 6435, 8283, 4732, 5896, 5599, 4229, 4798, 3309, 3128, 941, 2565, + 394, 257, 2477, 721, 1494, 3161, 1409, 1306, 2534, 1261, 2719, + 756, 4388, 570, 5416, 3719, 6067, 4092, 2565, 6299, 10504 }, + { 6042, 7417, 5391, 4671, 3245, 7547, 3777, 3203, 2044, 583, 2083, + 1971, 1721, 1948, -169, 1197, -1141, -480, 2155, 1033, 1313, 268, + 1857, 4493, 3083, 2005, 5347, 4397, 10144, 4828, 6622, 9817 }, + { 7202, 5045, 6601, 6937, 3704, 5796, 5061, 3575, 2383, 1389, 3111, + 1751, 1603, 2813, 174, 706, -569, 2620, 1735, 1418, 1871, -1542, + 168, 2156, 5107, 6329, 4968, 7018, 6279, 6864, 5898, 9157 }, + { 5722, 5683, 4189, 4814, 2883, 5508, 5100, 1625, 2169, 3680, 1884, + 2109, 462, 1145, 334, 515, 191, 441, 1058, 917, 1528, -96, + 1843, 5395, 4498, 5681, 4193, 5196, 8356, 5303, 7262, 10141 }, + { 5879, 5779, 7257, 3873, 6911, 6238, 5672, 3583, 3261, 3048, 2536, + -310, -1046, -69, -660, 417, -719, -2058, 1740, 888, 2746, 1367, + 1668, 1090, 1830, 1153, 5047, 7336, 3380, 7160, 4422, 9401 }, + { 7809, 7945, 8385, 8535, 7803, 3953, 5065, 3185, 2013, 1659, 1648, + 769, 292, -135, 114, -579, 713, 1407, -1181, 1569, 3525, 5630, + 219, 3518, 3739, 3432, 7282, 6357, 619, 5779, 10116, 6448 }, + { 9496, 7224, 5342, 5960, 5092, 4225, 4353, 3995, 3631, 1662, 1413, + 762, 534, 126, -551, -1025, 2327, 602, -452, 1285, 2103, 2579, + -1369, 2724, 6353, 3925, 4631, 9139, 4974, 6630, 7755, 4125 }, + { 5226, 7729, 5768, 5815, 4531, 2948, 3029, 2603, 2549, 1366, 119, + 405, 21, -1831, -327, -287, -415, -1317, -214, 3017, 1586, 2436, + 868, 1094, 290, 668, 2117, 756, 1228, 2700, 5743, 8052 }, + { 6262, 5531, 4454, 4616, 3913, 2022, 4240, 2241, 4201, 2506, 1810, + 628, -496, -779, -471, 394, 756, 1666, -445, 490, 575, -478, + 894, 1182, 822, 626, 1782, 1781, 5333, 5482, 1760, 8187 }, + { 6488, 6875, 4960, 6837, 4564, 1871, 390, 2940, 4330, 1634, 131, + -1102, -1451, -928, -1067, -419, -614, -2, 1017, 1066, 1051, 917, + 1097, 844, 465, 513, 2377, 1031, 3548, 5088, 4516, 10564 }, + { 6497, 6047, 5649, 7156, 4974, 3683, 2875, 4421, 1502, 1244, 668, + -30, -1465, -59, -399, -721, 954, -281, -2, 664, 1039, 814, + 758, 1911, 319, 4247, 1848, 1606, 2536, 2189, 1372, 7759 }, + { 5994, 5659, 6777, 6693, 4758, 2986, 1463, 1186, 2116, -166, 499, + 73, -1151, -164, 279, -895, -169, 339, 1194, 1772, 752, 1649, + 1696, -2615, 1581, 1740, 1789, 1832, 1899, 510, 2135, 7149 }, + { 9107, 4250, 5418, 4334, 613, 2618, 3395, 4809, 1724, 873, -78, + -1146, -431, -547, -1104, -1128, -6, -290, 945, 794, 564, 1670, + 737, 4540, 1574, 6285, 2596, 2859, 1191, 1428, 5614, 8419 }, + { 5905, 4490, 6470, 3636, 2119, 1731, 3532, 2461, 2391, 473, 176, + -562, 389, -1300, -916, -1436, 371, 567, 1038, 866, 59, 195, + 679, -721, 2994, 3260, 1813, 1589, 850, 1982, 7410, 11546 }, + { 7265, 8775, 6672, 6657, 6182, 3732, 3222, 4564, 2644, 790, 924, + -596, 628, -681, -57, -236, 103, 364, 603, 1420, 309, 787, + 1257, 770, 2453, 3401, 1175, 434, 792, 4019, 8792, 11773 } +}; +static int16_t default_ncobmc_krnl_2_1_3[MAX_SB_SIZE][MAX_SB_SIZE] = { + { 391, -894, -939, 1155, 4362, 4297, 7296, 2684, 3758, 8010, 8044, + 9041, 8748, 8816, 10796, 8701, 6840, 11306, 7814, 8456, 9952, 3511, + 7870, 2227, 7018, 7148, 4672, 5660, 6657, 6007, 1098, 3866 }, + { 2970, 945, 619, 1701, 4540, 3326, 7140, 8401, 6001, 5524, 6311, + 5657, 5333, 9833, 7547, 8127, 10894, 14326, 12130, 8591, 8408, 5873, + 7524, 6398, 7054, 6594, 9788, 8347, 8784, 9253, 8154, 6170 }, + { 3423, 6928, 5192, 5699, 5575, 6852, 8083, 7546, 8019, 8464, 8910, + 9251, 11401, 8637, 9356, 9671, 10065, 12652, 12275, 9662, 9627, 5550, + 9836, 10565, 9075, 9350, 11656, 8549, 8120, 4437, 5501, 6658 }, + { 5859, 5714, 6766, 5830, 7266, 4208, 5956, 8173, 10615, 7557, 10533, + 8101, 7530, 9292, 9312, 9603, 11268, 14896, 12761, 10435, 10584, 10602, + 7945, 6677, 7798, 9184, 11805, 9688, 12921, 9831, 9425, 9409 }, + { 5068, 7732, 8953, 7750, 6739, 7145, 7635, 7400, 9896, 11465, 12344, + 14483, 13309, 11497, 10778, 11614, 13096, 11519, 12197, 13573, 14652, 12324, + 7270, 8764, 10162, 11289, 13446, 10681, 7564, 7663, 7650, 3879 }, + { 6073, 8775, 7134, 7485, 8815, 9982, 9893, 11182, 10807, 12415, 10385, + 13211, 13198, 9974, 13590, 13229, 14029, 10733, 10710, 10950, 11286, 12150, + 10133, 10858, 8958, 9903, 12033, 9177, 9756, 8710, 8055, 3108 }, + { 8368, 10916, 7650, 6261, 8713, 10236, 12507, 10373, 12385, 11135, 11343, + 12039, 12114, 14871, 13861, 13742, 11649, 13839, 13207, 13160, 11863, 11950, + 12423, 10188, 7712, 8705, 11270, 12864, 13370, 11422, 7881, 7390 }, + { 10805, 12233, 10301, 9238, 9352, 7871, 10959, 12870, 11641, 9692, 12373, + 13839, 12380, 14055, 14653, 13348, 11227, 12844, 14769, 12714, 9815, 10484, + 12966, 10123, 8644, 11791, 9911, 7598, 13225, 9539, 6774, 8055 }, + { 7987, 9257, 6281, 7446, 8911, 10506, 7039, 9031, 9319, 10294, 13979, + 15391, 14445, 11372, 14852, 14690, 14954, 14129, 16319, 13385, 10855, 12837, + 13065, 10647, 12815, 13043, 9686, 7003, 12028, 10211, 10237, 11699 }, + { 6073, 7893, 7571, 5698, 8244, 7305, 6581, 9719, 9746, 11432, 12215, + 16346, 17408, 17379, 13508, 14637, 10471, 13204, 13089, 13632, 10135, 12397, + 12431, 13511, 13140, 13999, 14081, 10639, 7173, 7807, 9433, 4659 }, + { 6634, 10941, 11920, 9920, 11356, 10608, 10624, 12593, 11330, 11413, 13971, + 18455, 16400, 16654, 15373, 16023, 15144, 15413, 14357, 16626, 10718, 12841, + 16053, 14104, 13496, 13334, 10605, 11490, 12221, 6956, 9178, 8213 }, + { 7366, 9121, 9253, 11198, 9839, 11458, 10864, 8319, 12656, 12437, 13128, + 15378, 14565, 16278, 15940, 14457, 15156, 13972, 14035, 13587, 10888, 11376, + 15176, 18483, 13236, 12754, 12347, 13247, 11785, 10432, 13455, 7419 }, + { 7665, 10318, 12372, 11702, 11166, 12470, 11859, 10983, 12921, 13947, 12106, + 14300, 13037, 17367, 14444, 15259, 15107, 14974, 11715, 14835, 15525, 18775, + 17479, 13835, 9101, 10034, 18554, 10201, 8666, 11181, 11767, 6530 }, + { 11169, 7696, 11879, 11938, 10302, 13271, 12067, 13360, 9715, 12528, 13879, + 15312, 17012, 15194, 12951, 17211, 14989, 14796, 15695, 14942, 13140, 17003, + 18104, 14131, 14490, 11607, 9697, 10346, 6890, 7337, 12248, 7668 }, + { 7494, 9902, 9327, 10081, 9955, 10895, 12521, 13971, 11975, 12950, 13579, + 19214, 16537, 17208, 15292, 17698, 16633, 14485, 17676, 15920, 11698, 13314, + 13747, 11163, 10360, 13396, 13119, 7073, 11331, 8217, 8258, 8754 }, + { 9934, 11319, 10239, 9047, 11387, 10784, 12566, 13038, 13663, 12717, 14675, + 14008, 14178, 15820, 14510, 16181, 15440, 15283, 15009, 13767, 11372, 13359, + 14352, 14480, 17066, 10914, 11175, 8554, 7428, 10827, 10561, 6443 }, + { 10016, 9986, 12912, 11133, 8475, 9995, 12150, 14006, 15182, 16531, 13117, + 14634, 15313, 15598, 16928, 14269, 14814, 17080, 12532, 12849, 13261, 12479, + 14442, 9716, 15960, 13029, 13398, 10927, 9854, 10849, 12580, 10547 }, + { 9295, 7913, 11422, 9455, 10319, 11278, 11274, 13394, 13038, 13821, 15044, + 14686, 17187, 14091, 14823, 14137, 14455, 15111, 15447, 13582, 14076, 14295, + 15643, 11185, 16015, 10747, 11235, 11551, 12009, 13990, 8881, 5003 }, + { 11095, 8615, 12138, 8821, 9239, 6419, 11207, 11937, 12556, 14236, 12501, + 14976, 13740, 15006, 17876, 15826, 16800, 16761, 13880, 15072, 16296, 16857, + 14333, 11125, 12310, 13605, 10932, 12928, 5472, 11185, 9435, 5957 }, + { 7725, 6887, 7535, 8957, 9967, 9700, 10640, 10680, 13275, 12682, 11517, + 15207, 15552, 17018, 16856, 14725, 16692, 12845, 14748, 14656, 14606, 16310, + 14672, 15510, 13069, 9039, 8315, 8606, 8826, 8214, 8487, 7999 }, + { 9071, 9686, 10375, 11046, 7539, 7106, 10540, 13531, 13747, 9927, 14071, + 15876, 15935, 13026, 15104, 15296, 16773, 16198, 16098, 13165, 13227, 15002, + 12319, 13015, 14240, 10673, 12818, 10497, 5016, 8298, 5706, 6088 }, + { 9366, 8741, 8215, 11450, 8961, 10464, 10575, 13631, 13635, 13752, 12735, + 17169, 16010, 15438, 15786, 13083, 18481, 17990, 12316, 16370, 13953, 16000, + 14693, 15392, 15242, 15049, 10809, 7658, 12399, 7866, 7570, 5544 }, + { 6903, 5972, 7864, 7864, 8655, 13231, 12904, 14949, 15064, 15007, 14738, + 15847, 14769, 14910, 15543, 17103, 15630, 15115, 19594, 16319, 13352, 10936, + 15453, 13064, 13305, 12008, 7408, 8514, 14898, 8171, 5583, 9657 }, + { 1309, 4431, 10551, 8701, 8152, 8547, 11642, 9601, 12635, 14116, 12560, + 14796, 14370, 14959, 15558, 17801, 14148, 16067, 16927, 16084, 15633, 13749, + 16805, 13274, 7467, 12136, 9815, 6584, 10514, 9020, 9109, 10981 }, + { 10778, 9464, 8877, 8157, 7779, 9056, 13584, 11871, 13714, 16259, 13305, + 13956, 14785, 16328, 16541, 15199, 15586, 18478, 16668, 13019, 14279, 13814, + 15684, 15613, 15050, 14345, 14327, 15869, 14316, 13744, 10738, 8497 }, + { 9411, 9691, 11139, 8582, 8038, 9492, 10534, 12154, 9249, 16286, 16839, + 15572, 13252, 16207, 14760, 15743, 15428, 14223, 15971, 16378, 16607, 16993, + 15698, 15766, 14771, 13969, 14551, 13631, 10451, 9360, 15908, 7460 }, + { 5565, 3814, 5832, 4698, 7091, 10412, 8442, 9852, 9831, 10137, 9167, + 11864, 11520, 12092, 11930, 12431, 14914, 16568, 13978, 14847, 14215, 14290, + 13812, 15033, 15711, 15541, 13908, 14681, 12577, 9266, 12542, 5718 }, + { 3740, 2245, 1259, 3575, 4190, 8150, 9742, 8948, 11592, 12108, 10225, + 12748, 12684, 12687, 11339, 10475, 13481, 15937, 14669, 13780, 12167, 11074, + 16225, 14201, 13966, 9544, 12974, 12797, 13248, 13990, 14819, 7995 }, + { 2296, 817, 3435, 3505, 3507, 9072, 7580, 10139, 7087, 12821, 13297, + 12396, 12113, 10999, 9149, 14466, 15677, 11290, 11487, 10612, 8552, 15725, + 16233, 17367, 12511, 13088, 10898, 12875, 13386, 15384, 14845, 9849 }, + { 2320, 1714, 3209, 4858, 11853, 8126, 7775, 6246, 10834, 12812, 9996, + 8379, 10020, 11558, 10914, 12851, 11272, 13723, 7409, 11919, 10393, 12987, + 13756, 11382, 13258, 9754, 12513, 10697, 14356, 14065, 10023, 8748 }, + { 5715, 4721, 4773, 6968, 7426, 6196, 7322, 11771, 8704, 7198, 8944, + 12478, 6336, 10064, 9132, 10252, 11884, 12483, 11504, 12168, 11346, 13354, + 11779, 12178, 8942, 8770, 11937, 13047, 12938, 11277, 4002, 710 }, + { 7743, 4184, 5058, 4276, 5576, 5393, 5919, 5500, 7881, 8102, 11726, + 10912, 10943, 10344, 10654, 9537, 12118, 10565, 11112, 9964, 11328, 13005, + 8273, 10626, 11596, 12198, 13157, 13884, 13912, 10737, 6497, 2938 } +}; + +void get_default_ncobmc_kernels(AV1_COMMON *cm) { + av1_copy(cm->ncobmc_kernels[0][0].KERNEL[0], default_ncobmc_krnl_0_0_0); + av1_copy(cm->ncobmc_kernels[0][0].KERNEL[1], default_ncobmc_krnl_0_0_1); + av1_copy(cm->ncobmc_kernels[0][0].KERNEL[2], default_ncobmc_krnl_0_0_2); + av1_copy(cm->ncobmc_kernels[0][0].KERNEL[3], default_ncobmc_krnl_0_0_3); + av1_copy(cm->ncobmc_kernels[0][1].KERNEL[0], default_ncobmc_krnl_0_1_0); + av1_copy(cm->ncobmc_kernels[0][1].KERNEL[1], default_ncobmc_krnl_0_1_1); + av1_copy(cm->ncobmc_kernels[0][1].KERNEL[2], default_ncobmc_krnl_0_1_2); + av1_copy(cm->ncobmc_kernels[0][1].KERNEL[3], default_ncobmc_krnl_0_1_3); + av1_copy(cm->ncobmc_kernels[1][0].KERNEL[0], default_ncobmc_krnl_1_0_0); + av1_copy(cm->ncobmc_kernels[1][0].KERNEL[1], default_ncobmc_krnl_1_0_1); + av1_copy(cm->ncobmc_kernels[1][0].KERNEL[2], default_ncobmc_krnl_1_0_2); + av1_copy(cm->ncobmc_kernels[1][0].KERNEL[3], default_ncobmc_krnl_1_0_3); + av1_copy(cm->ncobmc_kernels[1][1].KERNEL[0], default_ncobmc_krnl_1_1_0); + av1_copy(cm->ncobmc_kernels[1][1].KERNEL[1], default_ncobmc_krnl_1_1_1); + av1_copy(cm->ncobmc_kernels[1][1].KERNEL[2], default_ncobmc_krnl_1_1_2); + av1_copy(cm->ncobmc_kernels[1][1].KERNEL[3], default_ncobmc_krnl_1_1_3); + av1_copy(cm->ncobmc_kernels[2][0].KERNEL[0], default_ncobmc_krnl_2_0_0); + av1_copy(cm->ncobmc_kernels[2][0].KERNEL[1], default_ncobmc_krnl_2_0_1); + av1_copy(cm->ncobmc_kernels[2][0].KERNEL[2], default_ncobmc_krnl_2_0_2); + av1_copy(cm->ncobmc_kernels[2][0].KERNEL[3], default_ncobmc_krnl_2_0_3); + av1_copy(cm->ncobmc_kernels[2][1].KERNEL[0], default_ncobmc_krnl_2_1_0); + av1_copy(cm->ncobmc_kernels[2][1].KERNEL[1], default_ncobmc_krnl_2_1_1); + av1_copy(cm->ncobmc_kernels[2][1].KERNEL[2], default_ncobmc_krnl_2_1_2); + av1_copy(cm->ncobmc_kernels[2][1].KERNEL[3], default_ncobmc_krnl_2_1_3); +} diff --git a/third_party/aom/av1/common/ncobmc_kernels.h b/third_party/aom/av1/common/ncobmc_kernels.h new file mode 100644 index 000000000..358b7b7c8 --- /dev/null +++ b/third_party/aom/av1/common/ncobmc_kernels.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include <stdio.h> +#include "av1/common/enums.h" +#include "av1/common/onyxc_int.h" +#include "av1/common/common.h" + +#ifndef AV1_COMMON_NCOBMC_KERNELS_H_ +#define AV1_COMMON_NCOBMC_KERNELS_H_ + +void get_default_ncobmc_kernels(AV1_COMMON *cm); + +#endif // AV1_COMMON_NCOBMC_KERNELS_H_ diff --git a/third_party/aom/av1/common/obmc.h b/third_party/aom/av1/common/obmc.h new file mode 100644 index 000000000..f3940490f --- /dev/null +++ b/third_party/aom/av1/common/obmc.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2017, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#ifndef AV1_COMMON_OBMC_H_ +#define AV1_COMMON_OBMC_H_ + +#if CONFIG_MOTION_VAR +typedef void (*overlappable_nb_visitor_t)(MACROBLOCKD *xd, int rel_mi_pos, + uint8_t nb_mi_size, MODE_INFO *nb_mi, + void *fun_ctxt); + +static INLINE void foreach_overlappable_nb_above(const AV1_COMMON *cm, + MACROBLOCKD *xd, int mi_col, + int nb_max, + overlappable_nb_visitor_t fun, + void *fun_ctxt) { + if (!xd->up_available) return; + + int nb_count = 0; + + // prev_row_mi points into the mi array, starting at the beginning of the + // previous row. + MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride; + const int end_col = AOMMIN(mi_col + xd->n8_w, cm->mi_cols); + uint8_t mi_step; + for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max; + above_mi_col += mi_step) { + MODE_INFO **above_mi = prev_row_mi + above_mi_col; + mi_step = AOMMIN(mi_size_wide[above_mi[0]->mbmi.sb_type], + mi_size_wide[BLOCK_64X64]); +#if CONFIG_CHROMA_SUB8X8 + // If we're considering a block with width 4, it should be treated as + // half of a pair of blocks with chroma information in the second. Move + // above_mi_col back to the start of the pair if needed, set above_mbmi + // to point at the block with chroma information, and set mi_step to 2 to + // step over the entire pair at the end of the iteration. + if (mi_step == 1) { + above_mi_col &= ~1; + above_mi = prev_row_mi + above_mi_col + 1; + mi_step = 2; + } +#endif // CONFIG_CHROMA_SUB8X8 + MB_MODE_INFO *above_mbmi = &above_mi[0]->mbmi; + if (is_neighbor_overlappable(above_mbmi)) { + ++nb_count; + fun(xd, above_mi_col - mi_col, AOMMIN(xd->n8_w, mi_step), *above_mi, + fun_ctxt); + } + } +} + +static INLINE void foreach_overlappable_nb_left(const AV1_COMMON *cm, + MACROBLOCKD *xd, int mi_row, + int nb_max, + overlappable_nb_visitor_t fun, + void *fun_ctxt) { + if (!xd->left_available) return; + + int nb_count = 0; + + // prev_col_mi points into the mi array, starting at the top of the + // previous column + MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride; + const int end_row = AOMMIN(mi_row + xd->n8_h, cm->mi_rows); + uint8_t mi_step; + for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max; + left_mi_row += mi_step) { + MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride; + mi_step = AOMMIN(mi_size_high[left_mi[0]->mbmi.sb_type], + mi_size_high[BLOCK_64X64]); +#if CONFIG_CHROMA_SUB8X8 + if (mi_step == 1) { + left_mi_row &= ~1; + left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride; + mi_step = 2; + } +#endif // CONFIG_CHROMA_SUB8X8 + MB_MODE_INFO *left_mbmi = &left_mi[0]->mbmi; + if (is_neighbor_overlappable(left_mbmi)) { + ++nb_count; + fun(xd, left_mi_row - mi_row, AOMMIN(xd->n8_h, mi_step), *left_mi, + fun_ctxt); + } + } +} + +#endif // CONFIG_MOTION_VAR +#endif // AV1_COMMON_OBMC_H_ diff --git a/third_party/aom/av1/common/od_dering.c b/third_party/aom/av1/common/od_dering.c deleted file mode 100644 index df4fb2ab5..000000000 --- a/third_party/aom/av1/common/od_dering.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include <math.h> -#include <stdlib.h> - -#ifdef HAVE_CONFIG_H -#include "./config.h" -#endif - -#include "./aom_dsp_rtcd.h" -#include "./av1_rtcd.h" -#include "./cdef.h" - -/* Generated from gen_filter_tables.c. */ -const int OD_DIRECTION_OFFSETS_TABLE[8][3] = { - { -1 * OD_FILT_BSTRIDE + 1, -2 * OD_FILT_BSTRIDE + 2, - -3 * OD_FILT_BSTRIDE + 3 }, - { 0 * OD_FILT_BSTRIDE + 1, -1 * OD_FILT_BSTRIDE + 2, - -1 * OD_FILT_BSTRIDE + 3 }, - { 0 * OD_FILT_BSTRIDE + 1, 0 * OD_FILT_BSTRIDE + 2, 0 * OD_FILT_BSTRIDE + 3 }, - { 0 * OD_FILT_BSTRIDE + 1, 1 * OD_FILT_BSTRIDE + 2, 1 * OD_FILT_BSTRIDE + 3 }, - { 1 * OD_FILT_BSTRIDE + 1, 2 * OD_FILT_BSTRIDE + 2, 3 * OD_FILT_BSTRIDE + 3 }, - { 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE + 1, 3 * OD_FILT_BSTRIDE + 1 }, - { 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE + 0, 3 * OD_FILT_BSTRIDE + 0 }, - { 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE - 1, 3 * OD_FILT_BSTRIDE - 1 }, -}; - -/* Detect direction. 0 means 45-degree up-right, 2 is horizontal, and so on. - The search minimizes the weighted variance along all the lines in a - particular direction, i.e. the squared error between the input and a - "predicted" block where each pixel is replaced by the average along a line - in a particular direction. Since each direction have the same sum(x^2) term, - that term is never computed. See Section 2, step 2, of: - http://jmvalin.ca/notes/intra_paint.pdf */ -int od_dir_find8_c(const uint16_t *img, int stride, int32_t *var, - int coeff_shift) { - int i; - int32_t cost[8] = { 0 }; - int partial[8][15] = { { 0 } }; - int32_t best_cost = 0; - int best_dir = 0; - /* Instead of dividing by n between 2 and 8, we multiply by 3*5*7*8/n. - The output is then 840 times larger, but we don't care for finding - the max. */ - static const int div_table[] = { 0, 840, 420, 280, 210, 168, 140, 120, 105 }; - for (i = 0; i < 8; i++) { - int j; - for (j = 0; j < 8; j++) { - int x; - /* We subtract 128 here to reduce the maximum range of the squared - partial sums. */ - x = (img[i * stride + j] >> coeff_shift) - 128; - partial[0][i + j] += x; - partial[1][i + j / 2] += x; - partial[2][i] += x; - partial[3][3 + i - j / 2] += x; - partial[4][7 + i - j] += x; - partial[5][3 - i / 2 + j] += x; - partial[6][j] += x; - partial[7][i / 2 + j] += x; - } - } - for (i = 0; i < 8; i++) { - cost[2] += partial[2][i] * partial[2][i]; - cost[6] += partial[6][i] * partial[6][i]; - } - cost[2] *= div_table[8]; - cost[6] *= div_table[8]; - for (i = 0; i < 7; i++) { - cost[0] += (partial[0][i] * partial[0][i] + - partial[0][14 - i] * partial[0][14 - i]) * - div_table[i + 1]; - cost[4] += (partial[4][i] * partial[4][i] + - partial[4][14 - i] * partial[4][14 - i]) * - div_table[i + 1]; - } - cost[0] += partial[0][7] * partial[0][7] * div_table[8]; - cost[4] += partial[4][7] * partial[4][7] * div_table[8]; - for (i = 1; i < 8; i += 2) { - int j; - for (j = 0; j < 4 + 1; j++) { - cost[i] += partial[i][3 + j] * partial[i][3 + j]; - } - cost[i] *= div_table[8]; - for (j = 0; j < 4 - 1; j++) { - cost[i] += (partial[i][j] * partial[i][j] + - partial[i][10 - j] * partial[i][10 - j]) * - div_table[2 * j + 2]; - } - } - for (i = 0; i < 8; i++) { - if (cost[i] > best_cost) { - best_cost = cost[i]; - best_dir = i; - } - } - /* Difference between the optimal variance and the variance along the - orthogonal direction. Again, the sum(x^2) terms cancel out. */ - *var = best_cost - cost[(best_dir + 4) & 7]; - /* We'd normally divide by 840, but dividing by 1024 is close enough - for what we're going to do with this. */ - *var >>= 10; - return best_dir; -} - -/* Smooth in the direction detected. */ -void od_filter_dering_direction_8x8_c(uint16_t *y, int ystride, - const uint16_t *in, int threshold, - int dir, int damping) { - int i; - int j; - int k; - static const int taps[3] = { 3, 2, 1 }; - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - int16_t sum; - int16_t xx; - int16_t yy; - xx = in[i * OD_FILT_BSTRIDE + j]; - sum = 0; - for (k = 0; k < 3; k++) { - int16_t p0; - int16_t p1; - p0 = in[i * OD_FILT_BSTRIDE + j + OD_DIRECTION_OFFSETS_TABLE[dir][k]] - - xx; - p1 = in[i * OD_FILT_BSTRIDE + j - OD_DIRECTION_OFFSETS_TABLE[dir][k]] - - xx; - sum += taps[k] * constrain(p0, threshold, damping); - sum += taps[k] * constrain(p1, threshold, damping); - } - sum = (sum + 8) >> 4; - yy = xx + sum; - y[i * ystride + j] = yy; - } - } -} - -/* Smooth in the direction detected. */ -void od_filter_dering_direction_4x4_c(uint16_t *y, int ystride, - const uint16_t *in, int threshold, - int dir, int damping) { - int i; - int j; - int k; - static const int taps[2] = { 4, 1 }; - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - int16_t sum; - int16_t xx; - int16_t yy; - xx = in[i * OD_FILT_BSTRIDE + j]; - sum = 0; - for (k = 0; k < 2; k++) { - int16_t p0; - int16_t p1; - p0 = in[i * OD_FILT_BSTRIDE + j + OD_DIRECTION_OFFSETS_TABLE[dir][k]] - - xx; - p1 = in[i * OD_FILT_BSTRIDE + j - OD_DIRECTION_OFFSETS_TABLE[dir][k]] - - xx; - sum += taps[k] * constrain(p0, threshold, damping); - sum += taps[k] * constrain(p1, threshold, damping); - } - sum = (sum + 8) >> 4; - yy = xx + sum; - y[i * ystride + j] = yy; - } - } -} - -/* Compute deringing filter threshold for an 8x8 block based on the - directional variance difference. A high variance difference means that we - have a highly directional pattern (e.g. a high contrast edge), so we can - apply more deringing. A low variance means that we either have a low - contrast edge, or a non-directional texture, so we want to be careful not - to blur. */ -static INLINE int od_adjust_thresh(int threshold, int32_t var) { - const int i = var >> 6 ? AOMMIN(get_msb(var >> 6), 12) : 0; - /* We use the variance of 8x8 blocks to adjust the threshold. */ - return var ? (threshold * (4 + i) + 8) >> 4 : 0; -} - -void copy_8x8_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src, - int sstride) { - int i, j; - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) dst[i * dstride + j] = src[i * sstride + j]; -} - -void copy_4x4_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src, - int sstride) { - int i, j; - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) dst[i * dstride + j] = src[i * sstride + j]; -} - -static void copy_dering_16bit_to_16bit(uint16_t *dst, int dstride, - uint16_t *src, dering_list *dlist, - int dering_count, int bsize) { - int bi, bx, by; - - if (bsize == BLOCK_8X8) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_8x8_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 3)], dstride, - &src[bi << (3 + 3)], 8); - } - } else if (bsize == BLOCK_4X8) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 2)], dstride, - &src[bi << (3 + 2)], 4); - copy_4x4_16bit_to_16bit(&dst[((by << 3) + 4) * dstride + (bx << 2)], - dstride, &src[(bi << (3 + 2)) + 4 * 4], 4); - } - } else if (bsize == BLOCK_8X4) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3)], dstride, - &src[bi << (2 + 3)], 8); - copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3) + 4], - dstride, &src[(bi << (2 + 3)) + 4], 8); - } - } else { - assert(bsize == BLOCK_4X4); - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 2)], dstride, - &src[bi << (2 + 2)], 4); - } - } -} - -void copy_8x8_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src, - int sstride) { - int i, j; - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - dst[i * dstride + j] = (uint8_t)src[i * sstride + j]; -} - -void copy_4x4_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src, - int sstride) { - int i, j; - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - dst[i * dstride + j] = (uint8_t)src[i * sstride + j]; -} - -static void copy_dering_16bit_to_8bit(uint8_t *dst, int dstride, - const uint16_t *src, dering_list *dlist, - int dering_count, int bsize) { - int bi, bx, by; - if (bsize == BLOCK_8X8) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_8x8_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 3)], dstride, - &src[bi << (3 + 3)], 8); - } - } else if (bsize == BLOCK_4X8) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 2)], dstride, - &src[bi << (3 + 2)], 4); - copy_4x4_16bit_to_8bit(&dst[((by << 3) + 4) * dstride + (bx << 2)], - dstride, &src[(bi << (3 + 2)) + 4 * 4], 4); - } - } else if (bsize == BLOCK_8X4) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3)], dstride, - &src[bi << (2 + 3)], 8); - copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3) + 4], dstride, - &src[(bi << (2 + 3)) + 4], 8); - } - } else { - assert(bsize == BLOCK_4X4); - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 2)], dstride, - &src[bi << (2 * 2)], 4); - } - } -} - -int get_filter_skip(int level) { - int filter_skip = level & 1; - if (level == 1) filter_skip = 0; - return filter_skip; -} - -void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec, - int ydec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], - int *dirinit, int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], - int pli, dering_list *dlist, int dering_count, int level, - int clpf_strength, int clpf_damping, int dering_damping, - int coeff_shift, int skip_dering, int hbd) { - int bi; - int bx; - int by; - int bsize, bsizex, bsizey; - - int threshold = (level >> 1) << coeff_shift; - int filter_skip = get_filter_skip(level); - if (level == 1) threshold = 31 << coeff_shift; - - od_filter_dering_direction_func filter_dering_direction[] = { - od_filter_dering_direction_4x4, od_filter_dering_direction_8x8 - }; - clpf_damping += coeff_shift - (pli != AOM_PLANE_Y); - dering_damping += coeff_shift - (pli != AOM_PLANE_Y); - bsize = - ydec ? (xdec ? BLOCK_4X4 : BLOCK_8X4) : (xdec ? BLOCK_4X8 : BLOCK_8X8); - bsizex = 3 - xdec; - bsizey = 3 - ydec; - - if (!skip_dering) { - if (pli == 0) { - if (!dirinit || !*dirinit) { - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - dir[by][bx] = - od_dir_find8(&in[8 * by * OD_FILT_BSTRIDE + 8 * bx], - OD_FILT_BSTRIDE, &var[by][bx], coeff_shift); - } - if (dirinit) *dirinit = 1; - } - } - // Only run dering for non-zero threshold (which is always the case for - // 4:2:2 or 4:4:0). If we don't dering, we still need to eventually write - // something out in y[] later. - if (threshold != 0) { - assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4); - for (bi = 0; bi < dering_count; bi++) { - int t = !filter_skip && dlist[bi].skip ? 0 : threshold; - by = dlist[bi].by; - bx = dlist[bi].bx; - (filter_dering_direction[bsize == BLOCK_8X8])( - &y[bi << (bsizex + bsizey)], 1 << bsizex, - &in[(by * OD_FILT_BSTRIDE << bsizey) + (bx << bsizex)], - pli ? t : od_adjust_thresh(t, var[by][bx]), dir[by][bx], - dering_damping); - } - } - } - - if (clpf_strength) { - if (threshold && !skip_dering) - copy_dering_16bit_to_16bit(in, OD_FILT_BSTRIDE, y, dlist, dering_count, - bsize); - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - int py = by << bsizey; - int px = bx << bsizex; - - if (!filter_skip && dlist[bi].skip) continue; - if (!dst || hbd) { - // 16 bit destination if high bitdepth or 8 bit destination not given - (!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd - : aom_clpf_hblock_hbd)( - dst ? (uint16_t *)dst + py * dstride + px - : &y[bi << (bsizex + bsizey)], - in + py * OD_FILT_BSTRIDE + px, dst && hbd ? dstride : 1 << bsizex, - OD_FILT_BSTRIDE, 1 << bsizex, 1 << bsizey, - clpf_strength << coeff_shift, clpf_damping); - } else { - // Do clpf and write the result to an 8 bit destination - (!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block - : aom_clpf_hblock)( - dst + py * dstride + px, in + py * OD_FILT_BSTRIDE + px, dstride, - OD_FILT_BSTRIDE, 1 << bsizex, 1 << bsizey, - clpf_strength << coeff_shift, clpf_damping); - } - } - } else if (threshold != 0) { - // No clpf, so copy instead - if (hbd) { - copy_dering_16bit_to_16bit((uint16_t *)dst, dstride, y, dlist, - dering_count, bsize); - } else { - copy_dering_16bit_to_8bit(dst, dstride, y, dlist, dering_count, bsize); - } - } else if (dirinit) { - // If we're here, both dering and clpf are off, and we still haven't written - // anything to y[] yet, so we just copy the input to y[]. This is necessary - // only for av1_cdef_search() and only av1_cdef_search() sets dirinit. - for (bi = 0; bi < dering_count; bi++) { - by = dlist[bi].by; - bx = dlist[bi].bx; - int iy, ix; - // TODO(stemidts/jmvalin): SIMD optimisations - for (iy = 0; iy < 1 << bsizey; iy++) - for (ix = 0; ix < 1 << bsizex; ix++) - y[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] = - in[((by << bsizey) + iy) * OD_FILT_BSTRIDE + (bx << bsizex) + ix]; - } - } -} diff --git a/third_party/aom/av1/common/od_dering.h b/third_party/aom/av1/common/od_dering.h deleted file mode 100644 index 031112b32..000000000 --- a/third_party/aom/av1/common/od_dering.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#if !defined(_dering_H) -#define _dering_H (1) - -#include "odintrin.h" - -#define OD_DERING_NBLOCKS (MAX_SB_SIZE / 8) - -/* We need to buffer three vertical lines. */ -#define OD_FILT_VBORDER (3) -/* We only need to buffer three horizontal pixels too, but let's align to - 16 bytes (8 x 16 bits) to make vectorization easier. */ -#define OD_FILT_HBORDER (8) -#define OD_FILT_BSTRIDE ALIGN_POWER_OF_TWO(MAX_SB_SIZE + 2 * OD_FILT_HBORDER, 3) - -#define OD_DERING_VERY_LARGE (30000) -#define OD_DERING_INBUF_SIZE \ - (OD_FILT_BSTRIDE * (MAX_SB_SIZE + 2 * OD_FILT_VBORDER)) - -extern const int OD_DIRECTION_OFFSETS_TABLE[8][3]; - -typedef struct { - uint8_t by; - uint8_t bx; - uint8_t skip; -} dering_list; - -typedef void (*od_filter_dering_direction_func)(uint16_t *y, int ystride, - const uint16_t *in, - int threshold, int dir, - int damping); - -int get_filter_skip(int level); - -void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec, - int ydec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], - int *dirinit, int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], - int pli, dering_list *dlist, int dering_count, int level, - int clpf_strength, int clpf_damping, int dering_damping, - int coeff_shift, int skip_dering, int hbd); -#endif diff --git a/third_party/aom/av1/common/od_dering_simd.h b/third_party/aom/av1/common/od_dering_simd.h deleted file mode 100644 index 4074e7e50..000000000 --- a/third_party/aom/av1/common/od_dering_simd.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2016, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 2 Clause License and - * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License - * was not distributed with this source code in the LICENSE file, you can - * obtain it at www.aomedia.org/license/software. If the Alliance for Open - * Media Patent License 1.0 was not distributed with this source code in the - * PATENTS file, you can obtain it at www.aomedia.org/license/patent. - */ - -#include "./av1_rtcd.h" -#include "./cdef_simd.h" -#include "./od_dering.h" - -/* partial A is a 16-bit vector of the form: - [x8 x7 x6 x5 x4 x3 x2 x1] and partial B has the form: - [0 y1 y2 y3 y4 y5 y6 y7]. - This function computes (x1^2+y1^2)*C1 + (x2^2+y2^2)*C2 + ... - (x7^2+y2^7)*C7 + (x8^2+0^2)*C8 where the C1..C8 constants are in const1 - and const2. */ -static INLINE v128 fold_mul_and_sum(v128 partiala, v128 partialb, v128 const1, - v128 const2) { - v128 tmp; - /* Reverse partial B. */ - partialb = v128_shuffle_8( - partialb, v128_from_32(0x0f0e0100, 0x03020504, 0x07060908, 0x0b0a0d0c)); - /* Interleave the x and y values of identical indices and pair x8 with 0. */ - tmp = partiala; - partiala = v128_ziplo_16(partialb, partiala); - partialb = v128_ziphi_16(partialb, tmp); - /* Square and add the corresponding x and y values. */ - partiala = v128_madd_s16(partiala, partiala); - partialb = v128_madd_s16(partialb, partialb); - /* Multiply by constant. */ - partiala = v128_mullo_s32(partiala, const1); - partialb = v128_mullo_s32(partialb, const2); - /* Sum all results. */ - partiala = v128_add_32(partiala, partialb); - return partiala; -} - -static INLINE v128 hsum4(v128 x0, v128 x1, v128 x2, v128 x3) { - v128 t0, t1, t2, t3; - t0 = v128_ziplo_32(x1, x0); - t1 = v128_ziplo_32(x3, x2); - t2 = v128_ziphi_32(x1, x0); - t3 = v128_ziphi_32(x3, x2); - x0 = v128_ziplo_64(t1, t0); - x1 = v128_ziphi_64(t1, t0); - x2 = v128_ziplo_64(t3, t2); - x3 = v128_ziphi_64(t3, t2); - return v128_add_32(v128_add_32(x0, x1), v128_add_32(x2, x3)); -} - -/* Computes cost for directions 0, 5, 6 and 7. We can call this function again - to compute the remaining directions. */ -static INLINE v128 compute_directions(v128 lines[8], int32_t tmp_cost1[4]) { - v128 partial4a, partial4b, partial5a, partial5b, partial7a, partial7b; - v128 partial6; - v128 tmp; - /* Partial sums for lines 0 and 1. */ - partial4a = v128_shl_n_byte(lines[0], 14); - partial4b = v128_shr_n_byte(lines[0], 2); - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[1], 12)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[1], 4)); - tmp = v128_add_16(lines[0], lines[1]); - partial5a = v128_shl_n_byte(tmp, 10); - partial5b = v128_shr_n_byte(tmp, 6); - partial7a = v128_shl_n_byte(tmp, 4); - partial7b = v128_shr_n_byte(tmp, 12); - partial6 = tmp; - - /* Partial sums for lines 2 and 3. */ - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[2], 10)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[2], 6)); - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[3], 8)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[3], 8)); - tmp = v128_add_16(lines[2], lines[3]); - partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 8)); - partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 8)); - partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 6)); - partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 10)); - partial6 = v128_add_16(partial6, tmp); - - /* Partial sums for lines 4 and 5. */ - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[4], 6)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[4], 10)); - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[5], 4)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[5], 12)); - tmp = v128_add_16(lines[4], lines[5]); - partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 6)); - partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 10)); - partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 8)); - partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 8)); - partial6 = v128_add_16(partial6, tmp); - - /* Partial sums for lines 6 and 7. */ - partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[6], 2)); - partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[6], 14)); - partial4a = v128_add_16(partial4a, lines[7]); - tmp = v128_add_16(lines[6], lines[7]); - partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 4)); - partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 12)); - partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 10)); - partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 6)); - partial6 = v128_add_16(partial6, tmp); - - /* Compute costs in terms of partial sums. */ - partial4a = - fold_mul_and_sum(partial4a, partial4b, v128_from_32(210, 280, 420, 840), - v128_from_32(105, 120, 140, 168)); - partial7a = - fold_mul_and_sum(partial7a, partial7b, v128_from_32(210, 420, 0, 0), - v128_from_32(105, 105, 105, 140)); - partial5a = - fold_mul_and_sum(partial5a, partial5b, v128_from_32(210, 420, 0, 0), - v128_from_32(105, 105, 105, 140)); - partial6 = v128_madd_s16(partial6, partial6); - partial6 = v128_mullo_s32(partial6, v128_dup_32(105)); - - partial4a = hsum4(partial4a, partial5a, partial6, partial7a); - v128_store_unaligned(tmp_cost1, partial4a); - return partial4a; -} - -/* transpose and reverse the order of the lines -- equivalent to a 90-degree - counter-clockwise rotation of the pixels. */ -static INLINE void array_reverse_transpose_8x8(v128 *in, v128 *res) { - const v128 tr0_0 = v128_ziplo_16(in[1], in[0]); - const v128 tr0_1 = v128_ziplo_16(in[3], in[2]); - const v128 tr0_2 = v128_ziphi_16(in[1], in[0]); - const v128 tr0_3 = v128_ziphi_16(in[3], in[2]); - const v128 tr0_4 = v128_ziplo_16(in[5], in[4]); - const v128 tr0_5 = v128_ziplo_16(in[7], in[6]); - const v128 tr0_6 = v128_ziphi_16(in[5], in[4]); - const v128 tr0_7 = v128_ziphi_16(in[7], in[6]); - - const v128 tr1_0 = v128_ziplo_32(tr0_1, tr0_0); - const v128 tr1_1 = v128_ziplo_32(tr0_5, tr0_4); - const v128 tr1_2 = v128_ziphi_32(tr0_1, tr0_0); - const v128 tr1_3 = v128_ziphi_32(tr0_5, tr0_4); - const v128 tr1_4 = v128_ziplo_32(tr0_3, tr0_2); - const v128 tr1_5 = v128_ziplo_32(tr0_7, tr0_6); - const v128 tr1_6 = v128_ziphi_32(tr0_3, tr0_2); - const v128 tr1_7 = v128_ziphi_32(tr0_7, tr0_6); - - res[7] = v128_ziplo_64(tr1_1, tr1_0); - res[6] = v128_ziphi_64(tr1_1, tr1_0); - res[5] = v128_ziplo_64(tr1_3, tr1_2); - res[4] = v128_ziphi_64(tr1_3, tr1_2); - res[3] = v128_ziplo_64(tr1_5, tr1_4); - res[2] = v128_ziphi_64(tr1_5, tr1_4); - res[1] = v128_ziplo_64(tr1_7, tr1_6); - res[0] = v128_ziphi_64(tr1_7, tr1_6); -} - -int SIMD_FUNC(od_dir_find8)(const od_dering_in *img, int stride, int32_t *var, - int coeff_shift) { - int i; - int32_t cost[8]; - int32_t best_cost = 0; - int best_dir = 0; - v128 lines[8]; - for (i = 0; i < 8; i++) { - lines[i] = v128_load_unaligned(&img[i * stride]); - lines[i] = - v128_sub_16(v128_shr_s16(lines[i], coeff_shift), v128_dup_16(128)); - } - -#if defined(__SSE4_1__) - /* Compute "mostly vertical" directions. */ - __m128i dir47 = compute_directions(lines, cost + 4); - - array_reverse_transpose_8x8(lines, lines); - - /* Compute "mostly horizontal" directions. */ - __m128i dir03 = compute_directions(lines, cost); - - __m128i max = _mm_max_epi32(dir03, dir47); - max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(1, 0, 3, 2))); - max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(2, 3, 0, 1))); - best_cost = _mm_cvtsi128_si32(max); - __m128i t = - _mm_packs_epi32(_mm_cmpeq_epi32(max, dir03), _mm_cmpeq_epi32(max, dir47)); - best_dir = _mm_movemask_epi8(_mm_packs_epi16(t, t)); - best_dir = get_msb(best_dir ^ (best_dir - 1)); // Count trailing zeros -#else - /* Compute "mostly vertical" directions. */ - compute_directions(lines, cost + 4); - - array_reverse_transpose_8x8(lines, lines); - - /* Compute "mostly horizontal" directions. */ - compute_directions(lines, cost); - - for (i = 0; i < 8; i++) { - if (cost[i] > best_cost) { - best_cost = cost[i]; - best_dir = i; - } - } -#endif - - /* Difference between the optimal variance and the variance along the - orthogonal direction. Again, the sum(x^2) terms cancel out. */ - *var = best_cost - cost[(best_dir + 4) & 7]; - /* We'd normally divide by 840, but dividing by 1024 is close enough - for what we're going to do with this. */ - *var >>= 10; - return best_dir; -} - -void SIMD_FUNC(od_filter_dering_direction_4x4)(uint16_t *y, int ystride, - const uint16_t *in, - int threshold, int dir, - int damping) { - int i; - v128 p0, p1, sum, row, res; - int o1 = OD_DIRECTION_OFFSETS_TABLE[dir][0]; - int o2 = OD_DIRECTION_OFFSETS_TABLE[dir][1]; - - if (threshold) damping -= get_msb(threshold); - for (i = 0; i < 4; i += 2) { - sum = v128_zero(); - row = v128_from_v64(v64_load_aligned(&in[i * OD_FILT_BSTRIDE]), - v64_load_aligned(&in[(i + 1) * OD_FILT_BSTRIDE])); - - // p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping) - p0 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE + o1]), - v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE + o1])); - p0 = constrain16(p0, row, threshold, damping); - - // p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping) - p1 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE - o1]), - v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE - o1])); - p1 = constrain16(p1, row, threshold, damping); - - // sum += 4 * (p0 + p1) - sum = v128_add_16(sum, v128_shl_n_16(v128_add_16(p0, p1), 2)); - - // p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping) - p0 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE + o2]), - v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE + o2])); - p0 = constrain16(p0, row, threshold, damping); - - // p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping) - p1 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE - o2]), - v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE - o2])); - p1 = constrain16(p1, row, threshold, damping); - - // sum += 1 * (p0 + p1) - sum = v128_add_16(sum, v128_add_16(p0, p1)); - - // res = row + ((sum + 8) >> 4) - res = v128_add_16(sum, v128_dup_16(8)); - res = v128_shr_n_s16(res, 4); - res = v128_add_16(row, res); - v64_store_aligned(&y[i * ystride], v128_high_v64(res)); - v64_store_aligned(&y[(i + 1) * ystride], v128_low_v64(res)); - } -} - -void SIMD_FUNC(od_filter_dering_direction_8x8)(uint16_t *y, int ystride, - const uint16_t *in, - int threshold, int dir, - int damping) { - int i; - v128 sum, p0, p1, row, res; - int o1 = OD_DIRECTION_OFFSETS_TABLE[dir][0]; - int o2 = OD_DIRECTION_OFFSETS_TABLE[dir][1]; - int o3 = OD_DIRECTION_OFFSETS_TABLE[dir][2]; - - if (threshold) damping -= get_msb(threshold); - for (i = 0; i < 8; i++) { - sum = v128_zero(); - row = v128_load_aligned(&in[i * OD_FILT_BSTRIDE]); - - // p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping) - p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o1]); - p0 = constrain16(p0, row, threshold, damping); - - // p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping) - p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o1]); - p1 = constrain16(p1, row, threshold, damping); - - // sum += 3 * (p0 + p1) - p0 = v128_add_16(p0, p1); - p0 = v128_add_16(p0, v128_shl_n_16(p0, 1)); - sum = v128_add_16(sum, p0); - - // p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping) - p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o2]); - p0 = constrain16(p0, row, threshold, damping); - - // p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping) - p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o2]); - p1 = constrain16(p1, row, threshold, damping); - - // sum += 2 * (p0 + p1) - p0 = v128_shl_n_16(v128_add_16(p0, p1), 1); - sum = v128_add_16(sum, p0); - - // p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping) - p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o3]); - p0 = constrain16(p0, row, threshold, damping); - - // p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping) - p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o3]); - p1 = constrain16(p1, row, threshold, damping); - - // sum += (p0 + p1) - p0 = v128_add_16(p0, p1); - sum = v128_add_16(sum, p0); - - // res = row + ((sum + 8) >> 4) - res = v128_add_16(sum, v128_dup_16(8)); - res = v128_shr_n_s16(res, 4); - res = v128_add_16(row, res); - v128_store_unaligned(&y[i * ystride], res); - } -} - -void SIMD_FUNC(copy_8x8_16bit_to_8bit)(uint8_t *dst, int dstride, - const uint16_t *src, int sstride) { - int i; - for (i = 0; i < 8; i++) { - v128 row = v128_load_unaligned(&src[i * sstride]); - row = v128_pack_s16_u8(row, row); - v64_store_unaligned(&dst[i * dstride], v128_low_v64(row)); - } -} - -void SIMD_FUNC(copy_4x4_16bit_to_8bit)(uint8_t *dst, int dstride, - const uint16_t *src, int sstride) { - int i; - for (i = 0; i < 4; i++) { - v128 row = v128_load_unaligned(&src[i * sstride]); - row = v128_pack_s16_u8(row, row); - u32_store_unaligned(&dst[i * dstride], v128_low_u32(row)); - } -} - -void SIMD_FUNC(copy_8x8_16bit_to_16bit)(uint16_t *dst, int dstride, - const uint16_t *src, int sstride) { - int i; - for (i = 0; i < 8; i++) { - v128 row = v128_load_unaligned(&src[i * sstride]); - v128_store_unaligned(&dst[i * dstride], row); - } -} - -void SIMD_FUNC(copy_4x4_16bit_to_16bit)(uint16_t *dst, int dstride, - const uint16_t *src, int sstride) { - int i; - for (i = 0; i < 4; i++) { - v64 row = v64_load_unaligned(&src[i * sstride]); - v64_store_unaligned(&dst[i * dstride], row); - } -} - -void SIMD_FUNC(copy_rect8_8bit_to_16bit)(uint16_t *dst, int dstride, - const uint8_t *src, int sstride, int v, - int h) { - int i, j; - for (i = 0; i < v; i++) { - for (j = 0; j < (h & ~0x7); j += 8) { - v64 row = v64_load_unaligned(&src[i * sstride + j]); - v128_store_unaligned(&dst[i * dstride + j], v128_unpack_u8_s16(row)); - } - for (; j < h; j++) { - dst[i * dstride + j] = src[i * sstride + j]; - } - } -} - -void SIMD_FUNC(copy_rect8_16bit_to_16bit)(uint16_t *dst, int dstride, - const uint16_t *src, int sstride, - int v, int h) { - int i, j; - for (i = 0; i < v; i++) { - for (j = 0; j < (h & ~0x7); j += 8) { - v128 row = v128_load_unaligned(&src[i * sstride + j]); - v128_store_unaligned(&dst[i * dstride + j], row); - } - for (; j < h; j++) { - dst[i * dstride + j] = src[i * sstride + j]; - } - } -} diff --git a/third_party/aom/av1/common/onyxc_int.h b/third_party/aom/av1/common/onyxc_int.h index 8647e113b..2396ce2f3 100644 --- a/third_party/aom/av1/common/onyxc_int.h +++ b/third_party/aom/av1/common/onyxc_int.h @@ -38,6 +38,10 @@ #if CONFIG_CFL #include "av1/common/cfl.h" #endif +#if CONFIG_HASH_ME +// TODO(youzhou@microsoft.com): Encoder only. Move it out of common +#include "av1/encoder/hash_motion.h" +#endif #ifdef __cplusplus extern "C" { #endif @@ -60,7 +64,13 @@ extern "C" { #define FRAME_ID_NUMBERS_PRESENT_FLAG 1 #define FRAME_ID_LENGTH_MINUS7 8 // Allows frame id up to 2^15-1 #define DELTA_FRAME_ID_LENGTH_MINUS2 12 // Allows frame id deltas up to 2^14-1 -#endif +#endif // CONFIG_REFERENCE_BUFFER + +#if CONFIG_NO_FRAME_CONTEXT_SIGNALING +#define FRAME_CONTEXTS (FRAME_BUFFERS + 1) +// Extra frame context which is always kept at default values +#define FRAME_CONTEXT_DEFAULTS (FRAME_CONTEXTS - 1) +#else #if CONFIG_EXT_REFS #define FRAME_CONTEXTS_LOG2 3 @@ -69,6 +79,7 @@ extern "C" { #endif #define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2) +#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING #define NUM_PING_PONG_BUFFERS 2 @@ -79,11 +90,13 @@ typedef enum { REFERENCE_MODES = 3, } REFERENCE_MODE; +#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING typedef enum { RESET_FRAME_CONTEXT_NONE = 0, RESET_FRAME_CONTEXT_CURRENT = 1, RESET_FRAME_CONTEXT_ALL = 2, } RESET_FRAME_CONTEXT_MODE; +#endif typedef enum { /** @@ -98,6 +111,14 @@ typedef enum { REFRESH_FRAME_CONTEXT_BACKWARD, } REFRESH_FRAME_CONTEXT_MODE; +#if CONFIG_MFMV +#define MFMV_STACK_SIZE INTER_REFS_PER_FRAME + +typedef struct { + int_mv mfmv[INTER_REFS_PER_FRAME][MFMV_STACK_SIZE]; +} TPL_MV_REF; +#endif + typedef struct { int_mv mv[2]; int_mv pred_mv[2]; @@ -106,14 +127,38 @@ typedef struct { typedef struct { int ref_count; + +#if CONFIG_FRAME_MARKER + int cur_frame_offset; + int lst_frame_offset; + int alt_frame_offset; + int gld_frame_offset; +#if CONFIG_EXT_REFS + int lst2_frame_offset; + int lst3_frame_offset; + int bwd_frame_offset; + int alt2_frame_offset; +#endif +#endif // CONFIG_FRAME_MARKER + +#if CONFIG_MFMV + TPL_MV_REF *tpl_mvs; +#endif MV_REF *mvs; int mi_rows; int mi_cols; + // Width and height give the size of the buffer (before any upscaling, unlike + // the sizes that can be derived from the buf structure) + int width; + int height; #if CONFIG_GLOBAL_MOTION WarpedMotionParams global_motion[TOTAL_REFS_PER_FRAME]; #endif // CONFIG_GLOBAL_MOTION aom_codec_frame_buffer_t raw_frame_buffer; YV12_BUFFER_CONFIG buf; +#if CONFIG_HASH_ME + hash_table hash_table; +#endif #if CONFIG_TEMPMV_SIGNALING uint8_t intra_only; #endif @@ -150,13 +195,29 @@ typedef struct BufferPool { InternalFrameBufferList int_frame_buffers; } BufferPool; +#if CONFIG_LV_MAP +typedef struct { + int base_ctx_table[2 /*row*/][2 /*col*/][2 /*sig_map*/] + [BASE_CONTEXT_POSITION_NUM + 1]; +} LV_MAP_CTX_TABLE; +typedef int BASE_CTX_TABLE[2 /*col*/][2 /*sig_map*/] + [BASE_CONTEXT_POSITION_NUM + 1]; +#endif + +#if CONFIG_REFERENCE_BUFFER +/* Initial version of sequence header structure */ +typedef struct SequenceHeader { + int frame_id_numbers_present_flag; + int frame_id_length_minus7; + int delta_frame_id_length_minus2; +} SequenceHeader; +#endif // CONFIG_REFERENCE_BUFFER + typedef struct AV1Common { struct aom_internal_error_info error; aom_color_space_t color_space; -#if CONFIG_COLORSPACE_HEADERS aom_transfer_function_t transfer_function; aom_chroma_sample_position_t chroma_sample_position; -#endif int color_range; int width; int height; @@ -211,21 +272,24 @@ typedef struct AV1Common { uint8_t last_intra_only; int allow_high_precision_mv; +#if CONFIG_AMVR + int seq_mv_precision_level; // 0 the default in AOM, 1 only integer, 2 + // adaptive + int cur_frame_mv_precision_level; // 0 the default in AOM, 1 only integer +#endif -#if CONFIG_PALETTE || CONFIG_INTRABC int allow_screen_content_tools; -#endif // CONFIG_PALETTE || CONFIG_INTRABC -#if CONFIG_EXT_INTER #if CONFIG_INTERINTRA int allow_interintra_compound; #endif // CONFIG_INTERINTRA #if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT int allow_masked_compound; #endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT -#endif // CONFIG_EXT_INTER +#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING // Flag signaling which frame contexts should be reset to default values. RESET_FRAME_CONTEXT_MODE reset_frame_context; +#endif // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in // MODE_INFO (8-pixel) units. @@ -304,9 +368,8 @@ typedef struct AV1Common { loop_filter_info_n lf_info; #if CONFIG_FRAME_SUPERRES - // The numerator of the superres scale; the denominator is fixed. - uint8_t superres_scale_numerator; - uint8_t superres_kf_scale_numerator; + // The denominator of the superres scale; the numerator is fixed. + uint8_t superres_scale_denominator; int superres_upscaled_width; int superres_upscaled_height; #endif // CONFIG_FRAME_SUPERRES @@ -343,9 +406,15 @@ typedef struct AV1Common { FRAME_CONTEXT *fc; /* this frame entropy */ FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS FRAME_CONTEXT *pre_fc; // Context referenced in this frame +#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING unsigned int frame_context_idx; /* Context to use/update */ +#endif FRAME_COUNTS counts; +#if CONFIG_FRAME_MARKER + unsigned int frame_offset; +#endif + unsigned int current_video_frame; BITSTREAM_PROFILE profile; @@ -355,9 +424,30 @@ typedef struct AV1Common { int error_resilient_mode; - int log2_tile_cols, log2_tile_rows; // Used in non-large_scale_tile_coding. int tile_cols, tile_rows; - int tile_width, tile_height; // In MI units + int last_tile_cols, last_tile_rows; + +#if CONFIG_MAX_TILE + int min_log2_tile_cols; + int max_log2_tile_cols; + int max_log2_tile_rows; + int min_log2_tile_rows; + int min_log2_tiles; + int max_tile_width_sb; + int max_tile_height_sb; + int uniform_tile_spacing_flag; + int log2_tile_cols; // only valid for uniform tiles + int log2_tile_rows; // only valid for uniform tiles + int tile_col_start_sb[MAX_TILE_COLS + 1]; // valid for 0 <= i <= tile_cols + int tile_row_start_sb[MAX_TILE_ROWS + 1]; // valid for 0 <= i <= tile_rows +#if CONFIG_DEPENDENT_HORZTILES + int tile_row_independent[MAX_TILE_ROWS]; // valid for 0 <= i < tile_rows +#endif +#else + int log2_tile_cols, log2_tile_rows; // Used in non-large_scale_tile_coding. + int tile_width, tile_height; // In MI units +#endif // CONFIG_MAX_TILE + #if CONFIG_EXT_TILE unsigned int large_scale_tile; unsigned int single_tile_decoding; @@ -407,15 +497,14 @@ typedef struct AV1Common { int mib_size; // Size of the superblock in units of MI blocks int mib_size_log2; // Log 2 of above. #if CONFIG_CDEF - int cdef_dering_damping; - int cdef_clpf_damping; + int cdef_pri_damping; + int cdef_sec_damping; int nb_cdef_strengths; int cdef_strengths[CDEF_MAX_STRENGTHS]; int cdef_uv_strengths[CDEF_MAX_STRENGTHS]; int cdef_bits; #endif -#if CONFIG_DELTA_Q int delta_q_present_flag; // Resolution of delta quant int delta_q_res; @@ -423,29 +512,39 @@ typedef struct AV1Common { int delta_lf_present_flag; // Resolution of delta lf level int delta_lf_res; -#endif +#if CONFIG_LOOPFILTER_LEVEL + // This is a flag for number of deltas of loop filter level + // 0: use 1 delta, for y_vertical, y_horizontal, u, and v + // 1: use separate deltas for each filter level + int delta_lf_multi; +#endif // CONFIG_LOOPFILTER_LEVEL #endif int num_tg; #if CONFIG_REFERENCE_BUFFER + SequenceHeader seq_params; int current_frame_id; int ref_frame_id[REF_FRAMES]; int valid_for_referencing[REF_FRAMES]; int refresh_mask; int invalid_delta_frame_id_minus1; -#endif +#endif // CONFIG_REFERENCE_BUFFER #if CONFIG_ANS && ANS_MAX_SYMBOLS int ans_window_size_log2; #endif -} AV1_COMMON; - -#if CONFIG_REFERENCE_BUFFER -/* Initial version of sequence header structure */ -typedef struct SequenceHeader { - int frame_id_numbers_present_flag; - int frame_id_length_minus7; - int delta_frame_id_length_minus2; -} SequenceHeader; +#if CONFIG_NCOBMC_ADAPT_WEIGHT + NCOBMC_KERNELS ncobmc_kernels[ADAPT_OVERLAP_BLOCKS][ALL_NCOBMC_MODES]; + uint8_t *ncobmcaw_buf[4]; +#endif +#if CONFIG_LV_MAP + LV_MAP_CTX_TABLE coeff_ctx_table; +#endif +#if CONFIG_LPF_SB + int final_lpf_encode; #endif +#if CONFIG_ADAPT_SCAN + int use_adapt_scan; +#endif +} AV1_COMMON; // TODO(hkuang): Don't need to lock the whole pool after implementing atomic // frame reference count. @@ -507,15 +606,57 @@ static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { bufs[new_idx].ref_count++; } +#if CONFIG_TEMPMV_SIGNALING +// Returns 1 if this frame might use mvs from some previous frame. This +// function doesn't consider whether prev_frame is actually suitable (see +// frame_can_use_prev_frame_mvs for that) +static INLINE int frame_might_use_prev_frame_mvs(const AV1_COMMON *cm) { + return !cm->error_resilient_mode && !cm->intra_only; +} + +// Returns 1 if this frame really can use MVs from some previous frame. +static INLINE int frame_can_use_prev_frame_mvs(const AV1_COMMON *cm) { + return (frame_might_use_prev_frame_mvs(cm) && cm->last_show_frame && + cm->prev_frame && !cm->prev_frame->intra_only && + cm->width == cm->prev_frame->width && + cm->height == cm->prev_frame->height); +} +#endif + +static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) { + if (buf->mvs == NULL || buf->mi_rows < cm->mi_rows || + buf->mi_cols < cm->mi_cols) { + aom_free(buf->mvs); + buf->mi_rows = cm->mi_rows; + buf->mi_cols = cm->mi_cols; +#if CONFIG_TMV + CHECK_MEM_ERROR(cm, buf->mvs, + (MV_REF *)aom_calloc( + ((cm->mi_rows + 1) >> 1) * ((cm->mi_cols + 1) >> 1), + sizeof(*buf->mvs))); +#else + CHECK_MEM_ERROR( + cm, buf->mvs, + (MV_REF *)aom_calloc(cm->mi_rows * cm->mi_cols, sizeof(*buf->mvs))); +#endif // CONFIG_TMV + +#if CONFIG_MFMV + aom_free(buf->tpl_mvs); + CHECK_MEM_ERROR( + cm, buf->tpl_mvs, + (TPL_MV_REF *)aom_calloc((cm->mi_rows + MAX_MIB_SIZE) * cm->mi_stride, + sizeof(*buf->tpl_mvs))); +#endif + } +} + #if CONFIG_VAR_REFS #define LAST_IS_VALID(cm) ((cm)->frame_refs[LAST_FRAME - 1].is_valid) #define LAST2_IS_VALID(cm) ((cm)->frame_refs[LAST2_FRAME - 1].is_valid) #define LAST3_IS_VALID(cm) ((cm)->frame_refs[LAST3_FRAME - 1].is_valid) #define GOLDEN_IS_VALID(cm) ((cm)->frame_refs[GOLDEN_FRAME - 1].is_valid) #define BWDREF_IS_VALID(cm) ((cm)->frame_refs[BWDREF_FRAME - 1].is_valid) -#if CONFIG_ALTREF2 #define ALTREF2_IS_VALID(cm) ((cm)->frame_refs[ALTREF2_FRAME - 1].is_valid) -#endif // CONFIG_ALTREF2 #define ALTREF_IS_VALID(cm) ((cm)->frame_refs[ALTREF_FRAME - 1].is_valid) #define L_OR_L2(cm) (LAST_IS_VALID(cm) || LAST2_IS_VALID(cm)) @@ -526,10 +667,8 @@ static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { #define L3_OR_G(cm) (LAST3_IS_VALID(cm) || GOLDEN_IS_VALID(cm)) #define L3_AND_G(cm) (LAST3_IS_VALID(cm) && GOLDEN_IS_VALID(cm)) -#if CONFIG_ALTREF2 #define BWD_OR_ALT2(cm) (BWDREF_IS_VALID(cm) || ALTREF2_IS_VALID(cm)) #define BWD_AND_ALT2(cm) (BWDREF_IS_VALID(cm) && ALTREF2_IS_VALID(cm)) -#endif // CONFIG_ALTREF2 #define BWD_OR_ALT(cm) (BWDREF_IS_VALID(cm) || ALTREF_IS_VALID(cm)) #define BWD_AND_ALT(cm) (BWDREF_IS_VALID(cm) && ALTREF_IS_VALID(cm)) #endif // CONFIG_VAR_REFS @@ -546,6 +685,15 @@ static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) { return cm->frame_type == KEY_FRAME || cm->intra_only; } +#if CONFIG_CFL +#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG +static INLINE void cfl_clear_sub8x8_val(CFL_CTX *cfl) { + memset(cfl->sub8x8_val, 0, sizeof(cfl->sub8x8_val)); +} +#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG +void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm); +#endif // CONFIG_CFL + static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd, #if CONFIG_PVQ tran_low_t *pvq_ref_coeff, @@ -602,11 +750,12 @@ static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { for (i = 0; i < MAX_MB_PLANE; ++i) { struct macroblockd_plane *const pd = &xd->plane[i]; #if CONFIG_CHROMA_SUB8X8 - if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) { - // Offset the buffer pointer - if (pd->subsampling_y && (mi_row & 0x01)) row_offset = mi_row - 1; - if (pd->subsampling_x && (mi_col & 0x01)) col_offset = mi_col - 1; - } + // Offset the buffer pointer + const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + if (pd->subsampling_y && (mi_row & 0x01) && (mi_size_high[bsize] == 1)) + row_offset = mi_row - 1; + if (pd->subsampling_x && (mi_col & 0x01) && (mi_size_wide[bsize] == 1)) + col_offset = mi_col - 1; #endif int above_idx = col_offset << (MI_SIZE_LOG2 - tx_size_wide_log2[0]); int left_idx = (row_offset & MAX_MIB_MASK) @@ -713,7 +862,14 @@ static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx, int block) { const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, block); const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block); + +#if CONFIG_KF_CTX + int above_ctx = intra_mode_context[above]; + int left_ctx = intra_mode_context[left]; + return tile_ctx->kf_y_cdf[above_ctx][left_ctx]; +#else return tile_ctx->kf_y_cdf[above][left]; +#endif } static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, @@ -796,14 +952,54 @@ static INLINE BLOCK_SIZE scale_chroma_bsize(BLOCK_SIZE bsize, int subsampling_x, } #endif +static INLINE aom_cdf_prob cdf_element_prob(const aom_cdf_prob *cdf, + size_t element) { + assert(cdf != NULL); +#if !CONFIG_ANS + return (element > 0 ? cdf[element - 1] : CDF_PROB_TOP) - cdf[element]; +#else + return cdf[element] - (element > 0 ? cdf[element - 1] : 0); +#endif +} + +static INLINE void partition_gather_horz_alike(aom_cdf_prob *out, + const aom_cdf_prob *const in) { + out[0] = CDF_PROB_TOP; + out[0] -= cdf_element_prob(in, PARTITION_HORZ); + out[0] -= cdf_element_prob(in, PARTITION_SPLIT); +#if CONFIG_EXT_PARTITION_TYPES + out[0] -= cdf_element_prob(in, PARTITION_HORZ_A); + out[0] -= cdf_element_prob(in, PARTITION_HORZ_B); + out[0] -= cdf_element_prob(in, PARTITION_VERT_A); +#endif + out[0] = AOM_ICDF(out[0]); + out[1] = AOM_ICDF(CDF_PROB_TOP); +} + +static INLINE void partition_gather_vert_alike(aom_cdf_prob *out, + const aom_cdf_prob *const in) { + out[0] = CDF_PROB_TOP; + out[0] -= cdf_element_prob(in, PARTITION_VERT); + out[0] -= cdf_element_prob(in, PARTITION_SPLIT); +#if CONFIG_EXT_PARTITION_TYPES + out[0] -= cdf_element_prob(in, PARTITION_HORZ_A); + out[0] -= cdf_element_prob(in, PARTITION_VERT_A); + out[0] -= cdf_element_prob(in, PARTITION_VERT_B); +#endif + out[0] = AOM_ICDF(out[0]); + out[1] = AOM_ICDF(CDF_PROB_TOP); +} + #if CONFIG_EXT_PARTITION_TYPES static INLINE void update_ext_partition_context(MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE subsize, BLOCK_SIZE bsize, PARTITION_TYPE partition) { if (bsize >= BLOCK_8X8) { +#if !CONFIG_EXT_PARTITION_TYPES_AB const int hbs = mi_size_wide[bsize] / 2; BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT); +#endif switch (partition) { case PARTITION_SPLIT: if (bsize != BLOCK_8X8) break; @@ -814,6 +1010,30 @@ static INLINE void update_ext_partition_context(MACROBLOCKD *xd, int mi_row, case PARTITION_VERT_4: update_partition_context(xd, mi_row, mi_col, subsize, bsize); break; +#if CONFIG_EXT_PARTITION_TYPES_AB + case PARTITION_HORZ_A: + update_partition_context(xd, mi_row, mi_col, + get_subsize(bsize, PARTITION_HORZ_4), subsize); + update_partition_context(xd, mi_row + mi_size_high[bsize] / 2, mi_col, + subsize, subsize); + break; + case PARTITION_HORZ_B: + update_partition_context(xd, mi_row, mi_col, subsize, subsize); + update_partition_context(xd, mi_row + mi_size_high[bsize] / 2, mi_col, + get_subsize(bsize, PARTITION_HORZ_4), subsize); + break; + case PARTITION_VERT_A: + update_partition_context(xd, mi_row, mi_col, + get_subsize(bsize, PARTITION_VERT_4), subsize); + update_partition_context(xd, mi_row, mi_col + mi_size_wide[bsize] / 2, + subsize, subsize); + break; + case PARTITION_VERT_B: + update_partition_context(xd, mi_row, mi_col, subsize, subsize); + update_partition_context(xd, mi_row, mi_col + mi_size_wide[bsize] / 2, + get_subsize(bsize, PARTITION_VERT_4), subsize); + break; +#else case PARTITION_HORZ_A: update_partition_context(xd, mi_row, mi_col, bsize2, subsize); update_partition_context(xd, mi_row + hbs, mi_col, subsize, subsize); @@ -830,6 +1050,7 @@ static INLINE void update_ext_partition_context(MACROBLOCKD *xd, int mi_row, update_partition_context(xd, mi_row, mi_col, subsize, subsize); update_partition_context(xd, mi_row, mi_col + hbs, bsize2, subsize); break; +#endif default: assert(0 && "Invalid partition type"); } } @@ -842,7 +1063,6 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, int has_rows, int has_cols, #endif BLOCK_SIZE bsize) { -#if CONFIG_UNPOISON_PARTITION_CTX const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MAX_MIB_MASK); @@ -853,6 +1073,7 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]); assert(bsl >= 0); +#if CONFIG_UNPOISON_PARTITION_CTX if (has_rows && has_cols) return (left * 2 + above) + bsl * PARTITION_PLOFFSET; else if (has_rows && !has_cols) @@ -860,18 +1081,8 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, else if (!has_rows && has_cols) return PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES + bsl; else - return PARTITION_CONTEXTS; // Bogus context, forced SPLIT + return INVALID_PARTITION_CTX; // Bogus context, forced SPLIT #else - const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; - const PARTITION_CONTEXT *left_ctx = - xd->left_seg_context + (mi_row & MAX_MIB_MASK); - // Minimum partition point is 8x8. Offset the bsl accordingly. - const int bsl = mi_width_log2_lookup[bsize] - mi_width_log2_lookup[BLOCK_8X8]; - int above = (*above_ctx >> bsl) & 1, left = (*left_ctx >> bsl) & 1; - - assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]); - assert(bsl >= 0); - return (left * 2 + above) + bsl * PARTITION_PLOFFSET; #endif } @@ -997,18 +1208,22 @@ static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx, } static INLINE TX_SIZE get_sqr_tx_size(int tx_dim) { - TX_SIZE tx_size; switch (tx_dim) { #if CONFIG_EXT_PARTITION case 128: -#endif +#endif // CONFIG_EXT_PARTITION case 64: - case 32: tx_size = TX_32X32; break; - case 16: tx_size = TX_16X16; break; - case 8: tx_size = TX_8X8; break; - default: tx_size = TX_4X4; +#if CONFIG_TX64X64 + return TX_64X64; +#else + return TX_32X32; +#endif // CONFIG_TX64X64 + break; + case 32: return TX_32X32; break; + case 16: return TX_16X16; break; + case 8: return TX_8X8; break; + default: return TX_4X4; } - return tx_size; } static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx, @@ -1035,49 +1250,114 @@ static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx, } #endif +// Compute the next partition in the direction of the sb_type stored in the mi +// array, starting with bsize. static INLINE PARTITION_TYPE get_partition(const AV1_COMMON *const cm, int mi_row, int mi_col, BLOCK_SIZE bsize) { - if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) { - return PARTITION_INVALID; - } else { - const int offset = mi_row * cm->mi_stride + mi_col; - MODE_INFO **mi = cm->mi_grid_visible + offset; - const MB_MODE_INFO *const mbmi = &mi[0]->mbmi; - const int bsl = b_width_log2_lookup[bsize]; - const PARTITION_TYPE partition = partition_lookup[bsl][mbmi->sb_type]; -#if !CONFIG_EXT_PARTITION_TYPES - return partition; + if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return PARTITION_INVALID; + + const int offset = mi_row * cm->mi_stride + mi_col; + MODE_INFO **mi = cm->mi_grid_visible + offset; + const BLOCK_SIZE subsize = mi[0]->mbmi.sb_type; + + if (subsize == bsize) return PARTITION_NONE; + + const int bhigh = mi_size_high[bsize]; + const int bwide = mi_size_wide[bsize]; + const int sshigh = mi_size_high[subsize]; + const int sswide = mi_size_wide[subsize]; + +#if CONFIG_EXT_PARTITION_TYPES + if (bsize > BLOCK_8X8 && mi_row + bwide / 2 < cm->mi_rows && + mi_col + bhigh / 2 < cm->mi_cols) { + // In this case, the block might be using an extended partition + // type. + const MB_MODE_INFO *const mbmi_right = &mi[bwide / 2]->mbmi; + const MB_MODE_INFO *const mbmi_below = &mi[bhigh / 2 * cm->mi_stride]->mbmi; + + if (sswide == bwide) { +#if CONFIG_EXT_PARTITION_TYPES_AB + // Smaller height but same width. Is PARTITION_HORZ, PARTITION_HORZ_4, + // PARTITION_HORZ_A or PARTITION_HORZ_B. + if (sshigh * 2 == bhigh) + return (mbmi_below->sb_type == subsize) ? PARTITION_HORZ + : PARTITION_HORZ_B; + assert(sshigh * 4 == bhigh); + return (mbmi_below->sb_type == subsize) ? PARTITION_HORZ_4 + : PARTITION_HORZ_A; #else - const int hbs = mi_size_wide[bsize] / 2; + // Smaller height but same width. Is PARTITION_HORZ_4, PARTITION_HORZ or + // PARTITION_HORZ_B. To distinguish the latter two, check if the lower + // half was split. + if (sshigh * 4 == bhigh) return PARTITION_HORZ_4; + assert(sshigh * 2 == bhigh); + + if (mbmi_below->sb_type == subsize) + return PARTITION_HORZ; + else + return PARTITION_HORZ_B; +#endif + } else if (sshigh == bhigh) { +#if CONFIG_EXT_PARTITION_TYPES_AB + // Smaller width but same height. Is PARTITION_VERT, PARTITION_VERT_4, + // PARTITION_VERT_A or PARTITION_VERT_B. + if (sswide * 2 == bwide) + return (mbmi_right->sb_type == subsize) ? PARTITION_VERT + : PARTITION_VERT_B; + assert(sswide * 4 == bwide); + return (mbmi_right->sb_type == subsize) ? PARTITION_VERT_4 + : PARTITION_VERT_A; +#else + // Smaller width but same height. Is PARTITION_VERT_4, PARTITION_VERT or + // PARTITION_VERT_B. To distinguish the latter two, check if the right + // half was split. + if (sswide * 4 == bwide) return PARTITION_VERT_4; + assert(sswide * 2 == bhigh); + + if (mbmi_right->sb_type == subsize) + return PARTITION_VERT; + else + return PARTITION_VERT_B; +#endif + } else { +#if !CONFIG_EXT_PARTITION_TYPES_AB + // Smaller width and smaller height. Might be PARTITION_SPLIT or could be + // PARTITION_HORZ_A or PARTITION_VERT_A. If subsize isn't halved in both + // dimensions, we immediately know this is a split (which will recurse to + // get to subsize). Otherwise look down and to the right. With + // PARTITION_VERT_A, the right block will have height bhigh; with + // PARTITION_HORZ_A, the lower block with have width bwide. Otherwise + // it's PARTITION_SPLIT. + if (sswide * 2 != bwide || sshigh * 2 != bhigh) return PARTITION_SPLIT; + + if (mi_size_wide[mbmi_below->sb_type] == bwide) return PARTITION_HORZ_A; + if (mi_size_high[mbmi_right->sb_type] == bhigh) return PARTITION_VERT_A; +#endif - assert(cm->mi_grid_visible[offset] == &cm->mi[offset]); - - if (partition == PARTITION_HORZ_4 || partition == PARTITION_VERT_4) - return partition; - - if (partition != PARTITION_NONE && bsize > BLOCK_8X8 && - mi_row + hbs < cm->mi_rows && mi_col + hbs < cm->mi_cols) { - const BLOCK_SIZE h = get_subsize(bsize, PARTITION_HORZ_A); - const BLOCK_SIZE v = get_subsize(bsize, PARTITION_VERT_A); - const MB_MODE_INFO *const mbmi_right = &mi[hbs]->mbmi; - const MB_MODE_INFO *const mbmi_below = &mi[hbs * cm->mi_stride]->mbmi; - if (mbmi->sb_type == h) { - return mbmi_below->sb_type == h ? PARTITION_HORZ : PARTITION_HORZ_B; - } else if (mbmi->sb_type == v) { - return mbmi_right->sb_type == v ? PARTITION_VERT : PARTITION_VERT_B; - } else if (mbmi_below->sb_type == h) { - return PARTITION_HORZ_A; - } else if (mbmi_right->sb_type == v) { - return PARTITION_VERT_A; - } else { - return PARTITION_SPLIT; - } + return PARTITION_SPLIT; } - - return partition; -#endif // !CONFIG_EXT_PARTITION_TYPES } +#endif + const int vert_split = sswide < bwide; + const int horz_split = sshigh < bhigh; + const int split_idx = (vert_split << 1) | horz_split; + assert(split_idx != 0); + + static const PARTITION_TYPE base_partitions[4] = { + PARTITION_INVALID, PARTITION_HORZ, PARTITION_VERT, PARTITION_SPLIT + }; + + return base_partitions[split_idx]; +} + +static INLINE void set_use_reference_buffer(AV1_COMMON *const cm, int use) { +#if CONFIG_REFERENCE_BUFFER + cm->seq_params.frame_id_numbers_present_flag = use; +#else + (void)cm; + (void)use; +#endif } static INLINE void set_sb_size(AV1_COMMON *const cm, BLOCK_SIZE sb_size) { @@ -1106,6 +1386,17 @@ static INLINE int all_lossless(const AV1_COMMON *cm, const MACROBLOCKD *xd) { return all_lossless; } +static INLINE int use_compressed_header(const AV1_COMMON *cm) { + (void)cm; +#if CONFIG_RESTRICT_COMPRESSED_HDR && CONFIG_NEW_MULTISYMBOL + return 0; +#elif CONFIG_RESTRICT_COMPRESSED_HDR + return cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_FORWARD; +#else + return 1; +#endif // CONFIG_RESTRICT_COMPRESSED_HDR && CONFIG_NEW_MULTISYMBOL +} + #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/pred_common.c b/third_party/aom/av1/common/pred_common.c index 0417a67f8..51fd0389e 100644 --- a/third_party/aom/av1/common/pred_common.c +++ b/third_party/aom/av1/common/pred_common.c @@ -22,19 +22,16 @@ static InterpFilter get_ref_filter_type(const MODE_INFO *mi, const MACROBLOCKD *xd, int dir, MV_REFERENCE_FRAME ref_frame) { - InterpFilter ref_type = SWITCHABLE_FILTERS; const MB_MODE_INFO *ref_mbmi = &mi->mbmi; int use_subpel[2] = { has_subpel_mv_component(mi, xd, dir), has_subpel_mv_component(mi, xd, dir + 2), }; - if (ref_mbmi->ref_frame[0] == ref_frame && use_subpel[0]) - ref_type = ref_mbmi->interp_filter[(dir & 0x01)]; - else if (ref_mbmi->ref_frame[1] == ref_frame && use_subpel[1]) - ref_type = ref_mbmi->interp_filter[(dir & 0x01) + 2]; - - return ref_type; + return (((ref_mbmi->ref_frame[0] == ref_frame && use_subpel[0]) || + (ref_mbmi->ref_frame[1] == ref_frame && use_subpel[1])) + ? av1_extract_interp_filter(ref_mbmi->interp_filters, dir & 0x01) + : SWITCHABLE_FILTERS); } int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) { @@ -79,13 +76,15 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { // left of the entries corresponding to real macroblocks. // The prediction flags in these dummy entries are initialized to 0. const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; - const int left_type = xd->left_available && is_inter_block(left_mbmi) - ? left_mbmi->interp_filter - : SWITCHABLE_FILTERS; + const int left_type = + xd->left_available && is_inter_block(left_mbmi) + ? av1_extract_interp_filter(left_mbmi->interp_filters, 0) + : SWITCHABLE_FILTERS; const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; - const int above_type = xd->up_available && is_inter_block(above_mbmi) - ? above_mbmi->interp_filter - : SWITCHABLE_FILTERS; + const int above_type = + xd->up_available && is_inter_block(above_mbmi) + ? av1_extract_interp_filter(above_mbmi->interp_filters, 0) + : SWITCHABLE_FILTERS; if (left_type == above_type) { return left_type; @@ -110,11 +109,7 @@ static INTRA_FILTER get_ref_intra_filter(const MB_MODE_INFO *ref_mbmi) { if (ref_mbmi->sb_type >= BLOCK_8X8) { const PREDICTION_MODE mode = ref_mbmi->mode; if (is_inter_block(ref_mbmi)) { -#if CONFIG_DUAL_FILTER - switch (ref_mbmi->interp_filter[0]) { -#else - switch (ref_mbmi->interp_filter) { -#endif + switch (av1_extract_interp_filter(ref_mbmi->interp_filters, 0)) { case EIGHTTAP_REGULAR: ref_type = INTRA_FILTER_8TAP; break; case EIGHTTAP_SMOOTH: ref_type = INTRA_FILTER_8TAP_SMOOTH; break; case MULTITAP_SHARP: ref_type = INTRA_FILTER_8TAP_SHARP; break; @@ -153,9 +148,14 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd) { #endif // CONFIG_INTRA_INTERP #endif // CONFIG_EXT_INTRA -#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING -int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi, - int plane, uint16_t *cache) { +#if CONFIG_PALETTE_DELTA_ENCODING +int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane, + uint16_t *cache) { + const int row = -xd->mb_to_top_edge >> 3; + // Do not refer to above SB row when on SB boundary. + const MODE_INFO *const above_mi = + (row % (1 << MIN_SB_SIZE_LOG2)) ? xd->above_mi : NULL; + const MODE_INFO *const left_mi = xd->left_mi; int above_n = 0, left_n = 0; if (above_mi) above_n = above_mi->mbmi.palette_mode_info.palette_size[plane != 0]; @@ -166,8 +166,9 @@ int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi, int left_idx = plane * PALETTE_MAX_SIZE; int n = 0; const uint16_t *above_colors = - above_mi->mbmi.palette_mode_info.palette_colors; - const uint16_t *left_colors = left_mi->mbmi.palette_mode_info.palette_colors; + above_mi ? above_mi->mbmi.palette_mode_info.palette_colors : NULL; + const uint16_t *left_colors = + left_mi ? left_mi->mbmi.palette_mode_info.palette_colors : NULL; // Merge the sorted lists of base colors from above and left to get // combined sorted color cache. while (above_n > 0 && left_n > 0) { @@ -193,7 +194,7 @@ int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi, assert(n <= 2 * PALETTE_MAX_SIZE); return n; } -#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING +#endif // CONFIG_PALETTE_DELTA_ENCODING // The mode info data structure has a one element border above and to the // left of the entries corresponding to real macroblocks. @@ -219,7 +220,7 @@ int av1_get_intra_inter_context(const MACROBLOCKD *xd) { } } -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF // The compound/single mode info data structure has one element border above and // to the left of the entries corresponding to real macroblocks. // The prediction flags in these dummy entries are initialized to 0. @@ -253,7 +254,7 @@ int av1_get_inter_mode_context(const MACROBLOCKD *xd) { return 2; } } -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF #if CONFIG_EXT_REFS #define CHECK_BACKWARD_REFS(ref_frame) \ @@ -314,8 +315,6 @@ int av1_get_reference_mode_context(const AV1_COMMON *cm, } #if CONFIG_EXT_COMP_REFS -#define CHECK_BWDREF_OR_ALTREF(ref_frame) \ - ((ref_frame) == BWDREF_FRAME || (ref_frame) == ALTREF_FRAME) // TODO(zoeliu): To try on the design of 3 contexts, instead of 5: // COMP_REF_TYPE_CONTEXTS = 3 int av1_get_comp_reference_type_context(const MACROBLOCKD *xd) { @@ -345,9 +344,9 @@ int av1_get_comp_reference_type_context(const MACROBLOCKD *xd) { const MV_REFERENCE_FRAME frfl = left_mbmi->ref_frame[0]; if (a_sg && l_sg) { // single/single - pred_context = 1 + - 2 * (!(CHECK_BWDREF_OR_ALTREF(frfa) ^ - CHECK_BWDREF_OR_ALTREF(frfl))); + pred_context = + 1 + + 2 * (!(IS_BACKWARD_REF_FRAME(frfa) ^ IS_BACKWARD_REF_FRAME(frfl))); } else if (l_sg || a_sg) { // single/comp const int uni_rfc = a_sg ? has_uni_comp_refs(left_mbmi) : has_uni_comp_refs(above_mbmi); @@ -355,8 +354,8 @@ int av1_get_comp_reference_type_context(const MACROBLOCKD *xd) { if (!uni_rfc) // comp bidir pred_context = 1; else // comp unidir - pred_context = 3 + (!(CHECK_BWDREF_OR_ALTREF(frfa) ^ - CHECK_BWDREF_OR_ALTREF(frfl))); + pred_context = 3 + (!(IS_BACKWARD_REF_FRAME(frfa) ^ + IS_BACKWARD_REF_FRAME(frfl))); } else { // comp/comp const int a_uni_rfc = has_uni_comp_refs(above_mbmi); const int l_uni_rfc = has_uni_comp_refs(left_mbmi); @@ -580,12 +579,12 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm, // The mode info data structure has a one element border above and to the // left of the entries correpsonding to real macroblocks. // The prediction flags in these dummy entries are initialised to 0. -#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream +#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS // Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1 const int bwd_ref_sign_idx = 1; #else const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]]; -#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS +#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS const int fwd_ref_sign_idx = !bwd_ref_sign_idx; (void)cm; @@ -690,12 +689,12 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm, // The mode info data structure has a one element border above and to the // left of the entries correpsonding to real macroblocks. // The prediction flags in these dummy entries are initialised to 0. -#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream +#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS // Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1 const int bwd_ref_sign_idx = 1; #else const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]]; -#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS +#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS const int fwd_ref_sign_idx = !bwd_ref_sign_idx; (void)cm; @@ -798,12 +797,11 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm, // The mode info data structure has a one element border above and to the // left of the entries correpsonding to real macroblocks. // The prediction flags in these dummy entries are initialised to 0. -#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream - // Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1 +#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS const int bwd_ref_sign_idx = 1; #else const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]]; -#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS +#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS const int fwd_ref_sign_idx = !bwd_ref_sign_idx; (void)cm; @@ -887,8 +885,6 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm, return pred_context; } -#if CONFIG_ALTREF2 - // Obtain contexts to signal a reference frame be either BWDREF/ALTREF2, or // ALTREF. int av1_get_pred_context_brfarf2_or_arf(const MACROBLOCKD *xd) { @@ -989,132 +985,6 @@ int av1_get_pred_context_comp_bwdref_p1(const AV1_COMMON *cm, return av1_get_pred_context_brf_or_arf2(xd); } -#else // !CONFIG_ALTREF2 - -// Returns a context number for the given MB prediction signal -int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm, - const MACROBLOCKD *xd) { - int pred_context; - const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; - const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; - const int above_in_image = xd->up_available; - const int left_in_image = xd->left_available; - -// Note: -// The mode info data structure has a one element border above and to the -// left of the entries corresponding to real macroblocks. -// The prediction flags in these dummy entries are initialized to 0. -#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream - // Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1 - const int bwd_ref_sign_idx = 1; -#else - const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]]; -#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS - const int fwd_ref_sign_idx = !bwd_ref_sign_idx; - - (void)cm; - - if (above_in_image && left_in_image) { // both edges available - const int above_intra = !is_inter_block(above_mbmi); - const int left_intra = !is_inter_block(left_mbmi); - - if (above_intra && left_intra) { // intra/intra (2) - pred_context = 2; - } else if (above_intra || left_intra) { // intra/inter - const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; - - if (!has_second_ref(edge_mbmi)) // single pred (1/3) - pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_bwd_ref[1]); - else // comp pred (1/3) - pred_context = - 1 + - 2 * (edge_mbmi->ref_frame[bwd_ref_sign_idx] != cm->comp_bwd_ref[1]); - } else { // inter/inter - const int l_comp = has_second_ref(left_mbmi); - const int a_comp = has_second_ref(above_mbmi); - - const MV_REFERENCE_FRAME l_brf = - l_comp ? left_mbmi->ref_frame[bwd_ref_sign_idx] : NONE_FRAME; - const MV_REFERENCE_FRAME a_brf = - a_comp ? above_mbmi->ref_frame[bwd_ref_sign_idx] : NONE_FRAME; - - const MV_REFERENCE_FRAME l_frf = - !l_comp ? left_mbmi->ref_frame[0] - : left_mbmi->ref_frame[fwd_ref_sign_idx]; - const MV_REFERENCE_FRAME a_frf = - !a_comp ? above_mbmi->ref_frame[0] - : above_mbmi->ref_frame[fwd_ref_sign_idx]; - - if (l_comp && a_comp) { // comp/comp - if (l_brf == a_brf && l_brf == cm->comp_bwd_ref[1]) { - pred_context = 0; - } else if (l_brf == cm->comp_bwd_ref[1] || - a_brf == cm->comp_bwd_ref[1]) { - pred_context = 1; - } else { -// NOTE: Backward ref should be either BWDREF or ALTREF. -#if !USE_UNI_COMP_REFS - // TODO(zoeliu): To further study the UNIDIR scenario - assert(l_brf == a_brf && l_brf != cm->comp_bwd_ref[1]); -#endif // !USE_UNI_COMP_REFS - pred_context = 3; - } - } else if (!l_comp && !a_comp) { // single/single - if (l_frf == a_frf && l_frf == cm->comp_bwd_ref[1]) { - pred_context = 0; - } else if (l_frf == cm->comp_bwd_ref[1] || - a_frf == cm->comp_bwd_ref[1]) { - pred_context = 1; - } else if (l_frf == a_frf) { - pred_context = 3; - } else { -#if !USE_UNI_COMP_REFS - // TODO(zoeliu): To further study the UNIDIR scenario - assert(l_frf != a_frf && l_frf != cm->comp_bwd_ref[1] && - a_frf != cm->comp_bwd_ref[1]); -#endif // !USE_UNI_COMP_REFS - pred_context = 4; - } - } else { // comp/single - assert((l_comp && !a_comp) || (!l_comp && a_comp)); - - if ((l_comp && l_brf == cm->comp_bwd_ref[1] && - a_frf == cm->comp_bwd_ref[1]) || - (a_comp && a_brf == cm->comp_bwd_ref[1] && - l_frf == cm->comp_bwd_ref[1])) { - pred_context = 1; - } else if ((l_comp && l_brf == cm->comp_bwd_ref[1]) || - (a_comp && a_brf == cm->comp_bwd_ref[1]) || - (!l_comp && l_frf == cm->comp_bwd_ref[1]) || - (!a_comp && a_frf == cm->comp_bwd_ref[1])) { - pred_context = 2; - } else { - pred_context = 4; - } - } - } - } else if (above_in_image || left_in_image) { // one edge available - const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi; - - if (!is_inter_block(edge_mbmi)) { - pred_context = 2; - } else { - if (has_second_ref(edge_mbmi)) { - pred_context = - 4 * (edge_mbmi->ref_frame[bwd_ref_sign_idx] != cm->comp_bwd_ref[1]); - } else { - pred_context = 3 * (edge_mbmi->ref_frame[0] != cm->comp_bwd_ref[1]); - } - } - } else { // no edges available (2) - pred_context = 2; - } - assert(pred_context >= 0 && pred_context < REF_CONTEXTS); - - return pred_context; -} -#endif // CONFIG_ALTREF2 - #else // !CONFIG_EXT_REFS // Returns a context number for the given MB prediction signal @@ -1270,96 +1140,7 @@ int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { // non-ALTREF backward reference frame, knowing that it shall be either of // these 2 choices. int av1_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { -#if CONFIG_ALTREF2 return av1_get_pred_context_brfarf2_or_arf(xd); -#else // !CONFIG_ALTREF2 - int pred_context; - const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; - const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; - const int has_above = xd->up_available; - const int has_left = xd->left_available; - - // Note: - // The mode info data structure has a one element border above and to the - // left of the entries correpsonding to real macroblocks. - // The prediction flags in these dummy entries are initialised to 0. - if (has_above && has_left) { // both edges available - const int above_intra = !is_inter_block(above_mbmi); - const int left_intra = !is_inter_block(left_mbmi); - - if (above_intra && left_intra) { // intra/intra - pred_context = 2; - } else if (above_intra || left_intra) { // intra/inter or inter/intra - const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi; - if (!has_second_ref(edge_mbmi)) { // single - if (!CHECK_BACKWARD_REFS(edge_mbmi->ref_frame[0])) - pred_context = 3; - else - pred_context = 4 * (edge_mbmi->ref_frame[0] == BWDREF_FRAME); - } else { // comp - pred_context = 1 + - 2 * (edge_mbmi->ref_frame[0] == BWDREF_FRAME || - edge_mbmi->ref_frame[1] == BWDREF_FRAME); - } - } else { // inter/inter - const int above_has_second = has_second_ref(above_mbmi); - const int left_has_second = has_second_ref(left_mbmi); - const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0]; - const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1]; - const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0]; - const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1]; - - if (above_has_second && left_has_second) { // comp/comp - if (above0 == left0 && above1 == left1) - pred_context = - 3 * (above0 == BWDREF_FRAME || above1 == BWDREF_FRAME || - left0 == BWDREF_FRAME || left1 == BWDREF_FRAME); - else - pred_context = 2; - } else if (above_has_second || left_has_second) { // single/comp - const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0; - const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0; - const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1; - - if (rfs == BWDREF_FRAME) - pred_context = 3 + (crf1 == BWDREF_FRAME || crf2 == BWDREF_FRAME); - else if (rfs == ALTREF_FRAME) - pred_context = (crf1 == BWDREF_FRAME || crf2 == BWDREF_FRAME); - else - pred_context = 1 + 2 * (crf1 == BWDREF_FRAME || crf2 == BWDREF_FRAME); - } else { // single/single - if (!CHECK_BACKWARD_REFS(above0) && !CHECK_BACKWARD_REFS(left0)) { - pred_context = 2 + (above0 == left0); - } else if (!CHECK_BACKWARD_REFS(above0) || - !CHECK_BACKWARD_REFS(left0)) { - const MV_REFERENCE_FRAME edge0 = - !CHECK_BACKWARD_REFS(above0) ? left0 : above0; - pred_context = 4 * (edge0 == BWDREF_FRAME); - } else { - pred_context = - 2 * (above0 == BWDREF_FRAME) + 2 * (left0 == BWDREF_FRAME); - } - } - } - } else if (has_above || has_left) { // one edge available - const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi; - - if (!is_inter_block(edge_mbmi) || - (!CHECK_BACKWARD_REFS(edge_mbmi->ref_frame[0]) && - !has_second_ref(edge_mbmi))) - pred_context = 2; - else if (!has_second_ref(edge_mbmi)) // single - pred_context = 4 * (edge_mbmi->ref_frame[0] == BWDREF_FRAME); - else // comp - pred_context = 3 * (edge_mbmi->ref_frame[0] == BWDREF_FRAME || - edge_mbmi->ref_frame[1] == BWDREF_FRAME); - } else { // no edges available (2) - pred_context = 2; - } - - assert(pred_context >= 0 && pred_context < REF_CONTEXTS); - return pred_context; -#endif // CONFIG_ALTREF2 } // For the bit to signal whether the single reference is LAST3/GOLDEN or @@ -1640,13 +1421,11 @@ int av1_get_pred_context_single_ref_p5(const MACROBLOCKD *xd) { return pred_context; } -#if CONFIG_ALTREF2 // For the bit to signal whether the single reference is ALTREF2_FRAME or // BWDREF_FRAME, knowing that it shall be either of these 2 choices. int av1_get_pred_context_single_ref_p6(const MACROBLOCKD *xd) { return av1_get_pred_context_brf_or_arf2(xd); } -#endif // CONFIG_ALTREF2 #else // !CONFIG_EXT_REFS diff --git a/third_party/aom/av1/common/pred_common.h b/third_party/aom/av1/common/pred_common.h index aab026eeb..db4618a59 100644 --- a/third_party/aom/av1/common/pred_common.h +++ b/third_party/aom/av1/common/pred_common.h @@ -86,14 +86,14 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd); #endif // CONFIG_INTRA_INTERP #endif // CONFIG_EXT_INTRA -#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING +#if CONFIG_PALETTE_DELTA_ENCODING // Get a list of palette base colors that are used in the above and left blocks, // referred to as "color cache". The return value is the number of colors in the // cache (<= 2 * PALETTE_MAX_SIZE). The color values are stored in "cache" // in ascending order. -int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi, - int plane, uint16_t *cache); -#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING +int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane, + uint16_t *cache); +#endif // CONFIG_PALETTE_DELTA_ENCODING int av1_get_intra_inter_context(const MACROBLOCKD *xd); @@ -243,17 +243,22 @@ static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p(const AV1_COMMON *cm, return cm->fc->comp_bwdref_prob[pred_context][0]; } -#if CONFIG_ALTREF2 -// TODO(zoeliu): ALTREF2 to work with NEW_MULTISYMBOL int av1_get_pred_context_comp_bwdref_p1(const AV1_COMMON *cm, const MACROBLOCKD *xd); +#if CONFIG_NEW_MULTISYMBOL +static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_bwdref_p1( + const AV1_COMMON *cm, const MACROBLOCKD *xd) { + const int pred_context = av1_get_pred_context_comp_bwdref_p1(cm, xd); + return xd->tile_ctx->comp_bwdref_cdf[pred_context][1]; +} +#endif // CONFIG_NEW_MULTISYMBOL + static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p1(const AV1_COMMON *cm, const MACROBLOCKD *xd) { const int pred_context = av1_get_pred_context_comp_bwdref_p1(cm, xd); return cm->fc->comp_bwdref_prob[pred_context][1]; } -#endif // CONFIG_ALTREF2 #endif // CONFIG_EXT_REFS int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd); @@ -292,14 +297,12 @@ static INLINE aom_prob av1_get_pred_prob_single_ref_p5(const AV1_COMMON *cm, return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p5(xd)][4]; } -#if CONFIG_ALTREF2 int av1_get_pred_context_single_ref_p6(const MACROBLOCKD *xd); static INLINE aom_prob av1_get_pred_prob_single_ref_p6(const AV1_COMMON *cm, const MACROBLOCKD *xd) { return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p6(xd)][5]; } -#endif // CONFIG_ALTREF2 #endif // CONFIG_EXT_REFS #if CONFIG_NEW_MULTISYMBOL @@ -334,17 +337,23 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p5( return xd->tile_ctx ->single_ref_cdf[av1_get_pred_context_single_ref_p5(xd)][4]; } +static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p6( + const AV1_COMMON *cm, const MACROBLOCKD *xd) { + (void)cm; + return xd->tile_ctx + ->single_ref_cdf[av1_get_pred_context_single_ref_p6(xd)][5]; +} #endif // CONFIG_EXT_REFS #endif // CONFIG_NEW_MULTISYMBOL -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF int av1_get_inter_mode_context(const MACROBLOCKD *xd); static INLINE aom_prob av1_get_inter_mode_prob(const AV1_COMMON *cm, const MACROBLOCKD *xd) { return cm->fc->comp_inter_mode_prob[av1_get_inter_mode_context(xd)]; } -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF // Returns a context number for the given MB prediction signal // The mode info data structure has a one element border above and to the diff --git a/third_party/aom/av1/common/pvq.c b/third_party/aom/av1/common/pvq.c index 75fe761d7..221c90c04 100644 --- a/third_party/aom/av1/common/pvq.c +++ b/third_party/aom/av1/common/pvq.c @@ -591,7 +591,7 @@ static int32_t od_pow(int32_t x, od_val16 beta) /*log2(g/OD_COMPAND_SCALE) = log2(x) - OD_COMPAND_SHIFT in Q(OD_LOG2_OUTSHIFT).*/ logr = od_log2(t) + (log2_x - OD_COMPAND_SHIFT)*OD_LOG2_OUTSCALE; - logr = OD_MULT16_32_QBETA(beta, logr); + logr = (od_val32)OD_MULT16_32_QBETA(beta, logr); return od_exp2(logr); } #endif @@ -974,7 +974,7 @@ void od_pvq_synthesis_partial(od_coeff *xcoeff, const od_coeff *ypulse, od_val32 x; /* This multiply doesn't round, so it introduces some bias. It would be nice (but not critical) to fix this. */ - x = OD_MULT16_32_Q16(ypulse[i], scale); + x = (od_val32)OD_MULT16_32_Q16(ypulse[i], scale); #if defined(OD_FLOAT_PVQ) xcoeff[i] = (od_coeff)floor(.5 + x*(qm_inv[i]*OD_QM_INV_SCALE_1)); diff --git a/third_party/aom/av1/common/pvq.h b/third_party/aom/av1/common/pvq.h index 17e54d4c5..4adf22f02 100644 --- a/third_party/aom/av1/common/pvq.h +++ b/third_party/aom/av1/common/pvq.h @@ -19,11 +19,7 @@ extern const uint16_t EXP_CDF_TABLE[][16]; extern const uint16_t LAPLACE_OFFSET[]; -#if CONFIG_DAALA_DIST -#define AV1_PVQ_ENABLE_ACTIVITY_MASKING (1) -#else #define AV1_PVQ_ENABLE_ACTIVITY_MASKING (0) -#endif # define PVQ_MAX_PARTITIONS (1 + 3*(OD_TXSIZES-1)) diff --git a/third_party/aom/av1/common/quant_common.c b/third_party/aom/av1/common/quant_common.c index 5210ba812..ea7140cdc 100644 --- a/third_party/aom/av1/common/quant_common.c +++ b/third_party/aom/av1/common/quant_common.c @@ -360,21 +360,28 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; void aom_qm_init(AV1_COMMON *cm) { - int q, c, f, t, size; + int q, c, f, t; int current; for (q = 0; q < NUM_QM_LEVELS; ++q) { for (c = 0; c < 2; ++c) { for (f = 0; f < 2; ++f) { current = 0; for (t = 0; t < TX_SIZES_ALL; ++t) { - size = tx_size_2d[t]; - cm->gqmatrix[q][c][f][t] = &wt_matrix_ref[AOMMIN( - NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c] - [current]; - cm->giqmatrix[q][c][f][t] = &iwt_matrix_ref[AOMMIN( - NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c] + const int size = tx_size_2d[t]; + // Don't use QM for sizes > 32x32 + if (q == NUM_QM_LEVELS - 1 || size > 1024) { + cm->gqmatrix[q][c][f][t] = NULL; + cm->giqmatrix[q][c][f][t] = NULL; + } else { + assert(current + size <= QM_TOTAL_SIZE); + cm->gqmatrix[q][c][f][t] = &wt_matrix_ref[AOMMIN( + NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c] [current]; - current += size; + cm->giqmatrix[q][c][f][t] = &iwt_matrix_ref[AOMMIN( + NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c] + [current]; + current += size; + } } } } @@ -14039,7 +14046,7 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = { }; #endif -#if CONFIG_PVQ || CONFIG_DAALA_DIST +#if CONFIG_PVQ /* Quantization matrices for 8x8. For other block sizes, we currently just do resampling. */ /* Flat quantization, i.e. optimize for PSNR. */ diff --git a/third_party/aom/av1/common/quant_common.h b/third_party/aom/av1/common/quant_common.h index f28ffe7ac..92843fe4d 100644 --- a/third_party/aom/av1/common/quant_common.h +++ b/third_party/aom/av1/common/quant_common.h @@ -48,9 +48,7 @@ int av1_get_qindex(const struct segmentation *seg, int segment_id, // Reduce the large number of quantizers to a smaller number of levels for which // different matrices may be defined static INLINE int aom_get_qmlevel(int qindex, int first, int last) { - int qmlevel = (qindex * (last + 1 - first) + QINDEX_RANGE / 2) / QINDEX_RANGE; - qmlevel = AOMMIN(qmlevel + first, NUM_QM_LEVELS - 1); - return qmlevel; + return first + (qindex * (last + 1 - first)) / QINDEX_RANGE; } void aom_qm_init(struct AV1Common *cm); qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp, @@ -99,7 +97,7 @@ static INLINE int get_dq_profile_from_ctx(int qindex, int q_ctx, int is_inter, } #endif // CONFIG_NEW_QUANT -#if CONFIG_PVQ || CONFIG_DAALA_DIST +#if CONFIG_PVQ extern const int OD_QM8_Q4_FLAT[]; extern const int OD_QM8_Q4_HVS[]; #endif diff --git a/third_party/aom/av1/common/reconinter.c b/third_party/aom/av1/common/reconinter.c index a1b5c1f67..d7e39b45c 100644 --- a/third_party/aom/av1/common/reconinter.c +++ b/third_party/aom/av1/common/reconinter.c @@ -10,6 +10,8 @@ */ #include <assert.h> +#include <stdio.h> +#include <limits.h> #include "./aom_scale_rtcd.h" #include "./aom_dsp_rtcd.h" @@ -23,9 +25,186 @@ #include "av1/common/reconintra.h" #if CONFIG_MOTION_VAR #include "av1/common/onyxc_int.h" +#include "av1/common/obmc.h" #endif // CONFIG_MOTION_VAR -#if CONFIG_EXT_INTER +#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION +// This function will determine whether or not to create a warped +// prediction and return the appropriate motion model depending +// on the configuration. Behavior will change with different +// combinations of GLOBAL_MOTION, WARPED_MOTION and MOTION_VAR. +static INLINE int allow_warp(const MODE_INFO *const mi, + const WarpTypesAllowed *const warp_types, +#if CONFIG_GLOBAL_MOTION + const WarpedMotionParams *const gm_params, +#endif // CONFIG_GLOBAL_MOTION +#if CONFIG_MOTION_VAR + int build_for_obmc, +#endif // CONFIG_MOTION_VAR + WarpedMotionParams *final_warp_params) { + const MB_MODE_INFO *const mbmi = &mi->mbmi; + *final_warp_params = default_warp_params; + +// Only global motion configured +#if CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR + (void)mbmi; + if (warp_types->global_warp_allowed) { + memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); + return 1; + } +#endif // CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR + +// Only warped motion configured +#if CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR + if (warp_types->local_warp_allowed) { + memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params)); + return 1; + } +#endif // CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR + +// Warped and global motion configured +#if CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR + // When both are enabled, warped will take priority. The global parameters + // will only be used to compute projection samples to find the warped model. + // Note that when a block chooses global, it will not be possible to + // select WARPED_CAUSAL. + if (warp_types->local_warp_allowed) { + memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params)); + return 1; + } else if (warp_types->global_warp_allowed) { + memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); + return 1; + } +#endif // CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR + +// Motion var and global motion configured +#if CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION + // We warp if either case is true: + // 1.) We are predicting a block which uses global motion + // 2.) We are predicting a neighboring block of a block using OBMC, + // the neighboring block uses global motion, and we have enabled + // WARP_GM_NEIGHBORS_WITH_OBMC + (void)mbmi; + if (warp_types->global_warp_allowed && + (WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) { + memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); + return 1; + } +#endif // CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION + +// Motion var and warped motion configured +#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION + // We warp if either case is true: + // 1.) We are predicting a block with motion mode WARPED_CAUSAL + // 2.) We are predicting a neighboring block of a block using OBMC, + // the neighboring block has mode WARPED_CAUSAL, and we have enabled + // WARP_WM_NEIGHBORS_WITH_OBMC + if (warp_types->local_warp_allowed) { + if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) { + memcpy(final_warp_params, &mbmi->wm_params[0], + sizeof(*final_warp_params)); + return 1; + } + } +#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION + +// Motion var, warped motion and global motion all configured +#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION + if (warp_types->local_warp_allowed) { + if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) { + memcpy(final_warp_params, &mbmi->wm_params[0], + sizeof(*final_warp_params)); + return 1; + } + } else if (warp_types->global_warp_allowed && + (WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) { + memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); + return 1; + } +#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION + + return 0; +} +#endif // CONFIG_GLOBAL_MOTION ||CONFIG_WARPED_MOTION + +static INLINE void av1_make_inter_predictor( + const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, + const int subpel_x, const int subpel_y, const struct scale_factors *sf, + int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters, +#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION + const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane, + int ref, +#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION +#if CONFIG_MOTION_VAR + const MODE_INFO *mi, int build_for_obmc, +#endif + int xs, int ys, const MACROBLOCKD *xd) { + (void)xd; + +#if !CONFIG_MOTION_VAR + const MODE_INFO *mi = xd->mi[0]; + (void)mi; +#endif // CONFIG_MOTION_VAR + +// Make sure the selected motion mode is valid for this configuration +#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION + assert_motion_mode_valid(mi->mbmi.motion_mode, +#if CONFIG_GLOBAL_MOTION + 0, xd->global_motion, +#endif // CONFIG_GLOBAL_MOTION +#if CONFIG_WARPED_MOTION + xd, +#endif + mi); +#endif // CONFIG MOTION_VAR || CONFIG_WARPED_MOTION + +#if CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION + WarpedMotionParams final_warp_params; + const int do_warp = allow_warp( + mi, warp_types, +#if CONFIG_GLOBAL_MOTION +#if CONFIG_COMPOUND_SINGLEREF + // TODO(zoeliu): To further check the single + // ref comp mode to work together with + // global motion. + has_second_ref(&mi->mbmi) ? &xd->global_motion[mi->mbmi.ref_frame[ref]] + : &xd->global_motion[mi->mbmi.ref_frame[0]], +#else // !(CONFIG_COMPOUND_SINGLEREF) + &xd->global_motion[mi->mbmi.ref_frame[ref]], +#endif // CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_GLOBAL_MOTION +#if CONFIG_MOTION_VAR + build_for_obmc, +#endif // CONFIG_MOTION_VAR + &final_warp_params); + if (do_warp +#if CONFIG_AMVR + && xd->cur_frame_mv_precision_level == 0 +#endif + ) { + const struct macroblockd_plane *const pd = &xd->plane[plane]; + const struct buf_2d *const pre_buf = &pd->pre[ref]; + av1_warp_plane(&final_warp_params, +#if CONFIG_HIGHBITDEPTH + xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, +#endif // CONFIG_HIGHBITDEPTH + pre_buf->buf0, pre_buf->width, pre_buf->height, + pre_buf->stride, dst, p_col, p_row, w, h, dst_stride, + pd->subsampling_x, pd->subsampling_y, xs, ys, conv_params); + return; + } +#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION +#if CONFIG_HIGHBITDEPTH + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { + highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, + sf, w, h, conv_params, interp_filters, xs, ys, + xd->bd); + return; + } +#endif // CONFIG_HIGHBITDEPTH + inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, sf, w, + h, conv_params, interp_filters, xs, ys); +} #define NSMOOTHERS 1 @@ -183,12 +362,6 @@ const wedge_params_type wedge_params_lookup[BLOCK_SIZES_ALL] = { wedge_masks[BLOCK_32X16] }, { 4, wedge_codebook_16_heqw, wedge_signflip_lookup[BLOCK_32X32], 0, wedge_masks[BLOCK_32X32] }, - { 0, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_32X64], 0, - wedge_masks[BLOCK_32X64] }, - { 0, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_64X32], 0, - wedge_masks[BLOCK_64X32] }, - { 0, wedge_codebook_16_heqw, wedge_signflip_lookup[BLOCK_64X64], 0, - wedge_masks[BLOCK_64X64] }, #else { 0, wedge_codebook_16_heqw, wedge_signflip_lookup[BLOCK_8X8], 0, wedge_masks[BLOCK_8X8] }, @@ -204,26 +377,40 @@ const wedge_params_type wedge_params_lookup[BLOCK_SIZES_ALL] = { wedge_masks[BLOCK_32X16] }, { 0, wedge_codebook_16_heqw, wedge_signflip_lookup[BLOCK_32X32], 0, wedge_masks[BLOCK_32X32] }, - { 0, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_32X64], 0, - wedge_masks[BLOCK_32X64] }, - { 0, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_64X32], 0, - wedge_masks[BLOCK_64X32] }, - { 0, wedge_codebook_16_heqw, wedge_signflip_lookup[BLOCK_64X64], 0, - wedge_masks[BLOCK_64X64] }, #endif // CONFIG_WEDGE + { 0, NULL, NULL, 0, NULL }, + { 0, NULL, NULL, 0, NULL }, + { 0, NULL, NULL, 0, NULL }, #if CONFIG_EXT_PARTITION { 0, NULL, NULL, 0, NULL }, { 0, NULL, NULL, 0, NULL }, { 0, NULL, NULL, 0, NULL }, #endif // CONFIG_EXT_PARTITION - { 4, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_4X16], 0, +#if CONFIG_WEDGE + { 0, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_4X16], 0, wedge_masks[BLOCK_4X16] }, - { 4, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_16X4], 0, + { 0, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_16X4], 0, wedge_masks[BLOCK_16X4] }, { 4, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_8X32], 0, wedge_masks[BLOCK_8X32] }, { 4, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_32X8], 0, wedge_masks[BLOCK_32X8] }, +#else + { 0, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_4X16], 0, + wedge_masks[BLOCK_4X16] }, + { 0, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_16X4], 0, + wedge_masks[BLOCK_16X4] }, + { 0, wedge_codebook_16_hgtw, wedge_signflip_lookup[BLOCK_8X32], 0, + wedge_masks[BLOCK_8X32] }, + { 0, wedge_codebook_16_hltw, wedge_signflip_lookup[BLOCK_32X8], 0, + wedge_masks[BLOCK_32X8] }, +#endif // CONFIG_WEDGE + { 0, NULL, NULL, 0, NULL }, + { 0, NULL, NULL, 0, NULL }, +#if CONFIG_EXT_PARTITION + { 0, NULL, NULL, 0, NULL }, + { 0, NULL, NULL, 0, NULL }, +#endif // CONFIG_EXT_PARTITION }; static const uint8_t *get_wedge_mask_inplace(int wedge_index, int neg, @@ -457,12 +644,12 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type, BLOCK_SIZE sb_type, int h, int w, int bd) { switch (mask_type) { case DIFFWTD_38: - diffwtd_mask_highbd(mask, 0, 42, CONVERT_TO_SHORTPTR(src0), src0_stride, + diffwtd_mask_highbd(mask, 0, 38, CONVERT_TO_SHORTPTR(src0), src0_stride, CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w, bd); break; case DIFFWTD_38_INV: - diffwtd_mask_highbd(mask, 1, 42, CONVERT_TO_SHORTPTR(src0), src0_stride, + diffwtd_mask_highbd(mask, 1, 38, CONVERT_TO_SHORTPTR(src0), src0_stride, CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w, bd); break; @@ -754,26 +941,19 @@ static void build_masked_compound_highbd( #endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_SUPERTX -void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, - uint8_t *dst, int dst_stride, - const int subpel_x, const int subpel_y, - const struct scale_factors *sf, int w, - int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - int xs, int ys, +void av1_make_masked_inter_predictor( + const uint8_t *pre, int pre_stride, uint8_t *dst, int dst_stride, + const int subpel_x, const int subpel_y, const struct scale_factors *sf, + int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters, + int xs, int ys, #if CONFIG_SUPERTX - int wedge_offset_x, int wedge_offset_y, + int wedge_offset_x, int wedge_offset_y, #endif // CONFIG_SUPERTX - int plane, + int plane, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - const WarpTypesAllowed *warp_types, - int p_col, int p_row, int ref, + const WarpTypesAllowed *warp_types, int p_col, int p_row, int ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - MACROBLOCKD *xd) { + MACROBLOCKD *xd) { const MODE_INFO *mi = xd->mi[0]; const INTERINTER_COMPOUND_DATA comp_data = { @@ -788,52 +968,81 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, mi->mbmi.interinter_compound_type }; +// We're going to call av1_make_inter_predictor to generate a prediction into +// a temporary buffer, then will blend that temporary buffer with that from +// the other reference. +// +// With CONFIG_CONVOLVE_ROUND, if the rounding mode is CONVOLVE_OPT_NO_ROUND +// then the predictions are at 32-bits, so we'll need 32 bits per +// pixel. Otherwise, we'll need up to 16 bits per pixel if +// CONFIG_HIGHBITDEPTH or just 8 otherwise. +#if CONFIG_CONVOLVE_ROUND +#define INTER_PRED_BYTES_PER_PIXEL 4 +#elif CONFIG_HIGHBITDEPTH +#define INTER_PRED_BYTES_PER_PIXEL 2 +#else +#define INTER_PRED_BYTES_PER_PIXEL 1 +#endif + DECLARE_ALIGNED(16, uint8_t, + tmp_buf[INTER_PRED_BYTES_PER_PIXEL * MAX_SB_SQUARE]); +#undef INTER_PRED_BYTES_PER_PIXEL + #if CONFIG_HIGHBITDEPTH + uint8_t *tmp_dst = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) + ? CONVERT_TO_BYTEPTR(tmp_buf) + : tmp_buf; + const int bd = xd->bd; +#else + uint8_t *tmp_dst = tmp_buf; + const int bd = 8; +#endif + #if CONFIG_CONVOLVE_ROUND - DECLARE_ALIGNED(16, CONV_BUF_TYPE, tmp_dst2[MAX_SB_SQUARE]); - int tmp_dst2_stride = MAX_SB_SIZE; + const int tmp_buf_stride = MAX_SB_SIZE; + const int is_conv_no_round = conv_params->round == CONVOLVE_OPT_NO_ROUND; CONV_BUF_TYPE *org_dst = conv_params->dst; int org_dst_stride = conv_params->dst_stride; - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - memset(tmp_dst2, 0, sizeof(tmp_dst2)); - conv_params->dst = tmp_dst2; - conv_params->dst_stride = tmp_dst2_stride; - // mask compound has its own average mechanism - conv_params->do_average = 0; + CONV_BUF_TYPE *tmp_buf32 = (CONV_BUF_TYPE *)tmp_buf; + if (is_conv_no_round) { + conv_params->dst = tmp_buf32; + conv_params->dst_stride = tmp_buf_stride; + assert(conv_params->do_average == 0); } #endif // CONFIG_CONVOLVE_ROUND - DECLARE_ALIGNED(16, uint8_t, tmp_dst_[2 * MAX_SB_SQUARE]); - uint8_t *tmp_dst = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) - ? CONVERT_TO_BYTEPTR(tmp_dst_) - : tmp_dst_; + + // This will generate a prediction in tmp_buf for the second reference av1_make_inter_predictor(pre, pre_stride, tmp_dst, MAX_SB_SIZE, subpel_x, - subpel_y, sf, w, h, conv_params, interp_filter, + subpel_y, sf, w, h, conv_params, interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION warp_types, p_col, p_row, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - 0, 0, + mi, 0, #endif xs, ys, xd); + #if CONFIG_COMPOUND_SEGMENT if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) { #if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - build_compound_seg_mask_d32(comp_data.seg_mask, comp_data.mask_type, - org_dst, org_dst_stride, tmp_dst2, - tmp_dst2_stride, mi->mbmi.sb_type, h, w, - conv_params, xd->bd); + if (is_conv_no_round) { + build_compound_seg_mask_d32( + comp_data.seg_mask, comp_data.mask_type, org_dst, org_dst_stride, + tmp_buf32, tmp_buf_stride, mi->mbmi.sb_type, h, w, conv_params, bd); } else { #endif // CONFIG_CONVOLVE_ROUND +#if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { build_compound_seg_mask_highbd(comp_data.seg_mask, comp_data.mask_type, dst, dst_stride, tmp_dst, MAX_SB_SIZE, - mi->mbmi.sb_type, h, w, xd->bd); + mi->mbmi.sb_type, h, w, bd); } else { +#endif build_compound_seg_mask(comp_data.seg_mask, comp_data.mask_type, dst, dst_stride, tmp_dst, MAX_SB_SIZE, mi->mbmi.sb_type, h, w); +#if CONFIG_HIGHBITDEPTH } +#endif #if CONFIG_CONVOLVE_ROUND } #endif @@ -841,116 +1050,56 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, #endif // CONFIG_COMPOUND_SEGMENT #if CONFIG_SUPERTX +#if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) build_masked_compound_wedge_extend_highbd( dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w, xd->bd); else +#endif // CONFIG_HIGHBITDEPTH build_masked_compound_wedge_extend( dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w); #else #if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { + if (is_conv_no_round) { build_masked_compound_no_round(org_dst, org_dst_stride, org_dst, - org_dst_stride, tmp_dst2, tmp_dst2_stride, + org_dst_stride, tmp_buf32, tmp_buf_stride, &comp_data, mi->mbmi.sb_type, h, w); - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - av1_highbd_convolve_rounding( - org_dst, org_dst_stride, dst, dst_stride, w, h, - FILTER_BITS * 2 - conv_params->round_0 - conv_params->round_1, - xd->bd); - } else { - av1_convolve_rounding( - org_dst, org_dst_stride, dst, dst_stride, w, h, - FILTER_BITS * 2 - conv_params->round_0 - conv_params->round_1); - } + + const int convolve_rounding_bits = + FILTER_BITS * 2 - conv_params->round_0 - conv_params->round_1; +#if CONFIG_HIGHBITDEPTH + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) + av1_highbd_convolve_rounding(org_dst, org_dst_stride, dst, dst_stride, w, + h, convolve_rounding_bits, xd->bd); + else +#endif + av1_convolve_rounding(org_dst, org_dst_stride, dst, dst_stride, w, h, + convolve_rounding_bits); + conv_params->do_post_rounding = 0; } else { #endif // CONFIG_CONVOLVE_ROUND - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { + +#if CONFIG_HIGHBITDEPTH + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) build_masked_compound_highbd(dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h, w, xd->bd); - } else { + else +#endif // CONFIG_HIGHBITDEPTH build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h, w); - } #if CONFIG_CONVOLVE_ROUND } #endif // CONFIG_CONVOLVE_ROUND #endif // CONFIG_SUPERTX -#else // CONFIG_HIGHBITDEPTH - -#if CONFIG_CONVOLVE_ROUND - DECLARE_ALIGNED(16, CONV_BUF_TYPE, tmp_dst2[MAX_SB_SQUARE]); - int tmp_dst2_stride = MAX_SB_SIZE; - CONV_BUF_TYPE *org_dst = conv_params->dst; - int org_dst_stride = conv_params->dst_stride; - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - memset(tmp_dst2, 0, sizeof(tmp_dst2)); - conv_params->dst = tmp_dst2; - conv_params->dst_stride = tmp_dst2_stride; - // mask compound has its own average mechanism - conv_params->do_average = 0; - } -#endif - DECLARE_ALIGNED(16, uint8_t, tmp_dst[MAX_SB_SQUARE]); - av1_make_inter_predictor(pre, pre_stride, tmp_dst, MAX_SB_SIZE, subpel_x, - subpel_y, sf, w, h, conv_params, interp_filter, -#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - warp_types, p_col, p_row, plane, ref, -#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION -#if CONFIG_MOTION_VAR - 0, 0, -#endif - xs, ys, xd); -#if CONFIG_COMPOUND_SEGMENT - if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) { -#if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - build_compound_seg_mask_d32( - comp_data.seg_mask, comp_data.mask_type, org_dst, org_dst_stride, - tmp_dst2, tmp_dst2_stride, mi->mbmi.sb_type, h, w, conv_params, 8); - } else { -#endif // CONFIG_CONVOLVE_ROUND - build_compound_seg_mask(comp_data.seg_mask, comp_data.mask_type, dst, - dst_stride, tmp_dst, MAX_SB_SIZE, - mi->mbmi.sb_type, h, w); -#if CONFIG_CONVOLVE_ROUND - } -#endif - } -#endif // CONFIG_COMPOUND_SEGMENT -#if CONFIG_SUPERTX - build_masked_compound_wedge_extend(dst, dst_stride, dst, dst_stride, tmp_dst, - MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, - wedge_offset_x, wedge_offset_y, h, w); -#else -#if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - build_masked_compound_no_round(org_dst, org_dst_stride, org_dst, - org_dst_stride, tmp_dst2, tmp_dst2_stride, - &comp_data, mi->mbmi.sb_type, h, w); - av1_convolve_rounding( - org_dst, org_dst_stride, dst, dst_stride, w, h, - FILTER_BITS * 2 - conv_params->round_0 - conv_params->round_1); - conv_params->do_post_rounding = 0; - } else { -#endif // CONFIG_CONVOLVE_ROUND - build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst, - MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h, w); -#if CONFIG_CONVOLVE_ROUND - } -#endif // CONFIG_CONVOLVE_ROUND -#endif // CONFIG_SUPERTX -#endif // CONFIG_HIGHBITDEPTH #if CONFIG_COMPOUND_SEGMENT (void)plane; #endif // CONFIG_COMPOUND_SEGMENT } -#endif // CONFIG_EXT_INTER // TODO(sarahparker) av1_highbd_build_inter_predictor and // av1_build_inter_predictor should be combined with @@ -959,11 +1108,7 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, void av1_highbd_build_inter_predictor( const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const MV *src_mv, const struct scale_factors *sf, int w, int h, int ref, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + InterpFilters interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION const WarpTypesAllowed *warp_types, int p_col, int p_row, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION @@ -983,12 +1128,12 @@ void av1_highbd_build_inter_predictor( (mv.col >> SCALE_SUBPEL_BITS); av1_make_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, - sf, w, h, &conv_params, interp_filter, + sf, w, h, &conv_params, interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION warp_types, p_col, p_row, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif sf->x_step_q4, sf->y_step_q4, xd); } @@ -998,11 +1143,7 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const MV *src_mv, const struct scale_factors *sf, int w, int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + InterpFilters interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane, int ref, @@ -1022,12 +1163,12 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, (mv.col >> SCALE_SUBPEL_BITS); av1_make_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, - sf, w, h, conv_params, interp_filter, + sf, w, h, conv_params, interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION warp_types, p_col, p_row, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif sf->x_step_q4, sf->y_step_q4, xd); } @@ -1039,27 +1180,25 @@ typedef struct SubpelParams { int subpel_y; } SubpelParams; -void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, +static INLINE void build_inter_predictors( + const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, #if CONFIG_MOTION_VAR - int mi_col_offset, int mi_row_offset, + const MODE_INFO *mi, int build_for_obmc, #endif // CONFIG_MOTION_VAR - int block, int bw, int bh, int x, int y, int w, - int h, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - int wedge_offset_x, int wedge_offset_y, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - int mi_x, int mi_y) { + int block, int bw, int bh, int x, int y, int w, int h, +#if CONFIG_SUPERTX + int wedge_offset_x, int wedge_offset_y, +#endif // CONFIG_SUPERTX + int mi_x, int mi_y) { struct macroblockd_plane *const pd = &xd->plane[plane]; -#if CONFIG_MOTION_VAR - const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset]; -#else +#if !CONFIG_MOTION_VAR const MODE_INFO *mi = xd->mi[0]; #endif // CONFIG_MOTION_VAR int is_compound = has_second_ref(&mi->mbmi); -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF int is_comp_mode_pred = is_compound || is_inter_singleref_comp_mode(mi->mbmi.mode); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF int ref; #if CONFIG_INTRABC const int is_intrabc = is_intrabc_block(&mi->mbmi); @@ -1071,9 +1210,9 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]]; is_global[ref] = is_global_mv_block(mi, block, wm->wmtype); } -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF if (!is_compound && is_comp_mode_pred) is_global[1] = is_global[0]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF #endif // CONFIG_GLOBAL_MOTION #if CONFIG_CB4X4 @@ -1081,34 +1220,32 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, (void)cm; #endif -#if CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4) - const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0); -#endif // CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4) - #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE bsize = mi->mbmi.sb_type; const int ss_x = pd->subsampling_x; const int ss_y = pd->subsampling_y; int sub8x8_inter = bsize < BLOCK_8X8 && (ss_x || ss_y); + +#if CONFIG_INTRABC + if (is_intrabc) { + sub8x8_inter = 0; + } +#endif + +#if CONFIG_MOTION_VAR + sub8x8_inter = sub8x8_inter && !build_for_obmc; +#endif // CONFIG_MOTION_VAR const int row_start = (block_size_high[bsize] == 4) && ss_y ? -1 : 0; const int col_start = (block_size_wide[bsize] == 4) && ss_x ? -1 : 0; -#if CONFIG_MOTION_VAR - if (!build_for_obmc && sub8x8_inter) { -#else if (sub8x8_inter) { -#endif // CONFIG_MOTION_VAR for (int row = row_start; row <= 0 && sub8x8_inter; ++row) for (int col = col_start; col <= 0; ++col) if (!is_inter_block(&xd->mi[row * xd->mi_stride + col]->mbmi)) sub8x8_inter = 0; } -#if CONFIG_MOTION_VAR - if (!build_for_obmc && sub8x8_inter) { -#else if (sub8x8_inter) { -#endif // CONFIG_MOTION_VAR // block size const int b4_w = block_size_wide[bsize] >> ss_x; const int b4_h = block_size_high[bsize] >> ss_y; @@ -1128,11 +1265,25 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, for (idx = 0; idx < b8_w; idx += b4_w) { MB_MODE_INFO *this_mbmi = &xd->mi[row * xd->mi_stride + col]->mbmi; is_compound = has_second_ref(this_mbmi); +#if CONFIG_CONVOLVE_ROUND + DECLARE_ALIGNED(16, int32_t, tmp_dst[8 * 8]); + int tmp_dst_stride = 8; + assert(w <= 8 && h <= 8); +#endif // CONFIG_CONVOLVE_ROUND +#if CONFIG_CONVOLVE_ROUND + ConvolveParams conv_params = + get_conv_params_no_round(0, 0, plane, tmp_dst, tmp_dst_stride); +#else + ConvolveParams conv_params = get_conv_params(0, 0, plane); +#endif + struct buf_2d *const dst_buf = &pd->dst; + x = x_base + idx; + y = y_base + idy; + uint8_t *dst = dst_buf->buf + dst_buf->stride * y + x; + // TODO(zoeliu): If single ref comp modes are considered here, a // mismatch was caused. Need a further investigation. for (ref = 0; ref < 1 + is_compound; ++ref) { - struct buf_2d *const dst_buf = &pd->dst; - const RefBuffer *ref_buf = &cm->frame_refs[this_mbmi->ref_frame[ref] - LAST_FRAME]; @@ -1156,7 +1307,6 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, const struct scale_factors *const sf = &ref_buf->sf; struct buf_2d *const pre_buf = &pd->pre[ref]; #endif // CONFIG_INTRABC - uint8_t *dst = dst_buf->buf; const MV mv = this_mbmi->mv[ref].as_mv; @@ -1174,11 +1324,6 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, #endif // CONFIG_WARPED_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - x = x_base + idx; - y = y_base + idy; - - dst += dst_buf->stride * y + x; - if (is_scaled) { int ssx = pd->subsampling_x; int ssy = pd->subsampling_y; @@ -1218,17 +1363,21 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, (x + (mv_q4.col >> SUBPEL_BITS)); } - ConvolveParams conv_params = get_conv_params(ref, ref, plane); -#if CONFIG_EXT_INTER + conv_params.ref = ref; + conv_params.do_average = ref; if (is_masked_compound_type(mi->mbmi.interinter_compound_type)) { - // TODO(angiebird): use get_conv_params_no_round() here // masked compound type has its own average mechanism + conv_params.do_average = 0; +#if CONFIG_CONVOLVE_ROUND && CONFIG_COMPOUND_SEGMENT && CONFIG_SUPERTX + // TODO(angiebird): convolve_round does not support compound_segment + // when supertx is on conv_params = get_conv_params(ref, 0, plane); +#endif } if (ref && is_masked_compound_type(mi->mbmi.interinter_compound_type)) av1_make_masked_inter_predictor( pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y, - sf, w, h, &conv_params, mi->mbmi.interp_filter, xs, ys, + sf, b4_w, b4_h, &conv_params, mi->mbmi.interp_filters, xs, ys, #if CONFIG_SUPERTX wedge_offset_x, wedge_offset_y, #endif // CONFIG_SUPERTX @@ -1239,19 +1388,42 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION xd); else -#endif // CONFIG_EXT_INTER av1_make_inter_predictor( pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y, - sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filter, + sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION &warp_types, (mi_x >> pd->subsampling_x) + x, (mi_y >> pd->subsampling_y) + y, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - mi_col_offset, mi_row_offset, + mi, build_for_obmc, #endif // CONFIG_MOTION_VAR xs, ys, xd); + } // for (ref = 0; ref < 1 + is_compound; ++ref) +#if CONFIG_CONVOLVE_ROUND + if (conv_params.do_post_rounding) { +#if CONFIG_HIGHBITDEPTH + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) + av1_highbd_convolve_rounding( + tmp_dst, tmp_dst_stride, dst, dst_buf->stride, b4_w, b4_h, + FILTER_BITS * 2 + is_compound - conv_params.round_0 - + conv_params.round_1, + xd->bd); + else +#endif // CONFIG_HIGHBITDEPTH +#if CONFIG_COMPOUND_SINGLEREF + av1_convolve_rounding( + tmp_dst, tmp_dst_stride, dst, dst_buf->stride, b4_w, b4_h, + FILTER_BITS * 2 + is_comp_mode_pred - conv_params.round_0 - + conv_params.round_1); +#else // !(CONFIG_COMPOUND_SINGLEREF) + av1_convolve_rounding(tmp_dst, tmp_dst_stride, dst, dst_buf->stride, + b4_w, b4_h, + FILTER_BITS * 2 + is_compound - + conv_params.round_0 - conv_params.round_1); +#endif // CONFIG_COMPOUND_SINGLEREF } +#endif // CONFIG_CONVOLVE_ROUND ++col; } ++row; @@ -1271,14 +1443,14 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, SubpelParams subpel_params[2]; #if CONFIG_CONVOLVE_ROUND DECLARE_ALIGNED(16, int32_t, tmp_dst[MAX_SB_SIZE * MAX_SB_SIZE]); - av1_zero(tmp_dst); #endif // CONFIG_CONVOLVE_ROUND -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref) { +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref) #else - for (ref = 0; ref < 1 + is_compound; ++ref) { -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + is_compound; ++ref) +#endif // CONFIG_COMPOUND_SINGLEREF + { #if CONFIG_INTRABC const struct scale_factors *const sf = is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf; @@ -1360,11 +1532,12 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, ConvolveParams conv_params = get_conv_params(ref, ref, plane); #endif // CONFIG_CONVOLVE_ROUND -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref) { +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref) #else - for (ref = 0; ref < 1 + is_compound; ++ref) { -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + is_compound; ++ref) +#endif // CONFIG_COMPOUND_SINGLEREF + { #if CONFIG_INTRABC const struct scale_factors *const sf = is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf; @@ -1384,7 +1557,6 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION conv_params.ref = ref; conv_params.do_average = ref; -#if CONFIG_EXT_INTER if (is_masked_compound_type(mi->mbmi.interinter_compound_type)) { // masked compound type has its own average mechanism conv_params.do_average = 0; @@ -1399,7 +1571,7 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, av1_make_masked_inter_predictor( pre[ref], pre_buf->stride, dst, dst_buf->stride, subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h, - &conv_params, mi->mbmi.interp_filter, subpel_params[ref].xs, + &conv_params, mi->mbmi.interp_filters, subpel_params[ref].xs, subpel_params[ref].ys, #if CONFIG_SUPERTX wedge_offset_x, wedge_offset_y, @@ -1411,17 +1583,16 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION xd); else -#endif // CONFIG_EXT_INTER av1_make_inter_predictor( pre[ref], pre_buf->stride, dst, dst_buf->stride, subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h, - &conv_params, mi->mbmi.interp_filter, + &conv_params, mi->mbmi.interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION &warp_types, (mi_x >> pd->subsampling_x) + x, (mi_y >> pd->subsampling_y) + y, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - mi_col_offset, mi_row_offset, + mi, build_for_obmc, #endif // CONFIG_MOTION_VAR subpel_params[ref].xs, subpel_params[ref].ys, xd); } @@ -1431,22 +1602,22 @@ void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, if (conv_params.do_post_rounding) { #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) - av1_highbd_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, - w, h, FILTER_BITS * 2 + is_compound - - conv_params.round_0 - - conv_params.round_1, - xd->bd); + av1_highbd_convolve_rounding( + tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h, + FILTER_BITS * 2 + is_compound - conv_params.round_0 - + conv_params.round_1, + xd->bd); else #endif // CONFIG_HIGHBITDEPTH -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h, FILTER_BITS * 2 + is_comp_mode_pred - conv_params.round_0 - conv_params.round_1); -#else // !(CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF) +#else // !(CONFIG_COMPOUND_SINGLEREF) av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h, FILTER_BITS * 2 + is_compound - conv_params.round_0 - conv_params.round_1); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF } #endif // CONFIG_CONVOLVE_ROUND } @@ -1491,22 +1662,22 @@ static void build_inter_predictors_for_planes(const AV1_COMMON *cm, for (x = 0; x < num_4x4_w; ++x) build_inter_predictors(cm, xd, plane, #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif // CONFIG_MOTION_VAR y * 2 + x, bw, bh, 4 * x, 4 * y, pw, ph, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER +#if CONFIG_SUPERTX 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER +#endif // CONFIG_SUPERTX mi_x, mi_y); } else { build_inter_predictors(cm, xd, plane, #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif // CONFIG_MOTION_VAR 0, bw, bh, 0, 0, bw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER +#if CONFIG_SUPERTX 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER +#endif // CONFIG_SUPERTX mi_x, mi_y); } } @@ -1516,17 +1687,17 @@ void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col, BUFFER_SET *ctx, BLOCK_SIZE bsize) { build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0, 0); -#if CONFIG_EXT_INTER && CONFIG_INTERINTRA +#if CONFIG_INTERINTRA if (is_interintra_pred(&xd->mi[0]->mbmi)) { BUFFER_SET default_ctx = { { xd->plane[0].dst.buf, NULL, NULL }, { xd->plane[0].dst.stride, 0, 0 } }; if (!ctx) ctx = &default_ctx; - av1_build_interintra_predictors_sby(xd, xd->plane[0].dst.buf, + av1_build_interintra_predictors_sby(cm, xd, xd->plane[0].dst.buf, xd->plane[0].dst.stride, ctx, bsize); } #else (void)ctx; -#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA +#endif // CONFIG_INTERINTRA } void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd, @@ -1534,7 +1705,7 @@ void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd, BLOCK_SIZE bsize) { build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 1, MAX_MB_PLANE - 1); -#if CONFIG_EXT_INTER && CONFIG_INTERINTRA +#if CONFIG_INTERINTRA if (is_interintra_pred(&xd->mi[0]->mbmi)) { BUFFER_SET default_ctx = { { NULL, xd->plane[1].dst.buf, xd->plane[2].dst.buf }, @@ -1542,12 +1713,12 @@ void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd, }; if (!ctx) ctx = &default_ctx; av1_build_interintra_predictors_sbuv( - xd, xd->plane[1].dst.buf, xd->plane[2].dst.buf, xd->plane[1].dst.stride, - xd->plane[2].dst.stride, ctx, bsize); + cm, xd, xd->plane[1].dst.buf, xd->plane[2].dst.buf, + xd->plane[1].dst.stride, xd->plane[2].dst.stride, ctx, bsize); } #else (void)ctx; -#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA +#endif // CONFIG_INTERINTRA } void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, @@ -1560,8 +1731,6 @@ void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE], BLOCK_SIZE bsize, const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col) { - uint8_t *const buffers[MAX_MB_PLANE] = { src->y_buffer, src->u_buffer, - src->v_buffer }; const int widths[MAX_MB_PLANE] = { src->y_crop_width, src->uv_crop_width, src->uv_crop_width }; const int heights[MAX_MB_PLANE] = { src->y_crop_height, src->uv_crop_height, @@ -1572,7 +1741,7 @@ void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE], for (i = 0; i < MAX_MB_PLANE; ++i) { struct macroblockd_plane *const pd = &planes[i]; - setup_pred_plane(&pd->dst, bsize, buffers[i], widths[i], heights[i], + setup_pred_plane(&pd->dst, bsize, src->buffers[i], widths[i], heights[i], strides[i], mi_row, mi_col, NULL, pd->subsampling_x, pd->subsampling_y); } @@ -1733,13 +1902,10 @@ void av1_build_masked_inter_predictor_complex( } void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm, - MACROBLOCKD *xd, -#if CONFIG_EXT_INTER - int mi_row_ori, int mi_col_ori, -#endif // CONFIG_EXT_INTER - int mi_row, int mi_col, - int plane, BLOCK_SIZE bsize, - int block) { + MACROBLOCKD *xd, int mi_row_ori, + int mi_col_ori, int mi_row, + int mi_col, int plane, + BLOCK_SIZE bsize, int block) { // Prediction function used in supertx: // Use the mv at current block (which is less than 8x8) // to get prediction of a block located at (mi_row, mi_col) at size of bsize @@ -1747,10 +1913,8 @@ void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm, // block (0-3): the sub8x8 location of current block const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; -#if CONFIG_EXT_INTER const int wedge_offset_x = (mi_col_ori - mi_col) * MI_SIZE; const int wedge_offset_y = (mi_row_ori - mi_row) * MI_SIZE; -#endif // CONFIG_EXT_INTER // For sub8x8 uv: // Skip uv prediction in supertx except the first block (block = 0) @@ -1765,40 +1929,30 @@ void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm, build_inter_predictors(cm, xd, plane, #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif // CONFIG_MOTION_VAR - block, bw, bh, 0, 0, bw, bh, -#if CONFIG_EXT_INTER - wedge_offset_x, wedge_offset_y, -#endif // CONFIG_EXT_INTER - mi_x, mi_y); + block, bw, bh, 0, 0, bw, bh, wedge_offset_x, + wedge_offset_y, mi_x, mi_y); } void av1_build_inter_predictor_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd, -#if CONFIG_EXT_INTER int mi_row_ori, int mi_col_ori, -#endif // CONFIG_EXT_INTER int mi_row, int mi_col, int plane, BLOCK_SIZE bsize) { const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; -#if CONFIG_EXT_INTER const int wedge_offset_x = (mi_col_ori - mi_col) * MI_SIZE; const int wedge_offset_y = (mi_row_ori - mi_row) * MI_SIZE; -#endif // CONFIG_EXT_INTER const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]); const int bw = block_size_wide[plane_bsize]; const int bh = block_size_high[plane_bsize]; build_inter_predictors(cm, xd, plane, #if CONFIG_MOTION_VAR - 0, 0, + xd->mi[0], 0, #endif // CONFIG_MOTION_VAR - 0, bw, bh, 0, 0, bw, bh, -#if CONFIG_EXT_INTER - wedge_offset_x, wedge_offset_y, -#endif // CONFIG_EXT_INTER - mi_x, mi_y); + 0, bw, bh, 0, 0, bw, bh, wedge_offset_x, + wedge_offset_y, mi_x, mi_y); } #endif // CONFIG_SUPERTX @@ -1887,62 +2041,29 @@ const uint8_t *av1_get_obmc_mask_flipped(int length) { } #endif // CONFIG_NCOBMC +static INLINE void increment_int_ptr(MACROBLOCKD *xd, int rel_mi_rc, + uint8_t mi_hw, MODE_INFO *mi, + void *fun_ctxt) { + (void)xd; + (void)rel_mi_rc; + (void)mi_hw; + (void)mi; + ++*(int *)fun_ctxt; +} + void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col) { - int i, mi_step; MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; - xd->mi[0]->mbmi.overlappable_neighbors[0] = 0; - xd->mi[0]->mbmi.overlappable_neighbors[1] = 0; + mbmi->overlappable_neighbors[0] = 0; + mbmi->overlappable_neighbors[1] = 0; if (!is_motion_variation_allowed_bsize(mbmi->sb_type)) return; - if (xd->up_available) { - const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); - for (i = 0; i < ilimit; i += mi_step) { - int mi_row_offset = -1; - int mi_col_offset = i; - MODE_INFO *above_mi = - xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *above_mbmi = &above_mi->mbmi; -#if CONFIG_CHROMA_SUB8X8 - if (above_mbmi->sb_type < BLOCK_8X8) { - ++mi_col_offset; - above_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } -#endif - BLOCK_SIZE above_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8); - mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_bsize]); - - if (is_neighbor_overlappable(above_mbmi)) - xd->mi[0]->mbmi.overlappable_neighbors[0]++; - } - } - - if (xd->left_available) { - const int ilimit = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); - for (i = 0; i < ilimit; i += mi_step) { - int mi_row_offset = i; - int mi_col_offset = -1; - MODE_INFO *left_mi = - xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *left_mbmi = &left_mi->mbmi; - -#if CONFIG_CHROMA_SUB8X8 - if (left_mbmi->sb_type < BLOCK_8X8) { - ++mi_row_offset; - left_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } -#endif - BLOCK_SIZE left_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8); - mi_step = AOMMIN(xd->n8_h, mi_size_high[left_bsize]); - - if (is_neighbor_overlappable(left_mbmi)) - xd->mi[0]->mbmi.overlappable_neighbors[1]++; - } - } + foreach_overlappable_nb_above(cm, xd, mi_col, INT_MAX, increment_int_ptr, + &mbmi->overlappable_neighbors[0]); + foreach_overlappable_nb_left(cm, xd, mi_row, INT_MAX, increment_int_ptr, + &mbmi->overlappable_neighbors[1]); } // HW does not support < 4x4 prediction. To limit the bandwidth requirement, for @@ -1974,146 +2095,113 @@ int skip_u4x4_pred_in_obmc(BLOCK_SIZE bsize, const struct macroblockd_plane *pd, } } -// This function combines motion compensated predictions that is generated by -// top/left neighboring blocks' inter predictors with the regular inter -// prediction. We assume the original prediction (bmc) is stored in -// xd->plane[].dst.buf -void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, - int mi_row, int mi_col, - uint8_t *above[MAX_MB_PLANE], - int above_stride[MAX_MB_PLANE], - uint8_t *left[MAX_MB_PLANE], - int left_stride[MAX_MB_PLANE]) { +struct obmc_inter_pred_ctxt { + uint8_t **adjacent; + int *adjacent_stride; +}; + +static INLINE void build_obmc_inter_pred_above(MACROBLOCKD *xd, int rel_mi_col, + uint8_t above_mi_width, + MODE_INFO *above_mi, + void *fun_ctxt) { + (void)above_mi; + struct obmc_inter_pred_ctxt *ctxt = (struct obmc_inter_pred_ctxt *)fun_ctxt; const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; - int plane, i; #if CONFIG_HIGHBITDEPTH const int is_hbd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0; #endif // CONFIG_HIGHBITDEPTH + const int overlap = + AOMMIN(block_size_high[bsize], block_size_high[BLOCK_64X64]) >> 1; - // handle above row - if (xd->up_available) { - const int overlap = - AOMMIN(block_size_high[bsize] >> 1, block_size_high[BLOCK_64X64] >> 1); - const int miw = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); - const int mi_row_offset = -1; - const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]]; - int neighbor_count = 0; - - assert(miw > 0); - - i = 0; - do { // for each mi in the above row - int mi_col_offset = i; - MB_MODE_INFO *above_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; -#if CONFIG_CHROMA_SUB8X8 - if (above_mbmi->sb_type < BLOCK_8X8) { - ++mi_col_offset; - above_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } -#endif - - const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type); - const int above_step = - AOMMIN(mi_size_wide[a_bsize], mi_size_wide[BLOCK_64X64]); - const int mi_step = AOMMIN(xd->n8_w, above_step); - - if (is_neighbor_overlappable(above_mbmi)) { - neighbor_count++; - if (neighbor_count > neighbor_limit) break; - for (plane = 0; plane < MAX_MB_PLANE; ++plane) { - const struct macroblockd_plane *pd = &xd->plane[plane]; - const int bw = (mi_step * MI_SIZE) >> pd->subsampling_x; - const int bh = overlap >> pd->subsampling_y; + for (int plane = 0; plane < MAX_MB_PLANE; ++plane) { + const struct macroblockd_plane *pd = &xd->plane[plane]; + const int bw = (above_mi_width * MI_SIZE) >> pd->subsampling_x; + const int bh = overlap >> pd->subsampling_y; + const int plane_col = (rel_mi_col * MI_SIZE) >> pd->subsampling_x; - if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue; + if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue; - const int dst_stride = pd->dst.stride; - uint8_t *const dst = &pd->dst.buf[(i * MI_SIZE) >> pd->subsampling_x]; - const int tmp_stride = above_stride[plane]; - const uint8_t *const tmp = - &above[plane][(i * MI_SIZE) >> pd->subsampling_x]; - const uint8_t *const mask = av1_get_obmc_mask(bh); + const int dst_stride = pd->dst.stride; + uint8_t *const dst = &pd->dst.buf[plane_col]; + const int tmp_stride = ctxt->adjacent_stride[plane]; + const uint8_t *const tmp = &ctxt->adjacent[plane][plane_col]; + const uint8_t *const mask = av1_get_obmc_mask(bh); #if CONFIG_HIGHBITDEPTH - if (is_hbd) - aom_highbd_blend_a64_vmask(dst, dst_stride, dst, dst_stride, tmp, - tmp_stride, mask, bh, bw, xd->bd); - else + if (is_hbd) + aom_highbd_blend_a64_vmask(dst, dst_stride, dst, dst_stride, tmp, + tmp_stride, mask, bh, bw, xd->bd); + else #endif // CONFIG_HIGHBITDEPTH - aom_blend_a64_vmask(dst, dst_stride, dst, dst_stride, tmp, - tmp_stride, mask, bh, bw); - } - } - i += mi_step; - } while (i < miw); + aom_blend_a64_vmask(dst, dst_stride, dst, dst_stride, tmp, tmp_stride, + mask, bh, bw); } +} - // handle left column - if (xd->left_available) { - const int overlap = - AOMMIN(block_size_wide[bsize] >> 1, block_size_wide[BLOCK_64X64] >> 1); - const int mih = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); - const int mi_col_offset = -1; - const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]]; - int neighbor_count = 0; - - assert(mih > 0); - - i = 0; - do { // for each mi in the left column - int mi_row_offset = i; - MB_MODE_INFO *left_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; -#if CONFIG_CHROMA_SUB8X8 - if (left_mbmi->sb_type < BLOCK_8X8) { - ++mi_row_offset; - left_mbmi = - &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } -#endif +static INLINE void build_obmc_inter_pred_left(MACROBLOCKD *xd, int rel_mi_row, + uint8_t left_mi_height, + MODE_INFO *left_mi, + void *fun_ctxt) { + (void)left_mi; + struct obmc_inter_pred_ctxt *ctxt = (struct obmc_inter_pred_ctxt *)fun_ctxt; + const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + const int overlap = + AOMMIN(block_size_wide[bsize], block_size_wide[BLOCK_64X64]) >> 1; +#if CONFIG_HIGHBITDEPTH + const int is_hbd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0; +#endif // CONFIG_HIGHBITDEPTH + + for (int plane = 0; plane < MAX_MB_PLANE; ++plane) { + const struct macroblockd_plane *pd = &xd->plane[plane]; + const int bw = overlap >> pd->subsampling_x; + const int bh = (left_mi_height * MI_SIZE) >> pd->subsampling_y; + const int plane_row = (rel_mi_row * MI_SIZE) >> pd->subsampling_y; + + if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; - const BLOCK_SIZE l_bsize = AOMMAX(BLOCK_8X8, left_mbmi->sb_type); - const int left_step = - AOMMIN(mi_size_high[l_bsize], mi_size_high[BLOCK_64X64]); - const int mi_step = AOMMIN(xd->n8_h, left_step); - - if (is_neighbor_overlappable(left_mbmi)) { - neighbor_count++; - if (neighbor_count > neighbor_limit) break; - for (plane = 0; plane < MAX_MB_PLANE; ++plane) { - const struct macroblockd_plane *pd = &xd->plane[plane]; - const int bw = overlap >> pd->subsampling_x; - const int bh = (mi_step * MI_SIZE) >> pd->subsampling_y; - - if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; - - const int dst_stride = pd->dst.stride; - uint8_t *const dst = - &pd->dst.buf[(i * MI_SIZE * dst_stride) >> pd->subsampling_y]; - const int tmp_stride = left_stride[plane]; - const uint8_t *const tmp = - &left[plane][(i * MI_SIZE * tmp_stride) >> pd->subsampling_y]; - const uint8_t *const mask = av1_get_obmc_mask(bw); + const int dst_stride = pd->dst.stride; + uint8_t *const dst = &pd->dst.buf[plane_row * dst_stride]; + const int tmp_stride = ctxt->adjacent_stride[plane]; + const uint8_t *const tmp = &ctxt->adjacent[plane][plane_row * tmp_stride]; + const uint8_t *const mask = av1_get_obmc_mask(bw); #if CONFIG_HIGHBITDEPTH - if (is_hbd) - aom_highbd_blend_a64_hmask(dst, dst_stride, dst, dst_stride, tmp, - tmp_stride, mask, bh, bw, xd->bd); - else + if (is_hbd) + aom_highbd_blend_a64_hmask(dst, dst_stride, dst, dst_stride, tmp, + tmp_stride, mask, bh, bw, xd->bd); + else #endif // CONFIG_HIGHBITDEPTH - aom_blend_a64_hmask(dst, dst_stride, dst, dst_stride, tmp, - tmp_stride, mask, bh, bw); - } - } - i += mi_step; - } while (i < mih); + aom_blend_a64_hmask(dst, dst_stride, dst, dst_stride, tmp, tmp_stride, + mask, bh, bw); } } +// This function combines motion compensated predictions that are generated by +// top/left neighboring blocks' inter predictors with the regular inter +// prediction. We assume the original prediction (bmc) is stored in +// xd->plane[].dst.buf +void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, + int mi_row, int mi_col, + uint8_t *above[MAX_MB_PLANE], + int above_stride[MAX_MB_PLANE], + uint8_t *left[MAX_MB_PLANE], + int left_stride[MAX_MB_PLANE]) { + const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + + // handle above row + struct obmc_inter_pred_ctxt ctxt_above = { above, above_stride }; + foreach_overlappable_nb_above(cm, xd, mi_col, + max_neighbor_obmc[b_width_log2_lookup[bsize]], + build_obmc_inter_pred_above, &ctxt_above); + + // handle left column + struct obmc_inter_pred_ctxt ctxt_left = { left, left_stride }; + foreach_overlappable_nb_left(cm, xd, mi_row, + max_neighbor_obmc[b_height_log2_lookup[bsize]], + build_obmc_inter_pred_left, &ctxt_left); +} + void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) { -#if CONFIG_EXT_INTER if (is_interintra_pred(mbmi)) { mbmi->ref_frame[1] = NONE_FRAME; } else if (has_second_ref(mbmi) && @@ -2129,109 +2217,190 @@ void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) { mbmi->mv[0].as_int = mbmi->mv[1].as_int; #endif // CONFIG_COMPOUND_SINGLEREF } -#endif // CONFIG_EXT_INTER if (has_second_ref(mbmi)) mbmi->ref_frame[1] = NONE_FRAME; return; } +struct build_prediction_ctxt { + const AV1_COMMON *cm; + int mi_row; + int mi_col; + uint8_t **tmp_buf; + int *tmp_width; + int *tmp_height; + int *tmp_stride; + int mb_to_far_edge; +}; + +static INLINE void build_prediction_by_above_pred(MACROBLOCKD *xd, + int rel_mi_col, + uint8_t above_mi_width, + MODE_INFO *above_mi, + void *fun_ctxt) { + MB_MODE_INFO *above_mbmi = &above_mi->mbmi; + const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type); + struct build_prediction_ctxt *ctxt = (struct build_prediction_ctxt *)fun_ctxt; + const int above_mi_col = ctxt->mi_col + rel_mi_col; + + MB_MODE_INFO backup_mbmi = *above_mbmi; + modify_neighbor_predictor_for_obmc(above_mbmi); + + for (int j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, a_bsize, ctxt->tmp_buf[j], ctxt->tmp_width[j], + ctxt->tmp_height[j], ctxt->tmp_stride[j], 0, rel_mi_col, + NULL, pd->subsampling_x, pd->subsampling_y); + } + +#if CONFIG_COMPOUND_SINGLEREF + const int num_refs = 1 + is_inter_anyref_comp_mode(above_mbmi->mode); +#else + const int num_refs = 1 + has_second_ref(above_mbmi); +#endif + + for (int ref = 0; ref < num_refs; ++ref) { +#if CONFIG_COMPOUND_SINGLEREF + const MV_REFERENCE_FRAME frame = has_second_ref(above_mbmi) + ? above_mbmi->ref_frame[ref] + : above_mbmi->ref_frame[0]; +#else + const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF + + const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME]; + + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, ctxt->mi_row, above_mi_col, + &ref_buf->sf); + } + + xd->mb_to_left_edge = 8 * MI_SIZE * (-above_mi_col); + xd->mb_to_right_edge = ctxt->mb_to_far_edge + + (xd->n8_w - rel_mi_col - above_mi_width) * MI_SIZE * 8; + + int mi_x = above_mi_col << MI_SIZE_LOG2; + int mi_y = ctxt->mi_row << MI_SIZE_LOG2; + + const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + + for (int j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + int bw = (above_mi_width * MI_SIZE) >> pd->subsampling_x; + int bh = clamp(block_size_high[bsize] >> (pd->subsampling_y + 1), 4, + block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1)); + + if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue; + build_inter_predictors(ctxt->cm, xd, j, above_mi, 1, 0, bw, bh, 0, 0, bw, + bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + *above_mbmi = backup_mbmi; +} + void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col, uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE], int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) { - const TileInfo *const tile = &xd->tile; + if (!xd->up_available) return; + + // Adjust mb_to_bottom_edge to have the correct value for the OBMC + // prediction block. This is half the height of the original block, + // except for 128-wide blocks, where we only use a height of 32. + int this_height = xd->n8_h * MI_SIZE; + int pred_height = AOMMIN(this_height / 2, 32); + xd->mb_to_bottom_edge += (this_height - pred_height) * 8; + + struct build_prediction_ctxt ctxt = { cm, mi_row, + mi_col, tmp_buf, + tmp_width, tmp_height, + tmp_stride, xd->mb_to_right_edge }; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; - int i, j, mi_step, ref; - const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); - int mb_to_right_edge_base = xd->mb_to_right_edge; - const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]]; - int neighbor_count = 0; + foreach_overlappable_nb_above(cm, xd, mi_col, + max_neighbor_obmc[b_width_log2_lookup[bsize]], + build_prediction_by_above_pred, &ctxt); - if (mi_row <= tile->mi_row_start) return; + xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); + xd->mb_to_right_edge = ctxt.mb_to_far_edge; + xd->mb_to_bottom_edge -= (this_height - pred_height) * 8; +} - xd->mb_to_bottom_edge += xd->n8_h * 32; - for (i = 0; i < ilimit; i += mi_step) { - int mi_row_offset = -1; - int mi_col_offset = i; - int mi_x, mi_y, bw, bh; - MODE_INFO *above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *above_mbmi = &above_mi->mbmi; +static INLINE void build_prediction_by_left_pred(MACROBLOCKD *xd, + int rel_mi_row, + uint8_t left_mi_height, + MODE_INFO *left_mi, + void *fun_ctxt) { + MB_MODE_INFO *left_mbmi = &left_mi->mbmi; + const BLOCK_SIZE l_bsize = AOMMAX(BLOCK_8X8, left_mbmi->sb_type); + struct build_prediction_ctxt *ctxt = (struct build_prediction_ctxt *)fun_ctxt; + const int left_mi_row = ctxt->mi_row + rel_mi_row; + + MB_MODE_INFO backup_mbmi = *left_mbmi; + modify_neighbor_predictor_for_obmc(left_mbmi); + + for (int j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, l_bsize, ctxt->tmp_buf[j], ctxt->tmp_width[j], + ctxt->tmp_height[j], ctxt->tmp_stride[j], rel_mi_row, 0, + NULL, pd->subsampling_x, pd->subsampling_y); + } -#if CONFIG_CHROMA_SUB8X8 - if (above_mbmi->sb_type < BLOCK_8X8) { - ++mi_col_offset; - above_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } +#if CONFIG_COMPOUND_SINGLEREF + const int num_refs = 1 + is_inter_anyref_comp_mode(left_mbmi->mode); +#else + const int num_refs = 1 + has_second_ref(left_mbmi); #endif - const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type); - MB_MODE_INFO backup_mbmi; - - const int above_step = - AOMMIN(mi_size_wide[a_bsize], mi_size_wide[BLOCK_64X64]); - mi_step = AOMMIN(xd->n8_w, above_step); + for (int ref = 0; ref < num_refs; ++ref) { +#if CONFIG_COMPOUND_SINGLEREF + const MV_REFERENCE_FRAME frame = has_second_ref(left_mbmi) + ? left_mbmi->ref_frame[ref] + : left_mbmi->ref_frame[0]; +#else + const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF - if (!is_neighbor_overlappable(above_mbmi)) continue; + const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME]; - neighbor_count++; - if (neighbor_count > neighbor_limit) break; + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, left_mi_row, ctxt->mi_col, + &ref_buf->sf); + } - backup_mbmi = *above_mbmi; - modify_neighbor_predictor_for_obmc(above_mbmi); + xd->mb_to_top_edge = 8 * MI_SIZE * (-left_mi_row); + xd->mb_to_bottom_edge = + ctxt->mb_to_far_edge + + (xd->n8_h - rel_mi_row - left_mi_height) * MI_SIZE * 8; - for (j = 0; j < MAX_MB_PLANE; ++j) { - struct macroblockd_plane *const pd = &xd->plane[j]; - setup_pred_plane(&pd->dst, a_bsize, tmp_buf[j], tmp_width[j], - tmp_height[j], tmp_stride[j], 0, i, NULL, - pd->subsampling_x, pd->subsampling_y); - } -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(above_mbmi->mode)); - ++ref) { - const MV_REFERENCE_FRAME frame = has_second_ref(above_mbmi) - ? above_mbmi->ref_frame[ref] - : above_mbmi->ref_frame[0]; -#else // !(CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF) - for (ref = 0; ref < 1 + has_second_ref(above_mbmi); ++ref) { - const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + int mi_x = ctxt->mi_col << MI_SIZE_LOG2; + int mi_y = left_mi_row << MI_SIZE_LOG2; - xd->block_refs[ref] = ref_buf; - if ((!av1_is_valid_scale(&ref_buf->sf))) - aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, - "Reference frame has invalid dimensions"); - av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col + i, - &ref_buf->sf); - } + const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; - xd->mb_to_left_edge = -(((mi_col + i) * MI_SIZE) * 8); - xd->mb_to_right_edge = - mb_to_right_edge_base + (xd->n8_w - i - mi_step) * 64; - mi_x = (mi_col + i) << MI_SIZE_LOG2; - mi_y = mi_row << MI_SIZE_LOG2; + for (int j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + int bw = clamp(block_size_wide[bsize] >> (pd->subsampling_x + 1), 4, + block_size_wide[BLOCK_64X64] >> (pd->subsampling_x + 1)); + int bh = (left_mi_height << MI_SIZE_LOG2) >> pd->subsampling_y; - for (j = 0; j < MAX_MB_PLANE; ++j) { - const struct macroblockd_plane *pd = &xd->plane[j]; - bw = (mi_step * MI_SIZE) >> pd->subsampling_x; - bh = AOMMAX((num_4x4_blocks_high_lookup[bsize] * 2) >> pd->subsampling_y, - 4); - bh = AOMMIN(bh, block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1)); - - if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue; - build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, - 0, 0, bw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - mi_x, mi_y); - } - *above_mbmi = backup_mbmi; + if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; + build_inter_predictors(ctxt->cm, xd, j, left_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); } - xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); - xd->mb_to_right_edge = mb_to_right_edge_base; - xd->mb_to_bottom_edge -= xd->n8_h * 32; + *left_mbmi = backup_mbmi; } void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, @@ -2240,97 +2409,27 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int tmp_width[MAX_MB_PLANE], int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) { - const TileInfo *const tile = &xd->tile; + if (!xd->left_available) return; + + // Adjust mb_to_right_edge to have the correct value for the OBMC + // prediction block. This is half the width of the original block, + // except for 128-wide blocks, where we only use a width of 32. + int this_width = xd->n8_w * MI_SIZE; + int pred_width = AOMMIN(this_width / 2, 32); + xd->mb_to_right_edge += (this_width - pred_width) * 8; + + struct build_prediction_ctxt ctxt = { cm, mi_row, + mi_col, tmp_buf, + tmp_width, tmp_height, + tmp_stride, xd->mb_to_bottom_edge }; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; - int i, j, mi_step, ref; - const int ilimit = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); - int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; - const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]]; - int neighbor_count = 0; - - if (mi_col == 0 || (mi_col - 1 < tile->mi_col_start)) return; - - xd->mb_to_right_edge += xd->n8_w * 32; - for (i = 0; i < ilimit; i += mi_step) { - int mi_row_offset = i; - int mi_col_offset = -1; - int mi_x, mi_y, bw, bh; - MODE_INFO *left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; - MB_MODE_INFO *left_mbmi = &left_mi->mbmi; - -#if CONFIG_CHROMA_SUB8X8 - if (left_mbmi->sb_type < BLOCK_8X8) { - ++mi_row_offset; - left_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi; - } -#endif - - const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8); - MB_MODE_INFO backup_mbmi; - const int left_step = - AOMMIN(mi_size_high[l_bsize], mi_size_high[BLOCK_64X64]); - mi_step = AOMMIN(xd->n8_h, left_step); + foreach_overlappable_nb_left(cm, xd, mi_row, + max_neighbor_obmc[b_height_log2_lookup[bsize]], + build_prediction_by_left_pred, &ctxt); - if (!is_neighbor_overlappable(left_mbmi)) continue; - - neighbor_count++; - if (neighbor_count > neighbor_limit) break; - - backup_mbmi = *left_mbmi; - modify_neighbor_predictor_for_obmc(left_mbmi); - - for (j = 0; j < MAX_MB_PLANE; ++j) { - struct macroblockd_plane *const pd = &xd->plane[j]; - setup_pred_plane(&pd->dst, l_bsize, tmp_buf[j], tmp_width[j], - tmp_height[j], tmp_stride[j], i, 0, NULL, - pd->subsampling_x, pd->subsampling_y); - } -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(left_mbmi->mode)); - ++ref) { - const MV_REFERENCE_FRAME frame = has_second_ref(left_mbmi) - ? left_mbmi->ref_frame[ref] - : left_mbmi->ref_frame[0]; -#else // !(CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF) - for (ref = 0; ref < 1 + has_second_ref(left_mbmi); ++ref) { - const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; - - xd->block_refs[ref] = ref_buf; - if ((!av1_is_valid_scale(&ref_buf->sf))) - aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, - "Reference frame has invalid dimensions"); - av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row + i, mi_col, - &ref_buf->sf); - } - - xd->mb_to_top_edge = -(((mi_row + i) * MI_SIZE) * 8); - xd->mb_to_bottom_edge = - mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * 64; - mi_x = mi_col << MI_SIZE_LOG2; - mi_y = (mi_row + i) << MI_SIZE_LOG2; - - for (j = 0; j < MAX_MB_PLANE; ++j) { - const struct macroblockd_plane *pd = &xd->plane[j]; - bw = AOMMAX((num_4x4_blocks_wide_lookup[bsize] * 2) >> pd->subsampling_x, - 4); - bw = AOMMIN(bw, block_size_wide[BLOCK_64X64] >> (pd->subsampling_x + 1)); - bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; - - if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; - build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, - 0, 0, bw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - mi_x, mi_y); - } - *left_mbmi = backup_mbmi; - } xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); - xd->mb_to_bottom_edge = mb_to_bottom_edge_base; - xd->mb_to_right_edge -= xd->n8_w * 32; + xd->mb_to_right_edge -= (this_width - pred_width) * 8; + xd->mb_to_bottom_edge = ctxt.mb_to_far_edge; } void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, @@ -2388,7 +2487,9 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) { const TileInfo *const tile = &xd->tile; +#if CONFIG_DEBUG BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; +#endif int i, j, mi_step, ref; const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); int mb_to_right_edge_base = xd->mb_to_right_edge; @@ -2405,18 +2506,14 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_x, mi_y, bw, bh; MODE_INFO *mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; MB_MODE_INFO *mbmi = &mi->mbmi; -#if CONFIG_EXT_INTER MB_MODE_INFO backup_mbmi; -#endif // CONFIG_EXT_INTER mi_step = AOMMIN(xd->n8_w, mi_size_wide[mbmi->sb_type]); if (!is_neighbor_overlappable(mbmi)) continue; -#if CONFIG_EXT_INTER backup_mbmi = *mbmi; modify_neighbor_predictor_for_obmc(mbmi); -#endif // CONFIG_EXT_INTER for (j = 0; j < MAX_MB_PLANE; ++j) { struct macroblockd_plane *const pd = &xd->plane[j]; @@ -2441,12 +2538,12 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, xd->mb_to_right_edge = mb_to_right_edge_base + (xd->n8_w - i - mi_step) * 64; mi_x = (mi_col + i) << MI_SIZE_LOG2; - mi_y = (mi_row << MI_SIZE_LOG2) + xd->n8_h * 4; + mi_y = (mi_row << MI_SIZE_LOG2) + xd->n8_h * (MI_SIZE >> 1); for (j = 0; j < MAX_MB_PLANE; ++j) { const struct macroblockd_plane *pd = &xd->plane[j]; bw = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_x; - bh = (num_4x4_blocks_high_lookup[bsize] << 1) >> pd->subsampling_y; + bh = (xd->n8_h << (MI_SIZE_LOG2 - 1)) >> pd->subsampling_y; if (mbmi->sb_type < BLOCK_8X8 && !CONFIG_CB4X4) { const PARTITION_TYPE bp = BLOCK_8X8 - mbmi->sb_type; @@ -2462,28 +2559,26 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, if ((bp == PARTITION_HORZ || bp == PARTITION_SPLIT) && y != 0) continue; - build_inter_predictors( - cm, xd, j, mi_col_offset, mi_row_offset, y * 2 + x, bw, bh, - (4 * x) >> pd->subsampling_x, - xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, pw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - mi_x, mi_y); + build_inter_predictors(cm, xd, j, mi, 1, y * 2 + x, bw, bh, + (4 * x) >> pd->subsampling_x, + xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, + pw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); } } else { - build_inter_predictors( - cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0, - xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, bw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - mi_x, mi_y); + build_inter_predictors(cm, xd, j, mi, 1, 0, bw, bh, 0, + xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, bw, + bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); } } -#if CONFIG_EXT_INTER *mbmi = backup_mbmi; -#endif // CONFIG_EXT_INTER } xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); xd->mb_to_right_edge = mb_to_right_edge_base; @@ -2497,7 +2592,9 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int tmp_height[MAX_MB_PLANE], const int tmp_stride[MAX_MB_PLANE]) { const TileInfo *const tile = &xd->tile; +#if CONFIG_DEBUG BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; +#endif int i, j, mi_step, ref; const int ilimit = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; @@ -2506,25 +2603,23 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, (mi_col + xd->n8_w) % MI_SIZE == 0 || (mi_col + xd->n8_w) >= cm->mi_cols) return; - xd->mb_to_left_edge -= xd->n8_w * 32; + assert(bsize >= BLOCK_8X8); + + xd->mb_to_left_edge -= xd->n8_w / 2 * MI_SIZE * 8; for (i = 0; i < ilimit; i += mi_step) { int mi_row_offset = i; int mi_col_offset = xd->n8_w; int mi_x, mi_y, bw, bh; MODE_INFO *mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; MB_MODE_INFO *mbmi = &mi->mbmi; -#if CONFIG_EXT_INTER MB_MODE_INFO backup_mbmi; -#endif // CONFIG_EXT_INTER mi_step = AOMMIN(xd->n8_h, mi_size_high[mbmi->sb_type]); if (!is_neighbor_overlappable(mbmi)) continue; -#if CONFIG_EXT_INTER backup_mbmi = *mbmi; modify_neighbor_predictor_for_obmc(mbmi); -#endif // CONFIG_EXT_INTER for (j = 0; j < MAX_MB_PLANE; ++j) { struct macroblockd_plane *const pd = &xd->plane[j]; @@ -2547,13 +2642,13 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, xd->mb_to_top_edge = -(((mi_row + i) * MI_SIZE) * 8); xd->mb_to_bottom_edge = - mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * 64; - mi_x = (mi_col << MI_SIZE_LOG2) + xd->n8_w * 4; + mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * MI_SIZE * 8; + mi_x = (mi_col << MI_SIZE_LOG2) + xd->n8_w * (MI_SIZE >> 1); mi_y = (mi_row + i) << MI_SIZE_LOG2; for (j = 0; j < MAX_MB_PLANE; ++j) { const struct macroblockd_plane *pd = &xd->plane[j]; - bw = (num_4x4_blocks_wide_lookup[bsize] << 1) >> pd->subsampling_x; + bw = (xd->n8_w << (MI_SIZE_LOG2 - 1)) >> pd->subsampling_x; bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; if (mbmi->sb_type < BLOCK_8X8 && !CONFIG_CB4X4) { @@ -2570,32 +2665,29 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, if ((bp == PARTITION_VERT || bp == PARTITION_SPLIT) && x != 0) continue; - build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, - y * 2 + x, bw, bh, + build_inter_predictors(cm, xd, j, mi, 1, y * 2 + x, bw, bh, xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, (4 * y) >> pd->subsampling_y, bw, ph, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER +#if CONFIG_SUPERTX 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER +#endif // CONFIG_SUPERTX mi_x, mi_y); } } else { - build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, - bh, xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, - 0, bw, bh, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER + build_inter_predictors(cm, xd, j, mi, 1, 0, bw, bh, + xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, 0, + bw, bh, +#if CONFIG_SUPERTX 0, 0, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER +#endif // CONFIG_SUPERTX mi_x, mi_y); } } -#if CONFIG_EXT_INTER *mbmi = backup_mbmi; -#endif // CONFIG_EXT_INTER } xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); xd->mb_to_bottom_edge = mb_to_bottom_edge_base; - xd->mb_to_left_edge += xd->n8_w * 32; + xd->mb_to_left_edge += xd->n8_w / 2 * MI_SIZE * 8; } // This function combines motion compensated predictions that is generated by @@ -2764,9 +2856,33 @@ void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, mi_col); } #endif // CONFIG_NCOBMC + +#if CONFIG_NCOBMC_ADAPT_WEIGHT +void reset_xd_boundary(MACROBLOCKD *xd, int mi_row, int bh, int mi_col, int bw, + int mi_rows, int mi_cols) { + xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); + xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; + xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); + xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; +} +void set_sb_mi_boundaries(const AV1_COMMON *const cm, MACROBLOCKD *const xd, + const int mi_row, const int mi_col) { + const BLOCK_SIZE sb = cm->sb_size; + const int num_mi_w = mi_size_wide[sb]; + const int num_mi_h = mi_size_high[sb]; + + xd->sb_mi_bd.mi_col_begin = mi_col; + xd->sb_mi_bd.mi_row_begin = mi_row; + // points to the last mi + xd->sb_mi_bd.mi_col_end = + mi_col + num_mi_w > cm->mi_cols ? cm->mi_cols - 1 : mi_col + num_mi_w - 1; + xd->sb_mi_bd.mi_row_end = + mi_row + num_mi_h > cm->mi_rows ? cm->mi_rows - 1 : mi_row + num_mi_h - 1; +} +#endif + #endif // CONFIG_MOTION_VAR -#if CONFIG_EXT_INTER /* clang-format off */ #if CONFIG_INTERINTRA #if CONFIG_EXT_PARTITION @@ -2785,7 +2901,7 @@ static int ii_size_scales[BLOCK_SIZES_ALL] = { #endif 32, 16, 16, 16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1, - 16, 16, 8, 8, + 16, 16, 8, 8, 4, 4, 2, 2 }; #else static const int ii_weights1d[MAX_SB_SIZE] = { @@ -2800,7 +2916,7 @@ static int ii_size_scales[BLOCK_SIZES_ALL] = { #endif 16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1, - 8, 8, 4, 4, + 8, 8, 4, 4, 2, 2, }; /* clang-format on */ #endif // CONFIG_EXT_PARTITION @@ -2852,7 +2968,6 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra, } break; -#if CONFIG_ALT_INTRA case II_SMOOTH_PRED: for (i = 0; i < bh; ++i) { for (j = 0; j < bw; ++j) { @@ -2863,11 +2978,7 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra, } } break; -#endif -#if !CONFIG_ALT_INTRA - case II_TM_PRED: -#endif case II_DC_PRED: default: for (i = 0; i < bh; ++i) { @@ -2902,8 +3013,8 @@ static void combine_interintra_highbd( const int subh = 2 * num_4x4_blocks_high_lookup[bsize] == bh; const int subw = 2 * num_4x4_blocks_wide_lookup[bsize] == bw; aom_highbd_blend_a64_mask(comppred8, compstride, intrapred8, intrastride, - interpred8, interstride, mask, bw, bh, bw, subh, - subw, bd); + interpred8, interstride, mask, + block_size_wide[bsize], bh, bw, subh, subw, bd); } return; } @@ -2931,7 +3042,6 @@ static void combine_interintra_highbd( } break; -#if CONFIG_ALT_INTRA case II_SMOOTH_PRED: for (i = 0; i < bh; ++i) { for (j = 0; j < bw; ++j) { @@ -2942,11 +3052,7 @@ static void combine_interintra_highbd( } } break; -#endif -#if !CONFIG_ALT_INTRA - case II_TM_PRED: -#endif case II_DC_PRED: default: for (i = 0; i < bh; ++i) { @@ -2960,7 +3066,8 @@ static void combine_interintra_highbd( } #endif // CONFIG_HIGHBITDEPTH -void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd, +void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm, + MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane, BUFFER_SET *ctx, uint8_t *dst, int dst_stride) { @@ -2969,7 +3076,7 @@ void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd, PREDICTION_MODE mode = interintra_to_intra_mode[xd->mi[0]->mbmi.interintra_mode]; - av1_predict_intra_block(xd, pd->width, pd->height, plane_bsize, mode, + av1_predict_intra_block(cm, xd, pd->width, pd->height, plane_bsize, mode, ctx->plane[plane], ctx->stride[plane], dst, dst_stride, 0, 0, plane); } @@ -2997,14 +3104,14 @@ void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane, inter_pred, inter_stride, intra_pred, intra_stride); } -void av1_build_interintra_predictors_sby(MACROBLOCKD *xd, uint8_t *ypred, - int ystride, BUFFER_SET *ctx, - BLOCK_SIZE bsize) { +void av1_build_interintra_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *ypred, int ystride, + BUFFER_SET *ctx, BLOCK_SIZE bsize) { #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { DECLARE_ALIGNED(16, uint16_t, intrapredictor[MAX_SB_SQUARE]); av1_build_intra_predictors_for_interintra( - xd, bsize, 0, ctx, CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE); + cm, xd, bsize, 0, ctx, CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE); av1_combine_interintra(xd, bsize, 0, ypred, ystride, CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE); return; @@ -3012,21 +3119,22 @@ void av1_build_interintra_predictors_sby(MACROBLOCKD *xd, uint8_t *ypred, #endif // CONFIG_HIGHBITDEPTH { DECLARE_ALIGNED(16, uint8_t, intrapredictor[MAX_SB_SQUARE]); - av1_build_intra_predictors_for_interintra(xd, bsize, 0, ctx, intrapredictor, - MAX_SB_SIZE); + av1_build_intra_predictors_for_interintra(cm, xd, bsize, 0, ctx, + intrapredictor, MAX_SB_SIZE); av1_combine_interintra(xd, bsize, 0, ypred, ystride, intrapredictor, MAX_SB_SIZE); } } -void av1_build_interintra_predictors_sbc(MACROBLOCKD *xd, uint8_t *upred, - int ustride, BUFFER_SET *ctx, - int plane, BLOCK_SIZE bsize) { +void av1_build_interintra_predictors_sbc(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *upred, int ustride, + BUFFER_SET *ctx, int plane, + BLOCK_SIZE bsize) { #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { DECLARE_ALIGNED(16, uint16_t, uintrapredictor[MAX_SB_SQUARE]); av1_build_intra_predictors_for_interintra( - xd, bsize, plane, ctx, CONVERT_TO_BYTEPTR(uintrapredictor), + cm, xd, bsize, plane, ctx, CONVERT_TO_BYTEPTR(uintrapredictor), MAX_SB_SIZE); av1_combine_interintra(xd, bsize, plane, upred, ustride, CONVERT_TO_BYTEPTR(uintrapredictor), MAX_SB_SIZE); @@ -3035,28 +3143,29 @@ void av1_build_interintra_predictors_sbc(MACROBLOCKD *xd, uint8_t *upred, #endif // CONFIG_HIGHBITDEPTH { DECLARE_ALIGNED(16, uint8_t, uintrapredictor[MAX_SB_SQUARE]); - av1_build_intra_predictors_for_interintra(xd, bsize, plane, ctx, + av1_build_intra_predictors_for_interintra(cm, xd, bsize, plane, ctx, uintrapredictor, MAX_SB_SIZE); av1_combine_interintra(xd, bsize, plane, upred, ustride, uintrapredictor, MAX_SB_SIZE); } } -void av1_build_interintra_predictors_sbuv(MACROBLOCKD *xd, uint8_t *upred, - uint8_t *vpred, int ustride, - int vstride, BUFFER_SET *ctx, - BLOCK_SIZE bsize) { - av1_build_interintra_predictors_sbc(xd, upred, ustride, ctx, 1, bsize); - av1_build_interintra_predictors_sbc(xd, vpred, vstride, ctx, 2, bsize); +void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *upred, uint8_t *vpred, + int ustride, int vstride, + BUFFER_SET *ctx, BLOCK_SIZE bsize) { + av1_build_interintra_predictors_sbc(cm, xd, upred, ustride, ctx, 1, bsize); + av1_build_interintra_predictors_sbc(cm, xd, vpred, vstride, ctx, 2, bsize); } -void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred, - uint8_t *upred, uint8_t *vpred, - int ystride, int ustride, int vstride, - BUFFER_SET *ctx, BLOCK_SIZE bsize) { - av1_build_interintra_predictors_sby(xd, ypred, ystride, ctx, bsize); - av1_build_interintra_predictors_sbuv(xd, upred, vpred, ustride, vstride, ctx, - bsize); +void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *ypred, uint8_t *upred, + uint8_t *vpred, int ystride, int ustride, + int vstride, BUFFER_SET *ctx, + BLOCK_SIZE bsize) { + av1_build_interintra_predictors_sby(cm, xd, ypred, ystride, ctx, bsize); + av1_build_interintra_predictors_sbuv(cm, xd, upred, vpred, ustride, vstride, + ctx, bsize); } #endif // CONFIG_INTERINTRA @@ -3092,13 +3201,13 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION WarpTypesAllowed warp_types; #if CONFIG_GLOBAL_MOTION -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF WarpedMotionParams *const wm = mi->mbmi.ref_frame[ref] > 0 ? &xd->global_motion[mi->mbmi.ref_frame[ref]] : &xd->global_motion[mi->mbmi.ref_frame[0]]; -#else // !(CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF) +#else // !(CONFIG_COMPOUND_SINGLEREF) WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]]; -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF warp_types.global_warp_allowed = is_global_mv_block(mi, block, wm->wmtype); #endif // CONFIG_GLOBAL_MOTION #if CONFIG_WARPED_MOTION @@ -3144,13 +3253,13 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane, av1_make_inter_predictor(pre, pre_buf->stride, dst, ext_dst_stride, subpel_x, subpel_y, sf, w, h, &conv_params, - mi->mbmi.interp_filter, + mi->mbmi.interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION &warp_types, (mi_x >> pd->subsampling_x) + x, (mi_y >> pd->subsampling_y) + y, plane, ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR - 0, 0, + mi, 0, #endif xs, ys, xd); } @@ -3172,10 +3281,10 @@ void av1_build_inter_predictors_for_planes_single_buf( const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize]; const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize]; assert(bsize == BLOCK_8X8); -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#if CONFIG_COMPOUND_SINGLEREF assert(has_second_ref(&xd->mi[0]->mbmi) || !is_inter_singleref_comp_mode(xd->mi[0]->mbmi.mode)); -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF +#endif // CONFIG_COMPOUND_SINGLEREF for (y = 0; y < num_4x4_h; ++y) for (x = 0; x < num_4x4_w; ++x) build_inter_predictors_single_buf( @@ -3215,10 +3324,11 @@ static void build_wedge_inter_predictor_from_buf( #if CONFIG_COMPOUND_SINGLEREF if ((is_compound || is_inter_singleref_comp_mode(mbmi->mode)) && - is_masked_compound_type(mbmi->interinter_compound_type)) { + is_masked_compound_type(mbmi->interinter_compound_type)) #else // !CONFIG_COMPOUND_SINGLEREF - if (is_compound && is_masked_compound_type(mbmi->interinter_compound_type)) { + if (is_compound && is_masked_compound_type(mbmi->interinter_compound_type)) #endif // CONFIG_COMPOUND_SINGLEREF + { #if CONFIG_COMPOUND_SEGMENT if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) { #if CONFIG_HIGHBITDEPTH @@ -3314,4 +3424,709 @@ void av1_build_wedge_inter_predictor_from_buf( } } } -#endif // CONFIG_EXT_INTER +#if CONFIG_NCOBMC_ADAPT_WEIGHT + +void alloc_ncobmc_pred_buffer(MACROBLOCKD *const xd) { + int i; + // allocate interpolated prediction buffer + for (i = 0; i < MAX_MB_PLANE; ++i) { + xd->ncobmc_pred_buf[i] = (uint8_t *)malloc(sizeof(uint8_t) * MAX_SB_SQUARE); + av1_zero_array(xd->ncobmc_pred_buf[i], MAX_SB_SQUARE); + xd->ncobmc_pred_buf_stride[i] = MAX_SB_SIZE; + } +} + +void free_ncobmc_pred_buffer(MACROBLOCKD *const xd) { + for (int i = 0; i < MAX_MB_PLANE; ++i) free(xd->ncobmc_pred_buf[i]); +} + +void get_pred_from_intrpl_buf(MACROBLOCKD *xd, int mi_row, int mi_col, + BLOCK_SIZE bsize, int plane) { + uint8_t *dst = xd->plane[plane].dst.buf; + int ds = xd->plane[plane].dst.stride; + int ss_x = xd->plane[plane].subsampling_x; + int ss_y = xd->plane[plane].subsampling_y; + + const int ip_wide = mi_size_wide[bsize] * MI_SIZE >> ss_x; + const int ip_high = mi_size_high[bsize] * MI_SIZE >> ss_y; + // relative coordinates of this MI in the superblock + int row_rlt = (mi_row - xd->sb_mi_bd.mi_row_begin) * MI_SIZE >> ss_y; + int col_rlt = (mi_col - xd->sb_mi_bd.mi_col_begin) * MI_SIZE >> ss_x; + int s = xd->ncobmc_pred_buf_stride[plane]; + int r, c; + + for (r = 0; r < ip_high; ++r) { + for (c = 0; c < ip_wide; ++c) { + dst[r * ds + c] = + xd->ncobmc_pred_buf[plane][(r + row_rlt) * s + c + col_rlt]; + } + } +} +// scaling factors for ncobmc kernels +#define KERNEL_SCALE_LOG 14 + +void build_ncobmc_intrpl_pred(const AV1_COMMON *const cm, MACROBLOCKD *xd, + int plane, int pxl_row, int pxl_col, + BLOCK_SIZE bsize, uint8_t *preds[][MAX_MB_PLANE], + int stride[MAX_MB_PLANE], // pred buffer strides + int mode) { + const ADAPT_OVERLAP_BLOCK ao_block = adapt_overlap_block_lookup[bsize]; + const NCOBMC_KERNELS *const knls = &cm->ncobmc_kernels[ao_block][mode]; + const int wide = mi_size_wide[bsize] * MI_SIZE; + const int high = mi_size_high[bsize] * MI_SIZE; + const int s = stride[plane]; + const int ss_x = xd->plane[plane].subsampling_x; + const int ss_y = xd->plane[plane].subsampling_y; + int row_offset = (pxl_row - xd->sb_mi_bd.mi_row_begin * MI_SIZE) >> ss_y; + int col_offset = (pxl_col - xd->sb_mi_bd.mi_col_begin * MI_SIZE) >> ss_x; + int dst_stride = xd->ncobmc_pred_buf_stride[plane]; + int dst_offset = row_offset * dst_stride + col_offset; + +#if CONFIG_HIGHBITDEPTH + const int is_hbd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0; +#else + const int is_hbd = 0; +#endif // CONFIG_HIGHBITDEPTH + + int r, c, k_r, k_c; + int64_t tmp; + + for (r = 0; r < (high >> ss_x); ++r) { + for (c = 0; c < (wide >> ss_y); ++c) { + int pos = r * s + c; + int q_tmp; + uint8_t val; + + // TODO(weitinglin): find out the optimal sub-sampling patterns for + // chroma + k_r = (r << ss_y) + ss_y; + k_c = (c << ss_x) + ss_x; + if (ss_y && k_r >= high) k_r -= 1; + if (ss_x && k_c >= wide) k_c -= 1; + + if (!is_hbd) { + uint8_t *tmp_p[4]; + int i; + for (i = 0; i < 4; ++i) tmp_p[i] = preds[i][plane]; + + tmp = 0; + for (i = 0; i < 4; ++i) + tmp += knls->KERNEL[i][k_r][k_c] * tmp_p[i][pos]; + + } else { + uint16_t *tmp_p[4]; + int i; + for (i = 0; i < 4; ++i) tmp_p[i] = CONVERT_TO_SHORTPTR(preds[i][plane]); + + tmp = 0; + for (i = 0; i < 4; ++i) + tmp += knls->KERNEL[i][k_r][k_c] * tmp_p[i][pos]; + } + + q_tmp = (tmp <= 0) ? 0 : ROUND_POWER_OF_TWO(tmp, KERNEL_SCALE_LOG); + val = clip_pixel(q_tmp); + + xd->ncobmc_pred_buf[plane][r * dst_stride + c + dst_offset] = val; + + assert(r * dst_stride + c + dst_offset < MAX_SB_SQUARE); + } + } +} + +void get_pred_by_horz_neighbor(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]) { + const TileInfo *const tile = &xd->tile; + const int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; + const int mb_to_top_edge_base = xd->mb_to_top_edge; + const int mb_to_left_edge_base = xd->mb_to_left_edge; + const int mb_to_right_edge_base = xd->mb_to_right_edge; + int overlappable_offset = -1; + const int mi_nums = AOMMIN(mi_size_high[bsize], cm->mi_rows - mi_row); + + int i, j, mi_step, ref; + + xd->mb_to_right_edge += mi_size_wide[bsize] * MI_SIZE * 4; + + // build from left neighbors + for (i = 0; i < mi_nums; i += mi_step) { + int mi_row_offset = i; + int mi_col_offset = -1; + int mi_x, mi_y, bw, bh; + MODE_INFO *left_mi; + MB_MODE_INFO *left_mbmi, backup_mbmi; + BLOCK_SIZE l_bsize; + + // create the original prediction if offset exceeds the boundary + if (mi_col == 0 || (mi_col - 1 < tile->mi_col_start)) mi_col_offset = 0; + + left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + left_mbmi = &left_mi->mbmi; + l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8); + + mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]); + + // reset the mi if it is not overlappble + if (!is_neighbor_overlappable(left_mbmi)) { + // use left_mbmi->sb_type instead of l_bsize to handle + // sub8x8 cases + int search_mi_step = mi_size_high[left_mbmi->sb_type]; + while (!is_neighbor_overlappable(left_mbmi)) { + mi_row_offset += search_mi_step; + if (mi_row_offset < mi_nums) { + left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + left_mbmi = &left_mi->mbmi; + search_mi_step = mi_size_high[left_mbmi->sb_type]; + } else { + if (overlappable_offset >= 0) { + mi_row_offset = overlappable_offset; + } else { + mi_row_offset = 0; + mi_col_offset = 0; + } + left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + left_mbmi = &left_mi->mbmi; + break; + } + } + } else { + // update the available overlappable mi + overlappable_offset = mi_row_offset; + } + + backup_mbmi = *left_mbmi; + modify_neighbor_predictor_for_obmc(left_mbmi); + + for (j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, l_bsize, dst_buf[j], MAX_SB_SIZE, MAX_SB_SIZE, + dst_stride[j], i, 0, NULL, pd->subsampling_x, + pd->subsampling_y); + } +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(left_mbmi->mode)); + ++ref) { + const MV_REFERENCE_FRAME frame = has_second_ref(left_mbmi) + ? left_mbmi->ref_frame[ref] + : left_mbmi->ref_frame[0]; +#else // !(CONFIG_COMPOUND_SINGLEREF) + for (ref = 0; ref < 1 + has_second_ref(left_mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row + i, mi_col, + &ref_buf->sf); + } + xd->mb_to_top_edge = -((mi_row + i) * MI_SIZE * 8); + xd->mb_to_bottom_edge = + mb_to_bottom_edge_base + (mi_nums - i - mi_step) * MI_SIZE * 8; + mi_x = mi_col << MI_SIZE_LOG2; + mi_y = (mi_row + i) << MI_SIZE_LOG2; + + for (j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + bw = mi_size_wide[bsize] << (MI_SIZE_LOG2 - 1) >> pd->subsampling_x; + bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; + + build_inter_predictors(cm, xd, j, left_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + *left_mbmi = backup_mbmi; + } + + // build from right neighbors + xd->mb_to_right_edge = mb_to_right_edge_base; + xd->mb_to_left_edge -= mi_size_wide[bsize] * MI_SIZE * 4; + + overlappable_offset = -1; + + for (i = 0; i < mi_nums; i += mi_step) { + int mi_row_offset = i; + int mi_col_offset = mi_size_wide[bsize]; + int mi_x, mi_y, bw, bh; + int mi_col_shift = mi_size_wide[bsize] >> 1; + MODE_INFO *right_mi; + MB_MODE_INFO *right_mbmi, backup_mbmi; + BLOCK_SIZE r_bsize; + + // create the original prediction if offset exceeds the boundary + if (mi_col + mi_col_offset > xd->sb_mi_bd.mi_col_end) mi_col_offset = 0; + + right_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + right_mbmi = &right_mi->mbmi; + r_bsize = AOMMAX(right_mbmi->sb_type, BLOCK_8X8); + + mi_step = AOMMIN(mi_nums, mi_size_high[r_bsize]); + + if (!is_neighbor_overlappable(right_mbmi)) { + int search_mi_step = mi_size_high[right_mbmi->sb_type]; + while (!is_neighbor_overlappable(right_mbmi)) { + mi_row_offset += search_mi_step; + if (mi_row_offset < mi_nums) { + right_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + right_mbmi = &right_mi->mbmi; + search_mi_step = mi_size_high[right_mbmi->sb_type]; + } else { + if (overlappable_offset >= 0) { + mi_row_offset = overlappable_offset; + } else { + mi_row_offset = 0; + mi_col_offset = 0; + } + right_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + right_mbmi = &right_mi->mbmi; + break; + } + } + } else { + overlappable_offset = mi_row_offset; + } + + backup_mbmi = *right_mbmi; + modify_neighbor_predictor_for_obmc(right_mbmi); + + for (j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, r_bsize, dst_buf[j], MAX_SB_SIZE, MAX_SB_SIZE, + dst_stride[j], i, mi_col_shift, NULL, pd->subsampling_x, + pd->subsampling_y); + } +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(right_mbmi->mode)); + ++ref) { + const MV_REFERENCE_FRAME frame = has_second_ref(right_mbmi) + ? right_mbmi->ref_frame[ref] + : right_mbmi->ref_frame[0]; +#else // !(CONFIG_COMPOUND_SINGLEREF) + for (ref = 0; ref < 1 + has_second_ref(right_mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = right_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row + i, + mi_col + mi_col_shift, &ref_buf->sf); + } + xd->mb_to_top_edge = -((mi_row + i) * MI_SIZE * 8); + xd->mb_to_bottom_edge = + mb_to_bottom_edge_base + (mi_nums - i - mi_step) * MI_SIZE * 8; + mi_x = (mi_col + mi_col_shift) << MI_SIZE_LOG2; + mi_y = (mi_row + i) << MI_SIZE_LOG2; + + for (j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + bw = mi_size_wide[bsize] << (MI_SIZE_LOG2 - 1) >> pd->subsampling_x; + bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; + + build_inter_predictors(cm, xd, j, right_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + + *right_mbmi = backup_mbmi; + } + + // restore the boundaries + xd->mb_to_top_edge = mb_to_top_edge_base; + xd->mb_to_bottom_edge = mb_to_bottom_edge_base; + xd->mb_to_left_edge = mb_to_left_edge_base; + xd->mb_to_right_edge = mb_to_right_edge_base; +} + +void get_pred_by_vert_neighbor(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]) { + const TileInfo *const tile = &xd->tile; + const int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; + const int mb_to_top_edge_base = xd->mb_to_top_edge; + const int mb_to_left_edge_base = xd->mb_to_left_edge; + const int mb_to_right_edge_base = xd->mb_to_right_edge; + int overlappable_offset = -1; + const int mi_nums = AOMMIN(mi_size_wide[bsize], cm->mi_cols - mi_col); + + int i, j, mi_step, ref; + + xd->mb_to_bottom_edge += mi_nums * MI_SIZE * 4; + + // build from above neighbors + for (i = 0; i < mi_nums; i += mi_step) { + int mi_row_offset = -1; + int mi_col_offset = i; + int mi_x, mi_y, bw, bh; + MODE_INFO *above_mi; + MB_MODE_INFO *above_mbmi, backup_mbmi; + BLOCK_SIZE a_bsize; + + // create the original prediction if offset exceeds the boundary + if (mi_row <= tile->mi_row_start) mi_row_offset = 0; + + above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + above_mbmi = &above_mi->mbmi; + a_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8); + + mi_step = AOMMIN(mi_nums, mi_size_high[a_bsize]); + + // reset the mi if it is not overlappble + if (!is_neighbor_overlappable(above_mbmi)) { + int search_mi_step = mi_size_high[above_mbmi->sb_type]; + // backward search + while (!is_neighbor_overlappable(above_mbmi)) { + mi_col_offset += search_mi_step; + if (mi_col_offset < mi_nums) { + above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + above_mbmi = &above_mi->mbmi; + search_mi_step = mi_size_high[above_mbmi->sb_type]; + } else { + if (overlappable_offset >= 0) { + mi_col_offset = overlappable_offset; + } else { + mi_row_offset = 0; + mi_col_offset = 0; + } + above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + above_mbmi = &above_mi->mbmi; + break; + } + } + } else { + // update the available overlappable mi + overlappable_offset = mi_col_offset; + } + + backup_mbmi = *above_mbmi; + modify_neighbor_predictor_for_obmc(above_mbmi); + + for (j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, a_bsize, dst_buf[j], MAX_SB_SIZE, MAX_SB_SIZE, + dst_stride[j], 0, i, NULL, pd->subsampling_x, + pd->subsampling_y); + } +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(above_mbmi->mode)); + ++ref) { + const MV_REFERENCE_FRAME frame = has_second_ref(above_mbmi) + ? above_mbmi->ref_frame[ref] + : above_mbmi->ref_frame[0]; +#else // !(CONFIG_COMPOUND_SINGLEREF) + for (ref = 0; ref < 1 + has_second_ref(above_mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col + i, + &ref_buf->sf); + } + + xd->mb_to_left_edge = -(((mi_col + i) * MI_SIZE) * 8); + xd->mb_to_right_edge = + mb_to_right_edge_base + (mi_nums - i - mi_step) * MI_SIZE * 8; + mi_x = (mi_col + i) << MI_SIZE_LOG2; + mi_y = mi_row << MI_SIZE_LOG2; + + for (j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + + bh = mi_size_high[bsize] << (MI_SIZE_LOG2 - 1) >> pd->subsampling_x; + bw = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; + + build_inter_predictors(cm, xd, j, above_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + + *above_mbmi = backup_mbmi; + } + + // build from bottom neighbors + xd->mb_to_bottom_edge = mb_to_bottom_edge_base; + xd->mb_to_top_edge -= mi_size_high[bsize] * MI_SIZE * 4; + + overlappable_offset = -1; + + for (i = 0; i < mi_nums; i += mi_step) { + int mi_row_offset = mi_size_high[bsize]; + int mi_col_offset = i; + int mi_x, mi_y, bw, bh; + int mi_row_shift = mi_size_high[bsize] >> 1; + MODE_INFO *bottom_mi; + MB_MODE_INFO *bottom_mbmi, backup_mbmi; + BLOCK_SIZE b_bsize; + + // create the original prediction if offset exceeds the boundary + if (mi_row + mi_row_offset > xd->sb_mi_bd.mi_row_end) mi_row_offset = 0; + + bottom_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + bottom_mbmi = &bottom_mi->mbmi; + b_bsize = AOMMAX(bottom_mbmi->sb_type, BLOCK_8X8); + + mi_step = AOMMIN(mi_nums, mi_size_high[b_bsize]); + + // reset the mi if it is not overlappble + if (!is_neighbor_overlappable(bottom_mbmi)) { + int search_mi_step = mi_size_high[bottom_mbmi->sb_type]; + while (!is_neighbor_overlappable(bottom_mbmi)) { + mi_col_offset += search_mi_step; + if (mi_col_offset < mi_nums) { + bottom_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + bottom_mbmi = &bottom_mi->mbmi; + search_mi_step = mi_size_high[bottom_mbmi->sb_type]; + } else { + if (overlappable_offset >= 0) { + mi_col_offset = overlappable_offset; + } else { + mi_col_offset = 0; + mi_row_offset = 0; + } + bottom_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + bottom_mbmi = &bottom_mi->mbmi; + break; + } + } + } else { + // update the available overlappable mi + overlappable_offset = mi_col_offset; + } + + backup_mbmi = *bottom_mbmi; + modify_neighbor_predictor_for_obmc(bottom_mbmi); + + for (j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, b_bsize, dst_buf[j], MAX_SB_SIZE, MAX_SB_SIZE, + dst_stride[j], mi_row_shift, i, NULL, pd->subsampling_x, + pd->subsampling_y); + } +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(bottom_mbmi->mode)); + ++ref) { + const MV_REFERENCE_FRAME frame = has_second_ref(bottom_mbmi) + ? bottom_mbmi->ref_frame[ref] + : bottom_mbmi->ref_frame[0]; +#else // !(CONFIG_COMPOUND_SINGLEREF) + for (ref = 0; ref < 1 + has_second_ref(bottom_mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = bottom_mbmi->ref_frame[ref]; +#endif // CONFIG_COMPOUND_SINGLEREF + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + xd->block_refs[ref] = ref_buf; + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row + mi_row_shift, + mi_col + i, &ref_buf->sf); + } + + xd->mb_to_left_edge = -(((mi_col + i) * MI_SIZE) * 8); + xd->mb_to_right_edge = + mb_to_right_edge_base + (mi_nums - i - mi_step) * MI_SIZE * 8; + mi_x = (mi_col + i) << MI_SIZE_LOG2; + mi_y = (mi_row + mi_row_shift) << MI_SIZE_LOG2; + + for (j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + + bh = mi_size_high[bsize] << (MI_SIZE_LOG2 - 1) >> pd->subsampling_x; + bw = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y; + + build_inter_predictors(cm, xd, j, bottom_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + + *bottom_mbmi = backup_mbmi; + } + // restore the boundaries + xd->mb_to_top_edge = mb_to_top_edge_base; + xd->mb_to_bottom_edge = mb_to_bottom_edge_base; + xd->mb_to_left_edge = mb_to_left_edge_base; + xd->mb_to_right_edge = mb_to_right_edge_base; +} + +void get_pred_by_corner_neighbor(const AV1_COMMON *cm, MACROBLOCKD *xd, + int bsize, int mi_row, int mi_col, + uint8_t *dst_buf[MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]) { + const TileInfo *const tile = &xd->tile; + const int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; + const int mb_to_top_edge_base = xd->mb_to_top_edge; + const int mb_to_left_edge_base = xd->mb_to_left_edge; + const int mb_to_right_edge_base = xd->mb_to_right_edge; + const int mi_wide = mi_size_wide[bsize]; + const int mi_high = mi_size_high[bsize]; + + // location of four mi sources + const int mi_row_offsets[4] = { -1, -1, mi_high, mi_high }; + const int mi_col_offsets[4] = { -1, mi_wide, -1, mi_wide }; + + MB_MODE_INFO backup_mbmi; + int mi_x, mi_y, bh, bw; + int i, j, ref; + + assert(bsize >= BLOCK_8X8); + + for (i = 0; i < 4; ++i) { + int mi_row_offset = mi_row_offsets[i]; + int mi_col_offset = mi_col_offsets[i]; + MODE_INFO *corner_mi; + MB_MODE_INFO *corner_mbmi; + + if (mi_col + mi_col_offset < tile->mi_col_start || + mi_col + mi_col_offset > xd->sb_mi_bd.mi_col_end) + mi_col_offset = 0; + + if (mi_row + mi_row_offset < tile->mi_row_start || + mi_row + mi_row_offset > xd->sb_mi_bd.mi_row_end) + mi_row_offset = 0; + + corner_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]; + corner_mbmi = &corner_mi->mbmi; + + // reset the mi if it is not overlappble + if (!is_neighbor_overlappable(corner_mbmi)) { + mi_row_offset = 0; + mi_col_offset = 0; + corner_mi = xd->mi[0]; + corner_mbmi = &corner_mi->mbmi; + } + + backup_mbmi = *corner_mbmi; + modify_neighbor_predictor_for_obmc(corner_mbmi); + + for (j = 0; j < MAX_MB_PLANE; ++j) { + struct macroblockd_plane *const pd = &xd->plane[j]; + setup_pred_plane(&pd->dst, BLOCK_8X8, dst_buf[j], MAX_SB_SIZE, + MAX_SB_SIZE, dst_stride[j], (i / 2) * (mi_high >> 1), + (i % 2) * (mi_wide >> 1), NULL, pd->subsampling_x, + pd->subsampling_y); + } + +#if CONFIG_COMPOUND_SINGLEREF + for (ref = 0; ref < 1 + (is_inter_anyref_comp_mode(corner_mbmi->mode)); + ++ref) { + const MV_REFERENCE_FRAME frame = has_second_ref(corner_mbmi) + ? corner_mbmi->ref_frame[ref] + : corner_mbmi->ref_frame[0]; +#else + for (ref = 0; ref < 1 + has_second_ref(corner_mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = corner_mbmi->ref_frame[ref]; +#endif + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + xd->block_refs[ref] = ref_buf; + + if ((!av1_is_valid_scale(&ref_buf->sf))) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + av1_setup_pre_planes(xd, ref, ref_buf->buf, + mi_row + (i / 2) * (mi_high >> 1), + mi_col + (i % 2) * (mi_wide >> 1), &ref_buf->sf); + } + // adjust mi boundaries of this block + xd->mb_to_bottom_edge = + mb_to_bottom_edge_base + (1 - (i / 2)) * mi_high * MI_SIZE * 4; + xd->mb_to_top_edge = mb_to_top_edge_base - (i / 2) * mi_high * MI_SIZE * 4; + xd->mb_to_right_edge = + mb_to_right_edge_base + (1 - (i % 2)) * mi_wide * MI_SIZE * 4; + xd->mb_to_left_edge = + mb_to_left_edge_base - (i % 2) * mi_wide * MI_SIZE * 4; + + mi_x = (mi_col + (i % 2) * mi_wide / 2) << MI_SIZE_LOG2; + mi_y = (mi_row + (i / 2) * mi_high / 2) << MI_SIZE_LOG2; + + for (j = 0; j < MAX_MB_PLANE; ++j) { + const struct macroblockd_plane *pd = &xd->plane[j]; + bh = mi_high << MI_SIZE_LOG2 >> (pd->subsampling_x + 1); + bw = mi_wide << MI_SIZE_LOG2 >> (pd->subsampling_y + 1); + build_inter_predictors(cm, xd, j, corner_mi, 1, 0, bw, bh, 0, 0, bw, bh, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } + *corner_mbmi = backup_mbmi; + } + // restore the boundaries + xd->mb_to_bottom_edge = mb_to_bottom_edge_base; + xd->mb_to_top_edge = mb_to_top_edge_base; + xd->mb_to_right_edge = mb_to_right_edge_base; + xd->mb_to_left_edge = mb_to_left_edge_base; +} + +// get the stitched extra prediction for this block +void av1_get_ext_blk_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[][MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]) { + get_pred_by_corner_neighbor(cm, xd, bsize, mi_row, mi_col, dst_buf[0], + dst_stride); + get_pred_by_vert_neighbor(cm, xd, bsize, mi_row, mi_col, dst_buf[1], + dst_stride); + get_pred_by_horz_neighbor(cm, xd, bsize, mi_row, mi_col, dst_buf[2], + dst_stride); +} + +void av1_get_ori_blk_pred(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]) { + MODE_INFO *const mi = xd->mi[0]; + MB_MODE_INFO *const mbmi = &mi->mbmi; + int mi_x = mi_col << MI_SIZE_LOG2; + int mi_y = mi_row << MI_SIZE_LOG2; + int bw = block_size_wide[bsize]; + int bh = block_size_high[bsize]; + int i, ref; + + for (i = 0; i < MAX_MB_PLANE; ++i) { + struct macroblockd_plane *const pd = &xd->plane[i]; + setup_pred_plane(&pd->dst, BLOCK_8X8, dst_buf[i], MAX_SB_SIZE, MAX_SB_SIZE, + dst_stride[i], 0, 0, NULL, pd->subsampling_x, + pd->subsampling_y); + } + + for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { + const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; + const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME]; + xd->block_refs[ref] = ref_buf; + + if (!av1_is_valid_scale(&ref_buf->sf)) + aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, + "Reference frame has invalid dimensions"); + + av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col, &ref_buf->sf); + } + + for (i = 0; i < MAX_MB_PLANE; ++i) { + const struct macroblockd_plane *pd = &xd->plane[i]; + build_inter_predictors(cm, xd, i, mi, 1, 0, bw >> pd->subsampling_x, + bh >> pd->subsampling_y, 0, 0, + bw >> pd->subsampling_x, bh >> pd->subsampling_y, +#if CONFIG_SUPERTX + 0, 0, +#endif // CONFIG_SUPERTX + mi_x, mi_y); + } +} + +#endif diff --git a/third_party/aom/av1/common/reconinter.h b/third_party/aom/av1/common/reconinter.h index 229646036..fd69f9db3 100644 --- a/third_party/aom/av1/common/reconinter.h +++ b/third_party/aom/av1/common/reconinter.h @@ -40,34 +40,27 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int subpel_x, int subpel_y, const struct scale_factors *sf, int w, int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - int xs, int ys) { -#if CONFIG_DUAL_FILTER - const InterpFilter filter_x = av1_get_plane_interp_filter( - interp_filter[1 + 2 * conv_params->ref], conv_params->plane); - const InterpFilter filter_y = av1_get_plane_interp_filter( - interp_filter[0 + 2 * conv_params->ref], conv_params->plane); - const InterpFilterParams interp_filter_params_x = - av1_get_interp_filter_params(filter_x); - const InterpFilterParams interp_filter_params_y = - av1_get_interp_filter_params(filter_y); -#else - const InterpFilterParams interp_filter_params_x = - av1_get_interp_filter_params(interp_filter); - const InterpFilterParams interp_filter_params_y = interp_filter_params_x; -#endif - + InterpFilters interp_filters, int xs, + int ys) { assert(conv_params->do_average == 0 || conv_params->do_average == 1); assert(sf); if (has_scale(xs, ys)) { // TODO(afergs, debargha): Use a different scale convolve function // that uses higher precision for subpel_x, subpel_y, xs, ys - av1_convolve_scale(src, src_stride, dst, dst_stride, w, h, interp_filter, - subpel_x, xs, subpel_y, ys, conv_params); + if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { +#if CONFIG_CONVOLVE_ROUND + av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h, + interp_filters, subpel_x, xs, subpel_y, ys, 1, + conv_params); + conv_params->do_post_rounding = 1; +#else + assert(0); +#endif // CONFIG_CONVOLVE_ROUND + } else { + assert(conv_params->round == CONVOLVE_OPT_ROUND); + av1_convolve_scale(src, src_stride, dst, dst_stride, w, h, interp_filters, + subpel_x, xs, subpel_y, ys, conv_params); + } } else { subpel_x >>= SCALE_EXTRA_BITS; subpel_y >>= SCALE_EXTRA_BITS; @@ -80,31 +73,32 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride, if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { #if CONFIG_CONVOLVE_ROUND av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h, -#if CONFIG_DUAL_FILTER - interp_filter, -#else // CONFIG_DUAL_FILTER - &interp_filter, -#endif // CONFIG_DUAL_FILTER - subpel_x, xs, subpel_y, ys, conv_params); + interp_filters, subpel_x, xs, subpel_y, ys, 0, + conv_params); conv_params->do_post_rounding = 1; #else assert(0); #endif // CONFIG_CONVOLVE_ROUND } else { assert(conv_params->round == CONVOLVE_OPT_ROUND); + + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + if (w <= 2 || h <= 2) { - av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter, + av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filters, subpel_x, xs, subpel_y, ys, conv_params); - } else if (interp_filter_params_x.taps == SUBPEL_TAPS && - interp_filter_params_y.taps == SUBPEL_TAPS) { - const int16_t *kernel_x = av1_get_interp_filter_subpel_kernel( - interp_filter_params_x, subpel_x); - const int16_t *kernel_y = av1_get_interp_filter_subpel_kernel( - interp_filter_params_y, subpel_y); + } else if (filter_params_x.taps == SUBPEL_TAPS && + filter_params_y.taps == SUBPEL_TAPS) { + const int16_t *kernel_x = + av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x); + const int16_t *kernel_y = + av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y); sf->predict[subpel_x != 0][subpel_y != 0][conv_params->do_average]( src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h); } else { - av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter, + av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filters, subpel_x, xs, subpel_y, ys, conv_params); } } @@ -117,31 +111,26 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride, int subpel_x, int subpel_y, const struct scale_factors *sf, int w, int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - int xs, int ys, int bd) { + InterpFilters interp_filters, int xs, + int ys, int bd) { const int avg = conv_params->do_average; assert(avg == 0 || avg == 1); -#if CONFIG_DUAL_FILTER - const int ref = conv_params->ref; - const InterpFilterParams interp_filter_params_x = - av1_get_interp_filter_params(interp_filter[1 + 2 * ref]); - const InterpFilterParams interp_filter_params_y = - av1_get_interp_filter_params(interp_filter[0 + 2 * ref]); -#else - const InterpFilterParams interp_filter_params_x = - av1_get_interp_filter_params(interp_filter); - const InterpFilterParams interp_filter_params_y = interp_filter_params_x; -#endif if (has_scale(xs, ys)) { - av1_highbd_convolve_scale( - src, src_stride, dst, dst_stride, w, h, interp_filter, - subpel_x >> SCALE_EXTRA_BITS, xs >> SCALE_EXTRA_BITS, - subpel_y >> SCALE_EXTRA_BITS, ys >> SCALE_EXTRA_BITS, avg, bd); + if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { +#if CONFIG_CONVOLVE_ROUND + av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h, + interp_filters, subpel_x, xs, subpel_y, ys, + 1, conv_params, bd); + conv_params->do_post_rounding = 1; +#else + assert(0); +#endif // CONFIG_CONVOLVE_ROUND + } else { + av1_highbd_convolve_scale(src, src_stride, dst, dst_stride, w, h, + interp_filters, subpel_x, xs, subpel_y, ys, avg, + bd); + } } else { subpel_x >>= SCALE_EXTRA_BITS; subpel_y >>= SCALE_EXTRA_BITS; @@ -154,37 +143,36 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride, if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { #if CONFIG_CONVOLVE_ROUND av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h, -#if CONFIG_DUAL_FILTER - interp_filter, -#else // CONFIG_DUAL_FILTER - &interp_filter, -#endif // CONFIG_DUAL_FILTER - subpel_x, xs, subpel_y, ys, conv_params, - bd); + interp_filters, subpel_x, xs, subpel_y, ys, + 0, conv_params, bd); conv_params->do_post_rounding = 1; #else assert(0); #endif // CONFIG_CONVOLVE_ROUND } else { - if (interp_filter_params_x.taps == SUBPEL_TAPS && - interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) { - const int16_t *kernel_x = av1_get_interp_filter_subpel_kernel( - interp_filter_params_x, subpel_x); - const int16_t *kernel_y = av1_get_interp_filter_subpel_kernel( - interp_filter_params_y, subpel_y); + InterpFilterParams filter_params_x, filter_params_y; + av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x, + &filter_params_y); + + if (filter_params_x.taps == SUBPEL_TAPS && + filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) { + const int16_t *kernel_x = + av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x); + const int16_t *kernel_y = + av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y); sf->highbd_predict[subpel_x != 0][subpel_y != 0][avg]( src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd); } else { av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, - interp_filter, subpel_x, xs, subpel_y, ys, avg, bd); + interp_filters, subpel_x, xs, subpel_y, ys, avg, + bd); } } } } #endif // CONFIG_HIGHBITDEPTH -#if CONFIG_EXT_INTER // Set to (1 << 5) if the 32-ary codebooks are used for any bock size #define MAX_WEDGE_TYPES (1 << 4) @@ -239,7 +227,8 @@ static INLINE int is_interinter_compound_used(COMPOUND_TYPE type, case COMPOUND_WEDGE: return wedge_params_lookup[sb_type].bits > 0; #endif // CONFIG_WEDGE #if CONFIG_COMPOUND_SEGMENT - case COMPOUND_SEG: return sb_type >= BLOCK_8X8; + case COMPOUND_SEG: + return AOMMIN(block_size_wide[sb_type], block_size_high[sb_type]) >= 8; #endif // CONFIG_COMPOUND_SEGMENT default: assert(0); return 0; } @@ -288,225 +277,20 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type, BLOCK_SIZE sb_type, int h, int w, int bd); #endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_COMPOUND_SEGMENT -#endif // CONFIG_EXT_INTER - -void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, -#if CONFIG_MOTION_VAR - int mi_col_offset, int mi_row_offset, -#endif // CONFIG_MOTION_VAR - int block, int bw, int bh, int x, int y, int w, - int h, -#if CONFIG_SUPERTX && CONFIG_EXT_INTER - int wedge_offset_x, int wedge_offset_y, -#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER - int mi_x, int mi_y); - -#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION -// This function will determine whether or not to create a warped -// prediction and return the appropriate motion model depending -// on the configuration. Behavior will change with different -// combinations of GLOBAL_MOTION, WARPED_MOTION and MOTION_VAR. -static INLINE int allow_warp(const MODE_INFO *const mi, - const WarpTypesAllowed *const warp_types, -#if CONFIG_GLOBAL_MOTION - const WarpedMotionParams *const gm_params, -#endif // CONFIG_GLOBAL_MOTION -#if CONFIG_MOTION_VAR - int mi_col_offset, int mi_row_offset, -#endif // CONFIG_MOTION_VAR - WarpedMotionParams *final_warp_params) { - const MB_MODE_INFO *const mbmi = &mi->mbmi; - set_default_warp_params(final_warp_params); - -// Only global motion configured -#if CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR - (void)mbmi; - if (warp_types->global_warp_allowed) { - memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); - return 1; - } -#endif // CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR - -// Only warped motion configured -#if CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR - if (warp_types->local_warp_allowed) { - memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params)); - return 1; - } -#endif // CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR - -// Warped and global motion configured -#if CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR - // When both are enabled, warped will take priority. The global parameters - // will only be used to compute projection samples to find the warped model. - // Note that when a block chooses global, it will not be possible to - // select WARPED_CAUSAL. - if (warp_types->local_warp_allowed) { - memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params)); - return 1; - } else if (warp_types->global_warp_allowed) { - memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); - return 1; - } -#endif // CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR - -// Motion var and global motion configured -#if CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION - // We warp if either case is true: - // 1.) We are predicting a block which uses global motion - // 2.) We are predicting a neighboring block of a block using OBMC, - // the neighboring block uses global motion, and we have enabled - // WARP_GM_NEIGHBORS_WITH_OBMC - const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0); - (void)mbmi; - if (warp_types->global_warp_allowed && - (WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) { - memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); - return 1; - } -#endif // CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION - -// Motion var and warped motion configured -#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION - // We warp if either case is true: - // 1.) We are predicting a block with motion mode WARPED_CAUSAL - // 2.) We are predicting a neighboring block of a block using OBMC, - // the neighboring block has mode WARPED_CAUSAL, and we have enabled - // WARP_WM_NEIGHBORS_WITH_OBMC - const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0); - if (warp_types->local_warp_allowed) { - if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) { - memcpy(final_warp_params, &mbmi->wm_params[0], - sizeof(*final_warp_params)); - return 1; - } - } -#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION - -// Motion var, warped motion and global motion all configured -#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION - const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0); - if (warp_types->local_warp_allowed) { - if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) { - memcpy(final_warp_params, &mbmi->wm_params[0], - sizeof(*final_warp_params)); - return 1; - } - } else if (warp_types->global_warp_allowed && - (WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) { - memcpy(final_warp_params, gm_params, sizeof(*final_warp_params)); - return 1; - } -#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION - return 0; -} -#endif // CONFIG_GLOBAL_MOTION ||CONFIG_WARPED_MOTION - -static INLINE void av1_make_inter_predictor( - const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, +void av1_make_masked_inter_predictor( + const uint8_t *pre, int pre_stride, uint8_t *dst, int dst_stride, const int subpel_x, const int subpel_y, const struct scale_factors *sf, - int w, int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif -#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane, - int ref, -#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION -#if CONFIG_MOTION_VAR - int mi_col_offset, int mi_row_offset, -#endif - int xs, int ys, const MACROBLOCKD *xd) { - (void)xd; - -#if CONFIG_MOTION_VAR - const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset]; -#else - const MODE_INFO *mi = xd->mi[0]; - (void)mi; -#endif // CONFIG_MOTION_VAR - -// Make sure the selected motion mode is valid for this configuration -#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION - assert_motion_mode_valid(mi->mbmi.motion_mode, -#if CONFIG_GLOBAL_MOTION - 0, xd->global_motion, -#endif // CONFIG_GLOBAL_MOTION -#if CONFIG_WARPED_MOTION - xd, -#endif - mi); -#endif // CONFIG MOTION_VAR || CONFIG_WARPED_MOTION - -#if CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION - WarpedMotionParams final_warp_params; - const int do_warp = allow_warp( - mi, warp_types, -#if CONFIG_GLOBAL_MOTION -#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF - // TODO(zoeliu): To further check the single - // ref comp mode to work together with - // global motion. - has_second_ref(&mi->mbmi) ? &xd->global_motion[mi->mbmi.ref_frame[ref]] - : &xd->global_motion[mi->mbmi.ref_frame[0]], -#else // !(CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF) - &xd->global_motion[mi->mbmi.ref_frame[ref]], -#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF -#endif // CONFIG_GLOBAL_MOTION -#if CONFIG_MOTION_VAR - mi_col_offset, mi_row_offset, -#endif // CONFIG_MOTION_VAR - &final_warp_params); - if (do_warp) { - const struct macroblockd_plane *const pd = &xd->plane[plane]; - const struct buf_2d *const pre_buf = &pd->pre[ref]; - av1_warp_plane(&final_warp_params, -#if CONFIG_HIGHBITDEPTH - xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, -#endif // CONFIG_HIGHBITDEPTH - pre_buf->buf0, pre_buf->width, pre_buf->height, - pre_buf->stride, dst, p_col, p_row, w, h, dst_stride, - pd->subsampling_x, pd->subsampling_y, xs, ys, conv_params); - return; - } -#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION -#if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, - sf, w, h, conv_params, interp_filter, xs, ys, - xd->bd); - return; - } -#endif // CONFIG_HIGHBITDEPTH - inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, sf, w, - h, conv_params, interp_filter, xs, ys); -} - -#if CONFIG_EXT_INTER -void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, - uint8_t *dst, int dst_stride, - const int subpel_x, const int subpel_y, - const struct scale_factors *sf, int w, - int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif - int xs, int ys, + int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters, + int xs, int ys, #if CONFIG_SUPERTX - int wedge_offset_x, int wedge_offset_y, + int wedge_offset_x, int wedge_offset_y, #endif // CONFIG_SUPERTX - int plane, + int plane, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - const WarpTypesAllowed *warp_types, - int p_col, int p_row, int ref, + const WarpTypesAllowed *warp_types, int p_col, int p_row, int ref, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION - MACROBLOCKD *xd); -#endif // CONFIG_EXT_INTER + MACROBLOCKD *xd); static INLINE int round_mv_comp_q4(int value) { return (value < 0 ? value - 2 : value + 2) / 4; @@ -588,18 +372,13 @@ void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, #if CONFIG_SUPERTX void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm, - MACROBLOCKD *xd, -#if CONFIG_EXT_INTER - int mi_row_ori, int mi_col_ori, -#endif // CONFIG_EXT_INTER - int mi_row, int mi_col, - int plane, BLOCK_SIZE bsize, - int block); + MACROBLOCKD *xd, int mi_row_ori, + int mi_col_ori, int mi_row, + int mi_col, int plane, + BLOCK_SIZE bsize, int block); void av1_build_inter_predictor_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd, -#if CONFIG_EXT_INTER int mi_row_ori, int mi_col_ori, -#endif // CONFIG_EXT_INTER int mi_row, int mi_col, int plane, BLOCK_SIZE bsize); struct macroblockd_plane; @@ -614,11 +393,7 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const MV *src_mv, const struct scale_factors *sf, int w, int h, ConvolveParams *conv_params, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + InterpFilters interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane, int ref, @@ -630,11 +405,7 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, void av1_highbd_build_inter_predictor( const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg, -#if CONFIG_DUAL_FILTER - const InterpFilter *interp_filter, -#else - const InterpFilter interp_filter, -#endif + InterpFilters interp_filters, #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION const WarpTypesAllowed *warp_types, int p_col, int p_row, #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION @@ -657,11 +428,11 @@ static INLINE void setup_pred_plane(struct buf_2d *dst, BLOCK_SIZE bsize, const struct scale_factors *scale, int subsampling_x, int subsampling_y) { #if CONFIG_CHROMA_SUB8X8 - if (bsize < BLOCK_8X8) { - // Offset the buffer pointer - if (subsampling_y && (mi_row & 0x01)) mi_row -= 1; - if (subsampling_x && (mi_col & 0x01)) mi_col -= 1; - } + // Offset the buffer pointer + if (subsampling_y && (mi_row & 0x01) && (mi_size_high[bsize] == 1)) + mi_row -= 1; + if (subsampling_x && (mi_col & 0x01) && (mi_size_wide[bsize] == 1)) + mi_col -= 1; #else (void)bsize; #endif @@ -740,16 +511,8 @@ static INLINE int has_subpel_mv_component(const MODE_INFO *const mi, static INLINE void set_default_interp_filters( MB_MODE_INFO *const mbmi, InterpFilter frame_interp_filter) { -#if CONFIG_DUAL_FILTER - int dir; - for (dir = 0; dir < 4; ++dir) - mbmi->interp_filter[dir] = frame_interp_filter == SWITCHABLE - ? EIGHTTAP_REGULAR - : frame_interp_filter; -#else - mbmi->interp_filter = frame_interp_filter == SWITCHABLE ? EIGHTTAP_REGULAR - : frame_interp_filter; -#endif // CONFIG_DUAL_FILTER + mbmi->interp_filters = + av1_broadcast_interp_filter(av1_unswitchable_filter(frame_interp_filter)); } static INLINE int av1_is_interp_needed(const MACROBLOCKD *const xd) { @@ -810,7 +573,6 @@ void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, #endif #endif // CONFIG_MOTION_VAR -#if CONFIG_EXT_INTER #define MASK_MASTER_SIZE ((MAX_WEDGE_SIZE) << 1) #define MASK_MASTER_STRIDE (MASK_MASTER_SIZE) @@ -836,26 +598,26 @@ const uint8_t *av1_get_compound_type_mask_inverse( const uint8_t *av1_get_compound_type_mask( const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type); #if CONFIG_INTERINTRA -void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred, - uint8_t *upred, uint8_t *vpred, - int ystride, int ustride, int vstride, - BUFFER_SET *ctx, BLOCK_SIZE bsize); -void av1_build_interintra_predictors_sby(MACROBLOCKD *xd, uint8_t *ypred, - int ystride, BUFFER_SET *ctx, +void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *ypred, uint8_t *upred, + uint8_t *vpred, int ystride, int ustride, + int vstride, BUFFER_SET *ctx, + BLOCK_SIZE bsize); +void av1_build_interintra_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *ypred, int ystride, + BUFFER_SET *ctx, BLOCK_SIZE bsize); +void av1_build_interintra_predictors_sbc(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *upred, int ustride, + BUFFER_SET *ctx, int plane, BLOCK_SIZE bsize); -void av1_build_interintra_predictors_sbc(MACROBLOCKD *xd, uint8_t *upred, - int ustride, BUFFER_SET *ctx, - int plane, BLOCK_SIZE bsize); -void av1_build_interintra_predictors_sbuv(MACROBLOCKD *xd, uint8_t *upred, - uint8_t *vpred, int ustride, - int vstride, BUFFER_SET *ctx, - BLOCK_SIZE bsize); - -void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd, - BLOCK_SIZE bsize, int plane, - BUFFER_SET *ctx, - uint8_t *intra_pred, - int intra_stride); +void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd, + uint8_t *upred, uint8_t *vpred, + int ustride, int vstride, + BUFFER_SET *ctx, BLOCK_SIZE bsize); + +void av1_build_intra_predictors_for_interintra( + const AV1_COMMON *cm, MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane, + BUFFER_SET *ctx, uint8_t *intra_pred, int intra_stride); void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane, const uint8_t *inter_pred, int inter_stride, const uint8_t *intra_pred, int intra_stride); @@ -871,7 +633,45 @@ void av1_build_wedge_inter_predictor_from_buf( #endif // CONFIG_SUPERTX uint8_t *ext_dst0[3], int ext_dst_stride0[3], uint8_t *ext_dst1[3], int ext_dst_stride1[3]); -#endif // CONFIG_EXT_INTER + +#if CONFIG_NCOBMC_ADAPT_WEIGHT +#define ASSIGN_ALIGNED_PTRS(p, a, s) \ + p[0] = a; \ + p[1] = a + s; \ + p[2] = a + 2 * s; + +#define ASSIGN_ALIGNED_PTRS_HBD(p, a, s, l) \ + p[0] = CONVERT_TO_BYTEPTR(a); \ + p[1] = CONVERT_TO_BYTEPTR(a + s * l); \ + p[2] = CONVERT_TO_BYTEPTR(a + 2 * s * l); + +void alloc_ncobmc_pred_buffer(MACROBLOCKD *const xd); +void free_ncobmc_pred_buffer(MACROBLOCKD *const xd); +void set_sb_mi_boundaries(const AV1_COMMON *const cm, MACROBLOCKD *const xd, + const int mi_row, const int mi_col); + +void reset_xd_boundary(MACROBLOCKD *xd, int mi_row, int bh, int mi_col, int bw, + int mi_rows, int mi_cols); + +void get_pred_from_intrpl_buf(MACROBLOCKD *xd, int mi_row, int mi_col, + BLOCK_SIZE bsize, int plane); + +void build_ncobmc_intrpl_pred(const AV1_COMMON *const cm, MACROBLOCKD *xd, + int plane, int pxl_row, int pxl_col, + BLOCK_SIZE bsize, uint8_t *preds[][MAX_MB_PLANE], + int ps[MAX_MB_PLANE], // pred buffer strides + int mode); + +void av1_get_ext_blk_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[][MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]); + +void av1_get_ori_blk_pred(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize, + int mi_row, int mi_col, + uint8_t *dst_buf[MAX_MB_PLANE], + int dst_stride[MAX_MB_PLANE]); +#endif // CONFIG_NCOBMC_ADAPT_WEIGHT #ifdef __cplusplus } // extern "C" diff --git a/third_party/aom/av1/common/reconintra.c b/third_party/aom/av1/common/reconintra.c index 0fdb6183b..c6d57b742 100644 --- a/third_party/aom/av1/common/reconintra.c +++ b/third_party/aom/av1/common/reconintra.c @@ -44,6 +44,10 @@ enum { #endif // CONFIG_INTRA_EDGE_UPSAMPLE #endif // CONFIG_INTRA_EDGE +#define INTRA_USES_EXT_TRANSFORMS 1 +#define INTRA_USES_RECT_TRANSFORMS \ + (CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX)) + static const uint8_t extend_modes[INTRA_MODES] = { NEED_ABOVE | NEED_LEFT, // DC NEED_ABOVE, // V @@ -54,13 +58,11 @@ static const uint8_t extend_modes[INTRA_MODES] = { NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // D153 NEED_LEFT | NEED_BOTTOMLEFT, // D207 NEED_ABOVE | NEED_ABOVERIGHT, // D63 -#if CONFIG_ALT_INTRA - NEED_LEFT | NEED_ABOVE, // SMOOTH + NEED_LEFT | NEED_ABOVE, // SMOOTH #if CONFIG_SMOOTH_HV NEED_LEFT | NEED_ABOVE, // SMOOTH_V NEED_LEFT | NEED_ABOVE, // SMOOTH_H #endif // CONFIG_SMOOTH_HV -#endif // CONFIG_ALT_INTRA NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // TM }; @@ -156,6 +158,13 @@ static const uint16_t orders_4x16[256] = { }; #endif +static const uint16_t orders_32x128[4] = { + 0, 1, 2, 3, +}; +static const uint16_t orders_128x32[4] = { + 0, 1, 2, 3, +}; + #if CONFIG_CB4X4 || CONFIG_EXT_PARTITION static const uint16_t orders_16x8[128] = { 0, 2, 8, 10, 32, 34, 40, 42, 1, 3, 9, 11, 33, 35, 41, 43, @@ -387,8 +396,10 @@ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { orders_64x128, orders_128x64, orders_128x128, // 4x16, 16x4, 8x32 orders_4x16, orders_16x4, orders_8x32, - // 32x8 - orders_32x8 + // 32x8, 16x64, 64x16 + orders_32x8, orders_16x64, orders_64x16, + // 32x128, 128x32 + orders_32x128, orders_128x32 }; /* clang-format on */ #else @@ -417,13 +428,13 @@ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { orders_64x128, orders_128x64, orders_128x128, // 4x16, 16x4, 8x32 orders_8x32, orders_32x8, orders_16x64, - // 32x8 - orders_64x16 + // 32x8, 16x64, 64x16 + orders_64x16, orders_32x128, orders_128x32 }; /* clang-format on */ #endif // CONFIG_EXT_PARTITION -#if CONFIG_EXT_PARTITION_TYPES +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB static const uint16_t orders_verta_64x64[4] = { 0, 2, 1, 2, }; @@ -511,11 +522,11 @@ static const uint16_t *const orders_verta[BLOCK_SIZES] = { #endif // CONFIG_EXT_PARTITION #endif // CONFIG_EXT_PARTITION_TYPES -static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col, - int top_available, int right_available, -#if CONFIG_EXT_PARTITION_TYPES +static int has_top_right(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row, + int mi_col, int top_available, int right_available, +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB PARTITION_TYPE partition, -#endif +#endif // CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB TX_SIZE txsz, int row_off, int col_off, int ss_x) { if (!top_available || !right_available) return 0; @@ -551,8 +562,9 @@ static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col, const int bw_in_mi_log2 = mi_width_log2_lookup[bsize]; const int bh_in_mi_log2 = mi_height_log2_lookup[bsize]; - const int blk_row_in_sb = (mi_row & MAX_MIB_MASK) >> bh_in_mi_log2; - const int blk_col_in_sb = (mi_col & MAX_MIB_MASK) >> bw_in_mi_log2; + const int sb_mi_size = mi_size_high[cm->sb_size]; + const int blk_row_in_sb = (mi_row & (sb_mi_size - 1)) >> bh_in_mi_log2; + const int blk_col_in_sb = (mi_col & (sb_mi_size - 1)) >> bw_in_mi_log2; // Top row of superblock: so top-right pixels are in the top and/or // top-right superblocks, both of which are already available. @@ -560,12 +572,12 @@ static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col, // Rightmost column of superblock (and not the top row): so top-right pixels // fall in the right superblock, which is not available yet. - if (((blk_col_in_sb + 1) << bw_in_mi_log2) >= MAX_MIB_SIZE) return 0; + if (((blk_col_in_sb + 1) << bw_in_mi_log2) >= sb_mi_size) return 0; // General case (neither top row nor rightmost column): check if the // top-right block is coded before the current block. const uint16_t *const order = -#if CONFIG_EXT_PARTITION_TYPES +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB (partition == PARTITION_VERT_A) ? orders_verta[bsize] : #endif // CONFIG_EXT_PARTITION_TYPES orders[bsize]; @@ -581,8 +593,8 @@ static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col, } } -static int has_bottom_left(BLOCK_SIZE bsize, int mi_row, int mi_col, - int bottom_available, int left_available, +static int has_bottom_left(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row, + int mi_col, int bottom_available, int left_available, TX_SIZE txsz, int row_off, int col_off, int ss_y) { if (!bottom_available || !left_available) return 0; @@ -604,8 +616,9 @@ static int has_bottom_left(BLOCK_SIZE bsize, int mi_row, int mi_col, const int bw_in_mi_log2 = mi_width_log2_lookup[bsize]; const int bh_in_mi_log2 = mi_height_log2_lookup[bsize]; - const int blk_row_in_sb = (mi_row & MAX_MIB_MASK) >> bh_in_mi_log2; - const int blk_col_in_sb = (mi_col & MAX_MIB_MASK) >> bw_in_mi_log2; + const int sb_mi_size = mi_size_high[cm->sb_size]; + const int blk_row_in_sb = (mi_row & (sb_mi_size - 1)) >> bh_in_mi_log2; + const int blk_col_in_sb = (mi_col & (sb_mi_size - 1)) >> bw_in_mi_log2; // Leftmost column of superblock: so bottom-left pixels maybe in the left // and/or bottom-left superblocks. But only the left superblock is @@ -617,13 +630,13 @@ static int has_bottom_left(BLOCK_SIZE bsize, int mi_row, int mi_col, ss_y; const int row_off_in_sb = blk_start_row_off + row_off; const int sb_height_unit = - MAX_MIB_SIZE << (MI_SIZE_LOG2 - tx_size_wide_log2[0]) >> ss_y; + sb_mi_size << (MI_SIZE_LOG2 - tx_size_wide_log2[0]) >> ss_y; return row_off_in_sb + bottom_left_count_unit < sb_height_unit; } // Bottom row of superblock (and not the leftmost column): so bottom-left // pixels fall in the bottom superblock, which is not available yet. - if (((blk_row_in_sb + 1) << bh_in_mi_log2) >= MAX_MIB_SIZE) return 0; + if (((blk_row_in_sb + 1) << bh_in_mi_log2) >= sb_mi_size) return 0; // General case (neither leftmost column nor bottom row): check if the // bottom-left block is coded before the current block. @@ -659,6 +672,17 @@ static void av1_init_intra_predictors_internal(void) { assert(NELEMENTS(mode_to_angle_map) == INTRA_MODES); #endif // CONFIG_EXT_INTRA +#if CONFIG_TX64X64 +#define INIT_RECTANGULAR(p, type) \ + p[TX_4X8] = aom_##type##_predictor_4x8; \ + p[TX_8X4] = aom_##type##_predictor_8x4; \ + p[TX_8X16] = aom_##type##_predictor_8x16; \ + p[TX_16X8] = aom_##type##_predictor_16x8; \ + p[TX_16X32] = aom_##type##_predictor_16x32; \ + p[TX_32X16] = aom_##type##_predictor_32x16; \ + p[TX_32X64] = aom_##type##_predictor_32x64; \ + p[TX_64X32] = aom_##type##_predictor_64x32; +#else #define INIT_RECTANGULAR(p, type) \ p[TX_4X8] = aom_##type##_predictor_4x8; \ p[TX_8X4] = aom_##type##_predictor_8x4; \ @@ -666,6 +690,7 @@ static void av1_init_intra_predictors_internal(void) { p[TX_16X8] = aom_##type##_predictor_16x8; \ p[TX_16X32] = aom_##type##_predictor_16x32; \ p[TX_32X16] = aom_##type##_predictor_32x16; +#endif // CONFIG_TX64X64 #if CONFIG_TX64X64 #define INIT_NO_4X4(p, type) \ @@ -702,16 +727,12 @@ static void av1_init_intra_predictors_internal(void) { INIT_ALL_SIZES(pred[D135_PRED], d135); INIT_ALL_SIZES(pred[D153_PRED], d153); -#if CONFIG_ALT_INTRA INIT_ALL_SIZES(pred[TM_PRED], paeth); INIT_ALL_SIZES(pred[SMOOTH_PRED], smooth); #if CONFIG_SMOOTH_HV INIT_ALL_SIZES(pred[SMOOTH_V_PRED], smooth_v); INIT_ALL_SIZES(pred[SMOOTH_H_PRED], smooth_h); #endif // CONFIG_SMOOTH_HV -#else - INIT_ALL_SIZES(pred[TM_PRED], tm); -#endif // CONFIG_ALT_INTRA INIT_ALL_SIZES(dc_pred[0][0], dc_128); INIT_ALL_SIZES(dc_pred[0][1], dc_top); @@ -728,16 +749,12 @@ static void av1_init_intra_predictors_internal(void) { INIT_ALL_SIZES(pred_high[D135_PRED], highbd_d135); INIT_ALL_SIZES(pred_high[D153_PRED], highbd_d153); -#if CONFIG_ALT_INTRA INIT_ALL_SIZES(pred_high[TM_PRED], highbd_paeth); INIT_ALL_SIZES(pred_high[SMOOTH_PRED], highbd_smooth); #if CONFIG_SMOOTH_HV INIT_ALL_SIZES(pred_high[SMOOTH_V_PRED], highbd_smooth_v); INIT_ALL_SIZES(pred_high[SMOOTH_H_PRED], highbd_smooth_h); #endif // CONFIG_SMOOTH_HV -#else - INIT_ALL_SIZES(pred_high[TM_PRED], highbd_tm); -#endif // CONFIG_ALT_INTRA INIT_ALL_SIZES(dc_pred_high[0][0], highbd_dc_128); INIT_ALL_SIZES(dc_pred_high[0][1], highbd_dc_top); @@ -797,67 +814,6 @@ static void dr_prediction_z1(uint8_t *dst, ptrdiff_t stride, int bw, int bh, assert(dy == 1); assert(dx > 0); -#if CONFIG_INTRA_INTERP - if (filter_type != INTRA_FILTER_LINEAR) { - const int pad_size = SUBPEL_TAPS >> 1; - int len; - DECLARE_ALIGNED(16, uint8_t, buf[SUBPEL_SHIFTS][MAX_SB_SIZE]); - DECLARE_ALIGNED(16, uint8_t, src[MAX_SB_SIZE + SUBPEL_TAPS]); - uint8_t flags[SUBPEL_SHIFTS]; - - memset(flags, 0, SUBPEL_SHIFTS * sizeof(flags[0])); - memset(src, above[0], pad_size * sizeof(above[0])); - memcpy(src + pad_size, above, (bw + bh) * sizeof(above[0])); - memset(src + pad_size + bw + bh, above[bw + bh - 1], - pad_size * sizeof(above[0])); - flags[0] = 1; - x = dx; - for (r = 0; r < bh; ++r, dst += stride, x += dx) { - base = x >> 8; - shift = x & 0xFF; - shift = ROUND_POWER_OF_TWO(shift, 8 - SUBPEL_BITS); - if (shift == SUBPEL_SHIFTS) { - base += 1; - shift = 0; - } - len = AOMMIN(bw, bw + bh - 1 - base); - if (len <= 0) { - int i; - for (i = r; i < bh; ++i) { - memset(dst, above[bw + bh - 1], bw * sizeof(dst[0])); - dst += stride; - } - return; - } - - if (len <= (bw >> 1) && !flags[shift]) { - base = x >> 8; - shift = x & 0xFF; - for (c = 0; c < len; ++c) { - val = intra_subpel_interp(base, shift, above, 0, bw + bh - 1, - filter_type); - dst[c] = clip_pixel(val); - ++base; - } - } else { - if (!flags[shift]) { - const int16_t *filter = av1_intra_filter_kernels[filter_type][shift]; - aom_convolve8_horiz(src + pad_size, bw + bh, buf[shift], bw + bh, - filter, 16, NULL, 16, bw + bh, - bw + bh < 16 ? 2 : 1); - flags[shift] = 1; - } - memcpy(dst, shift == 0 ? src + pad_size + base : &buf[shift][base], - len * sizeof(dst[0])); - } - - if (len < bw) - memset(dst + len, above[bw + bh - 1], (bw - len) * sizeof(dst[0])); - } - return; - } -#endif // CONFIG_INTRA_INTERP - #if !CONFIG_INTRA_EDGE_UPSAMPLE const int upsample_above = 0; #endif // !CONFIG_INTRA_EDGE_UPSAMPLE @@ -879,8 +835,13 @@ static void dr_prediction_z1(uint8_t *dst, ptrdiff_t stride, int bw, int bh, for (c = 0; c < bw; ++c, base += base_inc) { if (base < max_base_x) { +#if CONFIG_INTRA_INTERP + val = intra_subpel_interp(base, shift, above, 0, bw + bh - 1, + filter_type); +#else // CONFIG_INTRA_INTERP val = above[base] * (256 - shift) + above[base + 1] * shift; val = ROUND_POWER_OF_TWO(val, 8); +#endif // CONFIG_INTRA_INTERP dst[c] = clip_pixel(val); } else { dst[c] = above[max_base_x]; @@ -960,77 +921,6 @@ static void dr_prediction_z3(uint8_t *dst, ptrdiff_t stride, int bw, int bh, assert(dx == 1); assert(dy > 0); -#if CONFIG_INTRA_INTERP - if (filter_type != INTRA_FILTER_LINEAR) { - const int pad_size = SUBPEL_TAPS >> 1; - int len, i; - DECLARE_ALIGNED(16, uint8_t, buf[MAX_SB_SIZE][4 * SUBPEL_SHIFTS]); - DECLARE_ALIGNED(16, uint8_t, src[(MAX_SB_SIZE + SUBPEL_TAPS) * 4]); - uint8_t flags[SUBPEL_SHIFTS]; - - memset(flags, 0, SUBPEL_SHIFTS * sizeof(flags[0])); - for (i = 0; i < pad_size; ++i) src[4 * i] = left[0]; - for (i = 0; i < bw + bh; ++i) src[4 * (i + pad_size)] = left[i]; - for (i = 0; i < pad_size; ++i) - src[4 * (i + bw + bh + pad_size)] = left[bw + bh - 1]; - flags[0] = 1; - y = dy; - for (c = 0; c < bw; ++c, y += dy) { - base = y >> 8; - shift = y & 0xFF; - shift = ROUND_POWER_OF_TWO(shift, 8 - SUBPEL_BITS); - if (shift == SUBPEL_SHIFTS) { - base += 1; - shift = 0; - } - len = AOMMIN(bh, bw + bh - 1 - base); - - if (len <= 0) { - for (r = 0; r < bh; ++r) { - dst[r * stride + c] = left[bw + bh - 1]; - } - continue; - } - - if (len <= (bh >> 1) && !flags[shift]) { - base = y >> 8; - shift = y & 0xFF; - for (r = 0; r < len; ++r) { - val = intra_subpel_interp(base, shift, left, 0, bw + bh - 1, - filter_type); - dst[r * stride + c] = clip_pixel(val); - ++base; - } - } else { - if (!flags[shift]) { - const int16_t *filter = av1_intra_filter_kernels[filter_type][shift]; - aom_convolve8_vert(src + 4 * pad_size, 4, buf[0] + 4 * shift, - 4 * SUBPEL_SHIFTS, NULL, 16, filter, 16, - bw + bh < 16 ? 4 : 4, bw + bh); - flags[shift] = 1; - } - - if (shift == 0) { - for (r = 0; r < len; ++r) { - dst[r * stride + c] = left[r + base]; - } - } else { - for (r = 0; r < len; ++r) { - dst[r * stride + c] = buf[r + base][4 * shift]; - } - } - } - - if (len < bh) { - for (r = len; r < bh; ++r) { - dst[r * stride + c] = left[bw + bh - 1]; - } - } - } - return; - } -#endif // CONFIG_INTRA_INTERP - #if !CONFIG_INTRA_EDGE_UPSAMPLE const int upsample_left = 0; #endif // !CONFIG_INTRA_EDGE_UPSAMPLE @@ -1044,8 +934,13 @@ static void dr_prediction_z3(uint8_t *dst, ptrdiff_t stride, int bw, int bh, for (r = 0; r < bh; ++r, base += base_inc) { if (base < max_base_y) { +#if CONFIG_INTRA_INTERP + val = + intra_subpel_interp(base, shift, left, 0, bw + bh - 1, filter_type); +#else // CONFIG_INTRA_INTERP val = left[base] * (256 - shift) + left[base + 1] * shift; val = ROUND_POWER_OF_TWO(val, 8); +#endif // CONFIG_INTRA_INTERP dst[r * stride + c] = clip_pixel(val); } else { for (; r < bh; ++r) dst[r * stride + c] = left[max_base_y]; @@ -2324,7 +2219,7 @@ static int intra_edge_filter_strength(int bsz, int delta) { return strength; } -static void filter_intra_edge(uint8_t *p, int sz, int strength) { +void av1_filter_intra_edge_c(uint8_t *p, int sz, int strength) { if (!strength) return; const int kernel[INTRA_EDGE_FILT][INTRA_EDGE_TAPS] = { @@ -2348,7 +2243,7 @@ static void filter_intra_edge(uint8_t *p, int sz, int strength) { } #if CONFIG_HIGHBITDEPTH -static void filter_intra_edge_high(uint16_t *p, int sz, int strength) { +void av1_filter_intra_edge_high_c(uint16_t *p, int sz, int strength) { if (!strength) return; const int kernel[INTRA_EDGE_FILT][INTRA_EDGE_TAPS] = { @@ -2378,7 +2273,7 @@ static int use_intra_edge_upsample(int bsz, int delta) { return (bsz == 4 && d > 0 && d < 56); } -static void upsample_intra_edge(uint8_t *p, int sz) { +void av1_upsample_intra_edge_c(uint8_t *p, int sz) { // interpolate half-sample positions assert(sz <= MAX_UPSAMPLE_SZ); @@ -2402,7 +2297,7 @@ static void upsample_intra_edge(uint8_t *p, int sz) { } #if CONFIG_HIGHBITDEPTH -static void upsample_intra_edge_high(uint16_t *p, int sz, int bd) { +void av1_upsample_intra_edge_high_c(uint16_t *p, int sz, int bd) { // interpolate half-sample positions assert(sz <= MAX_UPSAMPLE_SZ); @@ -2438,17 +2333,15 @@ static void build_intra_predictors_high( int i; uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); - DECLARE_ALIGNED(16, uint16_t, left_data[MAX_TX_SIZE * 2 + 16]); - DECLARE_ALIGNED(16, uint16_t, above_data[MAX_TX_SIZE * 2 + 16]); + DECLARE_ALIGNED(16, uint16_t, left_data[MAX_TX_SIZE * 2 + 32]); + DECLARE_ALIGNED(16, uint16_t, above_data[MAX_TX_SIZE * 2 + 32]); uint16_t *const above_row = above_data + 16; uint16_t *const left_col = left_data + 16; const int txwpx = tx_size_wide[tx_size]; const int txhpx = tx_size_high[tx_size]; -#if !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && \ - (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#if !INTRA_USES_RECT_TRANSFORMS assert(txwpx == txhpx); -#endif // !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && - // (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#endif // !INTRA_USES_RECT_TRANSFORMS int need_left = extend_modes[mode] & NEED_LEFT; int need_above = extend_modes[mode] & NEED_ABOVE; int need_above_left = extend_modes[mode] & NEED_ABOVELEFT; @@ -2632,25 +2525,25 @@ static void build_intra_predictors_high( if (need_above && n_top_px > 0) { const int strength = intra_edge_filter_strength(txwpx, p_angle - 90); const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0); - filter_intra_edge_high(above_row - ab_le, n_px, strength); + av1_filter_intra_edge_high(above_row - ab_le, n_px, strength); } if (need_left && n_left_px > 0) { const int strength = intra_edge_filter_strength(txhpx, p_angle - 180); const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0); - filter_intra_edge_high(left_col - ab_le, n_px, strength); + av1_filter_intra_edge_high(left_col - ab_le, n_px, strength); } } #if CONFIG_INTRA_EDGE_UPSAMPLE const int upsample_above = use_intra_edge_upsample(txwpx, p_angle - 90); - if (upsample_above) { + if (need_above && upsample_above) { const int n_px = txwpx + (need_right ? txhpx : 0); - upsample_intra_edge_high(above_row, n_px, xd->bd); + av1_upsample_intra_edge_high(above_row, n_px, xd->bd); } const int upsample_left = use_intra_edge_upsample(txhpx, p_angle - 180); - if (upsample_left) { + if (need_left && upsample_left) { const int n_px = txhpx + (need_bottom ? txwpx : 0); - upsample_intra_edge_high(left_col, n_px, xd->bd); + av1_upsample_intra_edge_high(left_col, n_px, xd->bd); } #endif // CONFIG_INTRA_EDGE_UPSAMPLE #endif // CONFIG_INTRA_EDGE @@ -2684,17 +2577,15 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, int plane) { int i; const uint8_t *above_ref = ref - ref_stride; - DECLARE_ALIGNED(16, uint8_t, left_data[MAX_TX_SIZE * 2 + 16]); - DECLARE_ALIGNED(16, uint8_t, above_data[MAX_TX_SIZE * 2 + 16]); + DECLARE_ALIGNED(16, uint8_t, left_data[MAX_TX_SIZE * 2 + 32]); + DECLARE_ALIGNED(16, uint8_t, above_data[MAX_TX_SIZE * 2 + 32]); uint8_t *const above_row = above_data + 16; uint8_t *const left_col = left_data + 16; const int txwpx = tx_size_wide[tx_size]; const int txhpx = tx_size_high[tx_size]; -#if !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && \ - (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#if !INTRA_USES_RECT_TRANSFORMS assert(txwpx == txhpx); -#endif // !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && - // (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#endif // !INTRA_USES_RECT_TRANSFORMS int need_left = extend_modes[mode] & NEED_LEFT; int need_above = extend_modes[mode] & NEED_ABOVE; int need_above_left = extend_modes[mode] & NEED_ABOVELEFT; @@ -2876,25 +2767,25 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, if (need_above && n_top_px > 0) { const int strength = intra_edge_filter_strength(txwpx, p_angle - 90); const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0); - filter_intra_edge(above_row - ab_le, n_px, strength); + av1_filter_intra_edge(above_row - ab_le, n_px, strength); } if (need_left && n_left_px > 0) { const int strength = intra_edge_filter_strength(txhpx, p_angle - 180); const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0); - filter_intra_edge(left_col - ab_le, n_px, strength); + av1_filter_intra_edge(left_col - ab_le, n_px, strength); } } #if CONFIG_INTRA_EDGE_UPSAMPLE const int upsample_above = use_intra_edge_upsample(txwpx, p_angle - 90); - if (upsample_above) { + if (need_above && upsample_above) { const int n_px = txwpx + (need_right ? txhpx : 0); - upsample_intra_edge(above_row, n_px); + av1_upsample_intra_edge(above_row, n_px); } const int upsample_left = use_intra_edge_upsample(txhpx, p_angle - 180); - if (upsample_left) { + if (need_left && upsample_left) { const int n_px = txhpx + (need_bottom ? txwpx : 0); - upsample_intra_edge(left_col, n_px); + av1_upsample_intra_edge(left_col, n_px); } #endif // CONFIG_INTRA_EDGE_UPSAMPLE #endif // CONFIG_INTRA_EDGE @@ -2912,22 +2803,15 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, // predict if (mode == DC_PRED) { -#if CONFIG_CFL - // CFL predict its own DC_PRED for Chromatic planes - if (plane == AOM_PLANE_Y) { -#endif - dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride, above_row, - left_col); -#if CONFIG_CFL - } -#endif - + dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride, above_row, + left_col); } else { pred[mode][tx_size](dst, dst_stride, above_row, left_col); } } -static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, +static void predict_intra_block_helper(const AV1_COMMON *cm, + const MACROBLOCKD *xd, int wpx, int hpx, TX_SIZE tx_size, PREDICTION_MODE mode, const uint8_t *ref, int ref_stride, uint8_t *dst, int dst_stride, @@ -2951,11 +2835,9 @@ static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, const int mi_col = -xd->mb_to_left_edge >> (3 + MI_SIZE_LOG2); const int txwpx = tx_size_wide[tx_size]; const int txhpx = tx_size_high[tx_size]; -#if !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && \ - (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#if !INTRA_USES_RECT_TRANSFORMS assert(txwpx == txhpx); -#endif // !(CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && - // (CONFIG_VAR_TX || CONFIG_EXT_TX)) +#endif // !INTRA_USES_RECT_TRANSFORMS #if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2 && !CONFIG_CHROMA_SUB8X8 const int xr_chr_offset = (pd->subsampling_x && bsize < BLOCK_8X8) ? 2 : 0; const int yd_chr_offset = (pd->subsampling_y && bsize < BLOCK_8X8) ? 2 : 0; @@ -2976,7 +2858,7 @@ static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, (MI_SIZE_LOG2 - tx_size_wide_log2[0])) < xd->tile.mi_col_end; const int bottom_available = (yd > 0); -#if CONFIG_EXT_PARTITION_TYPES +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB const PARTITION_TYPE partition = xd->mi[0]->mbmi.partition; #endif @@ -2986,15 +2868,14 @@ static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, #endif const int have_top_right = - has_top_right(bsize, mi_row, mi_col, have_top, right_available, -#if CONFIG_EXT_PARTITION_TYPES + has_top_right(cm, bsize, mi_row, mi_col, have_top, right_available, +#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB partition, -#endif +#endif // CONFIG_EXT_PARTITION_TYPES && !CONFIG_EXT_PARTITION_TYPES_AB tx_size, row_off, col_off, pd->subsampling_x); const int have_bottom_left = - has_bottom_left(bsize, mi_row, mi_col, bottom_available, have_left, + has_bottom_left(cm, bsize, mi_row, mi_col, bottom_available, have_left, tx_size, row_off, col_off, pd->subsampling_y); -#if CONFIG_PALETTE if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) { const int stride = wpx; int r, c; @@ -3023,7 +2904,6 @@ static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, #endif // CONFIG_HIGHBITDEPTH return; } -#endif // CONFIG_PALETTE #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -3043,8 +2923,9 @@ static void predict_intra_block_helper(const MACROBLOCKD *xd, int wpx, int hpx, have_bottom_left ? AOMMIN(txhpx, yd) : 0, plane); } -void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx, - int blk_col, int blk_row, TX_SIZE tx_size) { +void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd, + int plane, int block_idx, int blk_col, + int blk_row, TX_SIZE tx_size) { const MODE_INFO *mi = xd->mi[0]; const MB_MODE_INFO *const mbmi = &mi->mbmi; struct macroblockd_plane *const pd = &xd->plane[plane]; @@ -3057,213 +2938,262 @@ void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx, ? get_y_mode(mi, block_raster_idx) : get_uv_mode(mbmi->uv_mode); #if CONFIG_CFL - if (plane != AOM_PLANE_Y && mbmi->uv_mode == UV_DC_PRED) { + if (plane != AOM_PLANE_Y && mbmi->uv_mode == UV_CFL_PRED) { if (plane == AOM_PLANE_U && blk_col == 0 && blk_row == 0) { // Avoid computing the CfL parameters twice, if they have already been // computed in cfl_rd_pick_alpha. if (!xd->cfl->are_parameters_computed) cfl_compute_parameters(xd, tx_size); } - - cfl_predict_block(xd, dst, pd->dst.stride, blk_row, blk_col, tx_size, - plane); - + cfl_predict_block(xd, dst, dst_stride, blk_row, blk_col, tx_size, plane); return; } #endif - av1_predict_intra_block(xd, pd->width, pd->height, txsize_to_bsize[tx_size], - mode, dst, dst_stride, dst, dst_stride, blk_col, - blk_row, plane); + av1_predict_intra_block(cm, xd, pd->width, pd->height, + txsize_to_bsize[tx_size], mode, dst, dst_stride, dst, + dst_stride, blk_col, blk_row, plane); } -void av1_predict_intra_block(const MACROBLOCKD *xd, int wpx, int hpx, - BLOCK_SIZE bsize, PREDICTION_MODE mode, - const uint8_t *ref, int ref_stride, uint8_t *dst, - int dst_stride, int col_off, int row_off, - int plane) { - const int block_width = block_size_wide[bsize]; - const int block_height = block_size_high[bsize]; -#if CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX) - const TX_SIZE tx_size = max_txsize_rect_lookup[bsize]; - assert(tx_size < TX_SIZES_ALL); -#else - const TX_SIZE tx_size = max_txsize_lookup[bsize]; - assert(tx_size < TX_SIZES); -#endif // CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || - // CONFIG_EXT_TX) +#if INTRA_USES_EXT_TRANSFORMS +// Copy the given row of dst into the equivalent row of ref, saving +// the overwritten data to tmp. Returns zero if no copy happened (so +// no restore is needed) +// +// Note that ref_row and dst_row follow the usual hibd convention +// where you convert to a uint16_t* with CONVERT_TO_SHORTPTR(). tmp +// does not follow that convention: it's a genuine pointer which is +// correctly aligned and sized for either 8 or 16 bit data. +// +// matching_strides is a boolean flag which should be nonzero if ref +// and dst have the same stride. +static int overwrite_ref_row(int matching_strides, int buf_flags, + int block_width, const uint8_t *dst_row, + uint8_t *ref_row, uint8_t *tmp_row) { + if (ref_row == dst_row && matching_strides) return 0; + + int row_bytes = block_width; - if (block_width == block_height) { - predict_intra_block_helper(xd, wpx, hpx, tx_size, mode, ref, ref_stride, - dst, dst_stride, col_off, row_off, plane); - } else { -#if (CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX)) || (CONFIG_EXT_INTER) - assert((block_width == wpx && block_height == hpx) || - (block_width == (wpx >> 1) && block_height == hpx) || - (block_width == wpx && block_height == (hpx >> 1))); #if CONFIG_HIGHBITDEPTH - uint16_t tmp16[MAX_SB_SIZE]; -#endif // CONFIG_HIGHBITDEPTH - uint8_t tmp[MAX_SB_SIZE]; - - if (block_width < block_height) { - assert(block_height == (block_width << 1)); - // Predict the top square sub-block. - predict_intra_block_helper(xd, wpx, hpx, tx_size, mode, ref, ref_stride, - dst, dst_stride, col_off, row_off, plane); -#if CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX) - if (block_width == tx_size_wide[tx_size] && - block_height == tx_size_high[tx_size]) { // Most common case. - return; // We are done. - } else { - // Can only happen for large rectangular block sizes as such large - // transform sizes aren't available. -#if CONFIG_EXT_PARTITION - assert(bsize == BLOCK_32X64 || bsize == BLOCK_64X128); -#else - assert(bsize == BLOCK_32X64); -#endif // CONFIG_EXT_PARTITION -#if CONFIG_TX64X64 - assert(tx_size == TX_32X32 || tx_size == TX64X64); + if (buf_flags & YV12_FLAG_HIGHBITDEPTH) { + row_bytes *= 2; + ref_row = (uint8_t *)CONVERT_TO_SHORTPTR(ref_row); + dst_row = (const uint8_t *)CONVERT_TO_SHORTPTR(dst_row); + } #else - assert(tx_size == TX_32X32); -#endif // CONFIG_TX64X64 - // In this case, we continue to the bottom square sub-block. - } -#endif // CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || - // CONFIG_EXT_TX) - { - const int half_block_height = block_height >> 1; - const int half_block_height_unit = - half_block_height >> tx_size_wide_log2[0]; - // Cast away const to modify 'ref' temporarily; will be restored later. - uint8_t *src_2 = (uint8_t *)ref + half_block_height * ref_stride; - uint8_t *dst_2 = dst + half_block_height * dst_stride; - const int row_off_2 = row_off + half_block_height_unit; - // Save the last row of top square sub-block as 'above' row for bottom - // square sub-block. - if (src_2 != dst_2 || ref_stride != dst_stride) { -#if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - uint16_t *src_2_16 = CONVERT_TO_SHORTPTR(src_2); - uint16_t *dst_2_16 = CONVERT_TO_SHORTPTR(dst_2); - memcpy(tmp16, src_2_16 - ref_stride, - block_width * sizeof(*src_2_16)); - memcpy(src_2_16 - ref_stride, dst_2_16 - dst_stride, - block_width * sizeof(*src_2_16)); - } else { + (void)buf_flags; #endif // CONFIG_HIGHBITDEPTH - memcpy(tmp, src_2 - ref_stride, block_width * sizeof(*src_2)); - memcpy(src_2 - ref_stride, dst_2 - dst_stride, - block_width * sizeof(*src_2)); + + memcpy(tmp_row, ref_row, row_bytes); + memcpy(ref_row, dst_row, row_bytes); + return 1; +} + +static void restore_ref_row(int buf_flags, int block_width, + const uint8_t *tmp_row, uint8_t *ref_row) { + int row_bytes = block_width; #if CONFIG_HIGHBITDEPTH - } + if (buf_flags & YV12_FLAG_HIGHBITDEPTH) { + row_bytes *= 2; + ref_row = (uint8_t *)CONVERT_TO_SHORTPTR(ref_row); + } +#else + (void)buf_flags; #endif // CONFIG_HIGHBITDEPTH - } - // Predict the bottom square sub-block. - predict_intra_block_helper(xd, wpx, hpx, tx_size, mode, src_2, - ref_stride, dst_2, dst_stride, col_off, - row_off_2, plane); - // Restore the last row of top square sub-block. - if (src_2 != dst_2 || ref_stride != dst_stride) { + + memcpy(ref_row, tmp_row, row_bytes); +} + +// The column equivalent of overwrite_ref_row. ref_row and dst_row +// point at the relevant column of the first row of the block. +static int overwrite_ref_col(int buf_flags, int block_height, + const uint8_t *dst_row, int dst_stride, + uint8_t *ref_row, int ref_stride, + uint8_t *tmp_row) { + if (ref_row == dst_row && ref_stride == dst_stride) return 0; + #if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - uint16_t *src_2_16 = CONVERT_TO_SHORTPTR(src_2); - memcpy(src_2_16 - ref_stride, tmp16, - block_width * sizeof(*src_2_16)); - } else { + if (buf_flags & YV12_FLAG_HIGHBITDEPTH) { + uint16_t *tmp_16 = (uint16_t *)tmp_row; + uint16_t *ref_16 = CONVERT_TO_SHORTPTR(ref_row); + const uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst_row); + + for (int i = 0; i < block_height; ++i) { + tmp_16[i] = ref_16[i * ref_stride]; + ref_16[i * ref_stride] = dst_16[i * dst_stride]; + } + } else { #endif // CONFIG_HIGHBITDEPTH - memcpy(src_2 - ref_stride, tmp, block_width * sizeof(*src_2)); + for (int i = 0; i < block_height; ++i) { + tmp_row[i] = ref_row[i * ref_stride]; + ref_row[i * ref_stride] = dst_row[i * dst_stride]; + } #if CONFIG_HIGHBITDEPTH - } -#endif // CONFIG_HIGHBITDEPTH - } - } - } else { // block_width > block_height - assert(block_width == (block_height << 1)); - // Predict the left square sub-block - predict_intra_block_helper(xd, wpx, hpx, tx_size, mode, ref, ref_stride, - dst, dst_stride, col_off, row_off, plane); -#if CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX) - if (block_width == tx_size_wide[tx_size] && - block_height == tx_size_high[tx_size]) { // Most common case. - return; // We are done. - } else { - // Can only happen for large rectangular block sizes as such large - // transform sizes aren't available. -#if CONFIG_EXT_PARTITION - assert(bsize == BLOCK_64X32 || bsize == BLOCK_128X64); -#else - assert(bsize == BLOCK_64X32); -#endif // CONFIG_EXT_PARTITION -#if CONFIG_TX64X64 - assert(tx_size == TX_32X32 || tx_size == TX64X64); + } #else - assert(tx_size == TX_32X32); -#endif // CONFIG_TX64X64 - // In this case, we continue to the right square sub-block. - } -#endif // CONFIG_RECT_INTRA_PRED && CONFIG_RECT_TX && (CONFIG_VAR_TX || - // CONFIG_EXT_TX) - { - int i; - const int half_block_width = block_width >> 1; - const int half_block_width_unit = - half_block_width >> tx_size_wide_log2[0]; - // Cast away const to modify 'ref' temporarily; will be restored later. - uint8_t *src_2 = (uint8_t *)ref + half_block_width; - uint8_t *dst_2 = dst + half_block_width; - const int col_off_2 = col_off + half_block_width_unit; - // Save the last column of left square sub-block as 'left' column for - // right square sub-block. - const int save_src = src_2 != dst_2 || ref_stride != dst_stride; - if (save_src) { -#if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - uint16_t *src_2_16 = CONVERT_TO_SHORTPTR(src_2); - uint16_t *dst_2_16 = CONVERT_TO_SHORTPTR(dst_2); - for (i = 0; i < block_height; ++i) { - tmp16[i] = src_2_16[i * ref_stride - 1]; - src_2_16[i * ref_stride - 1] = dst_2_16[i * dst_stride - 1]; - } - } else { + (void)buf_flags; #endif // CONFIG_HIGHBITDEPTH - for (i = 0; i < block_height; ++i) { - tmp[i] = src_2[i * ref_stride - 1]; - src_2[i * ref_stride - 1] = dst_2[i * dst_stride - 1]; - } + return 1; +} + +static void restore_ref_col(int buf_flags, int block_height, + const uint8_t *tmp_row, uint8_t *ref_row, + int ref_stride) { #if CONFIG_HIGHBITDEPTH - } + if (buf_flags & YV12_FLAG_HIGHBITDEPTH) { + const uint16_t *tmp_16 = (const uint16_t *)tmp_row; + uint16_t *ref_16 = CONVERT_TO_SHORTPTR(ref_row); + + for (int i = 0; i < block_height; ++i) { + ref_16[i * ref_stride] = tmp_16[i]; + } + } else { #endif // CONFIG_HIGHBITDEPTH - } - // Predict the right square sub-block. - predict_intra_block_helper(xd, wpx, hpx, tx_size, mode, src_2, - ref_stride, dst_2, dst_stride, col_off_2, - row_off, plane); - // Restore the last column of left square sub-block. - if (save_src) { + for (int i = 0; i < block_height; ++i) { + ref_row[i * ref_stride] = tmp_row[i]; + } #if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - uint16_t *src_2_16 = CONVERT_TO_SHORTPTR(src_2); - for (i = 0; i < block_height; ++i) { - src_2_16[i * ref_stride - 1] = tmp16[i]; - } - } else { + } +#else + (void)buf_flags; #endif // CONFIG_HIGHBITDEPTH - for (i = 0; i < block_height; ++i) { - src_2[i * ref_stride - 1] = tmp[i]; - } +} +#endif // #if INTRA_USES_EXT_TRANSFORMS + +void av1_predict_intra_block(const AV1_COMMON *cm, const MACROBLOCKD *xd, + int wpx, int hpx, BLOCK_SIZE bsize, + PREDICTION_MODE mode, const uint8_t *ref, + int ref_stride, uint8_t *dst, int dst_stride, + int col_off, int row_off, int plane) { + const int block_width = block_size_wide[bsize]; + const int block_height = block_size_high[bsize]; +#if INTRA_USES_RECT_TRANSFORMS + const TX_SIZE tx_size = max_txsize_rect_lookup[bsize]; + assert(tx_size < TX_SIZES_ALL); +#else + const TX_SIZE tx_size = max_txsize_lookup[bsize]; + assert(tx_size < TX_SIZES); +#endif // INTRA_USES_RECT_TRANSFORMS + + // Start by running the helper to predict either the entire block + // (if the block is square or the same size as tx_size) or the top + // or left of the block if it's tall and thin or short and wide. + predict_intra_block_helper(cm, xd, wpx, hpx, tx_size, mode, ref, ref_stride, + dst, dst_stride, col_off, row_off, plane); + +// If we're not using extended transforms, this function should +// always be called with a square block. +#if !INTRA_USES_EXT_TRANSFORMS + assert(block_width == block_height); +#endif // !INTRA_USES_EXT_TRANSFORMS + + // If the block is square, we're done. + if (block_width == block_height) return; + +#if INTRA_USES_EXT_TRANSFORMS +// If we're using rectangular transforms, we might be done even +// though the block isn't square. +#if INTRA_USES_RECT_TRANSFORMS + if (block_width == tx_size_wide[tx_size] && + block_height == tx_size_high[tx_size]) + return; + + // A block should only fail to have a matching transform if it's + // large and rectangular (such large transform sizes aren't + // available). + assert(block_width >= 32 && block_height >= 32); +#endif // INTRA_USES_RECT_TRANSFORMS + + assert((block_width == wpx && block_height == hpx) || + (block_width == (wpx >> 1) && block_height == hpx) || + (block_width == wpx && block_height == (hpx >> 1))); + +// The tmp buffer needs to be big enough to hold MAX_SB_SIZE samples +// from the image. If CONFIG_HIGHBITDEPTH is enabled, it also needs +// to be big enough and correctly aligned to hold 16-bit entries. #if CONFIG_HIGHBITDEPTH - } + uint16_t tmp_buf[MAX_SB_SIZE]; +#else + uint8_t tmp_buf[MAX_SB_SIZE]; #endif // CONFIG_HIGHBITDEPTH - } - } + uint8_t *tmp = (uint8_t *)tmp_buf; + + if (block_width < block_height) { + // The block is tall and thin. We've already done the top part, + // and need to repeat the prediction down the rest of the block. + + const int tx_height = tx_size_high[tx_size]; + const int tx_height_off = tx_height >> tx_size_wide_log2[0]; + assert(tx_height_off << tx_size_wide_log2[0] == tx_height); + + int next_row_off = row_off + tx_height_off; + int next_row_idx = tx_height; + + while (next_row_idx < block_height) { + const int last_row_idx = next_row_idx - 1; + + // Cast away the const to make a mutable pointer to the last + // row of ref. This will be snapshotted and restored later. + uint8_t *last_ref_row = (uint8_t *)ref + last_row_idx * ref_stride; + uint8_t *last_dst_row = dst + last_row_idx * dst_stride; + + const int needs_restore = + overwrite_ref_row(ref_stride == dst_stride, xd->cur_buf->flags, + block_width, last_dst_row, last_ref_row, tmp); + + const uint8_t *next_ref_row = ref + next_row_idx * ref_stride; + uint8_t *next_dst_row = dst + next_row_idx * dst_stride; + + predict_intra_block_helper(cm, xd, wpx, hpx, tx_size, mode, next_ref_row, + ref_stride, next_dst_row, dst_stride, col_off, + next_row_off, plane); + + if (needs_restore) + restore_ref_row(xd->cur_buf->flags, block_width, tmp, last_ref_row); + + next_row_idx += tx_height; + next_row_off += tx_height_off; + } + } else { + // The block is short and wide. We've already done the left part, + // and need to repeat the prediction to the right. + + const int tx_width = tx_size_wide[tx_size]; + const int tx_width_off = tx_width >> tx_size_wide_log2[0]; + assert(tx_width_off << tx_size_wide_log2[0] == tx_width); + + int next_col_off = col_off + tx_width_off; + int next_col_idx = tx_width; + + while (next_col_idx < block_width) { + const int last_col_idx = next_col_idx - 1; + + // Cast away the const to make a mutable pointer to ref, + // starting at the last column written. This will be + // snapshotted and restored later. + uint8_t *last_ref_col = (uint8_t *)ref + last_col_idx; + uint8_t *last_dst_col = dst + last_col_idx; + + const int needs_restore = + overwrite_ref_col(xd->cur_buf->flags, block_height, last_dst_col, + dst_stride, last_ref_col, ref_stride, tmp); + + const uint8_t *next_ref_col = ref + next_col_idx; + uint8_t *next_dst_col = dst + next_col_idx; + + predict_intra_block_helper(cm, xd, wpx, hpx, tx_size, mode, next_ref_col, + ref_stride, next_dst_col, dst_stride, + next_col_off, row_off, plane); + + if (needs_restore) + restore_ref_col(xd->cur_buf->flags, block_height, tmp, last_ref_col, + ref_stride); + + next_col_idx += tx_width; + next_col_off += tx_width_off; } -#else - assert(0); -#endif // (CONFIG_RECT_TX && (CONFIG_VAR_TX || CONFIG_EXT_TX)) || - // (CONFIG_EXT_INTER) } +#endif // INTRA_USES_EXT_TRANSFORMS } void av1_init_intra_predictors(void) { diff --git a/third_party/aom/av1/common/reconintra.h b/third_party/aom/av1/common/reconintra.h index 67e5706d6..42797e310 100644 --- a/third_party/aom/av1/common/reconintra.h +++ b/third_party/aom/av1/common/reconintra.h @@ -14,60 +14,34 @@ #include "aom/aom_integer.h" #include "av1/common/blockd.h" +#include "av1/common/onyxc_int.h" #ifdef __cplusplus extern "C" { #endif -#if CONFIG_DPCM_INTRA -static INLINE int av1_use_dpcm_intra(int plane, PREDICTION_MODE mode, - TX_TYPE tx_type, - const MB_MODE_INFO *const mbmi) { - (void)mbmi; - (void)plane; -#if CONFIG_EXT_INTRA - if (mbmi->sb_type >= BLOCK_8X8 && mbmi->angle_delta[plane != 0]) return 0; -#endif // CONFIG_EXT_INTRA - return (mode == V_PRED && (tx_type == IDTX || tx_type == H_DCT)) || - (mode == H_PRED && (tx_type == IDTX || tx_type == V_DCT)); -} -#endif // CONFIG_DPCM_INTRA - void av1_init_intra_predictors(void); -void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx, - int blk_col, int blk_row, TX_SIZE tx_size); -void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh, - BLOCK_SIZE bsize, PREDICTION_MODE mode, - const uint8_t *ref, int ref_stride, uint8_t *dst, - int dst_stride, int aoff, int loff, int plane); +void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd, + int plane, int block_idx, int blk_col, + int blk_row, TX_SIZE tx_size); +void av1_predict_intra_block(const AV1_COMMON *cm, const MACROBLOCKD *xd, + int bw, int bh, BLOCK_SIZE bsize, + PREDICTION_MODE mode, const uint8_t *ref, + int ref_stride, uint8_t *dst, int dst_stride, + int aoff, int loff, int plane); -#if CONFIG_EXT_INTER && CONFIG_INTERINTRA +#if CONFIG_INTERINTRA // Mapping of interintra to intra mode for use in the intra component static const PREDICTION_MODE interintra_to_intra_mode[INTERINTRA_MODES] = { - DC_PRED, V_PRED, H_PRED, -#if CONFIG_ALT_INTRA - SMOOTH_PRED -#else - TM_PRED -#endif + DC_PRED, V_PRED, H_PRED, SMOOTH_PRED }; // Mapping of intra mode to the interintra mode static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = { - II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED, -#if CONFIG_ALT_INTRA - II_SMOOTH_PRED, -#else - II_TM_PRED, -#endif - II_V_PRED, II_H_PRED, II_H_PRED, II_V_PRED, -#if CONFIG_ALT_INTRA - II_SMOOTH_PRED, II_SMOOTH_PRED -#else - II_TM_PRED -#endif + II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED, II_SMOOTH_PRED, II_V_PRED, + II_H_PRED, II_H_PRED, II_V_PRED, II_SMOOTH_PRED, II_SMOOTH_PRED }; -#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA +#endif // CONFIG_INTERINTRA #if CONFIG_FILTER_INTRA #define FILTER_INTRA_PREC_BITS 10 @@ -97,6 +71,14 @@ static INLINE int av1_use_angle_delta(BLOCK_SIZE bsize) { } #endif // CONFIG_EXT_INTRA +#if CONFIG_INTRABC +static INLINE int av1_allow_intrabc(BLOCK_SIZE bsize, + const AV1_COMMON *const cm) { + return (bsize >= BLOCK_8X8 || bsize == BLOCK_4X4) && + cm->allow_screen_content_tools; +} +#endif // CONFIG_INTRABC + #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/resize.c b/third_party/aom/av1/common/resize.c index 8ddca0acb..b0f303e35 100644 --- a/third_party/aom/av1/common/resize.c +++ b/third_party/aom/av1/common/resize.c @@ -32,7 +32,7 @@ #define INTERP_TAPS 8 #define SUBPEL_BITS_RS 6 #define SUBPEL_MASK_RS ((1 << SUBPEL_BITS_RS) - 1) -#define INTERP_PRECISION_BITS 32 +#define INTERP_PRECISION_BITS 16 #define SUBPEL_INTERP_EXTRA_BITS (INTERP_PRECISION_BITS - SUBPEL_BITS_RS) #define SUBPEL_INTERP_EXTRA_OFF (1 << (SUBPEL_INTERP_EXTRA_BITS - 1)) @@ -40,24 +40,6 @@ typedef int16_t interp_kernel[INTERP_TAPS]; // Filters for interpolation (0.5-band) - note this also filters integer pels. static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS_RS)] = { -#if SUBPEL_BITS_RS == 5 - { -3, 0, 35, 64, 35, 0, -3, 0 }, { -3, -1, 34, 64, 36, 1, -3, 0 }, - { -3, -1, 32, 64, 38, 1, -3, 0 }, { -2, -2, 31, 63, 39, 2, -3, 0 }, - { -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 28, 63, 42, 3, -4, 0 }, - { -2, -3, 27, 63, 43, 4, -4, 0 }, { -2, -3, 25, 62, 45, 5, -4, 0 }, - { -2, -3, 24, 62, 46, 5, -4, 0 }, { -2, -3, 23, 61, 47, 6, -4, 0 }, - { -2, -3, 21, 60, 49, 7, -4, 0 }, { -1, -4, 20, 60, 50, 8, -4, -1 }, - { -1, -4, 19, 59, 51, 9, -4, -1 }, { -1, -4, 17, 58, 52, 10, -4, 0 }, - { -1, -4, 16, 57, 53, 12, -4, -1 }, { -1, -4, 15, 56, 54, 13, -4, -1 }, - { -1, -4, 14, 55, 55, 14, -4, -1 }, { -1, -4, 13, 54, 56, 15, -4, -1 }, - { -1, -4, 12, 53, 57, 16, -4, -1 }, { 0, -4, 10, 52, 58, 17, -4, -1 }, - { -1, -4, 9, 51, 59, 19, -4, -1 }, { -1, -4, 8, 50, 60, 20, -4, -1 }, - { 0, -4, 7, 49, 60, 21, -3, -2 }, { 0, -4, 6, 47, 61, 23, -3, -2 }, - { 0, -4, 5, 46, 62, 24, -3, -2 }, { 0, -4, 5, 45, 62, 25, -3, -2 }, - { 0, -4, 4, 43, 63, 27, -3, -2 }, { 0, -4, 3, 42, 63, 28, -2, -2 }, - { 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 2, 39, 63, 31, -2, -2 }, - { 0, -3, 1, 38, 64, 32, -1, -3 }, { 0, -3, 1, 36, 64, 34, -1, -3 }, -#elif SUBPEL_BITS_RS == 6 { -3, 0, 35, 64, 35, 0, -3, 0 }, { -3, 0, 34, 64, 36, 0, -3, 0 }, { -3, -1, 34, 64, 36, 1, -3, 0 }, { -3, -1, 33, 64, 37, 1, -3, 0 }, { -3, -1, 32, 64, 38, 1, -3, 0 }, { -3, -1, 31, 64, 39, 1, -3, 0 }, @@ -90,29 +72,10 @@ static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS_RS)] = { { 0, -3, 2, 39, 63, 31, -1, -3 }, { 0, -3, 1, 39, 64, 31, -1, -3 }, { 0, -3, 1, 38, 64, 32, -1, -3 }, { 0, -3, 1, 37, 64, 33, -1, -3 }, { 0, -3, 1, 36, 64, 34, -1, -3 }, { 0, -3, 0, 36, 64, 34, 0, -3 }, -#endif // SUBPEL_BITS_RS == 5 }; // Filters for interpolation (0.625-band) - note this also filters integer pels. static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS_RS)] = { -#if SUBPEL_BITS_RS == 5 - { -1, -8, 33, 80, 33, -8, -1, 0 }, { -1, -8, 30, 80, 35, -8, -1, 1 }, - { -1, -8, 28, 80, 37, -7, -2, 1 }, { 0, -8, 26, 79, 39, -7, -2, 1 }, - { 0, -8, 24, 79, 41, -7, -2, 1 }, { 0, -8, 22, 78, 43, -6, -2, 1 }, - { 0, -8, 20, 78, 45, -5, -3, 1 }, { 0, -8, 18, 77, 48, -5, -3, 1 }, - { 0, -8, 16, 76, 50, -4, -3, 1 }, { 0, -8, 15, 75, 52, -3, -4, 1 }, - { 0, -7, 13, 74, 54, -3, -4, 1 }, { 0, -7, 11, 73, 56, -2, -4, 1 }, - { 0, -7, 10, 71, 58, -1, -4, 1 }, { 1, -7, 8, 70, 60, 0, -5, 1 }, - { 1, -6, 6, 68, 62, 1, -5, 1 }, { 1, -6, 5, 67, 63, 2, -5, 1 }, - { 1, -6, 4, 65, 65, 4, -6, 1 }, { 1, -5, 2, 63, 67, 5, -6, 1 }, - { 1, -5, 1, 62, 68, 6, -6, 1 }, { 1, -5, 0, 60, 70, 8, -7, 1 }, - { 1, -4, -1, 58, 71, 10, -7, 0 }, { 1, -4, -2, 56, 73, 11, -7, 0 }, - { 1, -4, -3, 54, 74, 13, -7, 0 }, { 1, -4, -3, 52, 75, 15, -8, 0 }, - { 1, -3, -4, 50, 76, 16, -8, 0 }, { 1, -3, -5, 48, 77, 18, -8, 0 }, - { 1, -3, -5, 45, 78, 20, -8, 0 }, { 1, -2, -6, 43, 78, 22, -8, 0 }, - { 1, -2, -7, 41, 79, 24, -8, 0 }, { 1, -2, -7, 39, 79, 26, -8, 0 }, - { 1, -2, -7, 37, 80, 28, -8, -1 }, { 1, -1, -8, 35, 80, 30, -8, -1 }, -#elif SUBPEL_BITS_RS == 6 { -1, -8, 33, 80, 33, -8, -1, 0 }, { -1, -8, 31, 80, 34, -8, -1, 1 }, { -1, -8, 30, 80, 35, -8, -1, 1 }, { -1, -8, 29, 80, 36, -7, -2, 1 }, { -1, -8, 28, 80, 37, -7, -2, 1 }, { -1, -8, 27, 80, 38, -7, -2, 1 }, @@ -145,29 +108,10 @@ static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS_RS)] = { { 1, -2, -7, 39, 79, 26, -8, 0 }, { 1, -2, -7, 38, 80, 27, -8, -1 }, { 1, -2, -7, 37, 80, 28, -8, -1 }, { 1, -2, -7, 36, 80, 29, -8, -1 }, { 1, -1, -8, 35, 80, 30, -8, -1 }, { 1, -1, -8, 34, 80, 31, -8, -1 }, -#endif // SUBPEL_BITS_RS == 5 }; // Filters for interpolation (0.75-band) - note this also filters integer pels. static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS_RS)] = { -#if SUBPEL_BITS_RS == 5 - { 2, -11, 25, 96, 25, -11, 2, 0 }, { 2, -11, 22, 96, 28, -11, 2, 0 }, - { 2, -10, 19, 95, 31, -11, 2, 0 }, { 2, -10, 17, 95, 34, -12, 2, 0 }, - { 2, -9, 14, 94, 37, -12, 2, 0 }, { 2, -8, 12, 93, 40, -12, 1, 0 }, - { 2, -8, 9, 92, 43, -12, 1, 1 }, { 2, -7, 7, 91, 46, -12, 1, 0 }, - { 2, -7, 5, 90, 49, -12, 1, 0 }, { 2, -6, 3, 88, 52, -12, 0, 1 }, - { 2, -5, 1, 86, 55, -12, 0, 1 }, { 2, -5, -1, 84, 58, -11, 0, 1 }, - { 2, -4, -2, 82, 61, -11, -1, 1 }, { 2, -4, -4, 80, 64, -10, -1, 1 }, - { 1, -3, -5, 77, 67, -9, -1, 1 }, { 1, -3, -6, 75, 70, -8, -2, 1 }, - { 1, -2, -7, 72, 72, -7, -2, 1 }, { 1, -2, -8, 70, 75, -6, -3, 1 }, - { 1, -1, -9, 67, 77, -5, -3, 1 }, { 1, -1, -10, 64, 80, -4, -4, 2 }, - { 1, -1, -11, 61, 82, -2, -4, 2 }, { 1, 0, -11, 58, 84, -1, -5, 2 }, - { 1, 0, -12, 55, 86, 1, -5, 2 }, { 1, 0, -12, 52, 88, 3, -6, 2 }, - { 0, 1, -12, 49, 90, 5, -7, 2 }, { 0, 1, -12, 46, 91, 7, -7, 2 }, - { 1, 1, -12, 43, 92, 9, -8, 2 }, { 0, 1, -12, 40, 93, 12, -8, 2 }, - { 0, 2, -12, 37, 94, 14, -9, 2 }, { 0, 2, -12, 34, 95, 17, -10, 2 }, - { 0, 2, -11, 31, 95, 19, -10, 2 }, { 0, 2, -11, 28, 96, 22, -11, 2 }, -#elif SUBPEL_BITS_RS == 6 { 2, -11, 25, 96, 25, -11, 2, 0 }, { 2, -11, 24, 96, 26, -11, 2, 0 }, { 2, -11, 22, 96, 28, -11, 2, 0 }, { 2, -10, 21, 96, 29, -12, 2, 0 }, { 2, -10, 19, 96, 31, -12, 2, 0 }, { 2, -10, 18, 95, 32, -11, 2, 0 }, @@ -200,29 +144,10 @@ static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS_RS)] = { { 0, 2, -12, 34, 95, 17, -10, 2 }, { 0, 2, -11, 32, 95, 18, -10, 2 }, { 0, 2, -12, 31, 96, 19, -10, 2 }, { 0, 2, -12, 29, 96, 21, -10, 2 }, { 0, 2, -11, 28, 96, 22, -11, 2 }, { 0, 2, -11, 26, 96, 24, -11, 2 }, -#endif // SUBPEL_BITS_RS == 5 }; // Filters for interpolation (0.875-band) - note this also filters integer pels. static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS_RS)] = { -#if SUBPEL_BITS_RS == 5 - { 3, -8, 13, 112, 13, -8, 3, 0 }, { 3, -7, 10, 112, 17, -9, 3, -1 }, - { 2, -6, 7, 111, 21, -9, 3, -1 }, { 2, -5, 4, 111, 24, -10, 3, -1 }, - { 2, -4, 1, 110, 28, -11, 3, -1 }, { 1, -3, -1, 108, 32, -12, 4, -1 }, - { 1, -2, -3, 106, 36, -13, 4, -1 }, { 1, -1, -6, 105, 40, -14, 4, -1 }, - { 1, -1, -7, 102, 44, -14, 4, -1 }, { 1, 0, -9, 100, 48, -15, 4, -1 }, - { 1, 1, -11, 97, 53, -16, 4, -1 }, { 0, 1, -12, 95, 57, -16, 4, -1 }, - { 0, 2, -13, 91, 61, -16, 4, -1 }, { 0, 2, -14, 88, 65, -16, 4, -1 }, - { 0, 3, -15, 84, 69, -17, 4, 0 }, { 0, 3, -16, 81, 73, -16, 3, 0 }, - { 0, 3, -16, 77, 77, -16, 3, 0 }, { 0, 3, -16, 73, 81, -16, 3, 0 }, - { 0, 4, -17, 69, 84, -15, 3, 0 }, { -1, 4, -16, 65, 88, -14, 2, 0 }, - { -1, 4, -16, 61, 91, -13, 2, 0 }, { -1, 4, -16, 57, 95, -12, 1, 0 }, - { -1, 4, -16, 53, 97, -11, 1, 1 }, { -1, 4, -15, 48, 100, -9, 0, 1 }, - { -1, 4, -14, 44, 102, -7, -1, 1 }, { -1, 4, -14, 40, 105, -6, -1, 1 }, - { -1, 4, -13, 36, 106, -3, -2, 1 }, { -1, 4, -12, 32, 108, -1, -3, 1 }, - { -1, 3, -11, 28, 110, 1, -4, 2 }, { -1, 3, -10, 24, 111, 4, -5, 2 }, - { -1, 3, -9, 21, 111, 7, -6, 2 }, { -1, 3, -9, 17, 112, 10, -7, 3 }, -#elif SUBPEL_BITS_RS == 6 { 3, -8, 13, 112, 13, -8, 3, 0 }, { 2, -7, 12, 112, 15, -8, 3, -1 }, { 3, -7, 10, 112, 17, -9, 3, -1 }, { 2, -6, 8, 112, 19, -9, 3, -1 }, { 2, -6, 7, 112, 21, -10, 3, -1 }, { 2, -5, 6, 111, 22, -10, 3, -1 }, @@ -255,29 +180,10 @@ static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS_RS)] = { { -1, 3, -10, 24, 111, 4, -5, 2 }, { -1, 3, -10, 22, 111, 6, -5, 2 }, { -1, 3, -10, 21, 112, 7, -6, 2 }, { -1, 3, -9, 19, 112, 8, -6, 2 }, { -1, 3, -9, 17, 112, 10, -7, 3 }, { -1, 3, -8, 15, 112, 12, -7, 2 }, -#endif // SUBPEL_BITS_RS == 5 }; // Filters for interpolation (full-band) - no filtering for integer pixels static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS_RS)] = { -#if SUBPEL_BITS_RS == 5 - { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -3, 128, 3, -1, 0, 0 }, - { -1, 2, -6, 127, 7, -2, 1, 0 }, { -1, 3, -9, 126, 12, -4, 1, 0 }, - { -1, 4, -12, 125, 16, -5, 1, 0 }, { -1, 4, -14, 123, 20, -6, 2, 0 }, - { -1, 5, -15, 120, 25, -8, 2, 0 }, { -1, 5, -17, 118, 30, -9, 3, -1 }, - { -1, 6, -18, 114, 35, -10, 3, -1 }, { -1, 6, -19, 111, 41, -12, 3, -1 }, - { -1, 6, -20, 107, 46, -13, 4, -1 }, { -1, 6, -21, 103, 52, -14, 4, -1 }, - { -1, 6, -21, 99, 57, -16, 5, -1 }, { -1, 6, -21, 94, 63, -17, 5, -1 }, - { -1, 6, -20, 89, 68, -18, 5, -1 }, { -1, 6, -20, 84, 73, -19, 6, -1 }, - { -1, 6, -20, 79, 79, -20, 6, -1 }, { -1, 6, -19, 73, 84, -20, 6, -1 }, - { -1, 5, -18, 68, 89, -20, 6, -1 }, { -1, 5, -17, 63, 94, -21, 6, -1 }, - { -1, 5, -16, 57, 99, -21, 6, -1 }, { -1, 4, -14, 52, 103, -21, 6, -1 }, - { -1, 4, -13, 46, 107, -20, 6, -1 }, { -1, 3, -12, 41, 111, -19, 6, -1 }, - { -1, 3, -10, 35, 114, -18, 6, -1 }, { -1, 3, -9, 30, 118, -17, 5, -1 }, - { 0, 2, -8, 25, 120, -15, 5, -1 }, { 0, 2, -6, 20, 123, -14, 4, -1 }, - { 0, 1, -5, 16, 125, -12, 4, -1 }, { 0, 1, -4, 12, 126, -9, 3, -1 }, - { 0, 1, -2, 7, 127, -6, 2, -1 }, { 0, 0, -1, 3, 128, -3, 1, 0 }, -#elif SUBPEL_BITS_RS == 6 { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, -1, 128, 2, -1, 0, 0 }, { 0, 1, -3, 127, 4, -2, 1, 0 }, { 0, 1, -4, 127, 6, -3, 1, 0 }, { 0, 2, -6, 126, 8, -3, 1, 0 }, { 0, 2, -7, 125, 11, -4, 1, 0 }, @@ -310,9 +216,86 @@ static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS_RS)] = { { 0, 2, -5, 13, 125, -8, 2, -1 }, { 0, 1, -4, 11, 125, -7, 2, 0 }, { 0, 1, -3, 8, 126, -6, 2, 0 }, { 0, 1, -3, 6, 127, -4, 1, 0 }, { 0, 1, -2, 4, 127, -3, 1, 0 }, { 0, 0, -1, 2, 128, -1, 0, 0 }, -#endif // SUBPEL_BITS_RS == 5 }; +#if CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION +#define INTERP_SIMPLE_TAPS 4 +static const int16_t filter_simple[(1 + << SUBPEL_BITS_RS)][INTERP_SIMPLE_TAPS] = { +#if INTERP_SIMPLE_TAPS == 2 + { 128, 0 }, { 126, 2 }, { 124, 4 }, { 122, 6 }, { 120, 8 }, { 118, 10 }, + { 116, 12 }, { 114, 14 }, { 112, 16 }, { 110, 18 }, { 108, 20 }, { 106, 22 }, + { 104, 24 }, { 102, 26 }, { 100, 28 }, { 98, 30 }, { 96, 32 }, { 94, 34 }, + { 92, 36 }, { 90, 38 }, { 88, 40 }, { 86, 42 }, { 84, 44 }, { 82, 46 }, + { 80, 48 }, { 78, 50 }, { 76, 52 }, { 74, 54 }, { 72, 56 }, { 70, 58 }, + { 68, 60 }, { 66, 62 }, { 64, 64 }, { 62, 66 }, { 60, 68 }, { 58, 70 }, + { 56, 72 }, { 54, 74 }, { 52, 76 }, { 50, 78 }, { 48, 80 }, { 46, 82 }, + { 44, 84 }, { 42, 86 }, { 40, 88 }, { 38, 90 }, { 36, 92 }, { 34, 94 }, + { 32, 96 }, { 30, 98 }, { 28, 100 }, { 26, 102 }, { 24, 104 }, { 22, 106 }, + { 20, 108 }, { 18, 110 }, { 16, 112 }, { 14, 114 }, { 12, 116 }, { 10, 118 }, + { 8, 120 }, { 6, 122 }, { 4, 124 }, { 2, 126 }, +#elif INTERP_SIMPLE_TAPS == 4 + { 0, 128, 0, 0 }, { -1, 128, 2, -1 }, { -2, 127, 4, -1 }, + { -3, 126, 7, -2 }, { -4, 125, 9, -2 }, { -5, 125, 11, -3 }, + { -6, 124, 13, -3 }, { -7, 123, 16, -4 }, { -7, 122, 18, -5 }, + { -8, 121, 20, -5 }, { -9, 120, 23, -6 }, { -9, 118, 25, -6 }, + { -10, 117, 28, -7 }, { -11, 116, 30, -7 }, { -11, 114, 33, -8 }, + { -12, 113, 35, -8 }, { -12, 111, 38, -9 }, { -13, 109, 41, -9 }, + { -13, 108, 43, -10 }, { -13, 106, 45, -10 }, { -13, 104, 48, -11 }, + { -14, 102, 51, -11 }, { -14, 100, 53, -11 }, { -14, 98, 56, -12 }, + { -14, 96, 58, -12 }, { -14, 94, 61, -13 }, { -15, 92, 64, -13 }, + { -15, 90, 66, -13 }, { -15, 87, 69, -13 }, { -14, 85, 71, -14 }, + { -14, 83, 73, -14 }, { -14, 80, 76, -14 }, { -14, 78, 78, -14 }, + { -14, 76, 80, -14 }, { -14, 73, 83, -14 }, { -14, 71, 85, -14 }, + { -13, 69, 87, -15 }, { -13, 66, 90, -15 }, { -13, 64, 92, -15 }, + { -13, 61, 94, -14 }, { -12, 58, 96, -14 }, { -12, 56, 98, -14 }, + { -11, 53, 100, -14 }, { -11, 51, 102, -14 }, { -11, 48, 104, -13 }, + { -10, 45, 106, -13 }, { -10, 43, 108, -13 }, { -9, 41, 109, -13 }, + { -9, 38, 111, -12 }, { -8, 35, 113, -12 }, { -8, 33, 114, -11 }, + { -7, 30, 116, -11 }, { -7, 28, 117, -10 }, { -6, 25, 118, -9 }, + { -6, 23, 120, -9 }, { -5, 20, 121, -8 }, { -5, 18, 122, -7 }, + { -4, 16, 123, -7 }, { -3, 13, 124, -6 }, { -3, 11, 125, -5 }, + { -2, 9, 125, -4 }, { -2, 7, 126, -3 }, { -1, 4, 127, -2 }, + { -1, 2, 128, -1 }, +#elif INTERP_SIMPLE_TAPS == 6 + { 0, 0, 128, 0, 0, 0 }, { 0, -1, 128, 2, -1, 0 }, + { 1, -3, 127, 4, -2, 1 }, { 1, -4, 127, 6, -3, 1 }, + { 2, -6, 126, 8, -3, 1 }, { 2, -7, 125, 11, -4, 1 }, + { 2, -9, 125, 13, -5, 2 }, { 3, -10, 124, 15, -6, 2 }, + { 3, -11, 123, 18, -7, 2 }, { 3, -12, 122, 20, -8, 3 }, + { 4, -13, 121, 22, -9, 3 }, { 4, -14, 119, 25, -9, 3 }, + { 4, -15, 118, 27, -10, 4 }, { 4, -16, 117, 30, -11, 4 }, + { 5, -17, 116, 32, -12, 4 }, { 5, -17, 114, 35, -13, 4 }, + { 5, -18, 112, 37, -13, 5 }, { 5, -19, 111, 40, -14, 5 }, + { 6, -19, 109, 42, -15, 5 }, { 6, -20, 107, 45, -15, 5 }, + { 6, -20, 105, 48, -16, 5 }, { 6, -21, 103, 51, -17, 6 }, + { 6, -21, 101, 53, -17, 6 }, { 6, -21, 99, 56, -18, 6 }, + { 7, -22, 97, 58, -18, 6 }, { 7, -22, 95, 61, -19, 6 }, + { 7, -22, 93, 63, -19, 6 }, { 7, -22, 91, 66, -20, 6 }, + { 7, -22, 88, 69, -20, 6 }, { 7, -22, 86, 71, -21, 7 }, + { 7, -22, 83, 74, -21, 7 }, { 7, -22, 81, 76, -21, 7 }, + { 7, -22, 79, 79, -22, 7 }, { 7, -21, 76, 81, -22, 7 }, + { 7, -21, 74, 83, -22, 7 }, { 7, -21, 71, 86, -22, 7 }, + { 6, -20, 69, 88, -22, 7 }, { 6, -20, 66, 91, -22, 7 }, + { 6, -19, 63, 93, -22, 7 }, { 6, -19, 61, 95, -22, 7 }, + { 6, -18, 58, 97, -22, 7 }, { 6, -18, 56, 99, -21, 6 }, + { 6, -17, 53, 101, -21, 6 }, { 6, -17, 51, 103, -21, 6 }, + { 5, -16, 48, 105, -20, 6 }, { 5, -15, 45, 107, -20, 6 }, + { 5, -15, 42, 109, -19, 6 }, { 5, -14, 40, 111, -19, 5 }, + { 5, -13, 37, 112, -18, 5 }, { 4, -13, 35, 114, -17, 5 }, + { 4, -12, 32, 116, -17, 5 }, { 4, -11, 30, 117, -16, 4 }, + { 4, -10, 27, 118, -15, 4 }, { 3, -9, 25, 119, -14, 4 }, + { 3, -9, 22, 121, -13, 4 }, { 3, -8, 20, 122, -12, 3 }, + { 2, -7, 18, 123, -11, 3 }, { 2, -6, 15, 124, -10, 3 }, + { 2, -5, 13, 125, -9, 2 }, { 1, -4, 11, 125, -7, 2 }, + { 1, -3, 8, 126, -6, 2 }, { 1, -3, 6, 127, -4, 1 }, + { 1, -2, 4, 127, -3, 1 }, { 0, -1, 2, 128, -1, 0 }, +#else +#error "Invalid value of INTERP_SIMPLE_TAPS" +#endif // INTERP_SIMPLE_TAPS == 2 +}; +#endif // CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION + // Filters for factor of 2 downsampling. static const int16_t av1_down2_symeven_half_filter[] = { 56, 12, -3, -1 }; static const int16_t av1_down2_symodd_half_filter[] = { 64, 35, 0, -3 }; @@ -331,33 +314,34 @@ static const interp_kernel *choose_interp_filter(int inlength, int outlength) { return filteredinterp_filters500; } -static void interpolate(const uint8_t *const input, int inlength, - uint8_t *output, int outlength) { - const int64_t delta = - (((uint64_t)inlength << 32) + outlength / 2) / outlength; - const int64_t offset = +static void interpolate_core(const uint8_t *const input, int inlength, + uint8_t *output, int outlength, + const int16_t *interp_filters, int interp_taps) { + const int32_t delta = + (((uint32_t)inlength << INTERP_PRECISION_BITS) + outlength / 2) / + outlength; + const int32_t offset = inlength > outlength - ? (((int64_t)(inlength - outlength) << 31) + outlength / 2) / + ? (((int32_t)(inlength - outlength) << (INTERP_PRECISION_BITS - 1)) + + outlength / 2) / outlength - : -(((int64_t)(outlength - inlength) << 31) + outlength / 2) / + : -(((int32_t)(outlength - inlength) << (INTERP_PRECISION_BITS - 1)) + + outlength / 2) / outlength; uint8_t *optr = output; int x, x1, x2, sum, k, int_pel, sub_pel; - int64_t y; - - const interp_kernel *interp_filters = - choose_interp_filter(inlength, outlength); + int32_t y; x = 0; y = offset + SUBPEL_INTERP_EXTRA_OFF; - while ((y >> INTERP_PRECISION_BITS) < (INTERP_TAPS / 2 - 1)) { + while ((y >> INTERP_PRECISION_BITS) < (interp_taps / 2 - 1)) { x++; y += delta; } x1 = x; x = outlength - 1; y = delta * x + offset + SUBPEL_INTERP_EXTRA_OFF; - while ((y >> INTERP_PRECISION_BITS) + (int64_t)(INTERP_TAPS / 2) >= + while ((y >> INTERP_PRECISION_BITS) + (int32_t)(interp_taps / 2) >= inlength) { x--; y -= delta; @@ -366,13 +350,12 @@ static void interpolate(const uint8_t *const input, int inlength, if (x1 > x2) { for (x = 0, y = offset + SUBPEL_INTERP_EXTRA_OFF; x < outlength; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) { - const int pk = int_pel - INTERP_TAPS / 2 + 1 + k; + for (k = 0; k < interp_taps; ++k) { + const int pk = int_pel - interp_taps / 2 + 1 + k; sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)]; } *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); @@ -380,41 +363,55 @@ static void interpolate(const uint8_t *const input, int inlength, } else { // Initial part. for (x = 0, y = offset + SUBPEL_INTERP_EXTRA_OFF; x < x1; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) - sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)]; + for (k = 0; k < interp_taps; ++k) + sum += filter[k] * input[AOMMAX(int_pel - interp_taps / 2 + 1 + k, 0)]; *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); } // Middle part. for (; x <= x2; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) - sum += filter[k] * input[int_pel - INTERP_TAPS / 2 + 1 + k]; + for (k = 0; k < interp_taps; ++k) + sum += filter[k] * input[int_pel - interp_taps / 2 + 1 + k]; *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); } // End part. for (; x < outlength; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) + for (k = 0; k < interp_taps; ++k) sum += filter[k] * - input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)]; + input[AOMMIN(int_pel - interp_taps / 2 + 1 + k, inlength - 1)]; *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); } } } +static void interpolate(const uint8_t *const input, int inlength, + uint8_t *output, int outlength) { + const interp_kernel *interp_filters = + choose_interp_filter(inlength, outlength); + + interpolate_core(input, inlength, output, outlength, &interp_filters[0][0], + INTERP_TAPS); +} + +#if CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION +static void interpolate_simple(const uint8_t *const input, int inlength, + uint8_t *output, int outlength) { + interpolate_core(input, inlength, output, outlength, &filter_simple[0][0], + INTERP_SIMPLE_TAPS); +} +#endif // CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION + #ifndef __clang_analyzer__ static void down2_symeven(const uint8_t *const input, int length, uint8_t *output) { @@ -596,14 +593,15 @@ static void fill_arr_to_col(uint8_t *img, int stride, int len, uint8_t *arr) { } } -void av1_resize_plane(const uint8_t *const input, int height, int width, - int in_stride, uint8_t *output, int height2, int width2, - int out_stride) { +static void resize_plane(const uint8_t *const input, int height, int width, + int in_stride, uint8_t *output, int height2, + int width2, int out_stride) { int i; - uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height); - uint8_t *tmpbuf = (uint8_t *)malloc(sizeof(uint8_t) * AOMMAX(width, height)); - uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * height); - uint8_t *arrbuf2 = (uint8_t *)malloc(sizeof(uint8_t) * height2); + uint8_t *intbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * width2 * height); + uint8_t *tmpbuf = + (uint8_t *)aom_malloc(sizeof(uint8_t) * AOMMAX(width, height)); + uint8_t *arrbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * height); + uint8_t *arrbuf2 = (uint8_t *)aom_malloc(sizeof(uint8_t) * height2); if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error; assert(width > 0); @@ -620,40 +618,80 @@ void av1_resize_plane(const uint8_t *const input, int height, int width, } Error: - free(intbuf); - free(tmpbuf); - free(arrbuf); - free(arrbuf2); + aom_free(intbuf); + aom_free(tmpbuf); + aom_free(arrbuf); + aom_free(arrbuf2); +} + +#if CONFIG_FRAME_SUPERRES +static void upscale_normative(const uint8_t *const input, int length, + uint8_t *output, int olength) { +#if CONFIG_LOOP_RESTORATION + interpolate_simple(input, length, output, olength); +#else + interpolate(input, length, output, olength); +#endif // CONFIG_LOOP_RESTORATION } +static void upscale_normative_plane(const uint8_t *const input, int height, + int width, int in_stride, uint8_t *output, + int height2, int width2, int out_stride) { + int i; + uint8_t *intbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * width2 * height); + uint8_t *arrbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * height); + uint8_t *arrbuf2 = (uint8_t *)aom_malloc(sizeof(uint8_t) * height2); + if (intbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error; + assert(width > 0); + assert(height > 0); + assert(width2 > 0); + assert(height2 > 0); + for (i = 0; i < height; ++i) + upscale_normative(input + in_stride * i, width, intbuf + width2 * i, + width2); + for (i = 0; i < width2; ++i) { + fill_col_to_arr(intbuf + i, width2, height, arrbuf); + upscale_normative(arrbuf, height, arrbuf2, height2); + fill_arr_to_col(output + i, out_stride, height2, arrbuf2); + } + +Error: + aom_free(intbuf); + aom_free(arrbuf); + aom_free(arrbuf2); +} +#endif // CONFIG_FRAME_SUPERRES + #if CONFIG_HIGHBITDEPTH -static void highbd_interpolate(const uint16_t *const input, int inlength, - uint16_t *output, int outlength, int bd) { - const int64_t delta = - (((uint64_t)inlength << 32) + outlength / 2) / outlength; - const int64_t offset = +static void highbd_interpolate_core(const uint16_t *const input, int inlength, + uint16_t *output, int outlength, int bd, + const int16_t *interp_filters, + int interp_taps) { + const int32_t delta = + (((uint32_t)inlength << INTERP_PRECISION_BITS) + outlength / 2) / + outlength; + const int32_t offset = inlength > outlength - ? (((int64_t)(inlength - outlength) << 31) + outlength / 2) / + ? (((int32_t)(inlength - outlength) << (INTERP_PRECISION_BITS - 1)) + + outlength / 2) / outlength - : -(((int64_t)(outlength - inlength) << 31) + outlength / 2) / + : -(((int32_t)(outlength - inlength) << (INTERP_PRECISION_BITS - 1)) + + outlength / 2) / outlength; uint16_t *optr = output; int x, x1, x2, sum, k, int_pel, sub_pel; - int64_t y; - - const interp_kernel *interp_filters = - choose_interp_filter(inlength, outlength); + int32_t y; x = 0; y = offset + SUBPEL_INTERP_EXTRA_OFF; - while ((y >> INTERP_PRECISION_BITS) < (INTERP_TAPS / 2 - 1)) { + while ((y >> INTERP_PRECISION_BITS) < (interp_taps / 2 - 1)) { x++; y += delta; } x1 = x; x = outlength - 1; y = delta * x + offset + SUBPEL_INTERP_EXTRA_OFF; - while ((y >> INTERP_PRECISION_BITS) + (int64_t)(INTERP_TAPS / 2) >= + while ((y >> INTERP_PRECISION_BITS) + (int32_t)(interp_taps / 2) >= inlength) { x--; y -= delta; @@ -662,13 +700,12 @@ static void highbd_interpolate(const uint16_t *const input, int inlength, if (x1 > x2) { for (x = 0, y = offset + SUBPEL_INTERP_EXTRA_OFF; x < outlength; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) { - const int pk = int_pel - INTERP_TAPS / 2 + 1 + k; + for (k = 0; k < interp_taps; ++k) { + const int pk = int_pel - interp_taps / 2 + 1 + k; sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)]; } *optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); @@ -676,41 +713,55 @@ static void highbd_interpolate(const uint16_t *const input, int inlength, } else { // Initial part. for (x = 0, y = offset + SUBPEL_INTERP_EXTRA_OFF; x < x1; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) - sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)]; + for (k = 0; k < interp_taps; ++k) + sum += filter[k] * input[AOMMAX(int_pel - interp_taps / 2 + 1 + k, 0)]; *optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); } // Middle part. for (; x <= x2; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) - sum += filter[k] * input[int_pel - INTERP_TAPS / 2 + 1 + k]; + for (k = 0; k < interp_taps; ++k) + sum += filter[k] * input[int_pel - interp_taps / 2 + 1 + k]; *optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); } // End part. for (; x < outlength; ++x, y += delta) { - const int16_t *filter; int_pel = y >> INTERP_PRECISION_BITS; sub_pel = (y >> SUBPEL_INTERP_EXTRA_BITS) & SUBPEL_MASK_RS; - filter = interp_filters[sub_pel]; + const int16_t *filter = &interp_filters[sub_pel * interp_taps]; sum = 0; - for (k = 0; k < INTERP_TAPS; ++k) + for (k = 0; k < interp_taps; ++k) sum += filter[k] * - input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)]; + input[AOMMIN(int_pel - interp_taps / 2 + 1 + k, inlength - 1)]; *optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); } } } +static void highbd_interpolate(const uint16_t *const input, int inlength, + uint16_t *output, int outlength, int bd) { + const interp_kernel *interp_filters = + choose_interp_filter(inlength, outlength); + + highbd_interpolate_core(input, inlength, output, outlength, bd, + &interp_filters[0][0], INTERP_TAPS); +} + +#if CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION +static void highbd_interpolate_simple(const uint16_t *const input, int inlength, + uint16_t *output, int outlength, int bd) { + highbd_interpolate_core(input, inlength, output, outlength, bd, + &filter_simple[0][0], INTERP_SIMPLE_TAPS); +} +#endif // CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION + #ifndef __clang_analyzer__ static void highbd_down2_symeven(const uint16_t *const input, int length, uint16_t *output, int bd) { @@ -877,15 +928,16 @@ static void highbd_fill_arr_to_col(uint16_t *img, int stride, int len, } } -void av1_highbd_resize_plane(const uint8_t *const input, int height, int width, - int in_stride, uint8_t *output, int height2, - int width2, int out_stride, int bd) { +static void highbd_resize_plane(const uint8_t *const input, int height, + int width, int in_stride, uint8_t *output, + int height2, int width2, int out_stride, + int bd) { int i; - uint16_t *intbuf = (uint16_t *)malloc(sizeof(uint16_t) * width2 * height); + uint16_t *intbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * width2 * height); uint16_t *tmpbuf = - (uint16_t *)malloc(sizeof(uint16_t) * AOMMAX(width, height)); - uint16_t *arrbuf = (uint16_t *)malloc(sizeof(uint16_t) * height); - uint16_t *arrbuf2 = (uint16_t *)malloc(sizeof(uint16_t) * height2); + (uint16_t *)aom_malloc(sizeof(uint16_t) * AOMMAX(width, height)); + uint16_t *arrbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * height); + uint16_t *arrbuf2 = (uint16_t *)aom_malloc(sizeof(uint16_t) * height2); if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error; for (i = 0; i < height; ++i) { @@ -900,11 +952,49 @@ void av1_highbd_resize_plane(const uint8_t *const input, int height, int width, } Error: - free(intbuf); - free(tmpbuf); - free(arrbuf); - free(arrbuf2); + aom_free(intbuf); + aom_free(tmpbuf); + aom_free(arrbuf); + aom_free(arrbuf2); } + +#if CONFIG_FRAME_SUPERRES +static void highbd_upscale_normative(const uint16_t *const input, int length, + uint16_t *output, int olength, int bd) { +#if CONFIG_LOOP_RESTORATION + highbd_interpolate_simple(input, length, output, olength, bd); +#else + highbd_interpolate(input, length, output, olength, bd); +#endif // CONFIG_LOOP_RESTORATION +} + +static void highbd_upscale_normative_plane(const uint8_t *const input, + int height, int width, int in_stride, + uint8_t *output, int height2, + int width2, int out_stride, int bd) { + int i; + uint16_t *intbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * width2 * height); + uint16_t *arrbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * height); + uint16_t *arrbuf2 = (uint16_t *)aom_malloc(sizeof(uint16_t) * height2); + if (intbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error; + for (i = 0; i < height; ++i) { + highbd_upscale_normative(CONVERT_TO_SHORTPTR(input + in_stride * i), width, + intbuf + width2 * i, width2, bd); + } + for (i = 0; i < width2; ++i) { + highbd_fill_col_to_arr(intbuf + i, width2, height, arrbuf); + highbd_upscale_normative(arrbuf, height, arrbuf2, height2, bd); + highbd_fill_arr_to_col(CONVERT_TO_SHORTPTR(output + i), out_stride, height2, + arrbuf2); + } + +Error: + aom_free(intbuf); + aom_free(arrbuf); + aom_free(arrbuf2); +} +#endif // CONFIG_FRAME_SUPERRES + #endif // CONFIG_HIGHBITDEPTH void av1_resize_frame420(const uint8_t *const y, int y_stride, @@ -912,11 +1002,11 @@ void av1_resize_frame420(const uint8_t *const y, int y_stride, int uv_stride, int height, int width, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth) { - av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); - av1_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2, - owidth / 2, ouv_stride); - av1_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2, - owidth / 2, ouv_stride); + resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); + resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2, owidth / 2, + ouv_stride); + resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2, owidth / 2, + ouv_stride); } void av1_resize_frame422(const uint8_t *const y, int y_stride, @@ -924,11 +1014,11 @@ void av1_resize_frame422(const uint8_t *const y, int y_stride, int uv_stride, int height, int width, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth) { - av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); - av1_resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2, - ouv_stride); - av1_resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2, - ouv_stride); + resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); + resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2, + ouv_stride); + resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2, + ouv_stride); } void av1_resize_frame444(const uint8_t *const y, int y_stride, @@ -936,11 +1026,9 @@ void av1_resize_frame444(const uint8_t *const y, int y_stride, int uv_stride, int height, int width, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth) { - av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); - av1_resize_plane(u, height, width, uv_stride, ou, oheight, owidth, - ouv_stride); - av1_resize_plane(v, height, width, uv_stride, ov, oheight, owidth, - ouv_stride); + resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride); + resize_plane(u, height, width, uv_stride, ou, oheight, owidth, ouv_stride); + resize_plane(v, height, width, uv_stride, ov, oheight, owidth, ouv_stride); } #if CONFIG_HIGHBITDEPTH @@ -950,12 +1038,12 @@ void av1_highbd_resize_frame420(const uint8_t *const y, int y_stride, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth, int bd) { - av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, - oy_stride, bd); - av1_highbd_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2, - owidth / 2, ouv_stride, bd); - av1_highbd_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2, - owidth / 2, ouv_stride, bd); + highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, + oy_stride, bd); + highbd_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2, + owidth / 2, ouv_stride, bd); + highbd_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2, + owidth / 2, ouv_stride, bd); } void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride, @@ -964,12 +1052,12 @@ void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth, int bd) { - av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, - oy_stride, bd); - av1_highbd_resize_plane(u, height, width / 2, uv_stride, ou, oheight, - owidth / 2, ouv_stride, bd); - av1_highbd_resize_plane(v, height, width / 2, uv_stride, ov, oheight, - owidth / 2, ouv_stride, bd); + highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, + oy_stride, bd); + highbd_resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2, + ouv_stride, bd); + highbd_resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2, + ouv_stride, bd); } void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride, @@ -978,12 +1066,12 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride, uint8_t *oy, int oy_stride, uint8_t *ou, uint8_t *ov, int ouv_stride, int oheight, int owidth, int bd) { - av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, - oy_stride, bd); - av1_highbd_resize_plane(u, height, width, uv_stride, ou, oheight, owidth, - ouv_stride, bd); - av1_highbd_resize_plane(v, height, width, uv_stride, ov, oheight, owidth, - ouv_stride, bd); + highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth, + oy_stride, bd); + highbd_resize_plane(u, height, width, uv_stride, ou, oheight, owidth, + ouv_stride, bd); + highbd_resize_plane(v, height, width, uv_stride, ov, oheight, owidth, + ouv_stride, bd); } #endif // CONFIG_HIGHBITDEPTH @@ -1013,30 +1101,56 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src, for (i = 0; i < MAX_MB_PLANE; ++i) { #if CONFIG_HIGHBITDEPTH if (src->flags & YV12_FLAG_HIGHBITDEPTH) - av1_highbd_resize_plane(srcs[i], src_heights[i], src_widths[i], - src_strides[i], dsts[i], dst_heights[i], - dst_widths[i], dst_strides[i], bd); + highbd_resize_plane(srcs[i], src_heights[i], src_widths[i], + src_strides[i], dsts[i], dst_heights[i], + dst_widths[i], dst_strides[i], bd); else #endif // CONFIG_HIGHBITDEPTH - av1_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i], - dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]); + resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i], + dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]); } aom_extend_frame_borders(dst); } -YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm, - YV12_BUFFER_CONFIG *unscaled, - YV12_BUFFER_CONFIG *scaled) { - if (cm->width != unscaled->y_crop_width || - cm->height != unscaled->y_crop_height) { - // For 2x2 scaling down. - aom_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0); - aom_extend_frame_borders(scaled); - return scaled; - } else { - return unscaled; +#if CONFIG_FRAME_SUPERRES +#if CONFIG_HIGHBITDEPTH +void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src, + YV12_BUFFER_CONFIG *dst, int bd) { +#else +void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src, + YV12_BUFFER_CONFIG *dst) { +#endif // CONFIG_HIGHBITDEPTH + // TODO(dkovalev): replace YV12_BUFFER_CONFIG with aom_image_t + int i; + const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer, + src->v_buffer }; + const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride }; + const int src_widths[3] = { src->y_crop_width, src->uv_crop_width, + src->uv_crop_width }; + const int src_heights[3] = { src->y_crop_height, src->uv_crop_height, + src->uv_crop_height }; + uint8_t *const dsts[3] = { dst->y_buffer, dst->u_buffer, dst->v_buffer }; + const int dst_strides[3] = { dst->y_stride, dst->uv_stride, dst->uv_stride }; + const int dst_widths[3] = { dst->y_crop_width, dst->uv_crop_width, + dst->uv_crop_width }; + const int dst_heights[3] = { dst->y_crop_height, dst->uv_crop_height, + dst->uv_crop_height }; + + for (i = 0; i < MAX_MB_PLANE; ++i) { +#if CONFIG_HIGHBITDEPTH + if (src->flags & YV12_FLAG_HIGHBITDEPTH) + highbd_upscale_normative_plane(srcs[i], src_heights[i], src_widths[i], + src_strides[i], dsts[i], dst_heights[i], + dst_widths[i], dst_strides[i], bd); + else +#endif // CONFIG_HIGHBITDEPTH + upscale_normative_plane(srcs[i], src_heights[i], src_widths[i], + src_strides[i], dsts[i], dst_heights[i], + dst_widths[i], dst_strides[i]); } + aom_extend_frame_borders(dst); } +#endif // CONFIG_FRAME_SUPERRES YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm, YV12_BUFFER_CONFIG *unscaled, @@ -1054,17 +1168,45 @@ YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm, } } -void av1_calculate_scaled_size(int *width, int *height, int num) { - if (num != SCALE_DENOMINATOR) { - *width = *width * num / SCALE_DENOMINATOR; - *height = *height * num / SCALE_DENOMINATOR; - // Make width and height even - *width += *width & 1; - *height += *height & 1; +// Calculates scaled dimensions given original dimensions and the scale +// denominator. If 'scale_height' is 1, both width and height are scaled; +// otherwise, only the width is scaled. +static void calculate_scaled_size_helper(int *width, int *height, int denom, + int scale_height) { + if (denom != SCALE_NUMERATOR) { + *width = *width * SCALE_NUMERATOR / denom; + *width += *width & 1; // Make it even. + if (scale_height) { + *height = *height * SCALE_NUMERATOR / denom; + *height += *height & 1; // Make it even. + } } } +void av1_calculate_scaled_size(int *width, int *height, int resize_denom) { + calculate_scaled_size_helper(width, height, resize_denom, 1); +} + #if CONFIG_FRAME_SUPERRES +void av1_calculate_scaled_superres_size(int *width, int *height, + int superres_denom) { + calculate_scaled_size_helper(width, height, superres_denom, + !CONFIG_HORZONLY_FRAME_SUPERRES); +} + +void av1_calculate_unscaled_superres_size(int *width, int *height, int denom) { + if (denom != SCALE_NUMERATOR) { + // Note: av1_calculate_scaled_superres_size() rounds *up* after division + // when the resulting dimensions are odd. So here, we round *down*. + *width = *width * denom / SCALE_NUMERATOR; +#if CONFIG_HORZONLY_FRAME_SUPERRES + (void)height; +#else + *height = *height * denom / SCALE_NUMERATOR; +#endif // CONFIG_HORZONLY_FRAME_SUPERRES + } +} + // TODO(afergs): Look for in-place upscaling // TODO(afergs): aom_ vs av1_ functions? Which can I use? // Upscale decoded image. @@ -1138,11 +1280,13 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) { // Scale up and back into frame_to_show. assert(frame_to_show->y_crop_width != cm->width); - assert(frame_to_show->y_crop_height != cm->height); + assert(IMPLIES(!CONFIG_HORZONLY_FRAME_SUPERRES, + frame_to_show->y_crop_height != cm->height)); #if CONFIG_HIGHBITDEPTH - av1_resize_and_extend_frame(©_buffer, frame_to_show, (int)cm->bit_depth); + av1_upscale_normative_and_extend_frame(©_buffer, frame_to_show, + (int)cm->bit_depth); #else - av1_resize_and_extend_frame(©_buffer, frame_to_show); + av1_upscale_normative_and_extend_frame(©_buffer, frame_to_show); #endif // CONFIG_HIGHBITDEPTH // Free the copy buffer diff --git a/third_party/aom/av1/common/resize.h b/third_party/aom/av1/common/resize.h index ca2c04686..66b32c72d 100644 --- a/third_party/aom/av1/common/resize.h +++ b/third_party/aom/av1/common/resize.h @@ -71,22 +71,40 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst); #endif // CONFIG_HIGHBITDEPTH -YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm, - YV12_BUFFER_CONFIG *unscaled, - YV12_BUFFER_CONFIG *scaled); +#if CONFIG_FRAME_SUPERRES +#if CONFIG_HIGHBITDEPTH +void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src, + YV12_BUFFER_CONFIG *dst, int bd); +#else +void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src, + YV12_BUFFER_CONFIG *dst); +#endif // CONFIG_HIGHBITDEPTH +#endif // CONFIG_FRAME_SUPERRES YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm, YV12_BUFFER_CONFIG *unscaled, YV12_BUFFER_CONFIG *scaled); -void av1_calculate_scaled_size(int *width, int *height, int num); +// Calculates the scaled dimensions from the given original dimensions and the +// resize scale denominator. +void av1_calculate_scaled_size(int *width, int *height, int resize_denom); #if CONFIG_FRAME_SUPERRES +// Similar to above, but calculates scaled dimensions after superres from the +// given original dimensions and superres scale denominator. +void av1_calculate_scaled_superres_size(int *width, int *height, + int superres_denom); + +// Inverse of av1_calculate_scaled_superres_size() above: calculates the +// original dimensions from the given scaled dimensions and the scale +// denominator. +void av1_calculate_unscaled_superres_size(int *width, int *height, int denom); + void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool); // Returns 1 if a superres upscaled frame is unscaled and 0 otherwise. static INLINE int av1_superres_unscaled(const AV1_COMMON *cm) { - return (cm->superres_scale_numerator == SCALE_DENOMINATOR); + return (cm->superres_scale_denominator == SCALE_NUMERATOR); } #endif // CONFIG_FRAME_SUPERRES diff --git a/third_party/aom/av1/common/restoration.c b/third_party/aom/av1/common/restoration.c index 8293af154..00441f072 100644 --- a/third_party/aom/av1/common/restoration.c +++ b/third_party/aom/av1/common/restoration.c @@ -19,6 +19,7 @@ #include "av1/common/restoration.h" #include "aom_dsp/aom_dsp_common.h" #include "aom_mem/aom_mem.h" + #include "aom_ports/mem.h" const sgr_params_type sgr_params[SGRPROJ_PARAMS] = { @@ -29,11 +30,18 @@ const sgr_params_type sgr_params[SGRPROJ_PARAMS] = { { -2, 3, 1, 5 }, { -2, 3, 1, 6 }, { -3, 4, 1, 3 }, { -3, 4, 1, 4 }, { -3, 4, 1, 5 }, { -3, 4, 1, 6 }, { -3, 4, 1, 7 }, { -3, 4, 1, 8 } #else - // r1, eps1, r2, eps2 +// r1, eps1, r2, eps2 +#if MAX_RADIUS == 2 + { 2, 12, 1, 4 }, { 2, 15, 1, 6 }, { 2, 18, 1, 8 }, { 2, 20, 1, 9 }, + { 2, 22, 1, 10 }, { 2, 25, 1, 11 }, { 2, 35, 1, 12 }, { 2, 45, 1, 13 }, + { 2, 55, 1, 14 }, { 2, 65, 1, 15 }, { 2, 75, 1, 16 }, { 2, 30, 1, 2 }, + { 2, 50, 1, 12 }, { 2, 60, 1, 13 }, { 2, 70, 1, 14 }, { 2, 80, 1, 15 }, +#else { 2, 12, 1, 4 }, { 2, 15, 1, 6 }, { 2, 18, 1, 8 }, { 2, 20, 1, 9 }, { 2, 22, 1, 10 }, { 2, 25, 1, 11 }, { 2, 35, 1, 12 }, { 2, 45, 1, 13 }, { 2, 55, 1, 14 }, { 2, 65, 1, 15 }, { 2, 75, 1, 16 }, { 3, 30, 1, 10 }, { 3, 50, 1, 12 }, { 3, 50, 2, 25 }, { 3, 60, 2, 35 }, { 3, 70, 2, 45 }, +#endif // MAX_RADIUS == 2 #endif }; @@ -76,12 +84,6 @@ void av1_free_restoration_struct(RestorationInfo *rst_info) { rst_info->sgrproj_info = NULL; } -#define MAX_RADIUS 3 // Only 1, 2, 3 allowed -#define MAX_EPS 80 // Max value of eps -#define MAX_NELEM ((2 * MAX_RADIUS + 1) * (2 * MAX_RADIUS + 1)) -#define SGRPROJ_MTABLE_BITS 20 -#define SGRPROJ_RECIP_BITS 12 - // TODO(debargha): This table can be substantially reduced since only a few // values are actually used. int sgrproj_mtable[MAX_EPS][MAX_NELEM]; @@ -102,82 +104,277 @@ static void loop_restoration_init(RestorationInternal *rst, int kf) { rst->keyframe = kf; } -void extend_frame(uint8_t *data, int width, int height, int stride) { +void extend_frame(uint8_t *data, int width, int height, int stride, + int border_horz, int border_vert) { uint8_t *data_p; int i; for (i = 0; i < height; ++i) { data_p = data + i * stride; - memset(data_p - WIENER_HALFWIN, data_p[0], WIENER_HALFWIN); - memset(data_p + width, data_p[width - 1], WIENER_HALFWIN); + memset(data_p - border_horz, data_p[0], border_horz); + memset(data_p + width, data_p[width - 1], border_horz); } - data_p = data - WIENER_HALFWIN; - for (i = -WIENER_HALFWIN; i < 0; ++i) { - memcpy(data_p + i * stride, data_p, width + 2 * WIENER_HALFWIN); + data_p = data - border_horz; + for (i = -border_vert; i < 0; ++i) { + memcpy(data_p + i * stride, data_p, width + 2 * border_horz); } - for (i = height; i < height + WIENER_HALFWIN; ++i) { + for (i = height; i < height + border_vert; ++i) { memcpy(data_p + i * stride, data_p + (height - 1) * stride, - width + 2 * WIENER_HALFWIN); + width + 2 * border_horz); } } -static void loop_copy_tile(uint8_t *data, int tile_idx, int subtile_idx, - int subtile_bits, int width, int height, int stride, - RestorationInternal *rst, uint8_t *dst, +#if CONFIG_STRIPED_LOOP_RESTORATION + +// This function setup a processing stripe by replacing the vertical +// stripe boundary (2 lines above and 2 lines below) by data coming +// from the above/below buffers. Before doing so the original +// frame data is saved into a temporary buffer, such that it +// can be restored by the restore_processing_stripe_boundary +// function after the filtering of the processing stripe. +// Returns the height of the processing stripe +static int setup_processing_stripe_boundary(int y0, int v_end, int h_start, + int h_end, uint8_t *data, + int stride, + RestorationInternal *rst, + int use_highbd) { + int y, y_stripe_topmost, stripe_index, i; + int tile_offset = RESTORATION_TILE_OFFSET >> rst->subsampling_y; + int stripe_height = rst->rsi->procunit_height; + int comp = rst->component; + uint8_t *boundary_above_buf = rst->stripe_boundary_above[comp]; + uint8_t *boundary_below_buf = rst->stripe_boundary_below[comp]; + int boundary_stride = rst->stripe_boundary_stride[comp]; + int x0 = h_start - RESTORATION_EXTRA_HORZ; + int x1 = h_end + RESTORATION_EXTRA_HORZ; + + stripe_index = (y0 + tile_offset) / stripe_height; + y_stripe_topmost = stripe_index * stripe_height - tile_offset; + boundary_above_buf += + ((stripe_index - 1) * 2 * boundary_stride + RESTORATION_EXTRA_HORZ) + << use_highbd; + boundary_below_buf += + (stripe_index * 2 * boundary_stride + RESTORATION_EXTRA_HORZ) + << use_highbd; + + // setup the 2 lines above the stripe + for (i = 0; i < 2; i++) { + y = y_stripe_topmost - 2 + i; + if (y >= 0 && y < y0 && y >= y0 - 2) { + uint8_t *p = data + ((y * stride + x0) << use_highbd); + uint8_t *new_data = + boundary_above_buf + ((i * boundary_stride + x0) << use_highbd); + // printf("above %3d %3d: %08x %08x : %08x %08x\n", y, x0, + // ((uint32_t*)p)[0], ((uint32_t*)p)[1], ((uint32_t*)new_data)[0], + // ((uint32_t*)new_data)[1]); + // Save old pixels + memcpy(rst->tmp_save_above[i], p, (x1 - x0) << use_highbd); + // Replace width pixels from boundary_above_buf + memcpy(p, new_data, (x1 - x0) << use_highbd); + } + } + // setup the 2 lines below the stripe + for (i = 0; i < 2; i++) { + y = y_stripe_topmost + stripe_height + i; + if (y < v_end + 2) { + uint8_t *p = data + ((y * stride + x0) << use_highbd); + uint8_t *new_data = + boundary_below_buf + ((i * boundary_stride + x0) << use_highbd); + // printf("below %3d %3d: %08x %08x : %08x %08x\n", y, x0, + // ((uint32_t*)p)[0], ((uint32_t*)p)[1], ((uint32_t*)new_data)[0], + // ((uint32_t*)new_data)[1]); + // Save old pixels + memcpy(rst->tmp_save_below[i], p, (x1 - x0) << use_highbd); + // Replace width pixels from boundary_below_buf + memcpy(p, new_data, (x1 - x0) << use_highbd); + } + } + // Return actual stripe height + return AOMMIN(v_end, y_stripe_topmost + stripe_height) - y0; +} + +// This function restores the boundary lines modified by +// setup_processing_stripe_boundary. +static void restore_processing_stripe_boundary(int y0, int v_end, int h_start, + int h_end, uint8_t *data, + int stride, + RestorationInternal *rst, + int use_highbd) { + int y, y_stripe_topmost, i, stripe_index; + int tile_offset = 8 >> rst->subsampling_y; + int stripe_height = rst->rsi->procunit_height; + int x0 = h_start - RESTORATION_EXTRA_HORZ; + int x1 = h_end + RESTORATION_EXTRA_HORZ; + + stripe_index = (y0 + tile_offset) / stripe_height; + y_stripe_topmost = stripe_index * stripe_height - tile_offset; + + // restore the 2 lines above the stripe + for (i = 0; i < 2; i++) { + y = y_stripe_topmost - 2 + i; + if (y >= 0 && y < y0 && y >= y0 - 2) { + uint8_t *p = data + ((y * stride + x0) << use_highbd); + memcpy(p, rst->tmp_save_above[i], (x1 - x0) << use_highbd); + } + } + // restore the 2 lines below the stripe + for (i = 0; i < 2; i++) { + y = y_stripe_topmost + stripe_height + i; + if (y < v_end + 2) { + uint8_t *p = data + ((y * stride + x0) << use_highbd); + memcpy(p, rst->tmp_save_below[i], (x1 - x0) << use_highbd); + } + } +} + +#endif + +static void loop_copy_tile(uint8_t *data, int tile_idx, int width, int height, + int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int i; - int h_start, h_end, v_start, v_end; - av1_get_rest_tile_limits(tile_idx, subtile_idx, subtile_bits, rst->nhtiles, - rst->nvtiles, tile_width, tile_height, width, height, - 0, 0, &h_start, &h_end, &v_start, &v_end); - for (i = v_start; i < v_end; ++i) - memcpy(dst + i * dst_stride + h_start, data + i * stride + h_start, - h_end - h_start); + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + for (int i = limits.v_start; i < limits.v_end; ++i) + memcpy(dst + i * dst_stride + limits.h_start, + data + i * stride + limits.h_start, limits.h_end - limits.h_start); +} + +static void stepdown_wiener_kernel(const InterpKernel orig, InterpKernel vert, + int boundary_dist, int istop) { + memcpy(vert, orig, sizeof(InterpKernel)); + switch (boundary_dist) { + case 0: + vert[WIENER_HALFWIN] += vert[2] + vert[1] + vert[0]; + vert[2] = vert[1] = vert[0] = 0; + break; + case 1: + vert[2] += vert[1] + vert[0]; + vert[1] = vert[0] = 0; + break; + case 2: + vert[1] += vert[0]; + vert[0] = 0; + break; + default: break; + } + if (!istop) { + int tmp; + tmp = vert[0]; + vert[0] = vert[WIENER_WIN - 1]; + vert[WIENER_WIN - 1] = tmp; + tmp = vert[1]; + vert[1] = vert[WIENER_WIN - 2]; + vert[WIENER_WIN - 2] = tmp; + tmp = vert[2]; + vert[2] = vert[WIENER_WIN - 3]; + vert[WIENER_WIN - 3] = tmp; + } } static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width, int height, int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { + const int procunit_width = rst->rsi->procunit_width; +#if CONFIG_STRIPED_LOOP_RESTORATION + int procunit_height; +#else + const int procunit_height = rst->rsi->procunit_height; +#endif const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int i, j; - int h_start, h_end, v_start, v_end; if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile(data, tile_idx, 0, 0, width, height, stride, rst, dst, - dst_stride); + loop_copy_tile(data, tile_idx, width, height, stride, rst, dst, dst_stride); return; } - av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles, - tile_width, tile_height, width, height, 0, 0, - &h_start, &h_end, &v_start, &v_end); + InterpKernel vertical_topbot; + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + // Convolve the whole tile (done in blocks here to match the requirements // of the vectorized convolve functions, but the result is equivalent) - for (i = v_start; i < v_end; i += MAX_SB_SIZE) - for (j = h_start; j < h_end; j += MAX_SB_SIZE) { - int w = AOMMIN(MAX_SB_SIZE, (h_end - j + 15) & ~15); - int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15); + for (int i = limits.v_start; i < limits.v_end; i += procunit_height) { +#if CONFIG_STRIPED_LOOP_RESTORATION + int h = setup_processing_stripe_boundary( + i, limits.v_end, limits.h_start, limits.h_end, data, stride, rst, 0); + h = ALIGN_POWER_OF_TWO(h, 1); + procunit_height = h; +#else + int h = AOMMIN(procunit_height, (limits.v_end - i + 15) & ~15); +#endif + for (int j = limits.h_start; j < limits.h_end; j += procunit_width) { + int w = AOMMIN(procunit_width, (limits.h_end - j + 15) & ~15); const uint8_t *data_p = data + i * stride + j; uint8_t *dst_p = dst + i * dst_stride + j; + // Note h is at least 16 + for (int b = 0; b < WIENER_HALFWIN - WIENER_BORDER_VERT; ++b) { + stepdown_wiener_kernel(rst->rsi->wiener_info[tile_idx].vfilter, + vertical_topbot, WIENER_BORDER_VERT + b, 1); +#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION + aom_convolve8_add_src_hip(data_p, stride, dst_p, dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1); +#else + aom_convolve8_add_src(data_p, stride, dst_p, dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1); +#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride; + dst_p += dst_stride; + } #if USE_WIENER_HIGH_INTERMEDIATE_PRECISION aom_convolve8_add_src_hip(data_p, stride, dst_p, dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, rst->rsi->wiener_info[tile_idx].vfilter, 16, w, - h); + h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); #else aom_convolve8_add_src(data_p, stride, dst_p, dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, - rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h); + rst->rsi->wiener_info[tile_idx].vfilter, 16, w, + h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); +#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride * (h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); + dst_p += dst_stride * (h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); + for (int b = WIENER_HALFWIN - WIENER_BORDER_VERT - 1; b >= 0; --b) { + stepdown_wiener_kernel(rst->rsi->wiener_info[tile_idx].vfilter, + vertical_topbot, WIENER_BORDER_VERT + b, 0); +#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION + aom_convolve8_add_src_hip(data_p, stride, dst_p, dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1); +#else + aom_convolve8_add_src(data_p, stride, dst_p, dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1); #endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride; + dst_p += dst_stride; + } } +#if CONFIG_STRIPED_LOOP_RESTORATION + restore_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, data, stride, rst, 0); +#endif + } } static void loop_wiener_filter(uint8_t *data, int width, int height, int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { int tile_idx; - extend_frame(data, width, height, stride); + extend_frame(data, width, height, stride, WIENER_BORDER_HORZ, + WIENER_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { loop_wiener_filter_tile(data, tile_idx, width, height, stride, rst, dst, dst_stride); @@ -560,36 +757,48 @@ const int32_t x_by_xplus1[256] = { const int32_t one_by_x[MAX_NELEM] = { 4096, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 372, 341, 315, - 293, 273, 256, 241, 228, 216, 205, 195, 186, 178, 171, 164, 158, - 152, 146, 141, 137, 132, 128, 124, 120, 117, 114, 111, 108, 105, - 102, 100, 98, 95, 93, 91, 89, 87, 85, 84 + 293, 273, 256, 241, 228, 216, 205, 195, 186, 178, 171, 164, +#if MAX_RADIUS > 2 + 158, 152, 146, 141, 137, 132, 128, 124, 120, 117, 114, 111, 108, + 105, 102, 100, 98, 95, 93, 91, 89, 87, 85, 84 +#endif // MAX_RADIUS > 2 }; static void av1_selfguided_restoration_internal(int32_t *dgd, int width, - int height, int stride, - int bit_depth, int r, int eps, - int32_t *tmpbuf) { - int32_t *A = tmpbuf; - int32_t *B = A + SGRPROJ_OUTBUF_SIZE; - int8_t num[RESTORATION_TILEPELS_MAX]; - int i, j; + int height, int dgd_stride, + int32_t *dst, int dst_stride, + int bit_depth, int r, int eps) { + const int width_ext = width + 2 * SGRPROJ_BORDER_HORZ; + const int height_ext = height + 2 * SGRPROJ_BORDER_VERT; + const int num_stride = width_ext; // Adjusting the stride of A and B here appears to avoid bad cache effects, // leading to a significant speed improvement. // We also align the stride to a multiple of 16 bytes, for consistency // with the SIMD version of this function. - int buf_stride = ((width + 3) & ~3) + 16; + int buf_stride = ((width_ext + 3) & ~3) + 16; + int32_t A_[RESTORATION_PROC_UNIT_PELS]; + int32_t B_[RESTORATION_PROC_UNIT_PELS]; + int32_t *A = A_; + int32_t *B = B_; + int8_t num_[RESTORATION_PROC_UNIT_PELS]; + int8_t *num = num_ + SGRPROJ_BORDER_VERT * num_stride + SGRPROJ_BORDER_HORZ; + int i, j; // Don't filter tiles with dimensions < 5 on any axis if ((width < 5) || (height < 5)) return; - boxsum(dgd, width, height, stride, r, 0, B, buf_stride); - boxsum(dgd, width, height, stride, r, 1, A, buf_stride); - boxnum(width, height, r, num, width); + boxsum(dgd - dgd_stride * SGRPROJ_BORDER_VERT - SGRPROJ_BORDER_HORZ, + width_ext, height_ext, dgd_stride, r, 0, B, buf_stride); + boxsum(dgd - dgd_stride * SGRPROJ_BORDER_VERT - SGRPROJ_BORDER_HORZ, + width_ext, height_ext, dgd_stride, r, 1, A, buf_stride); + boxnum(width_ext, height_ext, r, num_, num_stride); assert(r <= 3); + A += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; + B += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { const int k = i * buf_stride + j; - const int n = num[i * width + j]; + const int n = num[i * num_stride + j]; // a < 2^16 * n < 2^22 regardless of bit depth uint32_t a = ROUND_POWER_OF_TWO(A[k], 2 * (bit_depth - 8)); @@ -625,106 +834,115 @@ static void av1_selfguided_restoration_internal(int32_t *dgd, int width, j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k + buf_stride] + A[k + buf_stride + 1]; const int32_t b = 3 * B[k] + 2 * B[k + 1] + 2 * B[k + buf_stride] + B[k + buf_stride + 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } i = 0; j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k + buf_stride] + A[k + buf_stride - 1]; const int32_t b = 3 * B[k] + 2 * B[k - 1] + 2 * B[k + buf_stride] + B[k + buf_stride - 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } i = height - 1; j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k - buf_stride] + A[k - buf_stride + 1]; const int32_t b = 3 * B[k] + 2 * B[k + 1] + 2 * B[k - buf_stride] + B[k - buf_stride + 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } i = height - 1; j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k - buf_stride] + A[k - buf_stride - 1]; const int32_t b = 3 * B[k] + 2 * B[k - 1] + 2 * B[k - buf_stride] + B[k - buf_stride - 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } i = 0; for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k + buf_stride] + A[k + buf_stride - 1] + A[k + buf_stride + 1]; const int32_t b = B[k] + 2 * (B[k - 1] + B[k + 1]) + B[k + buf_stride] + B[k + buf_stride - 1] + B[k + buf_stride + 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } i = height - 1; for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k - buf_stride] + A[k - buf_stride - 1] + A[k - buf_stride + 1]; const int32_t b = B[k] + 2 * (B[k - 1] + B[k + 1]) + B[k - buf_stride] + B[k - buf_stride - 1] + B[k - buf_stride + 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } j = 0; for (i = 1; i < height - 1; ++i) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + A[k + 1] + A[k - buf_stride + 1] + A[k + buf_stride + 1]; const int32_t b = B[k] + 2 * (B[k - buf_stride] + B[k + buf_stride]) + B[k + 1] + B[k - buf_stride + 1] + B[k + buf_stride + 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } j = width - 1; for (i = 1; i < height - 1; ++i) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + A[k - 1] + A[k - buf_stride - 1] + A[k + buf_stride - 1]; const int32_t b = B[k] + 2 * (B[k - buf_stride] + B[k + buf_stride]) + B[k - 1] + B[k - buf_stride - 1] + B[k + buf_stride - 1]; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } for (i = 1; i < height - 1; ++i) { for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; + const int m = i * dst_stride + j; const int nb = 5; const int32_t a = (A[k] + A[k - 1] + A[k + 1] + A[k - buf_stride] + A[k + buf_stride]) * @@ -739,22 +957,26 @@ static void av1_selfguided_restoration_internal(int32_t *dgd, int width, B[k + 1 - buf_stride] + B[k + 1 + buf_stride]) * 3; const int32_t v = a * dgd[l] + b; - dgd[l] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); + dst[m] = ROUND_POWER_OF_TWO(v, SGRPROJ_SGR_BITS + nb - SGRPROJ_RST_BITS); } } } void av1_selfguided_restoration_c(uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, - int r, int eps, int32_t *tmpbuf) { + int r, int eps) { + int32_t dgd32_[RESTORATION_PROC_UNIT_PELS]; + const int dgd32_stride = width + 2 * SGRPROJ_BORDER_HORZ; + int32_t *dgd32 = + dgd32_ + dgd32_stride * SGRPROJ_BORDER_VERT + SGRPROJ_BORDER_HORZ; int i, j; - for (i = 0; i < height; ++i) { - for (j = 0; j < width; ++j) { - dst[i * dst_stride + j] = dgd[i * stride + j]; + for (i = -SGRPROJ_BORDER_VERT; i < height + SGRPROJ_BORDER_VERT; ++i) { + for (j = -SGRPROJ_BORDER_HORZ; j < width + SGRPROJ_BORDER_HORZ; ++j) { + dgd32[i * dgd32_stride + j] = dgd[i * stride + j]; } } - av1_selfguided_restoration_internal(dst, width, height, dst_stride, 8, r, eps, - tmpbuf); + av1_selfguided_restoration_internal(dgd32, width, height, dgd32_stride, dst, + dst_stride, 8, r, eps); } void av1_highpass_filter_c(uint8_t *dgd, int width, int height, int stride, @@ -853,7 +1075,6 @@ void apply_selfguided_restoration_c(uint8_t *dat, int width, int height, int xq[2]; int32_t *flt1 = tmpbuf; int32_t *flt2 = flt1 + RESTORATION_TILEPELS_MAX; - int32_t *tmpbuf2 = flt2 + RESTORATION_TILEPELS_MAX; int i, j; assert(width * height <= RESTORATION_TILEPELS_MAX); #if USE_HIGHPASS_IN_SGRPROJ @@ -861,10 +1082,10 @@ void apply_selfguided_restoration_c(uint8_t *dat, int width, int height, sgr_params[eps].corner, sgr_params[eps].edge); #else av1_selfguided_restoration_c(dat, width, height, stride, flt1, width, - sgr_params[eps].r1, sgr_params[eps].e1, tmpbuf2); + sgr_params[eps].r1, sgr_params[eps].e1); #endif // USE_HIGHPASS_IN_SGRPROJ av1_selfguided_restoration_c(dat, width, height, stride, flt2, width, - sgr_params[eps].r2, sgr_params[eps].e2, tmpbuf2); + sgr_params[eps].r2, sgr_params[eps].e2); decode_xq(xqd, xq); for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { @@ -886,31 +1107,54 @@ static void loop_sgrproj_filter_tile(uint8_t *data, int tile_idx, int width, int height, int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { + const int procunit_width = rst->rsi->procunit_width; +#if CONFIG_STRIPED_LOOP_RESTORATION + int procunit_height; +#else + const int procunit_height = rst->rsi->procunit_height; +#endif const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int h_start, h_end, v_start, v_end; - uint8_t *data_p, *dst_p; - if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile(data, tile_idx, 0, 0, width, height, stride, rst, dst, - dst_stride); + loop_copy_tile(data, tile_idx, width, height, stride, rst, dst, dst_stride); return; } - av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles, - tile_width, tile_height, width, height, 0, 0, - &h_start, &h_end, &v_start, &v_end); - data_p = data + h_start + v_start * stride; - dst_p = dst + h_start + v_start * dst_stride; - apply_selfguided_restoration(data_p, h_end - h_start, v_end - v_start, stride, - rst->rsi->sgrproj_info[tile_idx].ep, - rst->rsi->sgrproj_info[tile_idx].xqd, dst_p, - dst_stride, rst->tmpbuf); + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + for (int i = limits.v_start; i < limits.v_end; i += procunit_height) { +#if CONFIG_STRIPED_LOOP_RESTORATION + int h = setup_processing_stripe_boundary( + i, limits.v_end, limits.h_start, limits.h_end, data, stride, rst, 0); + procunit_height = h; +#else + int h = AOMMIN(procunit_height, limits.v_end - i); +#endif + for (int j = limits.h_start; j < limits.h_end; j += procunit_width) { + int w = AOMMIN(procunit_width, limits.h_end - j); + uint8_t *data_p = data + i * stride + j; + uint8_t *dst_p = dst + i * dst_stride + j; + apply_selfguided_restoration( + data_p, w, h, stride, rst->rsi->sgrproj_info[tile_idx].ep, + rst->rsi->sgrproj_info[tile_idx].xqd, dst_p, dst_stride, rst->tmpbuf); + } +#if CONFIG_STRIPED_LOOP_RESTORATION + restore_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, data, stride, rst, 0); +#endif + } } static void loop_sgrproj_filter(uint8_t *data, int width, int height, int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { int tile_idx; + extend_frame(data, width, height, stride, SGRPROJ_BORDER_HORZ, + SGRPROJ_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { loop_sgrproj_filter_tile(data, tile_idx, width, height, stride, rst, dst, dst_stride); @@ -921,10 +1165,11 @@ static void loop_switchable_filter(uint8_t *data, int width, int height, int stride, RestorationInternal *rst, uint8_t *dst, int dst_stride) { int tile_idx; - extend_frame(data, width, height, stride); + extend_frame(data, width, height, stride, RESTORATION_BORDER_HORZ, + RESTORATION_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile(data, tile_idx, 0, 0, width, height, stride, rst, dst, + loop_copy_tile(data, tile_idx, width, height, stride, rst, dst, dst_stride); } else if (rst->rsi->restoration_type[tile_idx] == RESTORE_WIENER) { loop_wiener_filter_tile(data, tile_idx, width, height, stride, rst, dst, @@ -937,40 +1182,43 @@ static void loop_switchable_filter(uint8_t *data, int width, int height, } #if CONFIG_HIGHBITDEPTH -void extend_frame_highbd(uint16_t *data, int width, int height, int stride) { +void extend_frame_highbd(uint16_t *data, int width, int height, int stride, + int border_horz, int border_vert) { uint16_t *data_p; int i, j; for (i = 0; i < height; ++i) { data_p = data + i * stride; - for (j = -WIENER_HALFWIN; j < 0; ++j) data_p[j] = data_p[0]; - for (j = width; j < width + WIENER_HALFWIN; ++j) - data_p[j] = data_p[width - 1]; + for (j = -border_horz; j < 0; ++j) data_p[j] = data_p[0]; + for (j = width; j < width + border_horz; ++j) data_p[j] = data_p[width - 1]; } - data_p = data - WIENER_HALFWIN; - for (i = -WIENER_HALFWIN; i < 0; ++i) { + data_p = data - border_horz; + for (i = -border_vert; i < 0; ++i) { memcpy(data_p + i * stride, data_p, - (width + 2 * WIENER_HALFWIN) * sizeof(uint16_t)); + (width + 2 * border_horz) * sizeof(uint16_t)); } - for (i = height; i < height + WIENER_HALFWIN; ++i) { + for (i = height; i < height + border_vert; ++i) { memcpy(data_p + i * stride, data_p + (height - 1) * stride, - (width + 2 * WIENER_HALFWIN) * sizeof(uint16_t)); + (width + 2 * border_horz) * sizeof(uint16_t)); } } -static void loop_copy_tile_highbd(uint16_t *data, int tile_idx, int subtile_idx, - int subtile_bits, int width, int height, - int stride, RestorationInternal *rst, - uint16_t *dst, int dst_stride) { +static void loop_copy_tile_highbd(uint16_t *data, int tile_idx, int width, + int height, int stride, + RestorationInternal *rst, uint16_t *dst, + int dst_stride) { const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int i; - int h_start, h_end, v_start, v_end; - av1_get_rest_tile_limits(tile_idx, subtile_idx, subtile_bits, rst->nhtiles, - rst->nvtiles, tile_width, tile_height, width, height, - 0, 0, &h_start, &h_end, &v_start, &v_end); - for (i = v_start; i < v_end; ++i) - memcpy(dst + i * dst_stride + h_start, data + i * stride + h_start, - (h_end - h_start) * sizeof(*dst)); + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + for (int i = limits.v_start; i < limits.v_end; ++i) + memcpy(dst + i * dst_stride + limits.h_start, + data + i * stride + limits.h_start, + (limits.h_end - limits.h_start) * sizeof(*dst)); } static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx, @@ -978,39 +1226,102 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx, RestorationInternal *rst, int bit_depth, uint16_t *dst, int dst_stride) { + const int procunit_width = rst->rsi->procunit_width; +#if CONFIG_STRIPED_LOOP_RESTORATION + int procunit_height; +#else + const int procunit_height = rst->rsi->procunit_height; +#endif const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int h_start, h_end, v_start, v_end; - int i, j; if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile_highbd(data, tile_idx, 0, 0, width, height, stride, rst, dst, + loop_copy_tile_highbd(data, tile_idx, width, height, stride, rst, dst, dst_stride); return; } - av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles, - tile_width, tile_height, width, height, 0, 0, - &h_start, &h_end, &v_start, &v_end); + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + InterpKernel vertical_topbot; + // Convolve the whole tile (done in blocks here to match the requirements // of the vectorized convolve functions, but the result is equivalent) - for (i = v_start; i < v_end; i += MAX_SB_SIZE) - for (j = h_start; j < h_end; j += MAX_SB_SIZE) { - int w = AOMMIN(MAX_SB_SIZE, (h_end - j + 15) & ~15); - int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15); + for (int i = limits.v_start; i < limits.v_end; i += procunit_height) { +#if CONFIG_STRIPED_LOOP_RESTORATION + int h = setup_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, (uint8_t *)data, + stride, rst, 1); + h = ALIGN_POWER_OF_TWO(h, 1); + procunit_height = h; +#else + int h = AOMMIN(procunit_height, (limits.v_end - i + 15) & ~15); +#endif + for (int j = limits.h_start; j < limits.h_end; j += procunit_width) { + int w = AOMMIN(procunit_width, (limits.h_end - j + 15) & ~15); const uint16_t *data_p = data + i * stride + j; uint16_t *dst_p = dst + i * dst_stride + j; + // Note h is at least 16 + for (int b = 0; b < WIENER_HALFWIN - WIENER_BORDER_VERT; ++b) { + stepdown_wiener_kernel(rst->rsi->wiener_info[tile_idx].vfilter, + vertical_topbot, WIENER_BORDER_VERT + b, 1); +#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION + aom_highbd_convolve8_add_src_hip( + CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p), + dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1, bit_depth); +#else + aom_highbd_convolve8_add_src(CONVERT_TO_BYTEPTR(data_p), stride, + CONVERT_TO_BYTEPTR(dst_p), dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, + 16, vertical_topbot, 16, w, 1, bit_depth); +#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride; + dst_p += dst_stride; + } #if USE_WIENER_HIGH_INTERMEDIATE_PRECISION aom_highbd_convolve8_add_src_hip( CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p), dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, - rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth); + rst->rsi->wiener_info[tile_idx].vfilter, 16, w, + h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2, bit_depth); #else aom_highbd_convolve8_add_src( CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p), dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, - rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth); + rst->rsi->wiener_info[tile_idx].vfilter, 16, w, + h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2, bit_depth); +#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride * (h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); + dst_p += dst_stride * (h - (WIENER_HALFWIN - WIENER_BORDER_VERT) * 2); + for (int b = WIENER_HALFWIN - WIENER_BORDER_VERT - 1; b >= 0; --b) { + stepdown_wiener_kernel(rst->rsi->wiener_info[tile_idx].vfilter, + vertical_topbot, WIENER_BORDER_VERT + b, 0); +#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION + aom_highbd_convolve8_add_src_hip( + CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p), + dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16, + vertical_topbot, 16, w, 1, bit_depth); +#else + aom_highbd_convolve8_add_src(CONVERT_TO_BYTEPTR(data_p), stride, + CONVERT_TO_BYTEPTR(dst_p), dst_stride, + rst->rsi->wiener_info[tile_idx].hfilter, + 16, vertical_topbot, 16, w, 1, bit_depth); #endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION + data_p += stride; + dst_p += dst_stride; + } } +#if CONFIG_STRIPED_LOOP_RESTORATION + restore_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, (uint8_t *)data, stride, + rst, 1); +#endif + } } static void loop_wiener_filter_highbd(uint8_t *data8, int width, int height, @@ -1020,7 +1331,8 @@ static void loop_wiener_filter_highbd(uint8_t *data8, int width, int height, uint16_t *data = CONVERT_TO_SHORTPTR(data8); uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); int tile_idx; - extend_frame_highbd(data, width, height, stride); + extend_frame_highbd(data, width, height, stride, WIENER_BORDER_HORZ, + WIENER_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { loop_wiener_filter_tile_highbd(data, tile_idx, width, height, stride, rst, bit_depth, dst, dst_stride); @@ -1030,15 +1342,19 @@ static void loop_wiener_filter_highbd(uint8_t *data8, int width, int height, void av1_selfguided_restoration_highbd_c(uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int bit_depth, int r, - int eps, int32_t *tmpbuf) { + int eps) { + int32_t dgd32_[RESTORATION_PROC_UNIT_PELS]; + const int dgd32_stride = width + 2 * SGRPROJ_BORDER_HORZ; + int32_t *dgd32 = + dgd32_ + dgd32_stride * SGRPROJ_BORDER_VERT + SGRPROJ_BORDER_HORZ; int i, j; - for (i = 0; i < height; ++i) { - for (j = 0; j < width; ++j) { - dst[i * dst_stride + j] = dgd[i * stride + j]; + for (i = -SGRPROJ_BORDER_VERT; i < height + SGRPROJ_BORDER_VERT; ++i) { + for (j = -SGRPROJ_BORDER_HORZ; j < width + SGRPROJ_BORDER_HORZ; ++j) { + dgd32[i * dgd32_stride + j] = dgd[i * stride + j]; } } - av1_selfguided_restoration_internal(dst, width, height, dst_stride, bit_depth, - r, eps, tmpbuf); + av1_selfguided_restoration_internal(dgd32, width, height, dgd32_stride, dst, + dst_stride, bit_depth, r, eps); } void av1_highpass_filter_highbd_c(uint16_t *dgd, int width, int height, @@ -1139,7 +1455,6 @@ void apply_selfguided_restoration_highbd_c(uint16_t *dat, int width, int height, int xq[2]; int32_t *flt1 = tmpbuf; int32_t *flt2 = flt1 + RESTORATION_TILEPELS_MAX; - int32_t *tmpbuf2 = flt2 + RESTORATION_TILEPELS_MAX; int i, j; assert(width * height <= RESTORATION_TILEPELS_MAX); #if USE_HIGHPASS_IN_SGRPROJ @@ -1148,11 +1463,11 @@ void apply_selfguided_restoration_highbd_c(uint16_t *dat, int width, int height, #else av1_selfguided_restoration_highbd_c(dat, width, height, stride, flt1, width, bit_depth, sgr_params[eps].r1, - sgr_params[eps].e1, tmpbuf2); + sgr_params[eps].e1); #endif // USE_HIGHPASS_IN_SGRPROJ av1_selfguided_restoration_highbd_c(dat, width, height, stride, flt2, width, bit_depth, sgr_params[eps].r2, - sgr_params[eps].e2, tmpbuf2); + sgr_params[eps].e2); decode_xq(xqd, xq); for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { @@ -1175,25 +1490,50 @@ static void loop_sgrproj_filter_tile_highbd(uint16_t *data, int tile_idx, RestorationInternal *rst, int bit_depth, uint16_t *dst, int dst_stride) { + const int procunit_width = rst->rsi->procunit_width; +#if CONFIG_STRIPED_LOOP_RESTORATION + int procunit_height; +#else + const int procunit_height = rst->rsi->procunit_height; +#endif const int tile_width = rst->tile_width; const int tile_height = rst->tile_height; - int h_start, h_end, v_start, v_end; - uint16_t *data_p, *dst_p; if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile_highbd(data, tile_idx, 0, 0, width, height, stride, rst, dst, + loop_copy_tile_highbd(data, tile_idx, width, height, stride, rst, dst, dst_stride); return; } - av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles, - tile_width, tile_height, width, height, 0, 0, - &h_start, &h_end, &v_start, &v_end); - data_p = data + h_start + v_start * stride; - dst_p = dst + h_start + v_start * dst_stride; - apply_selfguided_restoration_highbd( - data_p, h_end - h_start, v_end - v_start, stride, bit_depth, - rst->rsi->sgrproj_info[tile_idx].ep, rst->rsi->sgrproj_info[tile_idx].xqd, - dst_p, dst_stride, rst->tmpbuf); + RestorationTileLimits limits = + av1_get_rest_tile_limits(tile_idx, rst->nhtiles, rst->nvtiles, tile_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + tile_height, width, height, rst->subsampling_y); +#else + tile_height, width, height); +#endif + for (int i = limits.v_start; i < limits.v_end; i += procunit_height) { +#if CONFIG_STRIPED_LOOP_RESTORATION + int h = setup_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, (uint8_t *)data, + stride, rst, 1); + procunit_height = h; +#else + int h = AOMMIN(procunit_height, limits.v_end - i); +#endif + for (int j = limits.h_start; j < limits.h_end; j += procunit_width) { + int w = AOMMIN(procunit_width, limits.h_end - j); + uint16_t *data_p = data + i * stride + j; + uint16_t *dst_p = dst + i * dst_stride + j; + apply_selfguided_restoration_highbd( + data_p, w, h, stride, bit_depth, rst->rsi->sgrproj_info[tile_idx].ep, + rst->rsi->sgrproj_info[tile_idx].xqd, dst_p, dst_stride, rst->tmpbuf); + } +#if CONFIG_STRIPED_LOOP_RESTORATION + restore_processing_stripe_boundary(i, limits.v_end, limits.h_start, + limits.h_end, (uint8_t *)data, stride, + rst, 1); +#endif + } } static void loop_sgrproj_filter_highbd(uint8_t *data8, int width, int height, @@ -1203,6 +1543,8 @@ static void loop_sgrproj_filter_highbd(uint8_t *data8, int width, int height, int tile_idx; uint16_t *data = CONVERT_TO_SHORTPTR(data8); uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); + extend_frame_highbd(data, width, height, stride, SGRPROJ_BORDER_HORZ, + SGRPROJ_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { loop_sgrproj_filter_tile_highbd(data, tile_idx, width, height, stride, rst, bit_depth, dst, dst_stride); @@ -1216,11 +1558,12 @@ static void loop_switchable_filter_highbd(uint8_t *data8, int width, int height, uint16_t *data = CONVERT_TO_SHORTPTR(data8); uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); int tile_idx; - extend_frame_highbd(data, width, height, stride); + extend_frame_highbd(data, width, height, stride, RESTORATION_BORDER_HORZ, + RESTORATION_BORDER_VERT); for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) { if (rst->rsi->restoration_type[tile_idx] == RESTORE_NONE) { - loop_copy_tile_highbd(data, tile_idx, 0, 0, width, height, stride, rst, - dst, dst_stride); + loop_copy_tile_highbd(data, tile_idx, width, height, stride, rst, dst, + dst_stride); } else if (rst->rsi->restoration_type[tile_idx] == RESTORE_WIENER) { loop_wiener_filter_tile_highbd(data, tile_idx, width, height, stride, rst, bit_depth, dst, dst_stride); @@ -1263,7 +1606,6 @@ static void loop_restoration_rows(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, yend = AOMMIN(yend, yheight); uvend = AOMMIN(uvend, uvheight); - if (components_pattern == (1 << AOM_PLANE_Y)) { // Only y if (rsi[0].frame_restoration_type == RESTORE_NONE) { @@ -1313,6 +1655,10 @@ static void loop_restoration_rows(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, &cm->rst_internal.tile_width, &cm->rst_internal.tile_height, &cm->rst_internal.nhtiles, &cm->rst_internal.nvtiles); cm->rst_internal.rsi = &rsi[0]; +#if CONFIG_STRIPED_LOOP_RESTORATION + cm->rst_internal.component = AOM_PLANE_Y; + cm->rst_internal.subsampling_y = 0; +#endif restore_func = restore_funcs[cm->rst_internal.rsi->frame_restoration_type]; #if CONFIG_HIGHBITDEPTH @@ -1340,6 +1686,10 @@ static void loop_restoration_rows(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, &cm->rst_internal.tile_width, &cm->rst_internal.tile_height, &cm->rst_internal.nhtiles, &cm->rst_internal.nvtiles); cm->rst_internal.rsi = &rsi[AOM_PLANE_U]; +#if CONFIG_STRIPED_LOOP_RESTORATION + cm->rst_internal.component = AOM_PLANE_U; + cm->rst_internal.subsampling_y = cm->subsampling_y; +#endif restore_func = restore_funcs[cm->rst_internal.rsi->frame_restoration_type]; #if CONFIG_HIGHBITDEPTH @@ -1367,6 +1717,10 @@ static void loop_restoration_rows(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, &cm->rst_internal.tile_width, &cm->rst_internal.tile_height, &cm->rst_internal.nhtiles, &cm->rst_internal.nvtiles); cm->rst_internal.rsi = &rsi[AOM_PLANE_V]; +#if CONFIG_STRIPED_LOOP_RESTORATION + cm->rst_internal.component = AOM_PLANE_V; + cm->rst_internal.subsampling_y = cm->subsampling_y; +#endif restore_func = restore_funcs[cm->rst_internal.rsi->frame_restoration_type]; #if CONFIG_HIGHBITDEPTH @@ -1416,3 +1770,160 @@ void av1_loop_restoration_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, loop_restoration_rows(frame, cm, start_mi_row, end_mi_row, components_pattern, rsi, dst); } + +int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane, + int mi_row, int mi_col, BLOCK_SIZE bsize, + int *rcol0, int *rcol1, int *rrow0, + int *rrow1, int *nhtiles) { + assert(rcol0 && rcol1 && rrow0 && rrow1 && nhtiles); + + if (bsize != cm->sb_size) return 0; + +#if CONFIG_FRAME_SUPERRES + const int frame_w = cm->superres_upscaled_width; + const int frame_h = cm->superres_upscaled_height; + const int mi_to_px = MI_SIZE * SCALE_NUMERATOR; + const int denom = cm->superres_scale_denominator; +#else + const int frame_w = cm->width; + const int frame_h = cm->height; + const int mi_to_px = MI_SIZE; + const int denom = 1; +#endif // CONFIG_FRAME_SUPERRES + + const int ss_x = plane > 0 && cm->subsampling_x != 0; + const int ss_y = plane > 0 && cm->subsampling_y != 0; + + const int ss_frame_w = (frame_w + ss_x) >> ss_x; + const int ss_frame_h = (frame_h + ss_y) >> ss_y; + + int rtile_w, rtile_h, nvtiles; + av1_get_rest_ntiles(ss_frame_w, ss_frame_h, + cm->rst_info[plane].restoration_tilesize, &rtile_w, + &rtile_h, nhtiles, &nvtiles); + + const int rnd_w = rtile_w * denom - 1; + const int rnd_h = rtile_h * denom - 1; + + // rcol0/rrow0 should be the first column/row of rtiles that doesn't start + // left/below of mi_col/mi_row. For this calculation, we need to round up the + // division (if the sb starts at rtile column 10.1, the first matching rtile + // has column index 11) + *rcol0 = (mi_col * mi_to_px + rnd_w) / (rtile_w * denom); + *rrow0 = (mi_row * mi_to_px + rnd_h) / (rtile_h * denom); + + // rcol1/rrow1 is the equivalent calculation, but for the superblock + // below-right. There are some slightly strange boundary effects. First, we + // need to clamp to nhtiles/nvtiles for the case where it appears there are, + // say, 2.4 restoration tiles horizontally. There we need a maximum mi_row1 + // of 2 because tile 1 gets extended. + // + // Second, if mi_col1 >= cm->mi_cols then we must manually set *rcol1 to + // nhtiles. This is needed whenever the frame's width rounded up to the next + // toplevel superblock is smaller than nhtiles * rtile_w. The same logic is + // needed for rows. + const int mi_row1 = mi_row + mi_size_high[bsize]; + const int mi_col1 = mi_col + mi_size_wide[bsize]; + + if (mi_col1 >= cm->mi_cols) + *rcol1 = *nhtiles; + else + *rcol1 = AOMMIN(*nhtiles, (mi_col1 * mi_to_px + rnd_w) / (rtile_w * denom)); + + if (mi_row1 >= cm->mi_rows) + *rrow1 = nvtiles; + else + *rrow1 = AOMMIN(nvtiles, (mi_row1 * mi_to_px + rnd_h) / (rtile_h * denom)); + + return *rcol0 < *rcol1 && *rrow0 < *rrow1; +} + +#if CONFIG_STRIPED_LOOP_RESTORATION + +// Extend to left and right +static void extend_line(uint8_t *buf, int width, int extend, + int use_highbitdepth) { + int i; + if (use_highbitdepth) { + uint16_t val, *buf16 = (uint16_t *)buf; + val = buf16[0]; + for (i = 0; i < extend; i++) buf16[-1 - i] = val; + val = buf16[width - 1]; + for (i = 0; i < extend; i++) buf16[width + i] = val; + } else { + uint8_t val; + val = buf[0]; + for (i = 0; i < extend; i++) buf[-1 - i] = val; + val = buf[width - 1]; + for (i = 0; i < extend; i++) buf[width + i] = val; + } +} + +// For each 64 pixel high stripe, save 4 scan lines to be used as boundary in +// the loop restoration process. The lines are saved in +// rst_internal.stripe_boundary_lines +void av1_loop_restoration_save_boundary_lines(YV12_BUFFER_CONFIG *frame, + AV1_COMMON *cm) { + int p, boundary_stride; + int src_width, src_height, src_stride, stripe_height, stripe_offset, stripe_y, + yy; + uint8_t *src_buf, *boundary_below_buf, *boundary_above_buf; + int use_highbitdepth = 0; + for (p = 0; p < MAX_MB_PLANE; ++p) { + if (p == 0) { + src_buf = frame->y_buffer; + src_width = frame->y_crop_width; + src_height = frame->y_crop_height; + src_stride = frame->y_stride; + stripe_height = 64; + stripe_offset = 56 - 2; // offset of first line to copy + } else { + src_buf = p == 1 ? frame->u_buffer : frame->v_buffer; + src_width = frame->uv_crop_width; + src_height = frame->uv_crop_height; + src_stride = frame->uv_stride; + stripe_height = 64 >> cm->subsampling_y; + stripe_offset = (56 >> cm->subsampling_y) - 2; + } + boundary_above_buf = cm->rst_internal.stripe_boundary_above[p]; + boundary_below_buf = cm->rst_internal.stripe_boundary_below[p]; + boundary_stride = cm->rst_internal.stripe_boundary_stride[p]; +#if CONFIG_HIGHBITDEPTH + use_highbitdepth = cm->use_highbitdepth; + if (use_highbitdepth) { + src_buf = (uint8_t *)CONVERT_TO_SHORTPTR(src_buf); + } +#endif + src_buf += (stripe_offset * src_stride) << use_highbitdepth; + boundary_above_buf += RESTORATION_EXTRA_HORZ << use_highbitdepth; + boundary_below_buf += RESTORATION_EXTRA_HORZ << use_highbitdepth; + // Loop over stripes + for (stripe_y = stripe_offset; stripe_y < src_height; + stripe_y += stripe_height) { + // Save 2 lines above the LR stripe (offset -9, -10) + for (yy = 0; yy < 2; yy++) { + if (stripe_y + yy < src_height) { + memcpy(boundary_above_buf, src_buf, src_width << use_highbitdepth); + extend_line(boundary_above_buf, src_width, RESTORATION_EXTRA_HORZ, + use_highbitdepth); + src_buf += src_stride << use_highbitdepth; + boundary_above_buf += boundary_stride << use_highbitdepth; + } + } + // Save 2 lines below the LR stripe (offset 56,57) + for (yy = 2; yy < 4; yy++) { + if (stripe_y + yy < src_height) { + memcpy(boundary_below_buf, src_buf, src_width << use_highbitdepth); + extend_line(boundary_below_buf, src_width, RESTORATION_EXTRA_HORZ, + use_highbitdepth); + src_buf += src_stride << use_highbitdepth; + boundary_below_buf += boundary_stride << use_highbitdepth; + } + } + // jump to next stripe + src_buf += ((stripe_height - 4) * src_stride) << use_highbitdepth; + } + } +} + +#endif // CONFIG_STRIPED_LOOP_RESTORATION diff --git a/third_party/aom/av1/common/restoration.h b/third_party/aom/av1/common/restoration.h index 477f20a42..23a53879e 100644 --- a/third_party/aom/av1/common/restoration.h +++ b/third_party/aom/av1/common/restoration.h @@ -24,18 +24,77 @@ extern "C" { #define CLIP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x)) #define RINT(x) ((x) < 0 ? (int)((x)-0.5) : (int)((x) + 0.5)) +#define RESTORATION_PROC_UNIT_SIZE 64 + +#if CONFIG_STRIPED_LOOP_RESTORATION +// Filter tile grid offset upwards compared to the superblock grid +#define RESTORATION_TILE_OFFSET 8 +#endif + +#if CONFIG_STRIPED_LOOP_RESTORATION +#define SGRPROJ_BORDER_VERT 2 // Vertical border used for Sgr +#else +#define SGRPROJ_BORDER_VERT 1 // Vertical border used for Sgr +#endif +#define SGRPROJ_BORDER_HORZ 2 // Horizontal border used for Sgr + +#if CONFIG_STRIPED_LOOP_RESTORATION +#define WIENER_BORDER_VERT 2 // Vertical border used for Wiener +#else +#define WIENER_BORDER_VERT 1 // Vertical border used for Wiener +#endif +#define WIENER_HALFWIN 3 +#define WIENER_BORDER_HORZ (WIENER_HALFWIN) // Horizontal border for Wiener + +// RESTORATION_BORDER_VERT determines line buffer requirement for LR. +// Should be set at the max of SGRPROJ_BORDER_VERT and WIENER_BORDER_VERT. +// Note the line buffer needed is twice the value of this macro. +#if SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT +#define RESTORATION_BORDER_VERT (SGRPROJ_BORDER_VERT) +#else +#define RESTORATION_BORDER_VERT (WIENER_BORDER_VERT) +#endif // SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT + +#if SGRPROJ_BORDER_HORZ >= WIENER_BORDER_HORZ +#define RESTORATION_BORDER_HORZ (SGRPROJ_BORDER_HORZ) +#else +#define RESTORATION_BORDER_HORZ (WIENER_BORDER_HORZ) +#endif // SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT + +#if CONFIG_STRIPED_LOOP_RESTORATION +// Additional pixels to the left and right in above/below buffers +// It is RESTORATION_BORDER_HORZ rounded up to get nicer buffer alignment +#define RESTORATION_EXTRA_HORZ 4 +#endif + +// Pad up to 20 more (may be much less is needed) +#define RESTORATION_PADDING 20 +#define RESTORATION_PROC_UNIT_PELS \ + ((RESTORATION_PROC_UNIT_SIZE + RESTORATION_BORDER_HORZ * 2 + \ + RESTORATION_PADDING) * \ + (RESTORATION_PROC_UNIT_SIZE + RESTORATION_BORDER_VERT * 2 + \ + RESTORATION_PADDING)) + #define RESTORATION_TILESIZE_MAX 256 +#if CONFIG_STRIPED_LOOP_RESTORATION +#define RESTORATION_TILEPELS_HORZ_MAX \ + (RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_HORZ + 16) +#define RESTORATION_TILEPELS_VERT_MAX \ + ((RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_VERT + \ + RESTORATION_TILE_OFFSET)) #define RESTORATION_TILEPELS_MAX \ - (RESTORATION_TILESIZE_MAX * RESTORATION_TILESIZE_MAX * 9 / 4) - -// 4 32-bit buffers needed for the filter: -// 2 for the restored versions of the frame and -// 2 for each restoration operation -#define SGRPROJ_OUTBUF_SIZE \ - ((RESTORATION_TILESIZE_MAX * 3 / 2) * (RESTORATION_TILESIZE_MAX * 3 / 2 + 16)) -#define SGRPROJ_TMPBUF_SIZE \ - (RESTORATION_TILEPELS_MAX * 2 * sizeof(int32_t) + \ - SGRPROJ_OUTBUF_SIZE * 2 * sizeof(int32_t)) + (RESTORATION_TILEPELS_HORZ_MAX * RESTORATION_TILEPELS_VERT_MAX) +#else +#define RESTORATION_TILEPELS_MAX \ + ((RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_HORZ + 16) * \ + (RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_VERT)) +#endif + +// Two 32-bit buffers needed for the restored versions from two filters +// TODO(debargha, rupert): Refactor to not need the large tilesize to be stored +// on the decoder side. +#define SGRPROJ_TMPBUF_SIZE (RESTORATION_TILEPELS_MAX * 2 * sizeof(int32_t)) + #define SGRPROJ_EXTBUF_SIZE (0) #define SGRPROJ_PARAMS_BITS 4 #define SGRPROJ_PARAMS (1 << SGRPROJ_PARAMS_BITS) @@ -65,19 +124,22 @@ extern "C" { #define SGRPROJ_BITS (SGRPROJ_PRJ_BITS * 2 + SGRPROJ_PARAMS_BITS) -#define MAX_RADIUS 3 // Only 1, 2, 3 allowed +#define MAX_RADIUS 2 // Only 1, 2, 3 allowed #define MAX_EPS 80 // Max value of eps #define MAX_NELEM ((2 * MAX_RADIUS + 1) * (2 * MAX_RADIUS + 1)) #define SGRPROJ_MTABLE_BITS 20 #define SGRPROJ_RECIP_BITS 12 -#define WIENER_HALFWIN 3 #define WIENER_HALFWIN1 (WIENER_HALFWIN + 1) #define WIENER_WIN (2 * WIENER_HALFWIN + 1) #define WIENER_WIN2 ((WIENER_WIN) * (WIENER_WIN)) #define WIENER_TMPBUF_SIZE (0) #define WIENER_EXTBUF_SIZE (0) +// If WIENER_WIN_CHROMA == WIENER_WIN - 2, that implies 5x5 filters are used for +// chroma. To use 7x7 for chroma set WIENER_WIN_CHROMA to WIENER_WIN. +#define WIENER_WIN_CHROMA (WIENER_WIN - 2) + #define WIENER_FILT_PREC_BITS 7 #define WIENER_FILT_STEP (1 << WIENER_FILT_PREC_BITS) @@ -131,10 +193,6 @@ extern "C" { #if WIENER_FILT_PREC_BITS != 7 #error "Wiener filter currently only works if WIENER_FILT_PREC_BITS == 7" #endif -typedef struct { - DECLARE_ALIGNED(16, InterpKernel, vfilter); - DECLARE_ALIGNED(16, InterpKernel, hfilter); -} WienerInfo; typedef struct { #if USE_HIGHPASS_IN_SGRPROJ @@ -149,12 +207,8 @@ typedef struct { } sgr_params_type; typedef struct { - int ep; - int xqd[2]; -} SgrprojInfo; - -typedef struct { int restoration_tilesize; + int procunit_width, procunit_height; RestorationType frame_restoration_type; RestorationType *restoration_type; // Wiener filter @@ -170,6 +224,20 @@ typedef struct { int tile_width, tile_height; int nhtiles, nvtiles; int32_t *tmpbuf; +#if CONFIG_STRIPED_LOOP_RESTORATION + int component; + int subsampling_y; + uint8_t *stripe_boundary_above[MAX_MB_PLANE]; + uint8_t *stripe_boundary_below[MAX_MB_PLANE]; + int stripe_boundary_stride[MAX_MB_PLANE]; + // Temporary buffers to save/restore 2 lines above/below the restoration + // stripe + // Allow for filter margin to left and right + uint16_t + tmp_save_above[2][RESTORATION_TILESIZE_MAX + 2 * RESTORATION_EXTRA_HORZ]; + uint16_t + tmp_save_below[2][RESTORATION_TILESIZE_MAX + 2 * RESTORATION_EXTRA_HORZ]; +#endif } RestorationInternal; static INLINE void set_default_sgrproj(SgrprojInfo *sgrproj_info) { @@ -196,6 +264,8 @@ static INLINE int av1_get_rest_ntiles(int width, int height, int tilesize, int tile_width_, tile_height_; tile_width_ = (tilesize < 0) ? width : AOMMIN(tilesize, width); tile_height_ = (tilesize < 0) ? height : AOMMIN(tilesize, height); + assert(tile_width_ > 0 && tile_height_ > 0); + nhtiles_ = (width + (tile_width_ >> 1)) / tile_width_; nvtiles_ = (height + (tile_height_ >> 1)) / tile_height_; if (tile_width) *tile_width = tile_width_; @@ -205,37 +275,33 @@ static INLINE int av1_get_rest_ntiles(int width, int height, int tilesize, return (nhtiles_ * nvtiles_); } -static INLINE void av1_get_rest_tile_limits( - int tile_idx, int subtile_idx, int subtile_bits, int nhtiles, int nvtiles, - int tile_width, int tile_height, int im_width, int im_height, int clamp_h, - int clamp_v, int *h_start, int *h_end, int *v_start, int *v_end) { +typedef struct { int h_start, h_end, v_start, v_end; } RestorationTileLimits; + +static INLINE RestorationTileLimits +av1_get_rest_tile_limits(int tile_idx, int nhtiles, int nvtiles, int tile_width, + int tile_height, int im_width, +#if CONFIG_STRIPED_LOOP_RESTORATION + int im_height, int subsampling_y) { +#else + int im_height) { +#endif const int htile_idx = tile_idx % nhtiles; const int vtile_idx = tile_idx / nhtiles; - *h_start = htile_idx * tile_width; - *v_start = vtile_idx * tile_height; - *h_end = (htile_idx < nhtiles - 1) ? *h_start + tile_width : im_width; - *v_end = (vtile_idx < nvtiles - 1) ? *v_start + tile_height : im_height; - if (subtile_bits) { - const int num_subtiles_1d = (1 << subtile_bits); - const int subtile_width = (*h_end - *h_start) >> subtile_bits; - const int subtile_height = (*v_end - *v_start) >> subtile_bits; - const int subtile_idx_h = subtile_idx & (num_subtiles_1d - 1); - const int subtile_idx_v = subtile_idx >> subtile_bits; - *h_start += subtile_idx_h * subtile_width; - *v_start += subtile_idx_v * subtile_height; - *h_end = subtile_idx_h == num_subtiles_1d - 1 ? *h_end - : *h_start + subtile_width; - *v_end = subtile_idx_v == num_subtiles_1d - 1 ? *v_end - : *v_start + subtile_height; - } - if (clamp_h) { - *h_start = AOMMAX(*h_start, clamp_h); - *h_end = AOMMIN(*h_end, im_width - clamp_h); - } - if (clamp_v) { - *v_start = AOMMAX(*v_start, clamp_v); - *v_end = AOMMIN(*v_end, im_height - clamp_v); - } + RestorationTileLimits limits; + limits.h_start = htile_idx * tile_width; + limits.v_start = vtile_idx * tile_height; + limits.h_end = + (htile_idx < nhtiles - 1) ? limits.h_start + tile_width : im_width; + limits.v_end = + (vtile_idx < nvtiles - 1) ? limits.v_start + tile_height : im_height; +#if CONFIG_STRIPED_LOOP_RESTORATION + // Offset the tile upwards to align with the restoration processing stripe + limits.v_start -= RESTORATION_TILE_OFFSET >> subsampling_y; + if (limits.v_start < 0) limits.v_start = 0; + if (limits.v_end < im_height) + limits.v_end -= RESTORATION_TILE_OFFSET >> subsampling_y; +#endif + return limits; } extern const sgr_params_type sgr_params[SGRPROJ_PARAMS]; @@ -248,15 +314,34 @@ int av1_alloc_restoration_struct(struct AV1Common *cm, int height); void av1_free_restoration_struct(RestorationInfo *rst_info); -void extend_frame(uint8_t *data, int width, int height, int stride); +void extend_frame(uint8_t *data, int width, int height, int stride, + int border_horz, int border_vert); #if CONFIG_HIGHBITDEPTH -void extend_frame_highbd(uint16_t *data, int width, int height, int stride); +void extend_frame_highbd(uint16_t *data, int width, int height, int stride, + int border_horz, int border_vert); #endif // CONFIG_HIGHBITDEPTH void decode_xq(int *xqd, int *xq); void av1_loop_restoration_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, RestorationInfo *rsi, int components_pattern, int partial_frame, YV12_BUFFER_CONFIG *dst); void av1_loop_restoration_precal(); + +// Return 1 iff the block at mi_row, mi_col with size bsize is a +// top-level superblock containing the top-left corner of at least one +// loop restoration tile. +// +// If the block is a top-level superblock, the function writes to +// *rcol0, *rcol1, *rrow0, *rrow1. The rectangle of indices given by +// [*rcol0, *rcol1) x [*rrow0, *rrow1) will point at the set of rtiles +// whose top left corners lie in the superblock. Note that the set is +// only nonempty if *rcol0 < *rcol1 and *rrow0 < *rrow1. +int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane, + int mi_row, int mi_col, BLOCK_SIZE bsize, + int *rcol0, int *rcol1, int *rrow0, + int *rrow1, int *nhtiles); + +void av1_loop_restoration_save_boundary_lines(YV12_BUFFER_CONFIG *frame, + struct AV1Common *cm); #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/scale.h b/third_party/aom/av1/common/scale.h index 3aa61eb34..900e6bf47 100644 --- a/third_party/aom/av1/common/scale.h +++ b/third_party/aom/av1/common/scale.h @@ -19,7 +19,7 @@ extern "C" { #endif -#define SCALE_DENOMINATOR 16 +#define SCALE_NUMERATOR 8 #define REF_SCALE_SHIFT 14 #define REF_NO_SCALE (1 << REF_SCALE_SHIFT) diff --git a/third_party/aom/av1/common/scan.c b/third_party/aom/av1/common/scan.c index 7bdeb6239..3c8f3d7ac 100644 --- a/third_party/aom/av1/common/scan.c +++ b/third_party/aom/av1/common/scan.c @@ -1171,6 +1171,328 @@ DECLARE_ALIGNED(16, static const int16_t, qtr_scan_32x32[1024]) = { }; #if CONFIG_TX64X64 +DECLARE_ALIGNED(16, static const int16_t, default_scan_32x64[2048]) = { + 0, 1, 32, 2, 33, 64, 3, 34, 65, 96, 4, 35, 66, + 97, 128, 5, 36, 67, 98, 129, 160, 6, 37, 68, 99, 130, + 161, 192, 7, 38, 69, 100, 131, 162, 193, 224, 8, 39, 70, + 101, 132, 163, 194, 225, 256, 9, 40, 71, 102, 133, 164, 195, + 226, 257, 288, 10, 41, 72, 103, 134, 165, 196, 227, 258, 289, + 320, 11, 42, 73, 104, 135, 166, 197, 228, 259, 290, 321, 352, + 12, 43, 74, 105, 136, 167, 198, 229, 260, 291, 322, 353, 384, + 13, 44, 75, 106, 137, 168, 199, 230, 261, 292, 323, 354, 385, + 416, 14, 45, 76, 107, 138, 169, 200, 231, 262, 293, 324, 355, + 386, 417, 448, 15, 46, 77, 108, 139, 170, 201, 232, 263, 294, + 325, 356, 387, 418, 449, 480, 16, 47, 78, 109, 140, 171, 202, + 233, 264, 295, 326, 357, 388, 419, 450, 481, 512, 17, 48, 79, + 110, 141, 172, 203, 234, 265, 296, 327, 358, 389, 420, 451, 482, + 513, 544, 18, 49, 80, 111, 142, 173, 204, 235, 266, 297, 328, + 359, 390, 421, 452, 483, 514, 545, 576, 19, 50, 81, 112, 143, + 174, 205, 236, 267, 298, 329, 360, 391, 422, 453, 484, 515, 546, + 577, 608, 20, 51, 82, 113, 144, 175, 206, 237, 268, 299, 330, + 361, 392, 423, 454, 485, 516, 547, 578, 609, 640, 21, 52, 83, + 114, 145, 176, 207, 238, 269, 300, 331, 362, 393, 424, 455, 486, + 517, 548, 579, 610, 641, 672, 22, 53, 84, 115, 146, 177, 208, + 239, 270, 301, 332, 363, 394, 425, 456, 487, 518, 549, 580, 611, + 642, 673, 704, 23, 54, 85, 116, 147, 178, 209, 240, 271, 302, + 333, 364, 395, 426, 457, 488, 519, 550, 581, 612, 643, 674, 705, + 736, 24, 55, 86, 117, 148, 179, 210, 241, 272, 303, 334, 365, + 396, 427, 458, 489, 520, 551, 582, 613, 644, 675, 706, 737, 768, + 25, 56, 87, 118, 149, 180, 211, 242, 273, 304, 335, 366, 397, + 428, 459, 490, 521, 552, 583, 614, 645, 676, 707, 738, 769, 800, + 26, 57, 88, 119, 150, 181, 212, 243, 274, 305, 336, 367, 398, + 429, 460, 491, 522, 553, 584, 615, 646, 677, 708, 739, 770, 801, + 832, 27, 58, 89, 120, 151, 182, 213, 244, 275, 306, 337, 368, + 399, 430, 461, 492, 523, 554, 585, 616, 647, 678, 709, 740, 771, + 802, 833, 864, 28, 59, 90, 121, 152, 183, 214, 245, 276, 307, + 338, 369, 400, 431, 462, 493, 524, 555, 586, 617, 648, 679, 710, + 741, 772, 803, 834, 865, 896, 29, 60, 91, 122, 153, 184, 215, + 246, 277, 308, 339, 370, 401, 432, 463, 494, 525, 556, 587, 618, + 649, 680, 711, 742, 773, 804, 835, 866, 897, 928, 30, 61, 92, + 123, 154, 185, 216, 247, 278, 309, 340, 371, 402, 433, 464, 495, + 526, 557, 588, 619, 650, 681, 712, 743, 774, 805, 836, 867, 898, + 929, 960, 31, 62, 93, 124, 155, 186, 217, 248, 279, 310, 341, + 372, 403, 434, 465, 496, 527, 558, 589, 620, 651, 682, 713, 744, + 775, 806, 837, 868, 899, 930, 961, 992, 63, 94, 125, 156, 187, + 218, 249, 280, 311, 342, 373, 404, 435, 466, 497, 528, 559, 590, + 621, 652, 683, 714, 745, 776, 807, 838, 869, 900, 931, 962, 993, + 1024, 95, 126, 157, 188, 219, 250, 281, 312, 343, 374, 405, 436, + 467, 498, 529, 560, 591, 622, 653, 684, 715, 746, 777, 808, 839, + 870, 901, 932, 963, 994, 1025, 1056, 127, 158, 189, 220, 251, 282, + 313, 344, 375, 406, 437, 468, 499, 530, 561, 592, 623, 654, 685, + 716, 747, 778, 809, 840, 871, 902, 933, 964, 995, 1026, 1057, 1088, + 159, 190, 221, 252, 283, 314, 345, 376, 407, 438, 469, 500, 531, + 562, 593, 624, 655, 686, 717, 748, 779, 810, 841, 872, 903, 934, + 965, 996, 1027, 1058, 1089, 1120, 191, 222, 253, 284, 315, 346, 377, + 408, 439, 470, 501, 532, 563, 594, 625, 656, 687, 718, 749, 780, + 811, 842, 873, 904, 935, 966, 997, 1028, 1059, 1090, 1121, 1152, 223, + 254, 285, 316, 347, 378, 409, 440, 471, 502, 533, 564, 595, 626, + 657, 688, 719, 750, 781, 812, 843, 874, 905, 936, 967, 998, 1029, + 1060, 1091, 1122, 1153, 1184, 255, 286, 317, 348, 379, 410, 441, 472, + 503, 534, 565, 596, 627, 658, 689, 720, 751, 782, 813, 844, 875, + 906, 937, 968, 999, 1030, 1061, 1092, 1123, 1154, 1185, 1216, 287, 318, + 349, 380, 411, 442, 473, 504, 535, 566, 597, 628, 659, 690, 721, + 752, 783, 814, 845, 876, 907, 938, 969, 1000, 1031, 1062, 1093, 1124, + 1155, 1186, 1217, 1248, 319, 350, 381, 412, 443, 474, 505, 536, 567, + 598, 629, 660, 691, 722, 753, 784, 815, 846, 877, 908, 939, 970, + 1001, 1032, 1063, 1094, 1125, 1156, 1187, 1218, 1249, 1280, 351, 382, 413, + 444, 475, 506, 537, 568, 599, 630, 661, 692, 723, 754, 785, 816, + 847, 878, 909, 940, 971, 1002, 1033, 1064, 1095, 1126, 1157, 1188, 1219, + 1250, 1281, 1312, 383, 414, 445, 476, 507, 538, 569, 600, 631, 662, + 693, 724, 755, 786, 817, 848, 879, 910, 941, 972, 1003, 1034, 1065, + 1096, 1127, 1158, 1189, 1220, 1251, 1282, 1313, 1344, 415, 446, 477, 508, + 539, 570, 601, 632, 663, 694, 725, 756, 787, 818, 849, 880, 911, + 942, 973, 1004, 1035, 1066, 1097, 1128, 1159, 1190, 1221, 1252, 1283, 1314, + 1345, 1376, 447, 478, 509, 540, 571, 602, 633, 664, 695, 726, 757, + 788, 819, 850, 881, 912, 943, 974, 1005, 1036, 1067, 1098, 1129, 1160, + 1191, 1222, 1253, 1284, 1315, 1346, 1377, 1408, 479, 510, 541, 572, 603, + 634, 665, 696, 727, 758, 789, 820, 851, 882, 913, 944, 975, 1006, + 1037, 1068, 1099, 1130, 1161, 1192, 1223, 1254, 1285, 1316, 1347, 1378, 1409, + 1440, 511, 542, 573, 604, 635, 666, 697, 728, 759, 790, 821, 852, + 883, 914, 945, 976, 1007, 1038, 1069, 1100, 1131, 1162, 1193, 1224, 1255, + 1286, 1317, 1348, 1379, 1410, 1441, 1472, 543, 574, 605, 636, 667, 698, + 729, 760, 791, 822, 853, 884, 915, 946, 977, 1008, 1039, 1070, 1101, + 1132, 1163, 1194, 1225, 1256, 1287, 1318, 1349, 1380, 1411, 1442, 1473, 1504, + 575, 606, 637, 668, 699, 730, 761, 792, 823, 854, 885, 916, 947, + 978, 1009, 1040, 1071, 1102, 1133, 1164, 1195, 1226, 1257, 1288, 1319, 1350, + 1381, 1412, 1443, 1474, 1505, 1536, 607, 638, 669, 700, 731, 762, 793, + 824, 855, 886, 917, 948, 979, 1010, 1041, 1072, 1103, 1134, 1165, 1196, + 1227, 1258, 1289, 1320, 1351, 1382, 1413, 1444, 1475, 1506, 1537, 1568, 639, + 670, 701, 732, 763, 794, 825, 856, 887, 918, 949, 980, 1011, 1042, + 1073, 1104, 1135, 1166, 1197, 1228, 1259, 1290, 1321, 1352, 1383, 1414, 1445, + 1476, 1507, 1538, 1569, 1600, 671, 702, 733, 764, 795, 826, 857, 888, + 919, 950, 981, 1012, 1043, 1074, 1105, 1136, 1167, 1198, 1229, 1260, 1291, + 1322, 1353, 1384, 1415, 1446, 1477, 1508, 1539, 1570, 1601, 1632, 703, 734, + 765, 796, 827, 858, 889, 920, 951, 982, 1013, 1044, 1075, 1106, 1137, + 1168, 1199, 1230, 1261, 1292, 1323, 1354, 1385, 1416, 1447, 1478, 1509, 1540, + 1571, 1602, 1633, 1664, 735, 766, 797, 828, 859, 890, 921, 952, 983, + 1014, 1045, 1076, 1107, 1138, 1169, 1200, 1231, 1262, 1293, 1324, 1355, 1386, + 1417, 1448, 1479, 1510, 1541, 1572, 1603, 1634, 1665, 1696, 767, 798, 829, + 860, 891, 922, 953, 984, 1015, 1046, 1077, 1108, 1139, 1170, 1201, 1232, + 1263, 1294, 1325, 1356, 1387, 1418, 1449, 1480, 1511, 1542, 1573, 1604, 1635, + 1666, 1697, 1728, 799, 830, 861, 892, 923, 954, 985, 1016, 1047, 1078, + 1109, 1140, 1171, 1202, 1233, 1264, 1295, 1326, 1357, 1388, 1419, 1450, 1481, + 1512, 1543, 1574, 1605, 1636, 1667, 1698, 1729, 1760, 831, 862, 893, 924, + 955, 986, 1017, 1048, 1079, 1110, 1141, 1172, 1203, 1234, 1265, 1296, 1327, + 1358, 1389, 1420, 1451, 1482, 1513, 1544, 1575, 1606, 1637, 1668, 1699, 1730, + 1761, 1792, 863, 894, 925, 956, 987, 1018, 1049, 1080, 1111, 1142, 1173, + 1204, 1235, 1266, 1297, 1328, 1359, 1390, 1421, 1452, 1483, 1514, 1545, 1576, + 1607, 1638, 1669, 1700, 1731, 1762, 1793, 1824, 895, 926, 957, 988, 1019, + 1050, 1081, 1112, 1143, 1174, 1205, 1236, 1267, 1298, 1329, 1360, 1391, 1422, + 1453, 1484, 1515, 1546, 1577, 1608, 1639, 1670, 1701, 1732, 1763, 1794, 1825, + 1856, 927, 958, 989, 1020, 1051, 1082, 1113, 1144, 1175, 1206, 1237, 1268, + 1299, 1330, 1361, 1392, 1423, 1454, 1485, 1516, 1547, 1578, 1609, 1640, 1671, + 1702, 1733, 1764, 1795, 1826, 1857, 1888, 959, 990, 1021, 1052, 1083, 1114, + 1145, 1176, 1207, 1238, 1269, 1300, 1331, 1362, 1393, 1424, 1455, 1486, 1517, + 1548, 1579, 1610, 1641, 1672, 1703, 1734, 1765, 1796, 1827, 1858, 1889, 1920, + 991, 1022, 1053, 1084, 1115, 1146, 1177, 1208, 1239, 1270, 1301, 1332, 1363, + 1394, 1425, 1456, 1487, 1518, 1549, 1580, 1611, 1642, 1673, 1704, 1735, 1766, + 1797, 1828, 1859, 1890, 1921, 1952, 1023, 1054, 1085, 1116, 1147, 1178, 1209, + 1240, 1271, 1302, 1333, 1364, 1395, 1426, 1457, 1488, 1519, 1550, 1581, 1612, + 1643, 1674, 1705, 1736, 1767, 1798, 1829, 1860, 1891, 1922, 1953, 1984, 1055, + 1086, 1117, 1148, 1179, 1210, 1241, 1272, 1303, 1334, 1365, 1396, 1427, 1458, + 1489, 1520, 1551, 1582, 1613, 1644, 1675, 1706, 1737, 1768, 1799, 1830, 1861, + 1892, 1923, 1954, 1985, 2016, 1087, 1118, 1149, 1180, 1211, 1242, 1273, 1304, + 1335, 1366, 1397, 1428, 1459, 1490, 1521, 1552, 1583, 1614, 1645, 1676, 1707, + 1738, 1769, 1800, 1831, 1862, 1893, 1924, 1955, 1986, 2017, 1119, 1150, 1181, + 1212, 1243, 1274, 1305, 1336, 1367, 1398, 1429, 1460, 1491, 1522, 1553, 1584, + 1615, 1646, 1677, 1708, 1739, 1770, 1801, 1832, 1863, 1894, 1925, 1956, 1987, + 2018, 1151, 1182, 1213, 1244, 1275, 1306, 1337, 1368, 1399, 1430, 1461, 1492, + 1523, 1554, 1585, 1616, 1647, 1678, 1709, 1740, 1771, 1802, 1833, 1864, 1895, + 1926, 1957, 1988, 2019, 1183, 1214, 1245, 1276, 1307, 1338, 1369, 1400, 1431, + 1462, 1493, 1524, 1555, 1586, 1617, 1648, 1679, 1710, 1741, 1772, 1803, 1834, + 1865, 1896, 1927, 1958, 1989, 2020, 1215, 1246, 1277, 1308, 1339, 1370, 1401, + 1432, 1463, 1494, 1525, 1556, 1587, 1618, 1649, 1680, 1711, 1742, 1773, 1804, + 1835, 1866, 1897, 1928, 1959, 1990, 2021, 1247, 1278, 1309, 1340, 1371, 1402, + 1433, 1464, 1495, 1526, 1557, 1588, 1619, 1650, 1681, 1712, 1743, 1774, 1805, + 1836, 1867, 1898, 1929, 1960, 1991, 2022, 1279, 1310, 1341, 1372, 1403, 1434, + 1465, 1496, 1527, 1558, 1589, 1620, 1651, 1682, 1713, 1744, 1775, 1806, 1837, + 1868, 1899, 1930, 1961, 1992, 2023, 1311, 1342, 1373, 1404, 1435, 1466, 1497, + 1528, 1559, 1590, 1621, 1652, 1683, 1714, 1745, 1776, 1807, 1838, 1869, 1900, + 1931, 1962, 1993, 2024, 1343, 1374, 1405, 1436, 1467, 1498, 1529, 1560, 1591, + 1622, 1653, 1684, 1715, 1746, 1777, 1808, 1839, 1870, 1901, 1932, 1963, 1994, + 2025, 1375, 1406, 1437, 1468, 1499, 1530, 1561, 1592, 1623, 1654, 1685, 1716, + 1747, 1778, 1809, 1840, 1871, 1902, 1933, 1964, 1995, 2026, 1407, 1438, 1469, + 1500, 1531, 1562, 1593, 1624, 1655, 1686, 1717, 1748, 1779, 1810, 1841, 1872, + 1903, 1934, 1965, 1996, 2027, 1439, 1470, 1501, 1532, 1563, 1594, 1625, 1656, + 1687, 1718, 1749, 1780, 1811, 1842, 1873, 1904, 1935, 1966, 1997, 2028, 1471, + 1502, 1533, 1564, 1595, 1626, 1657, 1688, 1719, 1750, 1781, 1812, 1843, 1874, + 1905, 1936, 1967, 1998, 2029, 1503, 1534, 1565, 1596, 1627, 1658, 1689, 1720, + 1751, 1782, 1813, 1844, 1875, 1906, 1937, 1968, 1999, 2030, 1535, 1566, 1597, + 1628, 1659, 1690, 1721, 1752, 1783, 1814, 1845, 1876, 1907, 1938, 1969, 2000, + 2031, 1567, 1598, 1629, 1660, 1691, 1722, 1753, 1784, 1815, 1846, 1877, 1908, + 1939, 1970, 2001, 2032, 1599, 1630, 1661, 1692, 1723, 1754, 1785, 1816, 1847, + 1878, 1909, 1940, 1971, 2002, 2033, 1631, 1662, 1693, 1724, 1755, 1786, 1817, + 1848, 1879, 1910, 1941, 1972, 2003, 2034, 1663, 1694, 1725, 1756, 1787, 1818, + 1849, 1880, 1911, 1942, 1973, 2004, 2035, 1695, 1726, 1757, 1788, 1819, 1850, + 1881, 1912, 1943, 1974, 2005, 2036, 1727, 1758, 1789, 1820, 1851, 1882, 1913, + 1944, 1975, 2006, 2037, 1759, 1790, 1821, 1852, 1883, 1914, 1945, 1976, 2007, + 2038, 1791, 1822, 1853, 1884, 1915, 1946, 1977, 2008, 2039, 1823, 1854, 1885, + 1916, 1947, 1978, 2009, 2040, 1855, 1886, 1917, 1948, 1979, 2010, 2041, 1887, + 1918, 1949, 1980, 2011, 2042, 1919, 1950, 1981, 2012, 2043, 1951, 1982, 2013, + 2044, 1983, 2014, 2045, 2015, 2046, 2047, +}; + +DECLARE_ALIGNED(16, static const int16_t, default_scan_64x32[2048]) = { + 0, 1, 64, 2, 65, 128, 3, 66, 129, 192, 4, 67, 130, + 193, 256, 5, 68, 131, 194, 257, 320, 6, 69, 132, 195, 258, + 321, 384, 7, 70, 133, 196, 259, 322, 385, 448, 8, 71, 134, + 197, 260, 323, 386, 449, 512, 9, 72, 135, 198, 261, 324, 387, + 450, 513, 576, 10, 73, 136, 199, 262, 325, 388, 451, 514, 577, + 640, 11, 74, 137, 200, 263, 326, 389, 452, 515, 578, 641, 704, + 12, 75, 138, 201, 264, 327, 390, 453, 516, 579, 642, 705, 768, + 13, 76, 139, 202, 265, 328, 391, 454, 517, 580, 643, 706, 769, + 832, 14, 77, 140, 203, 266, 329, 392, 455, 518, 581, 644, 707, + 770, 833, 896, 15, 78, 141, 204, 267, 330, 393, 456, 519, 582, + 645, 708, 771, 834, 897, 960, 16, 79, 142, 205, 268, 331, 394, + 457, 520, 583, 646, 709, 772, 835, 898, 961, 1024, 17, 80, 143, + 206, 269, 332, 395, 458, 521, 584, 647, 710, 773, 836, 899, 962, + 1025, 1088, 18, 81, 144, 207, 270, 333, 396, 459, 522, 585, 648, + 711, 774, 837, 900, 963, 1026, 1089, 1152, 19, 82, 145, 208, 271, + 334, 397, 460, 523, 586, 649, 712, 775, 838, 901, 964, 1027, 1090, + 1153, 1216, 20, 83, 146, 209, 272, 335, 398, 461, 524, 587, 650, + 713, 776, 839, 902, 965, 1028, 1091, 1154, 1217, 1280, 21, 84, 147, + 210, 273, 336, 399, 462, 525, 588, 651, 714, 777, 840, 903, 966, + 1029, 1092, 1155, 1218, 1281, 1344, 22, 85, 148, 211, 274, 337, 400, + 463, 526, 589, 652, 715, 778, 841, 904, 967, 1030, 1093, 1156, 1219, + 1282, 1345, 1408, 23, 86, 149, 212, 275, 338, 401, 464, 527, 590, + 653, 716, 779, 842, 905, 968, 1031, 1094, 1157, 1220, 1283, 1346, 1409, + 1472, 24, 87, 150, 213, 276, 339, 402, 465, 528, 591, 654, 717, + 780, 843, 906, 969, 1032, 1095, 1158, 1221, 1284, 1347, 1410, 1473, 1536, + 25, 88, 151, 214, 277, 340, 403, 466, 529, 592, 655, 718, 781, + 844, 907, 970, 1033, 1096, 1159, 1222, 1285, 1348, 1411, 1474, 1537, 1600, + 26, 89, 152, 215, 278, 341, 404, 467, 530, 593, 656, 719, 782, + 845, 908, 971, 1034, 1097, 1160, 1223, 1286, 1349, 1412, 1475, 1538, 1601, + 1664, 27, 90, 153, 216, 279, 342, 405, 468, 531, 594, 657, 720, + 783, 846, 909, 972, 1035, 1098, 1161, 1224, 1287, 1350, 1413, 1476, 1539, + 1602, 1665, 1728, 28, 91, 154, 217, 280, 343, 406, 469, 532, 595, + 658, 721, 784, 847, 910, 973, 1036, 1099, 1162, 1225, 1288, 1351, 1414, + 1477, 1540, 1603, 1666, 1729, 1792, 29, 92, 155, 218, 281, 344, 407, + 470, 533, 596, 659, 722, 785, 848, 911, 974, 1037, 1100, 1163, 1226, + 1289, 1352, 1415, 1478, 1541, 1604, 1667, 1730, 1793, 1856, 30, 93, 156, + 219, 282, 345, 408, 471, 534, 597, 660, 723, 786, 849, 912, 975, + 1038, 1101, 1164, 1227, 1290, 1353, 1416, 1479, 1542, 1605, 1668, 1731, 1794, + 1857, 1920, 31, 94, 157, 220, 283, 346, 409, 472, 535, 598, 661, + 724, 787, 850, 913, 976, 1039, 1102, 1165, 1228, 1291, 1354, 1417, 1480, + 1543, 1606, 1669, 1732, 1795, 1858, 1921, 1984, 32, 95, 158, 221, 284, + 347, 410, 473, 536, 599, 662, 725, 788, 851, 914, 977, 1040, 1103, + 1166, 1229, 1292, 1355, 1418, 1481, 1544, 1607, 1670, 1733, 1796, 1859, 1922, + 1985, 33, 96, 159, 222, 285, 348, 411, 474, 537, 600, 663, 726, + 789, 852, 915, 978, 1041, 1104, 1167, 1230, 1293, 1356, 1419, 1482, 1545, + 1608, 1671, 1734, 1797, 1860, 1923, 1986, 34, 97, 160, 223, 286, 349, + 412, 475, 538, 601, 664, 727, 790, 853, 916, 979, 1042, 1105, 1168, + 1231, 1294, 1357, 1420, 1483, 1546, 1609, 1672, 1735, 1798, 1861, 1924, 1987, + 35, 98, 161, 224, 287, 350, 413, 476, 539, 602, 665, 728, 791, + 854, 917, 980, 1043, 1106, 1169, 1232, 1295, 1358, 1421, 1484, 1547, 1610, + 1673, 1736, 1799, 1862, 1925, 1988, 36, 99, 162, 225, 288, 351, 414, + 477, 540, 603, 666, 729, 792, 855, 918, 981, 1044, 1107, 1170, 1233, + 1296, 1359, 1422, 1485, 1548, 1611, 1674, 1737, 1800, 1863, 1926, 1989, 37, + 100, 163, 226, 289, 352, 415, 478, 541, 604, 667, 730, 793, 856, + 919, 982, 1045, 1108, 1171, 1234, 1297, 1360, 1423, 1486, 1549, 1612, 1675, + 1738, 1801, 1864, 1927, 1990, 38, 101, 164, 227, 290, 353, 416, 479, + 542, 605, 668, 731, 794, 857, 920, 983, 1046, 1109, 1172, 1235, 1298, + 1361, 1424, 1487, 1550, 1613, 1676, 1739, 1802, 1865, 1928, 1991, 39, 102, + 165, 228, 291, 354, 417, 480, 543, 606, 669, 732, 795, 858, 921, + 984, 1047, 1110, 1173, 1236, 1299, 1362, 1425, 1488, 1551, 1614, 1677, 1740, + 1803, 1866, 1929, 1992, 40, 103, 166, 229, 292, 355, 418, 481, 544, + 607, 670, 733, 796, 859, 922, 985, 1048, 1111, 1174, 1237, 1300, 1363, + 1426, 1489, 1552, 1615, 1678, 1741, 1804, 1867, 1930, 1993, 41, 104, 167, + 230, 293, 356, 419, 482, 545, 608, 671, 734, 797, 860, 923, 986, + 1049, 1112, 1175, 1238, 1301, 1364, 1427, 1490, 1553, 1616, 1679, 1742, 1805, + 1868, 1931, 1994, 42, 105, 168, 231, 294, 357, 420, 483, 546, 609, + 672, 735, 798, 861, 924, 987, 1050, 1113, 1176, 1239, 1302, 1365, 1428, + 1491, 1554, 1617, 1680, 1743, 1806, 1869, 1932, 1995, 43, 106, 169, 232, + 295, 358, 421, 484, 547, 610, 673, 736, 799, 862, 925, 988, 1051, + 1114, 1177, 1240, 1303, 1366, 1429, 1492, 1555, 1618, 1681, 1744, 1807, 1870, + 1933, 1996, 44, 107, 170, 233, 296, 359, 422, 485, 548, 611, 674, + 737, 800, 863, 926, 989, 1052, 1115, 1178, 1241, 1304, 1367, 1430, 1493, + 1556, 1619, 1682, 1745, 1808, 1871, 1934, 1997, 45, 108, 171, 234, 297, + 360, 423, 486, 549, 612, 675, 738, 801, 864, 927, 990, 1053, 1116, + 1179, 1242, 1305, 1368, 1431, 1494, 1557, 1620, 1683, 1746, 1809, 1872, 1935, + 1998, 46, 109, 172, 235, 298, 361, 424, 487, 550, 613, 676, 739, + 802, 865, 928, 991, 1054, 1117, 1180, 1243, 1306, 1369, 1432, 1495, 1558, + 1621, 1684, 1747, 1810, 1873, 1936, 1999, 47, 110, 173, 236, 299, 362, + 425, 488, 551, 614, 677, 740, 803, 866, 929, 992, 1055, 1118, 1181, + 1244, 1307, 1370, 1433, 1496, 1559, 1622, 1685, 1748, 1811, 1874, 1937, 2000, + 48, 111, 174, 237, 300, 363, 426, 489, 552, 615, 678, 741, 804, + 867, 930, 993, 1056, 1119, 1182, 1245, 1308, 1371, 1434, 1497, 1560, 1623, + 1686, 1749, 1812, 1875, 1938, 2001, 49, 112, 175, 238, 301, 364, 427, + 490, 553, 616, 679, 742, 805, 868, 931, 994, 1057, 1120, 1183, 1246, + 1309, 1372, 1435, 1498, 1561, 1624, 1687, 1750, 1813, 1876, 1939, 2002, 50, + 113, 176, 239, 302, 365, 428, 491, 554, 617, 680, 743, 806, 869, + 932, 995, 1058, 1121, 1184, 1247, 1310, 1373, 1436, 1499, 1562, 1625, 1688, + 1751, 1814, 1877, 1940, 2003, 51, 114, 177, 240, 303, 366, 429, 492, + 555, 618, 681, 744, 807, 870, 933, 996, 1059, 1122, 1185, 1248, 1311, + 1374, 1437, 1500, 1563, 1626, 1689, 1752, 1815, 1878, 1941, 2004, 52, 115, + 178, 241, 304, 367, 430, 493, 556, 619, 682, 745, 808, 871, 934, + 997, 1060, 1123, 1186, 1249, 1312, 1375, 1438, 1501, 1564, 1627, 1690, 1753, + 1816, 1879, 1942, 2005, 53, 116, 179, 242, 305, 368, 431, 494, 557, + 620, 683, 746, 809, 872, 935, 998, 1061, 1124, 1187, 1250, 1313, 1376, + 1439, 1502, 1565, 1628, 1691, 1754, 1817, 1880, 1943, 2006, 54, 117, 180, + 243, 306, 369, 432, 495, 558, 621, 684, 747, 810, 873, 936, 999, + 1062, 1125, 1188, 1251, 1314, 1377, 1440, 1503, 1566, 1629, 1692, 1755, 1818, + 1881, 1944, 2007, 55, 118, 181, 244, 307, 370, 433, 496, 559, 622, + 685, 748, 811, 874, 937, 1000, 1063, 1126, 1189, 1252, 1315, 1378, 1441, + 1504, 1567, 1630, 1693, 1756, 1819, 1882, 1945, 2008, 56, 119, 182, 245, + 308, 371, 434, 497, 560, 623, 686, 749, 812, 875, 938, 1001, 1064, + 1127, 1190, 1253, 1316, 1379, 1442, 1505, 1568, 1631, 1694, 1757, 1820, 1883, + 1946, 2009, 57, 120, 183, 246, 309, 372, 435, 498, 561, 624, 687, + 750, 813, 876, 939, 1002, 1065, 1128, 1191, 1254, 1317, 1380, 1443, 1506, + 1569, 1632, 1695, 1758, 1821, 1884, 1947, 2010, 58, 121, 184, 247, 310, + 373, 436, 499, 562, 625, 688, 751, 814, 877, 940, 1003, 1066, 1129, + 1192, 1255, 1318, 1381, 1444, 1507, 1570, 1633, 1696, 1759, 1822, 1885, 1948, + 2011, 59, 122, 185, 248, 311, 374, 437, 500, 563, 626, 689, 752, + 815, 878, 941, 1004, 1067, 1130, 1193, 1256, 1319, 1382, 1445, 1508, 1571, + 1634, 1697, 1760, 1823, 1886, 1949, 2012, 60, 123, 186, 249, 312, 375, + 438, 501, 564, 627, 690, 753, 816, 879, 942, 1005, 1068, 1131, 1194, + 1257, 1320, 1383, 1446, 1509, 1572, 1635, 1698, 1761, 1824, 1887, 1950, 2013, + 61, 124, 187, 250, 313, 376, 439, 502, 565, 628, 691, 754, 817, + 880, 943, 1006, 1069, 1132, 1195, 1258, 1321, 1384, 1447, 1510, 1573, 1636, + 1699, 1762, 1825, 1888, 1951, 2014, 62, 125, 188, 251, 314, 377, 440, + 503, 566, 629, 692, 755, 818, 881, 944, 1007, 1070, 1133, 1196, 1259, + 1322, 1385, 1448, 1511, 1574, 1637, 1700, 1763, 1826, 1889, 1952, 2015, 63, + 126, 189, 252, 315, 378, 441, 504, 567, 630, 693, 756, 819, 882, + 945, 1008, 1071, 1134, 1197, 1260, 1323, 1386, 1449, 1512, 1575, 1638, 1701, + 1764, 1827, 1890, 1953, 2016, 127, 190, 253, 316, 379, 442, 505, 568, + 631, 694, 757, 820, 883, 946, 1009, 1072, 1135, 1198, 1261, 1324, 1387, + 1450, 1513, 1576, 1639, 1702, 1765, 1828, 1891, 1954, 2017, 191, 254, 317, + 380, 443, 506, 569, 632, 695, 758, 821, 884, 947, 1010, 1073, 1136, + 1199, 1262, 1325, 1388, 1451, 1514, 1577, 1640, 1703, 1766, 1829, 1892, 1955, + 2018, 255, 318, 381, 444, 507, 570, 633, 696, 759, 822, 885, 948, + 1011, 1074, 1137, 1200, 1263, 1326, 1389, 1452, 1515, 1578, 1641, 1704, 1767, + 1830, 1893, 1956, 2019, 319, 382, 445, 508, 571, 634, 697, 760, 823, + 886, 949, 1012, 1075, 1138, 1201, 1264, 1327, 1390, 1453, 1516, 1579, 1642, + 1705, 1768, 1831, 1894, 1957, 2020, 383, 446, 509, 572, 635, 698, 761, + 824, 887, 950, 1013, 1076, 1139, 1202, 1265, 1328, 1391, 1454, 1517, 1580, + 1643, 1706, 1769, 1832, 1895, 1958, 2021, 447, 510, 573, 636, 699, 762, + 825, 888, 951, 1014, 1077, 1140, 1203, 1266, 1329, 1392, 1455, 1518, 1581, + 1644, 1707, 1770, 1833, 1896, 1959, 2022, 511, 574, 637, 700, 763, 826, + 889, 952, 1015, 1078, 1141, 1204, 1267, 1330, 1393, 1456, 1519, 1582, 1645, + 1708, 1771, 1834, 1897, 1960, 2023, 575, 638, 701, 764, 827, 890, 953, + 1016, 1079, 1142, 1205, 1268, 1331, 1394, 1457, 1520, 1583, 1646, 1709, 1772, + 1835, 1898, 1961, 2024, 639, 702, 765, 828, 891, 954, 1017, 1080, 1143, + 1206, 1269, 1332, 1395, 1458, 1521, 1584, 1647, 1710, 1773, 1836, 1899, 1962, + 2025, 703, 766, 829, 892, 955, 1018, 1081, 1144, 1207, 1270, 1333, 1396, + 1459, 1522, 1585, 1648, 1711, 1774, 1837, 1900, 1963, 2026, 767, 830, 893, + 956, 1019, 1082, 1145, 1208, 1271, 1334, 1397, 1460, 1523, 1586, 1649, 1712, + 1775, 1838, 1901, 1964, 2027, 831, 894, 957, 1020, 1083, 1146, 1209, 1272, + 1335, 1398, 1461, 1524, 1587, 1650, 1713, 1776, 1839, 1902, 1965, 2028, 895, + 958, 1021, 1084, 1147, 1210, 1273, 1336, 1399, 1462, 1525, 1588, 1651, 1714, + 1777, 1840, 1903, 1966, 2029, 959, 1022, 1085, 1148, 1211, 1274, 1337, 1400, + 1463, 1526, 1589, 1652, 1715, 1778, 1841, 1904, 1967, 2030, 1023, 1086, 1149, + 1212, 1275, 1338, 1401, 1464, 1527, 1590, 1653, 1716, 1779, 1842, 1905, 1968, + 2031, 1087, 1150, 1213, 1276, 1339, 1402, 1465, 1528, 1591, 1654, 1717, 1780, + 1843, 1906, 1969, 2032, 1151, 1214, 1277, 1340, 1403, 1466, 1529, 1592, 1655, + 1718, 1781, 1844, 1907, 1970, 2033, 1215, 1278, 1341, 1404, 1467, 1530, 1593, + 1656, 1719, 1782, 1845, 1908, 1971, 2034, 1279, 1342, 1405, 1468, 1531, 1594, + 1657, 1720, 1783, 1846, 1909, 1972, 2035, 1343, 1406, 1469, 1532, 1595, 1658, + 1721, 1784, 1847, 1910, 1973, 2036, 1407, 1470, 1533, 1596, 1659, 1722, 1785, + 1848, 1911, 1974, 2037, 1471, 1534, 1597, 1660, 1723, 1786, 1849, 1912, 1975, + 2038, 1535, 1598, 1661, 1724, 1787, 1850, 1913, 1976, 2039, 1599, 1662, 1725, + 1788, 1851, 1914, 1977, 2040, 1663, 1726, 1789, 1852, 1915, 1978, 2041, 1727, + 1790, 1853, 1916, 1979, 2042, 1791, 1854, 1917, 1980, 2043, 1855, 1918, 1981, + 2044, 1919, 1982, 2045, 1983, 2046, 2047, +}; + DECLARE_ALIGNED(16, static const int16_t, default_scan_64x64[4096]) = { 0, 1, 64, 65, 2, 128, 66, 129, 130, 3, 192, 67, 193, 131, 194, 4, 256, 68, 257, 195, 132, 258, 5, 196, 259, 320, @@ -3614,6 +3936,646 @@ DECLARE_ALIGNED(16, static const int16_t, #if CONFIG_TX64X64 DECLARE_ALIGNED(16, static const int16_t, + default_scan_32x64_neighbors[2049 * MAX_NEIGHBORS]) = { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 32, 32, 32, 2, + 2, 2, 33, 33, 64, 64, 64, 3, 3, 3, 34, 34, 65, + 65, 96, 96, 96, 4, 4, 4, 35, 35, 66, 66, 97, 97, + 128, 128, 128, 5, 5, 5, 36, 36, 67, 67, 98, 98, 129, + 129, 160, 160, 160, 6, 6, 6, 37, 37, 68, 68, 99, 99, + 130, 130, 161, 161, 192, 192, 192, 7, 7, 7, 38, 38, 69, + 69, 100, 100, 131, 131, 162, 162, 193, 193, 224, 224, 224, 8, + 8, 8, 39, 39, 70, 70, 101, 101, 132, 132, 163, 163, 194, + 194, 225, 225, 256, 256, 256, 9, 9, 9, 40, 40, 71, 71, + 102, 102, 133, 133, 164, 164, 195, 195, 226, 226, 257, 257, 288, + 288, 288, 10, 10, 10, 41, 41, 72, 72, 103, 103, 134, 134, + 165, 165, 196, 196, 227, 227, 258, 258, 289, 289, 320, 320, 320, + 11, 11, 11, 42, 42, 73, 73, 104, 104, 135, 135, 166, 166, + 197, 197, 228, 228, 259, 259, 290, 290, 321, 321, 352, 352, 352, + 12, 12, 12, 43, 43, 74, 74, 105, 105, 136, 136, 167, 167, + 198, 198, 229, 229, 260, 260, 291, 291, 322, 322, 353, 353, 384, + 384, 384, 13, 13, 13, 44, 44, 75, 75, 106, 106, 137, 137, + 168, 168, 199, 199, 230, 230, 261, 261, 292, 292, 323, 323, 354, + 354, 385, 385, 416, 416, 416, 14, 14, 14, 45, 45, 76, 76, + 107, 107, 138, 138, 169, 169, 200, 200, 231, 231, 262, 262, 293, + 293, 324, 324, 355, 355, 386, 386, 417, 417, 448, 448, 448, 15, + 15, 15, 46, 46, 77, 77, 108, 108, 139, 139, 170, 170, 201, + 201, 232, 232, 263, 263, 294, 294, 325, 325, 356, 356, 387, 387, + 418, 418, 449, 449, 480, 480, 480, 16, 16, 16, 47, 47, 78, + 78, 109, 109, 140, 140, 171, 171, 202, 202, 233, 233, 264, 264, + 295, 295, 326, 326, 357, 357, 388, 388, 419, 419, 450, 450, 481, + 481, 512, 512, 512, 17, 17, 17, 48, 48, 79, 79, 110, 110, + 141, 141, 172, 172, 203, 203, 234, 234, 265, 265, 296, 296, 327, + 327, 358, 358, 389, 389, 420, 420, 451, 451, 482, 482, 513, 513, + 544, 544, 544, 18, 18, 18, 49, 49, 80, 80, 111, 111, 142, + 142, 173, 173, 204, 204, 235, 235, 266, 266, 297, 297, 328, 328, + 359, 359, 390, 390, 421, 421, 452, 452, 483, 483, 514, 514, 545, + 545, 576, 576, 576, 19, 19, 19, 50, 50, 81, 81, 112, 112, + 143, 143, 174, 174, 205, 205, 236, 236, 267, 267, 298, 298, 329, + 329, 360, 360, 391, 391, 422, 422, 453, 453, 484, 484, 515, 515, + 546, 546, 577, 577, 608, 608, 608, 20, 20, 20, 51, 51, 82, + 82, 113, 113, 144, 144, 175, 175, 206, 206, 237, 237, 268, 268, + 299, 299, 330, 330, 361, 361, 392, 392, 423, 423, 454, 454, 485, + 485, 516, 516, 547, 547, 578, 578, 609, 609, 640, 640, 640, 21, + 21, 21, 52, 52, 83, 83, 114, 114, 145, 145, 176, 176, 207, + 207, 238, 238, 269, 269, 300, 300, 331, 331, 362, 362, 393, 393, + 424, 424, 455, 455, 486, 486, 517, 517, 548, 548, 579, 579, 610, + 610, 641, 641, 672, 672, 672, 22, 22, 22, 53, 53, 84, 84, + 115, 115, 146, 146, 177, 177, 208, 208, 239, 239, 270, 270, 301, + 301, 332, 332, 363, 363, 394, 394, 425, 425, 456, 456, 487, 487, + 518, 518, 549, 549, 580, 580, 611, 611, 642, 642, 673, 673, 704, + 704, 704, 23, 23, 23, 54, 54, 85, 85, 116, 116, 147, 147, + 178, 178, 209, 209, 240, 240, 271, 271, 302, 302, 333, 333, 364, + 364, 395, 395, 426, 426, 457, 457, 488, 488, 519, 519, 550, 550, + 581, 581, 612, 612, 643, 643, 674, 674, 705, 705, 736, 736, 736, + 24, 24, 24, 55, 55, 86, 86, 117, 117, 148, 148, 179, 179, + 210, 210, 241, 241, 272, 272, 303, 303, 334, 334, 365, 365, 396, + 396, 427, 427, 458, 458, 489, 489, 520, 520, 551, 551, 582, 582, + 613, 613, 644, 644, 675, 675, 706, 706, 737, 737, 768, 768, 768, + 25, 25, 25, 56, 56, 87, 87, 118, 118, 149, 149, 180, 180, + 211, 211, 242, 242, 273, 273, 304, 304, 335, 335, 366, 366, 397, + 397, 428, 428, 459, 459, 490, 490, 521, 521, 552, 552, 583, 583, + 614, 614, 645, 645, 676, 676, 707, 707, 738, 738, 769, 769, 800, + 800, 800, 26, 26, 26, 57, 57, 88, 88, 119, 119, 150, 150, + 181, 181, 212, 212, 243, 243, 274, 274, 305, 305, 336, 336, 367, + 367, 398, 398, 429, 429, 460, 460, 491, 491, 522, 522, 553, 553, + 584, 584, 615, 615, 646, 646, 677, 677, 708, 708, 739, 739, 770, + 770, 801, 801, 832, 832, 832, 27, 27, 27, 58, 58, 89, 89, + 120, 120, 151, 151, 182, 182, 213, 213, 244, 244, 275, 275, 306, + 306, 337, 337, 368, 368, 399, 399, 430, 430, 461, 461, 492, 492, + 523, 523, 554, 554, 585, 585, 616, 616, 647, 647, 678, 678, 709, + 709, 740, 740, 771, 771, 802, 802, 833, 833, 864, 864, 864, 28, + 28, 28, 59, 59, 90, 90, 121, 121, 152, 152, 183, 183, 214, + 214, 245, 245, 276, 276, 307, 307, 338, 338, 369, 369, 400, 400, + 431, 431, 462, 462, 493, 493, 524, 524, 555, 555, 586, 586, 617, + 617, 648, 648, 679, 679, 710, 710, 741, 741, 772, 772, 803, 803, + 834, 834, 865, 865, 896, 896, 896, 29, 29, 29, 60, 60, 91, + 91, 122, 122, 153, 153, 184, 184, 215, 215, 246, 246, 277, 277, + 308, 308, 339, 339, 370, 370, 401, 401, 432, 432, 463, 463, 494, + 494, 525, 525, 556, 556, 587, 587, 618, 618, 649, 649, 680, 680, + 711, 711, 742, 742, 773, 773, 804, 804, 835, 835, 866, 866, 897, + 897, 928, 928, 928, 30, 30, 30, 61, 61, 92, 92, 123, 123, + 154, 154, 185, 185, 216, 216, 247, 247, 278, 278, 309, 309, 340, + 340, 371, 371, 402, 402, 433, 433, 464, 464, 495, 495, 526, 526, + 557, 557, 588, 588, 619, 619, 650, 650, 681, 681, 712, 712, 743, + 743, 774, 774, 805, 805, 836, 836, 867, 867, 898, 898, 929, 929, + 960, 960, 960, 31, 62, 62, 93, 93, 124, 124, 155, 155, 186, + 186, 217, 217, 248, 248, 279, 279, 310, 310, 341, 341, 372, 372, + 403, 403, 434, 434, 465, 465, 496, 496, 527, 527, 558, 558, 589, + 589, 620, 620, 651, 651, 682, 682, 713, 713, 744, 744, 775, 775, + 806, 806, 837, 837, 868, 868, 899, 899, 930, 930, 961, 961, 992, + 992, 992, 63, 94, 94, 125, 125, 156, 156, 187, 187, 218, 218, + 249, 249, 280, 280, 311, 311, 342, 342, 373, 373, 404, 404, 435, + 435, 466, 466, 497, 497, 528, 528, 559, 559, 590, 590, 621, 621, + 652, 652, 683, 683, 714, 714, 745, 745, 776, 776, 807, 807, 838, + 838, 869, 869, 900, 900, 931, 931, 962, 962, 993, 993, 1024, 1024, + 1024, 95, 126, 126, 157, 157, 188, 188, 219, 219, 250, 250, 281, + 281, 312, 312, 343, 343, 374, 374, 405, 405, 436, 436, 467, 467, + 498, 498, 529, 529, 560, 560, 591, 591, 622, 622, 653, 653, 684, + 684, 715, 715, 746, 746, 777, 777, 808, 808, 839, 839, 870, 870, + 901, 901, 932, 932, 963, 963, 994, 994, 1025, 1025, 1056, 1056, 1056, + 127, 158, 158, 189, 189, 220, 220, 251, 251, 282, 282, 313, 313, + 344, 344, 375, 375, 406, 406, 437, 437, 468, 468, 499, 499, 530, + 530, 561, 561, 592, 592, 623, 623, 654, 654, 685, 685, 716, 716, + 747, 747, 778, 778, 809, 809, 840, 840, 871, 871, 902, 902, 933, + 933, 964, 964, 995, 995, 1026, 1026, 1057, 1057, 1088, 1088, 1088, 159, + 190, 190, 221, 221, 252, 252, 283, 283, 314, 314, 345, 345, 376, + 376, 407, 407, 438, 438, 469, 469, 500, 500, 531, 531, 562, 562, + 593, 593, 624, 624, 655, 655, 686, 686, 717, 717, 748, 748, 779, + 779, 810, 810, 841, 841, 872, 872, 903, 903, 934, 934, 965, 965, + 996, 996, 1027, 1027, 1058, 1058, 1089, 1089, 1120, 1120, 1120, 191, 222, + 222, 253, 253, 284, 284, 315, 315, 346, 346, 377, 377, 408, 408, + 439, 439, 470, 470, 501, 501, 532, 532, 563, 563, 594, 594, 625, + 625, 656, 656, 687, 687, 718, 718, 749, 749, 780, 780, 811, 811, + 842, 842, 873, 873, 904, 904, 935, 935, 966, 966, 997, 997, 1028, + 1028, 1059, 1059, 1090, 1090, 1121, 1121, 1152, 1152, 1152, 223, 254, 254, + 285, 285, 316, 316, 347, 347, 378, 378, 409, 409, 440, 440, 471, + 471, 502, 502, 533, 533, 564, 564, 595, 595, 626, 626, 657, 657, + 688, 688, 719, 719, 750, 750, 781, 781, 812, 812, 843, 843, 874, + 874, 905, 905, 936, 936, 967, 967, 998, 998, 1029, 1029, 1060, 1060, + 1091, 1091, 1122, 1122, 1153, 1153, 1184, 1184, 1184, 255, 286, 286, 317, + 317, 348, 348, 379, 379, 410, 410, 441, 441, 472, 472, 503, 503, + 534, 534, 565, 565, 596, 596, 627, 627, 658, 658, 689, 689, 720, + 720, 751, 751, 782, 782, 813, 813, 844, 844, 875, 875, 906, 906, + 937, 937, 968, 968, 999, 999, 1030, 1030, 1061, 1061, 1092, 1092, 1123, + 1123, 1154, 1154, 1185, 1185, 1216, 1216, 1216, 287, 318, 318, 349, 349, + 380, 380, 411, 411, 442, 442, 473, 473, 504, 504, 535, 535, 566, + 566, 597, 597, 628, 628, 659, 659, 690, 690, 721, 721, 752, 752, + 783, 783, 814, 814, 845, 845, 876, 876, 907, 907, 938, 938, 969, + 969, 1000, 1000, 1031, 1031, 1062, 1062, 1093, 1093, 1124, 1124, 1155, 1155, + 1186, 1186, 1217, 1217, 1248, 1248, 1248, 319, 350, 350, 381, 381, 412, + 412, 443, 443, 474, 474, 505, 505, 536, 536, 567, 567, 598, 598, + 629, 629, 660, 660, 691, 691, 722, 722, 753, 753, 784, 784, 815, + 815, 846, 846, 877, 877, 908, 908, 939, 939, 970, 970, 1001, 1001, + 1032, 1032, 1063, 1063, 1094, 1094, 1125, 1125, 1156, 1156, 1187, 1187, 1218, + 1218, 1249, 1249, 1280, 1280, 1280, 351, 382, 382, 413, 413, 444, 444, + 475, 475, 506, 506, 537, 537, 568, 568, 599, 599, 630, 630, 661, + 661, 692, 692, 723, 723, 754, 754, 785, 785, 816, 816, 847, 847, + 878, 878, 909, 909, 940, 940, 971, 971, 1002, 1002, 1033, 1033, 1064, + 1064, 1095, 1095, 1126, 1126, 1157, 1157, 1188, 1188, 1219, 1219, 1250, 1250, + 1281, 1281, 1312, 1312, 1312, 383, 414, 414, 445, 445, 476, 476, 507, + 507, 538, 538, 569, 569, 600, 600, 631, 631, 662, 662, 693, 693, + 724, 724, 755, 755, 786, 786, 817, 817, 848, 848, 879, 879, 910, + 910, 941, 941, 972, 972, 1003, 1003, 1034, 1034, 1065, 1065, 1096, 1096, + 1127, 1127, 1158, 1158, 1189, 1189, 1220, 1220, 1251, 1251, 1282, 1282, 1313, + 1313, 1344, 1344, 1344, 415, 446, 446, 477, 477, 508, 508, 539, 539, + 570, 570, 601, 601, 632, 632, 663, 663, 694, 694, 725, 725, 756, + 756, 787, 787, 818, 818, 849, 849, 880, 880, 911, 911, 942, 942, + 973, 973, 1004, 1004, 1035, 1035, 1066, 1066, 1097, 1097, 1128, 1128, 1159, + 1159, 1190, 1190, 1221, 1221, 1252, 1252, 1283, 1283, 1314, 1314, 1345, 1345, + 1376, 1376, 1376, 447, 478, 478, 509, 509, 540, 540, 571, 571, 602, + 602, 633, 633, 664, 664, 695, 695, 726, 726, 757, 757, 788, 788, + 819, 819, 850, 850, 881, 881, 912, 912, 943, 943, 974, 974, 1005, + 1005, 1036, 1036, 1067, 1067, 1098, 1098, 1129, 1129, 1160, 1160, 1191, 1191, + 1222, 1222, 1253, 1253, 1284, 1284, 1315, 1315, 1346, 1346, 1377, 1377, 1408, + 1408, 1408, 479, 510, 510, 541, 541, 572, 572, 603, 603, 634, 634, + 665, 665, 696, 696, 727, 727, 758, 758, 789, 789, 820, 820, 851, + 851, 882, 882, 913, 913, 944, 944, 975, 975, 1006, 1006, 1037, 1037, + 1068, 1068, 1099, 1099, 1130, 1130, 1161, 1161, 1192, 1192, 1223, 1223, 1254, + 1254, 1285, 1285, 1316, 1316, 1347, 1347, 1378, 1378, 1409, 1409, 1440, 1440, + 1440, 511, 542, 542, 573, 573, 604, 604, 635, 635, 666, 666, 697, + 697, 728, 728, 759, 759, 790, 790, 821, 821, 852, 852, 883, 883, + 914, 914, 945, 945, 976, 976, 1007, 1007, 1038, 1038, 1069, 1069, 1100, + 1100, 1131, 1131, 1162, 1162, 1193, 1193, 1224, 1224, 1255, 1255, 1286, 1286, + 1317, 1317, 1348, 1348, 1379, 1379, 1410, 1410, 1441, 1441, 1472, 1472, 1472, + 543, 574, 574, 605, 605, 636, 636, 667, 667, 698, 698, 729, 729, + 760, 760, 791, 791, 822, 822, 853, 853, 884, 884, 915, 915, 946, + 946, 977, 977, 1008, 1008, 1039, 1039, 1070, 1070, 1101, 1101, 1132, 1132, + 1163, 1163, 1194, 1194, 1225, 1225, 1256, 1256, 1287, 1287, 1318, 1318, 1349, + 1349, 1380, 1380, 1411, 1411, 1442, 1442, 1473, 1473, 1504, 1504, 1504, 575, + 606, 606, 637, 637, 668, 668, 699, 699, 730, 730, 761, 761, 792, + 792, 823, 823, 854, 854, 885, 885, 916, 916, 947, 947, 978, 978, + 1009, 1009, 1040, 1040, 1071, 1071, 1102, 1102, 1133, 1133, 1164, 1164, 1195, + 1195, 1226, 1226, 1257, 1257, 1288, 1288, 1319, 1319, 1350, 1350, 1381, 1381, + 1412, 1412, 1443, 1443, 1474, 1474, 1505, 1505, 1536, 1536, 1536, 607, 638, + 638, 669, 669, 700, 700, 731, 731, 762, 762, 793, 793, 824, 824, + 855, 855, 886, 886, 917, 917, 948, 948, 979, 979, 1010, 1010, 1041, + 1041, 1072, 1072, 1103, 1103, 1134, 1134, 1165, 1165, 1196, 1196, 1227, 1227, + 1258, 1258, 1289, 1289, 1320, 1320, 1351, 1351, 1382, 1382, 1413, 1413, 1444, + 1444, 1475, 1475, 1506, 1506, 1537, 1537, 1568, 1568, 1568, 639, 670, 670, + 701, 701, 732, 732, 763, 763, 794, 794, 825, 825, 856, 856, 887, + 887, 918, 918, 949, 949, 980, 980, 1011, 1011, 1042, 1042, 1073, 1073, + 1104, 1104, 1135, 1135, 1166, 1166, 1197, 1197, 1228, 1228, 1259, 1259, 1290, + 1290, 1321, 1321, 1352, 1352, 1383, 1383, 1414, 1414, 1445, 1445, 1476, 1476, + 1507, 1507, 1538, 1538, 1569, 1569, 1600, 1600, 1600, 671, 702, 702, 733, + 733, 764, 764, 795, 795, 826, 826, 857, 857, 888, 888, 919, 919, + 950, 950, 981, 981, 1012, 1012, 1043, 1043, 1074, 1074, 1105, 1105, 1136, + 1136, 1167, 1167, 1198, 1198, 1229, 1229, 1260, 1260, 1291, 1291, 1322, 1322, + 1353, 1353, 1384, 1384, 1415, 1415, 1446, 1446, 1477, 1477, 1508, 1508, 1539, + 1539, 1570, 1570, 1601, 1601, 1632, 1632, 1632, 703, 734, 734, 765, 765, + 796, 796, 827, 827, 858, 858, 889, 889, 920, 920, 951, 951, 982, + 982, 1013, 1013, 1044, 1044, 1075, 1075, 1106, 1106, 1137, 1137, 1168, 1168, + 1199, 1199, 1230, 1230, 1261, 1261, 1292, 1292, 1323, 1323, 1354, 1354, 1385, + 1385, 1416, 1416, 1447, 1447, 1478, 1478, 1509, 1509, 1540, 1540, 1571, 1571, + 1602, 1602, 1633, 1633, 1664, 1664, 1664, 735, 766, 766, 797, 797, 828, + 828, 859, 859, 890, 890, 921, 921, 952, 952, 983, 983, 1014, 1014, + 1045, 1045, 1076, 1076, 1107, 1107, 1138, 1138, 1169, 1169, 1200, 1200, 1231, + 1231, 1262, 1262, 1293, 1293, 1324, 1324, 1355, 1355, 1386, 1386, 1417, 1417, + 1448, 1448, 1479, 1479, 1510, 1510, 1541, 1541, 1572, 1572, 1603, 1603, 1634, + 1634, 1665, 1665, 1696, 1696, 1696, 767, 798, 798, 829, 829, 860, 860, + 891, 891, 922, 922, 953, 953, 984, 984, 1015, 1015, 1046, 1046, 1077, + 1077, 1108, 1108, 1139, 1139, 1170, 1170, 1201, 1201, 1232, 1232, 1263, 1263, + 1294, 1294, 1325, 1325, 1356, 1356, 1387, 1387, 1418, 1418, 1449, 1449, 1480, + 1480, 1511, 1511, 1542, 1542, 1573, 1573, 1604, 1604, 1635, 1635, 1666, 1666, + 1697, 1697, 1728, 1728, 1728, 799, 830, 830, 861, 861, 892, 892, 923, + 923, 954, 954, 985, 985, 1016, 1016, 1047, 1047, 1078, 1078, 1109, 1109, + 1140, 1140, 1171, 1171, 1202, 1202, 1233, 1233, 1264, 1264, 1295, 1295, 1326, + 1326, 1357, 1357, 1388, 1388, 1419, 1419, 1450, 1450, 1481, 1481, 1512, 1512, + 1543, 1543, 1574, 1574, 1605, 1605, 1636, 1636, 1667, 1667, 1698, 1698, 1729, + 1729, 1760, 1760, 1760, 831, 862, 862, 893, 893, 924, 924, 955, 955, + 986, 986, 1017, 1017, 1048, 1048, 1079, 1079, 1110, 1110, 1141, 1141, 1172, + 1172, 1203, 1203, 1234, 1234, 1265, 1265, 1296, 1296, 1327, 1327, 1358, 1358, + 1389, 1389, 1420, 1420, 1451, 1451, 1482, 1482, 1513, 1513, 1544, 1544, 1575, + 1575, 1606, 1606, 1637, 1637, 1668, 1668, 1699, 1699, 1730, 1730, 1761, 1761, + 1792, 1792, 1792, 863, 894, 894, 925, 925, 956, 956, 987, 987, 1018, + 1018, 1049, 1049, 1080, 1080, 1111, 1111, 1142, 1142, 1173, 1173, 1204, 1204, + 1235, 1235, 1266, 1266, 1297, 1297, 1328, 1328, 1359, 1359, 1390, 1390, 1421, + 1421, 1452, 1452, 1483, 1483, 1514, 1514, 1545, 1545, 1576, 1576, 1607, 1607, + 1638, 1638, 1669, 1669, 1700, 1700, 1731, 1731, 1762, 1762, 1793, 1793, 1824, + 1824, 1824, 895, 926, 926, 957, 957, 988, 988, 1019, 1019, 1050, 1050, + 1081, 1081, 1112, 1112, 1143, 1143, 1174, 1174, 1205, 1205, 1236, 1236, 1267, + 1267, 1298, 1298, 1329, 1329, 1360, 1360, 1391, 1391, 1422, 1422, 1453, 1453, + 1484, 1484, 1515, 1515, 1546, 1546, 1577, 1577, 1608, 1608, 1639, 1639, 1670, + 1670, 1701, 1701, 1732, 1732, 1763, 1763, 1794, 1794, 1825, 1825, 1856, 1856, + 1856, 927, 958, 958, 989, 989, 1020, 1020, 1051, 1051, 1082, 1082, 1113, + 1113, 1144, 1144, 1175, 1175, 1206, 1206, 1237, 1237, 1268, 1268, 1299, 1299, + 1330, 1330, 1361, 1361, 1392, 1392, 1423, 1423, 1454, 1454, 1485, 1485, 1516, + 1516, 1547, 1547, 1578, 1578, 1609, 1609, 1640, 1640, 1671, 1671, 1702, 1702, + 1733, 1733, 1764, 1764, 1795, 1795, 1826, 1826, 1857, 1857, 1888, 1888, 1888, + 959, 990, 990, 1021, 1021, 1052, 1052, 1083, 1083, 1114, 1114, 1145, 1145, + 1176, 1176, 1207, 1207, 1238, 1238, 1269, 1269, 1300, 1300, 1331, 1331, 1362, + 1362, 1393, 1393, 1424, 1424, 1455, 1455, 1486, 1486, 1517, 1517, 1548, 1548, + 1579, 1579, 1610, 1610, 1641, 1641, 1672, 1672, 1703, 1703, 1734, 1734, 1765, + 1765, 1796, 1796, 1827, 1827, 1858, 1858, 1889, 1889, 1920, 1920, 1920, 991, + 1022, 1022, 1053, 1053, 1084, 1084, 1115, 1115, 1146, 1146, 1177, 1177, 1208, + 1208, 1239, 1239, 1270, 1270, 1301, 1301, 1332, 1332, 1363, 1363, 1394, 1394, + 1425, 1425, 1456, 1456, 1487, 1487, 1518, 1518, 1549, 1549, 1580, 1580, 1611, + 1611, 1642, 1642, 1673, 1673, 1704, 1704, 1735, 1735, 1766, 1766, 1797, 1797, + 1828, 1828, 1859, 1859, 1890, 1890, 1921, 1921, 1952, 1952, 1952, 1023, 1054, + 1054, 1085, 1085, 1116, 1116, 1147, 1147, 1178, 1178, 1209, 1209, 1240, 1240, + 1271, 1271, 1302, 1302, 1333, 1333, 1364, 1364, 1395, 1395, 1426, 1426, 1457, + 1457, 1488, 1488, 1519, 1519, 1550, 1550, 1581, 1581, 1612, 1612, 1643, 1643, + 1674, 1674, 1705, 1705, 1736, 1736, 1767, 1767, 1798, 1798, 1829, 1829, 1860, + 1860, 1891, 1891, 1922, 1922, 1953, 1953, 1984, 1984, 1984, 1055, 1086, 1086, + 1117, 1117, 1148, 1148, 1179, 1179, 1210, 1210, 1241, 1241, 1272, 1272, 1303, + 1303, 1334, 1334, 1365, 1365, 1396, 1396, 1427, 1427, 1458, 1458, 1489, 1489, + 1520, 1520, 1551, 1551, 1582, 1582, 1613, 1613, 1644, 1644, 1675, 1675, 1706, + 1706, 1737, 1737, 1768, 1768, 1799, 1799, 1830, 1830, 1861, 1861, 1892, 1892, + 1923, 1923, 1954, 1954, 1985, 1985, 2016, 1087, 1118, 1118, 1149, 1149, 1180, + 1180, 1211, 1211, 1242, 1242, 1273, 1273, 1304, 1304, 1335, 1335, 1366, 1366, + 1397, 1397, 1428, 1428, 1459, 1459, 1490, 1490, 1521, 1521, 1552, 1552, 1583, + 1583, 1614, 1614, 1645, 1645, 1676, 1676, 1707, 1707, 1738, 1738, 1769, 1769, + 1800, 1800, 1831, 1831, 1862, 1862, 1893, 1893, 1924, 1924, 1955, 1955, 1986, + 1986, 2017, 1119, 1150, 1150, 1181, 1181, 1212, 1212, 1243, 1243, 1274, 1274, + 1305, 1305, 1336, 1336, 1367, 1367, 1398, 1398, 1429, 1429, 1460, 1460, 1491, + 1491, 1522, 1522, 1553, 1553, 1584, 1584, 1615, 1615, 1646, 1646, 1677, 1677, + 1708, 1708, 1739, 1739, 1770, 1770, 1801, 1801, 1832, 1832, 1863, 1863, 1894, + 1894, 1925, 1925, 1956, 1956, 1987, 1987, 2018, 1151, 1182, 1182, 1213, 1213, + 1244, 1244, 1275, 1275, 1306, 1306, 1337, 1337, 1368, 1368, 1399, 1399, 1430, + 1430, 1461, 1461, 1492, 1492, 1523, 1523, 1554, 1554, 1585, 1585, 1616, 1616, + 1647, 1647, 1678, 1678, 1709, 1709, 1740, 1740, 1771, 1771, 1802, 1802, 1833, + 1833, 1864, 1864, 1895, 1895, 1926, 1926, 1957, 1957, 1988, 1988, 2019, 1183, + 1214, 1214, 1245, 1245, 1276, 1276, 1307, 1307, 1338, 1338, 1369, 1369, 1400, + 1400, 1431, 1431, 1462, 1462, 1493, 1493, 1524, 1524, 1555, 1555, 1586, 1586, + 1617, 1617, 1648, 1648, 1679, 1679, 1710, 1710, 1741, 1741, 1772, 1772, 1803, + 1803, 1834, 1834, 1865, 1865, 1896, 1896, 1927, 1927, 1958, 1958, 1989, 1989, + 2020, 1215, 1246, 1246, 1277, 1277, 1308, 1308, 1339, 1339, 1370, 1370, 1401, + 1401, 1432, 1432, 1463, 1463, 1494, 1494, 1525, 1525, 1556, 1556, 1587, 1587, + 1618, 1618, 1649, 1649, 1680, 1680, 1711, 1711, 1742, 1742, 1773, 1773, 1804, + 1804, 1835, 1835, 1866, 1866, 1897, 1897, 1928, 1928, 1959, 1959, 1990, 1990, + 2021, 1247, 1278, 1278, 1309, 1309, 1340, 1340, 1371, 1371, 1402, 1402, 1433, + 1433, 1464, 1464, 1495, 1495, 1526, 1526, 1557, 1557, 1588, 1588, 1619, 1619, + 1650, 1650, 1681, 1681, 1712, 1712, 1743, 1743, 1774, 1774, 1805, 1805, 1836, + 1836, 1867, 1867, 1898, 1898, 1929, 1929, 1960, 1960, 1991, 1991, 2022, 1279, + 1310, 1310, 1341, 1341, 1372, 1372, 1403, 1403, 1434, 1434, 1465, 1465, 1496, + 1496, 1527, 1527, 1558, 1558, 1589, 1589, 1620, 1620, 1651, 1651, 1682, 1682, + 1713, 1713, 1744, 1744, 1775, 1775, 1806, 1806, 1837, 1837, 1868, 1868, 1899, + 1899, 1930, 1930, 1961, 1961, 1992, 1992, 2023, 1311, 1342, 1342, 1373, 1373, + 1404, 1404, 1435, 1435, 1466, 1466, 1497, 1497, 1528, 1528, 1559, 1559, 1590, + 1590, 1621, 1621, 1652, 1652, 1683, 1683, 1714, 1714, 1745, 1745, 1776, 1776, + 1807, 1807, 1838, 1838, 1869, 1869, 1900, 1900, 1931, 1931, 1962, 1962, 1993, + 1993, 2024, 1343, 1374, 1374, 1405, 1405, 1436, 1436, 1467, 1467, 1498, 1498, + 1529, 1529, 1560, 1560, 1591, 1591, 1622, 1622, 1653, 1653, 1684, 1684, 1715, + 1715, 1746, 1746, 1777, 1777, 1808, 1808, 1839, 1839, 1870, 1870, 1901, 1901, + 1932, 1932, 1963, 1963, 1994, 1994, 2025, 1375, 1406, 1406, 1437, 1437, 1468, + 1468, 1499, 1499, 1530, 1530, 1561, 1561, 1592, 1592, 1623, 1623, 1654, 1654, + 1685, 1685, 1716, 1716, 1747, 1747, 1778, 1778, 1809, 1809, 1840, 1840, 1871, + 1871, 1902, 1902, 1933, 1933, 1964, 1964, 1995, 1995, 2026, 1407, 1438, 1438, + 1469, 1469, 1500, 1500, 1531, 1531, 1562, 1562, 1593, 1593, 1624, 1624, 1655, + 1655, 1686, 1686, 1717, 1717, 1748, 1748, 1779, 1779, 1810, 1810, 1841, 1841, + 1872, 1872, 1903, 1903, 1934, 1934, 1965, 1965, 1996, 1996, 2027, 1439, 1470, + 1470, 1501, 1501, 1532, 1532, 1563, 1563, 1594, 1594, 1625, 1625, 1656, 1656, + 1687, 1687, 1718, 1718, 1749, 1749, 1780, 1780, 1811, 1811, 1842, 1842, 1873, + 1873, 1904, 1904, 1935, 1935, 1966, 1966, 1997, 1997, 2028, 1471, 1502, 1502, + 1533, 1533, 1564, 1564, 1595, 1595, 1626, 1626, 1657, 1657, 1688, 1688, 1719, + 1719, 1750, 1750, 1781, 1781, 1812, 1812, 1843, 1843, 1874, 1874, 1905, 1905, + 1936, 1936, 1967, 1967, 1998, 1998, 2029, 1503, 1534, 1534, 1565, 1565, 1596, + 1596, 1627, 1627, 1658, 1658, 1689, 1689, 1720, 1720, 1751, 1751, 1782, 1782, + 1813, 1813, 1844, 1844, 1875, 1875, 1906, 1906, 1937, 1937, 1968, 1968, 1999, + 1999, 2030, 1535, 1566, 1566, 1597, 1597, 1628, 1628, 1659, 1659, 1690, 1690, + 1721, 1721, 1752, 1752, 1783, 1783, 1814, 1814, 1845, 1845, 1876, 1876, 1907, + 1907, 1938, 1938, 1969, 1969, 2000, 2000, 2031, 1567, 1598, 1598, 1629, 1629, + 1660, 1660, 1691, 1691, 1722, 1722, 1753, 1753, 1784, 1784, 1815, 1815, 1846, + 1846, 1877, 1877, 1908, 1908, 1939, 1939, 1970, 1970, 2001, 2001, 2032, 1599, + 1630, 1630, 1661, 1661, 1692, 1692, 1723, 1723, 1754, 1754, 1785, 1785, 1816, + 1816, 1847, 1847, 1878, 1878, 1909, 1909, 1940, 1940, 1971, 1971, 2002, 2002, + 2033, 1631, 1662, 1662, 1693, 1693, 1724, 1724, 1755, 1755, 1786, 1786, 1817, + 1817, 1848, 1848, 1879, 1879, 1910, 1910, 1941, 1941, 1972, 1972, 2003, 2003, + 2034, 1663, 1694, 1694, 1725, 1725, 1756, 1756, 1787, 1787, 1818, 1818, 1849, + 1849, 1880, 1880, 1911, 1911, 1942, 1942, 1973, 1973, 2004, 2004, 2035, 1695, + 1726, 1726, 1757, 1757, 1788, 1788, 1819, 1819, 1850, 1850, 1881, 1881, 1912, + 1912, 1943, 1943, 1974, 1974, 2005, 2005, 2036, 1727, 1758, 1758, 1789, 1789, + 1820, 1820, 1851, 1851, 1882, 1882, 1913, 1913, 1944, 1944, 1975, 1975, 2006, + 2006, 2037, 1759, 1790, 1790, 1821, 1821, 1852, 1852, 1883, 1883, 1914, 1914, + 1945, 1945, 1976, 1976, 2007, 2007, 2038, 1791, 1822, 1822, 1853, 1853, 1884, + 1884, 1915, 1915, 1946, 1946, 1977, 1977, 2008, 2008, 2039, 1823, 1854, 1854, + 1885, 1885, 1916, 1916, 1947, 1947, 1978, 1978, 2009, 2009, 2040, 1855, 1886, + 1886, 1917, 1917, 1948, 1948, 1979, 1979, 2010, 2010, 2041, 1887, 1918, 1918, + 1949, 1949, 1980, 1980, 2011, 2011, 2042, 1919, 1950, 1950, 1981, 1981, 2012, + 2012, 2043, 1951, 1982, 1982, 2013, 2013, 2044, 1983, 2014, 2014, 2045, 2015, + 2046, 0, 0 +}; + +DECLARE_ALIGNED(16, static const int16_t, + default_scan_64x32_neighbors[2049 * MAX_NEIGHBORS]) = { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 64, 64, 64, 2, + 2, 2, 65, 65, 128, 128, 128, 3, 3, 3, 66, 66, 129, + 129, 192, 192, 192, 4, 4, 4, 67, 67, 130, 130, 193, 193, + 256, 256, 256, 5, 5, 5, 68, 68, 131, 131, 194, 194, 257, + 257, 320, 320, 320, 6, 6, 6, 69, 69, 132, 132, 195, 195, + 258, 258, 321, 321, 384, 384, 384, 7, 7, 7, 70, 70, 133, + 133, 196, 196, 259, 259, 322, 322, 385, 385, 448, 448, 448, 8, + 8, 8, 71, 71, 134, 134, 197, 197, 260, 260, 323, 323, 386, + 386, 449, 449, 512, 512, 512, 9, 9, 9, 72, 72, 135, 135, + 198, 198, 261, 261, 324, 324, 387, 387, 450, 450, 513, 513, 576, + 576, 576, 10, 10, 10, 73, 73, 136, 136, 199, 199, 262, 262, + 325, 325, 388, 388, 451, 451, 514, 514, 577, 577, 640, 640, 640, + 11, 11, 11, 74, 74, 137, 137, 200, 200, 263, 263, 326, 326, + 389, 389, 452, 452, 515, 515, 578, 578, 641, 641, 704, 704, 704, + 12, 12, 12, 75, 75, 138, 138, 201, 201, 264, 264, 327, 327, + 390, 390, 453, 453, 516, 516, 579, 579, 642, 642, 705, 705, 768, + 768, 768, 13, 13, 13, 76, 76, 139, 139, 202, 202, 265, 265, + 328, 328, 391, 391, 454, 454, 517, 517, 580, 580, 643, 643, 706, + 706, 769, 769, 832, 832, 832, 14, 14, 14, 77, 77, 140, 140, + 203, 203, 266, 266, 329, 329, 392, 392, 455, 455, 518, 518, 581, + 581, 644, 644, 707, 707, 770, 770, 833, 833, 896, 896, 896, 15, + 15, 15, 78, 78, 141, 141, 204, 204, 267, 267, 330, 330, 393, + 393, 456, 456, 519, 519, 582, 582, 645, 645, 708, 708, 771, 771, + 834, 834, 897, 897, 960, 960, 960, 16, 16, 16, 79, 79, 142, + 142, 205, 205, 268, 268, 331, 331, 394, 394, 457, 457, 520, 520, + 583, 583, 646, 646, 709, 709, 772, 772, 835, 835, 898, 898, 961, + 961, 1024, 1024, 1024, 17, 17, 17, 80, 80, 143, 143, 206, 206, + 269, 269, 332, 332, 395, 395, 458, 458, 521, 521, 584, 584, 647, + 647, 710, 710, 773, 773, 836, 836, 899, 899, 962, 962, 1025, 1025, + 1088, 1088, 1088, 18, 18, 18, 81, 81, 144, 144, 207, 207, 270, + 270, 333, 333, 396, 396, 459, 459, 522, 522, 585, 585, 648, 648, + 711, 711, 774, 774, 837, 837, 900, 900, 963, 963, 1026, 1026, 1089, + 1089, 1152, 1152, 1152, 19, 19, 19, 82, 82, 145, 145, 208, 208, + 271, 271, 334, 334, 397, 397, 460, 460, 523, 523, 586, 586, 649, + 649, 712, 712, 775, 775, 838, 838, 901, 901, 964, 964, 1027, 1027, + 1090, 1090, 1153, 1153, 1216, 1216, 1216, 20, 20, 20, 83, 83, 146, + 146, 209, 209, 272, 272, 335, 335, 398, 398, 461, 461, 524, 524, + 587, 587, 650, 650, 713, 713, 776, 776, 839, 839, 902, 902, 965, + 965, 1028, 1028, 1091, 1091, 1154, 1154, 1217, 1217, 1280, 1280, 1280, 21, + 21, 21, 84, 84, 147, 147, 210, 210, 273, 273, 336, 336, 399, + 399, 462, 462, 525, 525, 588, 588, 651, 651, 714, 714, 777, 777, + 840, 840, 903, 903, 966, 966, 1029, 1029, 1092, 1092, 1155, 1155, 1218, + 1218, 1281, 1281, 1344, 1344, 1344, 22, 22, 22, 85, 85, 148, 148, + 211, 211, 274, 274, 337, 337, 400, 400, 463, 463, 526, 526, 589, + 589, 652, 652, 715, 715, 778, 778, 841, 841, 904, 904, 967, 967, + 1030, 1030, 1093, 1093, 1156, 1156, 1219, 1219, 1282, 1282, 1345, 1345, 1408, + 1408, 1408, 23, 23, 23, 86, 86, 149, 149, 212, 212, 275, 275, + 338, 338, 401, 401, 464, 464, 527, 527, 590, 590, 653, 653, 716, + 716, 779, 779, 842, 842, 905, 905, 968, 968, 1031, 1031, 1094, 1094, + 1157, 1157, 1220, 1220, 1283, 1283, 1346, 1346, 1409, 1409, 1472, 1472, 1472, + 24, 24, 24, 87, 87, 150, 150, 213, 213, 276, 276, 339, 339, + 402, 402, 465, 465, 528, 528, 591, 591, 654, 654, 717, 717, 780, + 780, 843, 843, 906, 906, 969, 969, 1032, 1032, 1095, 1095, 1158, 1158, + 1221, 1221, 1284, 1284, 1347, 1347, 1410, 1410, 1473, 1473, 1536, 1536, 1536, + 25, 25, 25, 88, 88, 151, 151, 214, 214, 277, 277, 340, 340, + 403, 403, 466, 466, 529, 529, 592, 592, 655, 655, 718, 718, 781, + 781, 844, 844, 907, 907, 970, 970, 1033, 1033, 1096, 1096, 1159, 1159, + 1222, 1222, 1285, 1285, 1348, 1348, 1411, 1411, 1474, 1474, 1537, 1537, 1600, + 1600, 1600, 26, 26, 26, 89, 89, 152, 152, 215, 215, 278, 278, + 341, 341, 404, 404, 467, 467, 530, 530, 593, 593, 656, 656, 719, + 719, 782, 782, 845, 845, 908, 908, 971, 971, 1034, 1034, 1097, 1097, + 1160, 1160, 1223, 1223, 1286, 1286, 1349, 1349, 1412, 1412, 1475, 1475, 1538, + 1538, 1601, 1601, 1664, 1664, 1664, 27, 27, 27, 90, 90, 153, 153, + 216, 216, 279, 279, 342, 342, 405, 405, 468, 468, 531, 531, 594, + 594, 657, 657, 720, 720, 783, 783, 846, 846, 909, 909, 972, 972, + 1035, 1035, 1098, 1098, 1161, 1161, 1224, 1224, 1287, 1287, 1350, 1350, 1413, + 1413, 1476, 1476, 1539, 1539, 1602, 1602, 1665, 1665, 1728, 1728, 1728, 28, + 28, 28, 91, 91, 154, 154, 217, 217, 280, 280, 343, 343, 406, + 406, 469, 469, 532, 532, 595, 595, 658, 658, 721, 721, 784, 784, + 847, 847, 910, 910, 973, 973, 1036, 1036, 1099, 1099, 1162, 1162, 1225, + 1225, 1288, 1288, 1351, 1351, 1414, 1414, 1477, 1477, 1540, 1540, 1603, 1603, + 1666, 1666, 1729, 1729, 1792, 1792, 1792, 29, 29, 29, 92, 92, 155, + 155, 218, 218, 281, 281, 344, 344, 407, 407, 470, 470, 533, 533, + 596, 596, 659, 659, 722, 722, 785, 785, 848, 848, 911, 911, 974, + 974, 1037, 1037, 1100, 1100, 1163, 1163, 1226, 1226, 1289, 1289, 1352, 1352, + 1415, 1415, 1478, 1478, 1541, 1541, 1604, 1604, 1667, 1667, 1730, 1730, 1793, + 1793, 1856, 1856, 1856, 30, 30, 30, 93, 93, 156, 156, 219, 219, + 282, 282, 345, 345, 408, 408, 471, 471, 534, 534, 597, 597, 660, + 660, 723, 723, 786, 786, 849, 849, 912, 912, 975, 975, 1038, 1038, + 1101, 1101, 1164, 1164, 1227, 1227, 1290, 1290, 1353, 1353, 1416, 1416, 1479, + 1479, 1542, 1542, 1605, 1605, 1668, 1668, 1731, 1731, 1794, 1794, 1857, 1857, + 1920, 1920, 1920, 31, 31, 31, 94, 94, 157, 157, 220, 220, 283, + 283, 346, 346, 409, 409, 472, 472, 535, 535, 598, 598, 661, 661, + 724, 724, 787, 787, 850, 850, 913, 913, 976, 976, 1039, 1039, 1102, + 1102, 1165, 1165, 1228, 1228, 1291, 1291, 1354, 1354, 1417, 1417, 1480, 1480, + 1543, 1543, 1606, 1606, 1669, 1669, 1732, 1732, 1795, 1795, 1858, 1858, 1921, + 1921, 1984, 32, 32, 32, 95, 95, 158, 158, 221, 221, 284, 284, + 347, 347, 410, 410, 473, 473, 536, 536, 599, 599, 662, 662, 725, + 725, 788, 788, 851, 851, 914, 914, 977, 977, 1040, 1040, 1103, 1103, + 1166, 1166, 1229, 1229, 1292, 1292, 1355, 1355, 1418, 1418, 1481, 1481, 1544, + 1544, 1607, 1607, 1670, 1670, 1733, 1733, 1796, 1796, 1859, 1859, 1922, 1922, + 1985, 33, 33, 33, 96, 96, 159, 159, 222, 222, 285, 285, 348, + 348, 411, 411, 474, 474, 537, 537, 600, 600, 663, 663, 726, 726, + 789, 789, 852, 852, 915, 915, 978, 978, 1041, 1041, 1104, 1104, 1167, + 1167, 1230, 1230, 1293, 1293, 1356, 1356, 1419, 1419, 1482, 1482, 1545, 1545, + 1608, 1608, 1671, 1671, 1734, 1734, 1797, 1797, 1860, 1860, 1923, 1923, 1986, + 34, 34, 34, 97, 97, 160, 160, 223, 223, 286, 286, 349, 349, + 412, 412, 475, 475, 538, 538, 601, 601, 664, 664, 727, 727, 790, + 790, 853, 853, 916, 916, 979, 979, 1042, 1042, 1105, 1105, 1168, 1168, + 1231, 1231, 1294, 1294, 1357, 1357, 1420, 1420, 1483, 1483, 1546, 1546, 1609, + 1609, 1672, 1672, 1735, 1735, 1798, 1798, 1861, 1861, 1924, 1924, 1987, 35, + 35, 35, 98, 98, 161, 161, 224, 224, 287, 287, 350, 350, 413, + 413, 476, 476, 539, 539, 602, 602, 665, 665, 728, 728, 791, 791, + 854, 854, 917, 917, 980, 980, 1043, 1043, 1106, 1106, 1169, 1169, 1232, + 1232, 1295, 1295, 1358, 1358, 1421, 1421, 1484, 1484, 1547, 1547, 1610, 1610, + 1673, 1673, 1736, 1736, 1799, 1799, 1862, 1862, 1925, 1925, 1988, 36, 36, + 36, 99, 99, 162, 162, 225, 225, 288, 288, 351, 351, 414, 414, + 477, 477, 540, 540, 603, 603, 666, 666, 729, 729, 792, 792, 855, + 855, 918, 918, 981, 981, 1044, 1044, 1107, 1107, 1170, 1170, 1233, 1233, + 1296, 1296, 1359, 1359, 1422, 1422, 1485, 1485, 1548, 1548, 1611, 1611, 1674, + 1674, 1737, 1737, 1800, 1800, 1863, 1863, 1926, 1926, 1989, 37, 37, 37, + 100, 100, 163, 163, 226, 226, 289, 289, 352, 352, 415, 415, 478, + 478, 541, 541, 604, 604, 667, 667, 730, 730, 793, 793, 856, 856, + 919, 919, 982, 982, 1045, 1045, 1108, 1108, 1171, 1171, 1234, 1234, 1297, + 1297, 1360, 1360, 1423, 1423, 1486, 1486, 1549, 1549, 1612, 1612, 1675, 1675, + 1738, 1738, 1801, 1801, 1864, 1864, 1927, 1927, 1990, 38, 38, 38, 101, + 101, 164, 164, 227, 227, 290, 290, 353, 353, 416, 416, 479, 479, + 542, 542, 605, 605, 668, 668, 731, 731, 794, 794, 857, 857, 920, + 920, 983, 983, 1046, 1046, 1109, 1109, 1172, 1172, 1235, 1235, 1298, 1298, + 1361, 1361, 1424, 1424, 1487, 1487, 1550, 1550, 1613, 1613, 1676, 1676, 1739, + 1739, 1802, 1802, 1865, 1865, 1928, 1928, 1991, 39, 39, 39, 102, 102, + 165, 165, 228, 228, 291, 291, 354, 354, 417, 417, 480, 480, 543, + 543, 606, 606, 669, 669, 732, 732, 795, 795, 858, 858, 921, 921, + 984, 984, 1047, 1047, 1110, 1110, 1173, 1173, 1236, 1236, 1299, 1299, 1362, + 1362, 1425, 1425, 1488, 1488, 1551, 1551, 1614, 1614, 1677, 1677, 1740, 1740, + 1803, 1803, 1866, 1866, 1929, 1929, 1992, 40, 40, 40, 103, 103, 166, + 166, 229, 229, 292, 292, 355, 355, 418, 418, 481, 481, 544, 544, + 607, 607, 670, 670, 733, 733, 796, 796, 859, 859, 922, 922, 985, + 985, 1048, 1048, 1111, 1111, 1174, 1174, 1237, 1237, 1300, 1300, 1363, 1363, + 1426, 1426, 1489, 1489, 1552, 1552, 1615, 1615, 1678, 1678, 1741, 1741, 1804, + 1804, 1867, 1867, 1930, 1930, 1993, 41, 41, 41, 104, 104, 167, 167, + 230, 230, 293, 293, 356, 356, 419, 419, 482, 482, 545, 545, 608, + 608, 671, 671, 734, 734, 797, 797, 860, 860, 923, 923, 986, 986, + 1049, 1049, 1112, 1112, 1175, 1175, 1238, 1238, 1301, 1301, 1364, 1364, 1427, + 1427, 1490, 1490, 1553, 1553, 1616, 1616, 1679, 1679, 1742, 1742, 1805, 1805, + 1868, 1868, 1931, 1931, 1994, 42, 42, 42, 105, 105, 168, 168, 231, + 231, 294, 294, 357, 357, 420, 420, 483, 483, 546, 546, 609, 609, + 672, 672, 735, 735, 798, 798, 861, 861, 924, 924, 987, 987, 1050, + 1050, 1113, 1113, 1176, 1176, 1239, 1239, 1302, 1302, 1365, 1365, 1428, 1428, + 1491, 1491, 1554, 1554, 1617, 1617, 1680, 1680, 1743, 1743, 1806, 1806, 1869, + 1869, 1932, 1932, 1995, 43, 43, 43, 106, 106, 169, 169, 232, 232, + 295, 295, 358, 358, 421, 421, 484, 484, 547, 547, 610, 610, 673, + 673, 736, 736, 799, 799, 862, 862, 925, 925, 988, 988, 1051, 1051, + 1114, 1114, 1177, 1177, 1240, 1240, 1303, 1303, 1366, 1366, 1429, 1429, 1492, + 1492, 1555, 1555, 1618, 1618, 1681, 1681, 1744, 1744, 1807, 1807, 1870, 1870, + 1933, 1933, 1996, 44, 44, 44, 107, 107, 170, 170, 233, 233, 296, + 296, 359, 359, 422, 422, 485, 485, 548, 548, 611, 611, 674, 674, + 737, 737, 800, 800, 863, 863, 926, 926, 989, 989, 1052, 1052, 1115, + 1115, 1178, 1178, 1241, 1241, 1304, 1304, 1367, 1367, 1430, 1430, 1493, 1493, + 1556, 1556, 1619, 1619, 1682, 1682, 1745, 1745, 1808, 1808, 1871, 1871, 1934, + 1934, 1997, 45, 45, 45, 108, 108, 171, 171, 234, 234, 297, 297, + 360, 360, 423, 423, 486, 486, 549, 549, 612, 612, 675, 675, 738, + 738, 801, 801, 864, 864, 927, 927, 990, 990, 1053, 1053, 1116, 1116, + 1179, 1179, 1242, 1242, 1305, 1305, 1368, 1368, 1431, 1431, 1494, 1494, 1557, + 1557, 1620, 1620, 1683, 1683, 1746, 1746, 1809, 1809, 1872, 1872, 1935, 1935, + 1998, 46, 46, 46, 109, 109, 172, 172, 235, 235, 298, 298, 361, + 361, 424, 424, 487, 487, 550, 550, 613, 613, 676, 676, 739, 739, + 802, 802, 865, 865, 928, 928, 991, 991, 1054, 1054, 1117, 1117, 1180, + 1180, 1243, 1243, 1306, 1306, 1369, 1369, 1432, 1432, 1495, 1495, 1558, 1558, + 1621, 1621, 1684, 1684, 1747, 1747, 1810, 1810, 1873, 1873, 1936, 1936, 1999, + 47, 47, 47, 110, 110, 173, 173, 236, 236, 299, 299, 362, 362, + 425, 425, 488, 488, 551, 551, 614, 614, 677, 677, 740, 740, 803, + 803, 866, 866, 929, 929, 992, 992, 1055, 1055, 1118, 1118, 1181, 1181, + 1244, 1244, 1307, 1307, 1370, 1370, 1433, 1433, 1496, 1496, 1559, 1559, 1622, + 1622, 1685, 1685, 1748, 1748, 1811, 1811, 1874, 1874, 1937, 1937, 2000, 48, + 48, 48, 111, 111, 174, 174, 237, 237, 300, 300, 363, 363, 426, + 426, 489, 489, 552, 552, 615, 615, 678, 678, 741, 741, 804, 804, + 867, 867, 930, 930, 993, 993, 1056, 1056, 1119, 1119, 1182, 1182, 1245, + 1245, 1308, 1308, 1371, 1371, 1434, 1434, 1497, 1497, 1560, 1560, 1623, 1623, + 1686, 1686, 1749, 1749, 1812, 1812, 1875, 1875, 1938, 1938, 2001, 49, 49, + 49, 112, 112, 175, 175, 238, 238, 301, 301, 364, 364, 427, 427, + 490, 490, 553, 553, 616, 616, 679, 679, 742, 742, 805, 805, 868, + 868, 931, 931, 994, 994, 1057, 1057, 1120, 1120, 1183, 1183, 1246, 1246, + 1309, 1309, 1372, 1372, 1435, 1435, 1498, 1498, 1561, 1561, 1624, 1624, 1687, + 1687, 1750, 1750, 1813, 1813, 1876, 1876, 1939, 1939, 2002, 50, 50, 50, + 113, 113, 176, 176, 239, 239, 302, 302, 365, 365, 428, 428, 491, + 491, 554, 554, 617, 617, 680, 680, 743, 743, 806, 806, 869, 869, + 932, 932, 995, 995, 1058, 1058, 1121, 1121, 1184, 1184, 1247, 1247, 1310, + 1310, 1373, 1373, 1436, 1436, 1499, 1499, 1562, 1562, 1625, 1625, 1688, 1688, + 1751, 1751, 1814, 1814, 1877, 1877, 1940, 1940, 2003, 51, 51, 51, 114, + 114, 177, 177, 240, 240, 303, 303, 366, 366, 429, 429, 492, 492, + 555, 555, 618, 618, 681, 681, 744, 744, 807, 807, 870, 870, 933, + 933, 996, 996, 1059, 1059, 1122, 1122, 1185, 1185, 1248, 1248, 1311, 1311, + 1374, 1374, 1437, 1437, 1500, 1500, 1563, 1563, 1626, 1626, 1689, 1689, 1752, + 1752, 1815, 1815, 1878, 1878, 1941, 1941, 2004, 52, 52, 52, 115, 115, + 178, 178, 241, 241, 304, 304, 367, 367, 430, 430, 493, 493, 556, + 556, 619, 619, 682, 682, 745, 745, 808, 808, 871, 871, 934, 934, + 997, 997, 1060, 1060, 1123, 1123, 1186, 1186, 1249, 1249, 1312, 1312, 1375, + 1375, 1438, 1438, 1501, 1501, 1564, 1564, 1627, 1627, 1690, 1690, 1753, 1753, + 1816, 1816, 1879, 1879, 1942, 1942, 2005, 53, 53, 53, 116, 116, 179, + 179, 242, 242, 305, 305, 368, 368, 431, 431, 494, 494, 557, 557, + 620, 620, 683, 683, 746, 746, 809, 809, 872, 872, 935, 935, 998, + 998, 1061, 1061, 1124, 1124, 1187, 1187, 1250, 1250, 1313, 1313, 1376, 1376, + 1439, 1439, 1502, 1502, 1565, 1565, 1628, 1628, 1691, 1691, 1754, 1754, 1817, + 1817, 1880, 1880, 1943, 1943, 2006, 54, 54, 54, 117, 117, 180, 180, + 243, 243, 306, 306, 369, 369, 432, 432, 495, 495, 558, 558, 621, + 621, 684, 684, 747, 747, 810, 810, 873, 873, 936, 936, 999, 999, + 1062, 1062, 1125, 1125, 1188, 1188, 1251, 1251, 1314, 1314, 1377, 1377, 1440, + 1440, 1503, 1503, 1566, 1566, 1629, 1629, 1692, 1692, 1755, 1755, 1818, 1818, + 1881, 1881, 1944, 1944, 2007, 55, 55, 55, 118, 118, 181, 181, 244, + 244, 307, 307, 370, 370, 433, 433, 496, 496, 559, 559, 622, 622, + 685, 685, 748, 748, 811, 811, 874, 874, 937, 937, 1000, 1000, 1063, + 1063, 1126, 1126, 1189, 1189, 1252, 1252, 1315, 1315, 1378, 1378, 1441, 1441, + 1504, 1504, 1567, 1567, 1630, 1630, 1693, 1693, 1756, 1756, 1819, 1819, 1882, + 1882, 1945, 1945, 2008, 56, 56, 56, 119, 119, 182, 182, 245, 245, + 308, 308, 371, 371, 434, 434, 497, 497, 560, 560, 623, 623, 686, + 686, 749, 749, 812, 812, 875, 875, 938, 938, 1001, 1001, 1064, 1064, + 1127, 1127, 1190, 1190, 1253, 1253, 1316, 1316, 1379, 1379, 1442, 1442, 1505, + 1505, 1568, 1568, 1631, 1631, 1694, 1694, 1757, 1757, 1820, 1820, 1883, 1883, + 1946, 1946, 2009, 57, 57, 57, 120, 120, 183, 183, 246, 246, 309, + 309, 372, 372, 435, 435, 498, 498, 561, 561, 624, 624, 687, 687, + 750, 750, 813, 813, 876, 876, 939, 939, 1002, 1002, 1065, 1065, 1128, + 1128, 1191, 1191, 1254, 1254, 1317, 1317, 1380, 1380, 1443, 1443, 1506, 1506, + 1569, 1569, 1632, 1632, 1695, 1695, 1758, 1758, 1821, 1821, 1884, 1884, 1947, + 1947, 2010, 58, 58, 58, 121, 121, 184, 184, 247, 247, 310, 310, + 373, 373, 436, 436, 499, 499, 562, 562, 625, 625, 688, 688, 751, + 751, 814, 814, 877, 877, 940, 940, 1003, 1003, 1066, 1066, 1129, 1129, + 1192, 1192, 1255, 1255, 1318, 1318, 1381, 1381, 1444, 1444, 1507, 1507, 1570, + 1570, 1633, 1633, 1696, 1696, 1759, 1759, 1822, 1822, 1885, 1885, 1948, 1948, + 2011, 59, 59, 59, 122, 122, 185, 185, 248, 248, 311, 311, 374, + 374, 437, 437, 500, 500, 563, 563, 626, 626, 689, 689, 752, 752, + 815, 815, 878, 878, 941, 941, 1004, 1004, 1067, 1067, 1130, 1130, 1193, + 1193, 1256, 1256, 1319, 1319, 1382, 1382, 1445, 1445, 1508, 1508, 1571, 1571, + 1634, 1634, 1697, 1697, 1760, 1760, 1823, 1823, 1886, 1886, 1949, 1949, 2012, + 60, 60, 60, 123, 123, 186, 186, 249, 249, 312, 312, 375, 375, + 438, 438, 501, 501, 564, 564, 627, 627, 690, 690, 753, 753, 816, + 816, 879, 879, 942, 942, 1005, 1005, 1068, 1068, 1131, 1131, 1194, 1194, + 1257, 1257, 1320, 1320, 1383, 1383, 1446, 1446, 1509, 1509, 1572, 1572, 1635, + 1635, 1698, 1698, 1761, 1761, 1824, 1824, 1887, 1887, 1950, 1950, 2013, 61, + 61, 61, 124, 124, 187, 187, 250, 250, 313, 313, 376, 376, 439, + 439, 502, 502, 565, 565, 628, 628, 691, 691, 754, 754, 817, 817, + 880, 880, 943, 943, 1006, 1006, 1069, 1069, 1132, 1132, 1195, 1195, 1258, + 1258, 1321, 1321, 1384, 1384, 1447, 1447, 1510, 1510, 1573, 1573, 1636, 1636, + 1699, 1699, 1762, 1762, 1825, 1825, 1888, 1888, 1951, 1951, 2014, 62, 62, + 62, 125, 125, 188, 188, 251, 251, 314, 314, 377, 377, 440, 440, + 503, 503, 566, 566, 629, 629, 692, 692, 755, 755, 818, 818, 881, + 881, 944, 944, 1007, 1007, 1070, 1070, 1133, 1133, 1196, 1196, 1259, 1259, + 1322, 1322, 1385, 1385, 1448, 1448, 1511, 1511, 1574, 1574, 1637, 1637, 1700, + 1700, 1763, 1763, 1826, 1826, 1889, 1889, 1952, 1952, 2015, 63, 126, 126, + 189, 189, 252, 252, 315, 315, 378, 378, 441, 441, 504, 504, 567, + 567, 630, 630, 693, 693, 756, 756, 819, 819, 882, 882, 945, 945, + 1008, 1008, 1071, 1071, 1134, 1134, 1197, 1197, 1260, 1260, 1323, 1323, 1386, + 1386, 1449, 1449, 1512, 1512, 1575, 1575, 1638, 1638, 1701, 1701, 1764, 1764, + 1827, 1827, 1890, 1890, 1953, 1953, 2016, 127, 190, 190, 253, 253, 316, + 316, 379, 379, 442, 442, 505, 505, 568, 568, 631, 631, 694, 694, + 757, 757, 820, 820, 883, 883, 946, 946, 1009, 1009, 1072, 1072, 1135, + 1135, 1198, 1198, 1261, 1261, 1324, 1324, 1387, 1387, 1450, 1450, 1513, 1513, + 1576, 1576, 1639, 1639, 1702, 1702, 1765, 1765, 1828, 1828, 1891, 1891, 1954, + 1954, 2017, 191, 254, 254, 317, 317, 380, 380, 443, 443, 506, 506, + 569, 569, 632, 632, 695, 695, 758, 758, 821, 821, 884, 884, 947, + 947, 1010, 1010, 1073, 1073, 1136, 1136, 1199, 1199, 1262, 1262, 1325, 1325, + 1388, 1388, 1451, 1451, 1514, 1514, 1577, 1577, 1640, 1640, 1703, 1703, 1766, + 1766, 1829, 1829, 1892, 1892, 1955, 1955, 2018, 255, 318, 318, 381, 381, + 444, 444, 507, 507, 570, 570, 633, 633, 696, 696, 759, 759, 822, + 822, 885, 885, 948, 948, 1011, 1011, 1074, 1074, 1137, 1137, 1200, 1200, + 1263, 1263, 1326, 1326, 1389, 1389, 1452, 1452, 1515, 1515, 1578, 1578, 1641, + 1641, 1704, 1704, 1767, 1767, 1830, 1830, 1893, 1893, 1956, 1956, 2019, 319, + 382, 382, 445, 445, 508, 508, 571, 571, 634, 634, 697, 697, 760, + 760, 823, 823, 886, 886, 949, 949, 1012, 1012, 1075, 1075, 1138, 1138, + 1201, 1201, 1264, 1264, 1327, 1327, 1390, 1390, 1453, 1453, 1516, 1516, 1579, + 1579, 1642, 1642, 1705, 1705, 1768, 1768, 1831, 1831, 1894, 1894, 1957, 1957, + 2020, 383, 446, 446, 509, 509, 572, 572, 635, 635, 698, 698, 761, + 761, 824, 824, 887, 887, 950, 950, 1013, 1013, 1076, 1076, 1139, 1139, + 1202, 1202, 1265, 1265, 1328, 1328, 1391, 1391, 1454, 1454, 1517, 1517, 1580, + 1580, 1643, 1643, 1706, 1706, 1769, 1769, 1832, 1832, 1895, 1895, 1958, 1958, + 2021, 447, 510, 510, 573, 573, 636, 636, 699, 699, 762, 762, 825, + 825, 888, 888, 951, 951, 1014, 1014, 1077, 1077, 1140, 1140, 1203, 1203, + 1266, 1266, 1329, 1329, 1392, 1392, 1455, 1455, 1518, 1518, 1581, 1581, 1644, + 1644, 1707, 1707, 1770, 1770, 1833, 1833, 1896, 1896, 1959, 1959, 2022, 511, + 574, 574, 637, 637, 700, 700, 763, 763, 826, 826, 889, 889, 952, + 952, 1015, 1015, 1078, 1078, 1141, 1141, 1204, 1204, 1267, 1267, 1330, 1330, + 1393, 1393, 1456, 1456, 1519, 1519, 1582, 1582, 1645, 1645, 1708, 1708, 1771, + 1771, 1834, 1834, 1897, 1897, 1960, 1960, 2023, 575, 638, 638, 701, 701, + 764, 764, 827, 827, 890, 890, 953, 953, 1016, 1016, 1079, 1079, 1142, + 1142, 1205, 1205, 1268, 1268, 1331, 1331, 1394, 1394, 1457, 1457, 1520, 1520, + 1583, 1583, 1646, 1646, 1709, 1709, 1772, 1772, 1835, 1835, 1898, 1898, 1961, + 1961, 2024, 639, 702, 702, 765, 765, 828, 828, 891, 891, 954, 954, + 1017, 1017, 1080, 1080, 1143, 1143, 1206, 1206, 1269, 1269, 1332, 1332, 1395, + 1395, 1458, 1458, 1521, 1521, 1584, 1584, 1647, 1647, 1710, 1710, 1773, 1773, + 1836, 1836, 1899, 1899, 1962, 1962, 2025, 703, 766, 766, 829, 829, 892, + 892, 955, 955, 1018, 1018, 1081, 1081, 1144, 1144, 1207, 1207, 1270, 1270, + 1333, 1333, 1396, 1396, 1459, 1459, 1522, 1522, 1585, 1585, 1648, 1648, 1711, + 1711, 1774, 1774, 1837, 1837, 1900, 1900, 1963, 1963, 2026, 767, 830, 830, + 893, 893, 956, 956, 1019, 1019, 1082, 1082, 1145, 1145, 1208, 1208, 1271, + 1271, 1334, 1334, 1397, 1397, 1460, 1460, 1523, 1523, 1586, 1586, 1649, 1649, + 1712, 1712, 1775, 1775, 1838, 1838, 1901, 1901, 1964, 1964, 2027, 831, 894, + 894, 957, 957, 1020, 1020, 1083, 1083, 1146, 1146, 1209, 1209, 1272, 1272, + 1335, 1335, 1398, 1398, 1461, 1461, 1524, 1524, 1587, 1587, 1650, 1650, 1713, + 1713, 1776, 1776, 1839, 1839, 1902, 1902, 1965, 1965, 2028, 895, 958, 958, + 1021, 1021, 1084, 1084, 1147, 1147, 1210, 1210, 1273, 1273, 1336, 1336, 1399, + 1399, 1462, 1462, 1525, 1525, 1588, 1588, 1651, 1651, 1714, 1714, 1777, 1777, + 1840, 1840, 1903, 1903, 1966, 1966, 2029, 959, 1022, 1022, 1085, 1085, 1148, + 1148, 1211, 1211, 1274, 1274, 1337, 1337, 1400, 1400, 1463, 1463, 1526, 1526, + 1589, 1589, 1652, 1652, 1715, 1715, 1778, 1778, 1841, 1841, 1904, 1904, 1967, + 1967, 2030, 1023, 1086, 1086, 1149, 1149, 1212, 1212, 1275, 1275, 1338, 1338, + 1401, 1401, 1464, 1464, 1527, 1527, 1590, 1590, 1653, 1653, 1716, 1716, 1779, + 1779, 1842, 1842, 1905, 1905, 1968, 1968, 2031, 1087, 1150, 1150, 1213, 1213, + 1276, 1276, 1339, 1339, 1402, 1402, 1465, 1465, 1528, 1528, 1591, 1591, 1654, + 1654, 1717, 1717, 1780, 1780, 1843, 1843, 1906, 1906, 1969, 1969, 2032, 1151, + 1214, 1214, 1277, 1277, 1340, 1340, 1403, 1403, 1466, 1466, 1529, 1529, 1592, + 1592, 1655, 1655, 1718, 1718, 1781, 1781, 1844, 1844, 1907, 1907, 1970, 1970, + 2033, 1215, 1278, 1278, 1341, 1341, 1404, 1404, 1467, 1467, 1530, 1530, 1593, + 1593, 1656, 1656, 1719, 1719, 1782, 1782, 1845, 1845, 1908, 1908, 1971, 1971, + 2034, 1279, 1342, 1342, 1405, 1405, 1468, 1468, 1531, 1531, 1594, 1594, 1657, + 1657, 1720, 1720, 1783, 1783, 1846, 1846, 1909, 1909, 1972, 1972, 2035, 1343, + 1406, 1406, 1469, 1469, 1532, 1532, 1595, 1595, 1658, 1658, 1721, 1721, 1784, + 1784, 1847, 1847, 1910, 1910, 1973, 1973, 2036, 1407, 1470, 1470, 1533, 1533, + 1596, 1596, 1659, 1659, 1722, 1722, 1785, 1785, 1848, 1848, 1911, 1911, 1974, + 1974, 2037, 1471, 1534, 1534, 1597, 1597, 1660, 1660, 1723, 1723, 1786, 1786, + 1849, 1849, 1912, 1912, 1975, 1975, 2038, 1535, 1598, 1598, 1661, 1661, 1724, + 1724, 1787, 1787, 1850, 1850, 1913, 1913, 1976, 1976, 2039, 1599, 1662, 1662, + 1725, 1725, 1788, 1788, 1851, 1851, 1914, 1914, 1977, 1977, 2040, 1663, 1726, + 1726, 1789, 1789, 1852, 1852, 1915, 1915, 1978, 1978, 2041, 1727, 1790, 1790, + 1853, 1853, 1916, 1916, 1979, 1979, 2042, 1791, 1854, 1854, 1917, 1917, 1980, + 1980, 2043, 1855, 1918, 1918, 1981, 1981, 2044, 1919, 1982, 1982, 2045, 1983, + 2046, 0, 0 +}; + +DECLARE_ALIGNED(16, static const int16_t, default_scan_64x64_neighbors[4097 * MAX_NEIGHBORS]) = { 0, 0, 0, 0, 0, 0, 1, 64, 1, 1, 64, 64, 2, 65, 65, 128, 66, 129, 2, 2, 128, 128, 3, 66, 129, 192, @@ -5398,6 +6360,328 @@ DECLARE_ALIGNED(16, static const int16_t, av1_qtr_iscan_32x32[1024]) = { }; #if CONFIG_TX64X64 +DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_32x64[2048]) = { + 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, + 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, + 351, 378, 406, 435, 465, 496, 2, 4, 7, 11, 16, 22, 29, + 37, 46, 56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, + 232, 254, 277, 301, 326, 352, 379, 407, 436, 466, 497, 528, 5, + 8, 12, 17, 23, 30, 38, 47, 57, 68, 80, 93, 107, 122, + 138, 155, 173, 192, 212, 233, 255, 278, 302, 327, 353, 380, 408, + 437, 467, 498, 529, 560, 9, 13, 18, 24, 31, 39, 48, 58, + 69, 81, 94, 108, 123, 139, 156, 174, 193, 213, 234, 256, 279, + 303, 328, 354, 381, 409, 438, 468, 499, 530, 561, 592, 14, 19, + 25, 32, 40, 49, 59, 70, 82, 95, 109, 124, 140, 157, 175, + 194, 214, 235, 257, 280, 304, 329, 355, 382, 410, 439, 469, 500, + 531, 562, 593, 624, 20, 26, 33, 41, 50, 60, 71, 83, 96, + 110, 125, 141, 158, 176, 195, 215, 236, 258, 281, 305, 330, 356, + 383, 411, 440, 470, 501, 532, 563, 594, 625, 656, 27, 34, 42, + 51, 61, 72, 84, 97, 111, 126, 142, 159, 177, 196, 216, 237, + 259, 282, 306, 331, 357, 384, 412, 441, 471, 502, 533, 564, 595, + 626, 657, 688, 35, 43, 52, 62, 73, 85, 98, 112, 127, 143, + 160, 178, 197, 217, 238, 260, 283, 307, 332, 358, 385, 413, 442, + 472, 503, 534, 565, 596, 627, 658, 689, 720, 44, 53, 63, 74, + 86, 99, 113, 128, 144, 161, 179, 198, 218, 239, 261, 284, 308, + 333, 359, 386, 414, 443, 473, 504, 535, 566, 597, 628, 659, 690, + 721, 752, 54, 64, 75, 87, 100, 114, 129, 145, 162, 180, 199, + 219, 240, 262, 285, 309, 334, 360, 387, 415, 444, 474, 505, 536, + 567, 598, 629, 660, 691, 722, 753, 784, 65, 76, 88, 101, 115, + 130, 146, 163, 181, 200, 220, 241, 263, 286, 310, 335, 361, 388, + 416, 445, 475, 506, 537, 568, 599, 630, 661, 692, 723, 754, 785, + 816, 77, 89, 102, 116, 131, 147, 164, 182, 201, 221, 242, 264, + 287, 311, 336, 362, 389, 417, 446, 476, 507, 538, 569, 600, 631, + 662, 693, 724, 755, 786, 817, 848, 90, 103, 117, 132, 148, 165, + 183, 202, 222, 243, 265, 288, 312, 337, 363, 390, 418, 447, 477, + 508, 539, 570, 601, 632, 663, 694, 725, 756, 787, 818, 849, 880, + 104, 118, 133, 149, 166, 184, 203, 223, 244, 266, 289, 313, 338, + 364, 391, 419, 448, 478, 509, 540, 571, 602, 633, 664, 695, 726, + 757, 788, 819, 850, 881, 912, 119, 134, 150, 167, 185, 204, 224, + 245, 267, 290, 314, 339, 365, 392, 420, 449, 479, 510, 541, 572, + 603, 634, 665, 696, 727, 758, 789, 820, 851, 882, 913, 944, 135, + 151, 168, 186, 205, 225, 246, 268, 291, 315, 340, 366, 393, 421, + 450, 480, 511, 542, 573, 604, 635, 666, 697, 728, 759, 790, 821, + 852, 883, 914, 945, 976, 152, 169, 187, 206, 226, 247, 269, 292, + 316, 341, 367, 394, 422, 451, 481, 512, 543, 574, 605, 636, 667, + 698, 729, 760, 791, 822, 853, 884, 915, 946, 977, 1008, 170, 188, + 207, 227, 248, 270, 293, 317, 342, 368, 395, 423, 452, 482, 513, + 544, 575, 606, 637, 668, 699, 730, 761, 792, 823, 854, 885, 916, + 947, 978, 1009, 1040, 189, 208, 228, 249, 271, 294, 318, 343, 369, + 396, 424, 453, 483, 514, 545, 576, 607, 638, 669, 700, 731, 762, + 793, 824, 855, 886, 917, 948, 979, 1010, 1041, 1072, 209, 229, 250, + 272, 295, 319, 344, 370, 397, 425, 454, 484, 515, 546, 577, 608, + 639, 670, 701, 732, 763, 794, 825, 856, 887, 918, 949, 980, 1011, + 1042, 1073, 1104, 230, 251, 273, 296, 320, 345, 371, 398, 426, 455, + 485, 516, 547, 578, 609, 640, 671, 702, 733, 764, 795, 826, 857, + 888, 919, 950, 981, 1012, 1043, 1074, 1105, 1136, 252, 274, 297, 321, + 346, 372, 399, 427, 456, 486, 517, 548, 579, 610, 641, 672, 703, + 734, 765, 796, 827, 858, 889, 920, 951, 982, 1013, 1044, 1075, 1106, + 1137, 1168, 275, 298, 322, 347, 373, 400, 428, 457, 487, 518, 549, + 580, 611, 642, 673, 704, 735, 766, 797, 828, 859, 890, 921, 952, + 983, 1014, 1045, 1076, 1107, 1138, 1169, 1200, 299, 323, 348, 374, 401, + 429, 458, 488, 519, 550, 581, 612, 643, 674, 705, 736, 767, 798, + 829, 860, 891, 922, 953, 984, 1015, 1046, 1077, 1108, 1139, 1170, 1201, + 1232, 324, 349, 375, 402, 430, 459, 489, 520, 551, 582, 613, 644, + 675, 706, 737, 768, 799, 830, 861, 892, 923, 954, 985, 1016, 1047, + 1078, 1109, 1140, 1171, 1202, 1233, 1264, 350, 376, 403, 431, 460, 490, + 521, 552, 583, 614, 645, 676, 707, 738, 769, 800, 831, 862, 893, + 924, 955, 986, 1017, 1048, 1079, 1110, 1141, 1172, 1203, 1234, 1265, 1296, + 377, 404, 432, 461, 491, 522, 553, 584, 615, 646, 677, 708, 739, + 770, 801, 832, 863, 894, 925, 956, 987, 1018, 1049, 1080, 1111, 1142, + 1173, 1204, 1235, 1266, 1297, 1328, 405, 433, 462, 492, 523, 554, 585, + 616, 647, 678, 709, 740, 771, 802, 833, 864, 895, 926, 957, 988, + 1019, 1050, 1081, 1112, 1143, 1174, 1205, 1236, 1267, 1298, 1329, 1360, 434, + 463, 493, 524, 555, 586, 617, 648, 679, 710, 741, 772, 803, 834, + 865, 896, 927, 958, 989, 1020, 1051, 1082, 1113, 1144, 1175, 1206, 1237, + 1268, 1299, 1330, 1361, 1392, 464, 494, 525, 556, 587, 618, 649, 680, + 711, 742, 773, 804, 835, 866, 897, 928, 959, 990, 1021, 1052, 1083, + 1114, 1145, 1176, 1207, 1238, 1269, 1300, 1331, 1362, 1393, 1424, 495, 526, + 557, 588, 619, 650, 681, 712, 743, 774, 805, 836, 867, 898, 929, + 960, 991, 1022, 1053, 1084, 1115, 1146, 1177, 1208, 1239, 1270, 1301, 1332, + 1363, 1394, 1425, 1456, 527, 558, 589, 620, 651, 682, 713, 744, 775, + 806, 837, 868, 899, 930, 961, 992, 1023, 1054, 1085, 1116, 1147, 1178, + 1209, 1240, 1271, 1302, 1333, 1364, 1395, 1426, 1457, 1488, 559, 590, 621, + 652, 683, 714, 745, 776, 807, 838, 869, 900, 931, 962, 993, 1024, + 1055, 1086, 1117, 1148, 1179, 1210, 1241, 1272, 1303, 1334, 1365, 1396, 1427, + 1458, 1489, 1520, 591, 622, 653, 684, 715, 746, 777, 808, 839, 870, + 901, 932, 963, 994, 1025, 1056, 1087, 1118, 1149, 1180, 1211, 1242, 1273, + 1304, 1335, 1366, 1397, 1428, 1459, 1490, 1521, 1552, 623, 654, 685, 716, + 747, 778, 809, 840, 871, 902, 933, 964, 995, 1026, 1057, 1088, 1119, + 1150, 1181, 1212, 1243, 1274, 1305, 1336, 1367, 1398, 1429, 1460, 1491, 1522, + 1553, 1583, 655, 686, 717, 748, 779, 810, 841, 872, 903, 934, 965, + 996, 1027, 1058, 1089, 1120, 1151, 1182, 1213, 1244, 1275, 1306, 1337, 1368, + 1399, 1430, 1461, 1492, 1523, 1554, 1584, 1613, 687, 718, 749, 780, 811, + 842, 873, 904, 935, 966, 997, 1028, 1059, 1090, 1121, 1152, 1183, 1214, + 1245, 1276, 1307, 1338, 1369, 1400, 1431, 1462, 1493, 1524, 1555, 1585, 1614, + 1642, 719, 750, 781, 812, 843, 874, 905, 936, 967, 998, 1029, 1060, + 1091, 1122, 1153, 1184, 1215, 1246, 1277, 1308, 1339, 1370, 1401, 1432, 1463, + 1494, 1525, 1556, 1586, 1615, 1643, 1670, 751, 782, 813, 844, 875, 906, + 937, 968, 999, 1030, 1061, 1092, 1123, 1154, 1185, 1216, 1247, 1278, 1309, + 1340, 1371, 1402, 1433, 1464, 1495, 1526, 1557, 1587, 1616, 1644, 1671, 1697, + 783, 814, 845, 876, 907, 938, 969, 1000, 1031, 1062, 1093, 1124, 1155, + 1186, 1217, 1248, 1279, 1310, 1341, 1372, 1403, 1434, 1465, 1496, 1527, 1558, + 1588, 1617, 1645, 1672, 1698, 1723, 815, 846, 877, 908, 939, 970, 1001, + 1032, 1063, 1094, 1125, 1156, 1187, 1218, 1249, 1280, 1311, 1342, 1373, 1404, + 1435, 1466, 1497, 1528, 1559, 1589, 1618, 1646, 1673, 1699, 1724, 1748, 847, + 878, 909, 940, 971, 1002, 1033, 1064, 1095, 1126, 1157, 1188, 1219, 1250, + 1281, 1312, 1343, 1374, 1405, 1436, 1467, 1498, 1529, 1560, 1590, 1619, 1647, + 1674, 1700, 1725, 1749, 1772, 879, 910, 941, 972, 1003, 1034, 1065, 1096, + 1127, 1158, 1189, 1220, 1251, 1282, 1313, 1344, 1375, 1406, 1437, 1468, 1499, + 1530, 1561, 1591, 1620, 1648, 1675, 1701, 1726, 1750, 1773, 1795, 911, 942, + 973, 1004, 1035, 1066, 1097, 1128, 1159, 1190, 1221, 1252, 1283, 1314, 1345, + 1376, 1407, 1438, 1469, 1500, 1531, 1562, 1592, 1621, 1649, 1676, 1702, 1727, + 1751, 1774, 1796, 1817, 943, 974, 1005, 1036, 1067, 1098, 1129, 1160, 1191, + 1222, 1253, 1284, 1315, 1346, 1377, 1408, 1439, 1470, 1501, 1532, 1563, 1593, + 1622, 1650, 1677, 1703, 1728, 1752, 1775, 1797, 1818, 1838, 975, 1006, 1037, + 1068, 1099, 1130, 1161, 1192, 1223, 1254, 1285, 1316, 1347, 1378, 1409, 1440, + 1471, 1502, 1533, 1564, 1594, 1623, 1651, 1678, 1704, 1729, 1753, 1776, 1798, + 1819, 1839, 1858, 1007, 1038, 1069, 1100, 1131, 1162, 1193, 1224, 1255, 1286, + 1317, 1348, 1379, 1410, 1441, 1472, 1503, 1534, 1565, 1595, 1624, 1652, 1679, + 1705, 1730, 1754, 1777, 1799, 1820, 1840, 1859, 1877, 1039, 1070, 1101, 1132, + 1163, 1194, 1225, 1256, 1287, 1318, 1349, 1380, 1411, 1442, 1473, 1504, 1535, + 1566, 1596, 1625, 1653, 1680, 1706, 1731, 1755, 1778, 1800, 1821, 1841, 1860, + 1878, 1895, 1071, 1102, 1133, 1164, 1195, 1226, 1257, 1288, 1319, 1350, 1381, + 1412, 1443, 1474, 1505, 1536, 1567, 1597, 1626, 1654, 1681, 1707, 1732, 1756, + 1779, 1801, 1822, 1842, 1861, 1879, 1896, 1912, 1103, 1134, 1165, 1196, 1227, + 1258, 1289, 1320, 1351, 1382, 1413, 1444, 1475, 1506, 1537, 1568, 1598, 1627, + 1655, 1682, 1708, 1733, 1757, 1780, 1802, 1823, 1843, 1862, 1880, 1897, 1913, + 1928, 1135, 1166, 1197, 1228, 1259, 1290, 1321, 1352, 1383, 1414, 1445, 1476, + 1507, 1538, 1569, 1599, 1628, 1656, 1683, 1709, 1734, 1758, 1781, 1803, 1824, + 1844, 1863, 1881, 1898, 1914, 1929, 1943, 1167, 1198, 1229, 1260, 1291, 1322, + 1353, 1384, 1415, 1446, 1477, 1508, 1539, 1570, 1600, 1629, 1657, 1684, 1710, + 1735, 1759, 1782, 1804, 1825, 1845, 1864, 1882, 1899, 1915, 1930, 1944, 1957, + 1199, 1230, 1261, 1292, 1323, 1354, 1385, 1416, 1447, 1478, 1509, 1540, 1571, + 1601, 1630, 1658, 1685, 1711, 1736, 1760, 1783, 1805, 1826, 1846, 1865, 1883, + 1900, 1916, 1931, 1945, 1958, 1970, 1231, 1262, 1293, 1324, 1355, 1386, 1417, + 1448, 1479, 1510, 1541, 1572, 1602, 1631, 1659, 1686, 1712, 1737, 1761, 1784, + 1806, 1827, 1847, 1866, 1884, 1901, 1917, 1932, 1946, 1959, 1971, 1982, 1263, + 1294, 1325, 1356, 1387, 1418, 1449, 1480, 1511, 1542, 1573, 1603, 1632, 1660, + 1687, 1713, 1738, 1762, 1785, 1807, 1828, 1848, 1867, 1885, 1902, 1918, 1933, + 1947, 1960, 1972, 1983, 1993, 1295, 1326, 1357, 1388, 1419, 1450, 1481, 1512, + 1543, 1574, 1604, 1633, 1661, 1688, 1714, 1739, 1763, 1786, 1808, 1829, 1849, + 1868, 1886, 1903, 1919, 1934, 1948, 1961, 1973, 1984, 1994, 2003, 1327, 1358, + 1389, 1420, 1451, 1482, 1513, 1544, 1575, 1605, 1634, 1662, 1689, 1715, 1740, + 1764, 1787, 1809, 1830, 1850, 1869, 1887, 1904, 1920, 1935, 1949, 1962, 1974, + 1985, 1995, 2004, 2012, 1359, 1390, 1421, 1452, 1483, 1514, 1545, 1576, 1606, + 1635, 1663, 1690, 1716, 1741, 1765, 1788, 1810, 1831, 1851, 1870, 1888, 1905, + 1921, 1936, 1950, 1963, 1975, 1986, 1996, 2005, 2013, 2020, 1391, 1422, 1453, + 1484, 1515, 1546, 1577, 1607, 1636, 1664, 1691, 1717, 1742, 1766, 1789, 1811, + 1832, 1852, 1871, 1889, 1906, 1922, 1937, 1951, 1964, 1976, 1987, 1997, 2006, + 2014, 2021, 2027, 1423, 1454, 1485, 1516, 1547, 1578, 1608, 1637, 1665, 1692, + 1718, 1743, 1767, 1790, 1812, 1833, 1853, 1872, 1890, 1907, 1923, 1938, 1952, + 1965, 1977, 1988, 1998, 2007, 2015, 2022, 2028, 2033, 1455, 1486, 1517, 1548, + 1579, 1609, 1638, 1666, 1693, 1719, 1744, 1768, 1791, 1813, 1834, 1854, 1873, + 1891, 1908, 1924, 1939, 1953, 1966, 1978, 1989, 1999, 2008, 2016, 2023, 2029, + 2034, 2038, 1487, 1518, 1549, 1580, 1610, 1639, 1667, 1694, 1720, 1745, 1769, + 1792, 1814, 1835, 1855, 1874, 1892, 1909, 1925, 1940, 1954, 1967, 1979, 1990, + 2000, 2009, 2017, 2024, 2030, 2035, 2039, 2042, 1519, 1550, 1581, 1611, 1640, + 1668, 1695, 1721, 1746, 1770, 1793, 1815, 1836, 1856, 1875, 1893, 1910, 1926, + 1941, 1955, 1968, 1980, 1991, 2001, 2010, 2018, 2025, 2031, 2036, 2040, 2043, + 2045, 1551, 1582, 1612, 1641, 1669, 1696, 1722, 1747, 1771, 1794, 1816, 1837, + 1857, 1876, 1894, 1911, 1927, 1942, 1956, 1969, 1981, 1992, 2002, 2011, 2019, + 2026, 2032, 2037, 2041, 2044, 2046, 2047, +}; + +DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_64x32[2048]) = { + 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, + 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, + 351, 378, 406, 435, 465, 496, 528, 560, 592, 624, 656, 688, 720, + 752, 784, 816, 848, 880, 912, 944, 976, 1008, 1040, 1072, 1104, 1136, + 1168, 1200, 1232, 1264, 1296, 1328, 1360, 1392, 1424, 1456, 1488, 1520, 2, + 4, 7, 11, 16, 22, 29, 37, 46, 56, 67, 79, 92, 106, + 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, 352, 379, + 407, 436, 466, 497, 529, 561, 593, 625, 657, 689, 721, 753, 785, + 817, 849, 881, 913, 945, 977, 1009, 1041, 1073, 1105, 1137, 1169, 1201, + 1233, 1265, 1297, 1329, 1361, 1393, 1425, 1457, 1489, 1521, 1552, 5, 8, + 12, 17, 23, 30, 38, 47, 57, 68, 80, 93, 107, 122, 138, + 155, 173, 192, 212, 233, 255, 278, 302, 327, 353, 380, 408, 437, + 467, 498, 530, 562, 594, 626, 658, 690, 722, 754, 786, 818, 850, + 882, 914, 946, 978, 1010, 1042, 1074, 1106, 1138, 1170, 1202, 1234, 1266, + 1298, 1330, 1362, 1394, 1426, 1458, 1490, 1522, 1553, 1583, 9, 13, 18, + 24, 31, 39, 48, 58, 69, 81, 94, 108, 123, 139, 156, 174, + 193, 213, 234, 256, 279, 303, 328, 354, 381, 409, 438, 468, 499, + 531, 563, 595, 627, 659, 691, 723, 755, 787, 819, 851, 883, 915, + 947, 979, 1011, 1043, 1075, 1107, 1139, 1171, 1203, 1235, 1267, 1299, 1331, + 1363, 1395, 1427, 1459, 1491, 1523, 1554, 1584, 1613, 14, 19, 25, 32, + 40, 49, 59, 70, 82, 95, 109, 124, 140, 157, 175, 194, 214, + 235, 257, 280, 304, 329, 355, 382, 410, 439, 469, 500, 532, 564, + 596, 628, 660, 692, 724, 756, 788, 820, 852, 884, 916, 948, 980, + 1012, 1044, 1076, 1108, 1140, 1172, 1204, 1236, 1268, 1300, 1332, 1364, 1396, + 1428, 1460, 1492, 1524, 1555, 1585, 1614, 1642, 20, 26, 33, 41, 50, + 60, 71, 83, 96, 110, 125, 141, 158, 176, 195, 215, 236, 258, + 281, 305, 330, 356, 383, 411, 440, 470, 501, 533, 565, 597, 629, + 661, 693, 725, 757, 789, 821, 853, 885, 917, 949, 981, 1013, 1045, + 1077, 1109, 1141, 1173, 1205, 1237, 1269, 1301, 1333, 1365, 1397, 1429, 1461, + 1493, 1525, 1556, 1586, 1615, 1643, 1670, 27, 34, 42, 51, 61, 72, + 84, 97, 111, 126, 142, 159, 177, 196, 216, 237, 259, 282, 306, + 331, 357, 384, 412, 441, 471, 502, 534, 566, 598, 630, 662, 694, + 726, 758, 790, 822, 854, 886, 918, 950, 982, 1014, 1046, 1078, 1110, + 1142, 1174, 1206, 1238, 1270, 1302, 1334, 1366, 1398, 1430, 1462, 1494, 1526, + 1557, 1587, 1616, 1644, 1671, 1697, 35, 43, 52, 62, 73, 85, 98, + 112, 127, 143, 160, 178, 197, 217, 238, 260, 283, 307, 332, 358, + 385, 413, 442, 472, 503, 535, 567, 599, 631, 663, 695, 727, 759, + 791, 823, 855, 887, 919, 951, 983, 1015, 1047, 1079, 1111, 1143, 1175, + 1207, 1239, 1271, 1303, 1335, 1367, 1399, 1431, 1463, 1495, 1527, 1558, 1588, + 1617, 1645, 1672, 1698, 1723, 44, 53, 63, 74, 86, 99, 113, 128, + 144, 161, 179, 198, 218, 239, 261, 284, 308, 333, 359, 386, 414, + 443, 473, 504, 536, 568, 600, 632, 664, 696, 728, 760, 792, 824, + 856, 888, 920, 952, 984, 1016, 1048, 1080, 1112, 1144, 1176, 1208, 1240, + 1272, 1304, 1336, 1368, 1400, 1432, 1464, 1496, 1528, 1559, 1589, 1618, 1646, + 1673, 1699, 1724, 1748, 54, 64, 75, 87, 100, 114, 129, 145, 162, + 180, 199, 219, 240, 262, 285, 309, 334, 360, 387, 415, 444, 474, + 505, 537, 569, 601, 633, 665, 697, 729, 761, 793, 825, 857, 889, + 921, 953, 985, 1017, 1049, 1081, 1113, 1145, 1177, 1209, 1241, 1273, 1305, + 1337, 1369, 1401, 1433, 1465, 1497, 1529, 1560, 1590, 1619, 1647, 1674, 1700, + 1725, 1749, 1772, 65, 76, 88, 101, 115, 130, 146, 163, 181, 200, + 220, 241, 263, 286, 310, 335, 361, 388, 416, 445, 475, 506, 538, + 570, 602, 634, 666, 698, 730, 762, 794, 826, 858, 890, 922, 954, + 986, 1018, 1050, 1082, 1114, 1146, 1178, 1210, 1242, 1274, 1306, 1338, 1370, + 1402, 1434, 1466, 1498, 1530, 1561, 1591, 1620, 1648, 1675, 1701, 1726, 1750, + 1773, 1795, 77, 89, 102, 116, 131, 147, 164, 182, 201, 221, 242, + 264, 287, 311, 336, 362, 389, 417, 446, 476, 507, 539, 571, 603, + 635, 667, 699, 731, 763, 795, 827, 859, 891, 923, 955, 987, 1019, + 1051, 1083, 1115, 1147, 1179, 1211, 1243, 1275, 1307, 1339, 1371, 1403, 1435, + 1467, 1499, 1531, 1562, 1592, 1621, 1649, 1676, 1702, 1727, 1751, 1774, 1796, + 1817, 90, 103, 117, 132, 148, 165, 183, 202, 222, 243, 265, 288, + 312, 337, 363, 390, 418, 447, 477, 508, 540, 572, 604, 636, 668, + 700, 732, 764, 796, 828, 860, 892, 924, 956, 988, 1020, 1052, 1084, + 1116, 1148, 1180, 1212, 1244, 1276, 1308, 1340, 1372, 1404, 1436, 1468, 1500, + 1532, 1563, 1593, 1622, 1650, 1677, 1703, 1728, 1752, 1775, 1797, 1818, 1838, + 104, 118, 133, 149, 166, 184, 203, 223, 244, 266, 289, 313, 338, + 364, 391, 419, 448, 478, 509, 541, 573, 605, 637, 669, 701, 733, + 765, 797, 829, 861, 893, 925, 957, 989, 1021, 1053, 1085, 1117, 1149, + 1181, 1213, 1245, 1277, 1309, 1341, 1373, 1405, 1437, 1469, 1501, 1533, 1564, + 1594, 1623, 1651, 1678, 1704, 1729, 1753, 1776, 1798, 1819, 1839, 1858, 119, + 134, 150, 167, 185, 204, 224, 245, 267, 290, 314, 339, 365, 392, + 420, 449, 479, 510, 542, 574, 606, 638, 670, 702, 734, 766, 798, + 830, 862, 894, 926, 958, 990, 1022, 1054, 1086, 1118, 1150, 1182, 1214, + 1246, 1278, 1310, 1342, 1374, 1406, 1438, 1470, 1502, 1534, 1565, 1595, 1624, + 1652, 1679, 1705, 1730, 1754, 1777, 1799, 1820, 1840, 1859, 1877, 135, 151, + 168, 186, 205, 225, 246, 268, 291, 315, 340, 366, 393, 421, 450, + 480, 511, 543, 575, 607, 639, 671, 703, 735, 767, 799, 831, 863, + 895, 927, 959, 991, 1023, 1055, 1087, 1119, 1151, 1183, 1215, 1247, 1279, + 1311, 1343, 1375, 1407, 1439, 1471, 1503, 1535, 1566, 1596, 1625, 1653, 1680, + 1706, 1731, 1755, 1778, 1800, 1821, 1841, 1860, 1878, 1895, 152, 169, 187, + 206, 226, 247, 269, 292, 316, 341, 367, 394, 422, 451, 481, 512, + 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, + 960, 992, 1024, 1056, 1088, 1120, 1152, 1184, 1216, 1248, 1280, 1312, 1344, + 1376, 1408, 1440, 1472, 1504, 1536, 1567, 1597, 1626, 1654, 1681, 1707, 1732, + 1756, 1779, 1801, 1822, 1842, 1861, 1879, 1896, 1912, 170, 188, 207, 227, + 248, 270, 293, 317, 342, 368, 395, 423, 452, 482, 513, 545, 577, + 609, 641, 673, 705, 737, 769, 801, 833, 865, 897, 929, 961, 993, + 1025, 1057, 1089, 1121, 1153, 1185, 1217, 1249, 1281, 1313, 1345, 1377, 1409, + 1441, 1473, 1505, 1537, 1568, 1598, 1627, 1655, 1682, 1708, 1733, 1757, 1780, + 1802, 1823, 1843, 1862, 1880, 1897, 1913, 1928, 189, 208, 228, 249, 271, + 294, 318, 343, 369, 396, 424, 453, 483, 514, 546, 578, 610, 642, + 674, 706, 738, 770, 802, 834, 866, 898, 930, 962, 994, 1026, 1058, + 1090, 1122, 1154, 1186, 1218, 1250, 1282, 1314, 1346, 1378, 1410, 1442, 1474, + 1506, 1538, 1569, 1599, 1628, 1656, 1683, 1709, 1734, 1758, 1781, 1803, 1824, + 1844, 1863, 1881, 1898, 1914, 1929, 1943, 209, 229, 250, 272, 295, 319, + 344, 370, 397, 425, 454, 484, 515, 547, 579, 611, 643, 675, 707, + 739, 771, 803, 835, 867, 899, 931, 963, 995, 1027, 1059, 1091, 1123, + 1155, 1187, 1219, 1251, 1283, 1315, 1347, 1379, 1411, 1443, 1475, 1507, 1539, + 1570, 1600, 1629, 1657, 1684, 1710, 1735, 1759, 1782, 1804, 1825, 1845, 1864, + 1882, 1899, 1915, 1930, 1944, 1957, 230, 251, 273, 296, 320, 345, 371, + 398, 426, 455, 485, 516, 548, 580, 612, 644, 676, 708, 740, 772, + 804, 836, 868, 900, 932, 964, 996, 1028, 1060, 1092, 1124, 1156, 1188, + 1220, 1252, 1284, 1316, 1348, 1380, 1412, 1444, 1476, 1508, 1540, 1571, 1601, + 1630, 1658, 1685, 1711, 1736, 1760, 1783, 1805, 1826, 1846, 1865, 1883, 1900, + 1916, 1931, 1945, 1958, 1970, 252, 274, 297, 321, 346, 372, 399, 427, + 456, 486, 517, 549, 581, 613, 645, 677, 709, 741, 773, 805, 837, + 869, 901, 933, 965, 997, 1029, 1061, 1093, 1125, 1157, 1189, 1221, 1253, + 1285, 1317, 1349, 1381, 1413, 1445, 1477, 1509, 1541, 1572, 1602, 1631, 1659, + 1686, 1712, 1737, 1761, 1784, 1806, 1827, 1847, 1866, 1884, 1901, 1917, 1932, + 1946, 1959, 1971, 1982, 275, 298, 322, 347, 373, 400, 428, 457, 487, + 518, 550, 582, 614, 646, 678, 710, 742, 774, 806, 838, 870, 902, + 934, 966, 998, 1030, 1062, 1094, 1126, 1158, 1190, 1222, 1254, 1286, 1318, + 1350, 1382, 1414, 1446, 1478, 1510, 1542, 1573, 1603, 1632, 1660, 1687, 1713, + 1738, 1762, 1785, 1807, 1828, 1848, 1867, 1885, 1902, 1918, 1933, 1947, 1960, + 1972, 1983, 1993, 299, 323, 348, 374, 401, 429, 458, 488, 519, 551, + 583, 615, 647, 679, 711, 743, 775, 807, 839, 871, 903, 935, 967, + 999, 1031, 1063, 1095, 1127, 1159, 1191, 1223, 1255, 1287, 1319, 1351, 1383, + 1415, 1447, 1479, 1511, 1543, 1574, 1604, 1633, 1661, 1688, 1714, 1739, 1763, + 1786, 1808, 1829, 1849, 1868, 1886, 1903, 1919, 1934, 1948, 1961, 1973, 1984, + 1994, 2003, 324, 349, 375, 402, 430, 459, 489, 520, 552, 584, 616, + 648, 680, 712, 744, 776, 808, 840, 872, 904, 936, 968, 1000, 1032, + 1064, 1096, 1128, 1160, 1192, 1224, 1256, 1288, 1320, 1352, 1384, 1416, 1448, + 1480, 1512, 1544, 1575, 1605, 1634, 1662, 1689, 1715, 1740, 1764, 1787, 1809, + 1830, 1850, 1869, 1887, 1904, 1920, 1935, 1949, 1962, 1974, 1985, 1995, 2004, + 2012, 350, 376, 403, 431, 460, 490, 521, 553, 585, 617, 649, 681, + 713, 745, 777, 809, 841, 873, 905, 937, 969, 1001, 1033, 1065, 1097, + 1129, 1161, 1193, 1225, 1257, 1289, 1321, 1353, 1385, 1417, 1449, 1481, 1513, + 1545, 1576, 1606, 1635, 1663, 1690, 1716, 1741, 1765, 1788, 1810, 1831, 1851, + 1870, 1888, 1905, 1921, 1936, 1950, 1963, 1975, 1986, 1996, 2005, 2013, 2020, + 377, 404, 432, 461, 491, 522, 554, 586, 618, 650, 682, 714, 746, + 778, 810, 842, 874, 906, 938, 970, 1002, 1034, 1066, 1098, 1130, 1162, + 1194, 1226, 1258, 1290, 1322, 1354, 1386, 1418, 1450, 1482, 1514, 1546, 1577, + 1607, 1636, 1664, 1691, 1717, 1742, 1766, 1789, 1811, 1832, 1852, 1871, 1889, + 1906, 1922, 1937, 1951, 1964, 1976, 1987, 1997, 2006, 2014, 2021, 2027, 405, + 433, 462, 492, 523, 555, 587, 619, 651, 683, 715, 747, 779, 811, + 843, 875, 907, 939, 971, 1003, 1035, 1067, 1099, 1131, 1163, 1195, 1227, + 1259, 1291, 1323, 1355, 1387, 1419, 1451, 1483, 1515, 1547, 1578, 1608, 1637, + 1665, 1692, 1718, 1743, 1767, 1790, 1812, 1833, 1853, 1872, 1890, 1907, 1923, + 1938, 1952, 1965, 1977, 1988, 1998, 2007, 2015, 2022, 2028, 2033, 434, 463, + 493, 524, 556, 588, 620, 652, 684, 716, 748, 780, 812, 844, 876, + 908, 940, 972, 1004, 1036, 1068, 1100, 1132, 1164, 1196, 1228, 1260, 1292, + 1324, 1356, 1388, 1420, 1452, 1484, 1516, 1548, 1579, 1609, 1638, 1666, 1693, + 1719, 1744, 1768, 1791, 1813, 1834, 1854, 1873, 1891, 1908, 1924, 1939, 1953, + 1966, 1978, 1989, 1999, 2008, 2016, 2023, 2029, 2034, 2038, 464, 494, 525, + 557, 589, 621, 653, 685, 717, 749, 781, 813, 845, 877, 909, 941, + 973, 1005, 1037, 1069, 1101, 1133, 1165, 1197, 1229, 1261, 1293, 1325, 1357, + 1389, 1421, 1453, 1485, 1517, 1549, 1580, 1610, 1639, 1667, 1694, 1720, 1745, + 1769, 1792, 1814, 1835, 1855, 1874, 1892, 1909, 1925, 1940, 1954, 1967, 1979, + 1990, 2000, 2009, 2017, 2024, 2030, 2035, 2039, 2042, 495, 526, 558, 590, + 622, 654, 686, 718, 750, 782, 814, 846, 878, 910, 942, 974, 1006, + 1038, 1070, 1102, 1134, 1166, 1198, 1230, 1262, 1294, 1326, 1358, 1390, 1422, + 1454, 1486, 1518, 1550, 1581, 1611, 1640, 1668, 1695, 1721, 1746, 1770, 1793, + 1815, 1836, 1856, 1875, 1893, 1910, 1926, 1941, 1955, 1968, 1980, 1991, 2001, + 2010, 2018, 2025, 2031, 2036, 2040, 2043, 2045, 527, 559, 591, 623, 655, + 687, 719, 751, 783, 815, 847, 879, 911, 943, 975, 1007, 1039, 1071, + 1103, 1135, 1167, 1199, 1231, 1263, 1295, 1327, 1359, 1391, 1423, 1455, 1487, + 1519, 1551, 1582, 1612, 1641, 1669, 1696, 1722, 1747, 1771, 1794, 1816, 1837, + 1857, 1876, 1894, 1911, 1927, 1942, 1956, 1969, 1981, 1992, 2002, 2011, 2019, + 2026, 2032, 2037, 2041, 2044, 2046, 2047, +}; + DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_64x64[4096]) = { 0, 1, 4, 9, 15, 22, 33, 43, 56, 71, 86, 104, 121, 142, 166, 189, 214, 239, 269, 300, 331, 363, 400, 435, 471, 510, @@ -6040,6 +7324,82 @@ const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES] = { { mcol_scan_32x16, av1_mcol_iscan_32x16, mcol_scan_32x16_neighbors }, #endif // CONFIG_EXT_TX }, +#if CONFIG_TX64X64 + { + // TX_32X64 + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, +#if CONFIG_EXT_TX + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, +#endif // CONFIG_EXT_TX + }, + { + // TX_64X32 + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, +#if CONFIG_EXT_TX + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, +#endif // CONFIG_EXT_TX + } +#endif // CONFIG_TX64X64 }; const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = { @@ -6361,6 +7721,82 @@ const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = { { mcol_scan_32x16, av1_mcol_iscan_32x16, mcol_scan_32x16_neighbors }, #endif // CONFIG_EXT_TX }, +#if CONFIG_TX64X64 + { + // TX_32X64 + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, +#if CONFIG_EXT_TX + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, + { default_scan_32x64, av1_default_iscan_32x64, + default_scan_32x64_neighbors }, +#endif // CONFIG_EXT_TX + }, + { + // TX_64X32 + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, +#if CONFIG_EXT_TX + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, + { default_scan_64x32, av1_default_iscan_64x32, + default_scan_64x32_neighbors }, +#endif // CONFIG_EXT_TX + }, +#endif // CONFIG_TX64X64 { // TX_4X16 { default_scan_4x16, av1_default_iscan_4x16, @@ -6604,6 +8040,151 @@ static INLINE int clamp_64(int64_t value, int low, int high) { return value < low ? low : (value > high ? high : (int)value); } +#if USE_2X2_PROB +static int do_down_sample(TX_SIZE tx_size) { + const int tx_w = tx_size_wide[tx_size]; + const int tx_h = tx_size_high[tx_size]; + if (tx_w > 8 || tx_h > 8) { + return 1; + } else { + return 0; + } +} + +void av1_down_sample_scan_count(uint32_t *non_zero_count_ds, + const uint32_t *non_zero_count, + TX_SIZE tx_size) { + const int tx_w = tx_size_wide[tx_size]; + const int tx_h = tx_size_high[tx_size]; + if (tx_w > 8 && tx_h > 8) { + const int tx_w_ds = tx_w >> 1; + const int tx_h_ds = tx_h >> 1; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds << 1; + const int c = c_ds << 1; + const int ci = r * tx_w + c; + non_zero_count_ds[ci_ds] = non_zero_count[ci]; + } + } + } else if (tx_w > 8 && tx_h <= 8) { + const int tx_w_ds = tx_w >> 1; + const int tx_h_ds = tx_h; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds; + const int c = c_ds << 1; + const int ci = r * tx_w + c; + non_zero_count_ds[ci_ds] = non_zero_count[ci]; + } + } + } else if (tx_w <= 8 && tx_h > 8) { + const int tx_w_ds = tx_w; + const int tx_h_ds = tx_h >> 1; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds << 1; + const int c = c_ds; + const int ci = r * tx_w + c; + non_zero_count_ds[ci_ds] = non_zero_count[ci]; + } + } + } else { + assert(0); + } +} + +void av1_up_sample_scan_count(uint32_t *non_zero_count, + const uint32_t *non_zero_count_ds, + TX_SIZE tx_size, unsigned int block_num) { + const int tx_w = tx_size_wide[tx_size]; + const int tx_h = tx_size_high[tx_size]; + if (tx_w > 8 && tx_h > 8) { + const int tx_w_ds = tx_w >> 1; + const int tx_h_ds = tx_h >> 1; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds << 1; + const int c = c_ds << 1; + const int ci = r * tx_w + c; + non_zero_count[ci] = non_zero_count_ds[ci_ds]; + if (c_ds + 1 < tx_w_ds) { + uint32_t count = + non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + 1]; + count = ROUND_POWER_OF_TWO(count, 1); + count = clamp32u(count, 0, block_num); + non_zero_count[ci + 1] = count; + } else { + non_zero_count[ci + 1] = non_zero_count_ds[ci_ds]; + } + } + } + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c = 0; c < tx_w; ++c) { + const int r = r_ds << 1; + const int ci = r * tx_w + c; + if (r + 2 < tx_h) { + uint32_t count = non_zero_count[ci] + non_zero_count[ci + 2 * tx_w]; + count = ROUND_POWER_OF_TWO(count, 1); + count = clamp32u(count, 0, block_num); + non_zero_count[ci + tx_w] = count; + } else { + non_zero_count[ci + tx_w] = non_zero_count[ci]; + } + } + } + } else if (tx_w > 8 && tx_h <= 8) { + const int tx_w_ds = tx_w >> 1; + const int tx_h_ds = tx_h; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds; + const int c = c_ds << 1; + const int ci = r * tx_w + c; + non_zero_count[ci] = non_zero_count_ds[ci_ds]; + if (c_ds + 1 < tx_w_ds) { + uint32_t count = + non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + 1]; + count = ROUND_POWER_OF_TWO(count, 1); + count = clamp32u(count, 0, block_num); + non_zero_count[ci + 1] = count; + } else { + non_zero_count[ci + 1] = non_zero_count_ds[ci_ds]; + } + } + } + } else if (tx_w <= 8 && tx_h > 8) { + const int tx_w_ds = tx_w; + const int tx_h_ds = tx_h >> 1; + for (int r_ds = 0; r_ds < tx_h_ds; ++r_ds) { + for (int c_ds = 0; c_ds < tx_w_ds; ++c_ds) { + const int ci_ds = r_ds * tx_w_ds + c_ds; + const int r = r_ds << 1; + const int c = c_ds; + const int ci = r * tx_w + c; + non_zero_count[ci] = non_zero_count_ds[ci_ds]; + if (r_ds + 1 < tx_h_ds) { + uint32_t count = + non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + tx_w_ds]; + count = ROUND_POWER_OF_TWO(count, 1); + count = clamp32u(count, 0, block_num); + non_zero_count[ci + tx_w] = count; + } else { + non_zero_count[ci + tx_w] = non_zero_count_ds[ci_ds]; + } + } + } + } else { + assert(0); + } +} +#endif + static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type, int rate) { FRAME_CONTEXT *pre_fc = cm->pre_fc; @@ -6612,12 +8193,27 @@ static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type, uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type); const int tx2d_size = tx_size_2d[tx_size]; unsigned int block_num = cm->counts.txb_count[tx_size][tx_type]; +#if USE_2X2_PROB +#if CONFIG_TX64X64 + DECLARE_ALIGNED(16, uint32_t, non_zero_count_ds[1024]); + assert((tx2d_size >> 2) <= 1024); +#else // CONFIG_TX64X64 + DECLARE_ALIGNED(16, uint32_t, non_zero_count_ds[256]); + assert((tx2d_size >> 2) <= 256); +#endif // CONFIG_TX64X64 + if (do_down_sample(tx_size)) { + av1_down_sample_scan_count(non_zero_count_ds, non_zero_count, tx_size); + av1_up_sample_scan_count(non_zero_count, non_zero_count_ds, tx_size, + block_num); + } +#endif int i; + const int inv_precision = 30; + int32_t inv_block_num = block_num == 0 ? 0 : (1 << inv_precision) / block_num; for (i = 0; i < tx2d_size; i++) { int64_t curr_prob = - block_num == 0 - ? 0 - : (non_zero_count[i] << ADAPT_SCAN_PROB_PRECISION) / block_num; + block_num == 0 ? 0 : ((non_zero_count[i] * inv_block_num) >> + (inv_precision - ADAPT_SCAN_PROB_PRECISION)); int64_t prev_prob = prev_non_zero_prob[i]; int64_t pred_prob = (curr_prob * rate + @@ -6643,10 +8239,12 @@ static void update_scan_count(int16_t *scan, int max_scan, void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts, TX_SIZE tx_size, TX_TYPE tx_type, const tran_low_t *dqcoeffs, int max_scan) { - int16_t *scan = get_adapt_scan(cm->fc, tx_size, tx_type); - uint32_t *non_zero_count = get_non_zero_counts(counts, tx_size, tx_type); - update_scan_count(scan, max_scan, dqcoeffs, non_zero_count); - ++counts->txb_count[tx_size][tx_type]; + if (cm->use_adapt_scan && do_adapt_scan(tx_size, tx_type)) { + int16_t *scan = get_adapt_scan(cm->fc, tx_size, tx_type); + uint32_t *non_zero_count = get_non_zero_counts(counts, tx_size, tx_type); + update_scan_count(scan, max_scan, dqcoeffs, non_zero_count); + ++counts->txb_count[tx_size][tx_type]; + } } static int cmp_prob(const void *a, const void *b) { @@ -6670,24 +8268,7 @@ void av1_augment_prob(TX_SIZE tx_size, TX_TYPE tx_type, uint32_t *prob) { } } -// topological sort -static void dfs_scan(int tx1d_size, int *scan_idx, int coeff_idx, int16_t *scan, - int16_t *iscan) { - const int r = coeff_idx / tx1d_size; - const int c = coeff_idx % tx1d_size; - - if (iscan[coeff_idx] != -1) return; - - if (r > 0) dfs_scan(tx1d_size, scan_idx, coeff_idx - tx1d_size, scan, iscan); - - if (c > 0) dfs_scan(tx1d_size, scan_idx, coeff_idx - 1, scan, iscan); - - scan[*scan_idx] = coeff_idx; - iscan[coeff_idx] = *scan_idx; - ++(*scan_idx); -} - -void av1_update_neighbors(int tx_size, const int16_t *scan, +void av1_update_neighbors(TX_SIZE tx_size, const int16_t *scan, const int16_t *iscan, int16_t *neighbors) { const int tx1d_wide = tx_size_wide[tx_size]; const int tx1d_high = tx_size_high[tx_size]; @@ -6731,6 +8312,74 @@ void av1_update_neighbors(int tx_size, const int16_t *scan, neighbors[tx2d_size * MAX_NEIGHBORS + 1] = scan[0]; } +#if USE_LIMIT_SCAN_DISTANCE +typedef struct SCAN_NB_QUEUE { + int nb_ci_queue[COEFF_IDX_SIZE + 1]; + int pr_si_queue[COEFF_IDX_SIZE + 1]; + int size; + int start; + int end; +} SCAN_NB_QUEUE; + +static void assign_scan_idx(int16_t coeff_idx, int16_t *scan_idx, int tx_width, + int tx_height, int16_t *scan, int16_t *iscan, + int16_t *visit, SCAN_NB_QUEUE *queue) { + if (visit[coeff_idx] != 2) { + assert(*scan_idx < tx_width * tx_height); + scan[*scan_idx] = coeff_idx; + iscan[coeff_idx] = *scan_idx; + visit[coeff_idx] = 2; + int row = coeff_idx / tx_width; + int col = coeff_idx % tx_width; + int right_ci = coeff_idx + 1; + if (col + 1 < tx_width && visit[right_ci] == 0) { + visit[right_ci] = 1; + queue->pr_si_queue[queue->end] = *scan_idx; + queue->nb_ci_queue[queue->end] = right_ci; + queue->end = (queue->end + 1) % queue->size; + } + int down_ci = coeff_idx + tx_width; + if (row + 1 < tx_height && visit[down_ci] == 0) { + visit[down_ci] = 1; + queue->pr_si_queue[queue->end] = *scan_idx; + queue->nb_ci_queue[queue->end] = down_ci; + queue->end = (queue->end + 1) % queue->size; + } + ++(*scan_idx); + } +} +static void limit_nb_scan_distance(TX_SIZE tx_size, int16_t *scan, + int16_t *iscan) { + const int tx2d_size = tx_size_2d[tx_size]; + int16_t visit[COEFF_IDX_SIZE] = { 0 }; + int16_t org_scan[COEFF_IDX_SIZE]; + memcpy(org_scan, scan, tx2d_size * sizeof(*scan)); + const int tx_width = tx_size_wide[tx_size]; + const int tx_height = tx_size_high[tx_size]; + const int limit = 2 * AOMMAX(tx_width, tx_height); + SCAN_NB_QUEUE queue; + queue.size = tx2d_size; + queue.start = 0; + queue.end = 0; + int16_t new_si = 0; + for (int16_t si = 0; si < tx2d_size; ++si) { + while (queue.start != queue.end && + queue.pr_si_queue[queue.start] + limit <= new_si) { + int nb_ci = queue.nb_ci_queue[queue.start]; + assign_scan_idx(nb_ci, &new_si, tx_width, tx_height, scan, iscan, visit, + &queue); + queue.start = (queue.start + 1) % queue.size; + } + + int16_t ci = org_scan[si]; + assign_scan_idx(ci, &new_si, tx_width, tx_height, scan, iscan, visit, + &queue); + } + assert(new_si == tx2d_size); +} +#endif // USE_LIMIT_SCAN_DISTANCE + +#if USE_TOPOLOGICAL_SORT void av1_update_sort_order(TX_SIZE tx_size, TX_TYPE tx_type, const uint32_t *non_zero_prob, int16_t *sort_order) { const SCAN_ORDER *sc = get_default_scan(tx_size, tx_type, 0); @@ -6749,6 +8398,23 @@ void av1_update_sort_order(TX_SIZE tx_size, TX_TYPE tx_type, } } +// topological sort +static void dfs_scan(int tx1d_size, int *scan_idx, int coeff_idx, int16_t *scan, + int16_t *iscan) { + const int r = coeff_idx / tx1d_size; + const int c = coeff_idx % tx1d_size; + + if (iscan[coeff_idx] != -1) return; + + if (r > 0) dfs_scan(tx1d_size, scan_idx, coeff_idx - tx1d_size, scan, iscan); + + if (c > 0) dfs_scan(tx1d_size, scan_idx, coeff_idx - 1, scan, iscan); + + scan[*scan_idx] = coeff_idx; + iscan[coeff_idx] = *scan_idx; + ++(*scan_idx); +} + void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan, int16_t *iscan) { int coeff_idx; @@ -6767,17 +8433,66 @@ void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan, dfs_scan(tx1d_size, &scan_idx, coeff_idx, scan, iscan); } } +#else + +static void filter_prob(TX_SIZE tx_size, uint32_t *prob) { + const int tx1d_wide = tx_size_wide[tx_size]; + const int tx1d_high = tx_size_high[tx_size]; + for (int r = tx1d_high - 1; r >= 0; --r) { + for (int c = tx1d_wide - 1; c >= 0; --c) { + int idx = r * tx1d_wide + c; + uint32_t v = prob[idx]; + if (r > 0 && prob[idx - tx1d_wide] < v) prob[idx - tx1d_wide] = v; + if (c > 0 && prob[idx - 1] < v) prob[idx - 1] = v; + } + } +} + +void av1_update_scan_order(TX_SIZE tx_size, TX_TYPE tx_type, + uint32_t *non_zero_prob, int16_t *scan, + int16_t *iscan) { + const SCAN_ORDER *sc = get_default_scan(tx_size, tx_type, 0); + uint32_t temp[COEFF_IDX_SIZE]; + const int tx2d_size = tx_size_2d[tx_size]; + int scan_idx; + assert(tx2d_size <= COEFF_IDX_SIZE); + memcpy(temp, non_zero_prob, tx2d_size * sizeof(*non_zero_prob)); + filter_prob(tx_size, temp); + av1_augment_prob(tx_size, tx_type, temp); + qsort(temp, tx2d_size, sizeof(*temp), cmp_prob); + for (scan_idx = 0; scan_idx < tx2d_size; ++scan_idx) { + const int default_scan_idx = + (temp[scan_idx] & COEFF_IDX_MASK) ^ COEFF_IDX_MASK; + const int coeff_idx = sc->scan[default_scan_idx]; + scan[scan_idx] = coeff_idx; + iscan[coeff_idx] = scan_idx; + } +} +#endif static void update_scan_order_facade(AV1_COMMON *cm, TX_SIZE tx_size, - TX_TYPE tx_type) { + TX_TYPE tx_type, int use_curr_frame) { +#if USE_TOPOLOGICAL_SORT int16_t sort_order[COEFF_IDX_SIZE]; - uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type); +#endif + uint32_t *non_zero_prob; + if (use_curr_frame) + non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type); + else + non_zero_prob = get_non_zero_prob(cm->pre_fc, tx_size, tx_type); int16_t *scan = get_adapt_scan(cm->fc, tx_size, tx_type); int16_t *iscan = get_adapt_iscan(cm->fc, tx_size, tx_type); int16_t *nb = get_adapt_nb(cm->fc, tx_size, tx_type); assert(tx_size_2d[tx_size] <= COEFF_IDX_SIZE); +#if USE_TOPOLOGICAL_SORT av1_update_sort_order(tx_size, tx_type, non_zero_prob, sort_order); av1_update_scan_order(tx_size, sort_order, scan, iscan); +#else + av1_update_scan_order(tx_size, tx_type, non_zero_prob, scan, iscan); +#endif +#if USE_LIMIT_SCAN_DISTANCE + limit_nb_scan_distance(tx_size, scan, iscan); +#endif // USE_LIMIT_SCAN_DISTANCE av1_update_neighbors(tx_size, scan, iscan, nb); } @@ -6819,36 +8534,48 @@ void av1_init_scan_order(AV1_COMMON *cm) { if (tx_size >= TX_SIZES) continue; #endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX) for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) { - uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type); - const int tx2d_size = tx_size_2d[tx_size]; - int i; - SCAN_ORDER *sc = &cm->fc->sc[tx_size][tx_type]; - for (i = 0; i < tx2d_size; ++i) { - non_zero_prob[i] = - (1 << ADAPT_SCAN_PROB_PRECISION) / 2; // init non_zero_prob to 0.5 + if (do_adapt_scan(tx_size, tx_type)) { + uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type); + const int tx2d_size = tx_size_2d[tx_size]; + int i; + SCAN_ORDER *sc = &cm->fc->sc[tx_size][tx_type]; + for (i = 0; i < tx2d_size; ++i) { + non_zero_prob[i] = (1 << ADAPT_SCAN_PROB_PRECISION) / + 2; // init non_zero_prob to 0.5 + } + update_scan_order_facade(cm, tx_size, tx_type, 1); + sc->scan = get_adapt_scan(cm->fc, tx_size, tx_type); + sc->iscan = get_adapt_iscan(cm->fc, tx_size, tx_type); + sc->neighbors = get_adapt_nb(cm->fc, tx_size, tx_type); + update_eob_threshold(cm, tx_size, tx_type); } - update_scan_order_facade(cm, tx_size, tx_type); - sc->scan = get_adapt_scan(cm->fc, tx_size, tx_type); - sc->iscan = get_adapt_iscan(cm->fc, tx_size, tx_type); - sc->neighbors = get_adapt_nb(cm->fc, tx_size, tx_type); - update_eob_threshold(cm, tx_size, tx_type); } } } void av1_adapt_scan_order(AV1_COMMON *cm) { - TX_SIZE tx_size; - for (tx_size = 0; tx_size < TX_SIZES_ALL; ++tx_size) { + if (cm->use_adapt_scan) { + TX_SIZE tx_size; +#if CACHE_SCAN_PROB + int use_curr_frame = 0; +#else // CACHE_SCAN_PROB + int use_curr_frame = 1; +#endif // CACHE_SCAN_PROB + + for (tx_size = 0; tx_size < TX_SIZES_ALL; ++tx_size) { #if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX) - if (tx_size > TX_32X16) continue; + if (tx_size > TX_32X16) continue; #else - if (tx_size >= TX_SIZES) continue; + if (tx_size >= TX_SIZES) continue; #endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX) - TX_TYPE tx_type; - for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) { - update_scan_prob(cm, tx_size, tx_type, ADAPT_SCAN_UPDATE_RATE); - update_scan_order_facade(cm, tx_size, tx_type); - update_eob_threshold(cm, tx_size, tx_type); + TX_TYPE tx_type; + for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) { + if (do_adapt_scan(tx_size, tx_type)) { + update_scan_prob(cm, tx_size, tx_type, ADAPT_SCAN_UPDATE_RATE); + update_scan_order_facade(cm, tx_size, tx_type, use_curr_frame); + update_eob_threshold(cm, tx_size, tx_type); + } + } } } } diff --git a/third_party/aom/av1/common/scan.h b/third_party/aom/av1/common/scan.h index c9911de4e..82d2e917f 100644 --- a/third_party/aom/av1/common/scan.h +++ b/third_party/aom/av1/common/scan.h @@ -30,6 +30,9 @@ extern const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES]; extern const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES]; #if CONFIG_ADAPT_SCAN +#define USE_2X2_PROB 1 +#define USE_TOPOLOGICAL_SORT 0 +#define USE_LIMIT_SCAN_DISTANCE 0 void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts, TX_SIZE tx_size, TX_TYPE tx_type, const tran_low_t *dqcoeffs, int max_scan); @@ -39,6 +42,7 @@ void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts, // will be scanned first void av1_augment_prob(TX_SIZE tx_size, TX_TYPE tx_type, uint32_t *prob); +#if USE_TOPOLOGICAL_SORT // apply quick sort on nonzero probabilities to obtain a sort order void av1_update_sort_order(TX_SIZE tx_size, TX_TYPE tx_type, const uint32_t *non_zero_prob, int16_t *sort_order); @@ -48,14 +52,24 @@ void av1_update_sort_order(TX_SIZE tx_size, TX_TYPE tx_type, // scanned before the to-be-scanned coefficient. void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan, int16_t *iscan); +#else // USE_TOPOLOGICAL_SORT +void av1_update_scan_order(TX_SIZE tx_size, TX_TYPE tx_type, + uint32_t *non_zero_prob, int16_t *scan, + int16_t *iscan); +#endif // USE_TOPOLOGICAL_SORT // For each coeff_idx in scan[], update its above and left neighbors in // neighbors[] accordingly. -void av1_update_neighbors(int tx_size, const int16_t *scan, +void av1_update_neighbors(TX_SIZE tx_size, const int16_t *scan, const int16_t *iscan, int16_t *neighbors); void av1_init_scan_order(AV1_COMMON *cm); void av1_adapt_scan_order(AV1_COMMON *cm); -#endif +#if USE_2X2_PROB +void av1_down_sample_scan_count(uint32_t *non_zero_count_ds, + const uint32_t *non_zero_count, + TX_SIZE tx_size); +#endif // USE_2X2_PROB +#endif // CONFIG_ADAPT_SCAN void av1_deliver_eob_threshold(const AV1_COMMON *cm, MACROBLOCKD *xd); static INLINE int get_coef_context(const int16_t *neighbors, @@ -77,6 +91,17 @@ static INLINE const SCAN_ORDER *get_default_scan(TX_SIZE tx_size, #endif // CONFIG_EXT_TX } +static INLINE int do_adapt_scan(TX_SIZE tx_size, TX_TYPE tx_type) { + (void)tx_size; +#if CONFIG_EXT_TX + if (tx_size_2d[tx_size] >= 1024 && tx_type != DCT_DCT) return 0; + return tx_type < IDTX; +#else + (void)tx_type; + return 1; +#endif +} + static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type, const MB_MODE_INFO *mbmi) { @@ -84,12 +109,15 @@ static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *cm, TX_SIZE tx_size, // use the DCT_DCT scan order for MRC_DCT for now if (tx_type == MRC_DCT) tx_type = DCT_DCT; #endif // CONFIG_MRC_TX +#if CONFIG_LGT_FROM_PRED + if (mbmi->use_lgt) tx_type = DCT_DCT; +#endif const int is_inter = is_inter_block(mbmi); #if CONFIG_ADAPT_SCAN (void)mbmi; (void)is_inter; #if CONFIG_EXT_TX - if (tx_type >= IDTX) + if (!do_adapt_scan(tx_size, tx_type)) return get_default_scan(tx_size, tx_type, is_inter); else #endif // CONFIG_EXT_TX diff --git a/third_party/aom/av1/common/seg_common.c b/third_party/aom/av1/common/seg_common.c index 21a853629..4603026bd 100644 --- a/third_party/aom/av1/common/seg_common.c +++ b/third_party/aom/av1/common/seg_common.c @@ -16,10 +16,18 @@ #include "av1/common/seg_common.h" #include "av1/common/quant_common.h" +#if CONFIG_LOOPFILTER_LEVEL +static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 1, 1, 0, 0 }; + +static const int seg_feature_data_max[SEG_LVL_MAX] = { + MAXQ, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 0 +}; +#else static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 0, 0 }; static const int seg_feature_data_max[SEG_LVL_MAX] = { MAXQ, MAX_LOOP_FILTER, 3, 0 }; +#endif // CONFIG_LOOPFILTER_LEVEL // These functions provide access to new segment level features. // Eventually these function may be "optimized out" but for the moment, @@ -46,10 +54,11 @@ int av1_is_segfeature_signed(SEG_LVL_FEATURES feature_id) { void av1_set_segdata(struct segmentation *seg, int segment_id, SEG_LVL_FEATURES feature_id, int seg_data) { - assert(seg_data <= seg_feature_data_max[feature_id]); if (seg_data < 0) { assert(seg_feature_data_signed[feature_id]); assert(-seg_data <= seg_feature_data_max[feature_id]); + } else { + assert(seg_data <= seg_feature_data_max[feature_id]); } seg->feature_data[segment_id][feature_id] = seg_data; diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index 8b199e64e..6d16aedb6 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -26,14 +26,37 @@ extern "C" { #define PREDICTION_PROBS 3 +#if CONFIG_LOOPFILTER_LEVEL +typedef enum { + SEG_LVL_ALT_Q, // Use alternate Quantizer .... + SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical + SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal + SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane + SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane + SEG_LVL_REF_FRAME, // Optional Segment reference frame + SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode +#if CONFIG_SEGMENT_ZEROMV + SEG_LVL_ZEROMV, + SEG_LVL_MAX +#else + SEG_LVL_MAX +#endif +} SEG_LVL_FEATURES; +#else // CONFIG_LOOPFILTER_LEVEL // Segment level features. typedef enum { SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame - SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode - SEG_LVL_MAX = 4 // Number of features supported + SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode +#if CONFIG_SEGMENT_ZEROMV + SEG_LVL_ZEROMV = 4, + SEG_LVL_MAX = 5 +#else + SEG_LVL_MAX = 4 +#endif } SEG_LVL_FEATURES; +#endif // CONFIG_LOOPFILTER_LEVEL struct segmentation { uint8_t enabled; diff --git a/third_party/aom/av1/common/thread_common.c b/third_party/aom/av1/common/thread_common.c index d96a71aef..eec8629ff 100644 --- a/third_party/aom/av1/common/thread_common.c +++ b/third_party/aom/av1/common/thread_common.c @@ -290,6 +290,13 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, int start, int stop, int y_only, AVxWorker *workers, int nworkers, AV1LfSync *lf_sync) { +#if CONFIG_EXT_PARTITION + printf( + "STOPPING: This code has not been modified to work with the " + "extended coding unit size experiment"); + exit(EXIT_FAILURE); +#endif // CONFIG_EXT_PARTITION + const AVxWorkerInterface *const winterface = aom_get_worker_interface(); // Number of superblock rows and cols const int sb_rows = mi_rows_aligned_to_sb(cm) >> cm->mib_size_log2; @@ -299,13 +306,6 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, const int num_workers = AOMMIN(nworkers, tile_cols); int i; -#if CONFIG_EXT_PARTITION - printf( - "STOPPING: This code has not been modified to work with the " - "extended coding unit size experiment"); - exit(EXIT_FAILURE); -#endif // CONFIG_EXT_PARTITION - if (!lf_sync->sync_range || sb_rows != lf_sync->rows || num_workers > lf_sync->num_workers) { av1_loop_filter_dealloc(lf_sync); @@ -416,8 +416,11 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, struct macroblockd_plane planes[MAX_MB_PLANE], - int frame_filter_level, int y_only, - int partial_frame, AVxWorker *workers, + int frame_filter_level, +#if CONFIG_LOOPFILTER_LEVEL + int frame_filter_level_r, +#endif + int y_only, int partial_frame, AVxWorker *workers, int num_workers, AV1LfSync *lf_sync) { int start_mi_row, end_mi_row, mi_rows_to_filter; @@ -431,8 +434,12 @@ void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, mi_rows_to_filter = AOMMAX(cm->mi_rows / 8, 8); } end_mi_row = start_mi_row + mi_rows_to_filter; - av1_loop_filter_frame_init(cm, frame_filter_level); - +#if CONFIG_LOOPFILTER_LEVEL + av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level_r, + y_only); +#else + av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level); +#endif // CONFIG_LOOPFILTER_LEVEL loop_filter_rows_mt(frame, cm, planes, start_mi_row, end_mi_row, y_only, workers, num_workers, lf_sync); } diff --git a/third_party/aom/av1/common/thread_common.h b/third_party/aom/av1/common/thread_common.h index 7b57ae8f3..6d118e60b 100644 --- a/third_party/aom/av1/common/thread_common.h +++ b/third_party/aom/av1/common/thread_common.h @@ -50,8 +50,11 @@ void av1_loop_filter_dealloc(AV1LfSync *lf_sync); // Multi-threaded loopfilter that uses the tile threads. void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, struct macroblockd_plane planes[MAX_MB_PLANE], - int frame_filter_level, int y_only, - int partial_frame, AVxWorker *workers, + int frame_filter_level, +#if CONFIG_LOOPFILTER_LEVEL + int frame_filter_level_r, +#endif + int y_only, int partial_frame, AVxWorker *workers, int num_workers, AV1LfSync *lf_sync); void av1_accumulate_frame_counts(struct FRAME_COUNTS *acc_counts, diff --git a/third_party/aom/av1/common/tile_common.c b/third_party/aom/av1/common/tile_common.c index 3bff53c22..507a01265 100644 --- a/third_party/aom/av1/common/tile_common.c +++ b/third_party/aom/av1/common/tile_common.c @@ -13,29 +13,18 @@ #include "av1/common/onyxc_int.h" #include "aom_dsp/aom_dsp_common.h" -void av1_tile_set_row(TileInfo *tile, const AV1_COMMON *cm, int row) { - tile->mi_row_start = row * cm->tile_height; - tile->mi_row_end = AOMMIN(tile->mi_row_start + cm->tile_height, cm->mi_rows); -} - -void av1_tile_set_col(TileInfo *tile, const AV1_COMMON *cm, int col) { - tile->mi_col_start = col * cm->tile_width; - tile->mi_col_end = AOMMIN(tile->mi_col_start + cm->tile_width, cm->mi_cols); -} - #if CONFIG_DEPENDENT_HORZTILES void av1_tile_set_tg_boundary(TileInfo *tile, const AV1_COMMON *const cm, int row, int col) { - if (row < cm->tile_rows - 1) { - tile->tg_horz_boundary = - col >= cm->tile_group_start_col[row][col] - ? (row == cm->tile_group_start_row[row][col] ? 1 : 0) - : (row == cm->tile_group_start_row[row + 1][col] ? 1 : 0); - } else { - assert(col >= cm->tile_group_start_col[row][col]); - tile->tg_horz_boundary = - (row == cm->tile_group_start_row[row][col] ? 1 : 0); + const int tg_start_row = cm->tile_group_start_row[row][col]; + const int tg_start_col = cm->tile_group_start_col[row][col]; + tile->tg_horz_boundary = ((row == tg_start_row && col >= tg_start_col) || + (row == tg_start_row + 1 && col < tg_start_col)); +#if CONFIG_MAX_TILE + if (cm->tile_row_independent[row]) { + tile->tg_horz_boundary = 1; // this tile row is independent } +#endif } #endif void av1_tile_init(TileInfo *tile, const AV1_COMMON *cm, int row, int col) { @@ -46,6 +35,125 @@ void av1_tile_init(TileInfo *tile, const AV1_COMMON *cm, int row, int col) { #endif } +#if CONFIG_MAX_TILE + +// Find smallest k>=0 such that (blk_size << k) >= target +static int tile_log2(int blk_size, int target) { + int k; + for (k = 0; (blk_size << k) < target; k++) { + } + return k; +} + +void av1_get_tile_limits(AV1_COMMON *const cm) { + int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2); + int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2); + int sb_cols = mi_cols >> MAX_MIB_SIZE_LOG2; + int sb_rows = mi_rows >> MAX_MIB_SIZE_LOG2; + + cm->min_log2_tile_cols = tile_log2(MAX_TILE_WIDTH_SB, sb_cols); + cm->max_log2_tile_cols = tile_log2(1, AOMMIN(sb_cols, MAX_TILE_COLS)); + cm->max_log2_tile_rows = tile_log2(1, AOMMIN(sb_rows, MAX_TILE_ROWS)); + cm->min_log2_tiles = tile_log2(MAX_TILE_AREA_SB, sb_cols * sb_rows); + cm->min_log2_tiles = AOMMAX(cm->min_log2_tiles, cm->min_log2_tile_cols); + // TODO(dominic.symes@arm.com): + // Add in levelMinLog2Tiles as a lower limit when levels are defined +} + +void av1_calculate_tile_cols(AV1_COMMON *const cm) { + int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2); + int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2); + int sb_cols = mi_cols >> MAX_MIB_SIZE_LOG2; + int sb_rows = mi_rows >> MAX_MIB_SIZE_LOG2; + int i; + + if (cm->uniform_tile_spacing_flag) { + int start_sb; + int size_sb = ALIGN_POWER_OF_TWO(sb_cols, cm->log2_tile_cols); + size_sb >>= cm->log2_tile_cols; + assert(size_sb > 0); + for (i = 0, start_sb = 0; start_sb < sb_cols; i++) { + cm->tile_col_start_sb[i] = start_sb; + start_sb += size_sb; + } + cm->tile_cols = i; + cm->tile_col_start_sb[i] = sb_cols; + cm->min_log2_tile_rows = AOMMAX(cm->min_log2_tiles - cm->log2_tile_cols, 0); + cm->max_tile_height_sb = sb_rows >> cm->min_log2_tile_rows; + } else { + int max_tile_area_sb = (sb_rows * sb_cols); + int max_tile_width_sb = 0; + cm->log2_tile_cols = tile_log2(1, cm->tile_cols); + for (i = 0; i < cm->tile_cols; i++) { + int size_sb = cm->tile_col_start_sb[i + 1] - cm->tile_col_start_sb[i]; + max_tile_width_sb = AOMMAX(max_tile_width_sb, size_sb); + } + if (cm->min_log2_tiles) { + max_tile_area_sb >>= (cm->min_log2_tiles + 1); + } + cm->max_tile_height_sb = AOMMAX(max_tile_area_sb / max_tile_width_sb, 1); + } +} + +void av1_calculate_tile_rows(AV1_COMMON *const cm) { + int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2); + int sb_rows = mi_rows >> MAX_MIB_SIZE_LOG2; + int start_sb, size_sb, i; + + if (cm->uniform_tile_spacing_flag) { + size_sb = ALIGN_POWER_OF_TWO(sb_rows, cm->log2_tile_rows); + size_sb >>= cm->log2_tile_rows; + assert(size_sb > 0); + for (i = 0, start_sb = 0; start_sb < sb_rows; i++) { + cm->tile_row_start_sb[i] = start_sb; + start_sb += size_sb; + } + cm->tile_rows = i; + cm->tile_row_start_sb[i] = sb_rows; + } else { + cm->log2_tile_rows = tile_log2(1, cm->tile_rows); + } + +#if CONFIG_DEPENDENT_HORZTILES + // Record which tile rows must be indpendent for parallelism + for (i = 0, start_sb = 0; i < cm->tile_rows; i++) { + cm->tile_row_independent[i] = 0; + if (cm->tile_row_start_sb[i + 1] - start_sb > cm->max_tile_height_sb) { + cm->tile_row_independent[i] = 1; + start_sb = cm->tile_row_start_sb[i]; + } + } +#endif +} + +void av1_tile_set_row(TileInfo *tile, const AV1_COMMON *cm, int row) { + assert(row < cm->tile_rows); + int mi_row_start = cm->tile_row_start_sb[row] << MAX_MIB_SIZE_LOG2; + int mi_row_end = cm->tile_row_start_sb[row + 1] << MAX_MIB_SIZE_LOG2; + tile->mi_row_start = mi_row_start; + tile->mi_row_end = AOMMIN(mi_row_end, cm->mi_rows); +} + +void av1_tile_set_col(TileInfo *tile, const AV1_COMMON *cm, int col) { + assert(col < cm->tile_cols); + int mi_col_start = cm->tile_col_start_sb[col] << MAX_MIB_SIZE_LOG2; + int mi_col_end = cm->tile_col_start_sb[col + 1] << MAX_MIB_SIZE_LOG2; + tile->mi_col_start = mi_col_start; + tile->mi_col_end = AOMMIN(mi_col_end, cm->mi_cols); +} + +#else + +void av1_tile_set_row(TileInfo *tile, const AV1_COMMON *cm, int row) { + tile->mi_row_start = row * cm->tile_height; + tile->mi_row_end = AOMMIN(tile->mi_row_start + cm->tile_height, cm->mi_rows); +} + +void av1_tile_set_col(TileInfo *tile, const AV1_COMMON *cm, int col) { + tile->mi_col_start = col * cm->tile_width; + tile->mi_col_end = AOMMIN(tile->mi_col_start + cm->tile_width, cm->mi_cols); +} + #if CONFIG_EXT_PARTITION #define MIN_TILE_WIDTH_MAX_SB 2 #define MAX_TILE_WIDTH_MAX_SB 32 @@ -74,6 +182,7 @@ void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols, *max_log2_tile_cols = get_max_log2_tile_cols(max_sb_cols); assert(*min_log2_tile_cols <= *max_log2_tile_cols); } +#endif // CONFIG_MAX_TILE void av1_setup_frame_boundary_info(const AV1_COMMON *const cm) { MODE_INFO *mi = cm->mi; @@ -103,16 +212,38 @@ void av1_setup_frame_boundary_info(const AV1_COMMON *const cm) { } } +int get_tile_size(int mi_frame_size, int log2_tile_num, int *ntiles) { + // Round the frame up to a whole number of max superblocks + mi_frame_size = ALIGN_POWER_OF_TWO(mi_frame_size, MAX_MIB_SIZE_LOG2); + + // Divide by the signalled number of tiles, rounding up to the multiple of + // the max superblock size. To do this, shift right (and round up) to get the + // tile size in max super-blocks and then shift left again to convert it to + // mi units. + const int shift = log2_tile_num + MAX_MIB_SIZE_LOG2; + const int max_sb_tile_size = + ALIGN_POWER_OF_TWO(mi_frame_size, shift) >> shift; + const int mi_tile_size = max_sb_tile_size << MAX_MIB_SIZE_LOG2; + + // The actual number of tiles is the ceiling of the frame size in mi units + // divided by mi_size. This is at most 1 << log2_tile_num but might be + // strictly less if max_sb_tile_size got rounded up significantly. + if (ntiles) { + *ntiles = (mi_frame_size + mi_tile_size - 1) / mi_tile_size; + assert(*ntiles <= (1 << log2_tile_num)); + } + + return mi_tile_size; +} + +#if CONFIG_LOOPFILTERING_ACROSS_TILES void av1_setup_across_tile_boundary_info(const AV1_COMMON *const cm, const TileInfo *const tile_info) { - int lpf_across_tiles_enabled = 1; -#if CONFIG_LOOPFILTERING_ACROSS_TILES - lpf_across_tiles_enabled = cm->loop_filter_across_tiles_enabled; -#endif - if ((cm->tile_cols * cm->tile_rows > 1) && (!lpf_across_tiles_enabled)) { + if (cm->tile_cols * cm->tile_rows > 1) { const int mi_row = tile_info->mi_row_start; const int mi_col = tile_info->mi_col_start; MODE_INFO *const mi_start = cm->mi + mi_row * cm->mi_stride + mi_col; + assert(mi_start < cm->mip + cm->mi_alloc_size); MODE_INFO *mi = 0; const int row_diff = tile_info->mi_row_end - tile_info->mi_row_start; const int col_diff = tile_info->mi_col_end - tile_info->mi_col_start; @@ -136,6 +267,10 @@ void av1_setup_across_tile_boundary_info(const AV1_COMMON *const cm, } mi = mi_start + (row_diff - 1) * cm->mi_stride; + + // explicit bounds checking + assert(mi + col_diff <= cm->mip + cm->mi_alloc_size); + for (col = 0; col < col_diff; ++col) { mi->mbmi.boundary_info |= TILE_BOTTOM_BOUNDARY; mi += 1; @@ -149,7 +284,6 @@ void av1_setup_across_tile_boundary_info(const AV1_COMMON *const cm, } } -#if CONFIG_LOOPFILTERING_ACROSS_TILES int av1_disable_loopfilter_on_tile_boundary(const struct AV1Common *cm) { return (!cm->loop_filter_across_tiles_enabled && (cm->tile_cols * cm->tile_rows > 1)); diff --git a/third_party/aom/av1/common/tile_common.h b/third_party/aom/av1/common/tile_common.h index e5b8a0b82..be21e1482 100644 --- a/third_party/aom/av1/common/tile_common.h +++ b/third_party/aom/av1/common/tile_common.h @@ -43,13 +43,32 @@ void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols, int *max_log2_tile_cols); void av1_setup_frame_boundary_info(const struct AV1Common *const cm); -void av1_setup_across_tile_boundary_info(const struct AV1Common *const cm, - const TileInfo *const tile_info); + +// Calculate the correct tile size (width or height) for (1 << log2_tile_num) +// tiles horizontally or vertically in the frame. +int get_tile_size(int mi_frame_size, int log2_tile_num, int *ntiles); #if CONFIG_LOOPFILTERING_ACROSS_TILES +void av1_setup_across_tile_boundary_info(const struct AV1Common *const cm, + const TileInfo *const tile_info); int av1_disable_loopfilter_on_tile_boundary(const struct AV1Common *cm); #endif // CONFIG_LOOPFILTERING_ACROSS_TILES +#if CONFIG_MAX_TILE + +// Define tile maximum width and area +// There is no maximum height since height is limited by area and width limits +// The minimum tile width or height is fixed at one superblock +#define MAX_TILE_WIDTH (4096) // Max Tile width in pixels +#define MAX_TILE_WIDTH_SB (MAX_TILE_WIDTH >> MAX_SB_SIZE_LOG2) +#define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels +#define MAX_TILE_AREA_SB (MAX_TILE_AREA >> (2 * MAX_SB_SIZE_LOG2)) + +void av1_get_tile_limits(struct AV1Common *const cm); +void av1_calculate_tile_cols(struct AV1Common *const cm); +void av1_calculate_tile_rows(struct AV1Common *const cm); +#endif + #ifdef __cplusplus } // extern "C" #endif diff --git a/third_party/aom/av1/common/token_cdfs.h b/third_party/aom/av1/common/token_cdfs.h new file mode 100644 index 000000000..c4f0f94c0 --- /dev/null +++ b/third_party/aom/av1/common/token_cdfs.h @@ -0,0 +1,5253 @@ +/* + * Copyright (c) 2017, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include "./aom_config.h" +#include "av1/common/entropy.h" + +/* clang-format off */ +static const coeff_cdf_model +av1_default_coef_head_cdfs_q0[TX_SIZES][PLANE_TYPES] = { + { // TX 4X4 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(21029), AOM_ICDF(21848), AOM_ICDF(26326), AOM_ICDF(29423), + AOM_ICDF(30610), AOM_ICDF(32768), }, + {AOM_ICDF(10066), AOM_ICDF(12716), AOM_ICDF(18523), AOM_ICDF(23277), + AOM_ICDF(24780), AOM_ICDF(32768), }, + {AOM_ICDF(1655), AOM_ICDF(4793), AOM_ICDF(6429), AOM_ICDF(11430), + AOM_ICDF(12206), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(10364), AOM_ICDF(14773), AOM_ICDF(25084), AOM_ICDF(25599), + AOM_ICDF(32768), }, + {AOM_ICDF(10060), AOM_ICDF(14834), AOM_ICDF(24695), AOM_ICDF(25188), + AOM_ICDF(32768), }, + {AOM_ICDF(8279), AOM_ICDF(11106), AOM_ICDF(21159), AOM_ICDF(21671), + AOM_ICDF(32768), }, + {AOM_ICDF(5914), AOM_ICDF(6961), AOM_ICDF(15824), AOM_ICDF(16314), + AOM_ICDF(32768), }, + {AOM_ICDF(3542), AOM_ICDF(3935), AOM_ICDF(10073), AOM_ICDF(10456), + AOM_ICDF(32768), }, + {AOM_ICDF(1492), AOM_ICDF(1808), AOM_ICDF(4428), AOM_ICDF(4747), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(15783), AOM_ICDF(19657), AOM_ICDF(28753), AOM_ICDF(29248), + AOM_ICDF(32768), }, + {AOM_ICDF(12047), AOM_ICDF(15766), AOM_ICDF(26989), AOM_ICDF(27464), + AOM_ICDF(32768), }, + {AOM_ICDF(8412), AOM_ICDF(9971), AOM_ICDF(21538), AOM_ICDF(22026), + AOM_ICDF(32768), }, + {AOM_ICDF(5438), AOM_ICDF(6039), AOM_ICDF(15108), AOM_ICDF(15570), + AOM_ICDF(32768), }, + {AOM_ICDF(3247), AOM_ICDF(3593), AOM_ICDF(9495), AOM_ICDF(9859), + AOM_ICDF(32768), }, + {AOM_ICDF(1428), AOM_ICDF(1742), AOM_ICDF(4322), AOM_ICDF(4638), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(18469), AOM_ICDF(21675), AOM_ICDF(30172), AOM_ICDF(30563), + AOM_ICDF(32768), }, + {AOM_ICDF(12582), AOM_ICDF(16559), AOM_ICDF(27995), AOM_ICDF(28423), + AOM_ICDF(32768), }, + {AOM_ICDF(8183), AOM_ICDF(9915), AOM_ICDF(21836), AOM_ICDF(22336), + AOM_ICDF(32768), }, + {AOM_ICDF(5255), AOM_ICDF(5845), AOM_ICDF(15137), AOM_ICDF(15593), + AOM_ICDF(32768), }, + {AOM_ICDF(3140), AOM_ICDF(3478), AOM_ICDF(9376), AOM_ICDF(9739), + AOM_ICDF(32768), }, + {AOM_ICDF(1549), AOM_ICDF(1864), AOM_ICDF(4660), AOM_ICDF(4984), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(18319), AOM_ICDF(23757), AOM_ICDF(30989), AOM_ICDF(31399), + AOM_ICDF(32768), }, + {AOM_ICDF(12864), AOM_ICDF(18051), AOM_ICDF(28729), AOM_ICDF(29218), + AOM_ICDF(32768), }, + {AOM_ICDF(8090), AOM_ICDF(10047), AOM_ICDF(22011), AOM_ICDF(22680), + AOM_ICDF(32768), }, + {AOM_ICDF(5061), AOM_ICDF(5688), AOM_ICDF(14783), AOM_ICDF(15379), + AOM_ICDF(32768), }, + {AOM_ICDF(3425), AOM_ICDF(3784), AOM_ICDF(9565), AOM_ICDF(9998), + AOM_ICDF(32768), }, + {AOM_ICDF(1564), AOM_ICDF(1884), AOM_ICDF(4703), AOM_ICDF(5054), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(8329), AOM_ICDF(23625), AOM_ICDF(30376), AOM_ICDF(31182), + AOM_ICDF(32768), }, + {AOM_ICDF(7265), AOM_ICDF(19981), AOM_ICDF(27965), AOM_ICDF(29333), + AOM_ICDF(32768), }, + {AOM_ICDF(5797), AOM_ICDF(12014), AOM_ICDF(21143), AOM_ICDF(23728), + AOM_ICDF(32768), }, + {AOM_ICDF(4525), AOM_ICDF(7029), AOM_ICDF(14661), AOM_ICDF(17493), + AOM_ICDF(32768), }, + {AOM_ICDF(3200), AOM_ICDF(4082), AOM_ICDF(9679), AOM_ICDF(11816), + AOM_ICDF(32768), }, + {AOM_ICDF(1930), AOM_ICDF(2344), AOM_ICDF(5504), AOM_ICDF(6684), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(12366), AOM_ICDF(20513), AOM_ICDF(22133), AOM_ICDF(29810), + AOM_ICDF(30422), AOM_ICDF(32768), }, + {AOM_ICDF(7182), AOM_ICDF(16662), AOM_ICDF(18633), AOM_ICDF(27443), + AOM_ICDF(28120), AOM_ICDF(32768), }, + {AOM_ICDF(1791), AOM_ICDF(10613), AOM_ICDF(11616), AOM_ICDF(21520), + AOM_ICDF(22191), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(18943), AOM_ICDF(19755), AOM_ICDF(30340), AOM_ICDF(30674), + AOM_ICDF(32768), }, + {AOM_ICDF(15702), AOM_ICDF(17160), AOM_ICDF(28778), AOM_ICDF(29115), + AOM_ICDF(32768), }, + {AOM_ICDF(9337), AOM_ICDF(10054), AOM_ICDF(22492), AOM_ICDF(22845), + AOM_ICDF(32768), }, + {AOM_ICDF(6550), AOM_ICDF(7019), AOM_ICDF(17068), AOM_ICDF(17420), + AOM_ICDF(32768), }, + {AOM_ICDF(4169), AOM_ICDF(4566), AOM_ICDF(11849), AOM_ICDF(12185), + AOM_ICDF(32768), }, + {AOM_ICDF(2495), AOM_ICDF(2839), AOM_ICDF(6895), AOM_ICDF(7221), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20241), AOM_ICDF(21593), AOM_ICDF(31083), AOM_ICDF(31425), + AOM_ICDF(32768), }, + {AOM_ICDF(15276), AOM_ICDF(16626), AOM_ICDF(28787), AOM_ICDF(29136), + AOM_ICDF(32768), }, + {AOM_ICDF(7656), AOM_ICDF(8102), AOM_ICDF(20347), AOM_ICDF(20700), + AOM_ICDF(32768), }, + {AOM_ICDF(4527), AOM_ICDF(4880), AOM_ICDF(13482), AOM_ICDF(13819), + AOM_ICDF(32768), }, + {AOM_ICDF(2538), AOM_ICDF(2860), AOM_ICDF(7975), AOM_ICDF(8298), + AOM_ICDF(32768), }, + {AOM_ICDF(1394), AOM_ICDF(1707), AOM_ICDF(3770), AOM_ICDF(4086), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19968), AOM_ICDF(21872), AOM_ICDF(30812), AOM_ICDF(31172), + AOM_ICDF(32768), }, + {AOM_ICDF(15081), AOM_ICDF(16805), AOM_ICDF(28957), AOM_ICDF(29326), + AOM_ICDF(32768), }, + {AOM_ICDF(8196), AOM_ICDF(8748), AOM_ICDF(21434), AOM_ICDF(21825), + AOM_ICDF(32768), }, + {AOM_ICDF(5297), AOM_ICDF(5675), AOM_ICDF(15007), AOM_ICDF(15385), + AOM_ICDF(32768), }, + {AOM_ICDF(3102), AOM_ICDF(3429), AOM_ICDF(9255), AOM_ICDF(9607), + AOM_ICDF(32768), }, + {AOM_ICDF(1502), AOM_ICDF(1815), AOM_ICDF(4662), AOM_ICDF(4983), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(19362), AOM_ICDF(22537), AOM_ICDF(31260), AOM_ICDF(31624), + AOM_ICDF(32768), }, + {AOM_ICDF(14450), AOM_ICDF(17789), AOM_ICDF(29362), AOM_ICDF(29788), + AOM_ICDF(32768), }, + {AOM_ICDF(7957), AOM_ICDF(8982), AOM_ICDF(21542), AOM_ICDF(22120), + AOM_ICDF(32768), }, + {AOM_ICDF(4819), AOM_ICDF(5280), AOM_ICDF(14199), AOM_ICDF(14724), + AOM_ICDF(32768), }, + {AOM_ICDF(2831), AOM_ICDF(3180), AOM_ICDF(8511), AOM_ICDF(8950), + AOM_ICDF(32768), }, + {AOM_ICDF(1385), AOM_ICDF(1700), AOM_ICDF(4300), AOM_ICDF(4633), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(14134), AOM_ICDF(22252), AOM_ICDF(31119), AOM_ICDF(31577), + AOM_ICDF(32768), }, + {AOM_ICDF(11383), AOM_ICDF(19847), AOM_ICDF(29451), AOM_ICDF(30205), + AOM_ICDF(32768), }, + {AOM_ICDF(7338), AOM_ICDF(11314), AOM_ICDF(22338), AOM_ICDF(24028), + AOM_ICDF(32768), }, + {AOM_ICDF(5071), AOM_ICDF(6634), AOM_ICDF(15379), AOM_ICDF(17178), + AOM_ICDF(32768), }, + {AOM_ICDF(2969), AOM_ICDF(3703), AOM_ICDF(9896), AOM_ICDF(11246), + AOM_ICDF(32768), }, + {AOM_ICDF(1809), AOM_ICDF(2173), AOM_ICDF(5573), AOM_ICDF(6229), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(25213), AOM_ICDF(26007), AOM_ICDF(29751), AOM_ICDF(31199), + AOM_ICDF(31688), AOM_ICDF(32768), }, + {AOM_ICDF(13781), AOM_ICDF(16489), AOM_ICDF(23298), AOM_ICDF(27505), + AOM_ICDF(28405), AOM_ICDF(32768), }, + {AOM_ICDF(4621), AOM_ICDF(9194), AOM_ICDF(12764), AOM_ICDF(19842), + AOM_ICDF(20708), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(12686), AOM_ICDF(19031), AOM_ICDF(28910), AOM_ICDF(29358), + AOM_ICDF(32768), }, + {AOM_ICDF(12732), AOM_ICDF(18729), AOM_ICDF(28346), AOM_ICDF(28824), + AOM_ICDF(32768), }, + {AOM_ICDF(9753), AOM_ICDF(12954), AOM_ICDF(24344), AOM_ICDF(24920), + AOM_ICDF(32768), }, + {AOM_ICDF(6853), AOM_ICDF(7851), AOM_ICDF(18601), AOM_ICDF(19110), + AOM_ICDF(32768), }, + {AOM_ICDF(3697), AOM_ICDF(4071), AOM_ICDF(11373), AOM_ICDF(11743), + AOM_ICDF(32768), }, + {AOM_ICDF(1738), AOM_ICDF(2057), AOM_ICDF(5307), AOM_ICDF(5627), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18299), AOM_ICDF(24455), AOM_ICDF(30930), AOM_ICDF(31398), + AOM_ICDF(32768), }, + {AOM_ICDF(14316), AOM_ICDF(19083), AOM_ICDF(29266), AOM_ICDF(29766), + AOM_ICDF(32768), }, + {AOM_ICDF(9584), AOM_ICDF(11344), AOM_ICDF(23898), AOM_ICDF(24407), + AOM_ICDF(32768), }, + {AOM_ICDF(6076), AOM_ICDF(6645), AOM_ICDF(16805), AOM_ICDF(17237), + AOM_ICDF(32768), }, + {AOM_ICDF(3535), AOM_ICDF(3885), AOM_ICDF(10393), AOM_ICDF(10746), + AOM_ICDF(32768), }, + {AOM_ICDF(1909), AOM_ICDF(2222), AOM_ICDF(5010), AOM_ICDF(5328), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(21106), AOM_ICDF(25258), AOM_ICDF(31172), AOM_ICDF(31576), + AOM_ICDF(32768), }, + {AOM_ICDF(14944), AOM_ICDF(20229), AOM_ICDF(29903), AOM_ICDF(30361), + AOM_ICDF(32768), }, + {AOM_ICDF(10454), AOM_ICDF(13063), AOM_ICDF(25548), AOM_ICDF(26138), + AOM_ICDF(32768), }, + {AOM_ICDF(7667), AOM_ICDF(8529), AOM_ICDF(20025), AOM_ICDF(20588), + AOM_ICDF(32768), }, + {AOM_ICDF(4813), AOM_ICDF(5176), AOM_ICDF(13672), AOM_ICDF(14085), + AOM_ICDF(32768), }, + {AOM_ICDF(2450), AOM_ICDF(2763), AOM_ICDF(7515), AOM_ICDF(7873), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(18297), AOM_ICDF(25980), AOM_ICDF(31547), AOM_ICDF(31946), + AOM_ICDF(32768), }, + {AOM_ICDF(13370), AOM_ICDF(21048), AOM_ICDF(30193), AOM_ICDF(30703), + AOM_ICDF(32768), }, + {AOM_ICDF(9326), AOM_ICDF(13020), AOM_ICDF(25206), AOM_ICDF(26074), + AOM_ICDF(32768), }, + {AOM_ICDF(6117), AOM_ICDF(7480), AOM_ICDF(18243), AOM_ICDF(19130), + AOM_ICDF(32768), }, + {AOM_ICDF(6408), AOM_ICDF(6819), AOM_ICDF(13596), AOM_ICDF(14098), + AOM_ICDF(32768), }, + {AOM_ICDF(2179), AOM_ICDF(2485), AOM_ICDF(7393), AOM_ICDF(7768), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(11255), AOM_ICDF(26931), AOM_ICDF(31505), AOM_ICDF(32033), + AOM_ICDF(32768), }, + {AOM_ICDF(9120), AOM_ICDF(23148), AOM_ICDF(30070), AOM_ICDF(31091), + AOM_ICDF(32768), }, + {AOM_ICDF(7927), AOM_ICDF(15909), AOM_ICDF(25162), AOM_ICDF(27329), + AOM_ICDF(32768), }, + {AOM_ICDF(6416), AOM_ICDF(10706), AOM_ICDF(19959), AOM_ICDF(22732), + AOM_ICDF(32768), }, + {AOM_ICDF(4232), AOM_ICDF(5545), AOM_ICDF(13107), AOM_ICDF(15118), + AOM_ICDF(32768), }, + {AOM_ICDF(2626), AOM_ICDF(2941), AOM_ICDF(8665), AOM_ICDF(9872), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(27618), AOM_ICDF(28976), AOM_ICDF(30940), AOM_ICDF(31993), + AOM_ICDF(32336), AOM_ICDF(32768), }, + {AOM_ICDF(16119), AOM_ICDF(21691), AOM_ICDF(26334), AOM_ICDF(30705), + AOM_ICDF(31244), AOM_ICDF(32768), }, + {AOM_ICDF(5114), AOM_ICDF(14755), AOM_ICDF(17865), AOM_ICDF(27048), + AOM_ICDF(27895), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(19468), AOM_ICDF(23767), AOM_ICDF(31339), AOM_ICDF(31674), + AOM_ICDF(32768), }, + {AOM_ICDF(16878), AOM_ICDF(20966), AOM_ICDF(30654), AOM_ICDF(31007), + AOM_ICDF(32768), }, + {AOM_ICDF(12213), AOM_ICDF(14415), AOM_ICDF(26909), AOM_ICDF(27338), + AOM_ICDF(32768), }, + {AOM_ICDF(9404), AOM_ICDF(10670), AOM_ICDF(22239), AOM_ICDF(22719), + AOM_ICDF(32768), }, + {AOM_ICDF(6856), AOM_ICDF(7784), AOM_ICDF(17127), AOM_ICDF(17609), + AOM_ICDF(32768), }, + {AOM_ICDF(5034), AOM_ICDF(5529), AOM_ICDF(13229), AOM_ICDF(13634), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21214), AOM_ICDF(25570), AOM_ICDF(31656), AOM_ICDF(31994), + AOM_ICDF(32768), }, + {AOM_ICDF(17012), AOM_ICDF(20535), AOM_ICDF(30403), AOM_ICDF(30787), + AOM_ICDF(32768), }, + {AOM_ICDF(10855), AOM_ICDF(12147), AOM_ICDF(25451), AOM_ICDF(25874), + AOM_ICDF(32768), }, + {AOM_ICDF(7055), AOM_ICDF(7837), AOM_ICDF(19116), AOM_ICDF(19553), + AOM_ICDF(32768), }, + {AOM_ICDF(4141), AOM_ICDF(4531), AOM_ICDF(11911), AOM_ICDF(12296), + AOM_ICDF(32768), }, + {AOM_ICDF(1706), AOM_ICDF(2041), AOM_ICDF(5622), AOM_ICDF(5957), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22092), AOM_ICDF(26330), AOM_ICDF(31642), AOM_ICDF(32015), + AOM_ICDF(32768), }, + {AOM_ICDF(16433), AOM_ICDF(20889), AOM_ICDF(30263), AOM_ICDF(30704), + AOM_ICDF(32768), }, + {AOM_ICDF(11015), AOM_ICDF(13045), AOM_ICDF(26253), AOM_ICDF(26743), + AOM_ICDF(32768), }, + {AOM_ICDF(9188), AOM_ICDF(9924), AOM_ICDF(21991), AOM_ICDF(22551), + AOM_ICDF(32768), }, + {AOM_ICDF(5259), AOM_ICDF(5634), AOM_ICDF(14131), AOM_ICDF(14627), + AOM_ICDF(32768), }, + {AOM_ICDF(1916), AOM_ICDF(2218), AOM_ICDF(6453), AOM_ICDF(6780), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(20331), AOM_ICDF(26854), AOM_ICDF(31896), AOM_ICDF(32255), + AOM_ICDF(32768), }, + {AOM_ICDF(15738), AOM_ICDF(22741), AOM_ICDF(31108), AOM_ICDF(31557), + AOM_ICDF(32768), }, + {AOM_ICDF(11693), AOM_ICDF(15508), AOM_ICDF(27435), AOM_ICDF(28103), + AOM_ICDF(32768), }, + {AOM_ICDF(8066), AOM_ICDF(9281), AOM_ICDF(20855), AOM_ICDF(21631), + AOM_ICDF(32768), }, + {AOM_ICDF(4427), AOM_ICDF(4860), AOM_ICDF(12951), AOM_ICDF(13543), + AOM_ICDF(32768), }, + {AOM_ICDF(1928), AOM_ICDF(2372), AOM_ICDF(5634), AOM_ICDF(6672), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(15605), AOM_ICDF(27749), AOM_ICDF(31907), AOM_ICDF(32303), + AOM_ICDF(32768), }, + {AOM_ICDF(11920), AOM_ICDF(24653), AOM_ICDF(31013), AOM_ICDF(31675), + AOM_ICDF(32768), }, + {AOM_ICDF(8007), AOM_ICDF(14898), AOM_ICDF(25377), AOM_ICDF(27353), + AOM_ICDF(32768), }, + {AOM_ICDF(6010), AOM_ICDF(8920), AOM_ICDF(18956), AOM_ICDF(21554), + AOM_ICDF(32768), }, + {AOM_ICDF(4573), AOM_ICDF(5611), AOM_ICDF(13522), AOM_ICDF(15795), + AOM_ICDF(32768), }, + {AOM_ICDF(4274), AOM_ICDF(6411), AOM_ICDF(11398), AOM_ICDF(14247), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 8X8 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(22195), AOM_ICDF(22830), AOM_ICDF(25684), AOM_ICDF(28569), + AOM_ICDF(30557), AOM_ICDF(32768), }, + {AOM_ICDF(9973), AOM_ICDF(12001), AOM_ICDF(15354), AOM_ICDF(20353), + AOM_ICDF(23020), AOM_ICDF(32768), }, + {AOM_ICDF(1514), AOM_ICDF(3998), AOM_ICDF(4873), AOM_ICDF(9182), + AOM_ICDF(9967), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(11609), AOM_ICDF(14013), AOM_ICDF(24609), AOM_ICDF(25092), + AOM_ICDF(32768), }, + {AOM_ICDF(10302), AOM_ICDF(15208), AOM_ICDF(24145), AOM_ICDF(24658), + AOM_ICDF(32768), }, + {AOM_ICDF(7991), AOM_ICDF(10895), AOM_ICDF(20438), AOM_ICDF(21146), + AOM_ICDF(32768), }, + {AOM_ICDF(5831), AOM_ICDF(7006), AOM_ICDF(15716), AOM_ICDF(16394), + AOM_ICDF(32768), }, + {AOM_ICDF(3536), AOM_ICDF(3969), AOM_ICDF(10117), AOM_ICDF(10569), + AOM_ICDF(32768), }, + {AOM_ICDF(1369), AOM_ICDF(1686), AOM_ICDF(4062), AOM_ICDF(4385), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(17334), AOM_ICDF(19416), AOM_ICDF(28420), AOM_ICDF(28798), + AOM_ICDF(32768), }, + {AOM_ICDF(13512), AOM_ICDF(15917), AOM_ICDF(26736), AOM_ICDF(27122), + AOM_ICDF(32768), }, + {AOM_ICDF(9322), AOM_ICDF(10491), AOM_ICDF(21892), AOM_ICDF(22281), + AOM_ICDF(32768), }, + {AOM_ICDF(6187), AOM_ICDF(6682), AOM_ICDF(15992), AOM_ICDF(16351), + AOM_ICDF(32768), }, + {AOM_ICDF(3733), AOM_ICDF(4073), AOM_ICDF(10406), AOM_ICDF(10735), + AOM_ICDF(32768), }, + {AOM_ICDF(1606), AOM_ICDF(1920), AOM_ICDF(4715), AOM_ICDF(5028), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(20589), AOM_ICDF(22106), AOM_ICDF(30065), AOM_ICDF(30422), + AOM_ICDF(32768), }, + {AOM_ICDF(14731), AOM_ICDF(16342), AOM_ICDF(27701), AOM_ICDF(28059), + AOM_ICDF(32768), }, + {AOM_ICDF(8554), AOM_ICDF(9080), AOM_ICDF(20831), AOM_ICDF(21182), + AOM_ICDF(32768), }, + {AOM_ICDF(5011), AOM_ICDF(5354), AOM_ICDF(13968), AOM_ICDF(14296), + AOM_ICDF(32768), }, + {AOM_ICDF(2867), AOM_ICDF(3184), AOM_ICDF(8524), AOM_ICDF(8840), + AOM_ICDF(32768), }, + {AOM_ICDF(1174), AOM_ICDF(1486), AOM_ICDF(3643), AOM_ICDF(3955), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(23439), AOM_ICDF(24729), AOM_ICDF(31199), AOM_ICDF(31537), + AOM_ICDF(32768), }, + {AOM_ICDF(15716), AOM_ICDF(17015), AOM_ICDF(28650), AOM_ICDF(28989), + AOM_ICDF(32768), }, + {AOM_ICDF(8381), AOM_ICDF(8812), AOM_ICDF(21032), AOM_ICDF(21369), + AOM_ICDF(32768), }, + {AOM_ICDF(4868), AOM_ICDF(5197), AOM_ICDF(13740), AOM_ICDF(14065), + AOM_ICDF(32768), }, + {AOM_ICDF(2744), AOM_ICDF(3058), AOM_ICDF(8333), AOM_ICDF(8648), + AOM_ICDF(32768), }, + {AOM_ICDF(1185), AOM_ICDF(1497), AOM_ICDF(3656), AOM_ICDF(3968), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(23980), AOM_ICDF(26041), AOM_ICDF(31566), AOM_ICDF(31904), + AOM_ICDF(32768), }, + {AOM_ICDF(16060), AOM_ICDF(18243), AOM_ICDF(29508), AOM_ICDF(29868), + AOM_ICDF(32768), }, + {AOM_ICDF(8844), AOM_ICDF(9414), AOM_ICDF(22119), AOM_ICDF(22496), + AOM_ICDF(32768), }, + {AOM_ICDF(5265), AOM_ICDF(5612), AOM_ICDF(14599), AOM_ICDF(14944), + AOM_ICDF(32768), }, + {AOM_ICDF(3058), AOM_ICDF(3375), AOM_ICDF(9028), AOM_ICDF(9351), + AOM_ICDF(32768), }, + {AOM_ICDF(1414), AOM_ICDF(1726), AOM_ICDF(4249), AOM_ICDF(4563), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(9994), AOM_ICDF(19506), AOM_ICDF(21744), AOM_ICDF(29408), + AOM_ICDF(30809), AOM_ICDF(32768), }, + {AOM_ICDF(3771), AOM_ICDF(14862), AOM_ICDF(16756), AOM_ICDF(26385), + AOM_ICDF(27927), AOM_ICDF(32768), }, + {AOM_ICDF(964), AOM_ICDF(10643), AOM_ICDF(11416), AOM_ICDF(21060), + AOM_ICDF(22316), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23263), AOM_ICDF(23761), AOM_ICDF(31250), AOM_ICDF(31580), + AOM_ICDF(32768), }, + {AOM_ICDF(19631), AOM_ICDF(21067), AOM_ICDF(30262), AOM_ICDF(30596), + AOM_ICDF(32768), }, + {AOM_ICDF(12419), AOM_ICDF(13646), AOM_ICDF(25959), AOM_ICDF(26329), + AOM_ICDF(32768), }, + {AOM_ICDF(9274), AOM_ICDF(10229), AOM_ICDF(21588), AOM_ICDF(21981), + AOM_ICDF(32768), }, + {AOM_ICDF(6778), AOM_ICDF(7496), AOM_ICDF(17069), AOM_ICDF(17469), + AOM_ICDF(32768), }, + {AOM_ICDF(4655), AOM_ICDF(5089), AOM_ICDF(12206), AOM_ICDF(12574), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24055), AOM_ICDF(24771), AOM_ICDF(31529), AOM_ICDF(31851), + AOM_ICDF(32768), }, + {AOM_ICDF(18300), AOM_ICDF(19177), AOM_ICDF(29983), AOM_ICDF(30310), + AOM_ICDF(32768), }, + {AOM_ICDF(9684), AOM_ICDF(10239), AOM_ICDF(23130), AOM_ICDF(23465), + AOM_ICDF(32768), }, + {AOM_ICDF(6112), AOM_ICDF(6511), AOM_ICDF(16539), AOM_ICDF(16874), + AOM_ICDF(32768), }, + {AOM_ICDF(3508), AOM_ICDF(3841), AOM_ICDF(10475), AOM_ICDF(10798), + AOM_ICDF(32768), }, + {AOM_ICDF(1647), AOM_ICDF(1963), AOM_ICDF(5379), AOM_ICDF(5693), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24875), AOM_ICDF(25551), AOM_ICDF(31757), AOM_ICDF(32078), + AOM_ICDF(32768), }, + {AOM_ICDF(18585), AOM_ICDF(19328), AOM_ICDF(30217), AOM_ICDF(30542), + AOM_ICDF(32768), }, + {AOM_ICDF(8948), AOM_ICDF(9350), AOM_ICDF(22251), AOM_ICDF(22577), + AOM_ICDF(32768), }, + {AOM_ICDF(5148), AOM_ICDF(5481), AOM_ICDF(14806), AOM_ICDF(15127), + AOM_ICDF(32768), }, + {AOM_ICDF(2852), AOM_ICDF(3169), AOM_ICDF(8930), AOM_ICDF(9249), + AOM_ICDF(32768), }, + {AOM_ICDF(1298), AOM_ICDF(1609), AOM_ICDF(4289), AOM_ICDF(4600), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25149), AOM_ICDF(25840), AOM_ICDF(31833), AOM_ICDF(32153), + AOM_ICDF(32768), }, + {AOM_ICDF(19051), AOM_ICDF(19689), AOM_ICDF(30461), AOM_ICDF(30785), + AOM_ICDF(32768), }, + {AOM_ICDF(8956), AOM_ICDF(9308), AOM_ICDF(22406), AOM_ICDF(22729), + AOM_ICDF(32768), }, + {AOM_ICDF(5001), AOM_ICDF(5325), AOM_ICDF(14586), AOM_ICDF(14906), + AOM_ICDF(32768), }, + {AOM_ICDF(2875), AOM_ICDF(3189), AOM_ICDF(8639), AOM_ICDF(8955), + AOM_ICDF(32768), }, + {AOM_ICDF(1311), AOM_ICDF(1623), AOM_ICDF(4261), AOM_ICDF(4572), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(25212), AOM_ICDF(26544), AOM_ICDF(31879), AOM_ICDF(32209), + AOM_ICDF(32768), }, + {AOM_ICDF(18967), AOM_ICDF(20523), AOM_ICDF(30778), AOM_ICDF(31126), + AOM_ICDF(32768), }, + {AOM_ICDF(9672), AOM_ICDF(10140), AOM_ICDF(23740), AOM_ICDF(24117), + AOM_ICDF(32768), }, + {AOM_ICDF(5732), AOM_ICDF(6079), AOM_ICDF(16067), AOM_ICDF(16423), + AOM_ICDF(32768), }, + {AOM_ICDF(3370), AOM_ICDF(3687), AOM_ICDF(10101), AOM_ICDF(10429), + AOM_ICDF(32768), }, + {AOM_ICDF(1696), AOM_ICDF(2007), AOM_ICDF(5320), AOM_ICDF(5648), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(26296), AOM_ICDF(26903), AOM_ICDF(30027), AOM_ICDF(31098), + AOM_ICDF(31851), AOM_ICDF(32768), }, + {AOM_ICDF(13982), AOM_ICDF(16223), AOM_ICDF(22840), AOM_ICDF(26540), + AOM_ICDF(28301), AOM_ICDF(32768), }, + {AOM_ICDF(5643), AOM_ICDF(9834), AOM_ICDF(13670), AOM_ICDF(20220), + AOM_ICDF(21734), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(14291), AOM_ICDF(20303), AOM_ICDF(29319), AOM_ICDF(29879), + AOM_ICDF(32768), }, + {AOM_ICDF(13407), AOM_ICDF(20905), AOM_ICDF(29052), AOM_ICDF(29644), + AOM_ICDF(32768), }, + {AOM_ICDF(10860), AOM_ICDF(15525), AOM_ICDF(25872), AOM_ICDF(26766), + AOM_ICDF(32768), }, + {AOM_ICDF(7801), AOM_ICDF(9554), AOM_ICDF(20530), AOM_ICDF(21309), + AOM_ICDF(32768), }, + {AOM_ICDF(4523), AOM_ICDF(4994), AOM_ICDF(12583), AOM_ICDF(13069), + AOM_ICDF(32768), }, + {AOM_ICDF(1784), AOM_ICDF(2110), AOM_ICDF(5198), AOM_ICDF(5511), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20153), AOM_ICDF(24114), AOM_ICDF(30802), AOM_ICDF(31195), + AOM_ICDF(32768), }, + {AOM_ICDF(16079), AOM_ICDF(19936), AOM_ICDF(29580), AOM_ICDF(29992), + AOM_ICDF(32768), }, + {AOM_ICDF(10977), AOM_ICDF(12993), AOM_ICDF(25245), AOM_ICDF(25687), + AOM_ICDF(32768), }, + {AOM_ICDF(7386), AOM_ICDF(8212), AOM_ICDF(19223), AOM_ICDF(19683), + AOM_ICDF(32768), }, + {AOM_ICDF(4797), AOM_ICDF(5164), AOM_ICDF(12928), AOM_ICDF(13288), + AOM_ICDF(32768), }, + {AOM_ICDF(2188), AOM_ICDF(2498), AOM_ICDF(6396), AOM_ICDF(6706), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24221), AOM_ICDF(26746), AOM_ICDF(31634), AOM_ICDF(31980), + AOM_ICDF(32768), }, + {AOM_ICDF(17492), AOM_ICDF(20348), AOM_ICDF(30067), AOM_ICDF(30432), + AOM_ICDF(32768), }, + {AOM_ICDF(10522), AOM_ICDF(11531), AOM_ICDF(24642), AOM_ICDF(25031), + AOM_ICDF(32768), }, + {AOM_ICDF(6567), AOM_ICDF(7006), AOM_ICDF(17688), AOM_ICDF(18036), + AOM_ICDF(32768), }, + {AOM_ICDF(4123), AOM_ICDF(4447), AOM_ICDF(11775), AOM_ICDF(12095), + AOM_ICDF(32768), }, + {AOM_ICDF(1770), AOM_ICDF(2065), AOM_ICDF(6491), AOM_ICDF(6786), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25862), AOM_ICDF(27744), AOM_ICDF(31611), AOM_ICDF(31969), + AOM_ICDF(32768), }, + {AOM_ICDF(17752), AOM_ICDF(20079), AOM_ICDF(30169), AOM_ICDF(30530), + AOM_ICDF(32768), }, + {AOM_ICDF(10588), AOM_ICDF(11308), AOM_ICDF(24834), AOM_ICDF(25180), + AOM_ICDF(32768), }, + {AOM_ICDF(7459), AOM_ICDF(7820), AOM_ICDF(17949), AOM_ICDF(18281), + AOM_ICDF(32768), }, + {AOM_ICDF(3984), AOM_ICDF(4294), AOM_ICDF(11863), AOM_ICDF(12173), + AOM_ICDF(32768), }, + {AOM_ICDF(2689), AOM_ICDF(2969), AOM_ICDF(11371), AOM_ICDF(11651), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27703), AOM_ICDF(29662), AOM_ICDF(31910), AOM_ICDF(32262), + AOM_ICDF(32768), }, + {AOM_ICDF(17904), AOM_ICDF(21878), AOM_ICDF(30510), AOM_ICDF(30969), + AOM_ICDF(32768), }, + {AOM_ICDF(10660), AOM_ICDF(12299), AOM_ICDF(24907), AOM_ICDF(25524), + AOM_ICDF(32768), }, + {AOM_ICDF(6972), AOM_ICDF(7545), AOM_ICDF(18660), AOM_ICDF(19251), + AOM_ICDF(32768), }, + {AOM_ICDF(5359), AOM_ICDF(5768), AOM_ICDF(14022), AOM_ICDF(14397), + AOM_ICDF(32768), }, + {AOM_ICDF(5030), AOM_ICDF(5487), AOM_ICDF(10364), AOM_ICDF(10973), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(27980), AOM_ICDF(28880), AOM_ICDF(31045), AOM_ICDF(31931), + AOM_ICDF(32370), AOM_ICDF(32768), }, + {AOM_ICDF(15958), AOM_ICDF(19891), AOM_ICDF(25963), AOM_ICDF(29601), + AOM_ICDF(30931), AOM_ICDF(32768), }, + {AOM_ICDF(3897), AOM_ICDF(12331), AOM_ICDF(15935), AOM_ICDF(24489), + AOM_ICDF(26773), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(21443), AOM_ICDF(24237), AOM_ICDF(31473), AOM_ICDF(31808), + AOM_ICDF(32768), }, + {AOM_ICDF(18617), AOM_ICDF(22378), AOM_ICDF(30958), AOM_ICDF(31301), + AOM_ICDF(32768), }, + {AOM_ICDF(14626), AOM_ICDF(17725), AOM_ICDF(28852), AOM_ICDF(29246), + AOM_ICDF(32768), }, + {AOM_ICDF(12155), AOM_ICDF(14598), AOM_ICDF(26000), AOM_ICDF(26506), + AOM_ICDF(32768), }, + {AOM_ICDF(10111), AOM_ICDF(12149), AOM_ICDF(23415), AOM_ICDF(24002), + AOM_ICDF(32768), }, + {AOM_ICDF(11352), AOM_ICDF(12864), AOM_ICDF(22589), AOM_ICDF(23010), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22855), AOM_ICDF(25401), AOM_ICDF(31675), AOM_ICDF(31999), + AOM_ICDF(32768), }, + {AOM_ICDF(19086), AOM_ICDF(21008), AOM_ICDF(30886), AOM_ICDF(31214), + AOM_ICDF(32768), }, + {AOM_ICDF(13477), AOM_ICDF(14473), AOM_ICDF(28104), AOM_ICDF(28450), + AOM_ICDF(32768), }, + {AOM_ICDF(9553), AOM_ICDF(10401), AOM_ICDF(23815), AOM_ICDF(24225), + AOM_ICDF(32768), }, + {AOM_ICDF(5795), AOM_ICDF(6172), AOM_ICDF(18068), AOM_ICDF(18445), + AOM_ICDF(32768), }, + {AOM_ICDF(4297), AOM_ICDF(5909), AOM_ICDF(10206), AOM_ICDF(11818), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24424), AOM_ICDF(26344), AOM_ICDF(31912), AOM_ICDF(32231), + AOM_ICDF(32768), }, + {AOM_ICDF(20229), AOM_ICDF(21775), AOM_ICDF(31283), AOM_ICDF(31610), + AOM_ICDF(32768), }, + {AOM_ICDF(14224), AOM_ICDF(14882), AOM_ICDF(28673), AOM_ICDF(29012), + AOM_ICDF(32768), }, + {AOM_ICDF(10881), AOM_ICDF(11494), AOM_ICDF(23829), AOM_ICDF(24238), + AOM_ICDF(32768), }, + {AOM_ICDF(6367), AOM_ICDF(6988), AOM_ICDF(15685), AOM_ICDF(16306), + AOM_ICDF(32768), }, + {AOM_ICDF(7447), AOM_ICDF(11916), AOM_ICDF(17873), AOM_ICDF(22342), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25536), AOM_ICDF(27216), AOM_ICDF(31570), AOM_ICDF(31916), + AOM_ICDF(32768), }, + {AOM_ICDF(19600), AOM_ICDF(21062), AOM_ICDF(30095), AOM_ICDF(30444), + AOM_ICDF(32768), }, + {AOM_ICDF(11491), AOM_ICDF(12044), AOM_ICDF(26170), AOM_ICDF(26497), + AOM_ICDF(32768), }, + {AOM_ICDF(9629), AOM_ICDF(9963), AOM_ICDF(23790), AOM_ICDF(24112), + AOM_ICDF(32768), }, + {AOM_ICDF(8073), AOM_ICDF(8359), AOM_ICDF(22212), AOM_ICDF(22498), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27425), AOM_ICDF(29611), AOM_ICDF(32005), AOM_ICDF(32347), + AOM_ICDF(32768), }, + {AOM_ICDF(20590), AOM_ICDF(24265), AOM_ICDF(31252), AOM_ICDF(31658), + AOM_ICDF(32768), }, + {AOM_ICDF(14072), AOM_ICDF(15705), AOM_ICDF(28945), AOM_ICDF(29389), + AOM_ICDF(32768), }, + {AOM_ICDF(11295), AOM_ICDF(11926), AOM_ICDF(26485), AOM_ICDF(26872), + AOM_ICDF(32768), }, + {AOM_ICDF(10627), AOM_ICDF(11292), AOM_ICDF(22141), AOM_ICDF(22805), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 16X16 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(9850), AOM_ICDF(11321), AOM_ICDF(13211), AOM_ICDF(18246), + AOM_ICDF(21613), AOM_ICDF(32768), }, + {AOM_ICDF(4128), AOM_ICDF(6155), AOM_ICDF(7367), AOM_ICDF(11928), + AOM_ICDF(14060), AOM_ICDF(32768), }, + {AOM_ICDF(932), AOM_ICDF(2794), AOM_ICDF(3234), AOM_ICDF(6647), + AOM_ICDF(7340), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(9101), AOM_ICDF(10823), AOM_ICDF(21291), AOM_ICDF(22109), + AOM_ICDF(32768), }, + {AOM_ICDF(8086), AOM_ICDF(13032), AOM_ICDF(21855), AOM_ICDF(22748), + AOM_ICDF(32768), }, + {AOM_ICDF(6563), AOM_ICDF(10137), AOM_ICDF(18484), AOM_ICDF(20069), + AOM_ICDF(32768), }, + {AOM_ICDF(4987), AOM_ICDF(6567), AOM_ICDF(14425), AOM_ICDF(15700), + AOM_ICDF(32768), }, + {AOM_ICDF(3399), AOM_ICDF(3947), AOM_ICDF(9950), AOM_ICDF(10738), + AOM_ICDF(32768), }, + {AOM_ICDF(1474), AOM_ICDF(1793), AOM_ICDF(4347), AOM_ICDF(4690), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(17035), AOM_ICDF(18650), AOM_ICDF(27401), AOM_ICDF(27793), + AOM_ICDF(32768), }, + {AOM_ICDF(13213), AOM_ICDF(16039), AOM_ICDF(26044), AOM_ICDF(26448), + AOM_ICDF(32768), }, + {AOM_ICDF(9916), AOM_ICDF(11812), AOM_ICDF(22497), AOM_ICDF(22945), + AOM_ICDF(32768), }, + {AOM_ICDF(7227), AOM_ICDF(8059), AOM_ICDF(17399), AOM_ICDF(17817), + AOM_ICDF(32768), }, + {AOM_ICDF(5144), AOM_ICDF(5572), AOM_ICDF(12546), AOM_ICDF(12892), + AOM_ICDF(32768), }, + {AOM_ICDF(2364), AOM_ICDF(2678), AOM_ICDF(6057), AOM_ICDF(6372), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19805), AOM_ICDF(21667), AOM_ICDF(29302), AOM_ICDF(29680), + AOM_ICDF(32768), }, + {AOM_ICDF(14232), AOM_ICDF(16314), AOM_ICDF(27120), AOM_ICDF(27515), + AOM_ICDF(32768), }, + {AOM_ICDF(8796), AOM_ICDF(9578), AOM_ICDF(21112), AOM_ICDF(21479), + AOM_ICDF(32768), }, + {AOM_ICDF(5203), AOM_ICDF(5552), AOM_ICDF(14231), AOM_ICDF(14563), + AOM_ICDF(32768), }, + {AOM_ICDF(2943), AOM_ICDF(3257), AOM_ICDF(8676), AOM_ICDF(8994), + AOM_ICDF(32768), }, + {AOM_ICDF(1363), AOM_ICDF(1675), AOM_ICDF(4064), AOM_ICDF(4376), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24214), AOM_ICDF(25083), AOM_ICDF(30916), AOM_ICDF(31249), + AOM_ICDF(32768), }, + {AOM_ICDF(15904), AOM_ICDF(17001), AOM_ICDF(28199), AOM_ICDF(28532), + AOM_ICDF(32768), }, + {AOM_ICDF(8324), AOM_ICDF(8717), AOM_ICDF(20480), AOM_ICDF(20808), + AOM_ICDF(32768), }, + {AOM_ICDF(4752), AOM_ICDF(5070), AOM_ICDF(13245), AOM_ICDF(13565), + AOM_ICDF(32768), }, + {AOM_ICDF(2729), AOM_ICDF(3042), AOM_ICDF(8218), AOM_ICDF(8530), + AOM_ICDF(32768), }, + {AOM_ICDF(1385), AOM_ICDF(1697), AOM_ICDF(4196), AOM_ICDF(4508), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(26956), AOM_ICDF(27719), AOM_ICDF(31679), AOM_ICDF(32005), + AOM_ICDF(32768), }, + {AOM_ICDF(16913), AOM_ICDF(17759), AOM_ICDF(29092), AOM_ICDF(29422), + AOM_ICDF(32768), }, + {AOM_ICDF(8166), AOM_ICDF(8510), AOM_ICDF(20577), AOM_ICDF(20901), + AOM_ICDF(32768), }, + {AOM_ICDF(4804), AOM_ICDF(5119), AOM_ICDF(13537), AOM_ICDF(13853), + AOM_ICDF(32768), }, + {AOM_ICDF(2951), AOM_ICDF(3263), AOM_ICDF(8766), AOM_ICDF(9079), + AOM_ICDF(32768), }, + {AOM_ICDF(1498), AOM_ICDF(1810), AOM_ICDF(4515), AOM_ICDF(4827), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(7335), AOM_ICDF(13463), AOM_ICDF(14286), AOM_ICDF(24588), + AOM_ICDF(29117), AOM_ICDF(32768), }, + {AOM_ICDF(3212), AOM_ICDF(9869), AOM_ICDF(10336), AOM_ICDF(20172), + AOM_ICDF(25029), AOM_ICDF(32768), }, + {AOM_ICDF(917), AOM_ICDF(6904), AOM_ICDF(7251), AOM_ICDF(15225), + AOM_ICDF(18595), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23988), AOM_ICDF(24467), AOM_ICDF(31033), AOM_ICDF(31407), + AOM_ICDF(32768), }, + {AOM_ICDF(20390), AOM_ICDF(23805), AOM_ICDF(30556), AOM_ICDF(30920), + AOM_ICDF(32768), }, + {AOM_ICDF(13566), AOM_ICDF(16666), AOM_ICDF(27478), AOM_ICDF(27995), + AOM_ICDF(32768), }, + {AOM_ICDF(10353), AOM_ICDF(12637), AOM_ICDF(23789), AOM_ICDF(24437), + AOM_ICDF(32768), }, + {AOM_ICDF(7956), AOM_ICDF(9364), AOM_ICDF(19994), AOM_ICDF(20621), + AOM_ICDF(32768), }, + {AOM_ICDF(6036), AOM_ICDF(6495), AOM_ICDF(15543), AOM_ICDF(16033), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(25643), AOM_ICDF(26692), AOM_ICDF(31634), AOM_ICDF(31957), + AOM_ICDF(32768), }, + {AOM_ICDF(18721), AOM_ICDF(20381), AOM_ICDF(30130), AOM_ICDF(30466), + AOM_ICDF(32768), }, + {AOM_ICDF(10914), AOM_ICDF(12337), AOM_ICDF(24817), AOM_ICDF(25177), + AOM_ICDF(32768), }, + {AOM_ICDF(7843), AOM_ICDF(8667), AOM_ICDF(19826), AOM_ICDF(20212), + AOM_ICDF(32768), }, + {AOM_ICDF(5080), AOM_ICDF(5484), AOM_ICDF(14225), AOM_ICDF(14587), + AOM_ICDF(32768), }, + {AOM_ICDF(2880), AOM_ICDF(3192), AOM_ICDF(7916), AOM_ICDF(8236), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26447), AOM_ICDF(27233), AOM_ICDF(31779), AOM_ICDF(32097), + AOM_ICDF(32768), }, + {AOM_ICDF(19042), AOM_ICDF(20153), AOM_ICDF(30217), AOM_ICDF(30540), + AOM_ICDF(32768), }, + {AOM_ICDF(9858), AOM_ICDF(10440), AOM_ICDF(23424), AOM_ICDF(23753), + AOM_ICDF(32768), }, + {AOM_ICDF(6276), AOM_ICDF(6657), AOM_ICDF(17158), AOM_ICDF(17489), + AOM_ICDF(32768), }, + {AOM_ICDF(3725), AOM_ICDF(4039), AOM_ICDF(10981), AOM_ICDF(11303), + AOM_ICDF(32768), }, + {AOM_ICDF(2041), AOM_ICDF(2345), AOM_ICDF(6069), AOM_ICDF(6373), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27189), AOM_ICDF(27737), AOM_ICDF(31897), AOM_ICDF(32213), + AOM_ICDF(32768), }, + {AOM_ICDF(19763), AOM_ICDF(20443), AOM_ICDF(30288), AOM_ICDF(30607), + AOM_ICDF(32768), }, + {AOM_ICDF(9033), AOM_ICDF(9393), AOM_ICDF(22097), AOM_ICDF(22415), + AOM_ICDF(32768), }, + {AOM_ICDF(5417), AOM_ICDF(5747), AOM_ICDF(15230), AOM_ICDF(15545), + AOM_ICDF(32768), }, + {AOM_ICDF(3397), AOM_ICDF(3709), AOM_ICDF(10342), AOM_ICDF(10655), + AOM_ICDF(32768), }, + {AOM_ICDF(2805), AOM_ICDF(3108), AOM_ICDF(6119), AOM_ICDF(6422), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27874), AOM_ICDF(28490), AOM_ICDF(31981), AOM_ICDF(32301), + AOM_ICDF(32768), }, + {AOM_ICDF(20112), AOM_ICDF(20724), AOM_ICDF(30607), AOM_ICDF(30935), + AOM_ICDF(32768), }, + {AOM_ICDF(9188), AOM_ICDF(9549), AOM_ICDF(22544), AOM_ICDF(22875), + AOM_ICDF(32768), }, + {AOM_ICDF(5590), AOM_ICDF(5918), AOM_ICDF(15550), AOM_ICDF(15878), + AOM_ICDF(32768), }, + {AOM_ICDF(3567), AOM_ICDF(4015), AOM_ICDF(10658), AOM_ICDF(10988), + AOM_ICDF(32768), }, + {AOM_ICDF(1950), AOM_ICDF(2388), AOM_ICDF(6246), AOM_ICDF(6681), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(25724), AOM_ICDF(26337), AOM_ICDF(28579), AOM_ICDF(29957), + AOM_ICDF(30927), AOM_ICDF(32768), }, + {AOM_ICDF(9657), AOM_ICDF(12074), AOM_ICDF(16790), AOM_ICDF(21738), + AOM_ICDF(23899), AOM_ICDF(32768), }, + {AOM_ICDF(4158), AOM_ICDF(7646), AOM_ICDF(10690), AOM_ICDF(16969), + AOM_ICDF(18800), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(14330), AOM_ICDF(19826), AOM_ICDF(28364), AOM_ICDF(29154), + AOM_ICDF(32768), }, + {AOM_ICDF(13503), AOM_ICDF(21352), AOM_ICDF(28714), AOM_ICDF(29534), + AOM_ICDF(32768), }, + {AOM_ICDF(11754), AOM_ICDF(16853), AOM_ICDF(25931), AOM_ICDF(27325), + AOM_ICDF(32768), }, + {AOM_ICDF(8311), AOM_ICDF(10581), AOM_ICDF(21258), AOM_ICDF(22633), + AOM_ICDF(32768), }, + {AOM_ICDF(5297), AOM_ICDF(5819), AOM_ICDF(14162), AOM_ICDF(14892), + AOM_ICDF(32768), }, + {AOM_ICDF(2887), AOM_ICDF(3208), AOM_ICDF(7455), AOM_ICDF(7768), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22005), AOM_ICDF(24480), AOM_ICDF(30925), AOM_ICDF(31309), + AOM_ICDF(32768), }, + {AOM_ICDF(17332), AOM_ICDF(20557), AOM_ICDF(29696), AOM_ICDF(30096), + AOM_ICDF(32768), }, + {AOM_ICDF(11930), AOM_ICDF(14337), AOM_ICDF(25931), AOM_ICDF(26358), + AOM_ICDF(32768), }, + {AOM_ICDF(8888), AOM_ICDF(10020), AOM_ICDF(20964), AOM_ICDF(21352), + AOM_ICDF(32768), }, + {AOM_ICDF(5694), AOM_ICDF(6135), AOM_ICDF(14997), AOM_ICDF(15376), + AOM_ICDF(32768), }, + {AOM_ICDF(2521), AOM_ICDF(2842), AOM_ICDF(7765), AOM_ICDF(8069), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(23993), AOM_ICDF(25546), AOM_ICDF(31427), AOM_ICDF(31762), + AOM_ICDF(32768), }, + {AOM_ICDF(18134), AOM_ICDF(20327), AOM_ICDF(29992), AOM_ICDF(30386), + AOM_ICDF(32768), }, + {AOM_ICDF(10997), AOM_ICDF(12057), AOM_ICDF(24719), AOM_ICDF(25141), + AOM_ICDF(32768), }, + {AOM_ICDF(5719), AOM_ICDF(6153), AOM_ICDF(16654), AOM_ICDF(17032), + AOM_ICDF(32768), }, + {AOM_ICDF(3637), AOM_ICDF(3953), AOM_ICDF(11392), AOM_ICDF(11696), + AOM_ICDF(32768), }, + {AOM_ICDF(1837), AOM_ICDF(2127), AOM_ICDF(5703), AOM_ICDF(5993), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26095), AOM_ICDF(26989), AOM_ICDF(31766), AOM_ICDF(32091), + AOM_ICDF(32768), }, + {AOM_ICDF(19524), AOM_ICDF(20820), AOM_ICDF(30413), AOM_ICDF(30738), + AOM_ICDF(32768), }, + {AOM_ICDF(9962), AOM_ICDF(10551), AOM_ICDF(22667), AOM_ICDF(23010), + AOM_ICDF(32768), }, + {AOM_ICDF(5773), AOM_ICDF(6093), AOM_ICDF(15402), AOM_ICDF(15748), + AOM_ICDF(32768), }, + {AOM_ICDF(3546), AOM_ICDF(3850), AOM_ICDF(9983), AOM_ICDF(10287), + AOM_ICDF(32768), }, + {AOM_ICDF(2387), AOM_ICDF(2668), AOM_ICDF(5711), AOM_ICDF(5992), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29071), AOM_ICDF(29675), AOM_ICDF(31761), AOM_ICDF(32087), + AOM_ICDF(32768), }, + {AOM_ICDF(18709), AOM_ICDF(19761), AOM_ICDF(29374), AOM_ICDF(29730), + AOM_ICDF(32768), }, + {AOM_ICDF(9336), AOM_ICDF(10048), AOM_ICDF(22625), AOM_ICDF(22988), + AOM_ICDF(32768), }, + {AOM_ICDF(6446), AOM_ICDF(6793), AOM_ICDF(16834), AOM_ICDF(17172), + AOM_ICDF(32768), }, + {AOM_ICDF(4227), AOM_ICDF(4539), AOM_ICDF(11587), AOM_ICDF(11909), + AOM_ICDF(32768), }, + {AOM_ICDF(2624), AOM_ICDF(2929), AOM_ICDF(7139), AOM_ICDF(7444), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(25114), AOM_ICDF(25872), AOM_ICDF(29577), AOM_ICDF(31173), + AOM_ICDF(32008), AOM_ICDF(32768), }, + {AOM_ICDF(11286), AOM_ICDF(14376), AOM_ICDF(22156), AOM_ICDF(26266), + AOM_ICDF(29278), AOM_ICDF(32768), }, + {AOM_ICDF(2680), AOM_ICDF(11055), AOM_ICDF(14683), AOM_ICDF(23068), + AOM_ICDF(26651), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(22838), AOM_ICDF(24926), AOM_ICDF(31689), AOM_ICDF(32019), + AOM_ICDF(32768), }, + {AOM_ICDF(19245), AOM_ICDF(24299), AOM_ICDF(31481), AOM_ICDF(31852), + AOM_ICDF(32768), }, + {AOM_ICDF(15429), AOM_ICDF(21159), AOM_ICDF(30176), AOM_ICDF(30732), + AOM_ICDF(32768), }, + {AOM_ICDF(12373), AOM_ICDF(17092), AOM_ICDF(26912), AOM_ICDF(27758), + AOM_ICDF(32768), }, + {AOM_ICDF(10899), AOM_ICDF(13395), AOM_ICDF(23604), AOM_ICDF(24329), + AOM_ICDF(32768), }, + {AOM_ICDF(12767), AOM_ICDF(13096), AOM_ICDF(21644), AOM_ICDF(22083), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24527), AOM_ICDF(26101), AOM_ICDF(31912), AOM_ICDF(32226), + AOM_ICDF(32768), }, + {AOM_ICDF(20576), AOM_ICDF(22265), AOM_ICDF(31439), AOM_ICDF(31762), + AOM_ICDF(32768), }, + {AOM_ICDF(13792), AOM_ICDF(15369), AOM_ICDF(28531), AOM_ICDF(28942), + AOM_ICDF(32768), }, + {AOM_ICDF(9392), AOM_ICDF(11153), AOM_ICDF(23790), AOM_ICDF(24274), + AOM_ICDF(32768), }, + {AOM_ICDF(5587), AOM_ICDF(6191), AOM_ICDF(19027), AOM_ICDF(19480), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(17246), AOM_ICDF(22420), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24737), AOM_ICDF(25605), AOM_ICDF(31953), AOM_ICDF(32268), + AOM_ICDF(32768), }, + {AOM_ICDF(20933), AOM_ICDF(21817), AOM_ICDF(31546), AOM_ICDF(31861), + AOM_ICDF(32768), }, + {AOM_ICDF(13887), AOM_ICDF(14656), AOM_ICDF(28490), AOM_ICDF(28817), + AOM_ICDF(32768), }, + {AOM_ICDF(10018), AOM_ICDF(11047), AOM_ICDF(23593), AOM_ICDF(23967), + AOM_ICDF(32768), }, + {AOM_ICDF(3855), AOM_ICDF(6746), AOM_ICDF(15420), AOM_ICDF(18312), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25861), AOM_ICDF(26475), AOM_ICDF(32028), AOM_ICDF(32343), + AOM_ICDF(32768), }, + {AOM_ICDF(22221), AOM_ICDF(22755), AOM_ICDF(31735), AOM_ICDF(32050), + AOM_ICDF(32768), }, + {AOM_ICDF(15517), AOM_ICDF(15928), AOM_ICDF(29558), AOM_ICDF(29870), + AOM_ICDF(32768), }, + {AOM_ICDF(7719), AOM_ICDF(8507), AOM_ICDF(20165), AOM_ICDF(20638), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(19275), AOM_ICDF(25058), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(28675), AOM_ICDF(29326), AOM_ICDF(31767), AOM_ICDF(32092), + AOM_ICDF(32768), }, + {AOM_ICDF(21491), AOM_ICDF(22422), AOM_ICDF(29827), AOM_ICDF(30197), + AOM_ICDF(32768), }, + {AOM_ICDF(10080), AOM_ICDF(11350), AOM_ICDF(23883), AOM_ICDF(24321), + AOM_ICDF(32768), }, + {AOM_ICDF(8383), AOM_ICDF(8793), AOM_ICDF(21382), AOM_ICDF(21739), + AOM_ICDF(32768), }, + {AOM_ICDF(6835), AOM_ICDF(7137), AOM_ICDF(20646), AOM_ICDF(20947), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 32X32 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(15501), AOM_ICDF(16574), AOM_ICDF(17941), AOM_ICDF(20080), + AOM_ICDF(21984), AOM_ICDF(32768), }, + {AOM_ICDF(1676), AOM_ICDF(3221), AOM_ICDF(3952), AOM_ICDF(6916), + AOM_ICDF(7628), AOM_ICDF(32768), }, + {AOM_ICDF(468), AOM_ICDF(1825), AOM_ICDF(2211), AOM_ICDF(4504), + AOM_ICDF(4877), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(5597), AOM_ICDF(9461), AOM_ICDF(16777), AOM_ICDF(17896), + AOM_ICDF(32768), }, + {AOM_ICDF(5231), AOM_ICDF(9185), AOM_ICDF(16569), AOM_ICDF(17688), + AOM_ICDF(32768), }, + {AOM_ICDF(4128), AOM_ICDF(6983), AOM_ICDF(13860), AOM_ICDF(15674), + AOM_ICDF(32768), }, + {AOM_ICDF(2908), AOM_ICDF(4209), AOM_ICDF(9762), AOM_ICDF(11321), + AOM_ICDF(32768), }, + {AOM_ICDF(2269), AOM_ICDF(2797), AOM_ICDF(7063), AOM_ICDF(7999), + AOM_ICDF(32768), }, + {AOM_ICDF(1270), AOM_ICDF(1588), AOM_ICDF(3710), AOM_ICDF(4051), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(14862), AOM_ICDF(16903), AOM_ICDF(25712), AOM_ICDF(26189), + AOM_ICDF(32768), }, + {AOM_ICDF(12778), AOM_ICDF(15420), AOM_ICDF(25395), AOM_ICDF(25836), + AOM_ICDF(32768), }, + {AOM_ICDF(10402), AOM_ICDF(12279), AOM_ICDF(22858), AOM_ICDF(23302), + AOM_ICDF(32768), }, + {AOM_ICDF(8026), AOM_ICDF(8897), AOM_ICDF(18866), AOM_ICDF(19290), + AOM_ICDF(32768), }, + {AOM_ICDF(6610), AOM_ICDF(7121), AOM_ICDF(15967), AOM_ICDF(16322), + AOM_ICDF(32768), }, + {AOM_ICDF(3980), AOM_ICDF(4296), AOM_ICDF(10443), AOM_ICDF(10757), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19177), AOM_ICDF(21516), AOM_ICDF(28474), AOM_ICDF(28892), + AOM_ICDF(32768), }, + {AOM_ICDF(14901), AOM_ICDF(17006), AOM_ICDF(27100), AOM_ICDF(27500), + AOM_ICDF(32768), }, + {AOM_ICDF(10655), AOM_ICDF(11487), AOM_ICDF(23288), AOM_ICDF(23664), + AOM_ICDF(32768), }, + {AOM_ICDF(6980), AOM_ICDF(7408), AOM_ICDF(17955), AOM_ICDF(18288), + AOM_ICDF(32768), }, + {AOM_ICDF(3891), AOM_ICDF(4206), AOM_ICDF(11255), AOM_ICDF(11570), + AOM_ICDF(32768), }, + {AOM_ICDF(1532), AOM_ICDF(1844), AOM_ICDF(4593), AOM_ICDF(4905), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24338), AOM_ICDF(25864), AOM_ICDF(30962), AOM_ICDF(31346), + AOM_ICDF(32768), }, + {AOM_ICDF(16430), AOM_ICDF(18166), AOM_ICDF(28700), AOM_ICDF(29068), + AOM_ICDF(32768), }, + {AOM_ICDF(9726), AOM_ICDF(10244), AOM_ICDF(22575), AOM_ICDF(22934), + AOM_ICDF(32768), }, + {AOM_ICDF(5539), AOM_ICDF(5868), AOM_ICDF(15030), AOM_ICDF(15363), + AOM_ICDF(32768), }, + {AOM_ICDF(3305), AOM_ICDF(3620), AOM_ICDF(9405), AOM_ICDF(9720), + AOM_ICDF(32768), }, + {AOM_ICDF(1482), AOM_ICDF(1794), AOM_ICDF(4429), AOM_ICDF(4741), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29843), AOM_ICDF(30312), AOM_ICDF(31922), AOM_ICDF(32242), + AOM_ICDF(32768), }, + {AOM_ICDF(17390), AOM_ICDF(18061), AOM_ICDF(28932), AOM_ICDF(29258), + AOM_ICDF(32768), }, + {AOM_ICDF(7968), AOM_ICDF(8308), AOM_ICDF(20128), AOM_ICDF(20447), + AOM_ICDF(32768), }, + {AOM_ICDF(4523), AOM_ICDF(4838), AOM_ICDF(12959), AOM_ICDF(13274), + AOM_ICDF(32768), }, + {AOM_ICDF(2765), AOM_ICDF(3077), AOM_ICDF(8284), AOM_ICDF(8596), + AOM_ICDF(32768), }, + {AOM_ICDF(1422), AOM_ICDF(1733), AOM_ICDF(4244), AOM_ICDF(4556), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(19066), AOM_ICDF(20217), AOM_ICDF(21504), AOM_ICDF(24559), + AOM_ICDF(26831), AOM_ICDF(32768), }, + {AOM_ICDF(5708), AOM_ICDF(7393), AOM_ICDF(8108), AOM_ICDF(11986), + AOM_ICDF(17424), AOM_ICDF(32768), }, + {AOM_ICDF(1144), AOM_ICDF(2709), AOM_ICDF(3111), AOM_ICDF(6009), + AOM_ICDF(10882), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17586), AOM_ICDF(17895), AOM_ICDF(27561), AOM_ICDF(28179), + AOM_ICDF(32768), }, + {AOM_ICDF(16442), AOM_ICDF(19113), AOM_ICDF(27944), AOM_ICDF(28764), + AOM_ICDF(32768), }, + {AOM_ICDF(12438), AOM_ICDF(17724), AOM_ICDF(26435), AOM_ICDF(27714), + AOM_ICDF(32768), }, + {AOM_ICDF(9439), AOM_ICDF(12708), AOM_ICDF(22594), AOM_ICDF(24060), + AOM_ICDF(32768), }, + {AOM_ICDF(7762), AOM_ICDF(9639), AOM_ICDF(19669), AOM_ICDF(20614), + AOM_ICDF(32768), }, + {AOM_ICDF(5324), AOM_ICDF(5894), AOM_ICDF(14504), AOM_ICDF(15100), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23414), AOM_ICDF(25239), AOM_ICDF(31300), AOM_ICDF(31670), + AOM_ICDF(32768), }, + {AOM_ICDF(18089), AOM_ICDF(22136), AOM_ICDF(30318), AOM_ICDF(30720), + AOM_ICDF(32768), }, + {AOM_ICDF(12081), AOM_ICDF(15216), AOM_ICDF(27074), AOM_ICDF(27531), + AOM_ICDF(32768), }, + {AOM_ICDF(9327), AOM_ICDF(10783), AOM_ICDF(22927), AOM_ICDF(23384), + AOM_ICDF(32768), }, + {AOM_ICDF(6381), AOM_ICDF(6914), AOM_ICDF(17070), AOM_ICDF(17506), + AOM_ICDF(32768), }, + {AOM_ICDF(3854), AOM_ICDF(4164), AOM_ICDF(10355), AOM_ICDF(10665), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24366), AOM_ICDF(25993), AOM_ICDF(31678), AOM_ICDF(32001), + AOM_ICDF(32768), }, + {AOM_ICDF(18041), AOM_ICDF(21047), AOM_ICDF(30693), AOM_ICDF(31031), + AOM_ICDF(32768), }, + {AOM_ICDF(11271), AOM_ICDF(12970), AOM_ICDF(26794), AOM_ICDF(27180), + AOM_ICDF(32768), }, + {AOM_ICDF(8173), AOM_ICDF(8758), AOM_ICDF(21941), AOM_ICDF(22340), + AOM_ICDF(32768), }, + {AOM_ICDF(5248), AOM_ICDF(5568), AOM_ICDF(15646), AOM_ICDF(15994), + AOM_ICDF(32768), }, + {AOM_ICDF(2689), AOM_ICDF(3193), AOM_ICDF(6722), AOM_ICDF(7226), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27565), AOM_ICDF(28694), AOM_ICDF(31993), AOM_ICDF(32314), + AOM_ICDF(32768), }, + {AOM_ICDF(20591), AOM_ICDF(22532), AOM_ICDF(31143), AOM_ICDF(31473), + AOM_ICDF(32768), }, + {AOM_ICDF(11268), AOM_ICDF(12113), AOM_ICDF(25966), AOM_ICDF(26331), + AOM_ICDF(32768), }, + {AOM_ICDF(7268), AOM_ICDF(7674), AOM_ICDF(19409), AOM_ICDF(19747), + AOM_ICDF(32768), }, + {AOM_ICDF(4404), AOM_ICDF(4686), AOM_ICDF(13213), AOM_ICDF(13495), + AOM_ICDF(32768), }, + {AOM_ICDF(2637), AOM_ICDF(3766), AOM_ICDF(7533), AOM_ICDF(8663), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29847), AOM_ICDF(30306), AOM_ICDF(32081), AOM_ICDF(32397), + AOM_ICDF(32768), }, + {AOM_ICDF(22752), AOM_ICDF(23329), AOM_ICDF(31334), AOM_ICDF(31658), + AOM_ICDF(32768), }, + {AOM_ICDF(10305), AOM_ICDF(10672), AOM_ICDF(24328), AOM_ICDF(24657), + AOM_ICDF(32768), }, + {AOM_ICDF(5712), AOM_ICDF(6031), AOM_ICDF(16694), AOM_ICDF(17018), + AOM_ICDF(32768), }, + {AOM_ICDF(3979), AOM_ICDF(4278), AOM_ICDF(10985), AOM_ICDF(11284), + AOM_ICDF(32768), }, + {AOM_ICDF(2465), AOM_ICDF(2900), AOM_ICDF(6815), AOM_ICDF(7250), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(21609), AOM_ICDF(22111), AOM_ICDF(24624), AOM_ICDF(26045), + AOM_ICDF(27916), AOM_ICDF(32768), }, + {AOM_ICDF(5498), AOM_ICDF(7300), AOM_ICDF(12100), AOM_ICDF(15851), + AOM_ICDF(18370), AOM_ICDF(32768), }, + {AOM_ICDF(1268), AOM_ICDF(3284), AOM_ICDF(6295), AOM_ICDF(10711), + AOM_ICDF(12999), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(9621), AOM_ICDF(16733), AOM_ICDF(26354), AOM_ICDF(27609), + AOM_ICDF(32768), }, + {AOM_ICDF(9619), AOM_ICDF(18339), AOM_ICDF(27578), AOM_ICDF(28547), + AOM_ICDF(32768), }, + {AOM_ICDF(9575), AOM_ICDF(18177), AOM_ICDF(24044), AOM_ICDF(25625), + AOM_ICDF(32768), }, + {AOM_ICDF(5999), AOM_ICDF(11578), AOM_ICDF(20125), AOM_ICDF(22544), + AOM_ICDF(32768), }, + {AOM_ICDF(4842), AOM_ICDF(6220), AOM_ICDF(12898), AOM_ICDF(14944), + AOM_ICDF(32768), }, + {AOM_ICDF(948), AOM_ICDF(1247), AOM_ICDF(3292), AOM_ICDF(3791), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21002), AOM_ICDF(25135), AOM_ICDF(31208), AOM_ICDF(31629), + AOM_ICDF(32768), }, + {AOM_ICDF(18106), AOM_ICDF(22116), AOM_ICDF(29422), AOM_ICDF(30013), + AOM_ICDF(32768), }, + {AOM_ICDF(14580), AOM_ICDF(15855), AOM_ICDF(26171), AOM_ICDF(26535), + AOM_ICDF(32768), }, + {AOM_ICDF(9965), AOM_ICDF(10971), AOM_ICDF(23043), AOM_ICDF(23378), + AOM_ICDF(32768), }, + {AOM_ICDF(7123), AOM_ICDF(7395), AOM_ICDF(16893), AOM_ICDF(17232), + AOM_ICDF(32768), }, + {AOM_ICDF(3187), AOM_ICDF(3432), AOM_ICDF(7600), AOM_ICDF(7845), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26393), AOM_ICDF(27823), AOM_ICDF(31691), AOM_ICDF(32028), + AOM_ICDF(32768), }, + {AOM_ICDF(18449), AOM_ICDF(20915), AOM_ICDF(30092), AOM_ICDF(30531), + AOM_ICDF(32768), }, + {AOM_ICDF(11710), AOM_ICDF(12263), AOM_ICDF(26838), AOM_ICDF(27139), + AOM_ICDF(32768), }, + {AOM_ICDF(7737), AOM_ICDF(8192), AOM_ICDF(21299), AOM_ICDF(21572), + AOM_ICDF(32768), }, + {AOM_ICDF(3572), AOM_ICDF(4038), AOM_ICDF(13822), AOM_ICDF(14287), + AOM_ICDF(32768), }, + {AOM_ICDF(1689), AOM_ICDF(2703), AOM_ICDF(3716), AOM_ICDF(4729), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28371), AOM_ICDF(29507), AOM_ICDF(31986), AOM_ICDF(32314), + AOM_ICDF(32768), }, + {AOM_ICDF(19411), AOM_ICDF(21758), AOM_ICDF(30225), AOM_ICDF(30579), + AOM_ICDF(32768), }, + {AOM_ICDF(11995), AOM_ICDF(12434), AOM_ICDF(26661), AOM_ICDF(27026), + AOM_ICDF(32768), }, + {AOM_ICDF(9175), AOM_ICDF(9721), AOM_ICDF(22173), AOM_ICDF(22501), + AOM_ICDF(32768), }, + {AOM_ICDF(9078), AOM_ICDF(9742), AOM_ICDF(13063), AOM_ICDF(13727), + AOM_ICDF(32768), }, + {AOM_ICDF(3192), AOM_ICDF(3830), AOM_ICDF(6809), AOM_ICDF(7447), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(31351), AOM_ICDF(31682), AOM_ICDF(32124), AOM_ICDF(32438), + AOM_ICDF(32768), }, + {AOM_ICDF(20883), AOM_ICDF(22618), AOM_ICDF(30828), AOM_ICDF(31173), + AOM_ICDF(32768), }, + {AOM_ICDF(11388), AOM_ICDF(12381), AOM_ICDF(24266), AOM_ICDF(24700), + AOM_ICDF(32768), }, + {AOM_ICDF(6987), AOM_ICDF(7380), AOM_ICDF(18401), AOM_ICDF(18795), + AOM_ICDF(32768), }, + {AOM_ICDF(2016), AOM_ICDF(2773), AOM_ICDF(7814), AOM_ICDF(8570), + AOM_ICDF(32768), }, + {AOM_ICDF(2849), AOM_ICDF(4986), AOM_ICDF(8548), AOM_ICDF(10685), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(19461), AOM_ICDF(21728), AOM_ICDF(26601), AOM_ICDF(29082), + AOM_ICDF(30105), AOM_ICDF(32768), }, + {AOM_ICDF(2845), AOM_ICDF(10798), AOM_ICDF(14316), AOM_ICDF(23118), + AOM_ICDF(24609), AOM_ICDF(32768), }, + {AOM_ICDF(705), AOM_ICDF(10138), AOM_ICDF(12123), AOM_ICDF(21473), + AOM_ICDF(23327), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(24780), AOM_ICDF(25836), AOM_ICDF(31623), AOM_ICDF(31938), + AOM_ICDF(32768), }, + {AOM_ICDF(22703), AOM_ICDF(24390), AOM_ICDF(31353), AOM_ICDF(31797), + AOM_ICDF(32768), }, + {AOM_ICDF(18218), AOM_ICDF(20834), AOM_ICDF(29429), AOM_ICDF(30327), + AOM_ICDF(32768), }, + {AOM_ICDF(12517), AOM_ICDF(15626), AOM_ICDF(26000), AOM_ICDF(27281), + AOM_ICDF(32768), }, + {AOM_ICDF(9988), AOM_ICDF(12791), AOM_ICDF(24073), AOM_ICDF(25295), + AOM_ICDF(32768), }, + {AOM_ICDF(8529), AOM_ICDF(9202), AOM_ICDF(18853), AOM_ICDF(19751), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(26497), AOM_ICDF(27282), AOM_ICDF(32016), AOM_ICDF(32333), + AOM_ICDF(32768), }, + {AOM_ICDF(22767), AOM_ICDF(24548), AOM_ICDF(31680), AOM_ICDF(32007), + AOM_ICDF(32768), }, + {AOM_ICDF(10455), AOM_ICDF(13458), AOM_ICDF(26448), AOM_ICDF(26995), + AOM_ICDF(32768), }, + {AOM_ICDF(3684), AOM_ICDF(4847), AOM_ICDF(20940), AOM_ICDF(21522), + AOM_ICDF(32768), }, + {AOM_ICDF(9063), AOM_ICDF(11155), AOM_ICDF(17430), AOM_ICDF(19521), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(11469), AOM_ICDF(16384), AOM_ICDF(21299), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26212), AOM_ICDF(26755), AOM_ICDF(32090), AOM_ICDF(32400), + AOM_ICDF(32768), }, + {AOM_ICDF(22239), AOM_ICDF(23123), AOM_ICDF(31406), AOM_ICDF(31725), + AOM_ICDF(32768), }, + {AOM_ICDF(7220), AOM_ICDF(7609), AOM_ICDF(22715), AOM_ICDF(22993), + AOM_ICDF(32768), }, + {AOM_ICDF(5554), AOM_ICDF(6387), AOM_ICDF(11941), AOM_ICDF(12774), + AOM_ICDF(32768), }, + {AOM_ICDF(4915), AOM_ICDF(9830), AOM_ICDF(19661), AOM_ICDF(24576), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28796), AOM_ICDF(29237), AOM_ICDF(32134), AOM_ICDF(32446), + AOM_ICDF(32768), }, + {AOM_ICDF(25912), AOM_ICDF(26456), AOM_ICDF(32010), AOM_ICDF(32321), + AOM_ICDF(32768), }, + {AOM_ICDF(14399), AOM_ICDF(14668), AOM_ICDF(26039), AOM_ICDF(26309), + AOM_ICDF(32768), }, + {AOM_ICDF(2341), AOM_ICDF(4096), AOM_ICDF(11703), AOM_ICDF(13458), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30253), AOM_ICDF(30635), AOM_ICDF(32016), AOM_ICDF(32330), + AOM_ICDF(32768), }, + {AOM_ICDF(23066), AOM_ICDF(23485), AOM_ICDF(30571), AOM_ICDF(30897), + AOM_ICDF(32768), }, + {AOM_ICDF(11664), AOM_ICDF(12092), AOM_ICDF(22146), AOM_ICDF(22496), + AOM_ICDF(32768), }, + {AOM_ICDF(5932), AOM_ICDF(6387), AOM_ICDF(17131), AOM_ICDF(17470), + AOM_ICDF(32768), }, + {AOM_ICDF(5501), AOM_ICDF(5846), AOM_ICDF(15763), AOM_ICDF(16097), + AOM_ICDF(32768), }, + {AOM_ICDF(4946), AOM_ICDF(6801), AOM_ICDF(14838), AOM_ICDF(16693), + AOM_ICDF(32768), }, + }, + }, + }, + }, +}; + +static const coeff_cdf_model +av1_default_coef_head_cdfs_q1[TX_SIZES][PLANE_TYPES] = { + { // TX 4X4 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(21480), AOM_ICDF(22344), AOM_ICDF(27339), AOM_ICDF(29181), + AOM_ICDF(29765), AOM_ICDF(32768), }, + {AOM_ICDF(9705), AOM_ICDF(12374), AOM_ICDF(20269), AOM_ICDF(24109), + AOM_ICDF(25071), AOM_ICDF(32768), }, + {AOM_ICDF(2883), AOM_ICDF(6716), AOM_ICDF(10461), AOM_ICDF(16169), + AOM_ICDF(17355), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(8632), AOM_ICDF(15472), AOM_ICDF(26027), AOM_ICDF(26596), + AOM_ICDF(32768), }, + {AOM_ICDF(8543), AOM_ICDF(14383), AOM_ICDF(25665), AOM_ICDF(26207), + AOM_ICDF(32768), }, + {AOM_ICDF(8561), AOM_ICDF(12583), AOM_ICDF(22962), AOM_ICDF(23529), + AOM_ICDF(32768), }, + {AOM_ICDF(6538), AOM_ICDF(8023), AOM_ICDF(18106), AOM_ICDF(18672), + AOM_ICDF(32768), }, + {AOM_ICDF(4363), AOM_ICDF(4797), AOM_ICDF(12512), AOM_ICDF(12937), + AOM_ICDF(32768), }, + {AOM_ICDF(2471), AOM_ICDF(2791), AOM_ICDF(7274), AOM_ICDF(7605), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(14783), AOM_ICDF(18891), AOM_ICDF(29122), AOM_ICDF(29700), + AOM_ICDF(32768), }, + {AOM_ICDF(11829), AOM_ICDF(16696), AOM_ICDF(28114), AOM_ICDF(28591), + AOM_ICDF(32768), }, + {AOM_ICDF(8965), AOM_ICDF(11076), AOM_ICDF(23514), AOM_ICDF(24031), + AOM_ICDF(32768), }, + {AOM_ICDF(6257), AOM_ICDF(7011), AOM_ICDF(17779), AOM_ICDF(18315), + AOM_ICDF(32768), }, + {AOM_ICDF(4329), AOM_ICDF(4704), AOM_ICDF(12448), AOM_ICDF(12839), + AOM_ICDF(32768), }, + {AOM_ICDF(2542), AOM_ICDF(2860), AOM_ICDF(7886), AOM_ICDF(8207), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19181), AOM_ICDF(22038), AOM_ICDF(30697), AOM_ICDF(31106), + AOM_ICDF(32768), }, + {AOM_ICDF(12174), AOM_ICDF(17208), AOM_ICDF(28897), AOM_ICDF(29328), + AOM_ICDF(32768), }, + {AOM_ICDF(8420), AOM_ICDF(10706), AOM_ICDF(23788), AOM_ICDF(24321), + AOM_ICDF(32768), }, + {AOM_ICDF(6153), AOM_ICDF(6850), AOM_ICDF(17983), AOM_ICDF(18530), + AOM_ICDF(32768), }, + {AOM_ICDF(4168), AOM_ICDF(4524), AOM_ICDF(12547), AOM_ICDF(12983), + AOM_ICDF(32768), }, + {AOM_ICDF(3136), AOM_ICDF(3480), AOM_ICDF(9221), AOM_ICDF(9659), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(18701), AOM_ICDF(23907), AOM_ICDF(31282), AOM_ICDF(31695), + AOM_ICDF(32768), }, + {AOM_ICDF(12655), AOM_ICDF(19258), AOM_ICDF(29824), AOM_ICDF(30279), + AOM_ICDF(32768), }, + {AOM_ICDF(8699), AOM_ICDF(11467), AOM_ICDF(24763), AOM_ICDF(25450), + AOM_ICDF(32768), }, + {AOM_ICDF(6268), AOM_ICDF(7027), AOM_ICDF(18397), AOM_ICDF(19102), + AOM_ICDF(32768), }, + {AOM_ICDF(5613), AOM_ICDF(6020), AOM_ICDF(14084), AOM_ICDF(14637), + AOM_ICDF(32768), }, + {AOM_ICDF(2443), AOM_ICDF(2919), AOM_ICDF(8222), AOM_ICDF(8639), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(6156), AOM_ICDF(23586), AOM_ICDF(30739), AOM_ICDF(31476), + AOM_ICDF(32768), }, + {AOM_ICDF(6056), AOM_ICDF(21852), AOM_ICDF(29323), AOM_ICDF(30442), + AOM_ICDF(32768), }, + {AOM_ICDF(6113), AOM_ICDF(14408), AOM_ICDF(24331), AOM_ICDF(26899), + AOM_ICDF(32768), }, + {AOM_ICDF(5825), AOM_ICDF(9328), AOM_ICDF(18946), AOM_ICDF(22143), + AOM_ICDF(32768), }, + {AOM_ICDF(5023), AOM_ICDF(6340), AOM_ICDF(14812), AOM_ICDF(17429), + AOM_ICDF(32768), }, + {AOM_ICDF(5140), AOM_ICDF(6104), AOM_ICDF(11565), AOM_ICDF(14135), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(12606), AOM_ICDF(20577), AOM_ICDF(21354), AOM_ICDF(29249), + AOM_ICDF(29714), AOM_ICDF(32768), }, + {AOM_ICDF(8630), AOM_ICDF(17728), AOM_ICDF(19353), AOM_ICDF(27722), + AOM_ICDF(28219), AOM_ICDF(32768), }, + {AOM_ICDF(3040), AOM_ICDF(12616), AOM_ICDF(14286), AOM_ICDF(23918), + AOM_ICDF(24539), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(20824), AOM_ICDF(21610), AOM_ICDF(31110), AOM_ICDF(31445), + AOM_ICDF(32768), }, + {AOM_ICDF(15597), AOM_ICDF(17692), AOM_ICDF(29670), AOM_ICDF(30015), + AOM_ICDF(32768), }, + {AOM_ICDF(8954), AOM_ICDF(10007), AOM_ICDF(23515), AOM_ICDF(23902), + AOM_ICDF(32768), }, + {AOM_ICDF(6693), AOM_ICDF(7282), AOM_ICDF(18144), AOM_ICDF(18537), + AOM_ICDF(32768), }, + {AOM_ICDF(4048), AOM_ICDF(4451), AOM_ICDF(12255), AOM_ICDF(12626), + AOM_ICDF(32768), }, + {AOM_ICDF(2619), AOM_ICDF(2960), AOM_ICDF(7084), AOM_ICDF(7429), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21628), AOM_ICDF(22786), AOM_ICDF(31520), AOM_ICDF(31865), + AOM_ICDF(32768), }, + {AOM_ICDF(15854), AOM_ICDF(17925), AOM_ICDF(29872), AOM_ICDF(30228), + AOM_ICDF(32768), }, + {AOM_ICDF(8120), AOM_ICDF(8815), AOM_ICDF(22575), AOM_ICDF(22964), + AOM_ICDF(32768), }, + {AOM_ICDF(5006), AOM_ICDF(5427), AOM_ICDF(15724), AOM_ICDF(16101), + AOM_ICDF(32768), }, + {AOM_ICDF(2967), AOM_ICDF(3311), AOM_ICDF(9553), AOM_ICDF(9913), + AOM_ICDF(32768), }, + {AOM_ICDF(2878), AOM_ICDF(3188), AOM_ICDF(5418), AOM_ICDF(5825), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(21594), AOM_ICDF(23721), AOM_ICDF(31496), AOM_ICDF(31872), + AOM_ICDF(32768), }, + {AOM_ICDF(15704), AOM_ICDF(18452), AOM_ICDF(30207), AOM_ICDF(30585), + AOM_ICDF(32768), }, + {AOM_ICDF(8637), AOM_ICDF(9546), AOM_ICDF(23803), AOM_ICDF(24254), + AOM_ICDF(32768), }, + {AOM_ICDF(5991), AOM_ICDF(6479), AOM_ICDF(17619), AOM_ICDF(18099), + AOM_ICDF(32768), }, + {AOM_ICDF(3856), AOM_ICDF(4220), AOM_ICDF(11623), AOM_ICDF(12111), + AOM_ICDF(32768), }, + {AOM_ICDF(3501), AOM_ICDF(3825), AOM_ICDF(6760), AOM_ICDF(7246), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(19929), AOM_ICDF(23849), AOM_ICDF(31581), AOM_ICDF(31956), + AOM_ICDF(32768), }, + {AOM_ICDF(14239), AOM_ICDF(19461), AOM_ICDF(30323), AOM_ICDF(30761), + AOM_ICDF(32768), }, + {AOM_ICDF(8094), AOM_ICDF(9844), AOM_ICDF(23595), AOM_ICDF(24338), + AOM_ICDF(32768), }, + {AOM_ICDF(5204), AOM_ICDF(5848), AOM_ICDF(16396), AOM_ICDF(17121), + AOM_ICDF(32768), }, + {AOM_ICDF(3568), AOM_ICDF(3961), AOM_ICDF(10658), AOM_ICDF(11301), + AOM_ICDF(32768), }, + {AOM_ICDF(1594), AOM_ICDF(1913), AOM_ICDF(5552), AOM_ICDF(6040), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(13512), AOM_ICDF(24112), AOM_ICDF(31648), AOM_ICDF(32057), + AOM_ICDF(32768), }, + {AOM_ICDF(10595), AOM_ICDF(22378), AOM_ICDF(30592), AOM_ICDF(31236), + AOM_ICDF(32768), }, + {AOM_ICDF(7571), AOM_ICDF(13305), AOM_ICDF(24936), AOM_ICDF(26656), + AOM_ICDF(32768), }, + {AOM_ICDF(6163), AOM_ICDF(8207), AOM_ICDF(18688), AOM_ICDF(20500), + AOM_ICDF(32768), }, + {AOM_ICDF(3185), AOM_ICDF(4449), AOM_ICDF(13298), AOM_ICDF(14707), + AOM_ICDF(32768), }, + {AOM_ICDF(1890), AOM_ICDF(2731), AOM_ICDF(7562), AOM_ICDF(8192), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(26689), AOM_ICDF(27259), AOM_ICDF(30590), AOM_ICDF(31538), + AOM_ICDF(31930), AOM_ICDF(32768), }, + {AOM_ICDF(17843), AOM_ICDF(19709), AOM_ICDF(27299), AOM_ICDF(29813), + AOM_ICDF(30435), AOM_ICDF(32768), }, + {AOM_ICDF(9138), AOM_ICDF(13232), AOM_ICDF(20487), AOM_ICDF(25798), + AOM_ICDF(26794), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(13264), AOM_ICDF(22970), AOM_ICDF(30914), AOM_ICDF(31354), + AOM_ICDF(32768), }, + {AOM_ICDF(11647), AOM_ICDF(20651), AOM_ICDF(30191), AOM_ICDF(30692), + AOM_ICDF(32768), }, + {AOM_ICDF(10449), AOM_ICDF(15871), AOM_ICDF(27240), AOM_ICDF(27909), + AOM_ICDF(32768), }, + {AOM_ICDF(7759), AOM_ICDF(9400), AOM_ICDF(22161), AOM_ICDF(22812), + AOM_ICDF(32768), }, + {AOM_ICDF(4095), AOM_ICDF(4544), AOM_ICDF(13856), AOM_ICDF(14309), + AOM_ICDF(32768), }, + {AOM_ICDF(3199), AOM_ICDF(3509), AOM_ICDF(8639), AOM_ICDF(8964), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18180), AOM_ICDF(25717), AOM_ICDF(31446), AOM_ICDF(31899), + AOM_ICDF(32768), }, + {AOM_ICDF(14593), AOM_ICDF(22211), AOM_ICDF(30845), AOM_ICDF(31282), + AOM_ICDF(32768), }, + {AOM_ICDF(10443), AOM_ICDF(13816), AOM_ICDF(27239), AOM_ICDF(27789), + AOM_ICDF(32768), }, + {AOM_ICDF(6760), AOM_ICDF(7698), AOM_ICDF(19648), AOM_ICDF(20234), + AOM_ICDF(32768), }, + {AOM_ICDF(3896), AOM_ICDF(4253), AOM_ICDF(12678), AOM_ICDF(13056), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(6722), AOM_ICDF(13443), AOM_ICDF(14704), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22145), AOM_ICDF(27566), AOM_ICDF(31813), AOM_ICDF(32212), + AOM_ICDF(32768), }, + {AOM_ICDF(15241), AOM_ICDF(23215), AOM_ICDF(31215), AOM_ICDF(31658), + AOM_ICDF(32768), }, + {AOM_ICDF(11148), AOM_ICDF(15527), AOM_ICDF(28336), AOM_ICDF(28891), + AOM_ICDF(32768), }, + {AOM_ICDF(8864), AOM_ICDF(10402), AOM_ICDF(24069), AOM_ICDF(24811), + AOM_ICDF(32768), }, + {AOM_ICDF(6919), AOM_ICDF(7527), AOM_ICDF(19607), AOM_ICDF(20260), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(18971), AOM_ICDF(25869), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(18795), AOM_ICDF(27901), AOM_ICDF(31907), AOM_ICDF(32272), + AOM_ICDF(32768), }, + {AOM_ICDF(13177), AOM_ICDF(24166), AOM_ICDF(31395), AOM_ICDF(31820), + AOM_ICDF(32768), }, + {AOM_ICDF(9217), AOM_ICDF(15410), AOM_ICDF(28101), AOM_ICDF(28868), + AOM_ICDF(32768), }, + {AOM_ICDF(6328), AOM_ICDF(8749), AOM_ICDF(21695), AOM_ICDF(22954), + AOM_ICDF(32768), }, + {AOM_ICDF(15672), AOM_ICDF(17809), AOM_ICDF(22795), AOM_ICDF(24932), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(9431), AOM_ICDF(28094), AOM_ICDF(31965), AOM_ICDF(32338), + AOM_ICDF(32768), }, + {AOM_ICDF(8107), AOM_ICDF(26038), AOM_ICDF(31393), AOM_ICDF(32024), + AOM_ICDF(32768), }, + {AOM_ICDF(9347), AOM_ICDF(19880), AOM_ICDF(28342), AOM_ICDF(29759), + AOM_ICDF(32768), }, + {AOM_ICDF(7092), AOM_ICDF(13694), AOM_ICDF(25432), AOM_ICDF(28366), + AOM_ICDF(32768), }, + {AOM_ICDF(7802), AOM_ICDF(12483), AOM_ICDF(21845), AOM_ICDF(26526), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(29212), AOM_ICDF(29998), AOM_ICDF(31256), AOM_ICDF(32035), + AOM_ICDF(32360), AOM_ICDF(32768), }, + {AOM_ICDF(19150), AOM_ICDF(23189), AOM_ICDF(28117), AOM_ICDF(31168), + AOM_ICDF(31611), AOM_ICDF(32768), }, + {AOM_ICDF(9324), AOM_ICDF(18178), AOM_ICDF(23556), AOM_ICDF(29422), + AOM_ICDF(30204), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(20406), AOM_ICDF(26462), AOM_ICDF(31971), AOM_ICDF(32298), + AOM_ICDF(32768), }, + {AOM_ICDF(15834), AOM_ICDF(22647), AOM_ICDF(31547), AOM_ICDF(31902), + AOM_ICDF(32768), }, + {AOM_ICDF(11047), AOM_ICDF(15431), AOM_ICDF(27825), AOM_ICDF(28393), + AOM_ICDF(32768), }, + {AOM_ICDF(8665), AOM_ICDF(11083), AOM_ICDF(22493), AOM_ICDF(23423), + AOM_ICDF(32768), }, + {AOM_ICDF(6191), AOM_ICDF(7733), AOM_ICDF(16624), AOM_ICDF(17708), + AOM_ICDF(32768), }, + {AOM_ICDF(3210), AOM_ICDF(3875), AOM_ICDF(10937), AOM_ICDF(11867), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21520), AOM_ICDF(27152), AOM_ICDF(31994), AOM_ICDF(32324), + AOM_ICDF(32768), }, + {AOM_ICDF(17519), AOM_ICDF(23609), AOM_ICDF(31670), AOM_ICDF(32022), + AOM_ICDF(32768), }, + {AOM_ICDF(10647), AOM_ICDF(14610), AOM_ICDF(28389), AOM_ICDF(28873), + AOM_ICDF(32768), }, + {AOM_ICDF(7660), AOM_ICDF(10704), AOM_ICDF(22849), AOM_ICDF(23680), + AOM_ICDF(32768), }, + {AOM_ICDF(5535), AOM_ICDF(6454), AOM_ICDF(17275), AOM_ICDF(17753), + AOM_ICDF(32768), }, + {AOM_ICDF(4096), AOM_ICDF(6144), AOM_ICDF(13653), AOM_ICDF(15701), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22487), AOM_ICDF(27996), AOM_ICDF(32020), AOM_ICDF(32381), + AOM_ICDF(32768), }, + {AOM_ICDF(17371), AOM_ICDF(24453), AOM_ICDF(31777), AOM_ICDF(32152), + AOM_ICDF(32768), }, + {AOM_ICDF(11366), AOM_ICDF(16072), AOM_ICDF(29193), AOM_ICDF(29761), + AOM_ICDF(32768), }, + {AOM_ICDF(12545), AOM_ICDF(13869), AOM_ICDF(24642), AOM_ICDF(25603), + AOM_ICDF(32768), }, + {AOM_ICDF(4119), AOM_ICDF(5056), AOM_ICDF(16103), AOM_ICDF(17601), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(19350), AOM_ICDF(28517), AOM_ICDF(32050), AOM_ICDF(32401), + AOM_ICDF(32768), }, + {AOM_ICDF(14752), AOM_ICDF(25831), AOM_ICDF(31897), AOM_ICDF(32261), + AOM_ICDF(32768), }, + {AOM_ICDF(11157), AOM_ICDF(20816), AOM_ICDF(29821), AOM_ICDF(30635), + AOM_ICDF(32768), }, + {AOM_ICDF(8157), AOM_ICDF(9691), AOM_ICDF(22868), AOM_ICDF(23705), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(10650), AOM_ICDF(17203), AOM_ICDF(19661), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(15557), AOM_ICDF(29043), AOM_ICDF(32047), AOM_ICDF(32424), + AOM_ICDF(32768), }, + {AOM_ICDF(10253), AOM_ICDF(27948), AOM_ICDF(31922), AOM_ICDF(32329), + AOM_ICDF(32768), }, + {AOM_ICDF(7797), AOM_ICDF(18860), AOM_ICDF(28870), AOM_ICDF(30661), + AOM_ICDF(32768), }, + {AOM_ICDF(5617), AOM_ICDF(11235), AOM_ICDF(27151), AOM_ICDF(29959), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 8X8 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(20585), AOM_ICDF(21554), AOM_ICDF(27179), AOM_ICDF(28995), + AOM_ICDF(30170), AOM_ICDF(32768), }, + {AOM_ICDF(6316), AOM_ICDF(8987), AOM_ICDF(15571), AOM_ICDF(19766), + AOM_ICDF(21417), AOM_ICDF(32768), }, + {AOM_ICDF(1426), AOM_ICDF(4693), AOM_ICDF(6721), AOM_ICDF(11940), + AOM_ICDF(12874), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(10177), AOM_ICDF(14297), AOM_ICDF(24926), AOM_ICDF(25396), + AOM_ICDF(32768), }, + {AOM_ICDF(8812), AOM_ICDF(13381), AOM_ICDF(24128), AOM_ICDF(24649), + AOM_ICDF(32768), }, + {AOM_ICDF(8090), AOM_ICDF(11314), AOM_ICDF(21329), AOM_ICDF(21906), + AOM_ICDF(32768), }, + {AOM_ICDF(6324), AOM_ICDF(7511), AOM_ICDF(17212), AOM_ICDF(17717), + AOM_ICDF(32768), }, + {AOM_ICDF(4272), AOM_ICDF(4718), AOM_ICDF(12016), AOM_ICDF(12415), + AOM_ICDF(32768), }, + {AOM_ICDF(2129), AOM_ICDF(2445), AOM_ICDF(6433), AOM_ICDF(6755), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(15709), AOM_ICDF(18339), AOM_ICDF(28174), AOM_ICDF(28566), + AOM_ICDF(32768), }, + {AOM_ICDF(12592), AOM_ICDF(15866), AOM_ICDF(27071), AOM_ICDF(27475), + AOM_ICDF(32768), }, + {AOM_ICDF(9361), AOM_ICDF(10768), AOM_ICDF(22752), AOM_ICDF(23166), + AOM_ICDF(32768), }, + {AOM_ICDF(6525), AOM_ICDF(7048), AOM_ICDF(17478), AOM_ICDF(17863), + AOM_ICDF(32768), }, + {AOM_ICDF(4314), AOM_ICDF(4656), AOM_ICDF(12242), AOM_ICDF(12579), + AOM_ICDF(32768), }, + {AOM_ICDF(2419), AOM_ICDF(2735), AOM_ICDF(7387), AOM_ICDF(7707), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(20453), AOM_ICDF(22253), AOM_ICDF(29963), AOM_ICDF(30329), + AOM_ICDF(32768), }, + {AOM_ICDF(14090), AOM_ICDF(16483), AOM_ICDF(27992), AOM_ICDF(28355), + AOM_ICDF(32768), }, + {AOM_ICDF(8737), AOM_ICDF(9396), AOM_ICDF(22134), AOM_ICDF(22499), + AOM_ICDF(32768), }, + {AOM_ICDF(5543), AOM_ICDF(5904), AOM_ICDF(15783), AOM_ICDF(16122), + AOM_ICDF(32768), }, + {AOM_ICDF(3358), AOM_ICDF(3677), AOM_ICDF(10362), AOM_ICDF(10680), + AOM_ICDF(32768), }, + {AOM_ICDF(1875), AOM_ICDF(2187), AOM_ICDF(5982), AOM_ICDF(6294), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(23693), AOM_ICDF(25306), AOM_ICDF(31174), AOM_ICDF(31516), + AOM_ICDF(32768), }, + {AOM_ICDF(14804), AOM_ICDF(16843), AOM_ICDF(28713), AOM_ICDF(29058), + AOM_ICDF(32768), }, + {AOM_ICDF(8442), AOM_ICDF(8976), AOM_ICDF(22003), AOM_ICDF(22353), + AOM_ICDF(32768), }, + {AOM_ICDF(5397), AOM_ICDF(5741), AOM_ICDF(15529), AOM_ICDF(15867), + AOM_ICDF(32768), }, + {AOM_ICDF(3322), AOM_ICDF(3639), AOM_ICDF(10248), AOM_ICDF(10570), + AOM_ICDF(32768), }, + {AOM_ICDF(1852), AOM_ICDF(2161), AOM_ICDF(5980), AOM_ICDF(6290), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(24219), AOM_ICDF(26214), AOM_ICDF(31501), AOM_ICDF(31844), + AOM_ICDF(32768), }, + {AOM_ICDF(15202), AOM_ICDF(17709), AOM_ICDF(29450), AOM_ICDF(29807), + AOM_ICDF(32768), }, + {AOM_ICDF(9044), AOM_ICDF(9603), AOM_ICDF(23134), AOM_ICDF(23506), + AOM_ICDF(32768), }, + {AOM_ICDF(5849), AOM_ICDF(6187), AOM_ICDF(16695), AOM_ICDF(17032), + AOM_ICDF(32768), }, + {AOM_ICDF(3734), AOM_ICDF(4050), AOM_ICDF(11408), AOM_ICDF(11727), + AOM_ICDF(32768), }, + {AOM_ICDF(1898), AOM_ICDF(2201), AOM_ICDF(6126), AOM_ICDF(6430), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(10195), AOM_ICDF(21186), AOM_ICDF(23530), AOM_ICDF(29551), + AOM_ICDF(30281), AOM_ICDF(32768), }, + {AOM_ICDF(3950), AOM_ICDF(15607), AOM_ICDF(18726), AOM_ICDF(26764), + AOM_ICDF(27758), AOM_ICDF(32768), }, + {AOM_ICDF(942), AOM_ICDF(11209), AOM_ICDF(12954), AOM_ICDF(22126), + AOM_ICDF(23296), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(24110), AOM_ICDF(24717), AOM_ICDF(31199), AOM_ICDF(31532), + AOM_ICDF(32768), }, + {AOM_ICDF(16869), AOM_ICDF(18762), AOM_ICDF(29600), AOM_ICDF(29951), + AOM_ICDF(32768), }, + {AOM_ICDF(10702), AOM_ICDF(12122), AOM_ICDF(25122), AOM_ICDF(25503), + AOM_ICDF(32768), }, + {AOM_ICDF(8221), AOM_ICDF(9053), AOM_ICDF(20816), AOM_ICDF(21206), + AOM_ICDF(32768), }, + {AOM_ICDF(5635), AOM_ICDF(6244), AOM_ICDF(15801), AOM_ICDF(16186), + AOM_ICDF(32768), }, + {AOM_ICDF(3776), AOM_ICDF(4210), AOM_ICDF(10380), AOM_ICDF(10766), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24719), AOM_ICDF(25439), AOM_ICDF(31522), AOM_ICDF(31849), + AOM_ICDF(32768), }, + {AOM_ICDF(16693), AOM_ICDF(18162), AOM_ICDF(29698), AOM_ICDF(30036), + AOM_ICDF(32768), }, + {AOM_ICDF(9340), AOM_ICDF(10024), AOM_ICDF(23513), AOM_ICDF(23867), + AOM_ICDF(32768), }, + {AOM_ICDF(6269), AOM_ICDF(6709), AOM_ICDF(17711), AOM_ICDF(18060), + AOM_ICDF(32768), }, + {AOM_ICDF(3841), AOM_ICDF(4185), AOM_ICDF(11892), AOM_ICDF(12230), + AOM_ICDF(32768), }, + {AOM_ICDF(1944), AOM_ICDF(2259), AOM_ICDF(6437), AOM_ICDF(6776), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25795), AOM_ICDF(26524), AOM_ICDF(31784), AOM_ICDF(32108), + AOM_ICDF(32768), }, + {AOM_ICDF(17514), AOM_ICDF(18812), AOM_ICDF(30221), AOM_ICDF(30557), + AOM_ICDF(32768), }, + {AOM_ICDF(9099), AOM_ICDF(9576), AOM_ICDF(23502), AOM_ICDF(23843), + AOM_ICDF(32768), }, + {AOM_ICDF(5738), AOM_ICDF(6097), AOM_ICDF(16847), AOM_ICDF(17182), + AOM_ICDF(32768), }, + {AOM_ICDF(3411), AOM_ICDF(3730), AOM_ICDF(10729), AOM_ICDF(11057), + AOM_ICDF(32768), }, + {AOM_ICDF(1282), AOM_ICDF(1591), AOM_ICDF(4705), AOM_ICDF(5013), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26360), AOM_ICDF(27205), AOM_ICDF(31918), AOM_ICDF(32240), + AOM_ICDF(32768), }, + {AOM_ICDF(18465), AOM_ICDF(19729), AOM_ICDF(30758), AOM_ICDF(31089), + AOM_ICDF(32768), }, + {AOM_ICDF(9488), AOM_ICDF(9915), AOM_ICDF(24339), AOM_ICDF(24678), + AOM_ICDF(32768), }, + {AOM_ICDF(5812), AOM_ICDF(6156), AOM_ICDF(17325), AOM_ICDF(17661), + AOM_ICDF(32768), }, + {AOM_ICDF(3739), AOM_ICDF(4065), AOM_ICDF(10932), AOM_ICDF(11265), + AOM_ICDF(32768), }, + {AOM_ICDF(1391), AOM_ICDF(1700), AOM_ICDF(4764), AOM_ICDF(5073), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27036), AOM_ICDF(28212), AOM_ICDF(31970), AOM_ICDF(32305), + AOM_ICDF(32768), }, + {AOM_ICDF(18634), AOM_ICDF(21073), AOM_ICDF(31116), AOM_ICDF(31477), + AOM_ICDF(32768), }, + {AOM_ICDF(9822), AOM_ICDF(10441), AOM_ICDF(24990), AOM_ICDF(25437), + AOM_ICDF(32768), }, + {AOM_ICDF(6130), AOM_ICDF(6530), AOM_ICDF(17790), AOM_ICDF(18269), + AOM_ICDF(32768), }, + {AOM_ICDF(3725), AOM_ICDF(4044), AOM_ICDF(11127), AOM_ICDF(11602), + AOM_ICDF(32768), }, + {AOM_ICDF(1298), AOM_ICDF(1573), AOM_ICDF(4642), AOM_ICDF(5075), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(23042), AOM_ICDF(23702), AOM_ICDF(30487), AOM_ICDF(31370), + AOM_ICDF(31898), AOM_ICDF(32768), }, + {AOM_ICDF(15512), AOM_ICDF(17357), AOM_ICDF(27018), AOM_ICDF(29404), + AOM_ICDF(30377), AOM_ICDF(32768), }, + {AOM_ICDF(8935), AOM_ICDF(12713), AOM_ICDF(20545), AOM_ICDF(25580), + AOM_ICDF(26931), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(15021), AOM_ICDF(24086), AOM_ICDF(30796), AOM_ICDF(31272), + AOM_ICDF(32768), }, + {AOM_ICDF(13040), AOM_ICDF(21866), AOM_ICDF(30054), AOM_ICDF(30686), + AOM_ICDF(32768), }, + {AOM_ICDF(10915), AOM_ICDF(16852), AOM_ICDF(27467), AOM_ICDF(28235), + AOM_ICDF(32768), }, + {AOM_ICDF(8096), AOM_ICDF(10403), AOM_ICDF(22531), AOM_ICDF(23355), + AOM_ICDF(32768), }, + {AOM_ICDF(4485), AOM_ICDF(5020), AOM_ICDF(13360), AOM_ICDF(13816), + AOM_ICDF(32768), }, + {AOM_ICDF(1728), AOM_ICDF(2067), AOM_ICDF(5998), AOM_ICDF(6337), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20845), AOM_ICDF(25929), AOM_ICDF(31278), AOM_ICDF(31670), + AOM_ICDF(32768), }, + {AOM_ICDF(15553), AOM_ICDF(21602), AOM_ICDF(30338), AOM_ICDF(30745), + AOM_ICDF(32768), }, + {AOM_ICDF(10953), AOM_ICDF(13829), AOM_ICDF(26398), AOM_ICDF(26854), + AOM_ICDF(32768), }, + {AOM_ICDF(7900), AOM_ICDF(8858), AOM_ICDF(20869), AOM_ICDF(21378), + AOM_ICDF(32768), }, + {AOM_ICDF(5225), AOM_ICDF(5579), AOM_ICDF(13764), AOM_ICDF(14087), + AOM_ICDF(32768), }, + {AOM_ICDF(1881), AOM_ICDF(2352), AOM_ICDF(6742), AOM_ICDF(7212), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25402), AOM_ICDF(28169), AOM_ICDF(31825), AOM_ICDF(32169), + AOM_ICDF(32768), }, + {AOM_ICDF(17086), AOM_ICDF(21375), AOM_ICDF(30582), AOM_ICDF(30951), + AOM_ICDF(32768), }, + {AOM_ICDF(11057), AOM_ICDF(12358), AOM_ICDF(25930), AOM_ICDF(26346), + AOM_ICDF(32768), }, + {AOM_ICDF(6989), AOM_ICDF(7448), AOM_ICDF(18814), AOM_ICDF(19143), + AOM_ICDF(32768), }, + {AOM_ICDF(4476), AOM_ICDF(4752), AOM_ICDF(16025), AOM_ICDF(16301), + AOM_ICDF(32768), }, + {AOM_ICDF(2185), AOM_ICDF(4369), AOM_ICDF(12379), AOM_ICDF(14564), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26444), AOM_ICDF(28656), AOM_ICDF(31864), AOM_ICDF(32231), + AOM_ICDF(32768), }, + {AOM_ICDF(17642), AOM_ICDF(20848), AOM_ICDF(30615), AOM_ICDF(30967), + AOM_ICDF(32768), }, + {AOM_ICDF(10973), AOM_ICDF(11732), AOM_ICDF(25256), AOM_ICDF(25612), + AOM_ICDF(32768), }, + {AOM_ICDF(8325), AOM_ICDF(8726), AOM_ICDF(19826), AOM_ICDF(20146), + AOM_ICDF(32768), }, + {AOM_ICDF(5294), AOM_ICDF(5568), AOM_ICDF(14056), AOM_ICDF(14330), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(10923), AOM_ICDF(18204), AOM_ICDF(23666), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27760), AOM_ICDF(29748), AOM_ICDF(31934), AOM_ICDF(32299), + AOM_ICDF(32768), }, + {AOM_ICDF(17133), AOM_ICDF(21599), AOM_ICDF(30800), AOM_ICDF(31243), + AOM_ICDF(32768), }, + {AOM_ICDF(12224), AOM_ICDF(13907), AOM_ICDF(26992), AOM_ICDF(27546), + AOM_ICDF(32768), }, + {AOM_ICDF(9221), AOM_ICDF(9617), AOM_ICDF(21845), AOM_ICDF(22162), + AOM_ICDF(32768), }, + {AOM_ICDF(5401), AOM_ICDF(6482), AOM_ICDF(18004), AOM_ICDF(19085), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(29286), AOM_ICDF(29932), AOM_ICDF(31576), AOM_ICDF(32075), + AOM_ICDF(32408), AOM_ICDF(32768), }, + {AOM_ICDF(17969), AOM_ICDF(21693), AOM_ICDF(28937), AOM_ICDF(30945), + AOM_ICDF(31682), AOM_ICDF(32768), }, + {AOM_ICDF(6607), AOM_ICDF(16160), AOM_ICDF(23280), AOM_ICDF(27595), + AOM_ICDF(30027), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(24724), AOM_ICDF(28333), AOM_ICDF(32022), AOM_ICDF(32346), + AOM_ICDF(32768), }, + {AOM_ICDF(18803), AOM_ICDF(24728), AOM_ICDF(31661), AOM_ICDF(32022), + AOM_ICDF(32768), }, + {AOM_ICDF(14179), AOM_ICDF(20757), AOM_ICDF(30098), AOM_ICDF(30633), + AOM_ICDF(32768), }, + {AOM_ICDF(12564), AOM_ICDF(17179), AOM_ICDF(27133), AOM_ICDF(28080), + AOM_ICDF(32768), }, + {AOM_ICDF(10543), AOM_ICDF(13479), AOM_ICDF(23725), AOM_ICDF(25031), + AOM_ICDF(32768), }, + {AOM_ICDF(11377), AOM_ICDF(12741), AOM_ICDF(21923), AOM_ICDF(22888), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(26071), AOM_ICDF(28609), AOM_ICDF(32053), AOM_ICDF(32374), + AOM_ICDF(32768), }, + {AOM_ICDF(20389), AOM_ICDF(24820), AOM_ICDF(31690), AOM_ICDF(32027), + AOM_ICDF(32768), }, + {AOM_ICDF(12977), AOM_ICDF(16892), AOM_ICDF(29053), AOM_ICDF(29445), + AOM_ICDF(32768), }, + {AOM_ICDF(8745), AOM_ICDF(12303), AOM_ICDF(24164), AOM_ICDF(25209), + AOM_ICDF(32768), }, + {AOM_ICDF(4042), AOM_ICDF(5052), AOM_ICDF(18333), AOM_ICDF(18910), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(9557), AOM_ICDF(13653), AOM_ICDF(17749), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(27936), AOM_ICDF(29582), AOM_ICDF(32107), AOM_ICDF(32422), + AOM_ICDF(32768), }, + {AOM_ICDF(22472), AOM_ICDF(25761), AOM_ICDF(31858), AOM_ICDF(32177), + AOM_ICDF(32768), }, + {AOM_ICDF(14107), AOM_ICDF(16587), AOM_ICDF(29250), AOM_ICDF(29692), + AOM_ICDF(32768), }, + {AOM_ICDF(10726), AOM_ICDF(11739), AOM_ICDF(23985), AOM_ICDF(24576), + AOM_ICDF(32768), }, + {AOM_ICDF(5825), AOM_ICDF(8010), AOM_ICDF(18204), AOM_ICDF(20389), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27066), AOM_ICDF(29025), AOM_ICDF(31972), AOM_ICDF(32338), + AOM_ICDF(32768), }, + {AOM_ICDF(20639), AOM_ICDF(23330), AOM_ICDF(31616), AOM_ICDF(31985), + AOM_ICDF(32768), }, + {AOM_ICDF(13468), AOM_ICDF(15091), AOM_ICDF(29902), AOM_ICDF(30243), + AOM_ICDF(32768), }, + {AOM_ICDF(14473), AOM_ICDF(15019), AOM_ICDF(24030), AOM_ICDF(24439), + AOM_ICDF(32768), }, + {AOM_ICDF(7864), AOM_ICDF(11796), AOM_ICDF(19661), AOM_ICDF(23593), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(28741), AOM_ICDF(30503), AOM_ICDF(32039), AOM_ICDF(32388), + AOM_ICDF(32768), }, + {AOM_ICDF(19712), AOM_ICDF(25328), AOM_ICDF(31621), AOM_ICDF(32049), + AOM_ICDF(32768), }, + {AOM_ICDF(13461), AOM_ICDF(17167), AOM_ICDF(29712), AOM_ICDF(30308), + AOM_ICDF(32768), }, + {AOM_ICDF(10285), AOM_ICDF(11242), AOM_ICDF(27267), AOM_ICDF(28224), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(17246), AOM_ICDF(22420), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 16X16 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(4353), AOM_ICDF(7056), AOM_ICDF(15884), AOM_ICDF(20594), + AOM_ICDF(24026), AOM_ICDF(32768), }, + {AOM_ICDF(2397), AOM_ICDF(5417), AOM_ICDF(9610), AOM_ICDF(14451), + AOM_ICDF(16689), AOM_ICDF(32768), }, + {AOM_ICDF(841), AOM_ICDF(3543), AOM_ICDF(4598), AOM_ICDF(9149), + AOM_ICDF(9950), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(8763), AOM_ICDF(11845), AOM_ICDF(22684), AOM_ICDF(23211), + AOM_ICDF(32768), }, + {AOM_ICDF(8074), AOM_ICDF(12129), AOM_ICDF(22232), AOM_ICDF(22924), + AOM_ICDF(32768), }, + {AOM_ICDF(7453), AOM_ICDF(10017), AOM_ICDF(19822), AOM_ICDF(20662), + AOM_ICDF(32768), }, + {AOM_ICDF(5825), AOM_ICDF(6998), AOM_ICDF(16346), AOM_ICDF(16952), + AOM_ICDF(32768), }, + {AOM_ICDF(4059), AOM_ICDF(4481), AOM_ICDF(11444), AOM_ICDF(11852), + AOM_ICDF(32768), }, + {AOM_ICDF(1973), AOM_ICDF(2289), AOM_ICDF(5827), AOM_ICDF(6149), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(15272), AOM_ICDF(17017), AOM_ICDF(26959), AOM_ICDF(27346), + AOM_ICDF(32768), }, + {AOM_ICDF(12476), AOM_ICDF(14916), AOM_ICDF(26163), AOM_ICDF(26575), + AOM_ICDF(32768), }, + {AOM_ICDF(9485), AOM_ICDF(10720), AOM_ICDF(22557), AOM_ICDF(22973), + AOM_ICDF(32768), }, + {AOM_ICDF(6821), AOM_ICDF(7342), AOM_ICDF(17484), AOM_ICDF(17858), + AOM_ICDF(32768), }, + {AOM_ICDF(4370), AOM_ICDF(4714), AOM_ICDF(12030), AOM_ICDF(12366), + AOM_ICDF(32768), }, + {AOM_ICDF(2375), AOM_ICDF(2688), AOM_ICDF(6850), AOM_ICDF(7162), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19929), AOM_ICDF(21244), AOM_ICDF(29489), AOM_ICDF(29829), + AOM_ICDF(32768), }, + {AOM_ICDF(14005), AOM_ICDF(16066), AOM_ICDF(27595), AOM_ICDF(27947), + AOM_ICDF(32768), }, + {AOM_ICDF(8918), AOM_ICDF(9550), AOM_ICDF(22126), AOM_ICDF(22488), + AOM_ICDF(32768), }, + {AOM_ICDF(5741), AOM_ICDF(6095), AOM_ICDF(16004), AOM_ICDF(16340), + AOM_ICDF(32768), }, + {AOM_ICDF(3558), AOM_ICDF(3873), AOM_ICDF(10340), AOM_ICDF(10657), + AOM_ICDF(32768), }, + {AOM_ICDF(1822), AOM_ICDF(2134), AOM_ICDF(5530), AOM_ICDF(5843), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(23568), AOM_ICDF(24663), AOM_ICDF(30915), AOM_ICDF(31245), + AOM_ICDF(32768), }, + {AOM_ICDF(15139), AOM_ICDF(16577), AOM_ICDF(28661), AOM_ICDF(28997), + AOM_ICDF(32768), }, + {AOM_ICDF(8850), AOM_ICDF(9259), AOM_ICDF(22366), AOM_ICDF(22700), + AOM_ICDF(32768), }, + {AOM_ICDF(5454), AOM_ICDF(5781), AOM_ICDF(15617), AOM_ICDF(15937), + AOM_ICDF(32768), }, + {AOM_ICDF(3315), AOM_ICDF(3629), AOM_ICDF(10044), AOM_ICDF(10359), + AOM_ICDF(32768), }, + {AOM_ICDF(1736), AOM_ICDF(2047), AOM_ICDF(5698), AOM_ICDF(6009), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27011), AOM_ICDF(27875), AOM_ICDF(31721), AOM_ICDF(32046), + AOM_ICDF(32768), }, + {AOM_ICDF(16855), AOM_ICDF(18018), AOM_ICDF(29676), AOM_ICDF(30005), + AOM_ICDF(32768), }, + {AOM_ICDF(8916), AOM_ICDF(9282), AOM_ICDF(22431), AOM_ICDF(22760), + AOM_ICDF(32768), }, + {AOM_ICDF(5391), AOM_ICDF(5710), AOM_ICDF(15343), AOM_ICDF(15662), + AOM_ICDF(32768), }, + {AOM_ICDF(3316), AOM_ICDF(3629), AOM_ICDF(10223), AOM_ICDF(10537), + AOM_ICDF(32768), }, + {AOM_ICDF(1891), AOM_ICDF(2202), AOM_ICDF(6076), AOM_ICDF(6387), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(5744), AOM_ICDF(15508), AOM_ICDF(23294), AOM_ICDF(28653), + AOM_ICDF(30781), AOM_ICDF(32768), }, + {AOM_ICDF(2130), AOM_ICDF(11786), AOM_ICDF(17337), AOM_ICDF(24444), + AOM_ICDF(27499), AOM_ICDF(32768), }, + {AOM_ICDF(615), AOM_ICDF(8230), AOM_ICDF(10191), AOM_ICDF(18291), + AOM_ICDF(21029), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(25149), AOM_ICDF(25880), AOM_ICDF(31110), AOM_ICDF(31453), + AOM_ICDF(32768), }, + {AOM_ICDF(17454), AOM_ICDF(20460), AOM_ICDF(29560), AOM_ICDF(29929), + AOM_ICDF(32768), }, + {AOM_ICDF(11724), AOM_ICDF(14294), AOM_ICDF(25947), AOM_ICDF(26377), + AOM_ICDF(32768), }, + {AOM_ICDF(9198), AOM_ICDF(10981), AOM_ICDF(22357), AOM_ICDF(22857), + AOM_ICDF(32768), }, + {AOM_ICDF(7164), AOM_ICDF(8069), AOM_ICDF(18345), AOM_ICDF(18857), + AOM_ICDF(32768), }, + {AOM_ICDF(5833), AOM_ICDF(6316), AOM_ICDF(14661), AOM_ICDF(15073), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(26117), AOM_ICDF(26928), AOM_ICDF(31526), AOM_ICDF(31850), + AOM_ICDF(32768), }, + {AOM_ICDF(16540), AOM_ICDF(18394), AOM_ICDF(29402), AOM_ICDF(29740), + AOM_ICDF(32768), }, + {AOM_ICDF(9908), AOM_ICDF(10886), AOM_ICDF(23865), AOM_ICDF(24223), + AOM_ICDF(32768), }, + {AOM_ICDF(6805), AOM_ICDF(7383), AOM_ICDF(18402), AOM_ICDF(18777), + AOM_ICDF(32768), }, + {AOM_ICDF(4259), AOM_ICDF(4638), AOM_ICDF(12791), AOM_ICDF(13136), + AOM_ICDF(32768), }, + {AOM_ICDF(2274), AOM_ICDF(2584), AOM_ICDF(7391), AOM_ICDF(7713), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(27129), AOM_ICDF(27797), AOM_ICDF(31745), AOM_ICDF(32063), + AOM_ICDF(32768), }, + {AOM_ICDF(17255), AOM_ICDF(18663), AOM_ICDF(29815), AOM_ICDF(30145), + AOM_ICDF(32768), }, + {AOM_ICDF(9538), AOM_ICDF(10091), AOM_ICDF(23590), AOM_ICDF(23931), + AOM_ICDF(32768), }, + {AOM_ICDF(6366), AOM_ICDF(6732), AOM_ICDF(17467), AOM_ICDF(17800), + AOM_ICDF(32768), }, + {AOM_ICDF(3701), AOM_ICDF(4018), AOM_ICDF(11326), AOM_ICDF(11652), + AOM_ICDF(32768), }, + {AOM_ICDF(1976), AOM_ICDF(2284), AOM_ICDF(6325), AOM_ICDF(6633), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27944), AOM_ICDF(28479), AOM_ICDF(31894), AOM_ICDF(32211), + AOM_ICDF(32768), }, + {AOM_ICDF(18032), AOM_ICDF(18997), AOM_ICDF(30130), AOM_ICDF(30452), + AOM_ICDF(32768), }, + {AOM_ICDF(9467), AOM_ICDF(9842), AOM_ICDF(23729), AOM_ICDF(24051), + AOM_ICDF(32768), }, + {AOM_ICDF(5900), AOM_ICDF(6226), AOM_ICDF(16797), AOM_ICDF(17116), + AOM_ICDF(32768), }, + {AOM_ICDF(3282), AOM_ICDF(3595), AOM_ICDF(10418), AOM_ICDF(10730), + AOM_ICDF(32768), }, + {AOM_ICDF(2289), AOM_ICDF(2601), AOM_ICDF(6048), AOM_ICDF(6360), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29278), AOM_ICDF(29837), AOM_ICDF(32038), AOM_ICDF(32360), + AOM_ICDF(32768), }, + {AOM_ICDF(19805), AOM_ICDF(20846), AOM_ICDF(31007), AOM_ICDF(31343), + AOM_ICDF(32768), }, + {AOM_ICDF(9976), AOM_ICDF(10433), AOM_ICDF(24483), AOM_ICDF(24848), + AOM_ICDF(32768), }, + {AOM_ICDF(5971), AOM_ICDF(6354), AOM_ICDF(17184), AOM_ICDF(17539), + AOM_ICDF(32768), }, + {AOM_ICDF(3497), AOM_ICDF(4693), AOM_ICDF(11940), AOM_ICDF(12291), + AOM_ICDF(32768), }, + {AOM_ICDF(1776), AOM_ICDF(2357), AOM_ICDF(6260), AOM_ICDF(6918), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(23166), AOM_ICDF(23821), AOM_ICDF(30269), AOM_ICDF(31075), + AOM_ICDF(31847), AOM_ICDF(32768), }, + {AOM_ICDF(14510), AOM_ICDF(16494), AOM_ICDF(25635), AOM_ICDF(28335), + AOM_ICDF(29759), AOM_ICDF(32768), }, + {AOM_ICDF(7730), AOM_ICDF(12354), AOM_ICDF(18089), AOM_ICDF(24005), + AOM_ICDF(25442), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17908), AOM_ICDF(24824), AOM_ICDF(30533), AOM_ICDF(31042), + AOM_ICDF(32768), }, + {AOM_ICDF(13950), AOM_ICDF(22899), AOM_ICDF(29969), AOM_ICDF(30646), + AOM_ICDF(32768), }, + {AOM_ICDF(11728), AOM_ICDF(17834), AOM_ICDF(27214), AOM_ICDF(28218), + AOM_ICDF(32768), }, + {AOM_ICDF(9581), AOM_ICDF(12074), AOM_ICDF(23689), AOM_ICDF(24616), + AOM_ICDF(32768), }, + {AOM_ICDF(6193), AOM_ICDF(6855), AOM_ICDF(16430), AOM_ICDF(16955), + AOM_ICDF(32768), }, + {AOM_ICDF(3393), AOM_ICDF(3712), AOM_ICDF(8802), AOM_ICDF(9226), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23368), AOM_ICDF(26826), AOM_ICDF(31183), AOM_ICDF(31579), + AOM_ICDF(32768), }, + {AOM_ICDF(16523), AOM_ICDF(21603), AOM_ICDF(30044), AOM_ICDF(30503), + AOM_ICDF(32768), }, + {AOM_ICDF(11171), AOM_ICDF(14152), AOM_ICDF(27009), AOM_ICDF(27644), + AOM_ICDF(32768), }, + {AOM_ICDF(8523), AOM_ICDF(9348), AOM_ICDF(21021), AOM_ICDF(21595), + AOM_ICDF(32768), }, + {AOM_ICDF(4780), AOM_ICDF(5196), AOM_ICDF(13440), AOM_ICDF(13786), + AOM_ICDF(32768), }, + {AOM_ICDF(4328), AOM_ICDF(5255), AOM_ICDF(10820), AOM_ICDF(11747), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(27020), AOM_ICDF(28644), AOM_ICDF(31643), AOM_ICDF(31990), + AOM_ICDF(32768), }, + {AOM_ICDF(18016), AOM_ICDF(21678), AOM_ICDF(30346), AOM_ICDF(30712), + AOM_ICDF(32768), }, + {AOM_ICDF(10497), AOM_ICDF(11555), AOM_ICDF(24827), AOM_ICDF(25156), + AOM_ICDF(32768), }, + {AOM_ICDF(6370), AOM_ICDF(6703), AOM_ICDF(18612), AOM_ICDF(18903), + AOM_ICDF(32768), }, + {AOM_ICDF(5355), AOM_ICDF(5738), AOM_ICDF(14790), AOM_ICDF(15173), + AOM_ICDF(32768), }, + {AOM_ICDF(3486), AOM_ICDF(5578), AOM_ICDF(11155), AOM_ICDF(13247), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28933), AOM_ICDF(29746), AOM_ICDF(31882), AOM_ICDF(32203), + AOM_ICDF(32768), }, + {AOM_ICDF(18171), AOM_ICDF(20286), AOM_ICDF(29713), AOM_ICDF(30052), + AOM_ICDF(32768), }, + {AOM_ICDF(9732), AOM_ICDF(10163), AOM_ICDF(23952), AOM_ICDF(24275), + AOM_ICDF(32768), }, + {AOM_ICDF(6084), AOM_ICDF(6480), AOM_ICDF(17459), AOM_ICDF(17771), + AOM_ICDF(32768), }, + {AOM_ICDF(3250), AOM_ICDF(3656), AOM_ICDF(10291), AOM_ICDF(10697), + AOM_ICDF(32768), }, + {AOM_ICDF(4681), AOM_ICDF(8192), AOM_ICDF(15214), AOM_ICDF(18725), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29940), AOM_ICDF(30510), AOM_ICDF(31933), AOM_ICDF(32260), + AOM_ICDF(32768), }, + {AOM_ICDF(17688), AOM_ICDF(19258), AOM_ICDF(29757), AOM_ICDF(30125), + AOM_ICDF(32768), }, + {AOM_ICDF(9668), AOM_ICDF(10798), AOM_ICDF(24231), AOM_ICDF(24605), + AOM_ICDF(32768), }, + {AOM_ICDF(7580), AOM_ICDF(7942), AOM_ICDF(19364), AOM_ICDF(19692), + AOM_ICDF(32768), }, + {AOM_ICDF(6043), AOM_ICDF(6446), AOM_ICDF(15578), AOM_ICDF(15981), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(28553), AOM_ICDF(29151), AOM_ICDF(31521), AOM_ICDF(32038), + AOM_ICDF(32413), AOM_ICDF(32768), }, + {AOM_ICDF(15138), AOM_ICDF(19554), AOM_ICDF(27559), AOM_ICDF(29750), + AOM_ICDF(31321), AOM_ICDF(32768), }, + {AOM_ICDF(3406), AOM_ICDF(18680), AOM_ICDF(23310), AOM_ICDF(27259), + AOM_ICDF(30430), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(29000), AOM_ICDF(30219), AOM_ICDF(32098), AOM_ICDF(32414), + AOM_ICDF(32768), }, + {AOM_ICDF(21324), AOM_ICDF(25278), AOM_ICDF(31789), AOM_ICDF(32126), + AOM_ICDF(32768), }, + {AOM_ICDF(14011), AOM_ICDF(21190), AOM_ICDF(30288), AOM_ICDF(30900), + AOM_ICDF(32768), }, + {AOM_ICDF(12762), AOM_ICDF(18476), AOM_ICDF(27140), AOM_ICDF(28461), + AOM_ICDF(32768), }, + {AOM_ICDF(11498), AOM_ICDF(14867), AOM_ICDF(24806), AOM_ICDF(25613), + AOM_ICDF(32768), }, + {AOM_ICDF(15872), AOM_ICDF(16512), AOM_ICDF(24192), AOM_ICDF(25088), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(29308), AOM_ICDF(30286), AOM_ICDF(32095), AOM_ICDF(32410), + AOM_ICDF(32768), }, + {AOM_ICDF(21819), AOM_ICDF(24215), AOM_ICDF(31771), AOM_ICDF(32103), + AOM_ICDF(32768), }, + {AOM_ICDF(14853), AOM_ICDF(18028), AOM_ICDF(29729), AOM_ICDF(30160), + AOM_ICDF(32768), }, + {AOM_ICDF(10598), AOM_ICDF(13400), AOM_ICDF(26555), AOM_ICDF(27043), + AOM_ICDF(32768), }, + {AOM_ICDF(10426), AOM_ICDF(12660), AOM_ICDF(21597), AOM_ICDF(23831), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(29866), AOM_ICDF(30588), AOM_ICDF(32131), AOM_ICDF(32445), + AOM_ICDF(32768), }, + {AOM_ICDF(23473), AOM_ICDF(25323), AOM_ICDF(31960), AOM_ICDF(32280), + AOM_ICDF(32768), }, + {AOM_ICDF(17529), AOM_ICDF(19173), AOM_ICDF(30278), AOM_ICDF(30577), + AOM_ICDF(32768), }, + {AOM_ICDF(9830), AOM_ICDF(11469), AOM_ICDF(23484), AOM_ICDF(25122), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(30405), AOM_ICDF(31032), AOM_ICDF(32139), AOM_ICDF(32451), + AOM_ICDF(32768), }, + {AOM_ICDF(25453), AOM_ICDF(27199), AOM_ICDF(32040), AOM_ICDF(32361), + AOM_ICDF(32768), }, + {AOM_ICDF(15663), AOM_ICDF(16432), AOM_ICDF(30654), AOM_ICDF(31038), + AOM_ICDF(32768), }, + {AOM_ICDF(6780), AOM_ICDF(10169), AOM_ICDF(18079), AOM_ICDF(21469), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29785), AOM_ICDF(30368), AOM_ICDF(31904), AOM_ICDF(32245), + AOM_ICDF(32768), }, + {AOM_ICDF(18173), AOM_ICDF(21111), AOM_ICDF(30105), AOM_ICDF(30575), + AOM_ICDF(32768), }, + {AOM_ICDF(8476), AOM_ICDF(13666), AOM_ICDF(28420), AOM_ICDF(28896), + AOM_ICDF(32768), }, + {AOM_ICDF(11427), AOM_ICDF(12066), AOM_ICDF(26197), AOM_ICDF(26691), + AOM_ICDF(32768), }, + {AOM_ICDF(6827), AOM_ICDF(10923), AOM_ICDF(21845), AOM_ICDF(25941), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 32X32 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(7848), AOM_ICDF(9841), AOM_ICDF(13623), AOM_ICDF(19351), + AOM_ICDF(23196), AOM_ICDF(32768), }, + {AOM_ICDF(3229), AOM_ICDF(5641), AOM_ICDF(7103), AOM_ICDF(13195), + AOM_ICDF(15046), AOM_ICDF(32768), }, + {AOM_ICDF(810), AOM_ICDF(3129), AOM_ICDF(3687), AOM_ICDF(8373), + AOM_ICDF(8971), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(8165), AOM_ICDF(12626), AOM_ICDF(22213), AOM_ICDF(23403), + AOM_ICDF(32768), }, + {AOM_ICDF(7602), AOM_ICDF(15378), AOM_ICDF(23248), AOM_ICDF(24331), + AOM_ICDF(32768), }, + {AOM_ICDF(5607), AOM_ICDF(10197), AOM_ICDF(18657), AOM_ICDF(20616), + AOM_ICDF(32768), }, + {AOM_ICDF(4498), AOM_ICDF(6539), AOM_ICDF(14461), AOM_ICDF(16104), + AOM_ICDF(32768), }, + {AOM_ICDF(3387), AOM_ICDF(4098), AOM_ICDF(10245), AOM_ICDF(11322), + AOM_ICDF(32768), }, + {AOM_ICDF(1793), AOM_ICDF(2111), AOM_ICDF(5262), AOM_ICDF(5646), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(16815), AOM_ICDF(19141), AOM_ICDF(27640), AOM_ICDF(28110), + AOM_ICDF(32768), }, + {AOM_ICDF(13156), AOM_ICDF(15592), AOM_ICDF(26089), AOM_ICDF(26592), + AOM_ICDF(32768), }, + {AOM_ICDF(9841), AOM_ICDF(11588), AOM_ICDF(22858), AOM_ICDF(23403), + AOM_ICDF(32768), }, + {AOM_ICDF(7765), AOM_ICDF(8871), AOM_ICDF(19127), AOM_ICDF(19526), + AOM_ICDF(32768), }, + {AOM_ICDF(5550), AOM_ICDF(6013), AOM_ICDF(14338), AOM_ICDF(14677), + AOM_ICDF(32768), }, + {AOM_ICDF(2658), AOM_ICDF(2969), AOM_ICDF(7230), AOM_ICDF(7541), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22765), AOM_ICDF(24278), AOM_ICDF(30194), AOM_ICDF(30535), + AOM_ICDF(32768), }, + {AOM_ICDF(15310), AOM_ICDF(17292), AOM_ICDF(27870), AOM_ICDF(28248), + AOM_ICDF(32768), }, + {AOM_ICDF(10047), AOM_ICDF(10839), AOM_ICDF(23345), AOM_ICDF(23710), + AOM_ICDF(32768), }, + {AOM_ICDF(6594), AOM_ICDF(6959), AOM_ICDF(17456), AOM_ICDF(17796), + AOM_ICDF(32768), }, + {AOM_ICDF(3784), AOM_ICDF(4109), AOM_ICDF(10984), AOM_ICDF(11297), + AOM_ICDF(32768), }, + {AOM_ICDF(1569), AOM_ICDF(1875), AOM_ICDF(4586), AOM_ICDF(4892), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25747), AOM_ICDF(26817), AOM_ICDF(31236), AOM_ICDF(31577), + AOM_ICDF(32768), }, + {AOM_ICDF(16018), AOM_ICDF(17720), AOM_ICDF(28833), AOM_ICDF(29219), + AOM_ICDF(32768), }, + {AOM_ICDF(9348), AOM_ICDF(10015), AOM_ICDF(22943), AOM_ICDF(23323), + AOM_ICDF(32768), }, + {AOM_ICDF(5841), AOM_ICDF(6167), AOM_ICDF(15774), AOM_ICDF(16107), + AOM_ICDF(32768), }, + {AOM_ICDF(3385), AOM_ICDF(3703), AOM_ICDF(9664), AOM_ICDF(9975), + AOM_ICDF(32768), }, + {AOM_ICDF(1460), AOM_ICDF(1768), AOM_ICDF(4704), AOM_ICDF(5011), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29634), AOM_ICDF(30134), AOM_ICDF(31898), AOM_ICDF(32218), + AOM_ICDF(32768), }, + {AOM_ICDF(16976), AOM_ICDF(17856), AOM_ICDF(29258), AOM_ICDF(29584), + AOM_ICDF(32768), }, + {AOM_ICDF(8521), AOM_ICDF(8858), AOM_ICDF(21252), AOM_ICDF(21574), + AOM_ICDF(32768), }, + {AOM_ICDF(4894), AOM_ICDF(5208), AOM_ICDF(13957), AOM_ICDF(14271), + AOM_ICDF(32768), }, + {AOM_ICDF(3140), AOM_ICDF(3452), AOM_ICDF(9099), AOM_ICDF(9411), + AOM_ICDF(32768), }, + {AOM_ICDF(1770), AOM_ICDF(2080), AOM_ICDF(5241), AOM_ICDF(5551), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(22253), AOM_ICDF(23279), AOM_ICDF(24319), AOM_ICDF(27691), + AOM_ICDF(30884), AOM_ICDF(32768), }, + {AOM_ICDF(6281), AOM_ICDF(8348), AOM_ICDF(9473), AOM_ICDF(15740), + AOM_ICDF(24879), AOM_ICDF(32768), }, + {AOM_ICDF(1265), AOM_ICDF(3893), AOM_ICDF(4482), AOM_ICDF(9694), + AOM_ICDF(18376), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17243), AOM_ICDF(18993), AOM_ICDF(28515), AOM_ICDF(29242), + AOM_ICDF(32768), }, + {AOM_ICDF(15645), AOM_ICDF(23632), AOM_ICDF(29905), AOM_ICDF(30416), + AOM_ICDF(32768), }, + {AOM_ICDF(11203), AOM_ICDF(18441), AOM_ICDF(27037), AOM_ICDF(27930), + AOM_ICDF(32768), }, + {AOM_ICDF(9306), AOM_ICDF(13788), AOM_ICDF(23647), AOM_ICDF(24669), + AOM_ICDF(32768), }, + {AOM_ICDF(8076), AOM_ICDF(10237), AOM_ICDF(20500), AOM_ICDF(21437), + AOM_ICDF(32768), }, + {AOM_ICDF(7214), AOM_ICDF(8133), AOM_ICDF(17608), AOM_ICDF(18202), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23555), AOM_ICDF(26147), AOM_ICDF(31229), AOM_ICDF(31581), + AOM_ICDF(32768), }, + {AOM_ICDF(16046), AOM_ICDF(20455), AOM_ICDF(29711), AOM_ICDF(30107), + AOM_ICDF(32768), }, + {AOM_ICDF(10810), AOM_ICDF(14014), AOM_ICDF(25967), AOM_ICDF(26499), + AOM_ICDF(32768), }, + {AOM_ICDF(8267), AOM_ICDF(9930), AOM_ICDF(21704), AOM_ICDF(22244), + AOM_ICDF(32768), }, + {AOM_ICDF(5637), AOM_ICDF(6282), AOM_ICDF(15954), AOM_ICDF(16508), + AOM_ICDF(32768), }, + {AOM_ICDF(4090), AOM_ICDF(4363), AOM_ICDF(11771), AOM_ICDF(12044), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26146), AOM_ICDF(27425), AOM_ICDF(31658), AOM_ICDF(31983), + AOM_ICDF(32768), }, + {AOM_ICDF(17486), AOM_ICDF(20295), AOM_ICDF(30279), AOM_ICDF(30621), + AOM_ICDF(32768), }, + {AOM_ICDF(10812), AOM_ICDF(12230), AOM_ICDF(26095), AOM_ICDF(26460), + AOM_ICDF(32768), }, + {AOM_ICDF(7510), AOM_ICDF(8042), AOM_ICDF(21058), AOM_ICDF(21425), + AOM_ICDF(32768), }, + {AOM_ICDF(4566), AOM_ICDF(4916), AOM_ICDF(13594), AOM_ICDF(13891), + AOM_ICDF(32768), }, + {AOM_ICDF(1956), AOM_ICDF(2445), AOM_ICDF(5380), AOM_ICDF(5869), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28423), AOM_ICDF(29253), AOM_ICDF(31959), AOM_ICDF(32277), + AOM_ICDF(32768), }, + {AOM_ICDF(18711), AOM_ICDF(20638), AOM_ICDF(30445), AOM_ICDF(30777), + AOM_ICDF(32768), }, + {AOM_ICDF(10301), AOM_ICDF(10903), AOM_ICDF(24702), AOM_ICDF(25060), + AOM_ICDF(32768), }, + {AOM_ICDF(6531), AOM_ICDF(6885), AOM_ICDF(18215), AOM_ICDF(18535), + AOM_ICDF(32768), }, + {AOM_ICDF(3965), AOM_ICDF(4265), AOM_ICDF(11701), AOM_ICDF(12023), + AOM_ICDF(32768), }, + {AOM_ICDF(3255), AOM_ICDF(3906), AOM_ICDF(8897), AOM_ICDF(9548), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29905), AOM_ICDF(30382), AOM_ICDF(32053), AOM_ICDF(32369), + AOM_ICDF(32768), }, + {AOM_ICDF(19724), AOM_ICDF(20376), AOM_ICDF(30778), AOM_ICDF(31101), + AOM_ICDF(32768), }, + {AOM_ICDF(10430), AOM_ICDF(10786), AOM_ICDF(24620), AOM_ICDF(24943), + AOM_ICDF(32768), }, + {AOM_ICDF(6151), AOM_ICDF(6475), AOM_ICDF(17188), AOM_ICDF(17504), + AOM_ICDF(32768), }, + {AOM_ICDF(3728), AOM_ICDF(4034), AOM_ICDF(11352), AOM_ICDF(11658), + AOM_ICDF(32768), }, + {AOM_ICDF(1456), AOM_ICDF(1748), AOM_ICDF(5024), AOM_ICDF(5316), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(24883), AOM_ICDF(25616), AOM_ICDF(27995), AOM_ICDF(29251), + AOM_ICDF(31055), AOM_ICDF(32768), }, + {AOM_ICDF(9802), AOM_ICDF(11841), AOM_ICDF(18691), AOM_ICDF(22179), + AOM_ICDF(26383), AOM_ICDF(32768), }, + {AOM_ICDF(4096), AOM_ICDF(7928), AOM_ICDF(14072), AOM_ICDF(21042), + AOM_ICDF(23453), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(10363), AOM_ICDF(20924), AOM_ICDF(29116), AOM_ICDF(29906), + AOM_ICDF(32768), }, + {AOM_ICDF(10682), AOM_ICDF(22326), AOM_ICDF(29093), AOM_ICDF(29642), + AOM_ICDF(32768), }, + {AOM_ICDF(10304), AOM_ICDF(21073), AOM_ICDF(26843), AOM_ICDF(28904), + AOM_ICDF(32768), }, + {AOM_ICDF(6138), AOM_ICDF(13221), AOM_ICDF(22475), AOM_ICDF(25119), + AOM_ICDF(32768), }, + {AOM_ICDF(3788), AOM_ICDF(4356), AOM_ICDF(10607), AOM_ICDF(12690), + AOM_ICDF(32768), }, + {AOM_ICDF(1950), AOM_ICDF(4291), AOM_ICDF(10923), AOM_ICDF(12873), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21958), AOM_ICDF(27093), AOM_ICDF(30741), AOM_ICDF(31349), + AOM_ICDF(32768), }, + {AOM_ICDF(18725), AOM_ICDF(23406), AOM_ICDF(30541), AOM_ICDF(31268), + AOM_ICDF(32768), }, + {AOM_ICDF(15634), AOM_ICDF(17134), AOM_ICDF(26450), AOM_ICDF(27092), + AOM_ICDF(32768), }, + {AOM_ICDF(10012), AOM_ICDF(11287), AOM_ICDF(24758), AOM_ICDF(25304), + AOM_ICDF(32768), }, + {AOM_ICDF(6242), AOM_ICDF(7802), AOM_ICDF(19895), AOM_ICDF(21065), + AOM_ICDF(32768), }, + {AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(20480), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26587), AOM_ICDF(27934), AOM_ICDF(31817), AOM_ICDF(32094), + AOM_ICDF(32768), }, + {AOM_ICDF(20234), AOM_ICDF(22651), AOM_ICDF(30576), AOM_ICDF(30857), + AOM_ICDF(32768), }, + {AOM_ICDF(13405), AOM_ICDF(14708), AOM_ICDF(26624), AOM_ICDF(27183), + AOM_ICDF(32768), }, + {AOM_ICDF(9132), AOM_ICDF(11281), AOM_ICDF(19876), AOM_ICDF(21487), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(15522), AOM_ICDF(20696), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(19275), AOM_ICDF(25058), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28277), AOM_ICDF(29312), AOM_ICDF(32101), AOM_ICDF(32400), + AOM_ICDF(32768), }, + {AOM_ICDF(18946), AOM_ICDF(23037), AOM_ICDF(31186), AOM_ICDF(31565), + AOM_ICDF(32768), }, + {AOM_ICDF(14043), AOM_ICDF(14980), AOM_ICDF(29491), AOM_ICDF(30193), + AOM_ICDF(32768), }, + {AOM_ICDF(9638), AOM_ICDF(12529), AOM_ICDF(21203), AOM_ICDF(24094), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(11469), AOM_ICDF(18022), AOM_ICDF(22938), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(31039), AOM_ICDF(31404), AOM_ICDF(32048), AOM_ICDF(32372), + AOM_ICDF(32768), }, + {AOM_ICDF(20567), AOM_ICDF(21869), AOM_ICDF(28724), AOM_ICDF(29256), + AOM_ICDF(32768), }, + {AOM_ICDF(10000), AOM_ICDF(11250), AOM_ICDF(22768), AOM_ICDF(23393), + AOM_ICDF(32768), }, + {AOM_ICDF(6291), AOM_ICDF(7078), AOM_ICDF(20447), AOM_ICDF(21234), + AOM_ICDF(32768), }, + {AOM_ICDF(3072), AOM_ICDF(6144), AOM_ICDF(18432), AOM_ICDF(21504), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(23448), AOM_ICDF(25882), AOM_ICDF(29692), AOM_ICDF(31272), + AOM_ICDF(32065), AOM_ICDF(32768), }, + {AOM_ICDF(4276), AOM_ICDF(17832), AOM_ICDF(22156), AOM_ICDF(28463), + AOM_ICDF(30374), AOM_ICDF(32768), }, + {AOM_ICDF(842), AOM_ICDF(20937), AOM_ICDF(22447), AOM_ICDF(28559), + AOM_ICDF(30333), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(30469), AOM_ICDF(30991), AOM_ICDF(32114), AOM_ICDF(32435), + AOM_ICDF(32768), }, + {AOM_ICDF(27295), AOM_ICDF(29153), AOM_ICDF(31917), AOM_ICDF(32269), + AOM_ICDF(32768), }, + {AOM_ICDF(16309), AOM_ICDF(22060), AOM_ICDF(29937), AOM_ICDF(30686), + AOM_ICDF(32768), }, + {AOM_ICDF(11440), AOM_ICDF(16853), AOM_ICDF(26633), AOM_ICDF(27427), + AOM_ICDF(32768), }, + {AOM_ICDF(13069), AOM_ICDF(15405), AOM_ICDF(27401), AOM_ICDF(28033), + AOM_ICDF(32768), }, + {AOM_ICDF(9084), AOM_ICDF(10058), AOM_ICDF(23197), AOM_ICDF(23684), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(30728), AOM_ICDF(31202), AOM_ICDF(32138), AOM_ICDF(32450), + AOM_ICDF(32768), }, + {AOM_ICDF(23421), AOM_ICDF(26186), AOM_ICDF(31939), AOM_ICDF(32278), + AOM_ICDF(32768), }, + {AOM_ICDF(12249), AOM_ICDF(15027), AOM_ICDF(28348), AOM_ICDF(28854), + AOM_ICDF(32768), }, + {AOM_ICDF(5667), AOM_ICDF(6899), AOM_ICDF(22174), AOM_ICDF(23652), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(10650), AOM_ICDF(17203), AOM_ICDF(20480), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(30721), AOM_ICDF(31093), AOM_ICDF(32141), AOM_ICDF(32453), + AOM_ICDF(32768), }, + {AOM_ICDF(24052), AOM_ICDF(25175), AOM_ICDF(31923), AOM_ICDF(32231), + AOM_ICDF(32768), }, + {AOM_ICDF(8145), AOM_ICDF(9281), AOM_ICDF(27654), AOM_ICDF(28412), + AOM_ICDF(32768), }, + {AOM_ICDF(7373), AOM_ICDF(9830), AOM_ICDF(21299), AOM_ICDF(23757), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(31284), AOM_ICDF(31621), AOM_ICDF(32143), AOM_ICDF(32455), + AOM_ICDF(32768), }, + {AOM_ICDF(27783), AOM_ICDF(28563), AOM_ICDF(32045), AOM_ICDF(32361), + AOM_ICDF(32768), }, + {AOM_ICDF(10149), AOM_ICDF(12179), AOM_ICDF(28128), AOM_ICDF(28998), + AOM_ICDF(32768), }, + {AOM_ICDF(5650), AOM_ICDF(9039), AOM_ICDF(19209), AOM_ICDF(22599), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(31038), AOM_ICDF(31383), AOM_ICDF(32035), AOM_ICDF(32357), + AOM_ICDF(32768), }, + {AOM_ICDF(20689), AOM_ICDF(22001), AOM_ICDF(28880), AOM_ICDF(29479), + AOM_ICDF(32768), }, + {AOM_ICDF(7827), AOM_ICDF(10613), AOM_ICDF(24141), AOM_ICDF(24735), + AOM_ICDF(32768), }, + {AOM_ICDF(8021), AOM_ICDF(8585), AOM_ICDF(22014), AOM_ICDF(22383), + AOM_ICDF(32768), }, + {AOM_ICDF(6047), AOM_ICDF(6350), AOM_ICDF(19918), AOM_ICDF(20220), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, +}; + +static const coeff_cdf_model +av1_default_coef_head_cdfs_q2[TX_SIZES][PLANE_TYPES] = { + { // TX 4X4 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(23035), AOM_ICDF(23799), AOM_ICDF(27745), AOM_ICDF(29607), + AOM_ICDF(30130), AOM_ICDF(32768), }, + {AOM_ICDF(12409), AOM_ICDF(14763), AOM_ICDF(22883), AOM_ICDF(26775), + AOM_ICDF(27649), AOM_ICDF(32768), }, + {AOM_ICDF(5237), AOM_ICDF(9433), AOM_ICDF(15597), AOM_ICDF(21779), + AOM_ICDF(23224), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(10424), AOM_ICDF(17678), AOM_ICDF(28850), AOM_ICDF(29349), + AOM_ICDF(32768), }, + {AOM_ICDF(10376), AOM_ICDF(16902), AOM_ICDF(28779), AOM_ICDF(29265), + AOM_ICDF(32768), }, + {AOM_ICDF(10166), AOM_ICDF(14387), AOM_ICDF(26253), AOM_ICDF(26807), + AOM_ICDF(32768), }, + {AOM_ICDF(8474), AOM_ICDF(9927), AOM_ICDF(22092), AOM_ICDF(22697), + AOM_ICDF(32768), }, + {AOM_ICDF(6415), AOM_ICDF(6911), AOM_ICDF(17155), AOM_ICDF(17579), + AOM_ICDF(32768), }, + {AOM_ICDF(4611), AOM_ICDF(4928), AOM_ICDF(12174), AOM_ICDF(12497), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(16984), AOM_ICDF(21802), AOM_ICDF(30901), AOM_ICDF(31373), + AOM_ICDF(32768), }, + {AOM_ICDF(14003), AOM_ICDF(19369), AOM_ICDF(30193), AOM_ICDF(30615), + AOM_ICDF(32768), }, + {AOM_ICDF(10729), AOM_ICDF(13233), AOM_ICDF(26938), AOM_ICDF(27455), + AOM_ICDF(32768), }, + {AOM_ICDF(8604), AOM_ICDF(9526), AOM_ICDF(22436), AOM_ICDF(22989), + AOM_ICDF(32768), }, + {AOM_ICDF(6828), AOM_ICDF(7236), AOM_ICDF(18056), AOM_ICDF(18456), + AOM_ICDF(32768), }, + {AOM_ICDF(4302), AOM_ICDF(4555), AOM_ICDF(12209), AOM_ICDF(12462), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(20261), AOM_ICDF(24381), AOM_ICDF(31612), AOM_ICDF(31989), + AOM_ICDF(32768), }, + {AOM_ICDF(13775), AOM_ICDF(20449), AOM_ICDF(30685), AOM_ICDF(31111), + AOM_ICDF(32768), }, + {AOM_ICDF(10459), AOM_ICDF(13768), AOM_ICDF(27504), AOM_ICDF(28114), + AOM_ICDF(32768), }, + {AOM_ICDF(7994), AOM_ICDF(8989), AOM_ICDF(22906), AOM_ICDF(23636), + AOM_ICDF(32768), }, + {AOM_ICDF(5928), AOM_ICDF(6460), AOM_ICDF(16884), AOM_ICDF(17720), + AOM_ICDF(32768), }, + {AOM_ICDF(4520), AOM_ICDF(7910), AOM_ICDF(12429), AOM_ICDF(16949), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(17822), AOM_ICDF(26021), AOM_ICDF(31751), AOM_ICDF(32150), + AOM_ICDF(32768), }, + {AOM_ICDF(13484), AOM_ICDF(23372), AOM_ICDF(31305), AOM_ICDF(31747), + AOM_ICDF(32768), }, + {AOM_ICDF(11009), AOM_ICDF(15469), AOM_ICDF(28452), AOM_ICDF(29132), + AOM_ICDF(32768), }, + {AOM_ICDF(8358), AOM_ICDF(9357), AOM_ICDF(22412), AOM_ICDF(23385), + AOM_ICDF(32768), }, + {AOM_ICDF(9392), AOM_ICDF(10018), AOM_ICDF(18158), AOM_ICDF(19202), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(5236), AOM_ICDF(26529), AOM_ICDF(31709), AOM_ICDF(32201), + AOM_ICDF(32768), }, + {AOM_ICDF(5710), AOM_ICDF(25925), AOM_ICDF(31254), AOM_ICDF(31967), + AOM_ICDF(32768), }, + {AOM_ICDF(7645), AOM_ICDF(19427), AOM_ICDF(28170), AOM_ICDF(29920), + AOM_ICDF(32768), }, + {AOM_ICDF(7427), AOM_ICDF(13350), AOM_ICDF(23253), AOM_ICDF(25438), + AOM_ICDF(32768), }, + {AOM_ICDF(4681), AOM_ICDF(6687), AOM_ICDF(15381), AOM_ICDF(18725), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(11176), AOM_ICDF(18297), AOM_ICDF(19062), AOM_ICDF(28984), + AOM_ICDF(29496), AOM_ICDF(32768), }, + {AOM_ICDF(9778), AOM_ICDF(17798), AOM_ICDF(19934), AOM_ICDF(28434), + AOM_ICDF(28921), AOM_ICDF(32768), }, + {AOM_ICDF(4806), AOM_ICDF(14260), AOM_ICDF(17259), AOM_ICDF(26368), + AOM_ICDF(26942), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(21802), AOM_ICDF(22916), AOM_ICDF(31657), AOM_ICDF(31989), + AOM_ICDF(32768), }, + {AOM_ICDF(16874), AOM_ICDF(20345), AOM_ICDF(31048), AOM_ICDF(31389), + AOM_ICDF(32768), }, + {AOM_ICDF(10717), AOM_ICDF(12576), AOM_ICDF(26899), AOM_ICDF(27294), + AOM_ICDF(32768), }, + {AOM_ICDF(8468), AOM_ICDF(9404), AOM_ICDF(21928), AOM_ICDF(22358), + AOM_ICDF(32768), }, + {AOM_ICDF(5992), AOM_ICDF(6521), AOM_ICDF(16309), AOM_ICDF(16729), + AOM_ICDF(32768), }, + {AOM_ICDF(5134), AOM_ICDF(5452), AOM_ICDF(11491), AOM_ICDF(11865), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22003), AOM_ICDF(24147), AOM_ICDF(31841), AOM_ICDF(32177), + AOM_ICDF(32768), }, + {AOM_ICDF(17179), AOM_ICDF(20593), AOM_ICDF(31041), AOM_ICDF(31394), + AOM_ICDF(32768), }, + {AOM_ICDF(9282), AOM_ICDF(10544), AOM_ICDF(25698), AOM_ICDF(26133), + AOM_ICDF(32768), }, + {AOM_ICDF(6301), AOM_ICDF(7013), AOM_ICDF(19066), AOM_ICDF(19557), + AOM_ICDF(32768), }, + {AOM_ICDF(3845), AOM_ICDF(4316), AOM_ICDF(12209), AOM_ICDF(12812), + AOM_ICDF(32768), }, + {AOM_ICDF(4819), AOM_ICDF(6746), AOM_ICDF(11565), AOM_ICDF(13011), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22820), AOM_ICDF(26023), AOM_ICDF(31888), AOM_ICDF(32236), + AOM_ICDF(32768), }, + {AOM_ICDF(17130), AOM_ICDF(21510), AOM_ICDF(31268), AOM_ICDF(31632), + AOM_ICDF(32768), }, + {AOM_ICDF(10062), AOM_ICDF(11898), AOM_ICDF(26787), AOM_ICDF(27281), + AOM_ICDF(32768), }, + {AOM_ICDF(7681), AOM_ICDF(8590), AOM_ICDF(21264), AOM_ICDF(22034), + AOM_ICDF(32768), }, + {AOM_ICDF(4413), AOM_ICDF(5143), AOM_ICDF(13605), AOM_ICDF(14712), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(10923), AOM_ICDF(16384), AOM_ICDF(21845), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(20237), AOM_ICDF(25695), AOM_ICDF(31868), AOM_ICDF(32222), + AOM_ICDF(32768), }, + {AOM_ICDF(15551), AOM_ICDF(22658), AOM_ICDF(31236), AOM_ICDF(31659), + AOM_ICDF(32768), }, + {AOM_ICDF(9584), AOM_ICDF(12389), AOM_ICDF(26347), AOM_ICDF(27242), + AOM_ICDF(32768), }, + {AOM_ICDF(6067), AOM_ICDF(7231), AOM_ICDF(19625), AOM_ICDF(20707), + AOM_ICDF(32768), }, + {AOM_ICDF(3724), AOM_ICDF(4312), AOM_ICDF(11269), AOM_ICDF(12425), + AOM_ICDF(32768), }, + {AOM_ICDF(4096), AOM_ICDF(6554), AOM_ICDF(9830), AOM_ICDF(12288), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(11726), AOM_ICDF(26639), AOM_ICDF(31977), AOM_ICDF(32340), + AOM_ICDF(32768), }, + {AOM_ICDF(10754), AOM_ICDF(25823), AOM_ICDF(31568), AOM_ICDF(32060), + AOM_ICDF(32768), }, + {AOM_ICDF(8761), AOM_ICDF(16650), AOM_ICDF(27884), AOM_ICDF(29394), + AOM_ICDF(32768), }, + {AOM_ICDF(7387), AOM_ICDF(9941), AOM_ICDF(21377), AOM_ICDF(23333), + AOM_ICDF(32768), }, + {AOM_ICDF(2374), AOM_ICDF(3799), AOM_ICDF(16147), AOM_ICDF(19471), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(29271), AOM_ICDF(29645), AOM_ICDF(31447), AOM_ICDF(31951), + AOM_ICDF(32313), AOM_ICDF(32768), }, + {AOM_ICDF(22174), AOM_ICDF(23288), AOM_ICDF(29633), AOM_ICDF(31096), + AOM_ICDF(31701), AOM_ICDF(32768), }, + {AOM_ICDF(13601), AOM_ICDF(16603), AOM_ICDF(25296), AOM_ICDF(28966), + AOM_ICDF(30043), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(13850), AOM_ICDF(26266), AOM_ICDF(31653), AOM_ICDF(32083), + AOM_ICDF(32768), }, + {AOM_ICDF(11979), AOM_ICDF(24610), AOM_ICDF(31369), AOM_ICDF(31810), + AOM_ICDF(32768), }, + {AOM_ICDF(11325), AOM_ICDF(18989), AOM_ICDF(29109), AOM_ICDF(29770), + AOM_ICDF(32768), }, + {AOM_ICDF(9338), AOM_ICDF(11892), AOM_ICDF(25324), AOM_ICDF(26115), + AOM_ICDF(32768), }, + {AOM_ICDF(5725), AOM_ICDF(6243), AOM_ICDF(18483), AOM_ICDF(18919), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(9830), AOM_ICDF(16384), AOM_ICDF(19661), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18097), AOM_ICDF(27765), AOM_ICDF(31891), AOM_ICDF(32286), + AOM_ICDF(32768), }, + {AOM_ICDF(14735), AOM_ICDF(24632), AOM_ICDF(31577), AOM_ICDF(31970), + AOM_ICDF(32768), }, + {AOM_ICDF(11031), AOM_ICDF(15675), AOM_ICDF(29109), AOM_ICDF(29716), + AOM_ICDF(32768), }, + {AOM_ICDF(8859), AOM_ICDF(9891), AOM_ICDF(23909), AOM_ICDF(24940), + AOM_ICDF(32768), }, + {AOM_ICDF(7864), AOM_ICDF(11796), AOM_ICDF(20972), AOM_ICDF(24904), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(21057), AOM_ICDF(29116), AOM_ICDF(32033), AOM_ICDF(32367), + AOM_ICDF(32768), }, + {AOM_ICDF(15287), AOM_ICDF(25704), AOM_ICDF(31791), AOM_ICDF(32151), + AOM_ICDF(32768), }, + {AOM_ICDF(12927), AOM_ICDF(18993), AOM_ICDF(30815), AOM_ICDF(31329), + AOM_ICDF(32768), }, + {AOM_ICDF(13227), AOM_ICDF(16234), AOM_ICDF(27657), AOM_ICDF(28860), + AOM_ICDF(32768), }, + {AOM_ICDF(6899), AOM_ICDF(12072), AOM_ICDF(18971), AOM_ICDF(25869), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(17688), AOM_ICDF(28768), AOM_ICDF(32140), AOM_ICDF(32435), + AOM_ICDF(32768), }, + {AOM_ICDF(13473), AOM_ICDF(26360), AOM_ICDF(31944), AOM_ICDF(32307), + AOM_ICDF(32768), }, + {AOM_ICDF(12653), AOM_ICDF(18817), AOM_ICDF(28875), AOM_ICDF(30497), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(10923), AOM_ICDF(20025), AOM_ICDF(25486), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(6820), AOM_ICDF(28765), AOM_ICDF(31878), AOM_ICDF(32323), + AOM_ICDF(32768), }, + {AOM_ICDF(7737), AOM_ICDF(28672), AOM_ICDF(31972), AOM_ICDF(32313), + AOM_ICDF(32768), }, + {AOM_ICDF(11796), AOM_ICDF(18350), AOM_ICDF(24904), AOM_ICDF(28836), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(30079), AOM_ICDF(30525), AOM_ICDF(31559), AOM_ICDF(32085), + AOM_ICDF(32407), AOM_ICDF(32768), }, + {AOM_ICDF(22148), AOM_ICDF(24035), AOM_ICDF(29557), AOM_ICDF(31423), + AOM_ICDF(31881), AOM_ICDF(32768), }, + {AOM_ICDF(13266), AOM_ICDF(17717), AOM_ICDF(26069), AOM_ICDF(29825), + AOM_ICDF(30780), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(18219), AOM_ICDF(27530), AOM_ICDF(32048), AOM_ICDF(32373), + AOM_ICDF(32768), }, + {AOM_ICDF(14664), AOM_ICDF(25532), AOM_ICDF(31886), AOM_ICDF(32244), + AOM_ICDF(32768), }, + {AOM_ICDF(11683), AOM_ICDF(19554), AOM_ICDF(30330), AOM_ICDF(30870), + AOM_ICDF(32768), }, + {AOM_ICDF(9410), AOM_ICDF(14238), AOM_ICDF(25794), AOM_ICDF(27268), + AOM_ICDF(32768), }, + {AOM_ICDF(6629), AOM_ICDF(9580), AOM_ICDF(20186), AOM_ICDF(22187), + AOM_ICDF(32768), }, + {AOM_ICDF(2891), AOM_ICDF(4337), AOM_ICDF(11083), AOM_ICDF(13493), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20016), AOM_ICDF(28471), AOM_ICDF(32074), AOM_ICDF(32401), + AOM_ICDF(32768), }, + {AOM_ICDF(16915), AOM_ICDF(26047), AOM_ICDF(31965), AOM_ICDF(32300), + AOM_ICDF(32768), }, + {AOM_ICDF(10725), AOM_ICDF(18206), AOM_ICDF(30056), AOM_ICDF(30606), + AOM_ICDF(32768), }, + {AOM_ICDF(6883), AOM_ICDF(13990), AOM_ICDF(26334), AOM_ICDF(27531), + AOM_ICDF(32768), }, + {AOM_ICDF(11529), AOM_ICDF(15170), AOM_ICDF(22452), AOM_ICDF(24879), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(23488), AOM_ICDF(29744), AOM_ICDF(32117), AOM_ICDF(32442), + AOM_ICDF(32768), }, + {AOM_ICDF(17520), AOM_ICDF(27259), AOM_ICDF(32056), AOM_ICDF(32389), + AOM_ICDF(32768), }, + {AOM_ICDF(13107), AOM_ICDF(20597), AOM_ICDF(31416), AOM_ICDF(32092), + AOM_ICDF(32768), }, + {AOM_ICDF(20165), AOM_ICDF(22686), AOM_ICDF(26887), AOM_ICDF(29407), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(17711), AOM_ICDF(29963), AOM_ICDF(32137), AOM_ICDF(32452), + AOM_ICDF(32768), }, + {AOM_ICDF(14078), AOM_ICDF(28336), AOM_ICDF(32026), AOM_ICDF(32391), + AOM_ICDF(32768), }, + {AOM_ICDF(11129), AOM_ICDF(28749), AOM_ICDF(30295), AOM_ICDF(31222), + AOM_ICDF(32768), }, + {AOM_ICDF(7447), AOM_ICDF(13405), AOM_ICDF(22342), AOM_ICDF(26810), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(14413), AOM_ICDF(30309), AOM_ICDF(32090), AOM_ICDF(32471), + AOM_ICDF(32768), }, + {AOM_ICDF(11814), AOM_ICDF(30354), AOM_ICDF(32251), AOM_ICDF(32509), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(12743), AOM_ICDF(21845), AOM_ICDF(27307), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 8X8 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(16945), AOM_ICDF(18241), AOM_ICDF(25718), AOM_ICDF(28152), + AOM_ICDF(29383), AOM_ICDF(32768), }, + {AOM_ICDF(7095), AOM_ICDF(10051), AOM_ICDF(18830), AOM_ICDF(23174), + AOM_ICDF(24906), AOM_ICDF(32768), }, + {AOM_ICDF(2585), AOM_ICDF(6677), AOM_ICDF(10951), AOM_ICDF(17411), + AOM_ICDF(18916), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(12894), AOM_ICDF(17897), AOM_ICDF(28218), AOM_ICDF(28651), + AOM_ICDF(32768), }, + {AOM_ICDF(11333), AOM_ICDF(16802), AOM_ICDF(27676), AOM_ICDF(28153), + AOM_ICDF(32768), }, + {AOM_ICDF(10166), AOM_ICDF(13829), AOM_ICDF(25072), AOM_ICDF(25646), + AOM_ICDF(32768), }, + {AOM_ICDF(8356), AOM_ICDF(9772), AOM_ICDF(21358), AOM_ICDF(21912), + AOM_ICDF(32768), }, + {AOM_ICDF(5988), AOM_ICDF(6506), AOM_ICDF(16203), AOM_ICDF(16647), + AOM_ICDF(32768), }, + {AOM_ICDF(3684), AOM_ICDF(4012), AOM_ICDF(10039), AOM_ICDF(10367), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18192), AOM_ICDF(21044), AOM_ICDF(30229), AOM_ICDF(30597), + AOM_ICDF(32768), }, + {AOM_ICDF(14976), AOM_ICDF(18218), AOM_ICDF(29191), AOM_ICDF(29564), + AOM_ICDF(32768), }, + {AOM_ICDF(10914), AOM_ICDF(12508), AOM_ICDF(25451), AOM_ICDF(25857), + AOM_ICDF(32768), }, + {AOM_ICDF(7970), AOM_ICDF(8605), AOM_ICDF(20619), AOM_ICDF(21011), + AOM_ICDF(32768), }, + {AOM_ICDF(5555), AOM_ICDF(5926), AOM_ICDF(15730), AOM_ICDF(16091), + AOM_ICDF(32768), }, + {AOM_ICDF(3522), AOM_ICDF(3847), AOM_ICDF(10567), AOM_ICDF(10892), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(21896), AOM_ICDF(23866), AOM_ICDF(31136), AOM_ICDF(31486), + AOM_ICDF(32768), }, + {AOM_ICDF(15913), AOM_ICDF(18331), AOM_ICDF(29670), AOM_ICDF(30019), + AOM_ICDF(32768), }, + {AOM_ICDF(10158), AOM_ICDF(10878), AOM_ICDF(24664), AOM_ICDF(25024), + AOM_ICDF(32768), }, + {AOM_ICDF(6692), AOM_ICDF(7070), AOM_ICDF(18934), AOM_ICDF(19267), + AOM_ICDF(32768), }, + {AOM_ICDF(4603), AOM_ICDF(4914), AOM_ICDF(13724), AOM_ICDF(14041), + AOM_ICDF(32768), }, + {AOM_ICDF(2378), AOM_ICDF(3171), AOM_ICDF(7663), AOM_ICDF(8456), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24113), AOM_ICDF(25740), AOM_ICDF(31668), AOM_ICDF(32000), + AOM_ICDF(32768), }, + {AOM_ICDF(16618), AOM_ICDF(18583), AOM_ICDF(30173), AOM_ICDF(30511), + AOM_ICDF(32768), }, + {AOM_ICDF(10122), AOM_ICDF(10666), AOM_ICDF(24877), AOM_ICDF(25222), + AOM_ICDF(32768), }, + {AOM_ICDF(6721), AOM_ICDF(7062), AOM_ICDF(19250), AOM_ICDF(19588), + AOM_ICDF(32768), }, + {AOM_ICDF(4641), AOM_ICDF(4957), AOM_ICDF(13698), AOM_ICDF(14021), + AOM_ICDF(32768), }, + {AOM_ICDF(3324), AOM_ICDF(4749), AOM_ICDF(9498), AOM_ICDF(10923), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(24933), AOM_ICDF(27294), AOM_ICDF(31876), AOM_ICDF(32207), + AOM_ICDF(32768), }, + {AOM_ICDF(17505), AOM_ICDF(20214), AOM_ICDF(30842), AOM_ICDF(31189), + AOM_ICDF(32768), }, + {AOM_ICDF(10756), AOM_ICDF(11345), AOM_ICDF(25989), AOM_ICDF(26362), + AOM_ICDF(32768), }, + {AOM_ICDF(7374), AOM_ICDF(7763), AOM_ICDF(19820), AOM_ICDF(20160), + AOM_ICDF(32768), }, + {AOM_ICDF(5003), AOM_ICDF(5328), AOM_ICDF(15420), AOM_ICDF(15723), + AOM_ICDF(32768), }, + {AOM_ICDF(4915), AOM_ICDF(9830), AOM_ICDF(18022), AOM_ICDF(22938), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(7874), AOM_ICDF(17174), AOM_ICDF(19119), AOM_ICDF(28514), + AOM_ICDF(29361), AOM_ICDF(32768), }, + {AOM_ICDF(3407), AOM_ICDF(13628), AOM_ICDF(16836), AOM_ICDF(26723), + AOM_ICDF(27681), AOM_ICDF(32768), }, + {AOM_ICDF(1062), AOM_ICDF(11514), AOM_ICDF(14002), AOM_ICDF(24081), + AOM_ICDF(25232), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23614), AOM_ICDF(24717), AOM_ICDF(31593), AOM_ICDF(31927), + AOM_ICDF(32768), }, + {AOM_ICDF(18177), AOM_ICDF(21581), AOM_ICDF(30890), AOM_ICDF(31234), + AOM_ICDF(32768), }, + {AOM_ICDF(12535), AOM_ICDF(14549), AOM_ICDF(27749), AOM_ICDF(28134), + AOM_ICDF(32768), }, + {AOM_ICDF(9687), AOM_ICDF(10712), AOM_ICDF(23848), AOM_ICDF(24271), + AOM_ICDF(32768), }, + {AOM_ICDF(6461), AOM_ICDF(7119), AOM_ICDF(17940), AOM_ICDF(18368), + AOM_ICDF(32768), }, + {AOM_ICDF(3863), AOM_ICDF(4245), AOM_ICDF(10904), AOM_ICDF(11278), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24334), AOM_ICDF(25912), AOM_ICDF(31795), AOM_ICDF(32120), + AOM_ICDF(32768), }, + {AOM_ICDF(17964), AOM_ICDF(20229), AOM_ICDF(30726), AOM_ICDF(31064), + AOM_ICDF(32768), }, + {AOM_ICDF(10463), AOM_ICDF(11527), AOM_ICDF(25898), AOM_ICDF(26256), + AOM_ICDF(32768), }, + {AOM_ICDF(7431), AOM_ICDF(8071), AOM_ICDF(20542), AOM_ICDF(20928), + AOM_ICDF(32768), }, + {AOM_ICDF(4561), AOM_ICDF(4995), AOM_ICDF(13977), AOM_ICDF(14347), + AOM_ICDF(32768), }, + {AOM_ICDF(2427), AOM_ICDF(2687), AOM_ICDF(8149), AOM_ICDF(8409), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25888), AOM_ICDF(27308), AOM_ICDF(31957), AOM_ICDF(32279), + AOM_ICDF(32768), }, + {AOM_ICDF(18868), AOM_ICDF(20992), AOM_ICDF(31092), AOM_ICDF(31424), + AOM_ICDF(32768), }, + {AOM_ICDF(10480), AOM_ICDF(11191), AOM_ICDF(25801), AOM_ICDF(26149), + AOM_ICDF(32768), }, + {AOM_ICDF(6878), AOM_ICDF(7326), AOM_ICDF(19397), AOM_ICDF(19762), + AOM_ICDF(32768), }, + {AOM_ICDF(4235), AOM_ICDF(4601), AOM_ICDF(13182), AOM_ICDF(13587), + AOM_ICDF(32768), }, + {AOM_ICDF(3584), AOM_ICDF(5120), AOM_ICDF(11264), AOM_ICDF(13312), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26802), AOM_ICDF(28181), AOM_ICDF(32031), AOM_ICDF(32349), + AOM_ICDF(32768), }, + {AOM_ICDF(19661), AOM_ICDF(21746), AOM_ICDF(31360), AOM_ICDF(31688), + AOM_ICDF(32768), }, + {AOM_ICDF(10680), AOM_ICDF(11361), AOM_ICDF(26261), AOM_ICDF(26610), + AOM_ICDF(32768), }, + {AOM_ICDF(6811), AOM_ICDF(7274), AOM_ICDF(19689), AOM_ICDF(20075), + AOM_ICDF(32768), }, + {AOM_ICDF(4881), AOM_ICDF(5230), AOM_ICDF(11882), AOM_ICDF(12324), + AOM_ICDF(32768), }, + {AOM_ICDF(4096), AOM_ICDF(6144), AOM_ICDF(9557), AOM_ICDF(11605), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27511), AOM_ICDF(29045), AOM_ICDF(32051), AOM_ICDF(32376), + AOM_ICDF(32768), }, + {AOM_ICDF(19712), AOM_ICDF(22596), AOM_ICDF(31464), AOM_ICDF(31813), + AOM_ICDF(32768), }, + {AOM_ICDF(11035), AOM_ICDF(11852), AOM_ICDF(26626), AOM_ICDF(27082), + AOM_ICDF(32768), }, + {AOM_ICDF(7190), AOM_ICDF(7674), AOM_ICDF(20245), AOM_ICDF(20794), + AOM_ICDF(32768), }, + {AOM_ICDF(5114), AOM_ICDF(5407), AOM_ICDF(12895), AOM_ICDF(13443), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(15522), AOM_ICDF(20696), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(26201), AOM_ICDF(26641), AOM_ICDF(31158), AOM_ICDF(31755), + AOM_ICDF(32200), AOM_ICDF(32768), }, + {AOM_ICDF(19651), AOM_ICDF(20883), AOM_ICDF(28935), AOM_ICDF(30581), + AOM_ICDF(31426), AOM_ICDF(32768), }, + {AOM_ICDF(12456), AOM_ICDF(15868), AOM_ICDF(23727), AOM_ICDF(27839), + AOM_ICDF(29216), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(16708), AOM_ICDF(25600), AOM_ICDF(31550), AOM_ICDF(31927), + AOM_ICDF(32768), }, + {AOM_ICDF(14533), AOM_ICDF(24134), AOM_ICDF(31151), AOM_ICDF(31670), + AOM_ICDF(32768), }, + {AOM_ICDF(12771), AOM_ICDF(19041), AOM_ICDF(29256), AOM_ICDF(29926), + AOM_ICDF(32768), }, + {AOM_ICDF(9497), AOM_ICDF(12011), AOM_ICDF(24856), AOM_ICDF(25648), + AOM_ICDF(32768), }, + {AOM_ICDF(6059), AOM_ICDF(6512), AOM_ICDF(17765), AOM_ICDF(18218), + AOM_ICDF(32768), }, + {AOM_ICDF(4498), AOM_ICDF(6425), AOM_ICDF(13493), AOM_ICDF(15420), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(21314), AOM_ICDF(26763), AOM_ICDF(31645), AOM_ICDF(32043), + AOM_ICDF(32768), }, + {AOM_ICDF(16898), AOM_ICDF(23241), AOM_ICDF(31276), AOM_ICDF(31667), + AOM_ICDF(32768), }, + {AOM_ICDF(12339), AOM_ICDF(16091), AOM_ICDF(28493), AOM_ICDF(28851), + AOM_ICDF(32768), }, + {AOM_ICDF(8583), AOM_ICDF(10033), AOM_ICDF(23721), AOM_ICDF(24359), + AOM_ICDF(32768), }, + {AOM_ICDF(6801), AOM_ICDF(7728), AOM_ICDF(18857), AOM_ICDF(19784), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25155), AOM_ICDF(28551), AOM_ICDF(31936), AOM_ICDF(32273), + AOM_ICDF(32768), }, + {AOM_ICDF(18054), AOM_ICDF(22818), AOM_ICDF(31343), AOM_ICDF(31736), + AOM_ICDF(32768), }, + {AOM_ICDF(12381), AOM_ICDF(14088), AOM_ICDF(27865), AOM_ICDF(28300), + AOM_ICDF(32768), }, + {AOM_ICDF(7853), AOM_ICDF(8666), AOM_ICDF(21665), AOM_ICDF(22477), + AOM_ICDF(32768), }, + {AOM_ICDF(6242), AOM_ICDF(10923), AOM_ICDF(15604), AOM_ICDF(20285), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26649), AOM_ICDF(29334), AOM_ICDF(32001), AOM_ICDF(32345), + AOM_ICDF(32768), }, + {AOM_ICDF(18410), AOM_ICDF(22788), AOM_ICDF(31465), AOM_ICDF(31842), + AOM_ICDF(32768), }, + {AOM_ICDF(12504), AOM_ICDF(13480), AOM_ICDF(28600), AOM_ICDF(28955), + AOM_ICDF(32768), }, + {AOM_ICDF(9175), AOM_ICDF(10486), AOM_ICDF(21845), AOM_ICDF(23156), + AOM_ICDF(32768), }, + {AOM_ICDF(7710), AOM_ICDF(13493), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27622), AOM_ICDF(30399), AOM_ICDF(32070), AOM_ICDF(32399), + AOM_ICDF(32768), }, + {AOM_ICDF(18214), AOM_ICDF(24797), AOM_ICDF(31688), AOM_ICDF(32070), + AOM_ICDF(32768), }, + {AOM_ICDF(14564), AOM_ICDF(16894), AOM_ICDF(28981), AOM_ICDF(29564), + AOM_ICDF(32768), }, + {AOM_ICDF(7802), AOM_ICDF(12483), AOM_ICDF(17164), AOM_ICDF(21845), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(30040), AOM_ICDF(30464), AOM_ICDF(31682), AOM_ICDF(32091), + AOM_ICDF(32421), AOM_ICDF(32768), }, + {AOM_ICDF(20770), AOM_ICDF(22635), AOM_ICDF(29889), AOM_ICDF(31156), + AOM_ICDF(31909), AOM_ICDF(32768), }, + {AOM_ICDF(9112), AOM_ICDF(13841), AOM_ICDF(23864), AOM_ICDF(27288), + AOM_ICDF(30322), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23477), AOM_ICDF(28240), AOM_ICDF(32035), AOM_ICDF(32360), + AOM_ICDF(32768), }, + {AOM_ICDF(18183), AOM_ICDF(26268), AOM_ICDF(31861), AOM_ICDF(32205), + AOM_ICDF(32768), }, + {AOM_ICDF(14392), AOM_ICDF(23052), AOM_ICDF(30811), AOM_ICDF(31315), + AOM_ICDF(32768), }, + {AOM_ICDF(12579), AOM_ICDF(20081), AOM_ICDF(28411), AOM_ICDF(29467), + AOM_ICDF(32768), }, + {AOM_ICDF(9882), AOM_ICDF(14796), AOM_ICDF(25492), AOM_ICDF(27040), + AOM_ICDF(32768), }, + {AOM_ICDF(11141), AOM_ICDF(13107), AOM_ICDF(21627), AOM_ICDF(23593), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24700), AOM_ICDF(28735), AOM_ICDF(32055), AOM_ICDF(32379), + AOM_ICDF(32768), }, + {AOM_ICDF(19703), AOM_ICDF(25203), AOM_ICDF(31809), AOM_ICDF(32142), + AOM_ICDF(32768), }, + {AOM_ICDF(12756), AOM_ICDF(18882), AOM_ICDF(30716), AOM_ICDF(31103), + AOM_ICDF(32768), }, + {AOM_ICDF(9508), AOM_ICDF(13922), AOM_ICDF(25977), AOM_ICDF(26826), + AOM_ICDF(32768), }, + {AOM_ICDF(5243), AOM_ICDF(9175), AOM_ICDF(19661), AOM_ICDF(23593), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26792), AOM_ICDF(29367), AOM_ICDF(32090), AOM_ICDF(32407), + AOM_ICDF(32768), }, + {AOM_ICDF(21899), AOM_ICDF(25640), AOM_ICDF(31870), AOM_ICDF(32192), + AOM_ICDF(32768), }, + {AOM_ICDF(14205), AOM_ICDF(16907), AOM_ICDF(30415), AOM_ICDF(30764), + AOM_ICDF(32768), }, + {AOM_ICDF(10570), AOM_ICDF(13741), AOM_ICDF(23255), AOM_ICDF(26426), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27743), AOM_ICDF(29950), AOM_ICDF(32116), AOM_ICDF(32430), + AOM_ICDF(32768), }, + {AOM_ICDF(21595), AOM_ICDF(24944), AOM_ICDF(31927), AOM_ICDF(32259), + AOM_ICDF(32768), }, + {AOM_ICDF(15227), AOM_ICDF(16673), AOM_ICDF(30744), AOM_ICDF(31130), + AOM_ICDF(32768), }, + {AOM_ICDF(13797), AOM_ICDF(16384), AOM_ICDF(25007), AOM_ICDF(27594), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(28888), AOM_ICDF(30883), AOM_ICDF(32127), AOM_ICDF(32447), + AOM_ICDF(32768), }, + {AOM_ICDF(20978), AOM_ICDF(26121), AOM_ICDF(32090), AOM_ICDF(32406), + AOM_ICDF(32768), }, + {AOM_ICDF(16644), AOM_ICDF(18725), AOM_ICDF(30427), AOM_ICDF(31468), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(11469), AOM_ICDF(22938), AOM_ICDF(27853), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 16X16 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(2791), AOM_ICDF(5929), AOM_ICDF(15783), AOM_ICDF(21305), + AOM_ICDF(24756), AOM_ICDF(32768), }, + {AOM_ICDF(2492), AOM_ICDF(5974), AOM_ICDF(11999), AOM_ICDF(17892), + AOM_ICDF(20328), AOM_ICDF(32768), }, + {AOM_ICDF(1232), AOM_ICDF(4784), AOM_ICDF(7266), AOM_ICDF(13409), + AOM_ICDF(14638), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(10984), AOM_ICDF(15590), AOM_ICDF(26386), AOM_ICDF(26860), + AOM_ICDF(32768), }, + {AOM_ICDF(10300), AOM_ICDF(15555), AOM_ICDF(26075), AOM_ICDF(26661), + AOM_ICDF(32768), }, + {AOM_ICDF(9016), AOM_ICDF(12368), AOM_ICDF(23292), AOM_ICDF(24037), + AOM_ICDF(32768), }, + {AOM_ICDF(7432), AOM_ICDF(9010), AOM_ICDF(19640), AOM_ICDF(20245), + AOM_ICDF(32768), }, + {AOM_ICDF(5340), AOM_ICDF(5830), AOM_ICDF(14605), AOM_ICDF(15017), + AOM_ICDF(32768), }, + {AOM_ICDF(3041), AOM_ICDF(3357), AOM_ICDF(8664), AOM_ICDF(8983), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(17487), AOM_ICDF(19944), AOM_ICDF(29422), AOM_ICDF(29785), + AOM_ICDF(32768), }, + {AOM_ICDF(14365), AOM_ICDF(17572), AOM_ICDF(28369), AOM_ICDF(28763), + AOM_ICDF(32768), }, + {AOM_ICDF(10944), AOM_ICDF(12562), AOM_ICDF(24945), AOM_ICDF(25372), + AOM_ICDF(32768), }, + {AOM_ICDF(8061), AOM_ICDF(8670), AOM_ICDF(20179), AOM_ICDF(20570), + AOM_ICDF(32768), }, + {AOM_ICDF(5386), AOM_ICDF(5759), AOM_ICDF(14881), AOM_ICDF(15238), + AOM_ICDF(32768), }, + {AOM_ICDF(3124), AOM_ICDF(3450), AOM_ICDF(9578), AOM_ICDF(9895), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(21610), AOM_ICDF(23212), AOM_ICDF(30674), AOM_ICDF(31007), + AOM_ICDF(32768), }, + {AOM_ICDF(15516), AOM_ICDF(17922), AOM_ICDF(29225), AOM_ICDF(29573), + AOM_ICDF(32768), }, + {AOM_ICDF(10431), AOM_ICDF(11308), AOM_ICDF(24594), AOM_ICDF(24955), + AOM_ICDF(32768), }, + {AOM_ICDF(6949), AOM_ICDF(7331), AOM_ICDF(18758), AOM_ICDF(19089), + AOM_ICDF(32768), }, + {AOM_ICDF(4564), AOM_ICDF(4898), AOM_ICDF(12730), AOM_ICDF(13048), + AOM_ICDF(32768), }, + {AOM_ICDF(2435), AOM_ICDF(2739), AOM_ICDF(7406), AOM_ICDF(7710), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24469), AOM_ICDF(25838), AOM_ICDF(31499), AOM_ICDF(31824), + AOM_ICDF(32768), }, + {AOM_ICDF(17238), AOM_ICDF(18899), AOM_ICDF(30066), AOM_ICDF(30395), + AOM_ICDF(32768), }, + {AOM_ICDF(10423), AOM_ICDF(10890), AOM_ICDF(24655), AOM_ICDF(24992), + AOM_ICDF(32768), }, + {AOM_ICDF(6612), AOM_ICDF(6939), AOM_ICDF(18149), AOM_ICDF(18467), + AOM_ICDF(32768), }, + {AOM_ICDF(4122), AOM_ICDF(4431), AOM_ICDF(12556), AOM_ICDF(12874), + AOM_ICDF(32768), }, + {AOM_ICDF(1910), AOM_ICDF(2211), AOM_ICDF(7840), AOM_ICDF(8142), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27205), AOM_ICDF(28145), AOM_ICDF(31900), AOM_ICDF(32218), + AOM_ICDF(32768), }, + {AOM_ICDF(18503), AOM_ICDF(19729), AOM_ICDF(30590), AOM_ICDF(30916), + AOM_ICDF(32768), }, + {AOM_ICDF(10343), AOM_ICDF(10734), AOM_ICDF(24636), AOM_ICDF(24963), + AOM_ICDF(32768), }, + {AOM_ICDF(6629), AOM_ICDF(6955), AOM_ICDF(18492), AOM_ICDF(18810), + AOM_ICDF(32768), }, + {AOM_ICDF(4131), AOM_ICDF(4437), AOM_ICDF(13086), AOM_ICDF(13392), + AOM_ICDF(32768), }, + {AOM_ICDF(4005), AOM_ICDF(5097), AOM_ICDF(9102), AOM_ICDF(10194), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(1286), AOM_ICDF(10273), AOM_ICDF(21021), AOM_ICDF(28617), + AOM_ICDF(29729), AOM_ICDF(32768), }, + {AOM_ICDF(941), AOM_ICDF(10009), AOM_ICDF(17718), AOM_ICDF(25847), + AOM_ICDF(27712), AOM_ICDF(32768), }, + {AOM_ICDF(508), AOM_ICDF(9488), AOM_ICDF(12907), AOM_ICDF(21634), + AOM_ICDF(23969), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23900), AOM_ICDF(25135), AOM_ICDF(31528), AOM_ICDF(31861), + AOM_ICDF(32768), }, + {AOM_ICDF(18613), AOM_ICDF(22015), AOM_ICDF(30774), AOM_ICDF(31124), + AOM_ICDF(32768), }, + {AOM_ICDF(13064), AOM_ICDF(16135), AOM_ICDF(28060), AOM_ICDF(28484), + AOM_ICDF(32768), }, + {AOM_ICDF(10563), AOM_ICDF(12428), AOM_ICDF(24847), AOM_ICDF(25281), + AOM_ICDF(32768), }, + {AOM_ICDF(7960), AOM_ICDF(9069), AOM_ICDF(20548), AOM_ICDF(21017), + AOM_ICDF(32768), }, + {AOM_ICDF(6944), AOM_ICDF(7491), AOM_ICDF(16595), AOM_ICDF(17007), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24972), AOM_ICDF(26434), AOM_ICDF(31771), AOM_ICDF(32097), + AOM_ICDF(32768), }, + {AOM_ICDF(18362), AOM_ICDF(20757), AOM_ICDF(30733), AOM_ICDF(31070), + AOM_ICDF(32768), }, + {AOM_ICDF(11226), AOM_ICDF(12487), AOM_ICDF(26292), AOM_ICDF(26651), + AOM_ICDF(32768), }, + {AOM_ICDF(7823), AOM_ICDF(8448), AOM_ICDF(20940), AOM_ICDF(21314), + AOM_ICDF(32768), }, + {AOM_ICDF(4964), AOM_ICDF(5365), AOM_ICDF(14104), AOM_ICDF(14457), + AOM_ICDF(32768), }, + {AOM_ICDF(2435), AOM_ICDF(2712), AOM_ICDF(8247), AOM_ICDF(8524), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26551), AOM_ICDF(27694), AOM_ICDF(31943), AOM_ICDF(32261), + AOM_ICDF(32768), }, + {AOM_ICDF(19519), AOM_ICDF(21452), AOM_ICDF(31120), AOM_ICDF(31446), + AOM_ICDF(32768), }, + {AOM_ICDF(11272), AOM_ICDF(11965), AOM_ICDF(26389), AOM_ICDF(26736), + AOM_ICDF(32768), }, + {AOM_ICDF(7109), AOM_ICDF(7485), AOM_ICDF(19585), AOM_ICDF(19920), + AOM_ICDF(32768), }, + {AOM_ICDF(4033), AOM_ICDF(4370), AOM_ICDF(12546), AOM_ICDF(12865), + AOM_ICDF(32768), }, + {AOM_ICDF(1570), AOM_ICDF(2158), AOM_ICDF(7456), AOM_ICDF(8045), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27654), AOM_ICDF(28637), AOM_ICDF(32030), AOM_ICDF(32345), + AOM_ICDF(32768), }, + {AOM_ICDF(20795), AOM_ICDF(22232), AOM_ICDF(31351), AOM_ICDF(31672), + AOM_ICDF(32768), }, + {AOM_ICDF(10841), AOM_ICDF(11329), AOM_ICDF(25676), AOM_ICDF(26002), + AOM_ICDF(32768), }, + {AOM_ICDF(6589), AOM_ICDF(6943), AOM_ICDF(18084), AOM_ICDF(18412), + AOM_ICDF(32768), }, + {AOM_ICDF(3970), AOM_ICDF(4279), AOM_ICDF(12009), AOM_ICDF(12318), + AOM_ICDF(32768), }, + {AOM_ICDF(3449), AOM_ICDF(3967), AOM_ICDF(7761), AOM_ICDF(8278), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29545), AOM_ICDF(30314), AOM_ICDF(32084), AOM_ICDF(32404), + AOM_ICDF(32768), }, + {AOM_ICDF(21229), AOM_ICDF(22783), AOM_ICDF(31470), AOM_ICDF(31800), + AOM_ICDF(32768), }, + {AOM_ICDF(10409), AOM_ICDF(11031), AOM_ICDF(25267), AOM_ICDF(25669), + AOM_ICDF(32768), }, + {AOM_ICDF(6456), AOM_ICDF(6909), AOM_ICDF(18270), AOM_ICDF(18674), + AOM_ICDF(32768), }, + {AOM_ICDF(4253), AOM_ICDF(5017), AOM_ICDF(13288), AOM_ICDF(13706), + AOM_ICDF(32768), }, + {AOM_ICDF(1627), AOM_ICDF(2324), AOM_ICDF(8831), AOM_ICDF(9528), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(24627), AOM_ICDF(25102), AOM_ICDF(30943), AOM_ICDF(31607), + AOM_ICDF(32215), AOM_ICDF(32768), }, + {AOM_ICDF(17408), AOM_ICDF(18757), AOM_ICDF(28256), AOM_ICDF(30111), + AOM_ICDF(31225), AOM_ICDF(32768), }, + {AOM_ICDF(10984), AOM_ICDF(14293), AOM_ICDF(22894), AOM_ICDF(27503), + AOM_ICDF(28853), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(16390), AOM_ICDF(25826), AOM_ICDF(31293), AOM_ICDF(31726), + AOM_ICDF(32768), }, + {AOM_ICDF(14074), AOM_ICDF(25147), AOM_ICDF(31045), AOM_ICDF(31638), + AOM_ICDF(32768), }, + {AOM_ICDF(13598), AOM_ICDF(20524), AOM_ICDF(28818), AOM_ICDF(29894), + AOM_ICDF(32768), }, + {AOM_ICDF(10035), AOM_ICDF(13322), AOM_ICDF(25086), AOM_ICDF(26332), + AOM_ICDF(32768), }, + {AOM_ICDF(7156), AOM_ICDF(8035), AOM_ICDF(18456), AOM_ICDF(19334), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(10923), AOM_ICDF(19115), AOM_ICDF(21845), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22787), AOM_ICDF(27489), AOM_ICDF(31676), AOM_ICDF(32026), + AOM_ICDF(32768), }, + {AOM_ICDF(17518), AOM_ICDF(23800), AOM_ICDF(31204), AOM_ICDF(31578), + AOM_ICDF(32768), }, + {AOM_ICDF(10686), AOM_ICDF(15226), AOM_ICDF(28087), AOM_ICDF(28560), + AOM_ICDF(32768), }, + {AOM_ICDF(9612), AOM_ICDF(11942), AOM_ICDF(22574), AOM_ICDF(23010), + AOM_ICDF(32768), }, + {AOM_ICDF(6437), AOM_ICDF(8192), AOM_ICDF(18139), AOM_ICDF(19895), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26773), AOM_ICDF(28429), AOM_ICDF(31782), AOM_ICDF(32120), + AOM_ICDF(32768), }, + {AOM_ICDF(18449), AOM_ICDF(22329), AOM_ICDF(30991), AOM_ICDF(31329), + AOM_ICDF(32768), }, + {AOM_ICDF(12861), AOM_ICDF(14182), AOM_ICDF(27130), AOM_ICDF(27395), + AOM_ICDF(32768), }, + {AOM_ICDF(4681), AOM_ICDF(6554), AOM_ICDF(22469), AOM_ICDF(23874), + AOM_ICDF(32768), }, + {AOM_ICDF(8623), AOM_ICDF(13797), AOM_ICDF(22420), AOM_ICDF(27594), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28378), AOM_ICDF(29466), AOM_ICDF(31934), AOM_ICDF(32245), + AOM_ICDF(32768), }, + {AOM_ICDF(19880), AOM_ICDF(21733), AOM_ICDF(31206), AOM_ICDF(31550), + AOM_ICDF(32768), }, + {AOM_ICDF(12173), AOM_ICDF(13245), AOM_ICDF(27638), AOM_ICDF(27945), + AOM_ICDF(32768), }, + {AOM_ICDF(6215), AOM_ICDF(7910), AOM_ICDF(19774), AOM_ICDF(21469), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30333), AOM_ICDF(31015), AOM_ICDF(32078), AOM_ICDF(32401), + AOM_ICDF(32768), }, + {AOM_ICDF(19277), AOM_ICDF(21376), AOM_ICDF(31072), AOM_ICDF(31407), + AOM_ICDF(32768), }, + {AOM_ICDF(12978), AOM_ICDF(13724), AOM_ICDF(28144), AOM_ICDF(28442), + AOM_ICDF(32768), }, + {AOM_ICDF(10031), AOM_ICDF(12037), AOM_ICDF(25412), AOM_ICDF(27418), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(29777), AOM_ICDF(30229), AOM_ICDF(31726), AOM_ICDF(32104), + AOM_ICDF(32440), AOM_ICDF(32768), }, + {AOM_ICDF(18551), AOM_ICDF(20755), AOM_ICDF(29778), AOM_ICDF(30685), + AOM_ICDF(31935), AOM_ICDF(32768), }, + {AOM_ICDF(6236), AOM_ICDF(13170), AOM_ICDF(24037), AOM_ICDF(25823), + AOM_ICDF(30798), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(28890), AOM_ICDF(30863), AOM_ICDF(32128), AOM_ICDF(32440), + AOM_ICDF(32768), }, + {AOM_ICDF(17311), AOM_ICDF(27082), AOM_ICDF(31871), AOM_ICDF(32209), + AOM_ICDF(32768), }, + {AOM_ICDF(13447), AOM_ICDF(25217), AOM_ICDF(31158), AOM_ICDF(31793), + AOM_ICDF(32768), }, + {AOM_ICDF(11906), AOM_ICDF(20177), AOM_ICDF(29976), AOM_ICDF(30713), + AOM_ICDF(32768), }, + {AOM_ICDF(14883), AOM_ICDF(17134), AOM_ICDF(27140), AOM_ICDF(28266), + AOM_ICDF(32768), }, + {AOM_ICDF(14959), AOM_ICDF(17096), AOM_ICDF(22795), AOM_ICDF(25645), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(29494), AOM_ICDF(30807), AOM_ICDF(32086), AOM_ICDF(32404), + AOM_ICDF(32768), }, + {AOM_ICDF(19860), AOM_ICDF(25179), AOM_ICDF(31857), AOM_ICDF(32190), + AOM_ICDF(32768), }, + {AOM_ICDF(13936), AOM_ICDF(19209), AOM_ICDF(30508), AOM_ICDF(31073), + AOM_ICDF(32768), }, + {AOM_ICDF(7168), AOM_ICDF(10240), AOM_ICDF(24576), AOM_ICDF(27648), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(19275), AOM_ICDF(25058), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(30496), AOM_ICDF(31243), AOM_ICDF(32121), AOM_ICDF(32433), + AOM_ICDF(32768), }, + {AOM_ICDF(21369), AOM_ICDF(24262), AOM_ICDF(31827), AOM_ICDF(32158), + AOM_ICDF(32768), }, + {AOM_ICDF(18971), AOM_ICDF(21127), AOM_ICDF(29319), AOM_ICDF(30612), + AOM_ICDF(32768), }, + {AOM_ICDF(7710), AOM_ICDF(13493), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(30922), AOM_ICDF(31459), AOM_ICDF(32136), AOM_ICDF(32449), + AOM_ICDF(32768), }, + {AOM_ICDF(22640), AOM_ICDF(24782), AOM_ICDF(31768), AOM_ICDF(32076), + AOM_ICDF(32768), }, + {AOM_ICDF(12955), AOM_ICDF(14860), AOM_ICDF(28958), AOM_ICDF(30101), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(12743), AOM_ICDF(21845), AOM_ICDF(27307), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30469), AOM_ICDF(31279), AOM_ICDF(32115), AOM_ICDF(32446), + AOM_ICDF(32768), }, + {AOM_ICDF(19748), AOM_ICDF(24367), AOM_ICDF(31900), AOM_ICDF(32257), + AOM_ICDF(32768), }, + {AOM_ICDF(12684), AOM_ICDF(16120), AOM_ICDF(30125), AOM_ICDF(30918), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 32X32 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(8402), AOM_ICDF(9860), AOM_ICDF(23425), AOM_ICDF(26798), + AOM_ICDF(28753), AOM_ICDF(32768), }, + {AOM_ICDF(4503), AOM_ICDF(7478), AOM_ICDF(14541), AOM_ICDF(19455), + AOM_ICDF(21058), AOM_ICDF(32768), }, + {AOM_ICDF(1404), AOM_ICDF(4914), AOM_ICDF(7456), AOM_ICDF(13239), + AOM_ICDF(14005), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(11786), AOM_ICDF(17804), AOM_ICDF(26686), AOM_ICDF(27285), + AOM_ICDF(32768), }, + {AOM_ICDF(10456), AOM_ICDF(16685), AOM_ICDF(26272), AOM_ICDF(27135), + AOM_ICDF(32768), }, + {AOM_ICDF(8297), AOM_ICDF(12591), AOM_ICDF(23088), AOM_ICDF(24288), + AOM_ICDF(32768), }, + {AOM_ICDF(6320), AOM_ICDF(8297), AOM_ICDF(18902), AOM_ICDF(20112), + AOM_ICDF(32768), }, + {AOM_ICDF(4385), AOM_ICDF(4892), AOM_ICDF(12779), AOM_ICDF(13476), + AOM_ICDF(32768), }, + {AOM_ICDF(2151), AOM_ICDF(2470), AOM_ICDF(6432), AOM_ICDF(6758), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(17988), AOM_ICDF(21025), AOM_ICDF(29658), AOM_ICDF(30075), + AOM_ICDF(32768), }, + {AOM_ICDF(14641), AOM_ICDF(18188), AOM_ICDF(28759), AOM_ICDF(29202), + AOM_ICDF(32768), }, + {AOM_ICDF(10951), AOM_ICDF(12924), AOM_ICDF(25087), AOM_ICDF(25515), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(9165), AOM_ICDF(20302), AOM_ICDF(20696), + AOM_ICDF(32768), }, + {AOM_ICDF(5213), AOM_ICDF(5567), AOM_ICDF(14740), AOM_ICDF(15114), + AOM_ICDF(32768), }, + {AOM_ICDF(2785), AOM_ICDF(3096), AOM_ICDF(8153), AOM_ICDF(8465), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22839), AOM_ICDF(24625), AOM_ICDF(31013), AOM_ICDF(31343), + AOM_ICDF(32768), }, + {AOM_ICDF(16111), AOM_ICDF(18689), AOM_ICDF(29552), AOM_ICDF(29896), + AOM_ICDF(32768), }, + {AOM_ICDF(10736), AOM_ICDF(11502), AOM_ICDF(24493), AOM_ICDF(24827), + AOM_ICDF(32768), }, + {AOM_ICDF(7153), AOM_ICDF(7570), AOM_ICDF(18744), AOM_ICDF(19067), + AOM_ICDF(32768), }, + {AOM_ICDF(4285), AOM_ICDF(4591), AOM_ICDF(11651), AOM_ICDF(11957), + AOM_ICDF(32768), }, + {AOM_ICDF(2064), AOM_ICDF(2322), AOM_ICDF(6321), AOM_ICDF(6579), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24955), AOM_ICDF(26499), AOM_ICDF(31625), AOM_ICDF(31948), + AOM_ICDF(32768), }, + {AOM_ICDF(17242), AOM_ICDF(19354), AOM_ICDF(30096), AOM_ICDF(30432), + AOM_ICDF(32768), }, + {AOM_ICDF(10470), AOM_ICDF(11049), AOM_ICDF(24405), AOM_ICDF(24742), + AOM_ICDF(32768), }, + {AOM_ICDF(6717), AOM_ICDF(7038), AOM_ICDF(17553), AOM_ICDF(17870), + AOM_ICDF(32768), }, + {AOM_ICDF(4030), AOM_ICDF(4342), AOM_ICDF(11280), AOM_ICDF(11592), + AOM_ICDF(32768), }, + {AOM_ICDF(2060), AOM_ICDF(2355), AOM_ICDF(6966), AOM_ICDF(7260), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29697), AOM_ICDF(30286), AOM_ICDF(32009), AOM_ICDF(32325), + AOM_ICDF(32768), }, + {AOM_ICDF(18629), AOM_ICDF(19720), AOM_ICDF(30251), AOM_ICDF(30574), + AOM_ICDF(32768), }, + {AOM_ICDF(9459), AOM_ICDF(9826), AOM_ICDF(22948), AOM_ICDF(23264), + AOM_ICDF(32768), }, + {AOM_ICDF(5742), AOM_ICDF(6057), AOM_ICDF(16269), AOM_ICDF(16580), + AOM_ICDF(32768), }, + {AOM_ICDF(3696), AOM_ICDF(4006), AOM_ICDF(11276), AOM_ICDF(11586), + AOM_ICDF(32768), }, + {AOM_ICDF(2359), AOM_ICDF(2614), AOM_ICDF(5801), AOM_ICDF(6056), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(14224), AOM_ICDF(15827), AOM_ICDF(27984), AOM_ICDF(30263), + AOM_ICDF(31458), AOM_ICDF(32768), }, + {AOM_ICDF(4253), AOM_ICDF(7150), AOM_ICDF(20729), AOM_ICDF(24629), + AOM_ICDF(28621), AOM_ICDF(32768), }, + {AOM_ICDF(1405), AOM_ICDF(5159), AOM_ICDF(12422), AOM_ICDF(17006), + AOM_ICDF(24088), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(20029), AOM_ICDF(23525), AOM_ICDF(30941), AOM_ICDF(31369), + AOM_ICDF(32768), }, + {AOM_ICDF(15691), AOM_ICDF(22792), AOM_ICDF(30520), AOM_ICDF(30960), + AOM_ICDF(32768), }, + {AOM_ICDF(12036), AOM_ICDF(18829), AOM_ICDF(28256), AOM_ICDF(29025), + AOM_ICDF(32768), }, + {AOM_ICDF(10881), AOM_ICDF(14586), AOM_ICDF(25416), AOM_ICDF(26318), + AOM_ICDF(32768), }, + {AOM_ICDF(11249), AOM_ICDF(13311), AOM_ICDF(23713), AOM_ICDF(24498), + AOM_ICDF(32768), }, + {AOM_ICDF(9444), AOM_ICDF(10609), AOM_ICDF(20170), AOM_ICDF(21025), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23805), AOM_ICDF(26370), AOM_ICDF(31579), AOM_ICDF(31927), + AOM_ICDF(32768), }, + {AOM_ICDF(16685), AOM_ICDF(21243), AOM_ICDF(30526), AOM_ICDF(30890), + AOM_ICDF(32768), }, + {AOM_ICDF(11661), AOM_ICDF(14143), AOM_ICDF(26804), AOM_ICDF(27193), + AOM_ICDF(32768), }, + {AOM_ICDF(8321), AOM_ICDF(9593), AOM_ICDF(21814), AOM_ICDF(22228), + AOM_ICDF(32768), }, + {AOM_ICDF(6243), AOM_ICDF(6820), AOM_ICDF(16151), AOM_ICDF(16506), + AOM_ICDF(32768), }, + {AOM_ICDF(3612), AOM_ICDF(4386), AOM_ICDF(9547), AOM_ICDF(10321), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26022), AOM_ICDF(27534), AOM_ICDF(31845), AOM_ICDF(32167), + AOM_ICDF(32768), }, + {AOM_ICDF(18692), AOM_ICDF(21351), AOM_ICDF(30871), AOM_ICDF(31203), + AOM_ICDF(32768), }, + {AOM_ICDF(11493), AOM_ICDF(12410), AOM_ICDF(26280), AOM_ICDF(26619), + AOM_ICDF(32768), }, + {AOM_ICDF(7099), AOM_ICDF(7581), AOM_ICDF(19315), AOM_ICDF(19619), + AOM_ICDF(32768), }, + {AOM_ICDF(3329), AOM_ICDF(3623), AOM_ICDF(10868), AOM_ICDF(11162), + AOM_ICDF(32768), }, + {AOM_ICDF(3104), AOM_ICDF(4139), AOM_ICDF(10003), AOM_ICDF(11038), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28126), AOM_ICDF(29216), AOM_ICDF(32027), AOM_ICDF(32345), + AOM_ICDF(32768), }, + {AOM_ICDF(19828), AOM_ICDF(22063), AOM_ICDF(31140), AOM_ICDF(31465), + AOM_ICDF(32768), }, + {AOM_ICDF(11206), AOM_ICDF(11832), AOM_ICDF(25718), AOM_ICDF(26041), + AOM_ICDF(32768), }, + {AOM_ICDF(6496), AOM_ICDF(6825), AOM_ICDF(18069), AOM_ICDF(18408), + AOM_ICDF(32768), }, + {AOM_ICDF(4600), AOM_ICDF(4904), AOM_ICDF(12431), AOM_ICDF(12735), + AOM_ICDF(32768), }, + {AOM_ICDF(2016), AOM_ICDF(3529), AOM_ICDF(8066), AOM_ICDF(9578), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30246), AOM_ICDF(30814), AOM_ICDF(32096), AOM_ICDF(32411), + AOM_ICDF(32768), }, + {AOM_ICDF(21165), AOM_ICDF(22238), AOM_ICDF(31122), AOM_ICDF(31445), + AOM_ICDF(32768), }, + {AOM_ICDF(10123), AOM_ICDF(10519), AOM_ICDF(24102), AOM_ICDF(24419), + AOM_ICDF(32768), }, + {AOM_ICDF(5968), AOM_ICDF(6277), AOM_ICDF(17606), AOM_ICDF(17924), + AOM_ICDF(32768), }, + {AOM_ICDF(4312), AOM_ICDF(4620), AOM_ICDF(12131), AOM_ICDF(12439), + AOM_ICDF(32768), }, + {AOM_ICDF(4608), AOM_ICDF(6144), AOM_ICDF(9216), AOM_ICDF(10752), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(22808), AOM_ICDF(23508), AOM_ICDF(29956), AOM_ICDF(30649), + AOM_ICDF(31698), AOM_ICDF(32768), }, + {AOM_ICDF(11001), AOM_ICDF(12792), AOM_ICDF(25018), AOM_ICDF(27680), + AOM_ICDF(29623), AOM_ICDF(32768), }, + {AOM_ICDF(6919), AOM_ICDF(10026), AOM_ICDF(19635), AOM_ICDF(24728), + AOM_ICDF(26490), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(12861), AOM_ICDF(25068), AOM_ICDF(30802), AOM_ICDF(31375), + AOM_ICDF(32768), }, + {AOM_ICDF(11298), AOM_ICDF(21545), AOM_ICDF(29953), AOM_ICDF(30816), + AOM_ICDF(32768), }, + {AOM_ICDF(13053), AOM_ICDF(24270), AOM_ICDF(28485), AOM_ICDF(29845), + AOM_ICDF(32768), }, + {AOM_ICDF(7710), AOM_ICDF(15059), AOM_ICDF(26383), AOM_ICDF(28431), + AOM_ICDF(32768), }, + {AOM_ICDF(8856), AOM_ICDF(10332), AOM_ICDF(18008), AOM_ICDF(19779), + AOM_ICDF(32768), }, + {AOM_ICDF(3855), AOM_ICDF(7710), AOM_ICDF(19275), AOM_ICDF(22167), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(19458), AOM_ICDF(25796), AOM_ICDF(31754), AOM_ICDF(32007), + AOM_ICDF(32768), }, + {AOM_ICDF(16458), AOM_ICDF(23827), AOM_ICDF(31294), AOM_ICDF(31638), + AOM_ICDF(32768), }, + {AOM_ICDF(16274), AOM_ICDF(18913), AOM_ICDF(28150), AOM_ICDF(29029), + AOM_ICDF(32768), }, + {AOM_ICDF(12429), AOM_ICDF(15254), AOM_ICDF(24858), AOM_ICDF(26553), + AOM_ICDF(32768), }, + {AOM_ICDF(7399), AOM_ICDF(11627), AOM_ICDF(21141), AOM_ICDF(24312), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(17348), AOM_ICDF(23130), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25493), AOM_ICDF(28975), AOM_ICDF(31960), AOM_ICDF(32271), + AOM_ICDF(32768), }, + {AOM_ICDF(16904), AOM_ICDF(21759), AOM_ICDF(31381), AOM_ICDF(31728), + AOM_ICDF(32768), }, + {AOM_ICDF(9709), AOM_ICDF(11529), AOM_ICDF(24879), AOM_ICDF(26700), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(13107), AOM_ICDF(22938), AOM_ICDF(27853), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(10923), AOM_ICDF(20025), AOM_ICDF(25486), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26127), AOM_ICDF(28926), AOM_ICDF(31725), AOM_ICDF(32274), + AOM_ICDF(32768), }, + {AOM_ICDF(17673), AOM_ICDF(25036), AOM_ICDF(31940), AOM_ICDF(32216), + AOM_ICDF(32768), }, + {AOM_ICDF(14824), AOM_ICDF(17164), AOM_ICDF(26526), AOM_ICDF(28867), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(16384), AOM_ICDF(21845), AOM_ICDF(27307), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30683), AOM_ICDF(31149), AOM_ICDF(32155), AOM_ICDF(32449), + AOM_ICDF(32768), }, + {AOM_ICDF(17896), AOM_ICDF(22055), AOM_ICDF(31508), AOM_ICDF(31886), + AOM_ICDF(32768), }, + {AOM_ICDF(8548), AOM_ICDF(12822), AOM_ICDF(24220), AOM_ICDF(28494), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(27393), AOM_ICDF(28900), AOM_ICDF(31555), AOM_ICDF(31971), + AOM_ICDF(32368), AOM_ICDF(32768), }, + {AOM_ICDF(8379), AOM_ICDF(19364), AOM_ICDF(27675), AOM_ICDF(28688), + AOM_ICDF(31114), AOM_ICDF(32768), }, + {AOM_ICDF(1955), AOM_ICDF(19256), AOM_ICDF(24580), AOM_ICDF(25370), + AOM_ICDF(30257), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(31085), AOM_ICDF(31718), AOM_ICDF(32129), AOM_ICDF(32443), + AOM_ICDF(32768), }, + {AOM_ICDF(14336), AOM_ICDF(26852), AOM_ICDF(31370), AOM_ICDF(31760), + AOM_ICDF(32768), }, + {AOM_ICDF(11751), AOM_ICDF(23544), AOM_ICDF(28851), AOM_ICDF(29567), + AOM_ICDF(32768), }, + {AOM_ICDF(14670), AOM_ICDF(21251), AOM_ICDF(28381), AOM_ICDF(29752), + AOM_ICDF(32768), }, + {AOM_ICDF(14832), AOM_ICDF(19316), AOM_ICDF(27134), AOM_ICDF(28974), + AOM_ICDF(32768), }, + {AOM_ICDF(13312), AOM_ICDF(15360), AOM_ICDF(25600), AOM_ICDF(27648), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(31302), AOM_ICDF(31746), AOM_ICDF(32144), AOM_ICDF(32455), + AOM_ICDF(32768), }, + {AOM_ICDF(18343), AOM_ICDF(26723), AOM_ICDF(32018), AOM_ICDF(32434), + AOM_ICDF(32768), }, + {AOM_ICDF(10570), AOM_ICDF(16913), AOM_ICDF(29068), AOM_ICDF(30125), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(13797), AOM_ICDF(24145), AOM_ICDF(26732), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(31420), AOM_ICDF(31795), AOM_ICDF(32144), AOM_ICDF(32455), + AOM_ICDF(32768), }, + {AOM_ICDF(21510), AOM_ICDF(28245), AOM_ICDF(32064), AOM_ICDF(32366), + AOM_ICDF(32768), }, + {AOM_ICDF(6342), AOM_ICDF(11627), AOM_ICDF(25369), AOM_ICDF(28540), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(31470), AOM_ICDF(31806), AOM_ICDF(32143), AOM_ICDF(32455), + AOM_ICDF(32768), }, + {AOM_ICDF(19571), AOM_ICDF(25722), AOM_ICDF(31538), AOM_ICDF(31985), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(8738), AOM_ICDF(25122), AOM_ICDF(28399), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(31292), AOM_ICDF(31637), AOM_ICDF(32104), AOM_ICDF(32431), + AOM_ICDF(32768), }, + {AOM_ICDF(12774), AOM_ICDF(16652), AOM_ICDF(30002), AOM_ICDF(30986), + AOM_ICDF(32768), }, + {AOM_ICDF(4652), AOM_ICDF(11442), AOM_ICDF(30231), AOM_ICDF(30593), + AOM_ICDF(32768), }, + {AOM_ICDF(7022), AOM_ICDF(10031), AOM_ICDF(28087), AOM_ICDF(29090), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, +}; + +static const coeff_cdf_model +av1_default_coef_head_cdfs_q3[TX_SIZES][PLANE_TYPES] = { + { // TX 4X4 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(25117), AOM_ICDF(25655), AOM_ICDF(28371), AOM_ICDF(30246), + AOM_ICDF(30939), AOM_ICDF(32768), }, + {AOM_ICDF(15083), AOM_ICDF(16850), AOM_ICDF(26029), AOM_ICDF(29031), + AOM_ICDF(30115), AOM_ICDF(32768), }, + {AOM_ICDF(8774), AOM_ICDF(12118), AOM_ICDF(22041), AOM_ICDF(26730), + AOM_ICDF(28574), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(13690), AOM_ICDF(23135), AOM_ICDF(31469), AOM_ICDF(31868), + AOM_ICDF(32768), }, + {AOM_ICDF(13306), AOM_ICDF(22730), AOM_ICDF(31466), AOM_ICDF(31860), + AOM_ICDF(32768), }, + {AOM_ICDF(13503), AOM_ICDF(19892), AOM_ICDF(30528), AOM_ICDF(31005), + AOM_ICDF(32768), }, + {AOM_ICDF(13150), AOM_ICDF(16108), AOM_ICDF(28345), AOM_ICDF(28869), + AOM_ICDF(32768), }, + {AOM_ICDF(12014), AOM_ICDF(12842), AOM_ICDF(25693), AOM_ICDF(26145), + AOM_ICDF(32768), }, + {AOM_ICDF(8937), AOM_ICDF(13405), AOM_ICDF(23831), AOM_ICDF(28300), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18707), AOM_ICDF(26260), AOM_ICDF(31853), AOM_ICDF(32238), + AOM_ICDF(32768), }, + {AOM_ICDF(15985), AOM_ICDF(24804), AOM_ICDF(31717), AOM_ICDF(32115), + AOM_ICDF(32768), }, + {AOM_ICDF(14012), AOM_ICDF(18913), AOM_ICDF(30497), AOM_ICDF(31005), + AOM_ICDF(32768), }, + {AOM_ICDF(12300), AOM_ICDF(14741), AOM_ICDF(28386), AOM_ICDF(28958), + AOM_ICDF(32768), }, + {AOM_ICDF(12483), AOM_ICDF(15084), AOM_ICDF(24966), AOM_ICDF(26526), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(19934), AOM_ICDF(28117), AOM_ICDF(32022), AOM_ICDF(32378), + AOM_ICDF(32768), }, + {AOM_ICDF(14925), AOM_ICDF(26201), AOM_ICDF(31828), AOM_ICDF(32262), + AOM_ICDF(32768), }, + {AOM_ICDF(13132), AOM_ICDF(18927), AOM_ICDF(30269), AOM_ICDF(31173), + AOM_ICDF(32768), }, + {AOM_ICDF(13926), AOM_ICDF(19251), AOM_ICDF(28262), AOM_ICDF(29901), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(16626), AOM_ICDF(28981), AOM_ICDF(32074), AOM_ICDF(32413), + AOM_ICDF(32768), }, + {AOM_ICDF(12895), AOM_ICDF(27583), AOM_ICDF(31974), AOM_ICDF(32332), + AOM_ICDF(32768), }, + {AOM_ICDF(14150), AOM_ICDF(22094), AOM_ICDF(31030), AOM_ICDF(31775), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(5279), AOM_ICDF(29309), AOM_ICDF(32149), AOM_ICDF(32477), + AOM_ICDF(32768), }, + {AOM_ICDF(5880), AOM_ICDF(29657), AOM_ICDF(32086), AOM_ICDF(32385), + AOM_ICDF(32768), }, + {AOM_ICDF(11469), AOM_ICDF(18022), AOM_ICDF(22938), AOM_ICDF(27853), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(8302), AOM_ICDF(14024), AOM_ICDF(16072), AOM_ICDF(27926), + AOM_ICDF(28871), AOM_ICDF(32768), }, + {AOM_ICDF(9359), AOM_ICDF(15522), AOM_ICDF(20581), AOM_ICDF(28595), + AOM_ICDF(29250), AOM_ICDF(32768), }, + {AOM_ICDF(5318), AOM_ICDF(12803), AOM_ICDF(19679), AOM_ICDF(27719), + AOM_ICDF(28609), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(22745), AOM_ICDF(25806), AOM_ICDF(31997), AOM_ICDF(32327), + AOM_ICDF(32768), }, + {AOM_ICDF(18803), AOM_ICDF(25473), AOM_ICDF(31960), AOM_ICDF(32293), + AOM_ICDF(32768), }, + {AOM_ICDF(15553), AOM_ICDF(19553), AOM_ICDF(31039), AOM_ICDF(31407), + AOM_ICDF(32768), }, + {AOM_ICDF(13037), AOM_ICDF(15169), AOM_ICDF(28589), AOM_ICDF(29060), + AOM_ICDF(32768), }, + {AOM_ICDF(10871), AOM_ICDF(11694), AOM_ICDF(24941), AOM_ICDF(25360), + AOM_ICDF(32768), }, + {AOM_ICDF(6242), AOM_ICDF(10923), AOM_ICDF(18725), AOM_ICDF(23406), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22276), AOM_ICDF(27316), AOM_ICDF(32078), AOM_ICDF(32402), + AOM_ICDF(32768), }, + {AOM_ICDF(19227), AOM_ICDF(25420), AOM_ICDF(31954), AOM_ICDF(32293), + AOM_ICDF(32768), }, + {AOM_ICDF(12383), AOM_ICDF(16969), AOM_ICDF(30280), AOM_ICDF(30766), + AOM_ICDF(32768), }, + {AOM_ICDF(11282), AOM_ICDF(13725), AOM_ICDF(26516), AOM_ICDF(27379), + AOM_ICDF(32768), }, + {AOM_ICDF(5120), AOM_ICDF(9216), AOM_ICDF(15360), AOM_ICDF(20480), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(22814), AOM_ICDF(28656), AOM_ICDF(32097), AOM_ICDF(32425), + AOM_ICDF(32768), }, + {AOM_ICDF(19349), AOM_ICDF(26355), AOM_ICDF(32000), AOM_ICDF(32341), + AOM_ICDF(32768), }, + {AOM_ICDF(13824), AOM_ICDF(17830), AOM_ICDF(30780), AOM_ICDF(31142), + AOM_ICDF(32768), }, + {AOM_ICDF(6746), AOM_ICDF(13493), AOM_ICDF(25058), AOM_ICDF(27949), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(19746), AOM_ICDF(28536), AOM_ICDF(32088), AOM_ICDF(32411), + AOM_ICDF(32768), }, + {AOM_ICDF(17457), AOM_ICDF(27155), AOM_ICDF(32024), AOM_ICDF(32376), + AOM_ICDF(32768), }, + {AOM_ICDF(10949), AOM_ICDF(16662), AOM_ICDF(29118), AOM_ICDF(30229), + AOM_ICDF(32768), }, + {AOM_ICDF(6096), AOM_ICDF(12955), AOM_ICDF(21337), AOM_ICDF(27434), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(10114), AOM_ICDF(29713), AOM_ICDF(32140), AOM_ICDF(32448), + AOM_ICDF(32768), }, + {AOM_ICDF(11455), AOM_ICDF(29324), AOM_ICDF(32094), AOM_ICDF(32419), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(14418), AOM_ICDF(23593), AOM_ICDF(27525), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(30309), AOM_ICDF(30623), AOM_ICDF(31738), AOM_ICDF(32084), + AOM_ICDF(32428), AOM_ICDF(32768), }, + {AOM_ICDF(25732), AOM_ICDF(26211), AOM_ICDF(31079), AOM_ICDF(31737), + AOM_ICDF(32269), AOM_ICDF(32768), }, + {AOM_ICDF(19676), AOM_ICDF(21061), AOM_ICDF(29564), AOM_ICDF(31011), + AOM_ICDF(31879), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(12328), AOM_ICDF(28270), AOM_ICDF(32125), AOM_ICDF(32447), + AOM_ICDF(32768), }, + {AOM_ICDF(11177), AOM_ICDF(28585), AOM_ICDF(32076), AOM_ICDF(32401), + AOM_ICDF(32768), }, + {AOM_ICDF(13232), AOM_ICDF(25364), AOM_ICDF(31558), AOM_ICDF(32072), + AOM_ICDF(32768), }, + {AOM_ICDF(11997), AOM_ICDF(18443), AOM_ICDF(30261), AOM_ICDF(31873), + AOM_ICDF(32768), }, + {AOM_ICDF(7399), AOM_ICDF(11627), AOM_ICDF(24312), AOM_ICDF(27483), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(16893), AOM_ICDF(29817), AOM_ICDF(32005), AOM_ICDF(32463), + AOM_ICDF(32768), }, + {AOM_ICDF(14911), AOM_ICDF(27935), AOM_ICDF(32179), AOM_ICDF(32473), + AOM_ICDF(32768), }, + {AOM_ICDF(9973), AOM_ICDF(19946), AOM_ICDF(24220), AOM_ICDF(28494), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(18859), AOM_ICDF(29232), AOM_ICDF(31354), AOM_ICDF(32061), + AOM_ICDF(32768), }, + {AOM_ICDF(11281), AOM_ICDF(26322), AOM_ICDF(29545), AOM_ICDF(31156), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(8937), AOM_ICDF(19363), AOM_ICDF(23831), AOM_ICDF(28300), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(30586), AOM_ICDF(30911), AOM_ICDF(31771), AOM_ICDF(32121), + AOM_ICDF(32443), AOM_ICDF(32768), }, + {AOM_ICDF(23875), AOM_ICDF(24492), AOM_ICDF(30970), AOM_ICDF(31684), + AOM_ICDF(32217), AOM_ICDF(32768), }, + {AOM_ICDF(15874), AOM_ICDF(17477), AOM_ICDF(29172), AOM_ICDF(30703), + AOM_ICDF(32023), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17059), AOM_ICDF(30027), AOM_ICDF(32152), AOM_ICDF(32450), + AOM_ICDF(32768), }, + {AOM_ICDF(13931), AOM_ICDF(29387), AOM_ICDF(32103), AOM_ICDF(32414), + AOM_ICDF(32768), }, + {AOM_ICDF(12903), AOM_ICDF(25742), AOM_ICDF(31906), AOM_ICDF(32289), + AOM_ICDF(32768), }, + {AOM_ICDF(13493), AOM_ICDF(23130), AOM_ICDF(29614), AOM_ICDF(30840), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(14746), AOM_ICDF(26214), AOM_ICDF(28672), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18660), AOM_ICDF(30626), AOM_ICDF(32150), AOM_ICDF(32459), + AOM_ICDF(32768), }, + {AOM_ICDF(17338), AOM_ICDF(29279), AOM_ICDF(32168), AOM_ICDF(32495), + AOM_ICDF(32768), }, + {AOM_ICDF(11916), AOM_ICDF(17873), AOM_ICDF(26810), AOM_ICDF(29789), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(14564), AOM_ICDF(21845), AOM_ICDF(27307), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(23269), AOM_ICDF(31374), AOM_ICDF(32245), AOM_ICDF(32507), + AOM_ICDF(32768), }, + {AOM_ICDF(15741), AOM_ICDF(27628), AOM_ICDF(30840), AOM_ICDF(31804), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(15464), AOM_ICDF(29454), AOM_ICDF(30559), AOM_ICDF(31663), + AOM_ICDF(32768), }, + {AOM_ICDF(6827), AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 8X8 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(18128), AOM_ICDF(19079), AOM_ICDF(27400), AOM_ICDF(29265), + AOM_ICDF(30385), AOM_ICDF(32768), }, + {AOM_ICDF(10290), AOM_ICDF(12446), AOM_ICDF(23496), AOM_ICDF(26905), + AOM_ICDF(28729), AOM_ICDF(32768), }, + {AOM_ICDF(5877), AOM_ICDF(9423), AOM_ICDF(18374), AOM_ICDF(23871), + AOM_ICDF(26028), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(16010), AOM_ICDF(22388), AOM_ICDF(30990), AOM_ICDF(31378), + AOM_ICDF(32768), }, + {AOM_ICDF(14579), AOM_ICDF(21619), AOM_ICDF(30755), AOM_ICDF(31177), + AOM_ICDF(32768), }, + {AOM_ICDF(13859), AOM_ICDF(18660), AOM_ICDF(29381), AOM_ICDF(29904), + AOM_ICDF(32768), }, + {AOM_ICDF(12288), AOM_ICDF(14656), AOM_ICDF(27505), AOM_ICDF(28077), + AOM_ICDF(32768), }, + {AOM_ICDF(10009), AOM_ICDF(10812), AOM_ICDF(23591), AOM_ICDF(24068), + AOM_ICDF(32768), }, + {AOM_ICDF(8663), AOM_ICDF(9981), AOM_ICDF(19962), AOM_ICDF(20904), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20773), AOM_ICDF(24941), AOM_ICDF(31701), AOM_ICDF(32046), + AOM_ICDF(32768), }, + {AOM_ICDF(17537), AOM_ICDF(22279), AOM_ICDF(31257), AOM_ICDF(31629), + AOM_ICDF(32768), }, + {AOM_ICDF(13337), AOM_ICDF(15972), AOM_ICDF(29181), AOM_ICDF(29575), + AOM_ICDF(32768), }, + {AOM_ICDF(11120), AOM_ICDF(12128), AOM_ICDF(26440), AOM_ICDF(26874), + AOM_ICDF(32768), }, + {AOM_ICDF(10061), AOM_ICDF(10800), AOM_ICDF(23999), AOM_ICDF(24276), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24073), AOM_ICDF(27227), AOM_ICDF(31920), AOM_ICDF(32246), + AOM_ICDF(32768), }, + {AOM_ICDF(18916), AOM_ICDF(22611), AOM_ICDF(31508), AOM_ICDF(31853), + AOM_ICDF(32768), }, + {AOM_ICDF(13371), AOM_ICDF(14495), AOM_ICDF(28662), AOM_ICDF(29093), + AOM_ICDF(32768), }, + {AOM_ICDF(9283), AOM_ICDF(9840), AOM_ICDF(24228), AOM_ICDF(24506), + AOM_ICDF(32768), }, + {AOM_ICDF(4681), AOM_ICDF(9362), AOM_ICDF(20285), AOM_ICDF(24966), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(25180), AOM_ICDF(28079), AOM_ICDF(32048), AOM_ICDF(32365), + AOM_ICDF(32768), }, + {AOM_ICDF(19790), AOM_ICDF(23090), AOM_ICDF(31675), AOM_ICDF(32001), + AOM_ICDF(32768), }, + {AOM_ICDF(12634), AOM_ICDF(13382), AOM_ICDF(28384), AOM_ICDF(28718), + AOM_ICDF(32768), }, + {AOM_ICDF(11264), AOM_ICDF(12083), AOM_ICDF(28672), AOM_ICDF(29286), + AOM_ICDF(32768), }, + {AOM_ICDF(7710), AOM_ICDF(13493), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(26180), AOM_ICDF(29109), AOM_ICDF(32085), AOM_ICDF(32408), + AOM_ICDF(32768), }, + {AOM_ICDF(19990), AOM_ICDF(23991), AOM_ICDF(31806), AOM_ICDF(32152), + AOM_ICDF(32768), }, + {AOM_ICDF(13735), AOM_ICDF(14612), AOM_ICDF(29022), AOM_ICDF(29326), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(10240), AOM_ICDF(25259), AOM_ICDF(27307), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(5084), AOM_ICDF(13063), AOM_ICDF(15732), AOM_ICDF(27628), + AOM_ICDF(28823), AOM_ICDF(32768), }, + {AOM_ICDF(3233), AOM_ICDF(11850), AOM_ICDF(16878), AOM_ICDF(26809), + AOM_ICDF(27973), AOM_ICDF(32768), }, + {AOM_ICDF(1405), AOM_ICDF(10468), AOM_ICDF(15220), AOM_ICDF(25209), + AOM_ICDF(26482), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23854), AOM_ICDF(26692), AOM_ICDF(31964), AOM_ICDF(32291), + AOM_ICDF(32768), }, + {AOM_ICDF(20514), AOM_ICDF(25677), AOM_ICDF(31833), AOM_ICDF(32170), + AOM_ICDF(32768), }, + {AOM_ICDF(16504), AOM_ICDF(20235), AOM_ICDF(30877), AOM_ICDF(31237), + AOM_ICDF(32768), }, + {AOM_ICDF(13241), AOM_ICDF(15173), AOM_ICDF(28673), AOM_ICDF(29116), + AOM_ICDF(32768), }, + {AOM_ICDF(9526), AOM_ICDF(10553), AOM_ICDF(23852), AOM_ICDF(24361), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(6428), AOM_ICDF(17806), AOM_ICDF(18148), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24345), AOM_ICDF(27736), AOM_ICDF(32033), AOM_ICDF(32355), + AOM_ICDF(32768), }, + {AOM_ICDF(20277), AOM_ICDF(23726), AOM_ICDF(31700), AOM_ICDF(32031), + AOM_ICDF(32768), }, + {AOM_ICDF(13361), AOM_ICDF(15650), AOM_ICDF(29411), AOM_ICDF(29794), + AOM_ICDF(32768), }, + {AOM_ICDF(9421), AOM_ICDF(10887), AOM_ICDF(25426), AOM_ICDF(26039), + AOM_ICDF(32768), }, + {AOM_ICDF(6242), AOM_ICDF(7607), AOM_ICDF(17749), AOM_ICDF(18530), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26118), AOM_ICDF(28888), AOM_ICDF(32095), AOM_ICDF(32413), + AOM_ICDF(32768), }, + {AOM_ICDF(21286), AOM_ICDF(24631), AOM_ICDF(31871), AOM_ICDF(32198), + AOM_ICDF(32768), }, + {AOM_ICDF(13285), AOM_ICDF(15402), AOM_ICDF(29317), AOM_ICDF(29737), + AOM_ICDF(32768), }, + {AOM_ICDF(9902), AOM_ICDF(10814), AOM_ICDF(24755), AOM_ICDF(25276), + AOM_ICDF(32768), }, + {AOM_ICDF(11431), AOM_ICDF(13717), AOM_ICDF(20575), AOM_ICDF(23623), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27178), AOM_ICDF(29612), AOM_ICDF(32119), AOM_ICDF(32433), + AOM_ICDF(32768), }, + {AOM_ICDF(22095), AOM_ICDF(25550), AOM_ICDF(31976), AOM_ICDF(32298), + AOM_ICDF(32768), }, + {AOM_ICDF(13847), AOM_ICDF(16273), AOM_ICDF(29602), AOM_ICDF(30024), + AOM_ICDF(32768), }, + {AOM_ICDF(8771), AOM_ICDF(10923), AOM_ICDF(19694), AOM_ICDF(20521), + AOM_ICDF(32768), }, + {AOM_ICDF(11398), AOM_ICDF(15672), AOM_ICDF(21370), AOM_ICDF(25645), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(28257), AOM_ICDF(30327), AOM_ICDF(32126), AOM_ICDF(32441), + AOM_ICDF(32768), }, + {AOM_ICDF(22325), AOM_ICDF(26453), AOM_ICDF(32054), AOM_ICDF(32380), + AOM_ICDF(32768), }, + {AOM_ICDF(14860), AOM_ICDF(17652), AOM_ICDF(30682), AOM_ICDF(31035), + AOM_ICDF(32768), }, + {AOM_ICDF(5097), AOM_ICDF(10194), AOM_ICDF(18933), AOM_ICDF(21117), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(28902), AOM_ICDF(29234), AOM_ICDF(31608), AOM_ICDF(31973), + AOM_ICDF(32378), AOM_ICDF(32768), }, + {AOM_ICDF(22721), AOM_ICDF(23397), AOM_ICDF(30476), AOM_ICDF(31293), + AOM_ICDF(32179), AOM_ICDF(32768), }, + {AOM_ICDF(16404), AOM_ICDF(18013), AOM_ICDF(27505), AOM_ICDF(29454), + AOM_ICDF(31300), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(14290), AOM_ICDF(27662), AOM_ICDF(31923), AOM_ICDF(32327), + AOM_ICDF(32768), }, + {AOM_ICDF(13282), AOM_ICDF(26727), AOM_ICDF(31749), AOM_ICDF(32113), + AOM_ICDF(32768), }, + {AOM_ICDF(12514), AOM_ICDF(22487), AOM_ICDF(30689), AOM_ICDF(31459), + AOM_ICDF(32768), }, + {AOM_ICDF(11657), AOM_ICDF(16967), AOM_ICDF(29660), AOM_ICDF(30437), + AOM_ICDF(32768), }, + {AOM_ICDF(8937), AOM_ICDF(12660), AOM_ICDF(24576), AOM_ICDF(26810), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20145), AOM_ICDF(28026), AOM_ICDF(31820), AOM_ICDF(32212), + AOM_ICDF(32768), }, + {AOM_ICDF(16906), AOM_ICDF(25677), AOM_ICDF(31760), AOM_ICDF(32059), + AOM_ICDF(32768), }, + {AOM_ICDF(12332), AOM_ICDF(18322), AOM_ICDF(29597), AOM_ICDF(31006), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(13107), AOM_ICDF(21299), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(23492), AOM_ICDF(29214), AOM_ICDF(32166), AOM_ICDF(32467), + AOM_ICDF(32768), }, + {AOM_ICDF(18757), AOM_ICDF(25536), AOM_ICDF(31789), AOM_ICDF(32165), + AOM_ICDF(32768), }, + {AOM_ICDF(12603), AOM_ICDF(16384), AOM_ICDF(25206), AOM_ICDF(28987), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(24518), AOM_ICDF(29453), AOM_ICDF(32074), AOM_ICDF(32382), + AOM_ICDF(32768), }, + {AOM_ICDF(19369), AOM_ICDF(26533), AOM_ICDF(31972), AOM_ICDF(32370), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(24576), AOM_ICDF(28789), AOM_ICDF(31364), AOM_ICDF(32066), + AOM_ICDF(32768), }, + {AOM_ICDF(20052), AOM_ICDF(24454), AOM_ICDF(29834), AOM_ICDF(31301), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(30358), AOM_ICDF(30700), AOM_ICDF(31747), AOM_ICDF(32103), + AOM_ICDF(32430), AOM_ICDF(32768), }, + {AOM_ICDF(22346), AOM_ICDF(23277), AOM_ICDF(30508), AOM_ICDF(31386), + AOM_ICDF(32138), AOM_ICDF(32768), }, + {AOM_ICDF(11974), AOM_ICDF(14562), AOM_ICDF(27349), AOM_ICDF(28970), + AOM_ICDF(31969), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(22910), AOM_ICDF(29539), AOM_ICDF(32102), AOM_ICDF(32412), + AOM_ICDF(32768), }, + {AOM_ICDF(18429), AOM_ICDF(28710), AOM_ICDF(32106), AOM_ICDF(32432), + AOM_ICDF(32768), }, + {AOM_ICDF(13601), AOM_ICDF(25238), AOM_ICDF(31845), AOM_ICDF(32262), + AOM_ICDF(32768), }, + {AOM_ICDF(12472), AOM_ICDF(20976), AOM_ICDF(29026), AOM_ICDF(30500), + AOM_ICDF(32768), }, + {AOM_ICDF(8738), AOM_ICDF(11469), AOM_ICDF(24030), AOM_ICDF(26761), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23359), AOM_ICDF(30038), AOM_ICDF(32127), AOM_ICDF(32444), + AOM_ICDF(32768), }, + {AOM_ICDF(19590), AOM_ICDF(28108), AOM_ICDF(32056), AOM_ICDF(32382), + AOM_ICDF(32768), }, + {AOM_ICDF(15578), AOM_ICDF(22024), AOM_ICDF(29008), AOM_ICDF(30619), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26372), AOM_ICDF(31019), AOM_ICDF(32146), AOM_ICDF(32463), + AOM_ICDF(32768), }, + {AOM_ICDF(22190), AOM_ICDF(28573), AOM_ICDF(32160), AOM_ICDF(32464), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(22938), AOM_ICDF(27853), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26672), AOM_ICDF(31311), AOM_ICDF(32156), AOM_ICDF(32462), + AOM_ICDF(32768), }, + {AOM_ICDF(20946), AOM_ICDF(27885), AOM_ICDF(31997), AOM_ICDF(32382), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(27342), AOM_ICDF(31385), AOM_ICDF(32130), AOM_ICDF(32449), + AOM_ICDF(32768), }, + {AOM_ICDF(8674), AOM_ICDF(22167), AOM_ICDF(26985), AOM_ICDF(29877), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 16X16 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(2479), AOM_ICDF(4993), AOM_ICDF(17332), AOM_ICDF(21885), + AOM_ICDF(25826), AOM_ICDF(32768), }, + {AOM_ICDF(2848), AOM_ICDF(5996), AOM_ICDF(15242), AOM_ICDF(20755), + AOM_ICDF(23763), AOM_ICDF(32768), }, + {AOM_ICDF(2125), AOM_ICDF(6226), AOM_ICDF(11733), AOM_ICDF(18389), + AOM_ICDF(20442), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(14539), AOM_ICDF(19828), AOM_ICDF(29467), AOM_ICDF(29934), + AOM_ICDF(32768), }, + {AOM_ICDF(12513), AOM_ICDF(19139), AOM_ICDF(29177), AOM_ICDF(29702), + AOM_ICDF(32768), }, + {AOM_ICDF(11826), AOM_ICDF(16348), AOM_ICDF(27245), AOM_ICDF(27977), + AOM_ICDF(32768), }, + {AOM_ICDF(10123), AOM_ICDF(12262), AOM_ICDF(24690), AOM_ICDF(25359), + AOM_ICDF(32768), }, + {AOM_ICDF(7979), AOM_ICDF(8826), AOM_ICDF(20804), AOM_ICDF(21295), + AOM_ICDF(32768), }, + {AOM_ICDF(5262), AOM_ICDF(5604), AOM_ICDF(14716), AOM_ICDF(15015), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(20625), AOM_ICDF(24118), AOM_ICDF(31086), AOM_ICDF(31446), + AOM_ICDF(32768), }, + {AOM_ICDF(16710), AOM_ICDF(20899), AOM_ICDF(30505), AOM_ICDF(30864), + AOM_ICDF(32768), }, + {AOM_ICDF(13161), AOM_ICDF(15579), AOM_ICDF(27988), AOM_ICDF(28449), + AOM_ICDF(32768), }, + {AOM_ICDF(10596), AOM_ICDF(11651), AOM_ICDF(24124), AOM_ICDF(24589), + AOM_ICDF(32768), }, + {AOM_ICDF(7724), AOM_ICDF(8452), AOM_ICDF(21060), AOM_ICDF(21476), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(9466), AOM_ICDF(18933), AOM_ICDF(21117), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24265), AOM_ICDF(26472), AOM_ICDF(31667), AOM_ICDF(31998), + AOM_ICDF(32768), }, + {AOM_ICDF(18213), AOM_ICDF(21117), AOM_ICDF(30932), AOM_ICDF(31280), + AOM_ICDF(32768), }, + {AOM_ICDF(12944), AOM_ICDF(14000), AOM_ICDF(27696), AOM_ICDF(28050), + AOM_ICDF(32768), }, + {AOM_ICDF(9709), AOM_ICDF(10056), AOM_ICDF(23282), AOM_ICDF(23579), + AOM_ICDF(32768), }, + {AOM_ICDF(8590), AOM_ICDF(9862), AOM_ICDF(18770), AOM_ICDF(19724), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26658), AOM_ICDF(28275), AOM_ICDF(31975), AOM_ICDF(32294), + AOM_ICDF(32768), }, + {AOM_ICDF(20049), AOM_ICDF(22203), AOM_ICDF(31374), AOM_ICDF(31708), + AOM_ICDF(32768), }, + {AOM_ICDF(12795), AOM_ICDF(13387), AOM_ICDF(28328), AOM_ICDF(28653), + AOM_ICDF(32768), }, + {AOM_ICDF(8607), AOM_ICDF(9073), AOM_ICDF(23383), AOM_ICDF(23695), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(9947), AOM_ICDF(18725), AOM_ICDF(20480), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(28651), AOM_ICDF(29902), AOM_ICDF(32085), AOM_ICDF(32402), + AOM_ICDF(32768), }, + {AOM_ICDF(21133), AOM_ICDF(23229), AOM_ICDF(31684), AOM_ICDF(32013), + AOM_ICDF(32768), }, + {AOM_ICDF(13231), AOM_ICDF(14045), AOM_ICDF(28203), AOM_ICDF(28576), + AOM_ICDF(32768), }, + {AOM_ICDF(7903), AOM_ICDF(8481), AOM_ICDF(21781), AOM_ICDF(22359), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(824), AOM_ICDF(8672), AOM_ICDF(16514), AOM_ICDF(27587), + AOM_ICDF(29231), AOM_ICDF(32768), }, + {AOM_ICDF(1118), AOM_ICDF(9561), AOM_ICDF(17021), AOM_ICDF(25911), + AOM_ICDF(27753), AOM_ICDF(32768), }, + {AOM_ICDF(806), AOM_ICDF(9313), AOM_ICDF(13998), AOM_ICDF(22910), + AOM_ICDF(25224), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(23650), AOM_ICDF(26487), AOM_ICDF(31840), AOM_ICDF(32166), + AOM_ICDF(32768), }, + {AOM_ICDF(19593), AOM_ICDF(25206), AOM_ICDF(31604), AOM_ICDF(31944), + AOM_ICDF(32768), }, + {AOM_ICDF(15813), AOM_ICDF(19643), AOM_ICDF(30328), AOM_ICDF(30726), + AOM_ICDF(32768), }, + {AOM_ICDF(12978), AOM_ICDF(15108), AOM_ICDF(27886), AOM_ICDF(28310), + AOM_ICDF(32768), }, + {AOM_ICDF(9793), AOM_ICDF(11020), AOM_ICDF(23305), AOM_ICDF(23818), + AOM_ICDF(32768), }, + {AOM_ICDF(4855), AOM_ICDF(5565), AOM_ICDF(14268), AOM_ICDF(14741), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(24547), AOM_ICDF(27751), AOM_ICDF(31964), AOM_ICDF(32285), + AOM_ICDF(32768), }, + {AOM_ICDF(19674), AOM_ICDF(23377), AOM_ICDF(31426), AOM_ICDF(31759), + AOM_ICDF(32768), }, + {AOM_ICDF(12643), AOM_ICDF(14489), AOM_ICDF(28159), AOM_ICDF(28541), + AOM_ICDF(32768), }, + {AOM_ICDF(9110), AOM_ICDF(10279), AOM_ICDF(23565), AOM_ICDF(23992), + AOM_ICDF(32768), }, + {AOM_ICDF(5082), AOM_ICDF(5617), AOM_ICDF(16317), AOM_ICDF(16651), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(18971), AOM_ICDF(24145), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26773), AOM_ICDF(29038), AOM_ICDF(32050), AOM_ICDF(32367), + AOM_ICDF(32768), }, + {AOM_ICDF(20956), AOM_ICDF(23898), AOM_ICDF(31563), AOM_ICDF(31888), + AOM_ICDF(32768), }, + {AOM_ICDF(12527), AOM_ICDF(13472), AOM_ICDF(27840), AOM_ICDF(28211), + AOM_ICDF(32768), }, + {AOM_ICDF(8773), AOM_ICDF(9353), AOM_ICDF(22555), AOM_ICDF(22856), + AOM_ICDF(32768), }, + {AOM_ICDF(4291), AOM_ICDF(4876), AOM_ICDF(16969), AOM_ICDF(17554), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(17348), AOM_ICDF(23130), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28065), AOM_ICDF(29768), AOM_ICDF(32086), AOM_ICDF(32400), + AOM_ICDF(32768), }, + {AOM_ICDF(21847), AOM_ICDF(24001), AOM_ICDF(31608), AOM_ICDF(31929), + AOM_ICDF(32768), }, + {AOM_ICDF(12482), AOM_ICDF(13091), AOM_ICDF(27413), AOM_ICDF(27739), + AOM_ICDF(32768), }, + {AOM_ICDF(7582), AOM_ICDF(8002), AOM_ICDF(22090), AOM_ICDF(22405), + AOM_ICDF(32768), }, + {AOM_ICDF(6324), AOM_ICDF(7186), AOM_ICDF(15809), AOM_ICDF(16671), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29731), AOM_ICDF(30798), AOM_ICDF(32113), AOM_ICDF(32431), + AOM_ICDF(32768), }, + {AOM_ICDF(22224), AOM_ICDF(24448), AOM_ICDF(31791), AOM_ICDF(32118), + AOM_ICDF(32768), }, + {AOM_ICDF(12622), AOM_ICDF(13513), AOM_ICDF(28103), AOM_ICDF(28530), + AOM_ICDF(32768), }, + {AOM_ICDF(8886), AOM_ICDF(9600), AOM_ICDF(22890), AOM_ICDF(23604), + AOM_ICDF(32768), }, + {AOM_ICDF(8058), AOM_ICDF(9669), AOM_ICDF(18264), AOM_ICDF(19876), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(27375), AOM_ICDF(27731), AOM_ICDF(31591), AOM_ICDF(31993), + AOM_ICDF(32404), AOM_ICDF(32768), }, + {AOM_ICDF(20943), AOM_ICDF(21758), AOM_ICDF(30037), AOM_ICDF(31074), + AOM_ICDF(32003), AOM_ICDF(32768), }, + {AOM_ICDF(16218), AOM_ICDF(17771), AOM_ICDF(26832), AOM_ICDF(29181), + AOM_ICDF(30586), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17239), AOM_ICDF(27853), AOM_ICDF(31557), AOM_ICDF(32198), + AOM_ICDF(32768), }, + {AOM_ICDF(14494), AOM_ICDF(25906), AOM_ICDF(31543), AOM_ICDF(32033), + AOM_ICDF(32768), }, + {AOM_ICDF(12980), AOM_ICDF(19788), AOM_ICDF(29137), AOM_ICDF(29410), + AOM_ICDF(32768), }, + {AOM_ICDF(11796), AOM_ICDF(14680), AOM_ICDF(26477), AOM_ICDF(27787), + AOM_ICDF(32768), }, + {AOM_ICDF(12603), AOM_ICDF(15124), AOM_ICDF(21005), AOM_ICDF(23526), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(22821), AOM_ICDF(27655), AOM_ICDF(32024), AOM_ICDF(32303), + AOM_ICDF(32768), }, + {AOM_ICDF(16534), AOM_ICDF(23629), AOM_ICDF(31145), AOM_ICDF(31686), + AOM_ICDF(32768), }, + {AOM_ICDF(12407), AOM_ICDF(14952), AOM_ICDF(28950), AOM_ICDF(30859), + AOM_ICDF(32768), }, + {AOM_ICDF(6554), AOM_ICDF(10486), AOM_ICDF(19661), AOM_ICDF(23593), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(26369), AOM_ICDF(29624), AOM_ICDF(31996), AOM_ICDF(32272), + AOM_ICDF(32768), }, + {AOM_ICDF(19346), AOM_ICDF(24807), AOM_ICDF(31750), AOM_ICDF(32027), + AOM_ICDF(32768), }, + {AOM_ICDF(15056), AOM_ICDF(19484), AOM_ICDF(27454), AOM_ICDF(30111), + AOM_ICDF(32768), }, + {AOM_ICDF(5783), AOM_ICDF(11565), AOM_ICDF(21203), AOM_ICDF(26985), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28213), AOM_ICDF(30301), AOM_ICDF(32199), AOM_ICDF(32483), + AOM_ICDF(32768), }, + {AOM_ICDF(22988), AOM_ICDF(27307), AOM_ICDF(31879), AOM_ICDF(32260), + AOM_ICDF(32768), }, + {AOM_ICDF(11796), AOM_ICDF(15729), AOM_ICDF(24904), AOM_ICDF(28836), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29813), AOM_ICDF(31323), AOM_ICDF(32142), AOM_ICDF(32444), + AOM_ICDF(32768), }, + {AOM_ICDF(21497), AOM_ICDF(25254), AOM_ICDF(31307), AOM_ICDF(32142), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(30560), AOM_ICDF(30889), AOM_ICDF(31795), AOM_ICDF(32128), + AOM_ICDF(32455), AOM_ICDF(32768), }, + {AOM_ICDF(20347), AOM_ICDF(20993), AOM_ICDF(30496), AOM_ICDF(31112), + AOM_ICDF(32263), AOM_ICDF(32768), }, + {AOM_ICDF(9723), AOM_ICDF(10992), AOM_ICDF(27830), AOM_ICDF(28681), + AOM_ICDF(32168), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(25900), AOM_ICDF(30610), AOM_ICDF(32179), AOM_ICDF(32474), + AOM_ICDF(32768), }, + {AOM_ICDF(18535), AOM_ICDF(29316), AOM_ICDF(32153), AOM_ICDF(32437), + AOM_ICDF(32768), }, + {AOM_ICDF(15230), AOM_ICDF(25845), AOM_ICDF(30922), AOM_ICDF(31845), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(16384), AOM_ICDF(27097), AOM_ICDF(28987), + AOM_ICDF(32768), }, + {AOM_ICDF(8548), AOM_ICDF(12822), AOM_ICDF(21370), AOM_ICDF(25645), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(26104), AOM_ICDF(30659), AOM_ICDF(32157), AOM_ICDF(32462), + AOM_ICDF(32768), }, + {AOM_ICDF(20457), AOM_ICDF(28242), AOM_ICDF(31682), AOM_ICDF(32225), + AOM_ICDF(32768), }, + {AOM_ICDF(10923), AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(28672), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(28740), AOM_ICDF(30618), AOM_ICDF(32154), AOM_ICDF(32461), + AOM_ICDF(32768), }, + {AOM_ICDF(19333), AOM_ICDF(26214), AOM_ICDF(30802), AOM_ICDF(31785), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28161), AOM_ICDF(30834), AOM_ICDF(32160), AOM_ICDF(32464), + AOM_ICDF(32768), }, + {AOM_ICDF(26536), AOM_ICDF(29149), AOM_ICDF(31562), AOM_ICDF(32165), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(29913), AOM_ICDF(31560), AOM_ICDF(32172), AOM_ICDF(32470), + AOM_ICDF(32768), }, + {AOM_ICDF(22209), AOM_ICDF(28035), AOM_ICDF(30583), AOM_ICDF(31676), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, + { // TX 32X32 + { // Y plane + { // Intra + { // Band 0 + {AOM_ICDF(3982), AOM_ICDF(6433), AOM_ICDF(20418), AOM_ICDF(25151), + AOM_ICDF(27471), AOM_ICDF(32768), }, + {AOM_ICDF(3342), AOM_ICDF(6943), AOM_ICDF(15018), AOM_ICDF(20274), + AOM_ICDF(22412), AOM_ICDF(32768), }, + {AOM_ICDF(1805), AOM_ICDF(5863), AOM_ICDF(9932), AOM_ICDF(16426), + AOM_ICDF(17655), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(11799), AOM_ICDF(19138), AOM_ICDF(28295), AOM_ICDF(28881), + AOM_ICDF(32768), }, + {AOM_ICDF(11008), AOM_ICDF(18597), AOM_ICDF(28369), AOM_ICDF(29021), + AOM_ICDF(32768), }, + {AOM_ICDF(10104), AOM_ICDF(15628), AOM_ICDF(26339), AOM_ICDF(27195), + AOM_ICDF(32768), }, + {AOM_ICDF(8537), AOM_ICDF(11246), AOM_ICDF(22663), AOM_ICDF(23623), + AOM_ICDF(32768), }, + {AOM_ICDF(5895), AOM_ICDF(6476), AOM_ICDF(16647), AOM_ICDF(17329), + AOM_ICDF(32768), }, + {AOM_ICDF(4046), AOM_ICDF(4357), AOM_ICDF(10849), AOM_ICDF(11160), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(18503), AOM_ICDF(22222), AOM_ICDF(30403), AOM_ICDF(30814), + AOM_ICDF(32768), }, + {AOM_ICDF(15264), AOM_ICDF(19282), AOM_ICDF(29949), AOM_ICDF(30339), + AOM_ICDF(32768), }, + {AOM_ICDF(12101), AOM_ICDF(14721), AOM_ICDF(27350), AOM_ICDF(27783), + AOM_ICDF(32768), }, + {AOM_ICDF(9243), AOM_ICDF(10177), AOM_ICDF(22679), AOM_ICDF(23097), + AOM_ICDF(32768), }, + {AOM_ICDF(5571), AOM_ICDF(5967), AOM_ICDF(16714), AOM_ICDF(17043), + AOM_ICDF(32768), }, + {AOM_ICDF(2731), AOM_ICDF(3755), AOM_ICDF(14677), AOM_ICDF(15701), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(23077), AOM_ICDF(25272), AOM_ICDF(31444), AOM_ICDF(31771), + AOM_ICDF(32768), }, + {AOM_ICDF(16598), AOM_ICDF(19790), AOM_ICDF(30479), AOM_ICDF(30822), + AOM_ICDF(32768), }, + {AOM_ICDF(11961), AOM_ICDF(12871), AOM_ICDF(27162), AOM_ICDF(27529), + AOM_ICDF(32768), }, + {AOM_ICDF(8156), AOM_ICDF(8563), AOM_ICDF(22220), AOM_ICDF(22579), + AOM_ICDF(32768), }, + {AOM_ICDF(5851), AOM_ICDF(6242), AOM_ICDF(15994), AOM_ICDF(16384), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(26084), AOM_ICDF(27933), AOM_ICDF(31906), AOM_ICDF(32223), + AOM_ICDF(32768), }, + {AOM_ICDF(19335), AOM_ICDF(21760), AOM_ICDF(31149), AOM_ICDF(31477), + AOM_ICDF(32768), }, + {AOM_ICDF(12724), AOM_ICDF(13278), AOM_ICDF(27015), AOM_ICDF(27365), + AOM_ICDF(32768), }, + {AOM_ICDF(8687), AOM_ICDF(9010), AOM_ICDF(21051), AOM_ICDF(21334), + AOM_ICDF(32768), }, + {AOM_ICDF(5814), AOM_ICDF(6606), AOM_ICDF(14534), AOM_ICDF(15327), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(18432), AOM_ICDF(24576), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30147), AOM_ICDF(30787), AOM_ICDF(32081), AOM_ICDF(32395), + AOM_ICDF(32768), }, + {AOM_ICDF(20402), AOM_ICDF(21697), AOM_ICDF(30943), AOM_ICDF(31266), + AOM_ICDF(32768), }, + {AOM_ICDF(11661), AOM_ICDF(12125), AOM_ICDF(25710), AOM_ICDF(26034), + AOM_ICDF(32768), }, + {AOM_ICDF(7224), AOM_ICDF(7504), AOM_ICDF(19876), AOM_ICDF(20156), + AOM_ICDF(32768), }, + {AOM_ICDF(6183), AOM_ICDF(7110), AOM_ICDF(17002), AOM_ICDF(17930), + AOM_ICDF(32768), }, + {AOM_ICDF(5174), AOM_ICDF(10348), AOM_ICDF(17246), AOM_ICDF(22420), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(4079), AOM_ICDF(8378), AOM_ICDF(25109), AOM_ICDF(29897), + AOM_ICDF(30898), AOM_ICDF(32768), }, + {AOM_ICDF(3870), AOM_ICDF(8207), AOM_ICDF(22495), AOM_ICDF(27162), + AOM_ICDF(29559), AOM_ICDF(32768), }, + {AOM_ICDF(2127), AOM_ICDF(6197), AOM_ICDF(15932), AOM_ICDF(20604), + AOM_ICDF(27312), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(21253), AOM_ICDF(26168), AOM_ICDF(31780), AOM_ICDF(32120), + AOM_ICDF(32768), }, + {AOM_ICDF(16610), AOM_ICDF(23985), AOM_ICDF(31495), AOM_ICDF(31866), + AOM_ICDF(32768), }, + {AOM_ICDF(14861), AOM_ICDF(21030), AOM_ICDF(30219), AOM_ICDF(30784), + AOM_ICDF(32768), }, + {AOM_ICDF(14573), AOM_ICDF(18162), AOM_ICDF(28524), AOM_ICDF(29116), + AOM_ICDF(32768), }, + {AOM_ICDF(14036), AOM_ICDF(15983), AOM_ICDF(26283), AOM_ICDF(27085), + AOM_ICDF(32768), }, + {AOM_ICDF(9119), AOM_ICDF(10742), AOM_ICDF(19630), AOM_ICDF(20016), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23192), AOM_ICDF(27248), AOM_ICDF(31887), AOM_ICDF(32215), + AOM_ICDF(32768), }, + {AOM_ICDF(18219), AOM_ICDF(23213), AOM_ICDF(31417), AOM_ICDF(31769), + AOM_ICDF(32768), }, + {AOM_ICDF(12657), AOM_ICDF(14754), AOM_ICDF(27845), AOM_ICDF(28233), + AOM_ICDF(32768), }, + {AOM_ICDF(8127), AOM_ICDF(8829), AOM_ICDF(20909), AOM_ICDF(21279), + AOM_ICDF(32768), }, + {AOM_ICDF(7547), AOM_ICDF(8142), AOM_ICDF(17476), AOM_ICDF(18072), + AOM_ICDF(32768), }, + {AOM_ICDF(5461), AOM_ICDF(10923), AOM_ICDF(16384), AOM_ICDF(21845), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(25516), AOM_ICDF(28301), AOM_ICDF(31970), AOM_ICDF(32289), + AOM_ICDF(32768), }, + {AOM_ICDF(19094), AOM_ICDF(23041), AOM_ICDF(31404), AOM_ICDF(31732), + AOM_ICDF(32768), }, + {AOM_ICDF(12328), AOM_ICDF(13099), AOM_ICDF(27275), AOM_ICDF(27613), + AOM_ICDF(32768), }, + {AOM_ICDF(8134), AOM_ICDF(8458), AOM_ICDF(21075), AOM_ICDF(21352), + AOM_ICDF(32768), }, + {AOM_ICDF(5041), AOM_ICDF(5881), AOM_ICDF(17644), AOM_ICDF(18485), + AOM_ICDF(32768), }, + {AOM_ICDF(7282), AOM_ICDF(12743), AOM_ICDF(18204), AOM_ICDF(23666), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28082), AOM_ICDF(29782), AOM_ICDF(32087), AOM_ICDF(32400), + AOM_ICDF(32768), }, + {AOM_ICDF(21281), AOM_ICDF(24161), AOM_ICDF(31679), AOM_ICDF(31997), + AOM_ICDF(32768), }, + {AOM_ICDF(12144), AOM_ICDF(12913), AOM_ICDF(27139), AOM_ICDF(27460), + AOM_ICDF(32768), }, + {AOM_ICDF(8232), AOM_ICDF(8472), AOM_ICDF(21659), AOM_ICDF(21979), + AOM_ICDF(32768), }, + {AOM_ICDF(3034), AOM_ICDF(4855), AOM_ICDF(17598), AOM_ICDF(19418), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30193), AOM_ICDF(31021), AOM_ICDF(32122), AOM_ICDF(32435), + AOM_ICDF(32768), }, + {AOM_ICDF(22124), AOM_ICDF(23763), AOM_ICDF(31498), AOM_ICDF(31816), + AOM_ICDF(32768), }, + {AOM_ICDF(12066), AOM_ICDF(12418), AOM_ICDF(26849), AOM_ICDF(27157), + AOM_ICDF(32768), }, + {AOM_ICDF(8701), AOM_ICDF(8979), AOM_ICDF(20920), AOM_ICDF(21197), + AOM_ICDF(32768), }, + {AOM_ICDF(5266), AOM_ICDF(7022), AOM_ICDF(15799), AOM_ICDF(17554), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + { // UV plane + { // Intra + { // Band 0 + {AOM_ICDF(23468), AOM_ICDF(24062), AOM_ICDF(30645), AOM_ICDF(31200), + AOM_ICDF(32193), AOM_ICDF(32768), }, + {AOM_ICDF(12642), AOM_ICDF(14371), AOM_ICDF(26924), AOM_ICDF(28832), + AOM_ICDF(31098), AOM_ICDF(32768), }, + {AOM_ICDF(7785), AOM_ICDF(8831), AOM_ICDF(23705), AOM_ICDF(26028), + AOM_ICDF(29979), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(13575), AOM_ICDF(28087), AOM_ICDF(31130), AOM_ICDF(31832), + AOM_ICDF(32768), }, + {AOM_ICDF(11108), AOM_ICDF(27955), AOM_ICDF(31657), AOM_ICDF(32213), + AOM_ICDF(32768), }, + {AOM_ICDF(9797), AOM_ICDF(23985), AOM_ICDF(28039), AOM_ICDF(30741), + AOM_ICDF(32768), }, + {AOM_ICDF(5578), AOM_ICDF(18824), AOM_ICDF(26493), AOM_ICDF(28585), + AOM_ICDF(32768), }, + {AOM_ICDF(5041), AOM_ICDF(12603), AOM_ICDF(18905), AOM_ICDF(22686), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(17613), AOM_ICDF(26624), AOM_ICDF(30310), AOM_ICDF(31539), + AOM_ICDF(32768), }, + {AOM_ICDF(11398), AOM_ICDF(22795), AOM_ICDF(29444), AOM_ICDF(30868), + AOM_ICDF(32768), }, + {AOM_ICDF(8548), AOM_ICDF(15672), AOM_ICDF(22795), AOM_ICDF(28494), + AOM_ICDF(32768), }, + {AOM_ICDF(6144), AOM_ICDF(12288), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24145), AOM_ICDF(26301), AOM_ICDF(30181), AOM_ICDF(31475), + AOM_ICDF(32768), }, + {AOM_ICDF(15565), AOM_ICDF(20480), AOM_ICDF(27853), AOM_ICDF(30310), + AOM_ICDF(32768), }, + {AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(20480), AOM_ICDF(26624), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(27434), AOM_ICDF(28450), AOM_ICDF(30990), AOM_ICDF(31752), + AOM_ICDF(32768), }, + {AOM_ICDF(14947), AOM_ICDF(21845), AOM_ICDF(29319), AOM_ICDF(31043), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(31130), AOM_ICDF(31676), AOM_ICDF(32180), AOM_ICDF(32474), + AOM_ICDF(32768), }, + {AOM_ICDF(18289), AOM_ICDF(22099), AOM_ICDF(28196), AOM_ICDF(30482), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + { // Inter + { // Band 0 + {AOM_ICDF(29436), AOM_ICDF(29775), AOM_ICDF(31685), AOM_ICDF(32029), + AOM_ICDF(32425), AOM_ICDF(32768), }, + {AOM_ICDF(10536), AOM_ICDF(11074), AOM_ICDF(27753), AOM_ICDF(28385), + AOM_ICDF(31293), AOM_ICDF(32768), }, + {AOM_ICDF(3010), AOM_ICDF(3521), AOM_ICDF(22603), AOM_ICDF(23227), + AOM_ICDF(30440), AOM_ICDF(32768), }, + }, + { // Band 1 + {AOM_ICDF(17576), AOM_ICDF(29491), AOM_ICDF(30981), AOM_ICDF(31874), + AOM_ICDF(32768), }, + {AOM_ICDF(10426), AOM_ICDF(29044), AOM_ICDF(31725), AOM_ICDF(32321), + AOM_ICDF(32768), }, + {AOM_ICDF(15766), AOM_ICDF(28286), AOM_ICDF(31377), AOM_ICDF(32304), + AOM_ICDF(32768), }, + {AOM_ICDF(19661), AOM_ICDF(26985), AOM_ICDF(30069), AOM_ICDF(31611), + AOM_ICDF(32768), }, + {AOM_ICDF(16035), AOM_ICDF(23007), AOM_ICDF(28585), AOM_ICDF(30676), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 2 + {AOM_ICDF(23073), AOM_ICDF(30053), AOM_ICDF(31605), AOM_ICDF(32186), + AOM_ICDF(32768), }, + {AOM_ICDF(12858), AOM_ICDF(24887), AOM_ICDF(30279), AOM_ICDF(31524), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 3 + {AOM_ICDF(24030), AOM_ICDF(26839), AOM_ICDF(30896), AOM_ICDF(31832), + AOM_ICDF(32768), }, + {AOM_ICDF(17644), AOM_ICDF(23526), AOM_ICDF(27727), AOM_ICDF(30247), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 4 + {AOM_ICDF(28019), AOM_ICDF(30156), AOM_ICDF(31343), AOM_ICDF(32056), + AOM_ICDF(32768), }, + {AOM_ICDF(14980), AOM_ICDF(22469), AOM_ICDF(27151), AOM_ICDF(29959), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + { // Band 5 + {AOM_ICDF(30549), AOM_ICDF(31511), AOM_ICDF(32176), AOM_ICDF(32472), + AOM_ICDF(32768), }, + {AOM_ICDF(15019), AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + {AOM_ICDF(6553), AOM_ICDF(13107), AOM_ICDF(19660), AOM_ICDF(26214), + AOM_ICDF(32768), }, + }, + }, + }, + }, +}; +/* clang-format on */ + +typedef coeff_cdf_model coeff_cdf_table[TX_SIZES][PLANE_TYPES]; +static const coeff_cdf_table *av1_default_qctx_coef_cdfs[TOKEN_CDF_Q_CTXS] = { + &av1_default_coef_head_cdfs_q0, &av1_default_coef_head_cdfs_q1, + &av1_default_coef_head_cdfs_q2, &av1_default_coef_head_cdfs_q3, +}; diff --git a/third_party/aom/av1/common/txb_common.c b/third_party/aom/av1/common/txb_common.c index eb66ba175..c5b91e991 100644 --- a/third_party/aom/av1/common/txb_common.c +++ b/third_party/aom/av1/common/txb_common.c @@ -10,6 +10,7 @@ */ #include "aom/aom_integer.h" #include "av1/common/onyxc_int.h" +#include "av1/common/txb_common.h" const int16_t av1_coeff_band_4x4[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -95,6 +96,123 @@ const int16_t av1_coeff_band_32x32[1024] = { 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, }; +#if LV_MAP_PROB +void av1_init_txb_probs(FRAME_CONTEXT *fc) { + TX_SIZE tx_size; + int plane, ctx, level; + + // Update probability models for transform block skip flag + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (ctx = 0; ctx < TXB_SKIP_CONTEXTS; ++ctx) { + fc->txb_skip_cdf[tx_size][ctx][0] = + AOM_ICDF(128 * (aom_cdf_prob)fc->txb_skip[tx_size][ctx]); + fc->txb_skip_cdf[tx_size][ctx][1] = AOM_ICDF(32768); + fc->txb_skip_cdf[tx_size][ctx][2] = 0; + } + } + + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (ctx = 0; ctx < DC_SIGN_CONTEXTS; ++ctx) { + fc->dc_sign_cdf[plane][ctx][0] = + AOM_ICDF(128 * (aom_cdf_prob)fc->dc_sign[plane][ctx]); + fc->dc_sign_cdf[plane][ctx][1] = AOM_ICDF(32768); + fc->dc_sign_cdf[plane][ctx][2] = 0; + } + } + + // Update probability models for non-zero coefficient map and eob flag. + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (level = 0; level < NUM_BASE_LEVELS; ++level) { + for (ctx = 0; ctx < COEFF_BASE_CONTEXTS; ++ctx) { + fc->coeff_base_cdf[tx_size][plane][level][ctx][0] = AOM_ICDF( + 128 * (aom_cdf_prob)fc->coeff_base[tx_size][plane][level][ctx]); + fc->coeff_base_cdf[tx_size][plane][level][ctx][1] = AOM_ICDF(32768); + fc->coeff_base_cdf[tx_size][plane][level][ctx][2] = 0; + } + } + } + } + + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (ctx = 0; ctx < SIG_COEF_CONTEXTS; ++ctx) { + fc->nz_map_cdf[tx_size][plane][ctx][0] = + AOM_ICDF(128 * (aom_cdf_prob)fc->nz_map[tx_size][plane][ctx]); + fc->nz_map_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768); + fc->nz_map_cdf[tx_size][plane][ctx][2] = 0; + } + + for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx) { + fc->eob_flag_cdf[tx_size][plane][ctx][0] = + AOM_ICDF(128 * (aom_cdf_prob)fc->eob_flag[tx_size][plane][ctx]); + fc->eob_flag_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768); + fc->eob_flag_cdf[tx_size][plane][ctx][2] = 0; + } + } + } + + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) { + fc->coeff_lps_cdf[tx_size][plane][ctx][0] = + AOM_ICDF(128 * (aom_cdf_prob)fc->coeff_lps[tx_size][plane][ctx]); + fc->coeff_lps_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768); + fc->coeff_lps_cdf[tx_size][plane][ctx][2] = 0; + } +#if BR_NODE + for (int br = 0; br < BASE_RANGE_SETS; ++br) { + for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) { + fc->coeff_br_cdf[tx_size][plane][br][ctx][0] = AOM_ICDF( + 128 * (aom_cdf_prob)fc->coeff_br[tx_size][plane][br][ctx]); + fc->coeff_br_cdf[tx_size][plane][br][ctx][1] = AOM_ICDF(32768); + fc->coeff_br_cdf[tx_size][plane][br][ctx][2] = 0; + } + } +#endif // BR_NODE + } + } +#if CONFIG_CTX1D + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) { + fc->eob_mode_cdf[tx_size][plane][tx_class][0] = AOM_ICDF( + 128 * (aom_cdf_prob)fc->eob_mode[tx_size][plane][tx_class]); + fc->eob_mode_cdf[tx_size][plane][tx_class][1] = AOM_ICDF(32768); + fc->eob_mode_cdf[tx_size][plane][tx_class][2] = 0; + } + } + } + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) { + for (ctx = 0; ctx < EMPTY_LINE_CONTEXTS; ++ctx) { + fc->empty_line_cdf[tx_size][plane][tx_class][ctx][0] = AOM_ICDF( + 128 * + (aom_cdf_prob)fc->empty_line[tx_size][plane][tx_class][ctx]); + fc->empty_line_cdf[tx_size][plane][tx_class][ctx][1] = + AOM_ICDF(32768); + fc->empty_line_cdf[tx_size][plane][tx_class][ctx][2] = 0; + } + } + } + } + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) { + for (ctx = 0; ctx < HV_EOB_CONTEXTS; ++ctx) { + fc->hv_eob_cdf[tx_size][plane][tx_class][ctx][0] = AOM_ICDF( + 128 * (aom_cdf_prob)fc->hv_eob[tx_size][plane][tx_class][ctx]); + fc->hv_eob_cdf[tx_size][plane][tx_class][ctx][1] = AOM_ICDF(32768); + fc->hv_eob_cdf[tx_size][plane][tx_class][ctx][2] = 0; + } + } + } + } +#endif // CONFIG_CTX1D +} +#endif // LV_MAP_PROB + void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat, unsigned int update_factor) { FRAME_CONTEXT *fc = cm->fc; @@ -141,10 +259,64 @@ void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat, } for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { - for (plane = 0; plane < PLANE_TYPES; ++plane) - for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) + for (plane = 0; plane < PLANE_TYPES; ++plane) { + for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) { fc->coeff_lps[tx_size][plane][ctx] = merge_probs( pre_fc->coeff_lps[tx_size][plane][ctx], counts->coeff_lps[tx_size][plane][ctx], count_sat, update_factor); + } +#if BR_NODE + for (int br = 0; br < BASE_RANGE_SETS; ++br) { + for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) { + fc->coeff_br[tx_size][plane][br][ctx] = + merge_probs(pre_fc->coeff_br[tx_size][plane][br][ctx], + counts->coeff_br[tx_size][plane][br][ctx], count_sat, + update_factor); + } + } +#endif // BR_NODE + } + } +#if CONFIG_CTX1D + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) + fc->eob_mode[tx_size][plane][tx_class] = + merge_probs(pre_fc->eob_mode[tx_size][plane][tx_class], + counts->eob_mode[tx_size][plane][tx_class], count_sat, + update_factor); + } + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) + for (ctx = 0; ctx < EMPTY_LINE_CONTEXTS; ++ctx) + fc->empty_line[tx_size][plane][tx_class][ctx] = + merge_probs(pre_fc->empty_line[tx_size][plane][tx_class][ctx], + counts->empty_line[tx_size][plane][tx_class][ctx], + count_sat, update_factor); + } + for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) { + for (plane = 0; plane < PLANE_TYPES; ++plane) + for (int tx_class = 0; tx_class < TX_CLASSES; ++tx_class) + for (ctx = 0; ctx < HV_EOB_CONTEXTS; ++ctx) + fc->hv_eob[tx_size][plane][tx_class][ctx] = + merge_probs(pre_fc->hv_eob[tx_size][plane][tx_class][ctx], + counts->hv_eob[tx_size][plane][tx_class][ctx], + count_sat, update_factor); + } +#endif +} + +void av1_init_lv_map(AV1_COMMON *cm) { + LV_MAP_CTX_TABLE *coeff_ctx_table = &cm->coeff_ctx_table; + for (int row = 0; row < 2; ++row) { + for (int col = 0; col < 2; ++col) { + for (int sig_mag = 0; sig_mag < 2; ++sig_mag) { + for (int count = 0; count < BASE_CONTEXT_POSITION_NUM + 1; ++count) { + coeff_ctx_table->base_ctx_table[row][col][sig_mag][count] = + get_base_ctx_from_count_mag(row, col, count, sig_mag); + } + } + } } } diff --git a/third_party/aom/av1/common/txb_common.h b/third_party/aom/av1/common/txb_common.h index 5620a70a9..3bf8f8c61 100644 --- a/third_party/aom/av1/common/txb_common.h +++ b/third_party/aom/av1/common/txb_common.h @@ -11,6 +11,10 @@ #ifndef AV1_COMMON_TXB_COMMON_H_ #define AV1_COMMON_TXB_COMMON_H_ + +#define REDUCE_CONTEXT_DEPENDENCY 0 +#define MIN_SCAN_IDX_REDUCE_CONTEXT_DEPENDENCY 0 + extern const int16_t av1_coeff_band_4x4[16]; extern const int16_t av1_coeff_band_8x8[64]; @@ -28,7 +32,6 @@ static INLINE TX_SIZE get_txsize_context(TX_SIZE tx_size) { return txsize_sqr_up_map[tx_size]; } -#define BASE_CONTEXT_POSITION_NUM 12 static int base_ref_offset[BASE_CONTEXT_POSITION_NUM][2] = { /* clang-format off*/ { -2, 0 }, { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -2 }, { 0, -1 }, { 0, 1 }, @@ -36,23 +39,24 @@ static int base_ref_offset[BASE_CONTEXT_POSITION_NUM][2] = { /* clang-format on*/ }; -static INLINE int get_level_count(const tran_low_t *tcoeffs, int stride, +static INLINE int get_level_count(const tran_low_t *tcoeffs, int bwl, int height, int row, int col, int level, int (*nb_offset)[2], int nb_num) { int count = 0; for (int idx = 0; idx < nb_num; ++idx) { const int ref_row = row + nb_offset[idx][0]; const int ref_col = col + nb_offset[idx][1]; - const int pos = ref_row * stride + ref_col; - if (ref_row < 0 || ref_col < 0 || ref_row >= height || ref_col >= stride) + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl)) continue; + const int pos = (ref_row << bwl) + ref_col; tran_low_t abs_coeff = abs(tcoeffs[pos]); count += abs_coeff > level; } return count; } -static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int stride, +static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int bwl, int height, int row, int col, int (*nb_offset)[2], int nb_num) { mag[0] = 0; @@ -60,9 +64,10 @@ static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int stride, for (int idx = 0; idx < nb_num; ++idx) { const int ref_row = row + nb_offset[idx][0]; const int ref_col = col + nb_offset[idx][1]; - const int pos = ref_row * stride + ref_col; - if (ref_row < 0 || ref_col < 0 || ref_row >= height || ref_col >= stride) + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl)) continue; + const int pos = (ref_row << bwl) + ref_col; tran_low_t abs_coeff = abs(tcoeffs[pos]); if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0) { if (abs_coeff > mag[0]) { @@ -74,18 +79,50 @@ static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int stride, } } } + +static INLINE void get_base_count_mag(int *mag, int *count, + const tran_low_t *tcoeffs, int bwl, + int height, int row, int col) { + mag[0] = 0; + mag[1] = 0; + for (int i = 0; i < NUM_BASE_LEVELS; ++i) count[i] = 0; + for (int idx = 0; idx < BASE_CONTEXT_POSITION_NUM; ++idx) { + const int ref_row = row + base_ref_offset[idx][0]; + const int ref_col = col + base_ref_offset[idx][1]; + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl)) + continue; + const int pos = (ref_row << bwl) + ref_col; + tran_low_t abs_coeff = abs(tcoeffs[pos]); + // count + for (int i = 0; i < NUM_BASE_LEVELS; ++i) { + count[i] += abs_coeff > i; + } + // mag + if (base_ref_offset[idx][0] >= 0 && base_ref_offset[idx][1] >= 0) { + if (abs_coeff > mag[0]) { + mag[0] = abs_coeff; + mag[1] = 1; + } else if (abs_coeff == mag[0]) { + ++mag[1]; + } + } + } +} + static INLINE int get_level_count_mag(int *mag, const tran_low_t *tcoeffs, - int stride, int height, int row, int col, + int bwl, int height, int row, int col, int level, int (*nb_offset)[2], int nb_num) { + const int stride = 1 << bwl; int count = 0; *mag = 0; for (int idx = 0; idx < nb_num; ++idx) { const int ref_row = row + nb_offset[idx][0]; const int ref_col = col + nb_offset[idx][1]; - const int pos = ref_row * stride + ref_col; if (ref_row < 0 || ref_col < 0 || ref_row >= height || ref_col >= stride) continue; + const int pos = (ref_row << bwl) + ref_col; tran_low_t abs_coeff = abs(tcoeffs[pos]); count += abs_coeff > level; if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0) @@ -95,19 +132,21 @@ static INLINE int get_level_count_mag(int *mag, const tran_low_t *tcoeffs, } static INLINE int get_base_ctx_from_count_mag(int row, int col, int count, - int mag, int level) { + int sig_mag) { const int ctx = (count + 1) >> 1; - const int sig_mag = mag > level; int ctx_idx = -1; if (row == 0 && col == 0) { ctx_idx = (ctx << 1) + sig_mag; - assert(ctx_idx < 8); + // TODO(angiebird): turn this on once the optimization is finalized + // assert(ctx_idx < 8); } else if (row == 0) { ctx_idx = 8 + (ctx << 1) + sig_mag; - assert(ctx_idx < 18); + // TODO(angiebird): turn this on once the optimization is finalized + // assert(ctx_idx < 18); } else if (col == 0) { ctx_idx = 8 + 10 + (ctx << 1) + sig_mag; - assert(ctx_idx < 28); + // TODO(angiebird): turn this on once the optimization is finalized + // assert(ctx_idx < 28); } else { ctx_idx = 8 + 10 + 10 + (ctx << 1) + sig_mag; assert(ctx_idx < COEFF_BASE_CONTEXTS); @@ -119,15 +158,14 @@ static INLINE int get_base_ctx(const tran_low_t *tcoeffs, int c, // raster order const int bwl, const int height, const int level) { - const int stride = 1 << bwl; const int row = c >> bwl; const int col = c - (row << bwl); const int level_minus_1 = level - 1; int mag; - int count = get_level_count_mag(&mag, tcoeffs, stride, height, row, col, - level_minus_1, base_ref_offset, - BASE_CONTEXT_POSITION_NUM); - int ctx_idx = get_base_ctx_from_count_mag(row, col, count, mag, level); + int count = + get_level_count_mag(&mag, tcoeffs, bwl, height, row, col, level_minus_1, + base_ref_offset, BASE_CONTEXT_POSITION_NUM); + int ctx_idx = get_base_ctx_from_count_mag(row, col, count, mag > level); return ctx_idx; } @@ -139,13 +177,52 @@ static int br_ref_offset[BR_CONTEXT_POSITION_NUM][2] = { /* clang-format on*/ }; -static int br_level_map[9] = { +static const int br_level_map[9] = { 0, 0, 1, 1, 2, 2, 3, 3, 3, }; +static const int coeff_to_br_index[COEFF_BASE_RANGE] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, +}; + +static const int br_index_to_coeff[BASE_RANGE_SETS] = { + 0, 2, 6, +}; + +static const int br_extra_bits[BASE_RANGE_SETS] = { + 1, 2, 3, +}; + #define BR_MAG_OFFSET 1 // TODO(angiebird): optimize this function by using a table to map from // count/mag to ctx + +static INLINE int get_br_count_mag(int *mag, const tran_low_t *tcoeffs, int bwl, + int height, int row, int col, int level) { + mag[0] = 0; + mag[1] = 0; + int count = 0; + for (int idx = 0; idx < BR_CONTEXT_POSITION_NUM; ++idx) { + const int ref_row = row + br_ref_offset[idx][0]; + const int ref_col = col + br_ref_offset[idx][1]; + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl)) + continue; + const int pos = (ref_row << bwl) + ref_col; + tran_low_t abs_coeff = abs(tcoeffs[pos]); + count += abs_coeff > level; + if (br_ref_offset[idx][0] >= 0 && br_ref_offset[idx][1] >= 0) { + if (abs_coeff > mag[0]) { + mag[0] = abs_coeff; + mag[1] = 1; + } else if (abs_coeff == mag[0]) { + ++mag[1]; + } + } + } + return count; +} + static INLINE int get_br_ctx_from_count_mag(int row, int col, int count, int mag) { int offset = 0; @@ -153,7 +230,7 @@ static INLINE int get_br_ctx_from_count_mag(int row, int col, int count, offset = 0; else if (mag <= 3) offset = 1; - else if (mag <= 6) + else if (mag <= 5) offset = 2; else offset = 3; @@ -177,111 +254,171 @@ static INLINE int get_br_ctx_from_count_mag(int row, int col, int count, static INLINE int get_br_ctx(const tran_low_t *tcoeffs, const int c, // raster order const int bwl, const int height) { - const int stride = 1 << bwl; const int row = c >> bwl; const int col = c - (row << bwl); const int level_minus_1 = NUM_BASE_LEVELS; int mag; - const int count = get_level_count_mag(&mag, tcoeffs, stride, height, row, col, - level_minus_1, br_ref_offset, - BR_CONTEXT_POSITION_NUM); + const int count = + get_level_count_mag(&mag, tcoeffs, bwl, height, row, col, level_minus_1, + br_ref_offset, BR_CONTEXT_POSITION_NUM); const int ctx = get_br_ctx_from_count_mag(row, col, count, mag); return ctx; } -#define SIG_REF_OFFSET_NUM 11 +#define SIG_REF_OFFSET_NUM 7 static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { - { -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 }, { -1, 0 }, - { -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 }, + { -2, -1 }, { -2, 0 }, { -1, -2 }, { -1, -1 }, + { -1, 0 }, { 0, -2 }, { 0, -1 }, }; -static INLINE int get_nz_count(const tran_low_t *tcoeffs, int stride, - int height, int row, int col, - const int16_t *iscan) { +#if REDUCE_CONTEXT_DEPENDENCY +static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height, + int row, int col, int prev_row, int prev_col) { int count = 0; - const int pos = row * stride + col; for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) { const int ref_row = row + sig_ref_offset[idx][0]; const int ref_col = col + sig_ref_offset[idx][1]; - if (ref_row < 0 || ref_col < 0 || ref_row >= height || ref_col >= stride) + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl) || (prev_row == ref_row && prev_col == ref_col)) + continue; + const int nb_pos = (ref_row << bwl) + ref_col; + count += (tcoeffs[nb_pos] != 0); + } + return count; +} +#else +static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height, + int row, int col) { + int count = 0; + for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) { + const int ref_row = row + sig_ref_offset[idx][0]; + const int ref_col = col + sig_ref_offset[idx][1]; + if (ref_row < 0 || ref_col < 0 || ref_row >= height || + ref_col >= (1 << bwl)) continue; - const int nb_pos = ref_row * stride + ref_col; - if (iscan[nb_pos] < iscan[pos]) count += (tcoeffs[nb_pos] != 0); + const int nb_pos = (ref_row << bwl) + ref_col; + count += (tcoeffs[nb_pos] != 0); } return count; } +#endif + +static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) { + switch (tx_type) { +#if CONFIG_EXT_TX + case V_DCT: + case V_ADST: + case V_FLIPADST: return TX_CLASS_VERT; + case H_DCT: + case H_ADST: + case H_FLIPADST: return TX_CLASS_HORIZ; +#endif + default: return TX_CLASS_2D; + } +} // TODO(angiebird): optimize this function by generate a table that maps from // count to ctx static INLINE int get_nz_map_ctx_from_count(int count, - const tran_low_t *tcoeffs, int coeff_idx, // raster order - int bwl, const int16_t *iscan) { + int bwl, TX_TYPE tx_type) { + (void)tx_type; const int row = coeff_idx >> bwl; const int col = coeff_idx - (row << bwl); int ctx = 0; +#if CONFIG_EXT_TX + int tx_class = get_tx_class(tx_type); + int offset; + if (tx_class == TX_CLASS_2D) + offset = 0; + else if (tx_class == TX_CLASS_VERT) + offset = SIG_COEF_CONTEXTS_2D; + else + offset = SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D; +#else + int offset = 0; +#endif - if (row == 0 && col == 0) return 0; + if (row == 0 && col == 0) return offset + 0; - if (row == 0 && col == 1) return 1 + (tcoeffs[0] != 0); + if (row == 0 && col == 1) return offset + 1 + count; - if (row == 1 && col == 0) return 3 + (tcoeffs[0] != 0); + if (row == 1 && col == 0) return offset + 3 + count; if (row == 1 && col == 1) { - int pos; - ctx = (tcoeffs[0] != 0); - - if (iscan[1] < iscan[coeff_idx]) ctx += (tcoeffs[1] != 0); - pos = 1 << bwl; - if (iscan[pos] < iscan[coeff_idx]) ctx += (tcoeffs[pos] != 0); - - ctx = (ctx + 1) >> 1; + ctx = (count + 1) >> 1; assert(5 + ctx <= 7); - return 5 + ctx; + return offset + 5 + ctx; } if (row == 0) { ctx = (count + 1) >> 1; - assert(ctx < 3); - return 8 + ctx; + assert(ctx < 2); + return offset + 8 + ctx; } if (col == 0) { ctx = (count + 1) >> 1; - assert(ctx < 3); - return 11 + ctx; + assert(ctx < 2); + return offset + 10 + ctx; } ctx = count >> 1; - assert(14 + ctx < 20); + assert(12 + ctx < 16); - return 14 + ctx; + return offset + 12 + ctx; } -static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs, - const int coeff_idx, // raster order - const int bwl, const int height, - const int16_t *iscan) { - int stride = 1 << bwl; +static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs, const int scan_idx, + const int16_t *scan, const int bwl, + const int height, TX_TYPE tx_type) { + const int coeff_idx = scan[scan_idx]; const int row = coeff_idx >> bwl; const int col = coeff_idx - (row << bwl); - int count = get_nz_count(tcoeffs, stride, height, row, col, iscan); - return get_nz_map_ctx_from_count(count, tcoeffs, coeff_idx, bwl, iscan); +#if REDUCE_CONTEXT_DEPENDENCY + int prev_coeff_idx; + int prev_row; + int prev_col; + if (scan_idx > MIN_SCAN_IDX_REDUCE_CONTEXT_DEPENDENCY) { + prev_coeff_idx = scan[scan_idx - 1]; // raster order + prev_row = prev_coeff_idx >> bwl; + prev_col = prev_coeff_idx - (prev_row << bwl); + } else { + prev_coeff_idx = -1; + prev_row = -1; + prev_col = -1; + } + int count = get_nz_count(tcoeffs, bwl, height, row, col, prev_row, prev_col); +#else + int count = get_nz_count(tcoeffs, bwl, height, row, col); +#endif + return get_nz_map_ctx_from_count(count, coeff_idx, bwl, tx_type); } static INLINE int get_eob_ctx(const tran_low_t *tcoeffs, const int coeff_idx, // raster order - const TX_SIZE txs_ctx) { + const TX_SIZE txs_ctx, TX_TYPE tx_type) { (void)tcoeffs; - if (txs_ctx == TX_4X4) return av1_coeff_band_4x4[coeff_idx]; - if (txs_ctx == TX_8X8) return av1_coeff_band_8x8[coeff_idx]; - if (txs_ctx == TX_16X16) return av1_coeff_band_16x16[coeff_idx]; - if (txs_ctx == TX_32X32) return av1_coeff_band_32x32[coeff_idx]; + int offset = 0; +#if CONFIG_CTX1D + TX_CLASS tx_class = get_tx_class(tx_type); + if (tx_class == TX_CLASS_VERT) + offset = EOB_COEF_CONTEXTS_2D; + else if (tx_class == TX_CLASS_HORIZ) + offset = EOB_COEF_CONTEXTS_2D + EOB_COEF_CONTEXTS_1D; +#else + (void)tx_type; +#endif + + if (txs_ctx == TX_4X4) return offset + av1_coeff_band_4x4[coeff_idx]; + if (txs_ctx == TX_8X8) return offset + av1_coeff_band_8x8[coeff_idx]; + if (txs_ctx == TX_16X16) return offset + av1_coeff_band_16x16[coeff_idx]; + if (txs_ctx == TX_32X32) return offset + av1_coeff_band_32x32[coeff_idx]; assert(0); return 0; @@ -369,6 +506,86 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size, } } +#if LV_MAP_PROB +void av1_init_txb_probs(FRAME_CONTEXT *fc); +#endif // LV_MAP_PROB + void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat, unsigned int update_factor); + +void av1_init_lv_map(AV1_COMMON *cm); + +#if CONFIG_CTX1D +static INLINE void get_eob_vert(int16_t *eob_ls, const tran_low_t *tcoeff, + int w, int h) { + for (int c = 0; c < w; ++c) { + eob_ls[c] = 0; + for (int r = h - 1; r >= 0; --r) { + int coeff_idx = r * w + c; + if (tcoeff[coeff_idx] != 0) { + eob_ls[c] = r + 1; + break; + } + } + } +} + +static INLINE void get_eob_horiz(int16_t *eob_ls, const tran_low_t *tcoeff, + int w, int h) { + for (int r = 0; r < h; ++r) { + eob_ls[r] = 0; + for (int c = w - 1; c >= 0; --c) { + int coeff_idx = r * w + c; + if (tcoeff[coeff_idx] != 0) { + eob_ls[r] = c + 1; + break; + } + } + } +} + +static INLINE int get_empty_line_ctx(int line_idx, int16_t *eob_ls) { + if (line_idx > 0) { + int prev_eob = eob_ls[line_idx - 1]; + if (prev_eob == 0) { + return 1; + } else if (prev_eob < 3) { + return 2; + } else if (prev_eob < 6) { + return 3; + } else { + return 4; + } + } else { + return 0; + } +} + +#define MAX_POS_CTX 8 +static int pos_ctx[MAX_HVTX_SIZE] = { + 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, +}; +static INLINE int get_hv_eob_ctx(int line_idx, int pos, int16_t *eob_ls) { + if (line_idx > 0) { + int prev_eob = eob_ls[line_idx - 1]; + int diff = pos + 1 - prev_eob; + int abs_diff = abs(diff); + int ctx_idx = pos_ctx[abs_diff]; + assert(ctx_idx < MAX_POS_CTX); + if (diff < 0) { + ctx_idx += MAX_POS_CTX; + assert(ctx_idx >= MAX_POS_CTX); + assert(ctx_idx < 2 * MAX_POS_CTX); + } + return ctx_idx; + } else { + int ctx_idx = MAX_POS_CTX + MAX_POS_CTX + pos_ctx[pos]; + assert(ctx_idx < HV_EOB_CONTEXTS); + assert(HV_EOB_CONTEXTS == MAX_POS_CTX * 3); + return ctx_idx; + } +} +#endif // CONFIG_CTX1D + #endif // AV1_COMMON_TXB_COMMON_H_ diff --git a/third_party/aom/av1/common/warped_motion.c b/third_party/aom/av1/common/warped_motion.c index 75ae08723..34374af69 100644 --- a/third_party/aom/av1/common/warped_motion.c +++ b/third_party/aom/av1/common/warped_motion.c @@ -912,8 +912,8 @@ static void highbd_warp_plane_old(const WarpedMotionParams *const wm, in[0] = j; in[1] = i; projectpoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y); - out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4); - out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4); + out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, SCALE_SUBPEL_BITS); + out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, SCALE_SUBPEL_BITS); if (conv_params->do_average) pred[(j - p_col) + (i - p_row) * p_stride] = ROUND_POWER_OF_TWO( pred[(j - p_col) + (i - p_row) * p_stride] + @@ -939,136 +939,51 @@ void av1_highbd_warp_affine_c(const int32_t *mat, const uint16_t *ref, int16_t beta, int16_t gamma, int16_t delta) { int32_t tmp[15 * 8]; int i, j, k, l, m; - - for (i = p_row; i < p_row + p_height; i += 8) { - for (j = p_col; j < p_col + p_width; j += 8) { - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - - sx4 += alpha * (-4) + beta * (-4); - sy4 += gamma * (-4) + delta * (-4); - - sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1); - sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1); - - // Horizontal filter - for (k = -7; k < 8; ++k) { - int iy = iy4 + k; - if (iy < 0) - iy = 0; - else if (iy > height - 1) - iy = height - 1; - - int sx = sx4 + beta * (k + 4); - for (l = -4; l < 4; ++l) { - int ix = ix4 + l - 3; - const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) + - WARPEDPIXEL_PREC_SHIFTS; - assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3); - const int16_t *coeffs = warped_filter[offs]; - - int32_t sum = 1 << (bd + WARPEDPIXEL_FILTER_BITS - 1); - for (m = 0; m < 8; ++m) { - int sample_x = ix + m; - if (sample_x < 0) - sample_x = 0; - else if (sample_x > width - 1) - sample_x = width - 1; - sum += ref[iy * stride + sample_x] * coeffs[m]; - } - sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS); - assert(0 <= sum && - sum < (1 << (bd + WARPEDPIXEL_FILTER_BITS + 1 - - HORSHEAR_REDUCE_PREC_BITS))); - tmp[(k + 7) * 8 + (l + 4)] = sum; - sx += alpha; - } - } - - // Vertical filter - for (k = -4; k < AOMMIN(4, p_row + p_height - i - 4); ++k) { - int sy = sy4 + delta * (k + 4); - for (l = -4; l < 4; ++l) { - uint16_t *p = - &pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)]; - const int offs = ROUND_POWER_OF_TWO(sy, WARPEDDIFF_PREC_BITS) + - WARPEDPIXEL_PREC_SHIFTS; - assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3); - const int16_t *coeffs = warped_filter[offs]; - - int32_t sum = 1 << (bd + 2 * WARPEDPIXEL_FILTER_BITS - - HORSHEAR_REDUCE_PREC_BITS); - for (m = 0; m < 8; ++m) { - sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m]; - } - sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS); - assert(0 <= sum && sum < (1 << (bd + 2))); - uint16_t px = - clip_pixel_highbd(sum - (1 << (bd - 1)) - (1 << bd), bd); - if (conv_params->do_average) - *p = ROUND_POWER_OF_TWO(*p + px, 1); - else - *p = px; - sy += gamma; - } - } - } - } -} - #if CONFIG_CONVOLVE_ROUND -void av1_highbd_warp_affine_post_round_c( - const int32_t *mat, const uint16_t *ref, int width, int height, int stride, - uint16_t *pred, int p_col, int p_row, int p_width, int p_height, - int p_stride, int subsampling_x, int subsampling_y, int bd, - ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, - int16_t delta) { - (void)pred; - (void)p_stride; - int32_t tmp[15 * 8]; - int i, j, k, l, m; - const int offset_bits_horiz = bd + FILTER_BITS - 1; - const int offset_bits_vert = bd + 2 * FILTER_BITS - conv_params->round_0; + const int use_conv_params = conv_params->round == CONVOLVE_OPT_NO_ROUND; + const int reduce_bits_horiz = + use_conv_params ? conv_params->round_0 : HORSHEAR_REDUCE_PREC_BITS; + const int max_bits_horiz = + use_conv_params + ? bd + FILTER_BITS + 1 - conv_params->round_0 + : bd + WARPEDPIXEL_FILTER_BITS + 1 - HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = + use_conv_params ? bd + FILTER_BITS - 1 : bd + WARPEDPIXEL_FILTER_BITS - 1; + const int offset_bits_vert = + use_conv_params + ? bd + 2 * FILTER_BITS - conv_params->round_0 + : bd + 2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS; + if (use_conv_params) { + conv_params->do_post_rounding = 1; + } assert(FILTER_BITS == WARPEDPIXEL_FILTER_BITS); +#else + const int reduce_bits_horiz = HORSHEAR_REDUCE_PREC_BITS; + const int max_bits_horiz = + bd + WARPEDPIXEL_FILTER_BITS + 1 - HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = bd + WARPEDPIXEL_FILTER_BITS - 1; + const int offset_bits_vert = + bd + 2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS; +#endif + (void)max_bits_horiz; for (i = p_row; i < p_row + p_height; i += 8) { for (j = p_col; j < p_col + p_width; j += 8) { - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + // Calculate the center of this 8x8 block, + // project to luma coordinates (if in a subsampled chroma plane), + // apply the affine transformation, + // then convert back to the original coordinates (if necessary) + const int32_t src_x = (j + 4) << subsampling_x; + const int32_t src_y = (i + 4) << subsampling_y; + const int32_t dst_x = mat[2] * src_x + mat[3] * src_y + mat[0]; + const int32_t dst_y = mat[4] * src_x + mat[5] * src_y + mat[1]; + const int32_t x4 = dst_x >> subsampling_x; + const int32_t y4 = dst_y >> subsampling_y; + + int32_t ix4 = x4 >> WARPEDMODEL_PREC_BITS; + int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + int32_t iy4 = y4 >> WARPEDMODEL_PREC_BITS; + int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); sx4 += alpha * (-4) + beta * (-4); sy4 += gamma * (-4) + delta * (-4); @@ -1101,9 +1016,8 @@ void av1_highbd_warp_affine_post_round_c( sample_x = width - 1; sum += ref[iy * stride + sample_x] * coeffs[m]; } - sum = ROUND_POWER_OF_TWO(sum, conv_params->round_0); - assert(0 <= sum && - sum < (1 << (bd + FILTER_BITS + 1 - conv_params->round_0))); + sum = ROUND_POWER_OF_TWO(sum, reduce_bits_horiz); + assert(0 <= sum && sum < (1 << max_bits_horiz)); tmp[(k + 7) * 8 + (l + 4)] = sum; sx += alpha; } @@ -1112,7 +1026,7 @@ void av1_highbd_warp_affine_post_round_c( // Vertical filter for (k = -4; k < AOMMIN(4, p_row + p_height - i - 4); ++k) { int sy = sy4 + delta * (k + 4); - for (l = -4; l < 4; ++l) { + for (l = -4; l < AOMMIN(4, p_col + p_width - j - 4); ++l) { const int offs = ROUND_POWER_OF_TWO(sy, WARPEDDIFF_PREC_BITS) + WARPEDPIXEL_PREC_SHIFTS; assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3); @@ -1122,22 +1036,41 @@ void av1_highbd_warp_affine_post_round_c( for (m = 0; m < 8; ++m) { sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m]; } - - sum = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - - (1 << (offset_bits_horiz + FILTER_BITS - conv_params->round_0 - - conv_params->round_1)) - - (1 << (offset_bits_vert - conv_params->round_1)); - CONV_BUF_TYPE *p = - &conv_params->dst[(i - p_row + k + 4) * conv_params->dst_stride + - (j - p_col + l + 4)]; - *p += sum; +#if CONFIG_CONVOLVE_ROUND + if (use_conv_params) { + CONV_BUF_TYPE *p = + &conv_params + ->dst[(i - p_row + k + 4) * conv_params->dst_stride + + (j - p_col + l + 4)]; + sum = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - + (1 << (offset_bits_horiz + FILTER_BITS - + conv_params->round_0 - conv_params->round_1)) - + (1 << (offset_bits_vert - conv_params->round_1)); + if (conv_params->do_average) + *p += sum; + else + *p = sum; + } else { +#else + { +#endif + uint16_t *p = + &pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)]; + sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS); + assert(0 <= sum && sum < (1 << (bd + 2))); + uint16_t px = + clip_pixel_highbd(sum - (1 << (bd - 1)) - (1 << bd), bd); + if (conv_params->do_average) + *p = ROUND_POWER_OF_TWO(*p + px, 1); + else + *p = px; + } sy += gamma; } } } } } -#endif static void highbd_warp_plane(WarpedMotionParams *wm, const uint8_t *const ref8, int width, int height, int stride, @@ -1160,25 +1093,10 @@ static void highbd_warp_plane(WarpedMotionParams *wm, const uint8_t *const ref8, const uint16_t *const ref = CONVERT_TO_SHORTPTR(ref8); uint16_t *pred = CONVERT_TO_SHORTPTR(pred8); -#if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - conv_params->do_post_rounding = 1; - av1_highbd_warp_affine_post_round( - mat, ref, width, height, stride, pred, p_col, p_row, p_width, - p_height, p_stride, subsampling_x, subsampling_y, bd, conv_params, - alpha, beta, gamma, delta); - } else { - av1_highbd_warp_affine(mat, ref, width, height, stride, pred, p_col, - p_row, p_width, p_height, p_stride, subsampling_x, - subsampling_y, bd, conv_params, alpha, beta, gamma, - delta); - } -#else av1_highbd_warp_affine(mat, ref, width, height, stride, pred, p_col, p_row, p_width, p_height, p_stride, subsampling_x, subsampling_y, bd, conv_params, alpha, beta, gamma, delta); -#endif } else { highbd_warp_plane_old(wm, ref8, width, height, stride, pred8, p_col, p_row, p_width, p_height, p_stride, subsampling_x, @@ -1251,8 +1169,8 @@ static void warp_plane_old(const WarpedMotionParams *const wm, in[0] = j; in[1] = i; projectpoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y); - out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4); - out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4); + out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, SCALE_SUBPEL_BITS); + out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, SCALE_SUBPEL_BITS); if (conv_params->do_average) pred[(j - p_col) + (i - p_row) * p_stride] = ROUND_POWER_OF_TWO( pred[(j - p_col) + (i - p_row) * p_stride] + @@ -1359,143 +1277,51 @@ void av1_warp_affine_c(const int32_t *mat, const uint8_t *ref, int width, int32_t tmp[15 * 8]; int i, j, k, l, m; const int bd = 8; - - for (i = p_row; i < p_row + p_height; i += 8) { - for (j = p_col; j < p_col + p_width; j += 8) { - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - - sx4 += alpha * (-4) + beta * (-4); - sy4 += gamma * (-4) + delta * (-4); - - sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1); - sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1); - - // Horizontal filter - for (k = -7; k < 8; ++k) { - // Clamp to top/bottom edge of the frame - int iy = iy4 + k; - if (iy < 0) - iy = 0; - else if (iy > height - 1) - iy = height - 1; - - int sx = sx4 + beta * (k + 4); - - for (l = -4; l < 4; ++l) { - int ix = ix4 + l - 3; - // At this point, sx = sx4 + alpha * l + beta * k - const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) + - WARPEDPIXEL_PREC_SHIFTS; - assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3); - const int16_t *coeffs = warped_filter[offs]; - - int32_t sum = 1 << (bd + WARPEDPIXEL_FILTER_BITS - 1); - for (m = 0; m < 8; ++m) { - // Clamp to left/right edge of the frame - int sample_x = ix + m; - if (sample_x < 0) - sample_x = 0; - else if (sample_x > width - 1) - sample_x = width - 1; - - sum += ref[iy * stride + sample_x] * coeffs[m]; - } - sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS); - assert(0 <= sum && - sum < (1 << (bd + WARPEDPIXEL_FILTER_BITS + 1 - - HORSHEAR_REDUCE_PREC_BITS))); - tmp[(k + 7) * 8 + (l + 4)] = sum; - sx += alpha; - } - } - - // Vertical filter - for (k = -4; k < AOMMIN(4, p_row + p_height - i - 4); ++k) { - int sy = sy4 + delta * (k + 4); - for (l = -4; l < AOMMIN(4, p_col + p_width - j - 4); ++l) { - uint8_t *p = - &pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)]; - // At this point, sy = sy4 + gamma * l + delta * k - const int offs = ROUND_POWER_OF_TWO(sy, WARPEDDIFF_PREC_BITS) + - WARPEDPIXEL_PREC_SHIFTS; - assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3); - const int16_t *coeffs = warped_filter[offs]; - - int32_t sum = 1 << (bd + 2 * WARPEDPIXEL_FILTER_BITS - - HORSHEAR_REDUCE_PREC_BITS); - for (m = 0; m < 8; ++m) { - sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m]; - } - sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS); - assert(0 <= sum && sum < (1 << (bd + 2))); - uint8_t px = clip_pixel(sum - (1 << (bd - 1)) - (1 << bd)); - if (conv_params->do_average) - *p = ROUND_POWER_OF_TWO(*p + px, 1); - else - *p = px; - sy += gamma; - } - } - } - } -} - #if CONFIG_CONVOLVE_ROUND -void av1_warp_affine_post_round_c(const int32_t *mat, const uint8_t *ref, - int width, int height, int stride, - uint8_t *pred, int p_col, int p_row, - int p_width, int p_height, int p_stride, - int subsampling_x, int subsampling_y, - ConvolveParams *conv_params, int16_t alpha, - int16_t beta, int16_t gamma, int16_t delta) { - (void)pred; - (void)p_stride; - int32_t tmp[15 * 8]; - int i, j, k, l, m; - const int bd = 8; - const int offset_bits_horiz = bd + FILTER_BITS - 1; - const int offset_bits_vert = bd + 2 * FILTER_BITS - conv_params->round_0; + const int use_conv_params = conv_params->round == CONVOLVE_OPT_NO_ROUND; + const int reduce_bits_horiz = + use_conv_params ? conv_params->round_0 : HORSHEAR_REDUCE_PREC_BITS; + const int max_bits_horiz = + use_conv_params + ? bd + FILTER_BITS + 1 - conv_params->round_0 + : bd + WARPEDPIXEL_FILTER_BITS + 1 - HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = + use_conv_params ? bd + FILTER_BITS - 1 : bd + WARPEDPIXEL_FILTER_BITS - 1; + const int offset_bits_vert = + use_conv_params + ? bd + 2 * FILTER_BITS - conv_params->round_0 + : bd + 2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS; + if (use_conv_params) { + conv_params->do_post_rounding = 1; + } assert(FILTER_BITS == WARPEDPIXEL_FILTER_BITS); +#else + const int reduce_bits_horiz = HORSHEAR_REDUCE_PREC_BITS; + const int max_bits_horiz = + bd + WARPEDPIXEL_FILTER_BITS + 1 - HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = bd + WARPEDPIXEL_FILTER_BITS - 1; + const int offset_bits_vert = + bd + 2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS; +#endif + (void)max_bits_horiz; for (i = p_row; i < p_row + p_height; i += 8) { for (j = p_col; j < p_col + p_width; j += 8) { - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + // Calculate the center of this 8x8 block, + // project to luma coordinates (if in a subsampled chroma plane), + // apply the affine transformation, + // then convert back to the original coordinates (if necessary) + const int32_t src_x = (j + 4) << subsampling_x; + const int32_t src_y = (i + 4) << subsampling_y; + const int32_t dst_x = mat[2] * src_x + mat[3] * src_y + mat[0]; + const int32_t dst_y = mat[4] * src_x + mat[5] * src_y + mat[1]; + const int32_t x4 = dst_x >> subsampling_x; + const int32_t y4 = dst_y >> subsampling_y; + + int32_t ix4 = x4 >> WARPEDMODEL_PREC_BITS; + int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + int32_t iy4 = y4 >> WARPEDMODEL_PREC_BITS; + int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); sx4 += alpha * (-4) + beta * (-4); sy4 += gamma * (-4) + delta * (-4); @@ -1533,9 +1359,8 @@ void av1_warp_affine_post_round_c(const int32_t *mat, const uint8_t *ref, sum += ref[iy * stride + sample_x] * coeffs[m]; } - sum = ROUND_POWER_OF_TWO(sum, conv_params->round_0); - assert(0 <= sum && - sum < (1 << (bd + FILTER_BITS + 1 - conv_params->round_0))); + sum = ROUND_POWER_OF_TWO(sum, reduce_bits_horiz); + assert(0 <= sum && sum < (1 << max_bits_horiz)); tmp[(k + 7) * 8 + (l + 4)] = sum; sx += alpha; } @@ -1552,26 +1377,43 @@ void av1_warp_affine_post_round_c(const int32_t *mat, const uint8_t *ref, const int16_t *coeffs = warped_filter[offs]; int32_t sum = 1 << offset_bits_vert; - for (m = 0; m < 8; ++m) { sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m]; } - - sum = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - - (1 << (offset_bits_horiz + FILTER_BITS - conv_params->round_0 - - conv_params->round_1)) - - (1 << (offset_bits_vert - conv_params->round_1)); - CONV_BUF_TYPE *p = - &conv_params->dst[(i - p_row + k + 4) * conv_params->dst_stride + - (j - p_col + l + 4)]; - *p += sum; +#if CONFIG_CONVOLVE_ROUND + if (use_conv_params) { + CONV_BUF_TYPE *p = + &conv_params + ->dst[(i - p_row + k + 4) * conv_params->dst_stride + + (j - p_col + l + 4)]; + sum = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - + (1 << (offset_bits_horiz + FILTER_BITS - + conv_params->round_0 - conv_params->round_1)) - + (1 << (offset_bits_vert - conv_params->round_1)); + if (conv_params->do_average) + *p += sum; + else + *p = sum; + } else { +#else + { +#endif + uint8_t *p = + &pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)]; + sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS); + assert(0 <= sum && sum < (1 << (bd + 2))); + uint8_t px = clip_pixel(sum - (1 << (bd - 1)) - (1 << bd)); + if (conv_params->do_average) + *p = ROUND_POWER_OF_TWO(*p + px, 1); + else + *p = px; + } sy += gamma; } } } } } -#endif // CONFIG_CONVOLVE_ROUND static void warp_plane(WarpedMotionParams *wm, const uint8_t *const ref, int width, int height, int stride, uint8_t *pred, @@ -1590,23 +1432,9 @@ static void warp_plane(WarpedMotionParams *wm, const uint8_t *const ref, const int16_t gamma = wm->gamma; const int16_t delta = wm->delta; -#if CONFIG_CONVOLVE_ROUND - if (conv_params->round == CONVOLVE_OPT_NO_ROUND) { - conv_params->do_post_rounding = 1; - av1_warp_affine_post_round(mat, ref, width, height, stride, pred, p_col, - p_row, p_width, p_height, p_stride, - subsampling_x, subsampling_y, conv_params, - alpha, beta, gamma, delta); - } else { - av1_warp_affine(mat, ref, width, height, stride, pred, p_col, p_row, - p_width, p_height, p_stride, subsampling_x, subsampling_y, - conv_params, alpha, beta, gamma, delta); - } -#else av1_warp_affine(mat, ref, width, height, stride, pred, p_col, p_row, p_width, p_height, p_stride, subsampling_x, subsampling_y, conv_params, alpha, beta, gamma, delta); -#endif } else { warp_plane_old(wm, ref, width, height, stride, pred, p_col, p_row, p_width, p_height, p_stride, subsampling_x, subsampling_y, x_scale, diff --git a/third_party/aom/av1/common/warped_motion.h b/third_party/aom/av1/common/warped_motion.h index 845eb9a43..e05f6a85f 100644 --- a/third_party/aom/av1/common/warped_motion.h +++ b/third_party/aom/av1/common/warped_motion.h @@ -30,10 +30,9 @@ #define LEAST_SQUARES_SAMPLES_MAX (1 << LEAST_SQUARES_SAMPLES_MAX_BITS) #if WARPED_MOTION_SORT_SAMPLES -// #define SAMPLES_ARRAY_SIZE (LEAST_SQUARES_SAMPLES_MAX * 2) -// Search half bsize on the top and half bsize on the left, 1 upper-left block, +// Search 1 row on the top and 1 column on the left, 1 upper-left block, // 1 upper-right block. -#define SAMPLES_ARRAY_SIZE ((MAX_MIB_SIZE * MAX_MIB_SIZE + 2) * 2) +#define SAMPLES_ARRAY_SIZE ((MAX_MIB_SIZE * 2 + 2) * 2) #else #define SAMPLES_ARRAY_SIZE (LEAST_SQUARES_SAMPLES_MAX * 2) #endif // WARPED_MOTION_SORT_SAMPLES diff --git a/third_party/aom/av1/common/x86/av1_convolve_scale_sse4.c b/third_party/aom/av1/common/x86/av1_convolve_scale_sse4.c new file mode 100644 index 000000000..1f0fedb2a --- /dev/null +++ b/third_party/aom/av1/common/x86/av1_convolve_scale_sse4.c @@ -0,0 +1,645 @@ +/* + * Copyright (c) 2017, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include <assert.h> +#include <smmintrin.h> + +#include "./aom_dsp_rtcd.h" +#include "aom_dsp/aom_convolve.h" +#include "aom_dsp/aom_dsp_common.h" +#include "aom_dsp/aom_filter.h" +#include "av1/common/convolve.h" + +// Make a mask for coefficients of 10/12 tap filters. The coefficients are +// packed "89ab89ab". If it's a 12-tap filter, we want all 1's; if it's a +// 10-tap filter, we want "11001100" to just match the 8,9 terms. +static __m128i make_1012_mask(int ntaps) { + uint32_t low = 0xffffffff; + uint32_t high = (ntaps == 12) ? low : 0; + return _mm_set_epi32(high, low, high, low); +} + +// Zero-extend the given input operand to an entire __m128i register. +// +// Note that there's almost an intrinsic to do this but 32-bit Visual Studio +// doesn't have _mm_set_epi64x so we have to do it by hand. +static __m128i extend_32_to_128(uint32_t x) { + return _mm_set_epi32(0, 0, 0, x); +} + +// Load an SSE register from p and bitwise AND with a. +static __m128i load_and_128i(const void *p, __m128i a) { + const __m128d ad = _mm_castsi128_pd(a); + const __m128d bd = _mm_load1_pd((const double *)p); + return _mm_castpd_si128(_mm_and_pd(ad, bd)); +} + +// The horizontal filter for av1_convolve_2d_scale_sse4_1. This is the more +// general version, supporting 10 and 12 tap filters. For 8-tap filters, use +// hfilter8. +static void hfilter(const uint8_t *src, int src_stride, int32_t *dst, int w, + int h, int subpel_x_qn, int x_step_qn, + const InterpFilterParams *filter_params, unsigned round) { + const int bd = 8; + const int ntaps = filter_params->taps; + assert(ntaps == 10 || ntaps == 12); + + src -= ntaps / 2 - 1; + + // Construct a mask with which we'll AND filter coefficients 89ab89ab to zero + // out the unneeded entries. + const __m128i hicoeff_mask = make_1012_mask(ntaps); + + int32_t round_add32 = (1 << round) / 2 + (1 << (bd + FILTER_BITS - 1)); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(round); + + int x_qn = subpel_x_qn; + for (int x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint8_t *const src_col = src + (x_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // The "lo" coefficients are coefficients 0..7. For a 12-tap filter, the + // "hi" coefficients are arranged as 89ab89ab. For a 10-tap filter, they + // are masked out with hicoeff_mask. + const __m128i coefflo = _mm_loadu_si128((__m128i *)filter); + const __m128i coeffhi = load_and_128i(filter + 8, hicoeff_mask); + const __m128i zero = _mm_castps_si128(_mm_setzero_ps()); + + int y; + for (y = 0; y <= h - 4; y += 4) { + const uint8_t *const src0 = src_col + y * src_stride; + const uint8_t *const src1 = src0 + 1 * src_stride; + const uint8_t *const src2 = src0 + 2 * src_stride; + const uint8_t *const src3 = src0 + 3 * src_stride; + + // Load up source data. This is 8-bit input data, so each load gets 16 + // pixels (we need at most 12) + const __m128i data08 = _mm_loadu_si128((__m128i *)src0); + const __m128i data18 = _mm_loadu_si128((__m128i *)src1); + const __m128i data28 = _mm_loadu_si128((__m128i *)src2); + const __m128i data38 = _mm_loadu_si128((__m128i *)src3); + + // Now zero-extend up to 16-bit precision by interleaving with zeros. For + // the "high" pixels (8 to 11), interleave first (so that the expansion + // to 16-bits operates on an entire register). + const __m128i data0lo = _mm_unpacklo_epi8(data08, zero); + const __m128i data1lo = _mm_unpacklo_epi8(data18, zero); + const __m128i data2lo = _mm_unpacklo_epi8(data28, zero); + const __m128i data3lo = _mm_unpacklo_epi8(data38, zero); + const __m128i data01hi8 = _mm_unpackhi_epi32(data08, data18); + const __m128i data23hi8 = _mm_unpackhi_epi32(data28, data38); + const __m128i data01hi = _mm_unpacklo_epi8(data01hi8, zero); + const __m128i data23hi = _mm_unpacklo_epi8(data23hi8, zero); + + // Multiply by coefficients + const __m128i conv0lo = _mm_madd_epi16(data0lo, coefflo); + const __m128i conv1lo = _mm_madd_epi16(data1lo, coefflo); + const __m128i conv2lo = _mm_madd_epi16(data2lo, coefflo); + const __m128i conv3lo = _mm_madd_epi16(data3lo, coefflo); + const __m128i conv01hi = _mm_madd_epi16(data01hi, coeffhi); + const __m128i conv23hi = _mm_madd_epi16(data23hi, coeffhi); + + // Reduce horizontally and add + const __m128i conv01lo = _mm_hadd_epi32(conv0lo, conv1lo); + const __m128i conv23lo = _mm_hadd_epi32(conv2lo, conv3lo); + const __m128i convlo = _mm_hadd_epi32(conv01lo, conv23lo); + const __m128i convhi = _mm_hadd_epi32(conv01hi, conv23hi); + const __m128i conv = _mm_add_epi32(convlo, convhi); + + // Divide down by (1 << round), rounding to nearest. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + + // Write transposed to the output + _mm_storeu_si128((__m128i *)(dst + y + x * h), shifted); + } + for (; y < h; ++y) { + const uint8_t *const src_row = src_col + y * src_stride; + + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (int k = 0; k < ntaps; ++k) { + sum += filter[k] * src_row[k]; + } + + dst[y + x * h] = ROUND_POWER_OF_TWO(sum, round); + } + } +} + +// A specialised version of hfilter, the horizontal filter for +// av1_convolve_2d_scale_sse4_1. This version only supports 8 tap filters. +static void hfilter8(const uint8_t *src, int src_stride, int32_t *dst, int w, + int h, int subpel_x_qn, int x_step_qn, + const InterpFilterParams *filter_params, unsigned round) { + const int bd = 8; + const int ntaps = 8; + + src -= ntaps / 2 - 1; + + int32_t round_add32 = (1 << round) / 2 + (1 << (bd + FILTER_BITS - 1)); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(round); + + int x_qn = subpel_x_qn; + for (int x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint8_t *const src_col = src + (x_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // Load the filter coefficients + const __m128i coefflo = _mm_loadu_si128((__m128i *)filter); + const __m128i zero = _mm_castps_si128(_mm_setzero_ps()); + + int y; + for (y = 0; y <= h - 4; y += 4) { + const uint8_t *const src0 = src_col + y * src_stride; + const uint8_t *const src1 = src0 + 1 * src_stride; + const uint8_t *const src2 = src0 + 2 * src_stride; + const uint8_t *const src3 = src0 + 3 * src_stride; + + // Load up source data. This is 8-bit input data; each load is just + // loading the lower half of the register and gets 8 pixels + const __m128i data08 = _mm_loadl_epi64((__m128i *)src0); + const __m128i data18 = _mm_loadl_epi64((__m128i *)src1); + const __m128i data28 = _mm_loadl_epi64((__m128i *)src2); + const __m128i data38 = _mm_loadl_epi64((__m128i *)src3); + + // Now zero-extend up to 16-bit precision by interleaving with + // zeros. Drop the upper half of each register (which just had zeros) + const __m128i data0lo = _mm_unpacklo_epi8(data08, zero); + const __m128i data1lo = _mm_unpacklo_epi8(data18, zero); + const __m128i data2lo = _mm_unpacklo_epi8(data28, zero); + const __m128i data3lo = _mm_unpacklo_epi8(data38, zero); + + // Multiply by coefficients + const __m128i conv0lo = _mm_madd_epi16(data0lo, coefflo); + const __m128i conv1lo = _mm_madd_epi16(data1lo, coefflo); + const __m128i conv2lo = _mm_madd_epi16(data2lo, coefflo); + const __m128i conv3lo = _mm_madd_epi16(data3lo, coefflo); + + // Reduce horizontally and add + const __m128i conv01lo = _mm_hadd_epi32(conv0lo, conv1lo); + const __m128i conv23lo = _mm_hadd_epi32(conv2lo, conv3lo); + const __m128i conv = _mm_hadd_epi32(conv01lo, conv23lo); + + // Divide down by (1 << round), rounding to nearest. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + + // Write transposed to the output + _mm_storeu_si128((__m128i *)(dst + y + x * h), shifted); + } + for (; y < h; ++y) { + const uint8_t *const src_row = src_col + y * src_stride; + + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (int k = 0; k < ntaps; ++k) { + sum += filter[k] * src_row[k]; + } + + dst[y + x * h] = ROUND_POWER_OF_TWO(sum, round); + } + } +} + +// Do a 12-tap convolution with the given coefficients, loading data from src. +static __m128i convolve_32(const int32_t *src, __m128i coeff03, __m128i coeff47, + __m128i coeff8d) { + const __m128i data03 = _mm_loadu_si128((__m128i *)src); + const __m128i data47 = _mm_loadu_si128((__m128i *)(src + 4)); + const __m128i data8d = _mm_loadu_si128((__m128i *)(src + 8)); + const __m128i conv03 = _mm_mullo_epi32(data03, coeff03); + const __m128i conv47 = _mm_mullo_epi32(data47, coeff47); + const __m128i conv8d = _mm_mullo_epi32(data8d, coeff8d); + return _mm_add_epi32(_mm_add_epi32(conv03, conv47), conv8d); +} + +// Do an 8-tap convolution with the given coefficients, loading data from src. +static __m128i convolve_32_8(const int32_t *src, __m128i coeff03, + __m128i coeff47) { + const __m128i data03 = _mm_loadu_si128((__m128i *)src); + const __m128i data47 = _mm_loadu_si128((__m128i *)(src + 4)); + const __m128i conv03 = _mm_mullo_epi32(data03, coeff03); + const __m128i conv47 = _mm_mullo_epi32(data47, coeff47); + return _mm_add_epi32(conv03, conv47); +} + +// The vertical filter for av1_convolve_2d_scale_sse4_1. This is the more +// general version, supporting 10 and 12 tap filters. For 8-tap filters, use +// vfilter8. +static void vfilter(const int32_t *src, int src_stride, int32_t *dst, + int dst_stride, int w, int h, int subpel_y_qn, + int y_step_qn, const InterpFilterParams *filter_params, + const ConvolveParams *conv_params, int bd) { + const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0; + const int ntaps = filter_params->taps; + + // Construct a mask with which we'll AND filter coefficients 89ab to zero out + // the unneeded entries. The upper bits of this mask are unused. + const __m128i hicoeff_mask = make_1012_mask(ntaps); + + int32_t round_add32 = (1 << conv_params->round_1) / 2 + (1 << offset_bits); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(conv_params->round_1); + + const int32_t sub32 = ((1 << (offset_bits - conv_params->round_1)) + + (1 << (offset_bits - conv_params->round_1 - 1))); + const __m128i sub = _mm_set1_epi32(sub32); + + int y_qn = subpel_y_qn; + for (int y = 0; y < h; ++y, y_qn += y_step_qn) { + const int32_t *src_y = src + (y_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // Load up coefficients for the filter and sign-extend to 32-bit precision + // (to do so, calculate sign bits and then interleave) + const __m128i zero = _mm_castps_si128(_mm_setzero_ps()); + const __m128i coeff0716 = _mm_loadu_si128((__m128i *)filter); + const __m128i coeffhi16 = load_and_128i(filter + 8, hicoeff_mask); + const __m128i csign0716 = _mm_cmplt_epi16(coeff0716, zero); + const __m128i csignhi16 = _mm_cmplt_epi16(coeffhi16, zero); + const __m128i coeff03 = _mm_unpacklo_epi16(coeff0716, csign0716); + const __m128i coeff47 = _mm_unpackhi_epi16(coeff0716, csign0716); + const __m128i coeff8d = _mm_unpacklo_epi16(coeffhi16, csignhi16); + + int x; + for (x = 0; x <= w - 4; x += 4) { + const int32_t *const src0 = src_y + x * src_stride; + const int32_t *const src1 = src0 + 1 * src_stride; + const int32_t *const src2 = src0 + 2 * src_stride; + const int32_t *const src3 = src0 + 3 * src_stride; + + // Load the source data for the three rows, adding the three registers of + // convolved products to one as we go (conv0..conv3) to avoid the + // register pressure getting too high. + const __m128i conv0 = convolve_32(src0, coeff03, coeff47, coeff8d); + const __m128i conv1 = convolve_32(src1, coeff03, coeff47, coeff8d); + const __m128i conv2 = convolve_32(src2, coeff03, coeff47, coeff8d); + const __m128i conv3 = convolve_32(src3, coeff03, coeff47, coeff8d); + + // Now reduce horizontally to get one lane for each result + const __m128i conv01 = _mm_hadd_epi32(conv0, conv1); + const __m128i conv23 = _mm_hadd_epi32(conv2, conv3); + const __m128i conv = _mm_hadd_epi32(conv01, conv23); + + // Divide down by (1 << round_1), rounding to nearest and subtract sub32. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + const __m128i subbed = _mm_sub_epi32(shifted, sub); + + int32_t *dst_x = dst + y * dst_stride + x; + const __m128i result = + (conv_params->do_average) + ? _mm_add_epi32(subbed, _mm_loadu_si128((__m128i *)dst_x)) + : subbed; + + _mm_storeu_si128((__m128i *)dst_x, result); + } + for (; x < w; ++x) { + const int32_t *src_x = src_y + x * src_stride; + CONV_BUF_TYPE sum = 1 << offset_bits; + for (int k = 0; k < ntaps; ++k) sum += filter[k] * src_x[k]; + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - sub32; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + } +} + +// A specialised version of vfilter, the vertical filter for +// av1_convolve_2d_scale_sse4_1. This version only supports 8 tap filters. +static void vfilter8(const int32_t *src, int src_stride, int32_t *dst, + int dst_stride, int w, int h, int subpel_y_qn, + int y_step_qn, const InterpFilterParams *filter_params, + const ConvolveParams *conv_params, int bd) { + const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0; + const int ntaps = 8; + + int32_t round_add32 = (1 << conv_params->round_1) / 2 + (1 << offset_bits); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(conv_params->round_1); + + const int32_t sub32 = ((1 << (offset_bits - conv_params->round_1)) + + (1 << (offset_bits - conv_params->round_1 - 1))); + const __m128i sub = _mm_set1_epi32(sub32); + + int y_qn = subpel_y_qn; + for (int y = 0; y < h; ++y, y_qn += y_step_qn) { + const int32_t *src_y = src + (y_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // Load up coefficients for the filter and sign-extend to 32-bit precision + // (to do so, calculate sign bits and then interleave) + const __m128i zero = _mm_castps_si128(_mm_setzero_ps()); + const __m128i coeff0716 = _mm_loadu_si128((__m128i *)filter); + const __m128i csign0716 = _mm_cmplt_epi16(coeff0716, zero); + const __m128i coeff03 = _mm_unpacklo_epi16(coeff0716, csign0716); + const __m128i coeff47 = _mm_unpackhi_epi16(coeff0716, csign0716); + + int x; + for (x = 0; x <= w - 4; x += 4) { + const int32_t *const src0 = src_y + x * src_stride; + const int32_t *const src1 = src0 + 1 * src_stride; + const int32_t *const src2 = src0 + 2 * src_stride; + const int32_t *const src3 = src0 + 3 * src_stride; + + // Load the source data for the three rows, adding the three registers of + // convolved products to one as we go (conv0..conv3) to avoid the + // register pressure getting too high. + const __m128i conv0 = convolve_32_8(src0, coeff03, coeff47); + const __m128i conv1 = convolve_32_8(src1, coeff03, coeff47); + const __m128i conv2 = convolve_32_8(src2, coeff03, coeff47); + const __m128i conv3 = convolve_32_8(src3, coeff03, coeff47); + + // Now reduce horizontally to get one lane for each result + const __m128i conv01 = _mm_hadd_epi32(conv0, conv1); + const __m128i conv23 = _mm_hadd_epi32(conv2, conv3); + const __m128i conv = _mm_hadd_epi32(conv01, conv23); + + // Divide down by (1 << round_1), rounding to nearest and subtract sub32. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + const __m128i subbed = _mm_sub_epi32(shifted, sub); + + int32_t *dst_x = dst + y * dst_stride + x; + const __m128i result = + (conv_params->do_average) + ? _mm_add_epi32(subbed, _mm_loadu_si128((__m128i *)dst_x)) + : subbed; + + _mm_storeu_si128((__m128i *)dst_x, result); + } + for (; x < w; ++x) { + const int32_t *src_x = src_y + x * src_stride; + CONV_BUF_TYPE sum = 1 << offset_bits; + for (int k = 0; k < ntaps; ++k) sum += filter[k] * src_x[k]; + CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1) - sub32; + if (conv_params->do_average) + dst[y * dst_stride + x] += res; + else + dst[y * dst_stride + x] = res; + } + } +} + +void av1_convolve_2d_scale_sse4_1(const uint8_t *src, int src_stride, + CONV_BUF_TYPE *dst, int dst_stride, int w, + int h, InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int x_step_qn, + const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params) { + int32_t tmp[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + + const int xtaps = filter_params_x->taps; + const int ytaps = filter_params_y->taps; + + const int fo_vert = ytaps / 2 - 1; + + // horizontal filter + if (xtaps == 8) + hfilter8(src - fo_vert * src_stride, src_stride, tmp, w, im_h, subpel_x_qn, + x_step_qn, filter_params_x, conv_params->round_0); + else + hfilter(src - fo_vert * src_stride, src_stride, tmp, w, im_h, subpel_x_qn, + x_step_qn, filter_params_x, conv_params->round_0); + + // vertical filter (input is transposed) + if (ytaps == 8) + vfilter8(tmp, im_h, dst, dst_stride, w, h, subpel_y_qn, y_step_qn, + filter_params_y, conv_params, 8); + else + vfilter(tmp, im_h, dst, dst_stride, w, h, subpel_y_qn, y_step_qn, + filter_params_y, conv_params, 8); +} + +#if CONFIG_HIGHBITDEPTH +// An wrapper to generate the SHUFPD instruction with __m128i types (just +// writing _mm_shuffle_pd at the callsites gets a bit ugly because of the +// casts) +static __m128i mm_shuffle0_si128(__m128i a, __m128i b) { + __m128d ad = _mm_castsi128_pd(a); + __m128d bd = _mm_castsi128_pd(b); + return _mm_castpd_si128(_mm_shuffle_pd(ad, bd, 0)); +} + +// The horizontal filter for av1_highbd_convolve_2d_scale_sse4_1. This +// is the more general version, supporting 10 and 12 tap filters. For +// 8-tap filters, use hfilter8. +static void highbd_hfilter(const uint16_t *src, int src_stride, int32_t *dst, + int w, int h, int subpel_x_qn, int x_step_qn, + const InterpFilterParams *filter_params, + unsigned round, int bd) { + const int ntaps = filter_params->taps; + assert(ntaps == 10 || ntaps == 12); + + src -= ntaps / 2 - 1; + + // Construct a mask with which we'll AND filter coefficients 89ab89ab to zero + // out the unneeded entries. + const __m128i hicoeff_mask = make_1012_mask(ntaps); + + int32_t round_add32 = (1 << round) / 2 + (1 << (bd + FILTER_BITS - 1)); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(round); + + int x_qn = subpel_x_qn; + for (int x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint16_t *const src_col = src + (x_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // The "lo" coefficients are coefficients 0..7. For a 12-tap filter, the + // "hi" coefficients are arranged as 89ab89ab. For a 10-tap filter, they + // are masked out with hicoeff_mask. + const __m128i coefflo = _mm_loadu_si128((__m128i *)filter); + const __m128i coeffhi = load_and_128i(filter + 8, hicoeff_mask); + + int y; + for (y = 0; y <= h - 4; y += 4) { + const uint16_t *const src0 = src_col + y * src_stride; + const uint16_t *const src1 = src0 + 1 * src_stride; + const uint16_t *const src2 = src0 + 2 * src_stride; + const uint16_t *const src3 = src0 + 3 * src_stride; + + // Load up source data. This is 16-bit input data, so each load gets 8 + // pixels (we need at most 12) + const __m128i data0lo = _mm_loadu_si128((__m128i *)src0); + const __m128i data1lo = _mm_loadu_si128((__m128i *)src1); + const __m128i data2lo = _mm_loadu_si128((__m128i *)src2); + const __m128i data3lo = _mm_loadu_si128((__m128i *)src3); + const __m128i data0hi = _mm_loadu_si128((__m128i *)(src0 + 8)); + const __m128i data1hi = _mm_loadu_si128((__m128i *)(src1 + 8)); + const __m128i data2hi = _mm_loadu_si128((__m128i *)(src2 + 8)); + const __m128i data3hi = _mm_loadu_si128((__m128i *)(src3 + 8)); + + // The "hi" data has rubbish in the top half so interleave pairs together + // to minimise the calculation we need to do. + const __m128i data01hi = mm_shuffle0_si128(data0hi, data1hi); + const __m128i data23hi = mm_shuffle0_si128(data2hi, data3hi); + + // Multiply by coefficients + const __m128i conv0lo = _mm_madd_epi16(data0lo, coefflo); + const __m128i conv1lo = _mm_madd_epi16(data1lo, coefflo); + const __m128i conv2lo = _mm_madd_epi16(data2lo, coefflo); + const __m128i conv3lo = _mm_madd_epi16(data3lo, coefflo); + const __m128i conv01hi = _mm_madd_epi16(data01hi, coeffhi); + const __m128i conv23hi = _mm_madd_epi16(data23hi, coeffhi); + + // Reduce horizontally and add + const __m128i conv01lo = _mm_hadd_epi32(conv0lo, conv1lo); + const __m128i conv23lo = _mm_hadd_epi32(conv2lo, conv3lo); + const __m128i convlo = _mm_hadd_epi32(conv01lo, conv23lo); + const __m128i convhi = _mm_hadd_epi32(conv01hi, conv23hi); + const __m128i conv = _mm_add_epi32(convlo, convhi); + + // Divide down by (1 << round), rounding to nearest. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + + // Write transposed to the output + _mm_storeu_si128((__m128i *)(dst + y + x * h), shifted); + } + for (; y < h; ++y) { + const uint16_t *const src_row = src_col + y * src_stride; + + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (int k = 0; k < ntaps; ++k) { + sum += filter[k] * src_row[k]; + } + + dst[y + x * h] = ROUND_POWER_OF_TWO(sum, round); + } + } +} + +// A specialised version of hfilter, the horizontal filter for +// av1_highbd_convolve_2d_scale_sse4_1. This version only supports 8 tap +// filters. +static void highbd_hfilter8(const uint16_t *src, int src_stride, int32_t *dst, + int w, int h, int subpel_x_qn, int x_step_qn, + const InterpFilterParams *filter_params, + unsigned round, int bd) { + const int ntaps = 8; + + src -= ntaps / 2 - 1; + + int32_t round_add32 = (1 << round) / 2 + (1 << (bd + FILTER_BITS - 1)); + const __m128i round_add = _mm_set1_epi32(round_add32); + const __m128i round_shift = extend_32_to_128(round); + + int x_qn = subpel_x_qn; + for (int x = 0; x < w; ++x, x_qn += x_step_qn) { + const uint16_t *const src_col = src + (x_qn >> SCALE_SUBPEL_BITS); + const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; + assert(filter_idx < SUBPEL_SHIFTS); + const int16_t *filter = + av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx); + + // Load the filter coefficients + const __m128i coefflo = _mm_loadu_si128((__m128i *)filter); + + int y; + for (y = 0; y <= h - 4; y += 4) { + const uint16_t *const src0 = src_col + y * src_stride; + const uint16_t *const src1 = src0 + 1 * src_stride; + const uint16_t *const src2 = src0 + 2 * src_stride; + const uint16_t *const src3 = src0 + 3 * src_stride; + + // Load up source data. This is 16-bit input data, so each load gets the 8 + // pixels we need. + const __m128i data0lo = _mm_loadu_si128((__m128i *)src0); + const __m128i data1lo = _mm_loadu_si128((__m128i *)src1); + const __m128i data2lo = _mm_loadu_si128((__m128i *)src2); + const __m128i data3lo = _mm_loadu_si128((__m128i *)src3); + + // Multiply by coefficients + const __m128i conv0lo = _mm_madd_epi16(data0lo, coefflo); + const __m128i conv1lo = _mm_madd_epi16(data1lo, coefflo); + const __m128i conv2lo = _mm_madd_epi16(data2lo, coefflo); + const __m128i conv3lo = _mm_madd_epi16(data3lo, coefflo); + + // Reduce horizontally and add + const __m128i conv01lo = _mm_hadd_epi32(conv0lo, conv1lo); + const __m128i conv23lo = _mm_hadd_epi32(conv2lo, conv3lo); + const __m128i conv = _mm_hadd_epi32(conv01lo, conv23lo); + + // Divide down by (1 << round), rounding to nearest. + const __m128i shifted = + _mm_sra_epi32(_mm_add_epi32(conv, round_add), round_shift); + + // Write transposed to the output + _mm_storeu_si128((__m128i *)(dst + y + x * h), shifted); + } + for (; y < h; ++y) { + const uint16_t *const src_row = src_col + y * src_stride; + + int32_t sum = (1 << (bd + FILTER_BITS - 1)); + for (int k = 0; k < ntaps; ++k) { + sum += filter[k] * src_row[k]; + } + + dst[y + x * h] = ROUND_POWER_OF_TWO(sum, round); + } + } +} + +void av1_highbd_convolve_2d_scale_sse4_1( + const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, + int w, int h, InterpFilterParams *filter_params_x, + InterpFilterParams *filter_params_y, const int subpel_x_qn, + const int x_step_qn, const int subpel_y_qn, const int y_step_qn, + ConvolveParams *conv_params, int bd) { + int32_t tmp[(2 * MAX_SB_SIZE + MAX_FILTER_TAP) * MAX_SB_SIZE]; + int im_h = (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + + filter_params_y->taps; + + const int xtaps = filter_params_x->taps; + const int ytaps = filter_params_y->taps; + const int fo_vert = ytaps / 2 - 1; + + // horizontal filter + if (xtaps == 8) + highbd_hfilter8(src - fo_vert * src_stride, src_stride, tmp, w, im_h, + subpel_x_qn, x_step_qn, filter_params_x, + conv_params->round_0, bd); + else + highbd_hfilter(src - fo_vert * src_stride, src_stride, tmp, w, im_h, + subpel_x_qn, x_step_qn, filter_params_x, + conv_params->round_0, bd); + + // vertical filter (input is transposed) + if (ytaps == 8) + vfilter8(tmp, im_h, dst, dst_stride, w, h, subpel_y_qn, y_step_qn, + filter_params_y, conv_params, bd); + else + vfilter(tmp, im_h, dst, dst_stride, w, h, subpel_y_qn, y_step_qn, + filter_params_y, conv_params, bd); +} +#endif // CONFIG_HIGHBITDEPTH diff --git a/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c b/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c index f7824b627..58ede028a 100644 --- a/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c +++ b/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c @@ -74,17 +74,9 @@ static INLINE void fwd_txfm2d_sse4_1(const int16_t *input, int32_t *output, } void av1_fwd_txfm2d_32x32_sse4_1(const int16_t *input, int32_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { DECLARE_ALIGNED(16, int32_t, txfm_buf[1024]); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32); (void)bd; fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf); } - -void av1_fwd_txfm2d_64x64_sse4_1(const int16_t *input, int32_t *output, - int stride, int tx_type, int bd) { - DECLARE_ALIGNED(16, int32_t, txfm_buf[4096]); - TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type); - (void)bd; - fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf); -} diff --git a/third_party/aom/av1/common/x86/convolve_2d_sse2.c b/third_party/aom/av1/common/x86/convolve_2d_sse2.c index 46c2674ca..e4d352c0e 100644 --- a/third_party/aom/av1/common/x86/convolve_2d_sse2.c +++ b/third_party/aom/av1/common/x86/convolve_2d_sse2.c @@ -31,6 +31,7 @@ void av1_convolve_2d_sse2(const uint8_t *src, int src_stride, int i, j; const int fo_vert = filter_params_y->taps / 2 - 1; const int fo_horiz = filter_params_x->taps / 2 - 1; + const int do_average = conv_params->do_average; const uint8_t *const src_ptr = src - fo_vert * src_stride - fo_horiz; const __m128i zero = _mm_setzero_si128(); @@ -181,9 +182,15 @@ void av1_convolve_2d_sse2(const uint8_t *src, int src_stride, // Accumulate values into the destination buffer __m128i *const p = (__m128i *)&dst[i * dst_stride + j]; - _mm_storeu_si128(p, _mm_add_epi32(_mm_loadu_si128(p), res_lo_round)); - _mm_storeu_si128(p + 1, - _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + if (do_average) { + _mm_storeu_si128(p + 0, + _mm_add_epi32(_mm_loadu_si128(p + 0), res_lo_round)); + _mm_storeu_si128(p + 1, + _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + } else { + _mm_storeu_si128(p + 0, res_lo_round); + _mm_storeu_si128(p + 1, res_hi_round); + } } } } @@ -204,6 +211,7 @@ void av1_convolve_2d_sse2(const uint8_t *src, int src_stride, int i, j; const int fo_vert = filter_params_y->taps / 2 - 1; const int fo_horiz = filter_params_x->taps / 2 - 1; + const int do_average = conv_params->do_average; const uint8_t *const src_ptr = src - fo_vert * src_stride - fo_horiz; const __m128i zero = _mm_setzero_si128(); @@ -357,9 +365,15 @@ void av1_convolve_2d_sse2(const uint8_t *src, int src_stride, // Accumulate values into the destination buffer __m128i *const p = (__m128i *)&dst[i * dst_stride + j]; - _mm_storeu_si128(p, _mm_add_epi32(_mm_loadu_si128(p), res_lo_round)); - _mm_storeu_si128(p + 1, - _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + if (do_average) { + _mm_storeu_si128(p + 0, + _mm_add_epi32(_mm_loadu_si128(p + 0), res_lo_round)); + _mm_storeu_si128(p + 1, + _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + } else { + _mm_storeu_si128(p + 0, res_lo_round); + _mm_storeu_si128(p + 1, res_hi_round); + } } } } diff --git a/third_party/aom/av1/common/x86/highbd_convolve_2d_ssse3.c b/third_party/aom/av1/common/x86/highbd_convolve_2d_ssse3.c index ff4a0a0fe..195f0f570 100644 --- a/third_party/aom/av1/common/x86/highbd_convolve_2d_ssse3.c +++ b/third_party/aom/av1/common/x86/highbd_convolve_2d_ssse3.c @@ -32,6 +32,7 @@ void av1_highbd_convolve_2d_ssse3(const uint16_t *src, int src_stride, int i, j; const int fo_vert = filter_params_y->taps / 2 - 1; const int fo_horiz = filter_params_x->taps / 2 - 1; + const int do_average = conv_params->do_average; const uint16_t *const src_ptr = src - fo_vert * src_stride - fo_horiz; /* Horizontal filter */ @@ -185,9 +186,15 @@ void av1_highbd_convolve_2d_ssse3(const uint16_t *src, int src_stride, // Accumulate values into the destination buffer __m128i *const p = (__m128i *)&dst[i * dst_stride + j]; - _mm_storeu_si128(p, _mm_add_epi32(_mm_loadu_si128(p), res_lo_round)); - _mm_storeu_si128(p + 1, - _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + if (do_average) { + _mm_storeu_si128(p + 0, + _mm_add_epi32(_mm_loadu_si128(p + 0), res_lo_round)); + _mm_storeu_si128(p + 1, + _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + } else { + _mm_storeu_si128(p + 0, res_lo_round); + _mm_storeu_si128(p + 1, res_hi_round); + } } } } @@ -204,6 +211,7 @@ void av1_highbd_convolve_2d_ssse3(const uint16_t *src, int src_stride, int im_h = h + filter_params_y->taps - 1; int im_stride = MAX_SB_SIZE; int i, j; + const int do_average = conv_params->do_average; const int fo_vert = filter_params_y->taps / 2 - 1; const int fo_horiz = filter_params_x->taps / 2 - 1; const uint16_t *const src_ptr = src - fo_vert * src_stride - fo_horiz; @@ -362,9 +370,15 @@ void av1_highbd_convolve_2d_ssse3(const uint16_t *src, int src_stride, // Accumulate values into the destination buffer __m128i *const p = (__m128i *)&dst[i * dst_stride + j]; - _mm_storeu_si128(p, _mm_add_epi32(_mm_loadu_si128(p), res_lo_round)); - _mm_storeu_si128(p + 1, - _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + if (do_average) { + _mm_storeu_si128(p + 0, + _mm_add_epi32(_mm_loadu_si128(p + 0), res_lo_round)); + _mm_storeu_si128(p + 1, + _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi_round)); + } else { + _mm_storeu_si128(p + 0, res_lo_round); + _mm_storeu_si128(p + 1, res_hi_round); + } } } } diff --git a/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c b/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c index dd2a681bc..0e833e6d9 100644 --- a/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c +++ b/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c @@ -599,7 +599,7 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) { } void av1_inv_txfm2d_add_32x32_avx2(const int32_t *coeff, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { __m256i in[128], out[128]; const TXFM_1D_CFG *row_cfg = NULL; const TXFM_1D_CFG *col_cfg = NULL; diff --git a/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c b/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c index a93699f0b..8613bed86 100644 --- a/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c +++ b/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c @@ -230,7 +230,7 @@ static void write_buffer_4x4(__m128i *in, uint16_t *output, int stride, } void av1_inv_txfm2d_add_4x4_sse4_1(const int32_t *coeff, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { __m128i in[4]; const TXFM_1D_CFG *row_cfg = NULL; const TXFM_1D_CFG *col_cfg = NULL; @@ -706,7 +706,7 @@ static void write_buffer_8x8(__m128i *in, uint16_t *output, int stride, } void av1_inv_txfm2d_add_8x8_sse4_1(const int32_t *coeff, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { __m128i in[16], out[16]; const TXFM_1D_CFG *row_cfg = NULL; const TXFM_1D_CFG *col_cfg = NULL; @@ -1316,7 +1316,7 @@ static void round_shift_16x16(__m128i *in, int shift) { } void av1_inv_txfm2d_add_16x16_sse4_1(const int32_t *coeff, uint16_t *output, - int stride, int tx_type, int bd) { + int stride, TX_TYPE tx_type, int bd) { __m128i in[64], out[64]; const TXFM_1D_CFG *row_cfg = NULL; const TXFM_1D_CFG *col_cfg = NULL; diff --git a/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c b/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c index 35d637f72..71b0ec7a3 100644 --- a/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c +++ b/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c @@ -28,6 +28,20 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, #error "HORSHEAR_REDUCE_PREC_BITS < 5 not currently supported by SSSE3 filter" #endif int i, j, k; +#if CONFIG_CONVOLVE_ROUND + const int use_conv_params = conv_params->round == CONVOLVE_OPT_NO_ROUND; + const int reduce_bits_horiz = + use_conv_params ? conv_params->round_0 : HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = + use_conv_params ? bd + FILTER_BITS - 1 : bd + WARPEDPIXEL_FILTER_BITS - 1; + if (use_conv_params) { + conv_params->do_post_rounding = 1; + } + assert(FILTER_BITS == WARPEDPIXEL_FILTER_BITS); +#else + const int reduce_bits_horiz = HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = bd + WARPEDPIXEL_FILTER_BITS - 1; +#endif /* Note: For this code to work, the left/right frame borders need to be extended by at least 13 pixels each. By the time we get here, other @@ -43,30 +57,17 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, for (i = 0; i < p_height; i += 8) { for (j = 0; j < p_width; j += 8) { - // (x, y) coordinates of the center of this block in the destination - // image - const int32_t dst_x = p_col + j + 4; - const int32_t dst_y = p_row + i + 4; - - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + const int32_t src_x = (p_col + j + 4) << subsampling_x; + const int32_t src_y = (p_row + i + 4) << subsampling_y; + const int32_t dst_x = mat[2] * src_x + mat[3] * src_y + mat[0]; + const int32_t dst_y = mat[4] * src_x + mat[5] * src_y + mat[1]; + const int32_t x4 = dst_x >> subsampling_x; + const int32_t y4 = dst_y >> subsampling_y; + + int32_t ix4 = x4 >> WARPEDMODEL_PREC_BITS; + int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + int32_t iy4 = y4 >> WARPEDMODEL_PREC_BITS; + int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); // Add in all the constant terms, including rounding and offset sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) + @@ -154,9 +155,8 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, // coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6 const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14); - const __m128i round_const = - _mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) + - ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1)); + const __m128i round_const = _mm_set1_epi32( + (1 << offset_bits_horiz) + ((1 << reduce_bits_horiz) >> 1)); // Calculate filtered results const __m128i res_0 = _mm_madd_epi16(src, coeff_0); @@ -169,8 +169,8 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4), _mm_add_epi32(res_2, res_6)); - res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const), - HORSHEAR_REDUCE_PREC_BITS); + res_even = _mm_sra_epi32(_mm_add_epi32(res_even, round_const), + _mm_cvtsi32_si128(reduce_bits_horiz)); // Filter odd-index pixels const __m128i tmp_1 = _mm_loadu_si128( @@ -207,8 +207,8 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5), _mm_add_epi32(res_3, res_7)); - res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const), - HORSHEAR_REDUCE_PREC_BITS); + res_odd = _mm_sra_epi32(_mm_add_epi32(res_odd, round_const), + _mm_cvtsi32_si128(reduce_bits_horiz)); // Combine results into one register. // We store the columns in the order 0, 2, 4, 6, 1, 3, 5, 7 @@ -299,39 +299,65 @@ void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref, _mm_add_epi32(res_5, res_7)); // Rearrange pixels back into the order 0 ... 7 - const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); - const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); - - // Round and pack into 8 bits - const __m128i round_const = - _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + - ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); - - const __m128i res_lo_round = _mm_srai_epi32( - _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); - const __m128i res_hi_round = _mm_srai_epi32( - _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); - - __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); - // Clamp res_16bit to the range [0, 2^bd - 1] - const __m128i max_val = _mm_set1_epi16((1 << bd) - 1); - const __m128i zero = _mm_setzero_si128(); - res_16bit = _mm_max_epi16(_mm_min_epi16(res_16bit, max_val), zero); - - // Store, blending with 'pred' if needed - __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; - - // Note: If we're outputting a 4x4 block, we need to be very careful - // to only output 4 pixels at this point, to avoid encode/decode - // mismatches when encoding with multiple threads. - if (p_width == 4) { - if (comp_avg) - res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p)); - _mm_storel_epi64(p, res_16bit); + __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); + __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); + +#if CONFIG_CONVOLVE_ROUND + if (use_conv_params) { + __m128i *const p = + (__m128i *)&conv_params + ->dst[(i + k + 4) * conv_params->dst_stride + j]; + const __m128i round_const = _mm_set1_epi32( + -(1 << (bd + 2 * FILTER_BITS - conv_params->round_0 - 1)) + + ((1 << (conv_params->round_1)) >> 1)); + res_lo = _mm_add_epi32(res_lo, round_const); + res_lo = + _mm_srl_epi16(res_lo, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) res_lo = _mm_add_epi32(_mm_loadu_si128(p), res_lo); + _mm_storeu_si128(p, res_lo); + if (p_width > 4) { + res_hi = _mm_add_epi32(res_hi, round_const); + res_hi = + _mm_srl_epi16(res_hi, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) + res_hi = _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi); + _mm_storeu_si128(p + 1, res_hi); + } } else { - if (comp_avg) - res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p)); - _mm_storeu_si128(p, res_16bit); +#else + { +#endif + // Round and pack into 8 bits + const __m128i round_const = + _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + + ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); + + const __m128i res_lo_round = _mm_srai_epi32( + _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); + const __m128i res_hi_round = _mm_srai_epi32( + _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); + + __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); + // Clamp res_16bit to the range [0, 2^bd - 1] + const __m128i max_val = _mm_set1_epi16((1 << bd) - 1); + const __m128i zero = _mm_setzero_si128(); + res_16bit = _mm_max_epi16(_mm_min_epi16(res_16bit, max_val), zero); + + // Store, blending with 'pred' if needed + __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; + + // Note: If we're outputting a 4x4 block, we need to be very careful + // to only output 4 pixels at this point, to avoid encode/decode + // mismatches when encoding with multiple threads. + if (p_width == 4) { + if (comp_avg) + res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p)); + _mm_storel_epi64(p, res_16bit); + } else { + if (comp_avg) + res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p)); + _mm_storeu_si128(p, res_16bit); + } } } } diff --git a/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c b/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c index 0648b95b3..c440d0f88 100644 --- a/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c +++ b/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c @@ -366,7 +366,7 @@ static void iidtx16(__m256i *in) { void av1_iht16x16_256_add_avx2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m256i in[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; load_buffer_16x16(input, in); switch (tx_type) { diff --git a/third_party/aom/av1/common/x86/idct_intrin_sse2.c b/third_party/aom/av1/common/x86/idct_intrin_sse2.c index bf12a26d3..541165c8d 100644 --- a/third_party/aom/av1/common/x86/idct_intrin_sse2.c +++ b/third_party/aom/av1/common/x86/idct_intrin_sse2.c @@ -63,7 +63,7 @@ void av1_iht4x4_16_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, __m128i in[2]; const __m128i zero = _mm_setzero_si128(); const __m128i eight = _mm_set1_epi16(8); - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; in[0] = load_input_data(input); in[1] = load_input_data(input + 8); @@ -155,7 +155,7 @@ void av1_iht8x8_64_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, __m128i in[8]; const __m128i zero = _mm_setzero_si128(); const __m128i final_rounding = _mm_set1_epi16(1 << 4); - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; // load input data in[0] = load_input_data(input); @@ -257,7 +257,7 @@ void av1_iht16x16_256_add_sse2(const tran_low_t *input, uint8_t *dest, __m128i in[32]; __m128i *in0 = &in[0]; __m128i *in1 = &in[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; load_buffer_8x16(input, in0); input += 8; @@ -393,7 +393,7 @@ static INLINE void flip_buffer_lr_8x8(__m128i *in) { void av1_iht8x16_128_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i in[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; in[0] = load_input_data(input + 0 * 8); in[1] = load_input_data(input + 1 * 8); @@ -559,7 +559,7 @@ static INLINE void write_buffer_8x8_round6(uint8_t *dest, __m128i *in, void av1_iht16x8_128_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i in[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; // Transpose 16x8 input into in[] in[0] = load_input_data(input + 0 * 16); @@ -720,7 +720,7 @@ static INLINE void write_buffer_8x4_round5(uint8_t *dest, __m128i *in, void av1_iht8x4_32_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i in[8]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; in[0] = load_input_data(input + 0 * 8); in[1] = load_input_data(input + 1 * 8); @@ -905,7 +905,7 @@ static INLINE void write_buffer_4x8_round5(uint8_t *dest, __m128i *in, void av1_iht4x8_32_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i in[8]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; // Load rows, packed two per element of 'in'. // We pack into the bottom half of 'in' so that the @@ -1128,7 +1128,7 @@ static INLINE void write_buffer_16x32_round6(uint8_t *dest, __m128i *intl, void av1_iht16x32_512_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i intl[16], intr[16], inbl[16], inbr[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; int i; for (i = 0; i < 16; ++i) { @@ -1282,7 +1282,7 @@ static INLINE void write_buffer_32x16_round6(uint8_t *dest, __m128i *in0, void av1_iht32x16_512_add_sse2(const tran_low_t *input, uint8_t *dest, int stride, const TxfmParam *txfm_param) { __m128i in0[16], in1[16], in2[16], in3[16]; - int tx_type = txfm_param->tx_type; + const TX_TYPE tx_type = txfm_param->tx_type; int i; for (i = 0; i < 16; ++i) { diff --git a/third_party/aom/av1/common/x86/intra_edge_sse4.c b/third_party/aom/av1/common/x86/intra_edge_sse4.c new file mode 100644 index 000000000..ea4acff33 --- /dev/null +++ b/third_party/aom/av1/common/x86/intra_edge_sse4.c @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2017, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include <assert.h> +#include <smmintrin.h> + +#include "./aom_config.h" +#include "./av1_rtcd.h" + +void av1_filter_intra_edge_sse4_1(uint8_t *p, int sz, int strength) { + if (!strength) return; + + DECLARE_ALIGNED(16, static const int8_t, kern[3][16]) = { + { 4, 8, 4, 0, 4, 8, 4, 0, 4, 8, 4, 0, 4, 8, 4, 0 }, // strength 1: 4,8,4 + { 5, 6, 5, 0, 5, 6, 5, 0, 5, 6, 5, 0, 5, 6, 5, 0 }, // strength 2: 5,6,5 + { 2, 4, 4, 4, 2, 0, 0, 0, 2, 4, 4, 4, 2, 0, 0, 0 } // strength 3: 2,4,4,4,2 + }; + + DECLARE_ALIGNED(16, static const int8_t, v_const[5][16]) = { + { 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6 }, + { 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + }; + + // Extend the first and last samples to simplify the loop for the 5-tap case + p[-1] = p[0]; + __m128i last = _mm_set1_epi8(p[sz - 1]); + _mm_storeu_si128((__m128i *)&p[sz], last); + + // Adjust input pointer for filter support area + uint8_t *in = (strength == 3) ? p - 1 : p; + + // Avoid modifying first/last samples + uint8_t *out = p + 1; + int len = sz - 2; + + const int use_3tap_filter = (strength < 3); + + if (use_3tap_filter) { + __m128i coef0 = _mm_lddqu_si128((__m128i const *)kern[strength - 1]); + __m128i shuf0 = _mm_lddqu_si128((__m128i const *)v_const[0]); + __m128i shuf1 = _mm_lddqu_si128((__m128i const *)v_const[1]); + __m128i iden = _mm_lddqu_si128((__m128i *)v_const[3]); + __m128i in0 = _mm_lddqu_si128((__m128i *)in); + while (len > 0) { + int n_out = (len < 8) ? len : 8; + __m128i d0 = _mm_shuffle_epi8(in0, shuf0); + __m128i d1 = _mm_shuffle_epi8(in0, shuf1); + d0 = _mm_maddubs_epi16(d0, coef0); + d1 = _mm_maddubs_epi16(d1, coef0); + d0 = _mm_hadd_epi16(d0, d1); + __m128i eight = _mm_set1_epi16(8); + d0 = _mm_add_epi16(d0, eight); + d0 = _mm_srai_epi16(d0, 4); + d0 = _mm_packus_epi16(d0, d0); + __m128i out0 = _mm_lddqu_si128((__m128i *)out); + __m128i n0 = _mm_set1_epi8(n_out); + __m128i mask = _mm_cmpgt_epi8(n0, iden); + out0 = _mm_blendv_epi8(out0, d0, mask); + _mm_storel_epi64((__m128i *)out, out0); + __m128i in1 = _mm_lddqu_si128((__m128i *)(in + 16)); + in0 = _mm_alignr_epi8(in1, in0, 8); + in += 8; + out += 8; + len -= n_out; + } + } else { // 5-tap filter + __m128i coef0 = _mm_lddqu_si128((__m128i const *)kern[strength - 1]); + __m128i two = _mm_set1_epi8(2); + __m128i shuf_a = _mm_lddqu_si128((__m128i const *)v_const[2]); + __m128i shuf_b = _mm_add_epi8(shuf_a, two); + __m128i shuf_c = _mm_add_epi8(shuf_b, two); + __m128i shuf_d = _mm_add_epi8(shuf_c, two); + __m128i iden = _mm_lddqu_si128((__m128i *)v_const[3]); + __m128i in0 = _mm_lddqu_si128((__m128i *)in); + while (len > 0) { + int n_out = (len < 8) ? len : 8; + __m128i d0 = _mm_shuffle_epi8(in0, shuf_a); + __m128i d1 = _mm_shuffle_epi8(in0, shuf_b); + __m128i d2 = _mm_shuffle_epi8(in0, shuf_c); + __m128i d3 = _mm_shuffle_epi8(in0, shuf_d); + d0 = _mm_maddubs_epi16(d0, coef0); + d1 = _mm_maddubs_epi16(d1, coef0); + d2 = _mm_maddubs_epi16(d2, coef0); + d3 = _mm_maddubs_epi16(d3, coef0); + d0 = _mm_hadd_epi16(d0, d1); + d2 = _mm_hadd_epi16(d2, d3); + d0 = _mm_hadd_epi16(d0, d2); + __m128i eight = _mm_set1_epi16(8); + d0 = _mm_add_epi16(d0, eight); + d0 = _mm_srai_epi16(d0, 4); + d0 = _mm_packus_epi16(d0, d0); + __m128i out0 = _mm_lddqu_si128((__m128i *)out); + __m128i n0 = _mm_set1_epi8(n_out); + __m128i mask = _mm_cmpgt_epi8(n0, iden); + out0 = _mm_blendv_epi8(out0, d0, mask); + _mm_storel_epi64((__m128i *)out, out0); + __m128i in1 = _mm_lddqu_si128((__m128i *)(in + 16)); + in0 = _mm_alignr_epi8(in1, in0, 8); + in += 8; + out += 8; + len -= n_out; + } + } +} + +void av1_filter_intra_edge_high_sse4_1(uint16_t *p, int sz, int strength) { + if (!strength) return; + + DECLARE_ALIGNED(16, static const int16_t, kern[3][8]) = { + { 4, 8, 4, 8, 4, 8, 4, 8 }, // strength 1: 4,8,4 + { 5, 6, 5, 6, 5, 6, 5, 6 }, // strength 2: 5,6,5 + { 2, 4, 2, 4, 2, 4, 2, 4 } // strength 3: 2,4,4,4,2 + }; + + DECLARE_ALIGNED(16, static const int16_t, + v_const[1][8]) = { { 0, 1, 2, 3, 4, 5, 6, 7 } }; + + // Extend the first and last samples to simplify the loop for the 5-tap case + p[-1] = p[0]; + __m128i last = _mm_set1_epi16(p[sz - 1]); + _mm_storeu_si128((__m128i *)&p[sz], last); + + // Adjust input pointer for filter support area + uint16_t *in = (strength == 3) ? p - 1 : p; + + // Avoid modifying first/last samples + uint16_t *out = p + 1; + int len = sz - 2; + + const int use_3tap_filter = (strength < 3); + + if (use_3tap_filter) { + __m128i coef0 = _mm_lddqu_si128((__m128i const *)kern[strength - 1]); + __m128i iden = _mm_lddqu_si128((__m128i *)v_const[0]); + __m128i in0 = _mm_lddqu_si128((__m128i *)&in[0]); + __m128i in8 = _mm_lddqu_si128((__m128i *)&in[8]); + while (len > 0) { + int n_out = (len < 8) ? len : 8; + __m128i in1 = _mm_alignr_epi8(in8, in0, 2); + __m128i in2 = _mm_alignr_epi8(in8, in0, 4); + __m128i in02 = _mm_add_epi16(in0, in2); + __m128i d0 = _mm_unpacklo_epi16(in02, in1); + __m128i d1 = _mm_unpackhi_epi16(in02, in1); + d0 = _mm_mullo_epi16(d0, coef0); + d1 = _mm_mullo_epi16(d1, coef0); + d0 = _mm_hadd_epi16(d0, d1); + __m128i eight = _mm_set1_epi16(8); + d0 = _mm_add_epi16(d0, eight); + d0 = _mm_srli_epi16(d0, 4); + __m128i out0 = _mm_lddqu_si128((__m128i *)out); + __m128i n0 = _mm_set1_epi16(n_out); + __m128i mask = _mm_cmpgt_epi16(n0, iden); + out0 = _mm_blendv_epi8(out0, d0, mask); + _mm_storeu_si128((__m128i *)out, out0); + in += 8; + in0 = in8; + in8 = _mm_lddqu_si128((__m128i *)&in[8]); + out += 8; + len -= n_out; + } + } else { // 5-tap filter + __m128i coef0 = _mm_lddqu_si128((__m128i const *)kern[strength - 1]); + __m128i iden = _mm_lddqu_si128((__m128i *)v_const[0]); + __m128i in0 = _mm_lddqu_si128((__m128i *)&in[0]); + __m128i in8 = _mm_lddqu_si128((__m128i *)&in[8]); + while (len > 0) { + int n_out = (len < 8) ? len : 8; + __m128i in1 = _mm_alignr_epi8(in8, in0, 2); + __m128i in2 = _mm_alignr_epi8(in8, in0, 4); + __m128i in3 = _mm_alignr_epi8(in8, in0, 6); + __m128i in4 = _mm_alignr_epi8(in8, in0, 8); + __m128i in04 = _mm_add_epi16(in0, in4); + __m128i in123 = _mm_add_epi16(in1, in2); + in123 = _mm_add_epi16(in123, in3); + __m128i d0 = _mm_unpacklo_epi16(in04, in123); + __m128i d1 = _mm_unpackhi_epi16(in04, in123); + d0 = _mm_mullo_epi16(d0, coef0); + d1 = _mm_mullo_epi16(d1, coef0); + d0 = _mm_hadd_epi16(d0, d1); + __m128i eight = _mm_set1_epi16(8); + d0 = _mm_add_epi16(d0, eight); + d0 = _mm_srli_epi16(d0, 4); + __m128i out0 = _mm_lddqu_si128((__m128i *)out); + __m128i n0 = _mm_set1_epi16(n_out); + __m128i mask = _mm_cmpgt_epi16(n0, iden); + out0 = _mm_blendv_epi8(out0, d0, mask); + _mm_storeu_si128((__m128i *)out, out0); + in += 8; + in0 = in8; + in8 = _mm_lddqu_si128((__m128i *)&in[8]); + out += 8; + len -= n_out; + } + } +} + +void av1_upsample_intra_edge_sse4_1(uint8_t *p, int sz) { + // interpolate half-sample positions + assert(sz <= 24); + + DECLARE_ALIGNED(16, static const int8_t, kernel[1][16]) = { + { -1, 9, 9, -1, -1, 9, 9, -1, -1, 9, 9, -1, -1, 9, 9, -1 } + }; + + DECLARE_ALIGNED(16, static const int8_t, v_const[2][16]) = { + { 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6 }, + { 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10 } + }; + + // Extend first/last samples (upper-left p[-1], last p[sz-1]) + // to support 4-tap filter + p[-2] = p[-1]; + p[sz] = p[sz - 1]; + + uint8_t *in = &p[-2]; + uint8_t *out = &p[-2]; + + int n = sz + 1; // Input length including upper-left sample + + __m128i in0 = _mm_lddqu_si128((__m128i *)&in[0]); + __m128i in16 = _mm_lddqu_si128((__m128i *)&in[16]); + + __m128i coef0 = _mm_lddqu_si128((__m128i *)kernel[0]); + __m128i shuf0 = _mm_lddqu_si128((__m128i *)v_const[0]); + __m128i shuf1 = _mm_lddqu_si128((__m128i *)v_const[1]); + + while (n > 0) { + __m128i in8 = _mm_alignr_epi8(in16, in0, 8); + __m128i d0 = _mm_shuffle_epi8(in0, shuf0); + __m128i d1 = _mm_shuffle_epi8(in0, shuf1); + __m128i d2 = _mm_shuffle_epi8(in8, shuf0); + __m128i d3 = _mm_shuffle_epi8(in8, shuf1); + d0 = _mm_maddubs_epi16(d0, coef0); + d1 = _mm_maddubs_epi16(d1, coef0); + d2 = _mm_maddubs_epi16(d2, coef0); + d3 = _mm_maddubs_epi16(d3, coef0); + d0 = _mm_hadd_epi16(d0, d1); + d2 = _mm_hadd_epi16(d2, d3); + __m128i eight = _mm_set1_epi16(8); + d0 = _mm_add_epi16(d0, eight); + d2 = _mm_add_epi16(d2, eight); + d0 = _mm_srai_epi16(d0, 4); + d2 = _mm_srai_epi16(d2, 4); + d0 = _mm_packus_epi16(d0, d2); + __m128i in1 = _mm_alignr_epi8(in16, in0, 1); + __m128i out0 = _mm_unpacklo_epi8(in1, d0); + __m128i out1 = _mm_unpackhi_epi8(in1, d0); + _mm_storeu_si128((__m128i *)&out[0], out0); + _mm_storeu_si128((__m128i *)&out[16], out1); + in0 = in16; + in16 = _mm_setzero_si128(); + out += 32; + n -= 16; + } +} + +void av1_upsample_intra_edge_high_sse4_1(uint16_t *p, int sz, int bd) { + // interpolate half-sample positions + assert(sz <= 24); + + DECLARE_ALIGNED(16, static const int16_t, + kernel[1][8]) = { { -1, 9, -1, 9, -1, 9, -1, 9 } }; + + // Extend first/last samples (upper-left p[-1], last p[sz-1]) + // to support 4-tap filter + p[-2] = p[-1]; + p[sz] = p[sz - 1]; + + uint16_t *in = &p[-2]; + uint16_t *out = in; + int n = sz + 1; + + __m128i in0 = _mm_lddqu_si128((__m128i *)&in[0]); + __m128i in8 = _mm_lddqu_si128((__m128i *)&in[8]); + __m128i in16 = _mm_lddqu_si128((__m128i *)&in[16]); + __m128i in24 = _mm_lddqu_si128((__m128i *)&in[24]); + + while (n > 0) { + __m128i in1 = _mm_alignr_epi8(in8, in0, 2); + __m128i in2 = _mm_alignr_epi8(in8, in0, 4); + __m128i in3 = _mm_alignr_epi8(in8, in0, 6); + __m128i sum0 = _mm_add_epi16(in0, in3); + __m128i sum1 = _mm_add_epi16(in1, in2); + __m128i d0 = _mm_unpacklo_epi16(sum0, sum1); + __m128i d1 = _mm_unpackhi_epi16(sum0, sum1); + __m128i coef0 = _mm_lddqu_si128((__m128i *)kernel[0]); + d0 = _mm_madd_epi16(d0, coef0); + d1 = _mm_madd_epi16(d1, coef0); + __m128i eight = _mm_set1_epi32(8); + d0 = _mm_add_epi32(d0, eight); + d1 = _mm_add_epi32(d1, eight); + d0 = _mm_srai_epi32(d0, 4); + d1 = _mm_srai_epi32(d1, 4); + d0 = _mm_packus_epi32(d0, d1); + __m128i max0 = _mm_set1_epi16((1 << bd) - 1); + d0 = _mm_min_epi16(d0, max0); + __m128i out0 = _mm_unpacklo_epi16(in1, d0); + __m128i out1 = _mm_unpackhi_epi16(in1, d0); + _mm_storeu_si128((__m128i *)&out[0], out0); + _mm_storeu_si128((__m128i *)&out[8], out1); + in0 = in8; + in8 = in16; + in16 = in24; + in24 = _mm_setzero_si128(); + out += 16; + n -= 8; + } +} diff --git a/third_party/aom/av1/common/x86/selfguided_sse4.c b/third_party/aom/av1/common/x86/selfguided_sse4.c index e2e4f51c3..4006b8518 100644 --- a/third_party/aom/av1/common/x86/selfguided_sse4.c +++ b/third_party/aom/av1/common/x86/selfguided_sse4.c @@ -3,6 +3,7 @@ #include "./aom_config.h" #include "./av1_rtcd.h" #include "av1/common/restoration.h" +#include "aom_dsp/x86/synonyms.h" /* Calculate four consecutive entries of the intermediate A and B arrays (corresponding to the first loop in the C version of @@ -71,8 +72,8 @@ static void selfguided_restoration_1_v(uint8_t *src, int width, int height, __m128i a, b, x, y, x2, y2; __m128i sum, sum_sq, tmp; - a = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[j])); - b = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[src_stride + j])); + a = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[j])); + b = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[src_stride + j])); sum = _mm_cvtepi16_epi32(_mm_add_epi16(a, b)); tmp = _mm_unpacklo_epi16(a, b); @@ -81,7 +82,7 @@ static void selfguided_restoration_1_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[j], sum); _mm_store_si128((__m128i *)&A[j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[2 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[2 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -91,9 +92,9 @@ static void selfguided_restoration_1_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[i * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 1) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 1) * src_stride + j])); y = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i + 2) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i + 2) * src_stride + j])); sum = _mm_add_epi32(sum, _mm_sub_epi32(y, x)); @@ -106,7 +107,7 @@ static void selfguided_restoration_1_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[i * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 1) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 1) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -242,9 +243,9 @@ static void selfguided_restoration_2_v(uint8_t *src, int width, int height, __m128i a, b, c, c2, x, y, x2, y2; __m128i sum, sum_sq, tmp; - a = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[j])); - b = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[src_stride + j])); - c = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[2 * src_stride + j])); + a = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[j])); + b = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[src_stride + j])); + c = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[2 * src_stride + j])); sum = _mm_cvtepi16_epi32(_mm_add_epi16(_mm_add_epi16(a, b), c)); // Important: Since c may be up to 2^8, the result on squaring may @@ -256,7 +257,7 @@ static void selfguided_restoration_2_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[j], sum); _mm_store_si128((__m128i *)&A[j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[3 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[3 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -264,7 +265,7 @@ static void selfguided_restoration_2_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[buf_stride + j], sum); _mm_store_si128((__m128i *)&A[buf_stride + j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[4 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[4 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -289,7 +290,7 @@ static void selfguided_restoration_2_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[i * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 2) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 2) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -298,7 +299,7 @@ static void selfguided_restoration_2_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[(i + 1) * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 1) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 1) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -443,10 +444,10 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, __m128i a, b, c, d, x, y, x2, y2; __m128i sum, sum_sq, tmp, tmp2; - a = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[j])); - b = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[src_stride + j])); - c = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[2 * src_stride + j])); - d = _mm_cvtepu8_epi16(_mm_loadl_epi64((__m128i *)&src[3 * src_stride + j])); + a = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[j])); + b = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[src_stride + j])); + c = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[2 * src_stride + j])); + d = _mm_cvtepu8_epi16(xx_loadl_32((__m128i *)&src[3 * src_stride + j])); sum = _mm_cvtepi16_epi32( _mm_add_epi16(_mm_add_epi16(a, b), _mm_add_epi16(c, d))); @@ -458,7 +459,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[j], sum); _mm_store_si128((__m128i *)&A[j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[4 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[4 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -466,7 +467,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[buf_stride + j], sum); _mm_store_si128((__m128i *)&A[buf_stride + j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[5 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[5 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -474,7 +475,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[2 * buf_stride + j], sum); _mm_store_si128((__m128i *)&A[2 * buf_stride + j], sum_sq); - x = _mm_cvtepu8_epi32(_mm_loadl_epi64((__m128i *)&src[6 * src_stride + j])); + x = _mm_cvtepu8_epi32(xx_loadl_32((__m128i *)&src[6 * src_stride + j])); sum = _mm_add_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_add_epi32(sum_sq, x2); @@ -483,10 +484,8 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&B[i * buf_stride + j], sum); _mm_store_si128((__m128i *)&A[i * buf_stride + j], sum_sq); - x = _mm_cvtepu8_epi32( - _mm_cvtsi32_si128(*((int *)&src[(i - 3) * src_stride + j]))); - y = _mm_cvtepu8_epi32( - _mm_cvtsi32_si128(*((int *)&src[(i + 4) * src_stride + j]))); + x = _mm_cvtepu8_epi32(xx_loadl_32(&src[(i - 3) * src_stride + j])); + y = _mm_cvtepu8_epi32(xx_loadl_32(&src[(i + 4) * src_stride + j])); sum = _mm_add_epi32(sum, _mm_sub_epi32(y, x)); @@ -499,7 +498,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[i * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 3) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 3) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -508,7 +507,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[(i + 1) * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 2) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 2) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -517,7 +516,7 @@ static void selfguided_restoration_3_v(uint8_t *src, int width, int height, _mm_store_si128((__m128i *)&A[(i + 2) * buf_stride + j], sum_sq); x = _mm_cvtepu8_epi32( - _mm_loadl_epi64((__m128i *)&src[(i - 1) * src_stride + j])); + xx_loadl_32((__m128i *)&src[(i - 1) * src_stride + j])); sum = _mm_sub_epi32(sum, x); x2 = _mm_mullo_epi32(x, x); sum_sq = _mm_sub_epi32(sum_sq, x2); @@ -664,38 +663,48 @@ static void selfguided_restoration_3_h(int32_t *A, int32_t *B, int width, } void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, - int stride, int32_t *dst, int dst_stride, - int r, int eps, int32_t *tmpbuf) { - int32_t *A = tmpbuf; - int32_t *B = A + SGRPROJ_OUTBUF_SIZE; + int dgd_stride, int32_t *dst, + int dst_stride, int r, int eps) { + const int width_ext = width + 2 * SGRPROJ_BORDER_HORZ; + const int height_ext = height + 2 * SGRPROJ_BORDER_VERT; + int32_t A_[RESTORATION_PROC_UNIT_PELS]; + int32_t B_[RESTORATION_PROC_UNIT_PELS]; + int32_t *A = A_; + int32_t *B = B_; int i, j; // Adjusting the stride of A and B here appears to avoid bad cache effects, // leading to a significant speed improvement. // We also align the stride to a multiple of 16 bytes for efficiency. - int buf_stride = ((width + 3) & ~3) + 16; + int buf_stride = ((width_ext + 3) & ~3) + 16; // Don't filter tiles with dimensions < 5 on any axis if ((width < 5) || (height < 5)) return; + uint8_t *dgd0 = dgd - dgd_stride * SGRPROJ_BORDER_VERT - SGRPROJ_BORDER_HORZ; if (r == 1) { - selfguided_restoration_1_v(dgd, width, height, stride, A, B, buf_stride); - selfguided_restoration_1_h(A, B, width, height, buf_stride, eps, 8); + selfguided_restoration_1_v(dgd0, width_ext, height_ext, dgd_stride, A, B, + buf_stride); + selfguided_restoration_1_h(A, B, width_ext, height_ext, buf_stride, eps, 8); } else if (r == 2) { - selfguided_restoration_2_v(dgd, width, height, stride, A, B, buf_stride); - selfguided_restoration_2_h(A, B, width, height, buf_stride, eps, 8); + selfguided_restoration_2_v(dgd0, width_ext, height_ext, dgd_stride, A, B, + buf_stride); + selfguided_restoration_2_h(A, B, width_ext, height_ext, buf_stride, eps, 8); } else if (r == 3) { - selfguided_restoration_3_v(dgd, width, height, stride, A, B, buf_stride); - selfguided_restoration_3_h(A, B, width, height, buf_stride, eps, 8); + selfguided_restoration_3_v(dgd0, width_ext, height_ext, dgd_stride, A, B, + buf_stride); + selfguided_restoration_3_h(A, B, width_ext, height_ext, buf_stride, eps, 8); } else { assert(0); } + A += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; + B += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; { i = 0; j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k + buf_stride] + @@ -707,7 +716,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, } for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k + buf_stride] + @@ -720,7 +729,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k + buf_stride] + @@ -735,7 +744,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + @@ -751,7 +760,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, // Vectorize the innermost loop for (j = 1; j < width - 1; j += 4) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 5; @@ -804,7 +813,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, // (typically have 2 such pixels, but may have anywhere between 0 and 3) for (; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 5; const int32_t a = @@ -826,7 +835,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + @@ -845,7 +854,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k - buf_stride] + @@ -857,7 +866,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, } for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k - buf_stride] + @@ -870,7 +879,7 @@ void av1_selfguided_restoration_sse4_1(uint8_t *dgd, int width, int height, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k - buf_stride] + @@ -1051,7 +1060,6 @@ void apply_selfguided_restoration_sse4_1(uint8_t *dat, int width, int height, int xq[2]; int32_t *flt1 = tmpbuf; int32_t *flt2 = flt1 + RESTORATION_TILEPELS_MAX; - int32_t *tmpbuf2 = flt2 + RESTORATION_TILEPELS_MAX; int i, j; assert(width * height <= RESTORATION_TILEPELS_MAX); #if USE_HIGHPASS_IN_SGRPROJ @@ -1059,12 +1067,10 @@ void apply_selfguided_restoration_sse4_1(uint8_t *dat, int width, int height, sgr_params[eps].corner, sgr_params[eps].edge); #else av1_selfguided_restoration_sse4_1(dat, width, height, stride, flt1, width, - sgr_params[eps].r1, sgr_params[eps].e1, - tmpbuf2); + sgr_params[eps].r1, sgr_params[eps].e1); #endif // USE_HIGHPASS_IN_SGRPROJ av1_selfguided_restoration_sse4_1(dat, width, height, stride, flt2, width, - sgr_params[eps].r2, sgr_params[eps].e2, - tmpbuf2); + sgr_params[eps].r2, sgr_params[eps].e2); decode_xq(xqd, xq); __m128i xq0 = _mm_set1_epi32(xq[0]); @@ -1364,43 +1370,52 @@ static void highbd_selfguided_restoration_3_v(uint16_t *src, int width, } void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, - int height, int stride, + int height, int dgd_stride, int32_t *dst, int dst_stride, - int bit_depth, int r, int eps, - int32_t *tmpbuf) { - int32_t *A = tmpbuf; - int32_t *B = A + SGRPROJ_OUTBUF_SIZE; + int bit_depth, int r, int eps) { + const int width_ext = width + 2 * SGRPROJ_BORDER_HORZ; + const int height_ext = height + 2 * SGRPROJ_BORDER_VERT; + int32_t A_[RESTORATION_PROC_UNIT_PELS]; + int32_t B_[RESTORATION_PROC_UNIT_PELS]; + int32_t *A = A_; + int32_t *B = B_; int i, j; // Adjusting the stride of A and B here appears to avoid bad cache effects, // leading to a significant speed improvement. // We also align the stride to a multiple of 16 bytes for efficiency. - int buf_stride = ((width + 3) & ~3) + 16; + int buf_stride = ((width_ext + 3) & ~3) + 16; // Don't filter tiles with dimensions < 5 on any axis if ((width < 5) || (height < 5)) return; + uint16_t *dgd0 = dgd - dgd_stride * SGRPROJ_BORDER_VERT - SGRPROJ_BORDER_HORZ; if (r == 1) { - highbd_selfguided_restoration_1_v(dgd, width, height, stride, A, B, - buf_stride); - selfguided_restoration_1_h(A, B, width, height, buf_stride, eps, bit_depth); + highbd_selfguided_restoration_1_v(dgd0, width_ext, height_ext, dgd_stride, + A, B, buf_stride); + selfguided_restoration_1_h(A, B, width_ext, height_ext, buf_stride, eps, + bit_depth); } else if (r == 2) { - highbd_selfguided_restoration_2_v(dgd, width, height, stride, A, B, - buf_stride); - selfguided_restoration_2_h(A, B, width, height, buf_stride, eps, bit_depth); + highbd_selfguided_restoration_2_v(dgd0, width_ext, height_ext, dgd_stride, + A, B, buf_stride); + selfguided_restoration_2_h(A, B, width_ext, height_ext, buf_stride, eps, + bit_depth); } else if (r == 3) { - highbd_selfguided_restoration_3_v(dgd, width, height, stride, A, B, - buf_stride); - selfguided_restoration_3_h(A, B, width, height, buf_stride, eps, bit_depth); + highbd_selfguided_restoration_3_v(dgd0, width_ext, height_ext, dgd_stride, + A, B, buf_stride); + selfguided_restoration_3_h(A, B, width_ext, height_ext, buf_stride, eps, + bit_depth); } else { assert(0); } + A += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; + B += SGRPROJ_BORDER_VERT * buf_stride + SGRPROJ_BORDER_HORZ; { i = 0; j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k + buf_stride] + @@ -1412,7 +1427,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, } for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k + buf_stride] + @@ -1425,7 +1440,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k + buf_stride] + @@ -1440,7 +1455,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + @@ -1456,7 +1471,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, // Vectorize the innermost loop for (j = 1; j < width - 1; j += 4) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 5; @@ -1509,7 +1524,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, // (typically have 2 such pixels, but may have anywhere between 0 and 3) for (; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 5; const int32_t a = @@ -1531,7 +1546,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - buf_stride] + A[k + buf_stride]) + @@ -1550,7 +1565,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, j = 0; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k + 1] + 2 * A[k - buf_stride] + @@ -1562,7 +1577,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, } for (j = 1; j < width - 1; ++j) { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = A[k] + 2 * (A[k - 1] + A[k + 1]) + A[k - buf_stride] + @@ -1575,7 +1590,7 @@ void av1_selfguided_restoration_highbd_sse4_1(uint16_t *dgd, int width, j = width - 1; { const int k = i * buf_stride + j; - const int l = i * stride + j; + const int l = i * dgd_stride + j; const int m = i * dst_stride + j; const int nb = 3; const int32_t a = 3 * A[k] + 2 * A[k - 1] + 2 * A[k - buf_stride] + @@ -1725,7 +1740,6 @@ void apply_selfguided_restoration_highbd_sse4_1( int xq[2]; int32_t *flt1 = tmpbuf; int32_t *flt2 = flt1 + RESTORATION_TILEPELS_MAX; - int32_t *tmpbuf2 = flt2 + RESTORATION_TILEPELS_MAX; int i, j; assert(width * height <= RESTORATION_TILEPELS_MAX); #if USE_HIGHPASS_IN_SGRPROJ @@ -1735,11 +1749,11 @@ void apply_selfguided_restoration_highbd_sse4_1( #else av1_selfguided_restoration_highbd_sse4_1(dat, width, height, stride, flt1, width, bit_depth, sgr_params[eps].r1, - sgr_params[eps].e1, tmpbuf2); + sgr_params[eps].e1); #endif // USE_HIGHPASS_IN_SGRPROJ av1_selfguided_restoration_highbd_sse4_1(dat, width, height, stride, flt2, width, bit_depth, sgr_params[eps].r2, - sgr_params[eps].e2, tmpbuf2); + sgr_params[eps].e2); decode_xq(xqd, xq); __m128i xq0 = _mm_set1_epi32(xq[0]); diff --git a/third_party/aom/av1/common/x86/warp_plane_sse2.c b/third_party/aom/av1/common/x86/warp_plane_sse2.c index 5a22d9abf..d30466ae6 100644 --- a/third_party/aom/av1/common/x86/warp_plane_sse2.c +++ b/third_party/aom/av1/common/x86/warp_plane_sse2.c @@ -24,6 +24,20 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, __m128i tmp[15]; int i, j, k; const int bd = 8; +#if CONFIG_CONVOLVE_ROUND + const int use_conv_params = conv_params->round == CONVOLVE_OPT_NO_ROUND; + const int reduce_bits_horiz = + use_conv_params ? conv_params->round_0 : HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = + use_conv_params ? bd + FILTER_BITS - 1 : bd + WARPEDPIXEL_FILTER_BITS - 1; + if (use_conv_params) { + conv_params->do_post_rounding = 1; + } + assert(FILTER_BITS == WARPEDPIXEL_FILTER_BITS); +#else + const int reduce_bits_horiz = HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = bd + WARPEDPIXEL_FILTER_BITS - 1; +#endif /* Note: For this code to work, the left/right frame borders need to be extended by at least 13 pixels each. By the time we get here, other @@ -39,30 +53,17 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, for (i = 0; i < p_height; i += 8) { for (j = 0; j < p_width; j += 8) { - // (x, y) coordinates of the center of this block in the destination - // image - const int32_t dst_x = p_col + j + 4; - const int32_t dst_y = p_row + i + 4; - - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + const int32_t src_x = (p_col + j + 4) << subsampling_x; + const int32_t src_y = (p_row + i + 4) << subsampling_y; + const int32_t dst_x = mat[2] * src_x + mat[3] * src_y + mat[0]; + const int32_t dst_y = mat[4] * src_x + mat[5] * src_y + mat[1]; + const int32_t x4 = dst_x >> subsampling_x; + const int32_t y4 = dst_y >> subsampling_y; + + int32_t ix4 = x4 >> WARPEDMODEL_PREC_BITS; + int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + int32_t iy4 = y4 >> WARPEDMODEL_PREC_BITS; + int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); // Add in all the constant terms, including rounding and offset sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) + @@ -149,9 +150,8 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, // coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6 const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14); - const __m128i round_const = - _mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) + - ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1)); + const __m128i round_const = _mm_set1_epi32( + (1 << offset_bits_horiz) + ((1 << reduce_bits_horiz) >> 1)); // Calculate filtered results const __m128i src_0 = _mm_unpacklo_epi8(src, zero); @@ -165,8 +165,8 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4), _mm_add_epi32(res_2, res_6)); - res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const), - HORSHEAR_REDUCE_PREC_BITS); + res_even = _mm_sra_epi32(_mm_add_epi32(res_even, round_const), + _mm_cvtsi32_si128(reduce_bits_horiz)); // Filter odd-index pixels const __m128i tmp_1 = _mm_loadu_si128( @@ -203,8 +203,8 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5), _mm_add_epi32(res_3, res_7)); - res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const), - HORSHEAR_REDUCE_PREC_BITS); + res_odd = _mm_sra_epi32(_mm_add_epi32(res_odd, round_const), + _mm_cvtsi32_si128(reduce_bits_horiz)); // Combine results into one register. // We store the columns in the order 0, 2, 4, 6, 1, 3, 5, 7 @@ -295,37 +295,63 @@ void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width, _mm_add_epi32(res_5, res_7)); // Rearrange pixels back into the order 0 ... 7 - const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); - const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); - - // Round and pack into 8 bits - const __m128i round_const = - _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + - ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); - - const __m128i res_lo_round = _mm_srai_epi32( - _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); - const __m128i res_hi_round = _mm_srai_epi32( - _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); - - const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); - __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit); - - // Store, blending with 'pred' if needed - __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; - - // Note: If we're outputting a 4x4 block, we need to be very careful - // to only output 4 pixels at this point, to avoid encode/decode - // mismatches when encoding with multiple threads. - if (p_width == 4) { - if (comp_avg) { - const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p); - res_8bit = _mm_avg_epu8(res_8bit, orig); + __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); + __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); + +#if CONFIG_CONVOLVE_ROUND + if (use_conv_params) { + __m128i *const p = + (__m128i *)&conv_params + ->dst[(i + k + 4) * conv_params->dst_stride + j]; + const __m128i round_const = _mm_set1_epi32( + -(1 << (bd + 2 * FILTER_BITS - conv_params->round_0 - 1)) + + ((1 << (conv_params->round_1)) >> 1)); + res_lo = _mm_add_epi32(res_lo, round_const); + res_lo = + _mm_srl_epi16(res_lo, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) res_lo = _mm_add_epi32(_mm_loadu_si128(p), res_lo); + _mm_storeu_si128(p, res_lo); + if (p_width > 4) { + res_hi = _mm_add_epi32(res_hi, round_const); + res_hi = + _mm_srl_epi16(res_hi, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) + res_hi = _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi); + _mm_storeu_si128(p + 1, res_hi); } - *(uint32_t *)p = _mm_cvtsi128_si32(res_8bit); } else { - if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p)); - _mm_storel_epi64(p, res_8bit); +#else + { +#endif + // Round and pack into 8 bits + const __m128i round_const = + _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + + ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); + + const __m128i res_lo_round = _mm_srai_epi32( + _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); + const __m128i res_hi_round = _mm_srai_epi32( + _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); + + const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); + __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit); + + // Store, blending with 'pred' if needed + __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; + + // Note: If we're outputting a 4x4 block, we need to be very careful + // to only output 4 pixels at this point, to avoid encode/decode + // mismatches when encoding with multiple threads. + if (p_width == 4) { + if (comp_avg) { + const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p); + res_8bit = _mm_avg_epu8(res_8bit, orig); + } + *(uint32_t *)p = _mm_cvtsi128_si32(res_8bit); + } else { + if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p)); + _mm_storel_epi64(p, res_8bit); + } } } } diff --git a/third_party/aom/av1/common/x86/warp_plane_ssse3.c b/third_party/aom/av1/common/x86/warp_plane_ssse3.c index f8e6f62ba..3986ad389 100644 --- a/third_party/aom/av1/common/x86/warp_plane_ssse3.c +++ b/third_party/aom/av1/common/x86/warp_plane_ssse3.c @@ -211,6 +211,20 @@ void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width, __m128i tmp[15]; int i, j, k; const int bd = 8; +#if CONFIG_CONVOLVE_ROUND + const int use_conv_params = conv_params->round == CONVOLVE_OPT_NO_ROUND; + const int reduce_bits_horiz = + use_conv_params ? conv_params->round_0 : HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = + use_conv_params ? bd + FILTER_BITS - 1 : bd + WARPEDPIXEL_FILTER_BITS - 1; + if (use_conv_params) { + conv_params->do_post_rounding = 1; + } + assert(FILTER_BITS == WARPEDPIXEL_FILTER_BITS); +#else + const int reduce_bits_horiz = HORSHEAR_REDUCE_PREC_BITS; + const int offset_bits_horiz = bd + WARPEDPIXEL_FILTER_BITS - 1; +#endif /* Note: For this code to work, the left/right frame borders need to be extended by at least 13 pixels each. By the time we get here, other @@ -226,30 +240,17 @@ void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width, for (i = 0; i < p_height; i += 8) { for (j = 0; j < p_width; j += 8) { - // (x, y) coordinates of the center of this block in the destination - // image - const int32_t dst_x = p_col + j + 4; - const int32_t dst_y = p_row + i + 4; - - int32_t x4, y4, ix4, sx4, iy4, sy4; - if (subsampling_x) - x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 + - (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0]; - - if (subsampling_y) - y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 + - (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) / - 4; - else - y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1]; - - ix4 = x4 >> WARPEDMODEL_PREC_BITS; - sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); - iy4 = y4 >> WARPEDMODEL_PREC_BITS; - sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + const int32_t src_x = (p_col + j + 4) << subsampling_x; + const int32_t src_y = (p_row + i + 4) << subsampling_y; + const int32_t dst_x = mat[2] * src_x + mat[3] * src_y + mat[0]; + const int32_t dst_y = mat[4] * src_x + mat[5] * src_y + mat[1]; + const int32_t x4 = dst_x >> subsampling_x; + const int32_t y4 = dst_y >> subsampling_y; + + int32_t ix4 = x4 >> WARPEDMODEL_PREC_BITS; + int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); + int32_t iy4 = y4 >> WARPEDMODEL_PREC_BITS; + int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1); // Add in all the constant terms, including rounding and offset sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) + @@ -369,9 +370,8 @@ void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width, _mm_srli_si128(src_odd, 4), _mm_srli_si128(src_even, 6)); const __m128i res_57 = _mm_maddubs_epi16(src_57, coeff_57); - const __m128i round_const = - _mm_set1_epi16((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) + - ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1)); + const __m128i round_const = _mm_set1_epi16( + (1 << offset_bits_horiz) + ((1 << reduce_bits_horiz) >> 1)); // Note: The values res_02 + res_46 and res_13 + res_57 both // fit into int16s at this point, but their sum may be too wide to fit @@ -385,7 +385,7 @@ void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width, const __m128i res_odd = _mm_add_epi16(res_13, res_57); const __m128i res = _mm_add_epi16(_mm_add_epi16(res_even, res_odd), round_const); - tmp[k + 7] = _mm_srli_epi16(res, HORSHEAR_REDUCE_PREC_BITS); + tmp[k + 7] = _mm_srl_epi16(res, _mm_cvtsi32_si128(reduce_bits_horiz)); } } @@ -471,37 +471,63 @@ void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width, _mm_add_epi32(res_5, res_7)); // Rearrange pixels back into the order 0 ... 7 - const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); - const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); - - // Round and pack into 8 bits - const __m128i round_const = - _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + - ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); - - const __m128i res_lo_round = _mm_srai_epi32( - _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); - const __m128i res_hi_round = _mm_srai_epi32( - _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); - - const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); - __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit); - - // Store, blending with 'pred' if needed - __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; - - // Note: If we're outputting a 4x4 block, we need to be very careful - // to only output 4 pixels at this point, to avoid encode/decode - // mismatches when encoding with multiple threads. - if (p_width == 4) { - if (comp_avg) { - const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p); - res_8bit = _mm_avg_epu8(res_8bit, orig); + __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd); + __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd); + +#if CONFIG_CONVOLVE_ROUND + if (use_conv_params) { + __m128i *const p = + (__m128i *)&conv_params + ->dst[(i + k + 4) * conv_params->dst_stride + j]; + const __m128i round_const = _mm_set1_epi32( + -(1 << (bd + 2 * FILTER_BITS - conv_params->round_0 - 1)) + + ((1 << (conv_params->round_1)) >> 1)); + res_lo = _mm_add_epi32(res_lo, round_const); + res_lo = + _mm_srl_epi16(res_lo, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) res_lo = _mm_add_epi32(_mm_loadu_si128(p), res_lo); + _mm_storeu_si128(p, res_lo); + if (p_width > 4) { + res_hi = _mm_add_epi32(res_hi, round_const); + res_hi = + _mm_srl_epi16(res_hi, _mm_cvtsi32_si128(conv_params->round_1)); + if (comp_avg) + res_hi = _mm_add_epi32(_mm_loadu_si128(p + 1), res_hi); + _mm_storeu_si128(p + 1, res_hi); } - *(uint32_t *)p = _mm_cvtsi128_si32(res_8bit); } else { - if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p)); - _mm_storel_epi64(p, res_8bit); +#else + { +#endif + // Round and pack into 8 bits + const __m128i round_const = + _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) + + ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1)); + + const __m128i res_lo_round = _mm_srai_epi32( + _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS); + const __m128i res_hi_round = _mm_srai_epi32( + _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS); + + const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round); + __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit); + + // Store, blending with 'pred' if needed + __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j]; + + // Note: If we're outputting a 4x4 block, we need to be very careful + // to only output 4 pixels at this point, to avoid encode/decode + // mismatches when encoding with multiple threads. + if (p_width == 4) { + if (comp_avg) { + const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p); + res_8bit = _mm_avg_epu8(res_8bit, orig); + } + *(uint32_t *)p = _mm_cvtsi128_si32(res_8bit); + } else { + if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p)); + _mm_storel_epi64(p, res_8bit); + } } } } |