diff --git a/av1/common/alloccommon.c b/av1/common/alloccommon.c index 371e2dfe530d6bdfc17b16de4053a0a90e405d12..a7a2c5c0bf082ede7144865df34fef44322f1707 100644 --- a/av1/common/alloccommon.c +++ b/av1/common/alloccommon.c @@ -25,13 +25,8 @@ int av1_get_MBs(int width, int height) { 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; } @@ -48,13 +43,8 @@ void av1_set_mb_mi(AV1_COMMON *cm, int width, int height) { cm->mi_rows = aligned_height >> MI_SIZE_LOG2; cm->mi_stride = calc_mi_size(cm->mi_cols); -#if CONFIG_CB4X4 cm->mb_cols = (cm->mi_cols + 2) >> 2; cm->mb_rows = (cm->mi_rows + 2) >> 2; -#else - cm->mb_cols = (cm->mi_cols + 1) >> 1; - cm->mb_rows = (cm->mi_rows + 1) >> 1; -#endif cm->MBs = cm->mb_rows * cm->mb_cols; } diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c index 4da314a865e107543d536123fd7c5e892c3c1a6d..4dfc15f2d6c914730e865bc2741f5c27fc2f84b4 100644 --- a/av1/common/av1_loopfilter.c +++ b/av1/common/av1_loopfilter.c @@ -2981,13 +2981,6 @@ static void set_lpf_parameters( } } -#if !CONFIG_CB4X4 - // prepare internal edge parameters - if (curr_level && !curr_skipped) { - params->filter_length_internal = (TX_4X4 >= ts) ? (4) : (0); - } -#endif - // prepare common parameters if (params->filter_length || params->filter_length_internal) { const loop_filter_thresh *const limits = cm->lf_info.lfthr + level; @@ -3474,9 +3467,6 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, int mi_row, mi_col; int plane; -#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \ - CONFIG_CB4X4 - #if !CONFIG_PARALLEL_DEBLOCKING #if CONFIG_VAR_TX for (int i = 0; i < MAX_MB_PLANE; ++i) @@ -3521,75 +3511,7 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, } } } -#endif // CONFIG_PARALLEL_DEBLOCKING - -#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES - -#if CONFIG_PARALLEL_DEBLOCKING - for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { - 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 (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) { - 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 (plane = plane_start; plane < plane_end; plane += 1) { - av1_filter_block_plane_horz(cm, plane, &planes[plane], mi_row, mi_col); - } - } - } -#else // CONFIG_PARALLEL_DEBLOCKING - enum lf_path path; - LOOP_FILTER_MASK lfm; - - if (y_only) - path = LF_PATH_444; - else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1) - path = LF_PATH_420; - else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0) - path = LF_PATH_444; - else - path = LF_PATH_SLOW; - - 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); - - // TODO(JBB): Make setup_mask work for non 420. - av1_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride, &lfm); - - av1_filter_block_plane_ss00_ver(cm, &planes[0], mi_row, &lfm); - av1_filter_block_plane_ss00_hor(cm, &planes[0], mi_row, &lfm); - for (plane = 1; plane < num_planes; ++plane) { - switch (path) { - case LF_PATH_420: - av1_filter_block_plane_ss11_ver(cm, &planes[plane], mi_row, &lfm); - av1_filter_block_plane_ss11_hor(cm, &planes[plane], mi_row, &lfm); - break; - case LF_PATH_444: - av1_filter_block_plane_ss00_ver(cm, &planes[plane], mi_row, &lfm); - av1_filter_block_plane_ss00_hor(cm, &planes[plane], mi_row, &lfm); - break; - case LF_PATH_SLOW: - 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, - mi_row, mi_col, plane); - - break; - } - } - } - } -#endif // CONFIG_PARALLEL_DEBLOCKING -#endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES +#endif // !CONFIG_PARALLEL_DEBLOCKING } void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, diff --git a/av1/common/blockd.c b/av1/common/blockd.c index 236aeb2b5849c1df3bf890586e4fa943f1742cfb..be7d737514c0e85d144109ae30bd304fd8859a02 100644 --- a/av1/common/blockd.c +++ b/av1/common/blockd.c @@ -178,15 +178,10 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd, int plane; for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) continue; -#else - (void)mi_row; - (void)mi_col; -#endif av1_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg); } } @@ -200,11 +195,7 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, ENTROPY_CONTEXT *const l = pd->left_context + loff; const int txs_wide = tx_size_wide_unit[tx_size]; const int txs_high = tx_size_high_unit[tx_size]; -#if CONFIG_CB4X4 const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; -#else - const BLOCK_SIZE bsize = AOMMAX(xd->mi[0]->mbmi.sb_type, BLOCK_8X8); -#endif const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); // above @@ -240,17 +231,11 @@ void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE bsize) { int i; int nplanes; -#if CONFIG_CB4X4 int chroma_ref; chroma_ref = is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y); nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref; -#else - (void)mi_row; - (void)mi_col; - nplanes = MAX_MB_PLANE; -#endif for (i = 0; i < nplanes; i++) { struct macroblockd_plane *const pd = &xd->plane[i]; #if CONFIG_CHROMA_SUB8X8 diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 3b542e06d46acdd57f96e3149b888191ebd682f9..fb7da68c04f1c3a6b75d956af913a8a201f81026 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h @@ -478,12 +478,8 @@ static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) { #endif static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { -#if CONFIG_CB4X4 (void)block; return mi->mbmi.mode; -#else - return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode : mi->mbmi.mode; -#endif } #if CONFIG_CFL @@ -687,7 +683,6 @@ typedef struct cfl_ctx { // 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, @@ -695,7 +690,6 @@ typedef struct cfl_ctx { // 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 @@ -875,7 +869,7 @@ static INLINE int is_rect_tx(TX_SIZE tx_size) { return tx_size >= TX_SIZES; } #endif // CONFIG_RECT_TX static INLINE int block_signals_txsize(BLOCK_SIZE bsize) { -#if CONFIG_CB4X4 && (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX +#if (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX return bsize > BLOCK_4X4; #else return bsize >= BLOCK_8X8; @@ -975,12 +969,12 @@ static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter, int use_reduced_set) { const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size]; const TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size]; -#if CONFIG_CB4X4 && USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#if USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 (void)bs; if (tx_size_sqr_up > TX_32X32) return EXT_TX_SET_DCTONLY; #else if (tx_size_sqr_up > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY; -#endif +#endif // USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 if (use_reduced_set) return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DTT4_IDTX; #if CONFIG_MRC_TX @@ -1173,13 +1167,8 @@ static INLINE TX_SIZE tx_size_from_tx_mode(BLOCK_SIZE bsize, TX_MODE tx_mode, #endif // (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX (void)is_inter; #if CONFIG_VAR_TX && CONFIG_RECT_TX -#if CONFIG_CB4X4 if (bsize == BLOCK_4X4) return AOMMIN(max_txsize_lookup[bsize], largest_tx_size); -#else - if (bsize < BLOCK_8X8) - return AOMMIN(max_txsize_lookup[bsize], largest_tx_size); -#endif if (txsize_sqr_map[max_rect_tx_size] <= largest_tx_size) return max_rect_tx_size; else @@ -1297,38 +1286,23 @@ static INLINE TX_TYPE av1_get_tx_type(PLANE_TYPE plane_type, if (xd->lossless[mbmi->segment_id] || txsize_sqr_map[tx_size] > TX_32X32 || (txsize_sqr_map[tx_size] >= TX_32X32 && !is_inter_block(mbmi))) return DCT_DCT; - if (mbmi->sb_type >= BLOCK_8X8 || CONFIG_CB4X4) { - if (plane_type == PLANE_TYPE_Y) { + if (plane_type == PLANE_TYPE_Y) { #if !ALLOW_INTRA_EXT_TX - if (is_inter_block(mbmi)) + if (is_inter_block(mbmi)) #endif // ALLOW_INTRA_EXT_TX - return mbmi->tx_type; - } + return mbmi->tx_type; + } - if (is_inter_block(mbmi)) { - // UV Inter only - return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32) - ? DCT_DCT - : mbmi->tx_type; - } + if (is_inter_block(mbmi)) { + // UV Inter only + return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32) + ? DCT_DCT + : mbmi->tx_type; } -#if CONFIG_CB4X4 (void)block; return intra_mode_to_tx_type_context[get_uv_mode(mbmi->uv_mode)]; -#else // CONFIG_CB4X4 - // Sub8x8-Inter/Intra OR UV-Intra - if (is_inter_block(mbmi)) { // Sub8x8-Inter - return DCT_DCT; - } else { // Sub8x8 Intra OR UV-Intra - const int block_raster_idx = - av1_block_index_to_raster_order(tx_size, block); - return intra_mode_to_tx_type_context[plane_type == PLANE_TYPE_Y - ? get_y_mode(mi, block_raster_idx) - : get_uv_mode(mbmi->uv_mode)]; - } -#endif // CONFIG_CB4X4 -#else // CONFIG_EXT_TX +#else // CONFIG_EXT_TX (void)block; #if CONFIG_MRC_TX if (mbmi->tx_type == MRC_DCT) { @@ -1463,14 +1437,8 @@ static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) { #if CONFIG_VAR_TX static INLINE int get_vartx_max_txsize(const MB_MODE_INFO *const mbmi, BLOCK_SIZE bsize, int subsampled) { -#if CONFIG_CB4X4 (void)mbmi; 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 #if CONFIG_EXT_PARTITION && CONFIG_TX64X64 // The decoder is designed so that it can process 64x64 luma pixels at a @@ -1662,11 +1630,7 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) { const MODE_INFO *mi = xd->mi[0]; const MB_MODE_INFO *const mbmi = &mi->mbmi; int ref; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif // First check if all modes are ZEROMV if (mbmi->sb_type >= BLOCK_8X8 || unify_bsize) { diff --git a/av1/common/common_data.h b/av1/common/common_data.h index 5e5f4ce4c4447911fac3a6a9fb3428968f676349..2751bcca3d3a1e1a197db0932e277e923d2fd469 100644 --- a/av1/common/common_data.h +++ b/av1/common/common_data.h @@ -61,7 +61,6 @@ static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = { }; // 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_SUB8X8 0, 0, 0, @@ -76,21 +75,8 @@ static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = { 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, 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_SUB8X8 0, 0, 0, @@ -105,44 +91,22 @@ static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = { 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, 3, - 1, IF_EXT_PARTITION(2, 4) -#endif }; /* clang-format off */ static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 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, 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, - 2, 8, IF_EXT_PARTITION(4, 16) -#endif }; static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 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, 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, - 8, 2, IF_EXT_PARTITION(16, 4) -#endif }; /* clang-format on */ @@ -748,7 +712,6 @@ static const TX_TYPE_1D htx_tab[TX_TYPES] = { // block which may use a rectangular transform, in which case it is // "(max_txsize_lookup[bsize] + 1) - TX_8X8", invalid for bsize < 8X8 static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2, INT32_MIN, INT32_MIN, INT32_MIN, @@ -757,12 +720,6 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES_ALL] = { INT32_MIN, // 4X8, 8X4, 8X8, TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, TX_8X8 - TX_8X8, -#else // CONFIG_CB4X4 - // 4X4 - INT32_MIN, - // 4X8, 8X4, 8X8 - INT32_MIN, INT32_MIN, TX_8X8 - TX_8X8, -#endif // CONFIG_CB4X4 // 8X16, 16X8, 16X16 TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, TX_16X16 - TX_8X8, // 16X32, 32X16, 32X32 @@ -1098,15 +1055,11 @@ static const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES_ALL][2][2] = { { { BLOCK_4X4, BLOCK_4X2 }, { BLOCK_2X4, BLOCK_2X2 } }, { { BLOCK_4X8, BLOCK_4X4 }, { BLOCK_INVALID, BLOCK_2X4 } }, { { BLOCK_8X4, BLOCK_INVALID }, { BLOCK_4X4, BLOCK_4X2 } }, -#elif CONFIG_CB4X4 +#else { { BLOCK_4X4, BLOCK_4X4 }, { BLOCK_4X4, BLOCK_4X4 } }, { { BLOCK_4X8, BLOCK_4X4 }, { BLOCK_INVALID, BLOCK_4X4 } }, { { BLOCK_8X4, BLOCK_INVALID }, { BLOCK_4X4, BLOCK_4X4 } }, -#else - { { BLOCK_4X4, BLOCK_INVALID }, { BLOCK_INVALID, BLOCK_INVALID } }, - { { BLOCK_4X8, BLOCK_4X4 }, { BLOCK_INVALID, BLOCK_INVALID } }, - { { BLOCK_8X4, BLOCK_INVALID }, { BLOCK_4X4, BLOCK_INVALID } }, -#endif +#endif // CONFIG_CHROMA_SUB8X8 { { BLOCK_8X8, BLOCK_8X4 }, { BLOCK_4X8, BLOCK_4X4 } }, { { BLOCK_8X16, BLOCK_8X8 }, { BLOCK_INVALID, BLOCK_4X8 } }, { { BLOCK_16X8, BLOCK_INVALID }, { BLOCK_8X8, BLOCK_8X4 } }, diff --git a/av1/common/enums.h b/av1/common/enums.h index ba11ee9446d9c0b7f6ea189b6bb4c41686fef043..0254ff1e31b9db6752b517762846c2a8687b6d79 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h @@ -45,11 +45,7 @@ extern "C" { #define MIN_SB_SIZE_LOG2 6 // Pixels per Mode Info (MI) unit -#if CONFIG_CB4X4 #define MI_SIZE_LOG2 2 -#else -#define MI_SIZE_LOG2 3 -#endif #define MI_SIZE (1 << MI_SIZE_LOG2) // MI-units per max superblock (MI Block - MIB) diff --git a/av1/common/mv.h b/av1/common/mv.h index f4708178cbd70925493a143c2335ea519bcc309d..76ef91189413e07e86952c8e0f2ed2355d1f0c9c 100644 --- a/av1/common/mv.h +++ b/av1/common/mv.h @@ -244,7 +244,7 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm, int is_integer #endif ) { - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; int_mv res; const int32_t *mat = gm->wmmat; int x, y, tx, ty; diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c index ed7fdb9b037f595d40fdbf1cb70f86a6fda719d8..b4c34609cb01bccdc991bef18687afbde74bc79f 100644 --- a/av1/common/mvref_common.c +++ b/av1/common/mvref_common.c @@ -65,11 +65,7 @@ static uint8_t add_ref_mv_candidate( int subsampling_y) { int index = 0, ref; int newmv_count = 0; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif assert(weight % 2 == 0); #if !CONFIG_EXT_WARPED_MOTION (void)bsize; @@ -274,7 +270,6 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, int i; uint8_t newmv_count = 0; int col_offset = 0; -#if CONFIG_CB4X4 const int shift = 0; // TODO(jingning): Revisit this part after cb4x4 is stable. if (abs(row_offset) > 1) { @@ -282,10 +277,6 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, if (mi_col & 0x01 && xd->n8_w < n8_w_8) --col_offset; } const int use_step_16 = (xd->n8_w >= 16); -#else - 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 < end_mi && *refmv_count < MAX_REF_MV_STACK_SIZE;) { @@ -350,17 +341,12 @@ static uint8_t scan_col_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd, int i; uint8_t newmv_count = 0; int row_offset = 0; -#if CONFIG_CB4X4 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 shift = 1; - const int use_step_16 = (xd->n8_h >= 8); -#endif for (i = 0; i < end_mi && *refmv_count < MAX_REF_MV_STACK_SIZE;) { const MODE_INFO *const candidate_mi = @@ -751,10 +737,8 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, 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; @@ -765,21 +749,13 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, // 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); } @@ -860,13 +836,9 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, { int blk_row, blk_col; int coll_blk_count = 0; -#if CONFIG_CB4X4 const int mi_step = (xd->n8_w == 1 || xd->n8_h == 1) ? mi_size_wide[BLOCK_8X8] : mi_size_wide[BLOCK_16X16]; -#else - const int mi_step = mi_size_wide[BLOCK_16X16]; -#endif #if CONFIG_TPL_MV // Modified sample positions to be consistent with frame_mvs @@ -929,13 +901,8 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, #endif // CONFIG_GLOBAL_MOTION && USE_CUR_GM_REFMV 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) @@ -956,11 +923,7 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd, max_col_offset, &processed_cols); } -#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, mi_col, block, rf, col_offset, ref_mv_stack, @@ -1138,12 +1101,10 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd, mv_ref_search[8].row = num_8x8_blocks_high - 1; mv_ref_search[8].col = -3; -#if CONFIG_CB4X4 for (i = 0; i < MVREF_NEIGHBOURS; ++i) { mv_ref_search[i].row *= 2; mv_ref_search[i].col *= 2; } -#endif // CONFIG_CB4X4 // The nearest 2 blocks are treated differently // if the size < 8x8 we get the mv from the bmi substructure, diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h index c5c2a2b19e64dc4590881a0b30614fd1efb0d9c0..81b8b391170fd9f6ec11fd630a77c18517979f60 100644 --- a/av1/common/mvref_common.h +++ b/av1/common/mvref_common.h @@ -353,13 +353,8 @@ static INLINE int16_t av1_mode_context_analyzer( if (block >= 0) { mode_ctx = mode_context[rf[0]] & 0x00ff; -#if !CONFIG_CB4X4 - if (block > 0 && bsize < BLOCK_8X8 && bsize > BLOCK_4X4) - mode_ctx |= (1 << SKIP_NEARESTMV_SUB8X8_OFFSET); -#else (void)block; (void)bsize; -#endif return mode_ctx; } diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index 110a4a681023a2c5cd5d6b8acc2789eef16f0115..9b3bb99d69db640cf7da366cea649e2648fe8c9a 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h @@ -887,7 +887,6 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, #endif // CONFIG_EXT_PARTITION_TYPES } -#if CONFIG_CB4X4 static INLINE int is_chroma_reference(int mi_row, int mi_col, BLOCK_SIZE bsize, int subsampling_x, int subsampling_y) { #if CONFIG_CHROMA_SUB8X8 @@ -923,7 +922,6 @@ static INLINE BLOCK_SIZE scale_chroma_bsize(BLOCK_SIZE bsize, int subsampling_x, return bs; } -#endif static INLINE aom_cdf_prob cdf_element_prob(const aom_cdf_prob *cdf, size_t element) { @@ -1338,11 +1336,7 @@ static INLINE void set_use_reference_buffer(AV1_COMMON *const cm, int use) { static INLINE void set_sb_size(AV1_COMMON *const cm, BLOCK_SIZE sb_size) { cm->sb_size = sb_size; cm->mib_size = mi_size_wide[cm->sb_size]; -#if CONFIG_CB4X4 cm->mib_size_log2 = b_width_log2_lookup[cm->sb_size]; -#else - cm->mib_size_log2 = mi_width_log2_lookup[cm->sb_size]; -#endif } static INLINE int all_lossless(const AV1_COMMON *cm, const MACROBLOCKD *xd) { diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index 356a89df43ac95bbbe832df3bd2b9f8df271ab62..156ea5720433ed231ae7bc81be4bbf86c292a674 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c @@ -1133,10 +1133,8 @@ static INLINE void build_inter_predictors( #endif // CONFIG_COMPOUND_SINGLEREF #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_CB4X4 (void)block; (void)cm; -#endif #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE bsize = mi->mbmi.sb_type; @@ -1371,19 +1369,7 @@ static INLINE void build_inter_predictors( const struct scale_factors *const sf = &xd->block_refs[ref]->sf; struct buf_2d *const pre_buf = &pd->pre[ref]; #endif // CONFIG_INTRABC -#if CONFIG_CB4X4 const MV mv = mi->mbmi.mv[ref].as_mv; -#else - const MV mv = -#if CONFIG_MOTION_VAR - (mi->mbmi.sb_type < BLOCK_8X8 && !build_for_obmc) - ? -#else - mi->mbmi.sb_type < BLOCK_8X8 ? -#endif - average_split_mvs(pd, mi, ref, block) - : mi->mbmi.mv[ref].as_mv; -#endif const int is_scaled = av1_is_scaled(sf); if (is_scaled) { @@ -1536,21 +1522,15 @@ static void build_inter_predictors_for_planes(const AV1_COMMON *cm, int plane; const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif for (plane = plane_from; plane <= plane_to; ++plane) { const struct macroblockd_plane *pd = &xd->plane[plane]; const int bw = pd->width; const int bh = pd->height; -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, pd->subsampling_y)) continue; -#endif if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !unify_bsize) { const PARTITION_TYPE bp = bsize - xd->mi[0]->mbmi.sb_type; @@ -2248,31 +2228,9 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, const struct macroblockd_plane *pd = &xd->plane[j]; bw = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_x; 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; - const int have_vsplit = bp != PARTITION_HORZ; - const int have_hsplit = bp != PARTITION_VERT; - const int num_4x4_w = 2 >> (!have_vsplit); - const int num_4x4_h = 2 >> (!have_hsplit); - const int pw = 8 >> (have_vsplit + pd->subsampling_x); - int x, y; - - for (y = 0; y < num_4x4_h; ++y) - for (x = 0; x < num_4x4_w; ++x) { - if ((bp == PARTITION_HORZ || bp == PARTITION_SPLIT) && y != 0) - continue; - - 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, mi_x, mi_y); - } - } else { - build_inter_predictors(cm, xd, j, mi, 1, 0, bw, bh, 0, - xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, bw, - bh, 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, mi_x, mi_y); } *mbmi = backup_mbmi; } @@ -2346,31 +2304,9 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, const struct macroblockd_plane *pd = &xd->plane[j]; 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) { - const PARTITION_TYPE bp = BLOCK_8X8 - mbmi->sb_type; - const int have_vsplit = bp != PARTITION_HORZ; - const int have_hsplit = bp != PARTITION_VERT; - const int num_4x4_w = 2 >> (!have_vsplit); - const int num_4x4_h = 2 >> (!have_hsplit); - const int ph = 8 >> (have_hsplit + pd->subsampling_y); - int x, y; - - for (y = 0; y < num_4x4_h; ++y) - for (x = 0; x < num_4x4_w; ++x) { - if ((bp == PARTITION_VERT || bp == PARTITION_SPLIT) && x != 0) - continue; - - 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, mi_x, - mi_y); - } - } else { - build_inter_predictors(cm, xd, j, mi, 1, 0, bw, bh, - xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, 0, - bw, bh, mi_x, mi_y); - } + build_inter_predictors(cm, xd, j, mi, 1, 0, bw, bh, + xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, 0, bw, + bh, mi_x, mi_y); } *mbmi = backup_mbmi; } @@ -2964,26 +2900,9 @@ void av1_build_inter_predictors_for_planes_single_buf( get_plane_block_size(bsize, &xd->plane[plane]); const int bw = block_size_wide[plane_bsize]; const int bh = block_size_high[plane_bsize]; - - if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) { - int x, y; - 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_COMPOUND_SINGLEREF - assert(has_second_ref(&xd->mi[0]->mbmi) || - !is_inter_singleref_comp_mode(xd->mi[0]->mbmi.mode)); -#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( - xd, plane, y * 2 + x, bw, bh, 4 * x, 4 * y, 4, 4, mi_x, mi_y, ref, - ext_dst[plane], ext_dst_stride[plane]); - } else { - build_inter_predictors_single_buf(xd, plane, 0, bw, bh, 0, 0, bw, bh, - mi_x, mi_y, ref, ext_dst[plane], - ext_dst_stride[plane]); - } + build_inter_predictors_single_buf(xd, plane, 0, bw, bh, 0, 0, bw, bh, mi_x, + mi_y, ref, ext_dst[plane], + ext_dst_stride[plane]); } } @@ -3065,24 +2984,11 @@ void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize, for (plane = plane_from; plane <= plane_to; ++plane) { const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]); - - if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) { - int x, y; - 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); - for (y = 0; y < num_4x4_h; ++y) - for (x = 0; x < num_4x4_w; ++x) - build_wedge_inter_predictor_from_buf( - xd, plane, 4 * x, 4 * y, 4, 4, ext_dst0[plane], - ext_dst_stride0[plane], ext_dst1[plane], ext_dst_stride1[plane]); - } else { - const int bw = block_size_wide[plane_bsize]; - const int bh = block_size_high[plane_bsize]; - build_wedge_inter_predictor_from_buf( - xd, plane, 0, 0, bw, bh, ext_dst0[plane], ext_dst_stride0[plane], - ext_dst1[plane], ext_dst_stride1[plane]); - } + const int bw = block_size_wide[plane_bsize]; + const int bh = block_size_high[plane_bsize]; + build_wedge_inter_predictor_from_buf( + xd, plane, 0, 0, bw, bh, ext_dst0[plane], ext_dst_stride0[plane], + ext_dst1[plane], ext_dst_stride1[plane]); } } #if CONFIG_NCOBMC_ADAPT_WEIGHT diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index ebbd7fed2ebe210c757be922310d27362402e19d..9eac0b70d28eaebee587345dbe6ebd14e9342138 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h @@ -448,11 +448,7 @@ static INLINE int has_subpel_mv_component(const MODE_INFO *const mi, const BLOCK_SIZE bsize = mbmi->sb_type; int plane; int ref = (dir >> 1); -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif if (bsize >= BLOCK_8X8 || unify_bsize) { if (dir & 0x01) { diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c index c3e96a7eb87f4d7f5f03692e46fd76d4f9d408dd..2f7f46c6306e899d49e8b37a7627acd75de52b7c 100644 --- a/av1/common/reconintra.c +++ b/av1/common/reconintra.c @@ -165,7 +165,6 @@ 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, 4, 6, 12, 14, 36, 38, 44, 46, 5, 7, 13, 15, 37, 39, 45, 47, @@ -207,7 +206,6 @@ static const uint16_t orders_8x8[256] = { 255, }; -#if CONFIG_CB4X4 && CONFIG_EXT_PARTITION static const uint16_t orders_4x8[512] = { 0, 1, 2, 3, 8, 9, 10, 11, 32, 33, 34, 35, 40, 41, 42, 43, 128, 129, 130, 131, 136, 137, 138, 139, 160, 161, 162, 163, 168, 169, @@ -365,13 +363,10 @@ static const uint16_t orders_4x4[1024] = { 747, 750, 751, 762, 763, 766, 767, 938, 939, 942, 943, 954, 955, 958, 959, 1002, 1003, 1006, 1007, 1018, 1019, 1022, 1023, }; -#endif -#endif // CONFIG_CB4X4 || CONFIG_EXT_PARTITION #if CONFIG_EXT_PARTITION /* clang-format off */ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2 orders_4x4, orders_4x4, orders_4x4, @@ -380,12 +375,6 @@ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { orders_4x4, // 4X8, 8X4, 8X8 orders_4x8, orders_8x4, orders_8x8, -#else // CONFIG_CHROMA_SUB8X8 - // 4X4 - orders_8x8, - // 4X8, 8X4, 8X8 - orders_8x8, orders_8x8, orders_8x8, -#endif // 8X16, 16X8, 16X16 orders_8x16, orders_16x8, orders_16x16, // 16X32, 32X16, 32X32 @@ -405,7 +394,6 @@ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { #else /* clang-format off */ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2 orders_8x8, orders_8x8, orders_8x8, @@ -414,12 +402,6 @@ static const uint16_t *const orders[BLOCK_SIZES_ALL] = { orders_8x8, // 4X8, 8X4, 8X8 orders_8x16, orders_16x8, orders_16x16, -#else // CONFIG_CHROMA_SUB8X8 - // 4X4 - orders_16x16, - // 4X8, 8X4, 8X8 - orders_16x16, orders_16x16, orders_16x16, -#endif // 8X16, 16X8, 16X16 orders_16x32, orders_32x16, orders_32x32, // 16X32, 32X16, 32X32 @@ -447,7 +429,6 @@ static const uint16_t orders_verta_16x16[64] = { 32, 34, 36, 38, 48, 50, 52, 54, 33, 34, 37, 38, 49, 50, 53, 54, 40, 42, 44, 46, 56, 58, 60, 62, 41, 42, 45, 46, 57, 58, 61, 62, }; -#if CONFIG_EXT_PARTITION || CONFIG_CB4X4 static const uint16_t orders_verta_8x8[256] = { 0, 2, 4, 6, 16, 18, 20, 22, 64, 66, 68, 70, 80, 82, 84, 86, 1, 2, 5, 6, 17, 18, 21, 22, 65, 66, 69, 70, 81, 82, @@ -468,7 +449,6 @@ static const uint16_t orders_verta_8x8[256] = { 169, 170, 173, 174, 185, 186, 189, 190, 233, 234, 237, 238, 249, 250, 253, 254, }; -#endif // CONFIG_EXT_PARTITION || CONFIG_CB4X4 #if CONFIG_EXT_PARTITION /* clang-format off */ @@ -495,7 +475,6 @@ static const uint16_t *const orders_verta[BLOCK_SIZES] = { #else /* clang-format off */ static const uint16_t *const orders_verta[BLOCK_SIZES] = { -#if CONFIG_CB4X4 #if CONFIG_CHROMA_SUB8X8 // 2X2, 2X4, 4X2 orders_verta_8x8, orders_verta_8x8, orders_verta_8x8, @@ -504,12 +483,6 @@ static const uint16_t *const orders_verta[BLOCK_SIZES] = { orders_verta_8x8, // 4X8, 8X4, 8X8 orders_verta_8x8, orders_verta_8x8, orders_verta_16x16, -#else // CONFIG_CHROMA_SUB8X8 - // 4X4 - orders_verta_16x16, - // 4X8, 8X4, 8X8 - orders_verta_16x16, orders_verta_16x16, orders_verta_16x16, -#endif // 8X16, 16X8, 16X16 orders_16x32, orders_32x16, orders_verta_32x32, // 16X32, 32X16, 32X32 @@ -530,25 +503,10 @@ static int has_top_right(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row, TX_SIZE txsz, int row_off, int col_off, int ss_x) { if (!top_available || !right_available) return 0; -#if !CONFIG_CB4X4 - // TODO(bshacklett, huisu): Currently the RD loop traverses 4X8 blocks in - // inverted N order while in the bitstream the subblocks are stored in Z - // order. This discrepancy makes this function incorrect when considering 4X8 - // blocks in the RD loop, so we disable the extended right edge for these - // blocks. The correct solution is to change the bitstream to store these - // blocks in inverted N order, and then update this function appropriately. - if (bsize == BLOCK_4X8 && row_off == 1) return 0; -#endif - const int bw_unit = block_size_wide[bsize] >> tx_size_wide_log2[0]; const int plane_bw_unit = AOMMAX(bw_unit >> ss_x, 1); const int top_right_count_unit = tx_size_wide_unit[txsz]; -#if !CONFIG_CB4X4 - // Special handling for block sizes 4x8 and 4x4. - if (ss_x == 0 && bw_unit < 2 && col_off == 0) return 1; -#endif - if (row_off > 0) { // Just need to check if enough pixels on the right. #if CONFIG_EXT_PARTITION if (col_off + top_right_count_unit >= @@ -606,11 +564,6 @@ static int has_bottom_left(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row, const int plane_bh_unit = AOMMAX(bh_unit >> ss_y, 1); const int bottom_left_count_unit = tx_size_high_unit[txsz]; -#if !CONFIG_CB4X4 - // Special handling for block sizes 8x4 and 4x4. - if (ss_y == 0 && bh_unit < 2 && row_off == 0) return 1; -#endif - // All bottom-left pixels are in the left block, which is already available. if (row_off + bottom_left_count_unit < plane_bh_unit) return 1; @@ -2626,7 +2579,7 @@ static void predict_intra_block_helper(const AV1_COMMON *cm, BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; const struct macroblockd_plane *const pd = &xd->plane[plane]; const int txw = tx_size_wide_unit[tx_size]; -#if CONFIG_CB4X4 && CONFIG_CHROMA_SUB8X8 +#if CONFIG_CHROMA_SUB8X8 const int have_top = row_off || (pd->subsampling_y ? xd->chroma_up_available : xd->up_available); const int have_left = @@ -2645,7 +2598,7 @@ static void predict_intra_block_helper(const AV1_COMMON *cm, #if !INTRA_USES_RECT_TRANSFORMS assert(txwpx == txhpx); #endif // !INTRA_USES_RECT_TRANSFORMS -#if CONFIG_CB4X4 && !CONFIG_CHROMA_SUB8X8 +#if !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; #else @@ -2669,10 +2622,8 @@ static void predict_intra_block_helper(const AV1_COMMON *cm, const PARTITION_TYPE partition = xd->mi[0]->mbmi.partition; #endif -#if CONFIG_CB4X4 // force 4x4 chroma component block size. bsize = scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y); -#endif const int have_top_right = has_top_right(cm, bsize, mi_row, mi_col, have_top, right_available, diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 88e997605959e4c74235ae7e613537af92cbde3c..b80ba5462302b415525fbc8d09be8f8d5fe691f0 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -270,12 +270,9 @@ static int get_block_idx(const MACROBLOCKD *xd, int plane, int row, int col) { #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane); const TX_SIZE tx_size = av1_get_tx_size(plane, xd); const uint8_t txh_unit = tx_size_high_unit[tx_size]; @@ -845,14 +842,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, } } } - -#if CONFIG_CB4X4 if (mbmi->skip) av1_reset_skip_context(xd, mi_row, mi_col, bsize); -#else - if (mbmi->skip) { - av1_reset_skip_context(xd, mi_row, mi_col, AOMMAX(BLOCK_8X8, bsize)); - } -#endif #if CONFIG_COEF_INTERLEAVE { @@ -991,20 +981,15 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 int row, col; const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane); const int max_blocks_high = max_block_high(xd, plane_bsize, plane); -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, pd->subsampling_y)) continue; -#endif int blk_row, blk_col; const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd); int mu_blocks_wide = @@ -1061,12 +1046,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, } } -#if CONFIG_CB4X4 av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize); -#else - av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, - AOMMAX(bsize, BLOCK_8X8)); -#endif #if CONFIG_MOTION_VAR if (mbmi->motion_mode == OBMC_CAUSAL) { @@ -1096,21 +1076,16 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane); const int max_blocks_high = max_block_high(xd, plane_bsize, plane); int row, col; -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x, pd->subsampling_y)) continue; -#endif const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd); int mu_blocks_wide = @@ -1194,11 +1169,7 @@ static void detoken_and_recon_sb(AV1Decoder *const pbi, MACROBLOCKD *const xd, BLOCK_SIZE bsize) { AV1_COMMON *const cm = &pbi->common; const int hbs = mi_size_wide[bsize] >> 1; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif #if CONFIG_EXT_PARTITION_TYPES BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT); #endif @@ -1346,11 +1317,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd, #if CONFIG_EXT_PARTITION_TYPES && CONFIG_EXT_PARTITION_TYPES_AB const int qbs = num_8x8_wh >> 2; #endif -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif PARTITION_TYPE partition; BLOCK_SIZE subsize; #if CONFIG_EXT_PARTITION_TYPES @@ -2923,43 +2890,12 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data, assert(mi_row > 0); #endif -// when Parallel deblocking is enabled, deblocking should not -// be interleaved with decoding. Instead, deblocking should be done -// after the entire frame is decoded. -#if !CONFIG_VAR_TX && !CONFIG_PARALLEL_DEBLOCKING && !CONFIG_CB4X4 - // Loopfilter one tile row. - // Note: If out-of-order tile decoding is used(for example, inv_row_order - // = 1), the loopfiltering has be done after all tile rows are decoded. - if (!inv_row_order && cm->lf.filter_level && !cm->skip_loop_filter) { - LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1; - const int lf_start = AOMMAX(0, tile_info.mi_row_start - cm->mib_size); - const int lf_end = tile_info.mi_row_end - cm->mib_size; - - // Delay the loopfilter if the first tile row is only - // a single superblock high. - if (lf_end <= 0) continue; - - // Decoding has completed. Finish up the loop filter in this thread. - if (tile_info.mi_row_end >= cm->mi_rows) continue; - - winterface->sync(&pbi->lf_worker); - lf_data->start = lf_start; - lf_data->stop = lf_end; - if (pbi->max_threads > 1) { - winterface->launch(&pbi->lf_worker); - } else { - winterface->execute(&pbi->lf_worker); - } - } -#endif // !CONFIG_VAR_TX && !CONFIG_PARALLEL_DEBLOCKING - // After loopfiltering, the last 7 row pixels in each superblock row may // still be changed by the longest loopfilter of the next superblock row. if (cm->frame_parallel_decode) av1_frameworker_broadcast(pbi->cur_buf, mi_row << cm->mib_size_log2); } -#if CONFIG_VAR_TX || CONFIG_CB4X4 #if CONFIG_INTRABC // When intraBC is on, do loop filtering per superblock, // instead of do it after the whole frame has been encoded, @@ -2989,27 +2925,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data, #endif // CONFIG_LOOPFILTER_LEVEL #endif // CONFIG_LPF_SB #endif // CONFIG_INTRABC -#else -#if CONFIG_PARALLEL_DEBLOCKING - // Loopfilter all rows in the frame in the frame. - if (cm->lf.filter_level && !cm->skip_loop_filter) { - LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1; - winterface->sync(&pbi->lf_worker); - lf_data->start = 0; - lf_data->stop = cm->mi_rows; - winterface->execute(&pbi->lf_worker); - } -#else - // Loopfilter remaining rows in the frame. - if (cm->lf.filter_level && !cm->skip_loop_filter) { - LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1; - winterface->sync(&pbi->lf_worker); - lf_data->start = lf_data->stop; - lf_data->stop = cm->mi_rows; - winterface->execute(&pbi->lf_worker); - } -#endif // CONFIG_PARALLEL_DEBLOCKING -#endif // CONFIG_VAR_TX if (cm->frame_parallel_decode) av1_frameworker_broadcast(pbi->cur_buf, INT_MAX); @@ -3047,276 +2962,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data, #endif // CONFIG_EXT_TILE } -static int tile_worker_hook(TileWorkerData *const tile_data, - const TileInfo *const tile) { - AV1Decoder *const pbi = tile_data->pbi; - const AV1_COMMON *const cm = &pbi->common; - int mi_row, mi_col; - - if (setjmp(tile_data->error_info.jmp)) { - tile_data->error_info.setjmp = 0; - aom_merge_corrupted_flag(&tile_data->xd.corrupted, 1); - return 0; - } - - tile_data->error_info.setjmp = 1; - tile_data->xd.error_info = &tile_data->error_info; -#if CONFIG_DEPENDENT_HORZTILES - if (!cm->dependent_horz_tiles || tile->tg_horz_boundary) { - av1_zero_above_context(&pbi->common, tile->mi_col_start, tile->mi_col_end); - } -#else - av1_zero_above_context(&pbi->common, tile->mi_col_start, tile->mi_col_end); -#endif - - for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end; - mi_row += cm->mib_size) { - av1_zero_left_context(&tile_data->xd); - - for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end; - mi_col += cm->mib_size) { - decode_partition(pbi, &tile_data->xd, mi_row, mi_col, - &tile_data->bit_reader, cm->sb_size); -#if NC_MODE_INFO && CONFIG_MOTION_VAR - detoken_and_recon_sb(pbi, &tile_data->xd, mi_row, mi_col, - &tile_data->bit_reader, cm->sb_size); -#endif - } - } - return !tile_data->xd.corrupted; -} - -// sorts in descending order -static int compare_tile_buffers(const void *a, const void *b) { - const TileBufferDec *const buf1 = (const TileBufferDec *)a; - const TileBufferDec *const buf2 = (const TileBufferDec *)b; - return (int)(buf2->size - buf1->size); -} - -static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data, - const uint8_t *data_end) { - AV1_COMMON *const cm = &pbi->common; - const AVxWorkerInterface *const winterface = aom_get_worker_interface(); - const int tile_cols = cm->tile_cols; - const int tile_rows = cm->tile_rows; - const int num_workers = AOMMIN(pbi->max_threads & ~1, tile_cols); - TileBufferDec(*const tile_buffers)[MAX_TILE_COLS] = pbi->tile_buffers; -#if CONFIG_EXT_TILE - const int dec_tile_row = AOMMIN(pbi->dec_tile_row, tile_rows); - const int single_row = pbi->dec_tile_row >= 0; - const int dec_tile_col = AOMMIN(pbi->dec_tile_col, tile_cols); - const int single_col = pbi->dec_tile_col >= 0; -#endif // CONFIG_EXT_TILE - int tile_rows_start; - int tile_rows_end; - int tile_cols_start; - int tile_cols_end; - int tile_row, tile_col; - int i; - -#if CONFIG_EXT_TILE - if (cm->large_scale_tile) { - tile_rows_start = single_row ? dec_tile_row : 0; - tile_rows_end = single_row ? dec_tile_row + 1 : tile_rows; - tile_cols_start = single_col ? dec_tile_col : 0; - tile_cols_end = single_col ? tile_cols_start + 1 : tile_cols; - } else { -#endif // CONFIG_EXT_TILE - tile_rows_start = 0; - tile_rows_end = tile_rows; - tile_cols_start = 0; - tile_cols_end = tile_cols; -#if CONFIG_EXT_TILE - } -#endif // CONFIG_EXT_TILE - -#if !CONFIG_ANS - int final_worker = -1; -#endif // !CONFIG_ANS - - assert(tile_rows <= MAX_TILE_ROWS); - assert(tile_cols <= MAX_TILE_COLS); - - assert(tile_cols * tile_rows > 1); - - // TODO(jzern): See if we can remove the restriction of passing in max - // threads to the decoder. - if (pbi->num_tile_workers == 0) { - const int num_threads = pbi->max_threads & ~1; - CHECK_MEM_ERROR(cm, pbi->tile_workers, - aom_malloc(num_threads * sizeof(*pbi->tile_workers))); - // Ensure tile data offsets will be properly aligned. This may fail on - // platforms without DECLARE_ALIGNED(). - assert((sizeof(*pbi->tile_worker_data) % 16) == 0); - CHECK_MEM_ERROR( - cm, pbi->tile_worker_data, - aom_memalign(32, num_threads * sizeof(*pbi->tile_worker_data))); - CHECK_MEM_ERROR(cm, pbi->tile_worker_info, - aom_malloc(num_threads * sizeof(*pbi->tile_worker_info))); - for (i = 0; i < num_threads; ++i) { - AVxWorker *const worker = &pbi->tile_workers[i]; - ++pbi->num_tile_workers; - - winterface->init(worker); - if (i < num_threads - 1 && !winterface->reset(worker)) { - aom_internal_error(&cm->error, AOM_CODEC_ERROR, - "Tile decoder thread creation failed"); - } - } - } - - // Reset tile decoding hook - for (i = 0; i < num_workers; ++i) { - AVxWorker *const worker = &pbi->tile_workers[i]; - winterface->sync(worker); - worker->hook = (AVxWorkerHook)tile_worker_hook; - worker->data1 = &pbi->tile_worker_data[i]; - worker->data2 = &pbi->tile_worker_info[i]; - } - - // Initialize thread frame counts. - if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) { - for (i = 0; i < num_workers; ++i) { - TileWorkerData *const twd = (TileWorkerData *)pbi->tile_workers[i].data1; - av1_zero(twd->counts); - } - } - -// Load tile data into tile_buffers -#if CONFIG_EXT_TILE - if (cm->large_scale_tile) - get_ls_tile_buffers(pbi, data, data_end, tile_buffers); - else -#endif // CONFIG_EXT_TILE - get_tile_buffers(pbi, data, data_end, tile_buffers, 0, - cm->tile_rows * cm->tile_cols - 1); - - for (tile_row = tile_rows_start; tile_row < tile_rows_end; ++tile_row) { - // Sort the buffers in this tile row based on size in descending order. - qsort(&tile_buffers[tile_row][tile_cols_start], - tile_cols_end - tile_cols_start, sizeof(tile_buffers[0][0]), - compare_tile_buffers); - - // Rearrange the tile buffers in this tile row such that per-tile group - // the largest, and presumably the most difficult tile will be decoded in - // the main thread. This should help minimize the number of instances - // where the main thread is waiting for a worker to complete. - { - int group_start; - for (group_start = tile_cols_start; group_start < tile_cols_end; - group_start += num_workers) { - const int group_end = AOMMIN(group_start + num_workers, tile_cols); - const TileBufferDec largest = tile_buffers[tile_row][group_start]; - memmove(&tile_buffers[tile_row][group_start], - &tile_buffers[tile_row][group_start + 1], - (group_end - group_start - 1) * sizeof(tile_buffers[0][0])); - tile_buffers[tile_row][group_end - 1] = largest; - } - } - - for (tile_col = tile_cols_start; tile_col < tile_cols_end;) { - // Launch workers for individual columns - for (i = 0; i < num_workers && tile_col < tile_cols_end; - ++i, ++tile_col) { - TileBufferDec *const buf = &tile_buffers[tile_row][tile_col]; - AVxWorker *const worker = &pbi->tile_workers[i]; - TileWorkerData *const twd = (TileWorkerData *)worker->data1; - TileInfo *const tile_info = (TileInfo *)worker->data2; - - twd->pbi = pbi; - twd->xd = pbi->mb; - twd->xd.corrupted = 0; - twd->xd.counts = - cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD - ? &twd->counts - : NULL; - av1_zero(twd->dqcoeff); - av1_tile_init(tile_info, cm, tile_row, buf->col); - av1_tile_init(&twd->xd.tile, cm, tile_row, buf->col); - -#if CONFIG_LOOPFILTERING_ACROSS_TILES - dec_setup_across_tile_boundary_info(cm, tile_info); -#endif // CONFIG_LOOPFILTERING_ACROSS_TILES - - setup_bool_decoder(buf->data, data_end, buf->size, &cm->error, - &twd->bit_reader, -#if CONFIG_ANS && ANS_MAX_SYMBOLS - 1 << cm->ans_window_size_log2, -#endif // CONFIG_ANS && ANS_MAX_SYMBOLS - pbi->decrypt_cb, pbi->decrypt_state); - av1_init_macroblockd(cm, &twd->xd, -#if CONFIG_PVQ - twd->pvq_ref_coeff, -#endif -#if CONFIG_CFL - &twd->cfl, -#endif - twd->dqcoeff); -#if CONFIG_PVQ - daala_dec_init(cm, &twd->xd.daala_dec, &twd->bit_reader); - twd->xd.daala_dec.state.adapt = &twd->tctx.pvq_context; -#endif - // Initialise the tile context from the frame context - twd->tctx = *cm->fc; - twd->xd.tile_ctx = &twd->tctx; - twd->xd.plane[0].color_index_map = twd->color_index_map[0]; - twd->xd.plane[1].color_index_map = twd->color_index_map[1]; - - worker->had_error = 0; - if (i == num_workers - 1 || tile_col == tile_cols_end - 1) { - winterface->execute(worker); - } else { - winterface->launch(worker); - } - -#if !CONFIG_ANS - if (tile_row == tile_rows - 1 && buf->col == tile_cols - 1) { - final_worker = i; - } -#endif // !CONFIG_ANS - } - - // Sync all workers - for (; i > 0; --i) { - AVxWorker *const worker = &pbi->tile_workers[i - 1]; - // TODO(jzern): The tile may have specific error data associated with - // its aom_internal_error_info which could be propagated to the main - // info in cm. Additionally once the threads have been synced and an - // error is detected, there's no point in continuing to decode tiles. - pbi->mb.corrupted |= !winterface->sync(worker); - } - } - } - - // Accumulate thread frame counts. - if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) { - for (i = 0; i < num_workers; ++i) { - TileWorkerData *const twd = (TileWorkerData *)pbi->tile_workers[i].data1; - av1_accumulate_frame_counts(&cm->counts, &twd->counts); - } - } - -#if CONFIG_EXT_TILE - if (cm->large_scale_tile) { - // Return the end of the last tile buffer - return tile_buffers[tile_rows - 1][tile_cols - 1].raw_data_end; - } else { -#endif // CONFIG_EXT_TILE -#if CONFIG_ANS - return data_end; -#else - assert(final_worker != -1); - { - TileWorkerData *const twd = - (TileWorkerData *)pbi->tile_workers[final_worker].data1; - return aom_reader_find_end(&twd->bit_reader); - } -#endif // CONFIG_ANS -#if CONFIG_EXT_TILE - } -#endif // CONFIG_EXT_TILE -} - static void error_handler(void *data) { AV1_COMMON *const cm = (AV1_COMMON *)data; aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME, "Truncated packet"); @@ -4595,43 +4240,13 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data, dec_setup_frame_boundary_info(cm); - if (pbi->max_threads > 1 && !CONFIG_CB4X4 && -#if CONFIG_EXT_TILE - pbi->dec_tile_col < 0 && // Decoding all columns -#endif // CONFIG_EXT_TILE - cm->tile_cols > 1) { - // Multi-threaded tile decoder - *p_data_end = - decode_tiles_mt(pbi, data + pbi->first_partition_size, data_end); - if (!xd->corrupted) { - if (!cm->skip_loop_filter) { -// If multiple threads are used to decode tiles, then we use those -// threads to do parallel loopfiltering. -#if CONFIG_LOOPFILTER_LEVEL - av1_loop_filter_frame_mt( - (YV12_BUFFER_CONFIG *)xd->cur_buf, cm, pbi->mb.plane, - cm->lf.filter_level[0], cm->lf.filter_level[1], 0, 0, - pbi->tile_workers, pbi->num_tile_workers, &pbi->lf_row_sync); -#else - av1_loop_filter_frame_mt((YV12_BUFFER_CONFIG *)xd->cur_buf, cm, - pbi->mb.plane, cm->lf.filter_level, 0, 0, - pbi->tile_workers, pbi->num_tile_workers, - &pbi->lf_row_sync); -#endif // CONFIG_LOOPFILTER_LEVEL - } - } else { - aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME, - "Decode failed. Frame data is corrupted."); - } - } else { #if CONFIG_OBU - *p_data_end = decode_tiles(pbi, data, data_end, startTile, endTile); + *p_data_end = decode_tiles(pbi, data, data_end, startTile, endTile); #else - *p_data_end = decode_tiles( - pbi, data + pbi->uncomp_hdr_size + pbi->first_partition_size, data_end, - startTile, endTile); + *p_data_end = + decode_tiles(pbi, data + pbi->uncomp_hdr_size + pbi->first_partition_size, + data_end, startTile, endTile); #endif - } if (endTile != cm->tile_rows * cm->tile_cols - 1) { return; diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 8214de961c6a9258e0edc5cb6562463701fa0278..7ae20f726f8feaadc6f01c15bfd6646fd2947b1c 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -899,15 +899,10 @@ static void read_filter_intra_mode_info(AV1_COMMON *const cm, } } -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) return; -#else - (void)mi_row; - (void)mi_col; -#endif // CONFIG_CB4X4 if (mbmi->uv_mode == UV_DC_PRED && mbmi->palette_mode_info.palette_size[1] == 0) { @@ -1270,43 +1265,15 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, set_txfm_ctxs(mbmi->tx_size, xd->n8_w, xd->n8_h, mbmi->skip, xd); #endif // CONFIG_INTRABC && CONFIG_VAR_TX -#if CONFIG_CB4X4 (void)i; mbmi->mode = read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); -#else - switch (bsize) { - case BLOCK_4X4: - for (i = 0; i < 4; ++i) - mi->bmi[i].as_mode = read_intra_mode( - r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, i)); - mbmi->mode = mi->bmi[3].as_mode; - break; - case BLOCK_4X8: - mi->bmi[0].as_mode = mi->bmi[2].as_mode = - read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); - mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode = - read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 1)); - break; - case BLOCK_8X4: - mi->bmi[0].as_mode = mi->bmi[1].as_mode = - read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); - mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode = - read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 2)); - break; - default: - mbmi->mode = - read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0)); - } -#endif -#if CONFIG_CB4X4 if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) { #if CONFIG_CFL xd->cfl->is_chroma_reference = 1; #endif // CONFIG_CFL -#endif // CONFIG_CB4X4 mbmi->uv_mode = read_intra_mode_uv(ec_ctx, r, mbmi->mode); #if CONFIG_CFL @@ -1318,7 +1285,6 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, } #endif // CONFIG_CFL -#if CONFIG_CB4X4 } else { // Avoid decoding angle_info if there is is no chroma prediction mbmi->uv_mode = UV_DC_PRED; @@ -1327,7 +1293,6 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, xd->cfl->store_y = 1; #endif } -#endif #if CONFIG_EXT_INTRA read_intra_angle_info(xd, r); @@ -1339,8 +1304,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, #if CONFIG_FILTER_INTRA mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0; mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0; - if (bsize >= BLOCK_8X8 || CONFIG_CB4X4) - read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r); + read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r); #endif // CONFIG_FILTER_INTRA #if !CONFIG_TXK_SEL @@ -1836,43 +1800,12 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row, FRAME_CONTEXT *ec_ctx = xd->tile_ctx; -#if CONFIG_CB4X4 (void)i; mbmi->mode = read_intra_mode(r, ec_ctx->y_mode_cdf[size_group_lookup[bsize]]); -#else - switch (bsize) { - case BLOCK_4X4: - for (i = 0; i < 4; ++i) - mi->bmi[i].as_mode = read_intra_mode(r, ec_ctx->y_mode_cdf[0]); - mbmi->mode = mi->bmi[3].as_mode; - break; - case BLOCK_4X8: - mi->bmi[0].as_mode = mi->bmi[2].as_mode = - read_intra_mode(r, ec_ctx->y_mode_cdf[0]); - mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode = - read_intra_mode(r, ec_ctx->y_mode_cdf[0]); - break; - case BLOCK_8X4: - mi->bmi[0].as_mode = mi->bmi[1].as_mode = - read_intra_mode(r, ec_ctx->y_mode_cdf[0]); - mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode = - read_intra_mode(r, ec_ctx->y_mode_cdf[0]); - break; - default: - mbmi->mode = - read_intra_mode(r, ec_ctx->y_mode_cdf[size_group_lookup[bsize]]); - } -#endif -#if CONFIG_CB4X4 if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) { mbmi->uv_mode = read_intra_mode_uv(ec_ctx, r, mbmi->mode); -#else - mbmi->uv_mode = read_intra_mode_uv(ec_ctx, r, mbmi->mode); - (void)mi_row; - (void)mi_col; -#endif #if CONFIG_CFL if (mbmi->uv_mode == UV_CFL_PRED) { @@ -1884,7 +1817,6 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row, } #endif // CONFIG_CFL -#if CONFIG_CB4X4 } else { // Avoid decoding angle_info if there is is no chroma prediction mbmi->uv_mode = UV_DC_PRED; @@ -1893,7 +1825,6 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row, xd->cfl->store_y = 1; #endif } -#endif // Explicitly ignore cm here to avoid a compile warning if none of // ext-intra, palette and filter-intra are enabled. @@ -1909,8 +1840,7 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row, #if CONFIG_FILTER_INTRA mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0; mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0; - if (bsize >= BLOCK_8X8 || CONFIG_CB4X4) - read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r); + read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r); #endif // CONFIG_FILTER_INTRA } @@ -1931,13 +1861,8 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd, FRAME_CONTEXT *ec_ctx = xd->tile_ctx; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; -#if CONFIG_CB4X4 int_mv *pred_mv = mbmi->pred_mv; (void)block; -#else - int_mv *pred_mv = - (bsize >= BLOCK_8X8) ? mbmi->pred_mv : xd->mi[0]->bmi[block].pred_mv; -#endif // CONFIG_CB4X4 (void)ref_frame; (void)cm; (void)mi_row; @@ -2299,7 +2224,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, MB_MODE_INFO *const mbmi = &mi->mbmi; const BLOCK_SIZE bsize = mbmi->sb_type; const int allow_hp = cm->allow_high_precision_mv; - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; int_mv nearestmv[2], nearmv[2]; int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; int ref, is_compound; @@ -2926,13 +2851,8 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi, xd->left_txfm_context = xd->left_txfm_context_buffer + ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2); - if (cm->tx_mode == TX_MODE_SELECT && -#if CONFIG_CB4X4 - bsize > BLOCK_4X4 && -#else - bsize >= BLOCK_8X8 && -#endif - !mbmi->skip && inter_block && !xd->lossless[mbmi->segment_id]) { + if (cm->tx_mode == TX_MODE_SELECT && bsize > BLOCK_4X4 && !mbmi->skip && + inter_block && !xd->lossless[mbmi->segment_id]) { const TX_SIZE max_tx_size = max_txsize_rect_lookup[bsize]; const int bh = tx_size_high_unit[max_tx_size]; const int bw = tx_size_wide_unit[max_tx_size]; diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c index ac6ad00537bed4b4668dff34ad96e3c158585629..27f81483544d933050f7ff1b75752c20aa04c96c 100644 --- a/av1/decoder/decodetxb.c +++ b/av1/decoder/decodetxb.c @@ -541,12 +541,9 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 +#else const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); -#else // CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif // CONFIG_CB4X4 +#endif // CONFIG_CHROMA_SUB8X8 TXB_CTX txb_ctx; get_txb_ctx(plane_bsize, tx_size, plane, pd->above_context + col, diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index c71a571069e81c052eb5e381d1bfdcccfd4f1e19..19f82883c457a85604af044ba4f6b39b6c161b16 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -709,12 +709,9 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 adapt = x->daala_enc.state.adapt; @@ -1187,16 +1184,10 @@ static void write_filter_intra_mode_info(const AV1_COMMON *const cm, } } -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) return; -#else - (void)xd; - (void)mi_row; - (void)mi_col; -#endif // CONFIG_CB4X4 if (mbmi->uv_mode == UV_DC_PRED && mbmi->palette_mode_info.palette_size[1] == 0) { @@ -1635,11 +1626,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row, const int is_inter = is_inter_block(mbmi); const int is_compound = has_second_ref(mbmi); int skip, ref; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif (void)mi_row; (void)mi_col; @@ -1704,7 +1691,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row, write_is_inter(cm, xd, mbmi->segment_id, w, is_inter); if (cm->tx_mode == TX_MODE_SELECT && -#if CONFIG_CB4X4 && CONFIG_VAR_TX && !CONFIG_RECT_TX +#if CONFIG_VAR_TX && !CONFIG_RECT_TX (bsize >= BLOCK_8X8 || (bsize > BLOCK_4X4 && is_inter)) && #else block_signals_txsize(bsize) && @@ -1763,23 +1750,16 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row, } } } -#if CONFIG_CB4X4 if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) { write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w); -#else // !CONFIG_CB4X4 - write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w); -#endif // CONFIG_CB4X4 #if CONFIG_CFL if (mbmi->uv_mode == UV_CFL_PRED) { write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w); } #endif - -#if CONFIG_CB4X4 } -#endif #if CONFIG_EXT_INTRA write_intra_angle_info(xd, w); @@ -2084,11 +2064,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd, const MODE_INFO *const left_mi = xd->left_mi; const MB_MODE_INFO *const mbmi = &mi->mbmi; const BLOCK_SIZE bsize = mbmi->sb_type; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif (void)mi_row; (void)mi_col; @@ -2169,23 +2145,17 @@ static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd, } } -#if CONFIG_CB4X4 if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) { write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w); -#else // !CONFIG_CB4X4 - write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w); -#endif // CONFIG_CB4X4 #if CONFIG_CFL if (mbmi->uv_mode == UV_CFL_PRED) { write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w); } #endif - -#if CONFIG_CB4X4 } -#endif + #if CONFIG_EXT_INTRA write_intra_angle_info(xd, w); #endif // CONFIG_EXT_INTRA @@ -2507,7 +2477,6 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, assert(*tok < tok_end); #endif for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) { @@ -2516,19 +2485,15 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, #endif // !CONFIG_LV_MAP continue; } -#endif #if CONFIG_VAR_TX const struct macroblockd_plane *const pd = &xd->plane[plane]; BLOCK_SIZE bsize = mbmi->sb_type; #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(bsize, BLOCK_8X8), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 const int num_4x4_w = block_size_wide[plane_bsize] >> tx_size_wide_log2[0]; @@ -2674,11 +2639,7 @@ static void write_tokens_sb(AV1_COMP *cpi, const TileInfo *const tile, const int hbs = mi_size_wide[bsize] / 2; PARTITION_TYPE partition; BLOCK_SIZE subsize; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; @@ -2818,11 +2779,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile, #endif // CONFIG_EXT_PARTITION_TYPES const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize); const BLOCK_SIZE subsize = get_subsize(bsize, partition); -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; diff --git a/av1/encoder/block.h b/av1/encoder/block.h index c2b618a95511c883aafa0a38f79b1be4e27b7d8d..4547c9751af309d2c3b55b508579eedd0aac9528 100644 --- a/av1/encoder/block.h +++ b/av1/encoder/block.h @@ -214,11 +214,7 @@ struct macroblock { #endif int skip; - -#if CONFIG_CB4X4 int skip_chroma_rd; -#endif - int skip_cost[SKIP_CONTEXTS][2]; #if CONFIG_LV_MAP @@ -356,13 +352,11 @@ struct macroblock { #if CONFIG_DIST_8X8 int using_dist_8x8; aom_tune_metric tune_metric; -#if CONFIG_CB4X4 #if CONFIG_HIGHBITDEPTH DECLARE_ALIGNED(16, uint16_t, decoded_8x8[8 * 8]); #else DECLARE_ALIGNED(16, uint8_t, decoded_8x8[8 * 8]); #endif -#endif // CONFIG_CB4X4 #endif // CONFIG_DIST_8X8 }; diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c index eb33cd561146c7adc8bcaf8c90a13110cc7da80b..7be0225d7dfbc6b3af8890cc8910db8afa551451 100644 --- a/av1/encoder/context_tree.c +++ b/av1/encoder/context_tree.c @@ -13,10 +13,7 @@ #include "av1/encoder/encoder.h" static const BLOCK_SIZE square[MAX_SB_SIZE_LOG2 - 1] = { -#if CONFIG_CB4X4 - BLOCK_4X4, -#endif - BLOCK_8X8, BLOCK_16X16, BLOCK_32X32, BLOCK_64X64, + BLOCK_4X4, BLOCK_8X8, BLOCK_16X16, BLOCK_32X32, BLOCK_64X64, #if CONFIG_EXT_PARTITION BLOCK_128X128, #endif // CONFIG_EXT_PARTITION @@ -172,17 +169,12 @@ static void free_tree_contexts(PC_TREE *tree) { // represents the state of our search. void av1_setup_pc_tree(AV1_COMMON *cm, ThreadData *td) { int i, j; -#if CONFIG_CB4X4 #if CONFIG_EXT_PARTITION const int tree_nodes_inc = 1024; #else const int tree_nodes_inc = 256; #endif // CONFIG_EXT_PARTITION const int leaf_factor = 4; -#else - const int tree_nodes_inc = 0; - const int leaf_factor = 1; -#endif #if CONFIG_EXT_PARTITION const int leaf_nodes = 256 * leaf_factor; const int tree_nodes = tree_nodes_inc + 256 + 64 + 16 + 4 + 1; @@ -195,42 +187,16 @@ void av1_setup_pc_tree(AV1_COMMON *cm, ThreadData *td) { int square_index = 1; int nodes; -#if !CONFIG_CB4X4 - aom_free(td->leaf_tree); - CHECK_MEM_ERROR(cm, td->leaf_tree, - aom_calloc(leaf_nodes, sizeof(*td->leaf_tree))); - PICK_MODE_CONTEXT *this_leaf = &td->leaf_tree[0]; -#endif aom_free(td->pc_tree); CHECK_MEM_ERROR(cm, td->pc_tree, aom_calloc(tree_nodes, sizeof(*td->pc_tree))); this_pc = &td->pc_tree[0]; -#if !CONFIG_CB4X4 - // 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same - // context so we only need to allocate 1 for each 8x8 block. - for (i = 0; i < leaf_nodes; ++i) { -#if CONFIG_EXT_PARTITION_TYPES - alloc_mode_context(cm, 4, PARTITION_NONE, &td->leaf_tree[i]); -#else - alloc_mode_context(cm, 16, &td->leaf_tree[i]); -#endif - } -#endif - // Sets up all the leaf nodes in the tree. for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) { PC_TREE *const tree = &td->pc_tree[pc_tree_index]; tree->block_size = square[0]; -#if CONFIG_CB4X4 alloc_tree_contexts(cm, tree, 16); -#else - alloc_tree_contexts(cm, tree, 4); -#endif -#if !CONFIG_CB4X4 - tree->leaf_split[0] = this_leaf++; - for (j = 1; j < 4; j++) tree->leaf_split[j] = tree->leaf_split[0]; -#endif } // Each node has 4 leaf nodes, fill each block_size level of the tree @@ -238,11 +204,7 @@ void av1_setup_pc_tree(AV1_COMMON *cm, ThreadData *td) { for (nodes = leaf_nodes >> 2; nodes > 0; nodes >>= 2) { for (i = 0; i < nodes; ++i) { PC_TREE *const tree = &td->pc_tree[pc_tree_index]; -#if CONFIG_CB4X4 alloc_tree_contexts(cm, tree, 16 << (2 * square_index)); -#else - alloc_tree_contexts(cm, tree, 4 << (2 * square_index)); -#endif tree->block_size = square[square_index]; for (j = 0; j < 4; j++) tree->split[j] = this_pc++; ++pc_tree_index; @@ -262,15 +224,11 @@ void av1_setup_pc_tree(AV1_COMMON *cm, ThreadData *td) { } void av1_free_pc_tree(ThreadData *td) { -#if CONFIG_CB4X4 #if CONFIG_EXT_PARTITION const int tree_nodes_inc = 1024; #else const int tree_nodes_inc = 256; #endif // CONFIG_EXT_PARTITION -#else - const int tree_nodes_inc = 0; -#endif #if CONFIG_EXT_PARTITION const int tree_nodes = tree_nodes_inc + 256 + 64 + 16 + 4 + 1; @@ -281,15 +239,4 @@ void av1_free_pc_tree(ThreadData *td) { for (i = 0; i < tree_nodes; ++i) free_tree_contexts(&td->pc_tree[i]); aom_free(td->pc_tree); td->pc_tree = NULL; -#if !CONFIG_CB4X4 - const int leaf_factor = 1; -#if CONFIG_EXT_PARTITION - const int leaf_nodes = 256 * leaf_factor; -#else - const int leaf_nodes = 64 * leaf_factor; -#endif // CONFIG_EXT_PARTITION - for (i = 0; i < leaf_nodes; ++i) free_mode_context(&td->leaf_tree[i]); - aom_free(td->leaf_tree); - td->leaf_tree = NULL; -#endif } diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index ec43e5e2579cde11ae4b4d1853bcf9072803f615..f0cf128778ebaf656a33aa9403c88ef97cf94b99 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c @@ -448,7 +448,7 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td, const int mis = cm->mi_stride; const int mi_width = mi_size_wide[bsize]; const int mi_height = mi_size_high[bsize]; - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; int8_t rf_type; @@ -633,12 +633,7 @@ static void set_mode_info_sb(const AV1_COMP *const cpi, ThreadData *td, const BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT); const int quarter_step = mi_size_wide[bsize] / 4; #endif -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; - assert(bsize >= BLOCK_8X8); -#endif if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; @@ -820,7 +815,7 @@ static int set_segment_rdmult(const AV1_COMP *const cpi, MACROBLOCK *const x, return av1_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q); } -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 static void dist_8x8_set_sub8x8_dst(MACROBLOCK *const x, uint8_t *dst8x8, BLOCK_SIZE bsize, int bw, int bh, int mi_row, int mi_col) { @@ -853,7 +848,7 @@ static void dist_8x8_set_sub8x8_dst(MACROBLOCK *const x, uint8_t *dst8x8, #endif } } -#endif +#endif // CONFIG_DIST_8X8 static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data, MACROBLOCK *const x, int mi_row, int mi_col, @@ -913,11 +908,9 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data, // Set to zero to make sure we do not use the previous encoded frame stats mbmi->skip = 0; -#if CONFIG_CB4X4 x->skip_chroma_rd = !is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y); -#endif #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -1614,12 +1607,7 @@ static void encode_sb(const AV1_COMP *const cpi, ThreadData *td, #endif #endif -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; - assert(bsize >= BLOCK_8X8); -#endif if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; @@ -1893,7 +1881,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td, BLOCK_SIZE bs_type = mib[0]->mbmi.sb_type; int do_partition_search = 1; PICK_MODE_CONTEXT *ctx_none = &pc_tree->none; - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; #if CONFIG_PVQ od_rollback_buffer pre_rdo_buf; #endif @@ -2586,7 +2574,7 @@ static void rd_test_partition3(const AV1_COMP *const cpi, ThreadData *td, } #endif // CONFIG_EXT_PARTITION_TYPES -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 static int64_t dist_8x8_yuv(const AV1_COMP *const cpi, MACROBLOCK *const x, uint8_t *y_src_8x8) { MACROBLOCKD *const xd = &x->e_mbd; @@ -2632,7 +2620,7 @@ static int64_t dist_8x8_yuv(const AV1_COMP *const cpi, MACROBLOCK *const x, return total_dist = dist_8x8 + dist_8x8_uv; } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 // TODO(jingning,jimbankoski,rbultje): properly skip partition types that are // unlikely to be selected depending on previous rate-distortion optimization @@ -2661,7 +2649,6 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, RD_STATS this_rdc, sum_rdc, best_rdc; const int bsize_at_least_8x8 = (bsize >= BLOCK_8X8); int do_square_split = bsize_at_least_8x8; -#if CONFIG_CB4X4 const int unify_bsize = 1; const int pl = bsize_at_least_8x8 ? partition_plane_context(xd, mi_row, mi_col, @@ -2670,14 +2657,6 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, #endif bsize) : 0; -#else - const int unify_bsize = 0; - const int pl = partition_plane_context(xd, mi_row, mi_col, -#if CONFIG_UNPOISON_PARTITION_CTX - has_rows, has_cols, -#endif - bsize); -#endif // CONFIG_CB4X4 const int *partition_cost = pl >= 0 ? x->partition_cost[pl] : x->partition_cost[0]; @@ -3006,7 +2985,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, } reached_last_index = (idx == 4); -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && reached_last_index && sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) { const int src_stride = x->plane[0].src.stride; @@ -3017,7 +2996,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, sum_rdc.dist = dist_8x8; sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 } #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG @@ -3083,14 +3062,14 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, subsize, &pc_tree->horizontal[1], best_rdc.rdcost - sum_rdc.rdcost); -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) { update_state(cpi, td, &pc_tree->horizontal[1], mi_row + mi_step, mi_col, subsize, DRY_RUN_NORMAL); encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row + mi_step, mi_col, subsize, NULL); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 if (this_rdc.rate == INT_MAX) { sum_rdc.rdcost = INT64_MAX; @@ -3099,7 +3078,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, sum_rdc.dist += this_rdc.dist; sum_rdc.rdcost += this_rdc.rdcost; } -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) { const int src_stride = x->plane[0].src.stride; @@ -3109,7 +3088,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, sum_rdc.dist = dist_8x8; sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 } #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG @@ -3168,14 +3147,14 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, subsize, &pc_tree->vertical[1], best_rdc.rdcost - sum_rdc.rdcost); -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) { update_state(cpi, td, &pc_tree->vertical[1], mi_row, mi_col + mi_step, subsize, DRY_RUN_NORMAL); encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col + mi_step, subsize, NULL); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 if (this_rdc.rate == INT_MAX) { sum_rdc.rdcost = INT64_MAX; @@ -3184,7 +3163,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, sum_rdc.dist += this_rdc.dist; sum_rdc.rdcost += this_rdc.rdcost; } -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) { int64_t dist_8x8; @@ -3193,7 +3172,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, sum_rdc.dist = dist_8x8; sum_rdc.rdcost = RDCOST(x->rdmult, sum_rdc.rate, sum_rdc.dist); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 } #if CONFIG_CFL && CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG @@ -3448,13 +3427,13 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, } } -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX && bsize == BLOCK_4X4 && pc_tree->index == 3) { encode_sb(cpi, td, tile_info, tp, mi_row, mi_col, DRY_RUN_NORMAL, bsize, pc_tree, NULL); } -#endif // CONFIG_DIST_8X8 && CONFIG_CB4X4 +#endif // CONFIG_DIST_8X8 if (bsize == cm->sb_size) { #if !CONFIG_PVQ && !CONFIG_LV_MAP @@ -3524,11 +3503,6 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td, av1_fill_mode_rates(cm, x, xd->tile_ctx); if (sf->adaptive_pred_interp_filter) { -#if !CONFIG_CB4X4 - for (i = 0; i < leaf_nodes; ++i) - td->leaf_tree[i].pred_interp_filter = SWITCHABLE; -#endif - for (i = 0; i < leaf_nodes; ++i) { td->pc_tree[i].vertical[0].pred_interp_filter = SWITCHABLE; td->pc_tree[i].vertical[1].pred_interp_filter = SWITCHABLE; @@ -4713,7 +4687,7 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd, const UV_PREDICTION_MODE uv_mode = mbmi->uv_mode; (void)counts; const BLOCK_SIZE bsize = mbmi->sb_type; - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; if (bsize < BLOCK_8X8 && !unify_bsize) { int idx, idy; @@ -4765,13 +4739,10 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd, mbmi->filter_intra_mode_info.filter_intra_mode[0], FILTER_INTRA_MODES); } - if (mbmi->uv_mode == UV_DC_PRED -#if CONFIG_CB4X4 - && + if (mbmi->uv_mode == UV_DC_PRED && is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, - xd->plane[1].subsampling_y) -#endif - && mbmi->palette_mode_info.palette_size[1] == 0) { + xd->plane[1].subsampling_y) && + mbmi->palette_mode_info.palette_size[1] == 0) { const int use_filter_intra_mode = mbmi->filter_intra_mode_info.use_filter_intra_mode[1]; ++counts->filter_intra[1][use_filter_intra_mode]; @@ -4784,15 +4755,9 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd, #endif // CONFIG_FILTER_INTRA } -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y)) return; -#else - (void)mi_row; - (void)mi_col; - (void)xd; -#endif #if CONFIG_ENTROPY_STATS ++counts->uv_mode[y_mode][uv_mode]; #endif // CONFIG_ENTROPY_STATS @@ -5123,11 +5088,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, const int mi_width = mi_size_wide[bsize]; const int mi_height = mi_size_high[bsize]; const int is_inter = is_inter_block(mbmi); -#if CONFIG_CB4X4 const BLOCK_SIZE block_size = bsize; -#else - const BLOCK_SIZE block_size = AOMMAX(bsize, BLOCK_8X8); -#endif #if CONFIG_PVQ x->pvq_speed = 0; @@ -5255,13 +5216,13 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, #endif } -#if CONFIG_DIST_8X8 && CONFIG_CB4X4 +#if CONFIG_DIST_8X8 if (x->using_dist_8x8 && bsize < BLOCK_8X8) { dist_8x8_set_sub8x8_dst(x, (uint8_t *)x->decoded_8x8, bsize, block_size_wide[bsize], block_size_high[bsize], mi_row, mi_col); } -#endif +#endif // CONFIG_DIST_8X8 if (!dry_run) { #if CONFIG_VAR_TX @@ -5271,11 +5232,11 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, TX_SIZE tx_size = mbmi->tx_size; #endif if (cm->tx_mode == TX_MODE_SELECT && !xd->lossless[mbmi->segment_id] && -#if CONFIG_CB4X4 && (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX +#if (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX mbmi->sb_type > BLOCK_4X4 && #else mbmi->sb_type >= BLOCK_8X8 && -#endif +#endif // (CONFIG_VAR_TX || CONFIG_EXT_TX) && CONFIG_RECT_TX !(is_inter && (mbmi->skip || seg_skip))) { #if CONFIG_VAR_TX if (is_inter) { @@ -5353,14 +5314,8 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, } #if CONFIG_VAR_TX - if (cm->tx_mode == TX_MODE_SELECT && -#if CONFIG_CB4X4 - mbmi->sb_type > BLOCK_4X4 && -#else - mbmi->sb_type >= BLOCK_8X8 && -#endif - is_inter && !(mbmi->skip || seg_skip) && - !xd->lossless[mbmi->segment_id]) { + if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type > BLOCK_4X4 && is_inter && + !(mbmi->skip || seg_skip) && !xd->lossless[mbmi->segment_id]) { if (dry_run) tx_partition_set_contexts(cm, xd, bsize, mi_row, mi_col); } else { TX_SIZE tx_size = mbmi->tx_size; diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index aeff5b68fb44493edde81574312b5286d70ba7bb..6a88714d7b4250269ebc4c5ed234dabbf554a4d1 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c @@ -917,7 +917,6 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, if (x->skip) return; for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 const int subsampling_x = xd->plane[plane].subsampling_x; const int subsampling_y = xd->plane[plane].subsampling_y; @@ -926,10 +925,6 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, continue; bsize = scale_chroma_bsize(bsize, subsampling_x, subsampling_y); -#else - (void)mi_row; - (void)mi_col; -#endif #if CONFIG_VAR_TX // TODO(jingning): Clean this up. @@ -1102,15 +1097,10 @@ void av1_encode_intra_block_plane(AV1_COMMON *cm, MACROBLOCK *x, cm, x, NULL, &xd->mi[0]->mbmi.skip, ta, tl, enable_optimize_b }; -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) return; -#else - (void)mi_row; - (void)mi_col; -#endif if (enable_optimize_b) { const struct macroblockd_plane *const pd = &xd->plane[plane]; diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c index f8a546999dc7b1ca3bac9460de1ad8e6b9f01aa1..fd1d13e435bcae74d8a1e4b1dcd57b3635365363 100644 --- a/av1/encoder/encodemv.c +++ b/av1/encoder/encodemv.c @@ -381,11 +381,7 @@ void av1_update_mv_count(ThreadData *td) { const MODE_INFO *mi = xd->mi[0]; const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO_EXT *mbmi_ext = td->mb.mbmi_ext; -#if CONFIG_CB4X4 const int unify_bsize = 1; -#else - const int unify_bsize = 0; -#endif #if CONFIG_AMVR MvSubpelPrecision precision = 1; if (xd->cur_frame_mv_precision_level) { diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index b70c8594b3074c9a5c5909b9d887b6d0315addf5..41fc6b8f29b9035d42caea8a2fc28e5550d7f392 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c @@ -4640,7 +4640,6 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) { #endif #endif // CONFIG_LPF_SB { -#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4 #if CONFIG_LPF_SB av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0, 0, 0); @@ -4657,14 +4656,6 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) { av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0); #endif // CONFIG_LOOPFILTER_LEVEL #endif // CONFIG_LPF_SB -#else - if (cpi->num_workers > 1) - av1_loop_filter_frame_mt(cm->frame_to_show, cm, xd->plane, - lf->filter_level, 0, 0, cpi->workers, - cpi->num_workers, &cpi->lf_row_sync); - else - av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0); -#endif } #endif // CONFIG_INTRABC diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index d708eeb97274bd72bff1e0548d433c30ad697eb8..919abd78f1dd43776b3a0a7e238003dfe2c951cf 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h @@ -339,9 +339,6 @@ typedef struct ThreadData { MACROBLOCK mb; RD_COUNTS rd_counts; FRAME_COUNTS *counts; -#if !CONFIG_CB4X4 - PICK_MODE_CONTEXT *leaf_tree; -#endif PC_TREE *pc_tree; PC_TREE *pc_root[MAX_MIB_SIZE_LOG2 - MIN_MIB_SIZE_LOG2 + 1]; #if CONFIG_MOTION_VAR @@ -720,13 +717,8 @@ static INLINE unsigned int get_token_alloc(int mb_rows, int mb_cols) { // Get the allocated token size for a tile. It does the same calculation as in // the frame token allocation. static INLINE unsigned int allocated_tokens(TileInfo tile) { -#if CONFIG_CB4X4 int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 2) >> 2; int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 2) >> 2; -#else - int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 1) >> 1; - int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 1) >> 1; -#endif return get_token_alloc(tile_mb_rows, tile_mb_cols); } diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index 15b6d09aeeaa3a6902c526ceedb87ee8c28fd6f9..bbb20d8a42db714999152bcffd85bc12eec29389 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c @@ -469,12 +469,9 @@ void av1_write_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); #else - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(bsize, BLOCK_8X8), pd); -#endif + const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); +#endif // CONFIG_CHROMA_SUB8X8 const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane); const int max_blocks_high = max_block_high(xd, plane_bsize, plane); const TX_SIZE tx_size = av1_get_tx_size(plane, xd); diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c index edc9b1d61e35468ab9ab0ed7a34d44c4a2054cb5..1ea99d64052a9386b88ecb8ffa1016558095ac70 100644 --- a/av1/encoder/ethread.c +++ b/av1/encoder/ethread.c @@ -81,10 +81,7 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) { aom_memalign(32, sizeof(*thread_data->td))); av1_zero(*thread_data->td); -// Set up pc_tree. -#if !CONFIG_CB4X4 - thread_data->td->leaf_tree = NULL; -#endif + // Set up pc_tree. thread_data->td->pc_tree = NULL; av1_setup_pc_tree(cm, thread_data->td); diff --git a/av1/encoder/picklpf.c b/av1/encoder/picklpf.c index b6b427d70876be098f0768afd7020c45f6774a65..35276d7609e724746afaccba935a629e9662e64c 100644 --- a/av1/encoder/picklpf.c +++ b/av1/encoder/picklpf.c @@ -123,18 +123,8 @@ static int try_filter_superblock(const YV12_BUFFER_CONFIG *sd, AV1_COMMON *const cm = &cpi->common; int filt_err; -#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4 av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, 1, partial_frame, mi_row, mi_col); -#else - if (cpi->num_workers > 1) - av1_loop_filter_frame_mt(cm->frame_to_show, cm, cpi->td.mb.e_mbd.plane, - filt_level, 1, partial_frame, cpi->workers, - cpi->num_workers, &cpi->lf_row_sync); - else - av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, - 1, partial_frame); -#endif #if CONFIG_HIGHBITDEPTH if (cm->use_highbitdepth) { @@ -252,7 +242,6 @@ static int64_t try_filter_frame(const YV12_BUFFER_CONFIG *sd, AV1_COMMON *const cm = &cpi->common; int64_t filt_err; -#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_CB4X4 #if CONFIG_LOOPFILTER_LEVEL assert(plane >= 0 && plane <= 2); int filter_level[2] = { filt_level, filt_level }; @@ -265,15 +254,6 @@ static int64_t try_filter_frame(const YV12_BUFFER_CONFIG *sd, av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, 1, partial_frame); #endif // CONFIG_LOOPFILTER_LEVEL -#else - if (cpi->num_workers > 1) - av1_loop_filter_frame_mt(cm->frame_to_show, cm, cpi->td.mb.e_mbd.plane, - filt_level, 1, partial_frame, cpi->workers, - cpi->num_workers, &cpi->lf_row_sync); - else - av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, - 1, partial_frame); -#endif int highbd = 0; #if CONFIG_HIGHBITDEPTH diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c index 6053f54313f8ac6e47a28ee10e734fce7c850a63..a5fed79ac7eebe823df10201d5ce02bcc7d6071c 100644 --- a/av1/encoder/rd.c +++ b/av1/encoder/rd.c @@ -565,25 +565,10 @@ static void set_block_thresholds(const AV1_COMMON *cm, RD_OPT *rd) { const int t = q * rd_thresh_block_size_factor[bsize]; const int thresh_max = INT_MAX / t; -#if CONFIG_CB4X4 for (i = 0; i < MAX_MODES; ++i) rd->threshes[segment_id][bsize][i] = rd->thresh_mult[i] < thresh_max ? rd->thresh_mult[i] * t / 4 : INT_MAX; -#else - if (bsize >= BLOCK_8X8) { - for (i = 0; i < MAX_MODES; ++i) - rd->threshes[segment_id][bsize][i] = rd->thresh_mult[i] < thresh_max - ? rd->thresh_mult[i] * t / 4 - : INT_MAX; - } else { - for (i = 0; i < MAX_REFS; ++i) - rd->threshes[segment_id][bsize][i] = - rd->thresh_mult_sub8x8[i] < thresh_max - ? rd->thresh_mult_sub8x8[i] * t / 4 - : INT_MAX; - } -#endif } } } @@ -1489,11 +1474,7 @@ void av1_update_rd_thresh_fact(const AV1_COMMON *const cm, int (*factor_buf)[MAX_MODES], int rd_thresh, int bsize, int best_mode_index) { if (rd_thresh > 0) { -#if CONFIG_CB4X4 const int top_mode = MAX_MODES; -#else - const int top_mode = bsize < BLOCK_8X8 ? MAX_REFS : MAX_MODES; -#endif int mode; for (mode = 0; mode < top_mode; ++mode) { const BLOCK_SIZE min_size = AOMMAX(bsize - 1, BLOCK_4X4); diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index f96be6d7d4419243b5db4f3f2ae055d6e4f8fddf..0e2e31e82eb28354d89c614feaec7a337743b5cb 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -1522,9 +1522,7 @@ static void model_rd_for_sb(const AV1_COMP *const cpi, BLOCK_SIZE bsize, int rate; int64_t dist; -#if CONFIG_CB4X4 if (x->skip_chroma_rd && plane) continue; -#endif // CONFIG_CB4X4 // TODO(geza): Write direct sse functions that do not compute // variance as well. @@ -1803,12 +1801,9 @@ int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane, #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); -#elif CONFIG_CB4X4 +#else const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); -#else // CONFIG_CB4X4 - const BLOCK_SIZE plane_bsize = - get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd); -#endif // CONFIG_CB4X4 +#endif // CONFIG_CHROMA_SUB8X8 TXB_CTX txb_ctx; get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx); @@ -2898,10 +2893,10 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi, *rd_stats = this_rd_stats; } } -#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 const int is_inter = is_inter_block(mbmi); if (mbmi->sb_type < BLOCK_8X8 && is_inter) break; -#endif // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#endif // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 } #if CONFIG_LGT_FROM_PRED const TX_SIZE rect_tx_size = max_txsize_rect_lookup[bs]; @@ -2964,10 +2959,10 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi, *rd_stats = this_rd_stats; } } -#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 const int is_inter = is_inter_block(mbmi); if (mbmi->sb_type < BLOCK_8X8 && is_inter) break; -#endif // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#endif // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 } #if CONFIG_LGT_FROM_PRED if (is_lgt_allowed(mbmi->mode, tx_size) && !cm->reduced_tx_set_used) { @@ -3053,10 +3048,10 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi, best_rd = rd; *rd_stats = this_rd_stats; } -#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#if !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 const int is_inter = is_inter_block(mbmi); if (mbmi->sb_type < BLOCK_8X8 && is_inter) break; -#endif // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 +#endif // !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 } #if CONFIG_LGT_FROM_PRED mbmi->use_lgt = 1; @@ -3726,15 +3721,9 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( assert(IMPLIES(tx_size == TX_4X8 || tx_size == TX_8X4, block == 0 || block == 2)); xd->mi[0]->bmi[block_raster_idx].as_mode = mode; - av1_predict_intra_block(cm, xd, pd->width, pd->height, - txsize_to_bsize[tx_size], mode, dst, dst_stride, - dst, dst_stride, -#if CONFIG_CB4X4 - 2 * (col + idx), 2 * (row + idy), -#else - col + idx, row + idy, -#endif // CONFIG_CB4X4 - 0); + av1_predict_intra_block( + cm, xd, pd->width, pd->height, txsize_to_bsize[tx_size], mode, dst, + dst_stride, dst, dst_stride, 2 * (col + idx), 2 * (row + idy), 0); #if !CONFIG_PVQ aom_subtract_block(tx_height, tx_width, src_diff, 8, src, src_stride, dst, dst_stride); @@ -3744,27 +3733,15 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, &xd->mi[0]->mbmi); const int coeff_ctx = combine_entropy_contexts(tempa[idx], templ[idy]); -#if CONFIG_CB4X4 block = 4 * block; -#endif // CONFIG_CB4X4 #if !CONFIG_PVQ #if DISABLE_TRELLISQ_SEARCH - av1_xform_quant(cm, x, 0, block, -#if CONFIG_CB4X4 - 2 * (row + idy), 2 * (col + idx), -#else - row + idy, col + idx, -#endif // CONFIG_CB4X4 + av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx), BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_B); #else const AV1_XFORM_QUANT xform_quant = is_lossless ? AV1_XFORM_QUANT_B : AV1_XFORM_QUANT_FP; - av1_xform_quant(cm, x, 0, block, -#if CONFIG_CB4X4 - 2 * (row + idy), 2 * (col + idx), -#else - row + idy, col + idx, -#endif // CONFIG_CB4X4 + av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx), BLOCK_8X8, tx_size, coeff_ctx, xform_quant); av1_optimize_b(cm, x, 0, 0, 0, block, BLOCK_8X8, tx_size, tempa + idx, @@ -3787,12 +3764,7 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( #else (void)scan_order; - av1_xform_quant(cm, x, 0, block, -#if CONFIG_CB4X4 - 2 * (row + idy), 2 * (col + idx), -#else - row + idy, col + idx, -#endif // CONFIG_CB4X4 + av1_xform_quant(cm, x, 0, block, 2 * (row + idy), 2 * (col + idx), BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); ratey += x->rate; @@ -4582,12 +4554,10 @@ static int super_block_uvrd(const AV1_COMP *const cpi, MACROBLOCK *x, if (ref_best_rd < 0) is_cost_valid = 0; -#if CONFIG_CB4X4 if (x->skip_chroma_rd) return is_cost_valid; bsize = scale_chroma_bsize(bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y); -#endif // CONFIG_CB4X4 #if !CONFIG_PVQ if (is_inter_block(mbmi) && is_cost_valid) { @@ -5809,11 +5779,9 @@ static int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, av1_init_rd_stats(rd_stats); -#if CONFIG_CB4X4 if (x->skip_chroma_rd) return is_cost_valid; bsize = scale_chroma_bsize(mbmi->sb_type, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y); -#endif // CONFIG_CB4X4 #if CONFIG_EXT_TX && CONFIG_RECT_TX if (is_rect_tx(mbmi->tx_size)) { @@ -6519,7 +6487,6 @@ static void choose_intra_uv_mode(const AV1_COMP *const cpi, MACROBLOCK *const x, // Use an estimated rd for uv_intra based on DC_PRED if the // appropriate speed flag is set. init_sbuv_mode(mbmi); -#if CONFIG_CB4X4 if (x->skip_chroma_rd) { *rate_uv = 0; *rate_uv_tokenonly = 0; @@ -6534,14 +6501,6 @@ static void choose_intra_uv_mode(const AV1_COMP *const cpi, MACROBLOCK *const x, // Only store reconstructed luma when there's chroma RDO. When there's no // chroma RDO, the reconstructed luma will be stored in encode_superblock(). xd->cfl->store_y = !x->skip_chroma_rd; -#endif // CONFIG_CFL -#else - bsize = bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize; -#if CONFIG_CFL - xd->cfl->store_y = 1; -#endif // CONFIG_CFL -#endif // CONFIG_CB4X4 -#if CONFIG_CFL if (xd->cfl->store_y) { // Perform one extra call to txfm_rd_in_plane(), with the values chosen // during luma RDO, so we can store reconstructed luma values @@ -6818,10 +6777,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, #else DECLARE_ALIGNED(16, uint8_t, second_pred[MAX_SB_SQUARE]); #endif // CONFIG_HIGHBITDEPTH - -#if CONFIG_CB4X4 (void)ref_mv_sub8x8; -#endif // CONFIG_CB4X4 #if CONFIG_COMPOUND_SINGLEREF for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) @@ -6829,12 +6785,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, for (ref = 0; ref < 2; ++ref) #endif // CONFIG_COMPOUND_SINGLEREF { -#if !CONFIG_CB4X4 - if (bsize < BLOCK_8X8 && ref_mv_sub8x8 != NULL) - ref_mv[ref].as_int = ref_mv_sub8x8[ref]->as_int; - else -#endif // !CONFIG_CB4X4 - ref_mv[ref] = x->mbmi_ext->ref_mvs[refs[ref]][0]; + ref_mv[ref] = x->mbmi_ext->ref_mvs[refs[ref]][0]; if (scaled_ref_frame[ref]) { int i; @@ -7071,18 +7022,9 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); } else { #endif // CONFIG_COMPOUND_SINGLEREF -#if !CONFIG_CB4X4 - if (bsize >= BLOCK_8X8) -#endif // !CONFIG_CB4X4 - *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv, - &x->mbmi_ext->ref_mvs[refs[ref]][0].as_mv, - x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); -#if !CONFIG_CB4X4 - else - *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv, - &ref_mv_sub8x8[ref]->as_mv, x->nmvjointcost, - x->mvcost, MV_COST_WEIGHT); -#endif // !CONFIG_CB4X4 + *rate_mv += av1_mv_bit_cost(&frame_mv[refs[ref]].as_mv, + &x->mbmi_ext->ref_mvs[refs[ref]][0].as_mv, + x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); #if CONFIG_COMPOUND_SINGLEREF } #endif // CONFIG_COMPOUND_SINGLEREF @@ -7363,17 +7305,11 @@ static void setup_buffer_inter( &frame_nearest_mv[ref_frame], &frame_near_mv[ref_frame]); #endif -// Further refinement that is encode side only to test the top few candidates -// in full and choose the best as the centre point for subsequent searches. -// The current implementation doesn't support scaling. -#if CONFIG_CB4X4 + // Further refinement that is encode side only to test the top few candidates + // in full and choose the best as the centre point for subsequent searches. + // The current implementation doesn't support scaling. av1_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, ref_frame, block_size); -#else - if (!av1_is_scaled(sf) && block_size >= BLOCK_8X8) - av1_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, ref_frame, - block_size); -#endif // CONFIG_CB4X4 } static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x, @@ -7934,7 +7870,6 @@ static void do_masked_motion_search_indexed( int_mv frame_comp_mv[TOTAL_REFS_PER_FRAME]; #endif // CONFIG_COMPOUND_SINGLEREF MV_REFERENCE_FRAME rf[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] }; - assert(bsize >= BLOCK_8X8 || CONFIG_CB4X4); frame_mv[rf[0]].as_int = cur_mv[0].as_int; #if CONFIG_COMPOUND_SINGLEREF @@ -10082,7 +10017,7 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x, int y_skip = 0, uv_skip = 0; int64_t dist_y = 0, dist_uv = 0; TX_SIZE max_uv_tx_size; - const int unify_bsize = CONFIG_CB4X4; + const int unify_bsize = 1; (void)cm; @@ -10106,13 +10041,9 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x, if (intra_yrd < best_rd) { #if CONFIG_CFL -#if CONFIG_CB4X4 // Only store reconstructed luma when there's chroma RDO. When there's no // chroma RDO, the reconstructed luma will be stored in encode_superblock(). xd->cfl->store_y = !x->skip_chroma_rd; -#else - xd->cfl->store_y = 1; -#endif // CONFIG_CB4X4 if (xd->cfl->store_y) { // Perform one extra call to txfm_rd_in_plane(), with the values chosen // during luma RDO, so we can store reconstructed luma values @@ -10126,14 +10057,9 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x, max_uv_tx_size = uv_txsize_lookup[bsize][mbmi->tx_size][pd[1].subsampling_x] [pd[1].subsampling_y]; init_sbuv_mode(mbmi); -#if CONFIG_CB4X4 if (!x->skip_chroma_rd) rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv, &uv_skip, bsize, max_uv_tx_size); -#else - rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv, - &uv_skip, AOMMAX(BLOCK_8X8, bsize), max_uv_tx_size); -#endif // CONFIG_CB4X4 if (y_skip && (uv_skip || x->skip_chroma_rd)) { rd_cost->rate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly + @@ -11139,14 +11065,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, } #endif // CONFIG_FILTER_INTRA -#if CONFIG_CB4X4 rate2 = rate_y + intra_mode_cost[mbmi->mode]; if (!x->skip_chroma_rd) rate2 += rate_uv + x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode]; -#else - rate2 = rate_y + intra_mode_cost[mbmi->mode] + rate_uv + - x->intra_uv_mode_cost[mbmi->mode][mbmi->uv_mode]; -#endif // CONFIG_CB4X4 if (try_palette && mbmi->mode == DC_PRED) { rate2 += x->palette_y_mode_cost[bsize - BLOCK_8X8][palette_ctx][0]; @@ -12683,11 +12604,9 @@ int64_t get_prediction_rd_cost(const struct AV1_COMP *cpi, struct macroblock *x, int64_t this_rd; int ref; -#if CONFIG_CB4X4 x->skip_chroma_rd = !is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y); -#endif set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c index d384d3717a97323d2957b3607cccac785f05ce84..ff28a2f1b5e9ca4e25e0a60ad4cbaa3252b6329a 100644 --- a/av1/encoder/tokenize.c +++ b/av1/encoder/tokenize.c @@ -722,7 +722,6 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, #endif for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) { @@ -734,7 +733,6 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, #endif continue; } -#endif const struct macroblockd_plane *const pd = &xd->plane[plane]; #if CONFIG_CHROMA_SUB8X8 const BLOCK_SIZE plane_bsize = @@ -806,7 +804,6 @@ void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, int plane; for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) { @@ -816,10 +813,6 @@ void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, #endif continue; } -#else - (void)mi_row; - (void)mi_col; -#endif av1_foreach_transformed_block_in_plane(xd, bsize, plane, tokenize_b, &arg); #if !CONFIG_PVQ @@ -833,30 +826,20 @@ void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, else if (dry_run == DRY_RUN_NORMAL) { int plane; for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) continue; -#else - (void)mi_row; - (void)mi_col; -#endif av1_foreach_transformed_block_in_plane(xd, bsize, plane, set_entropy_context_b, &arg); } } else if (dry_run == DRY_RUN_COSTCOEFFS) { int plane; for (plane = 0; plane < MAX_MB_PLANE; ++plane) { -#if CONFIG_CB4X4 if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[plane].subsampling_x, xd->plane[plane].subsampling_y)) continue; -#else - (void)mi_row; - (void)mi_col; -#endif av1_foreach_transformed_block_in_plane(xd, bsize, plane, cost_coeffs_b, &arg); }