Remove CCSO macros Addresses one task of #468
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h index 851319d..eec06f2 100644 --- a/aom/aom_encoder.h +++ b/aom/aom_encoder.h
@@ -448,12 +448,10 @@ * */ unsigned int enable_wiener_nonsep; -#if CONFIG_CCSO /*!\brief enable cross-component sample offset * */ unsigned int enable_ccso; -#endif /*!\brief enable prediction enhancement filter * */
diff --git a/apps/aomenc.c b/apps/aomenc.c index c6d7821..3670d6e 100644 --- a/apps/aomenc.c +++ b/apps/aomenc.c
@@ -474,9 +474,7 @@ #if CONFIG_AFFINE_REFINEMENT &g_av1_codec_arg_defs.enable_affine_refine, #endif // CONFIG_AFFINE_REFINEMENT -#if CONFIG_CCSO &g_av1_codec_arg_defs.enable_ccso, -#endif &g_av1_codec_arg_defs.enable_pef, #if CONFIG_LF_SUB_PU &g_av1_codec_arg_defs.enable_lf_sub_pu, @@ -698,9 +696,7 @@ config->enable_sgrproj = 1; config->enable_pc_wiener = 1; config->enable_wiener_nonsep = 1; -#if CONFIG_CCSO config->enable_ccso = 1; -#endif #if CONFIG_LF_SUB_PU config->enable_pef = 0; config->enable_lf_sub_pu = 1; @@ -1655,17 +1651,12 @@ fprintf(stdout, "Tool setting (Loop filter) : Deblocking (%d), CDEF (%d), " -#if CONFIG_CCSO "CCSO (%d), " -#endif "LoopRestoration (%d: [%d/%d/%d/%d])\n", encoder_cfg->enable_deblocking, encoder_cfg->enable_cdef, -#if CONFIG_CCSO - encoder_cfg->enable_ccso, -#endif - encoder_cfg->enable_restoration, encoder_cfg->enable_wiener, - encoder_cfg->enable_sgrproj, encoder_cfg->enable_pc_wiener, - encoder_cfg->enable_wiener_nonsep); + encoder_cfg->enable_ccso, encoder_cfg->enable_restoration, + encoder_cfg->enable_wiener, encoder_cfg->enable_sgrproj, + encoder_cfg->enable_pc_wiener, encoder_cfg->enable_wiener_nonsep); fprintf(stdout, "Tool setting (Others) : Palette (%d), "
diff --git a/av1/arg_defs.c b/av1/arg_defs.c index f0eeda8..ea88891 100644 --- a/av1/arg_defs.c +++ b/av1/arg_defs.c
@@ -351,11 +351,9 @@ .enable_wiener_nonsep = ARG_DEF(NULL, "enable-wiener-nonsep", 1, "Enable nonsep-wiener lr filter (0: false, " "1: true (default))"), -#if CONFIG_CCSO .enable_ccso = ARG_DEF(NULL, "enable-ccso", 1, "Enable cross component sample offset (0: false " "1: true)"), -#endif .enable_pef = ARG_DEF(NULL, "enable-pef", 1, "Enable prediction enhancement filter (0: false " "1: true)"),
diff --git a/av1/arg_defs.h b/av1/arg_defs.h index 5ae03f9..8538acf 100644 --- a/av1/arg_defs.h +++ b/av1/arg_defs.h
@@ -135,9 +135,7 @@ arg_def_t enable_sgrproj; arg_def_t enable_pc_wiener; arg_def_t enable_wiener_nonsep; -#if CONFIG_CCSO arg_def_t enable_ccso; -#endif arg_def_t enable_pef; #if CONFIG_LF_SUB_PU arg_def_t enable_lf_sub_pu;
diff --git a/av1/av1.cmake b/av1/av1.cmake index 1b28749..a1e4f9a 100644 --- a/av1/av1.cmake +++ b/av1/av1.cmake
@@ -117,12 +117,10 @@ endif() endif() -if(CONFIG_CCSO) - list(APPEND AOM_AV1_COMMON_SOURCES "${AOM_ROOT}/av1/common/ccso.c" - "${AOM_ROOT}/av1/common/ccso.h") - list(APPEND AOM_AV1_ENCODER_SOURCES "${AOM_ROOT}/av1/encoder/pickccso.c" - "${AOM_ROOT}/av1/encoder/pickccso.h") -endif() +list(APPEND AOM_AV1_COMMON_SOURCES "${AOM_ROOT}/av1/common/ccso.c" + "${AOM_ROOT}/av1/common/ccso.h") +list(APPEND AOM_AV1_ENCODER_SOURCES "${AOM_ROOT}/av1/encoder/pickccso.c" + "${AOM_ROOT}/av1/encoder/pickccso.h") list( APPEND
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 5b1c87f..9ff98bd 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c
@@ -72,9 +72,7 @@ unsigned int enable_sgrproj; unsigned int enable_pc_wiener; unsigned int enable_wiener_nonsep; -#if CONFIG_CCSO unsigned int enable_ccso; -#endif unsigned int enable_pef; #if CONFIG_LF_SUB_PU unsigned int enable_lf_sub_pu; @@ -413,9 +411,7 @@ 1, // enable_sgrproj 1, // enable_pc_wiener 1, // enable_wiener_nonsep -#if CONFIG_CCSO - 1, // enable_ccso -#endif + 1, // enable_ccso #if CONFIG_LF_SUB_PU 0, // enable_pef 1, // enable_lf_sub_pu @@ -966,9 +962,7 @@ cfg->enable_sgrproj = extra_cfg->enable_sgrproj; cfg->enable_pc_wiener = extra_cfg->enable_pc_wiener; cfg->enable_wiener_nonsep = extra_cfg->enable_wiener_nonsep; -#if CONFIG_CCSO cfg->enable_ccso = extra_cfg->enable_ccso; -#endif cfg->enable_pef = extra_cfg->enable_pef; #if CONFIG_LF_SUB_PU cfg->enable_lf_sub_pu = extra_cfg->enable_lf_sub_pu; @@ -1094,9 +1088,7 @@ extra_cfg->enable_sgrproj = cfg->enable_sgrproj; extra_cfg->enable_pc_wiener = cfg->enable_pc_wiener; extra_cfg->enable_wiener_nonsep = cfg->enable_wiener_nonsep; -#if CONFIG_CCSO extra_cfg->enable_ccso = cfg->enable_ccso; -#endif extra_cfg->enable_pef = cfg->enable_pef; #if CONFIG_LF_SUB_PU extra_cfg->enable_lf_sub_pu = cfg->enable_lf_sub_pu; @@ -1405,9 +1397,7 @@ tool_cfg->enable_restoration &= (tool_cfg->enable_wiener | tool_cfg->enable_sgrproj | tool_cfg->enable_pc_wiener | tool_cfg->enable_wiener_nonsep); -#if CONFIG_CCSO tool_cfg->enable_ccso = extra_cfg->enable_ccso; -#endif tool_cfg->enable_pef = extra_cfg->enable_pef; if (tool_cfg->enable_pef) { if (cfg->g_lag_in_frames == 0) { @@ -3786,11 +3776,9 @@ } else if (arg_match_helper(&arg, &g_av1_codec_arg_defs.enable_wiener_nonsep, argv, err_string)) { extra_cfg.enable_wiener_nonsep = arg_parse_uint_helper(&arg, err_string); -#if CONFIG_CCSO } else if (arg_match_helper(&arg, &g_av1_codec_arg_defs.enable_ccso, argv, err_string)) { extra_cfg.enable_ccso = arg_parse_int_helper(&arg, err_string); -#endif } else if (arg_match_helper(&arg, &g_av1_codec_arg_defs.enable_pef, argv, err_string)) { extra_cfg.enable_pef = arg_parse_int_helper(&arg, err_string); @@ -4487,10 +4475,7 @@ #if CONFIG_DERIVED_MVD_SIGN 1, #endif // CONFIG_DERIVED_MVD_SIGN - 1, 1, 1, 1, 1, 1, 1, 1, -#if CONFIG_CCSO - 1, -#endif + 1, 1, 1, 1, 1, 1, 1, 1, 1, #if CONFIG_LF_SUB_PU 0, 1, #else
diff --git a/av1/common/av1_common_int.h b/av1/common/av1_common_int.h index 8d9305e..82a1dcf 100644 --- a/av1/common/av1_common_int.h +++ b/av1/common/av1_common_int.h
@@ -375,13 +375,10 @@ REFINE_ALL = 2, } UENUM1BYTE(OPTFLOW_REFINE_TYPE); -#if CONFIG_CCSO /** ccso info */ typedef struct { -#if CONFIG_CCSO_BO_ONLY_OPTION /** ccso band offset only option */ uint8_t ccso_bo_only[CCSO_NUM_COMPONENTS]; -#endif #if CONFIG_D143_CCSO_FM_FLAG /** ccso frame flag */ bool ccso_frame_flag; @@ -390,20 +387,15 @@ bool ccso_enable[CCSO_NUM_COMPONENTS]; /** ccso filter offset */ int8_t filter_offset[CCSO_NUM_COMPONENTS][CCSO_BAND_NUM * 16]; -#if CONFIG_CCSO_EXT /** ccso log2 of max bands */ int max_band_log2[CCSO_NUM_COMPONENTS]; -#endif /** quant index */ uint8_t quant_idx[CCSO_NUM_COMPONENTS]; /** extended filter support */ uint8_t ext_filter_support[CCSO_NUM_COMPONENTS]; -#if CONFIG_CCSO_EDGE_CLF /** edge classifier index */ uint8_t edge_clf[CCSO_NUM_COMPONENTS]; -#endif // CONFIG_CCSO_EDGE_CLF } CcsoInfo; -#endif /*!\cond */ @@ -546,10 +538,8 @@ uint8_t enable_cdef; // To turn on/off CDEF uint8_t enable_restoration; // To turn on/off loop restoration -#if CONFIG_CCSO - uint8_t enable_ccso; // To turn on/off CCSO -#endif - uint8_t enable_pef; // To turn on/off prediction enhancement filter + uint8_t enable_ccso; // To turn on/off CCSO + uint8_t enable_pef; // To turn on/off prediction enhancement filter #if CONFIG_LF_SUB_PU uint8_t enable_lf_sub_pu; // To turn on/off sub-block deblocking #endif // CONFIG_LF_SUB_PU @@ -1637,12 +1627,10 @@ int frame_filter_dictionary_stride; #endif // CONFIG_COMBINE_PC_NS_WIENER -#if CONFIG_CCSO /*! * CCSO (Cross Component Sample Offset) parameters. */ CcsoInfo ccso_info; -#endif /*! * Parameters for film grain synthesis.
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index 65f5276..8d405a4 100644 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl
@@ -571,68 +571,33 @@ } # Cross-component Sample Offset -if (aom_config("CONFIG_CCSO") eq "yes") { - if (aom_config("CONFIG_CCSO_EXT") eq "yes") { - if (aom_config("CONFIG_CCSO_EDGE_CLF") eq "yes") { - if (aom_config("CONFIG_CCSO_BO_ONLY_OPTION") eq "yes") { - add_proto qw/void ccso_filter_block_hbd_wo_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const int x, const int y, const int pic_width, const int pic_height, int *src_cls, const int8_t *offset_buf, const int scaled_ext_stride, const int dst_stride, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, const int blk_size, const bool isSingleBand, const uint8_t shift_bits, const int edge_clf, const uint8_t ccso_bo_only"; - } - else{ - add_proto qw/void ccso_filter_block_hbd_wo_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const int x, const int y, const int pic_width, const int pic_height, int *src_cls, const int8_t *offset_buf, const int scaled_ext_stride, const int dst_stride, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, const int blk_size, const bool isSingleBand, const uint8_t shift_bits, const int edge_clf"; - } - } - else{ - add_proto qw/void ccso_filter_block_hbd_wo_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const int x, const int y, const int pic_width, const int pic_height, int *src_cls, const int8_t *offset_buf, const int scaled_ext_stride, const int dst_stride, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, const int blk_size, const bool isSingleBand, const uint8_t shift_bits"; - } - specialize qw/ccso_filter_block_hbd_wo_buf avx2/; +add_proto qw/void ccso_filter_block_hbd_wo_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const int x, const int y, const int pic_width, const int pic_height, int *src_cls, const int8_t *offset_buf, const int scaled_ext_stride, const int dst_stride, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, const int blk_size, const bool isSingleBand, const uint8_t shift_bits, const int edge_clf, const uint8_t ccso_bo_only"; +specialize qw/ccso_filter_block_hbd_wo_buf avx2/; - if (aom_config("CONFIG_AV1_ENCODER") eq "yes") { - if (aom_config("CONFIG_CCSO_BO_ONLY_OPTION") eq "yes") { - add_proto qw/void ccso_filter_block_hbd_with_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const uint8_t *src_cls0, const uint8_t *src_cls1, - const int src_y_stride, const int dst_stride, - const int ccso_stride, - const int x, const int y, - const int pic_width, const int pic_height, - const int8_t *filter_offset, const int blk_size, - const int y_uv_hscale, const int y_uv_vscale, - const int max_val, const uint8_t shift_bits, - const uint8_t ccso_bo_only"; - } - else{ - add_proto qw/void ccso_filter_block_hbd_with_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const uint8_t *src_cls0, const uint8_t *src_cls1, - const int src_y_stride, const int dst_stride, - const int ccso_stride, - const int x, const int y, - const int pic_width, const int pic_height, - const int8_t *filter_offset, const int blk_size, - const int y_uv_hscale, const int y_uv_vscale, - const int max_val, const uint8_t shift_bits"; - } - specialize qw/ccso_filter_block_hbd_with_buf avx2/; +if (aom_config("CONFIG_AV1_ENCODER") eq "yes") { + add_proto qw/void ccso_filter_block_hbd_with_buf/, "const uint16_t *src_y, uint16_t *dst_yuv, const uint8_t *src_cls0, const uint8_t *src_cls1, + const int src_y_stride, const int dst_stride, + const int ccso_stride, + const int x, const int y, + const int pic_width, const int pic_height, + const int8_t *filter_offset, const int blk_size, + const int y_uv_hscale, const int y_uv_vscale, + const int max_val, const uint8_t shift_bits, + const uint8_t ccso_bo_only"; + specialize qw/ccso_filter_block_hbd_with_buf avx2/; - add_proto qw/uint64_t compute_distortion_block/, "const uint16_t *org, const int org_stride, - const uint16_t *rec16, const int rec_stride, const int x, const int y, - const int log2_filter_unit_size, const int height, - const int width"; - specialize qw/compute_distortion_block avx2/; + add_proto qw/uint64_t compute_distortion_block/, "const uint16_t *org, const int org_stride, + const uint16_t *rec16, const int rec_stride, const int x, const int y, + const int log2_filter_unit_size, const int height, + const int width"; + specialize qw/compute_distortion_block avx2/; - if (aom_config("CONFIG_CCSO_EDGE_CLF") eq "yes") { - add_proto qw/void ccso_derive_src_block/, "const uint16_t *src_y, uint8_t *const src_cls0, - uint8_t *const src_cls1, const int src_y_stride, const int ccso_stride, - const int x, const int y, const int pic_width, const int pic_height, - const int y_uv_hscale, const int y_uv_vscale, const int qstep, - const int neg_qstep, const int *src_loc, const int blk_size, const int edge_clf"; - } - else { - add_proto qw/void ccso_derive_src_block/, "const uint16_t *src_y, uint8_t *const src_cls0, - uint8_t *const src_cls1, const int src_y_stride, const int ccso_stride, - const int x, const int y, const int pic_width, const int pic_height, - const int y_uv_hscale, const int y_uv_vscale, const int qstep, - const int neg_qstep, const int *src_loc, const int blk_size"; - } - specialize qw/ccso_derive_src_block avx2/ - } - } + add_proto qw/void ccso_derive_src_block/, "const uint16_t *src_y, uint8_t *const src_cls0, + uint8_t *const src_cls1, const int src_y_stride, const int ccso_stride, + const int x, const int y, const int pic_width, const int pic_height, + const int y_uv_hscale, const int y_uv_vscale, const int qstep, + const int neg_qstep, const int *src_loc, const int blk_size, const int edge_clf"; + specialize qw/ccso_derive_src_block avx2/ } # Prediction enhancement filter
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index cb09f52..62f864a 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -670,16 +670,12 @@ int8_t cdef_strength : 4; /*! \brief chroma block info for sub-8x8 cases */ CHROMA_REF_INFO chroma_ref_info; -#if CONFIG_CCSO -#if CONFIG_CCSO_EXT /*! \brief Whether to use cross-component sample offset for the Y plane. */ uint8_t ccso_blk_y : 2; -#endif /*! \brief Whether to use cross-component sample offset for the U plane. */ uint8_t ccso_blk_u : 2; /*! \brief Whether to use cross-component sample offset for the V plane. */ uint8_t ccso_blk_v : 2; -#endif /**@}*/ #if CONFIG_RD_DEBUG @@ -2626,16 +2622,12 @@ * Enable IST for current coding block. */ uint8_t enable_ist; -#if CONFIG_CCSO -#if CONFIG_CCSO_EXT /** ccso blk y */ uint8_t ccso_blk_y; -#endif /** ccso blk u */ uint8_t ccso_blk_u; /** ccso blk v */ uint8_t ccso_blk_v; -#endif #if CONFIG_CONTEXT_DERIVATION /** buffer to store AOM_PLANE_U txfm coefficient signs */
diff --git a/av1/common/ccso.c b/av1/common/ccso.c index 7234347..e16fb2a 100644 --- a/av1/common/ccso.c +++ b/av1/common/ccso.c
@@ -47,15 +47,8 @@ * from the look-up table */ void cal_filter_support(int *rec_luma_idx, const uint16_t *rec_y, const uint8_t quant_step_size, const int inv_quant_step, - const int *rec_idx -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { -#if CONFIG_CCSO_EDGE_CLF + const int *rec_idx, const int edge_clf) { if (edge_clf == 0) { -#endif // CONFIG_CCSO_EDGE_CLF for (int i = 0; i < 2; i++) { int d = rec_y[rec_idx[i]] - rec_y[0]; if (d > quant_step_size) @@ -65,7 +58,6 @@ else rec_luma_idx[i] = 1; } -#if CONFIG_CCSO_EDGE_CLF } else { // if (edge_clf == 1) for (int i = 0; i < 2; i++) { int d = rec_y[rec_idx[i]] - rec_y[0]; @@ -75,7 +67,6 @@ rec_luma_idx[i] = 1; } } -#endif // CONFIG_CCSO_EDGE_CLF } /* Derive sample locations for CCSO */ @@ -112,48 +103,29 @@ } } -#if CONFIG_CCSO_EXT - void ccso_filter_block_hbd_wo_buf_c( const uint16_t *src_y, uint16_t *dst_yuv, const int x, const int y, const int pic_width, const int pic_height, int *src_cls, const int8_t *offset_buf, const int src_y_stride, const int dst_stride, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, - const int blk_size, const bool isSingleBand, const uint8_t shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { + const int blk_size, const bool isSingleBand, const uint8_t shift_bits, + const int edge_clf, const uint8_t ccso_bo_only) { const int y_end = AOMMIN(pic_height - y, blk_size); const int x_end = AOMMIN(pic_width - x, blk_size); for (int y_start = 0; y_start < y_end; y_start++) { const int y_pos = y_start; for (int x_start = 0; x_start < x_end; x_start++) { const int x_pos = x + x_start; -#if CONFIG_CCSO_BO_ONLY_OPTION if (!ccso_bo_only) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION cal_filter_support(src_cls, &src_y[(y_pos << y_uv_vscale) * src_y_stride + (x_pos << y_uv_hscale)], - thr, neg_thr, src_loc -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + thr, neg_thr, src_loc, edge_clf); } else { src_cls[0] = 0; src_cls[1] = 0; } -#endif // CONFIG_CCSO_BO_ONLY_OPTION const int band_num = isSingleBand ? 0 : src_y[(y_pos << y_uv_vscale) * src_y_stride + @@ -172,12 +144,8 @@ const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const uint8_t thr, const uint8_t filter_sup, - const uint8_t max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const uint8_t max_band_log2, + const int edge_clf) { const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_ext_stride = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); const int pic_height = xd->plane[plane].dst.height; @@ -200,36 +168,19 @@ (x >> blk_log2); const bool use_ccso = mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_y; if (!use_ccso) continue; -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { ccso_filter_block_hbd_wo_buf_c( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, 0, - 0, thr, neg_thr, src_loc, max_val, blk_size, false, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - , - cm->ccso_info.ccso_bo_only[plane]); + 0, thr, neg_thr, src_loc, max_val, blk_size, false, shift_bits, + edge_clf, cm->ccso_info.ccso_bo_only[plane]); } else { -#endif // CONFIG_CCSO_BO_ONLY_OPTION ccso_filter_block_hbd_wo_buf( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, 0, - 0, thr, neg_thr, src_loc, max_val, blk_size, false, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif // CONFIG_CCSO_BO_ONLY_OPTION - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + 0, thr, neg_thr, src_loc, max_val, blk_size, false, shift_bits, + edge_clf, 0); } -#endif // CONFIG_CCSO_BO_ONLY_OPTION } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_ext_stride << blk_log2); @@ -241,12 +192,8 @@ const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const uint8_t thr, const uint8_t filter_sup, - const uint8_t max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const uint8_t max_band_log2, + const int edge_clf) { (void)max_band_log2; const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_ext_stride = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); @@ -270,37 +217,19 @@ (x >> blk_log2); const bool use_ccso = mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_y; if (!use_ccso) continue; -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { ccso_filter_block_hbd_wo_buf_c( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, 0, - 0, thr, neg_thr, src_loc, max_val, blk_size, true, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - - , - cm->ccso_info.ccso_bo_only[plane]); + 0, thr, neg_thr, src_loc, max_val, blk_size, true, shift_bits, + edge_clf, cm->ccso_info.ccso_bo_only[plane]); } else { -#endif // CONFIG_CCSO_BO_ONLY_OPTION ccso_filter_block_hbd_wo_buf( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, 0, - 0, thr, neg_thr, src_loc, max_val, blk_size, true, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif // CONFIG_CCSO_BO_ONLY_OPTION - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + 0, thr, neg_thr, src_loc, max_val, blk_size, true, shift_bits, + edge_clf, 0); } -#endif // CONFIG_CCSO_BO_ONLY_OPTION } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_ext_stride << blk_log2); @@ -312,12 +241,8 @@ const int plane, const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const uint8_t thr, const uint8_t filter_sup, - const uint8_t max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const uint8_t max_band_log2, + const int edge_clf) { const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_ext_stride = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); const int pic_height = xd->plane[plane].dst.height; @@ -344,38 +269,19 @@ (plane == 1) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_u : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; if (!use_ccso) continue; -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { ccso_filter_block_hbd_wo_buf_c( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, blk_size, - false, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - , - cm->ccso_info.ccso_bo_only[plane]); + false, shift_bits, edge_clf, cm->ccso_info.ccso_bo_only[plane]); } else { -#endif // CONFIG_CCSO_BO_ONLY_OPTION ccso_filter_block_hbd_wo_buf( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, blk_size, - false, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif // CONFIG_CCSO_BO_ONLY_OPTION - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + false, shift_bits, edge_clf, 0); } -#endif // CONFIG_CCSO_BO_ONLY_OPTION } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_ext_stride << (blk_log2 + y_uv_vscale)); @@ -387,12 +293,8 @@ const int plane, const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const uint8_t thr, const uint8_t filter_sup, - const uint8_t max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const uint8_t max_band_log2, + const int edge_clf) { (void)max_band_log2; const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_ext_stride = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); @@ -420,177 +322,24 @@ (plane == 1) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_u : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; if (!use_ccso) continue; -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { ccso_filter_block_hbd_wo_buf_c( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, blk_size, - true, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - , - cm->ccso_info.ccso_bo_only[plane]); + true, shift_bits, edge_clf, cm->ccso_info.ccso_bo_only[plane]); } else { -#endif // CONFIG_CCSO_BO_ONLY_OPTION ccso_filter_block_hbd_wo_buf( src_y, dst_yuv, x, y, pic_width, pic_height, src_cls, cm->ccso_info.filter_offset[plane], ccso_ext_stride, dst_stride, y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, blk_size, - true, shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif // CONFIG_CCSO_BO_ONLY_OPTION - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + true, shift_bits, edge_clf, 0); } -#endif // CONFIG_CCSO_BO_ONLY_OPTION } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_ext_stride << (blk_log2 + y_uv_vscale)); } } -#endif // CONFIG_CCSO_EXT - -#if !CONFIG_CCSO_EXT -/* Apply CCSO for one filtering unit using c code (high bit-depth) */ -void ccso_filter_block_hbd_c( - const uint16_t *temp_rec_y_buf, uint16_t *rec_uv_16, const int x, - const int y, const int pic_width_c, const int pic_height_c, - int *rec_luma_idx, const int8_t *offset_buf, -#if CONFIG_CCSO_EXT - const int shift_bits, -#endif - const int *ccso_stride_idx, const int *dst_stride_idx, - const int y_uv_hori_scale, const int y_uv_vert_scale, const int pad_stride, - const int quant_step_size, const int inv_quant_step, const int *rec_idx, - const int maxval, const int filter_unit_size) { - int y_offset; - int x_offset; - if (y + filter_unit_size >= pic_height_c) - y_offset = pic_height_c - y; - else - y_offset = filter_unit_size; - - if (x + filter_unit_size >= pic_width_c) - x_offset = pic_width_c - x; - else - x_offset = filter_unit_size; - - for (int y_off = 0; y_off < y_offset; y_off++) { - for (int x_off = 0; x_off < x_offset; x_off++) { -#if CONFIG_CCSO_EXT - const int band_num = - temp_rec_y_buf[((ccso_stride_idx[y_off] << y_uv_vert_scale) + - ((x + x_off) << y_uv_hori_scale)) + - pad_stride] >> - shift_bits; -#endif - cal_filter_support( - rec_luma_idx, - &temp_rec_y_buf[((ccso_stride_idx[y_off] << y_uv_vert_scale) + - ((x + x_off) << y_uv_hori_scale)) + - pad_stride], - quant_step_size, inv_quant_step, rec_idx); - const int offset_val = offset_buf[ -#if CONFIG_CCSO_EXT - (band_num << 4) + -#endif - (rec_luma_idx[0] << 2) + rec_luma_idx[1]]; - rec_uv_16[dst_stride_idx[y_off] + x + x_off] = clamp( - offset_val + rec_uv_16[dst_stride_idx[y_off] + x + x_off], 0, maxval); - } - } -} - -/* Apply CCSO for one color component (high bit-depth) */ -void apply_ccso_filter_hbd(AV1_COMMON *cm, MACROBLOCKD *xd, const int plane, - const uint16_t *temp_rec_y_buf, uint16_t *rec_uv_16, - const int dst_stride, const int8_t *filter_offset, - const uint8_t quant_step_size, - const uint8_t ext_filter_support) { - const CommonModeInfoParams *const mi_params = &cm->mi_params; - const int ccso_stride_ext = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); - const int pic_height_c = xd->plane[plane].dst.height; - const int pic_width_c = xd->plane[plane].dst.width; - int rec_luma_idx[2]; - int inv_quant_step = quant_step_size * -1; - int rec_idx[2]; - const int maxval = (1 << cm->seq_params.bit_depth) - 1; -#if CONFIG_CCSO_EXT - const int shift_bits = - cm->seq_params.bit_depth - cm->ccso_info.max_band_log2[plane]; -#endif - derive_ccso_sample_pos(rec_idx, ccso_stride_ext, ext_filter_support); - - const int8_t *offset_buf; - if (filter_offset == NULL) { -#if CONFIG_CCSO_EXT - offset_buf = cm->ccso_info.filter_offset[plane]; -#else - offset_buf = cm->ccso_info.filter_offset[plane - 1]; -#endif - } else { - offset_buf = filter_offset; - } - const int log2_filter_unit_size = - plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int filter_unit_size = 1 << log2_filter_unit_size; - int ccso_stride_ext_idx[1 << (CCSO_BLK_SIZE + 1)]; - int dst_stride_idx[1 << (CCSO_BLK_SIZE + 1)]; - for (int i = 0; i < filter_unit_size; i++) { - ccso_stride_ext_idx[i] = ccso_stride_ext * i; - dst_stride_idx[i] = dst_stride * i; - } - const int pad_stride = - CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; - const int y_uv_hori_scale = xd->plane[plane].subsampling_x; - const int y_uv_vert_scale = xd->plane[plane].subsampling_y; - for (int y = 0; y < pic_height_c; y += filter_unit_size) { - for (int x = 0; x < pic_width_c; x += filter_unit_size) { - if (filter_offset == NULL) { - const int ccso_blk_idx = - (filter_unit_size >> - (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * - (y >> log2_filter_unit_size) * mi_params->mi_stride + - (filter_unit_size >> - (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * - (x >> log2_filter_unit_size); - - const bool use_ccso = - (plane == 1) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_u -#if CONFIG_CCSO_EXT - : (plane == 0) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_y - : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; -#else - : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; -#endif - if (!use_ccso) continue; - } - - ccso_filter_block_hbd(temp_rec_y_buf, rec_uv_16, x, y, pic_width_c, - pic_height_c, rec_luma_idx, offset_buf, -#if CONFIG_CCSO_EXT - shift_bits, -#endif - ccso_stride_ext_idx, dst_stride_idx, - y_uv_hori_scale, y_uv_vert_scale, pad_stride, - quant_step_size, inv_quant_step, rec_idx, maxval, - filter_unit_size); - } - temp_rec_y_buf += - (ccso_stride_ext << (log2_filter_unit_size + y_uv_vert_scale)); - rec_uv_16 += (dst_stride << log2_filter_unit_size); - } -} -#endif // !CONFIG_CCSO_EXT /* Apply CCSO for one frame */ void ccso_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd, @@ -599,7 +348,6 @@ av1_setup_dst_planes(xd->plane, frame, 0, 0, 0, num_planes, NULL); const uint8_t quant_sz[4] = { 16, 8, 32, 64 }; -#if CONFIG_CCSO_EXT for (int plane = 0; plane < num_planes; plane++) { const int dst_stride = xd->plane[plane].dst.stride; const uint8_t quant_step_size = quant_sz[cm->ccso_info.quant_idx[plane]]; @@ -613,23 +361,7 @@ apply_ccso_filter_func( cm, xd, plane, ext_rec_y, &(xd->plane[plane].dst.buf)[0], dst_stride, quant_step_size, cm->ccso_info.ext_filter_support[plane], - cm->ccso_info.max_band_log2[plane] -#if CONFIG_CCSO_EDGE_CLF - , - cm->ccso_info.edge_clf[plane] -#endif // CONFIG_CCSO_EDGE_CLF - ); + cm->ccso_info.max_band_log2[plane], cm->ccso_info.edge_clf[plane]); } -#else - for (int plane = 1; plane < 3; plane++) { - const int dst_stride = xd->plane[plane].dst.stride; - const uint8_t quant_step_size = - quant_sz[cm->ccso_info.quant_idx[plane - 1]]; - if (cm->ccso_info.ccso_enable[plane - 1]) { - apply_ccso_filter_hbd( - cm, xd, plane, ext_rec_y, &(xd->plane[plane].dst.buf)[0], dst_stride, - NULL, quant_step_size, cm->ccso_info.ext_filter_support[plane - 1]); - } -#endif } }
diff --git a/av1/common/ccso.h b/av1/common/ccso.h index 1486bd6..2e24ee7 100644 --- a/av1/common/ccso.h +++ b/av1/common/ccso.h
@@ -24,9 +24,7 @@ #include "aom_ports/mem.h" #include "av1/common/av1_common_int.h" -#if CONFIG_CCSO_EDGE_CLF static const int edge_clf_to_edge_interval[2] = { 3, 2 }; -#endif // CONFIG_CCSO_EDGE_CLF #ifdef __cplusplus extern "C" { @@ -36,36 +34,18 @@ void cal_filter_support(int *rec_luma_idx, const uint16_t *rec_y, const uint8_t quant_step_size, const int inv_quant_step, - const int *rec_idx -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -); -#if CONFIG_CCSO_EXT + const int *rec_idx, const int edge_clf); + void derive_ccso_sample_pos(int *rec_idx, const int ccso_stride, const uint8_t ext_filter_support); -#else -void apply_ccso_filter_hbd(AV1_COMMON *cm, MACROBLOCKD *xd, const int plane, - const uint16_t *temp_rec_y_buf, uint16_t *rec_uv_16, - const int dst_stride, const int8_t *filter_offset, - const uint8_t quant_step_size, - const uint8_t ext_filter_support); -#endif // CONFIG_CCSO_EXT -#if CONFIG_CCSO_EXT /* Apply CCSO on one color component */ typedef void (*CCSO_FILTER_FUNC)(AV1_COMMON *cm, MACROBLOCKD *xd, const int plane, const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const uint8_t thr, const uint8_t filter_sup, - const uint8_t max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -); -#endif // CONFIG_CCSO_EXT + const uint8_t max_band_log2, + const int edge_clf); void ccso_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd, uint16_t *ext_rec_y);
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index 9879ca0..b9a003b 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -345,11 +345,9 @@ RESET_CDF_COUNTER(fc->filter_intra_mode_cdf, FILTER_INTRA_MODES); RESET_CDF_COUNTER(fc->switchable_flex_restore_cdf, 2); RESET_CDF_COUNTER(fc->wiener_restore_cdf, 2); -#if CONFIG_CCSO_EXT for (int plane = 0; plane < MAX_MB_PLANE; plane++) { RESET_CDF_COUNTER(fc->ccso_cdf[plane], 2); } -#endif RESET_CDF_COUNTER(fc->sgrproj_restore_cdf, 2); RESET_CDF_COUNTER(fc->wienerns_restore_cdf, 2); RESET_CDF_COUNTER(fc->wienerns_length_cdf, 2);
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index a204c62..bbb2868 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -7368,7 +7368,6 @@ 11570) }; #endif // CONFIG_ENTROPY_PARA -#if CONFIG_CCSO_EXT #if CONFIG_ENTROPY_PARA static const aom_cdf_prob default_ccso_cdf[3][CDF_SIZE(2)] = { { AOM_CDF2(12979), 37 }, @@ -7378,7 +7377,6 @@ #else static const aom_cdf_prob default_ccso_cdf[CDF_SIZE(2)] = { AOM_CDF2(11570) }; #endif // CONFIG_ENTROPY_PARA -#endif #if CONFIG_ENTROPY_PARA static const aom_cdf_prob default_sgrproj_restore_cdf[CDF_SIZE(2)] = { @@ -8065,7 +8063,6 @@ av1_copy(fc->switchable_flex_restore_cdf, default_switchable_flex_restore_cdf); av1_copy(fc->wiener_restore_cdf, default_wiener_restore_cdf); -#if CONFIG_CCSO_EXT for (int plane = 0; plane < MAX_MB_PLANE; plane++) { #if CONFIG_ENTROPY_PARA av1_copy(fc->ccso_cdf[plane], default_ccso_cdf[plane]); @@ -8073,7 +8070,6 @@ av1_copy(fc->ccso_cdf[plane], default_ccso_cdf); #endif // CONFIG_ENTROPY_PARA } -#endif av1_copy(fc->sgrproj_restore_cdf, default_sgrproj_restore_cdf); av1_copy(fc->wienerns_restore_cdf, default_wienerns_restore_cdf); av1_copy(fc->wienerns_length_cdf, default_wienerns_length_cdf);
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 4e34c93..0b3b24d 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -443,9 +443,7 @@ aom_cdf_prob switchable_flex_restore_cdf[MAX_LR_FLEX_SWITCHABLE_BITS] [MAX_LR_FLEX_MB_PLANE][CDF_SIZE(2)]; aom_cdf_prob wiener_restore_cdf[CDF_SIZE(2)]; -#if CONFIG_CCSO_EXT aom_cdf_prob ccso_cdf[3][CDF_SIZE(2)]; -#endif aom_cdf_prob sgrproj_restore_cdf[CDF_SIZE(2)]; aom_cdf_prob wienerns_restore_cdf[CDF_SIZE(2)]; aom_cdf_prob wienerns_length_cdf[2][CDF_SIZE(2)];
diff --git a/av1/common/enums.h b/av1/common/enums.h index b3015bf..b4c96b6 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h
@@ -97,21 +97,10 @@ #endif // CONFIG_IBP_WEIGHT // Cross-Component Sample Offset (CCSO) -#if CONFIG_CCSO #define CCSO_BLK_SIZE 7 #define CCSO_PADDING_SIZE 5 -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION #define CCSO_BAND_NUM 128 -#else -#define CCSO_BAND_NUM 8 -#endif #define CCSO_NUM_COMPONENTS 3 -#else -#define CCSO_BAND_NUM 1 -#define CCSO_NUM_COMPONENTS 2 -#endif -#endif #define BUGFIX_AMVD_AMVR 1 // Supported scale modes for JOINT_NEWMV
diff --git a/av1/common/x86/highbd_ccso_avx2.c b/av1/common/x86/highbd_ccso_avx2.c index bdc9a52..dffc9fa 100644 --- a/av1/common/x86/highbd_ccso_avx2.c +++ b/av1/common/x86/highbd_ccso_avx2.c
@@ -15,7 +15,6 @@ #include "av1/common/ccso.h" -#if CONFIG_CCSO_EDGE_CLF __m256i cal_filter_support_edge0_avx2(__m256i d, __m256i cmp_thr1, __m256i cmp_thr2, __m256i all1, __m256i cmp_idxa, __m256i cmp_idxb, @@ -42,7 +41,6 @@ __m256i idx = _mm256_add_epi16(idx_mask1a, idx_mask1b); return idx; } -#endif // CONFIG_CCSO_EDGE_CLF void ccso_filter_block_hbd_wo_buf_avx2( const uint16_t *src_y, uint16_t *dts_yuv, const int x, const int y, @@ -54,20 +52,9 @@ // const int pad_stride, no pad size anymore const int quant_step_size, const int inv_quant_step, const int *rec_idx, const int max_val, const int blk_size, const bool isSingleBand, - const uint8_t shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { -#if CONFIG_CCSO_BO_ONLY_OPTION + const uint8_t shift_bits, const int edge_clf, const uint8_t ccso_bo_only) { assert(ccso_bo_only == 0); (void)ccso_bo_only; -#endif // CONFIG_CCSO_BO_ONLY_OPTION __m256i cmp_thr1 = _mm256_set1_epi16(quant_step_size); __m256i cmp_thr2 = _mm256_set1_epi16(inv_quant_step); __m256i cmp_idxa = _mm256_set1_epi16(2); // d > quant_step_size @@ -178,8 +165,6 @@ rec_cur_final = rec_curlo; } __m256i dst_rec = _mm256_loadu_si256((const __m256i *)(dst_rec2 + xOff)); - -#if CONFIG_CCSO_EDGE_CLF __m256i idx1, idx2; if (edge_clf == 0) { idx1 = cal_filter_support_edge0_avx2(d1, cmp_thr1, cmp_thr2, all1, @@ -192,29 +177,6 @@ idx2 = cal_filter_support_edge1_avx2(d2, cmp_thr2, all1, cmp_idxb, cmp_idxc); } -#else - __m256i idx_mask1a = _mm256_cmpgt_epi16(d1, cmp_thr1); - __m256i idx_mask1b = _mm256_cmpgt_epi16(cmp_thr2, d1); - __m256i idx_mask1c = _mm256_xor_si256(idx_mask1a, idx_mask1b); - idx_mask1c = _mm256_xor_si256(idx_mask1c, all1); - idx_mask1a = _mm256_and_si256(idx_mask1a, cmp_idxa); - idx_mask1b = _mm256_and_si256(idx_mask1b, cmp_idxb); - idx_mask1c = _mm256_and_si256(idx_mask1c, cmp_idxc); - - __m256i idx1 = _mm256_add_epi16(idx_mask1a, idx_mask1b); - idx1 = _mm256_add_epi16(idx1, idx_mask1c); - - __m256i idx_mask2a = _mm256_cmpgt_epi16(d2, cmp_thr1); - __m256i idx_mask2b = _mm256_cmpgt_epi16(cmp_thr2, d2); - __m256i idx_mask2c = _mm256_xor_si256(idx_mask2a, idx_mask2b); - idx_mask2c = _mm256_xor_si256(idx_mask2c, all1); - idx_mask2a = _mm256_and_si256(idx_mask2a, cmp_idxa); - idx_mask2b = _mm256_and_si256(idx_mask2b, cmp_idxb); - idx_mask2c = _mm256_and_si256(idx_mask2c, cmp_idxc); - - __m256i idx2 = _mm256_add_epi16(idx_mask2a, idx_mask2b); - idx2 = _mm256_add_epi16(idx2, idx_mask2c); -#endif // CONFIG_CCSO_EDGE_CLF __m256i offset; // const int band_num = src_y[x_pos] >> shift_bits; @@ -262,12 +224,7 @@ cal_filter_support(rec_luma_idx, &src_y[((yOff << y_uv_vscale) * src_y_stride + ((x + xOff) << y_uv_hscale))], - quant_step_size, inv_quant_step, rec_idx -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); + quant_step_size, inv_quant_step, rec_idx, edge_clf); const int band_num = isSingleBand ? 0 : src_y[((yOff << y_uv_vscale) * src_y_stride + @@ -288,12 +245,8 @@ const int pic_width, const int pic_height, const int y_uv_hscale, const int y_uv_vscale, const int qstep, const int neg_qstep, - const int *src_loc, const int blk_size -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const int *src_loc, const int blk_size, + const int edge_clf) { const int quant_step_size = qstep; const int inv_quant_step = neg_qstep; __m256i cmp_thr1 = _mm256_set1_epi16(quant_step_size); @@ -405,7 +358,6 @@ d2 = _mm256_sub_epi16(rec_tap2lo, rec_curlo); } -#if CONFIG_CCSO_EDGE_CLF __m256i idx1, idx2; if (edge_clf == 0) { idx1 = cal_filter_support_edge0_avx2(d1, cmp_thr1, cmp_thr2, all1, @@ -418,29 +370,6 @@ idx2 = cal_filter_support_edge1_avx2(d2, cmp_thr2, all1, cmp_idxb, cmp_idxc); } -#else - __m256i idx_mask1a = _mm256_cmpgt_epi16(d1, cmp_thr1); - __m256i idx_mask1b = _mm256_cmpgt_epi16(cmp_thr2, d1); - __m256i idx_mask1c = _mm256_xor_si256(idx_mask1a, idx_mask1b); - idx_mask1c = _mm256_xor_si256(idx_mask1c, all1); - idx_mask1a = _mm256_and_si256(idx_mask1a, cmp_idxa); - idx_mask1b = _mm256_and_si256(idx_mask1b, cmp_idxb); - idx_mask1c = _mm256_and_si256(idx_mask1c, cmp_idxc); - - __m256i idx1 = _mm256_add_epi16(idx_mask1a, idx_mask1b); - idx1 = _mm256_add_epi16(idx1, idx_mask1c); - - __m256i idx_mask2a = _mm256_cmpgt_epi16(d2, cmp_thr1); - __m256i idx_mask2b = _mm256_cmpgt_epi16(cmp_thr2, d2); - __m256i idx_mask2c = _mm256_xor_si256(idx_mask2a, idx_mask2b); - idx_mask2c = _mm256_xor_si256(idx_mask2c, all1); - idx_mask2a = _mm256_and_si256(idx_mask2a, cmp_idxa); - idx_mask2b = _mm256_and_si256(idx_mask2b, cmp_idxb); - idx_mask2c = _mm256_and_si256(idx_mask2c, cmp_idxc); - - __m256i idx2 = _mm256_add_epi16(idx_mask2a, idx_mask2b); - idx2 = _mm256_add_epi16(idx2, idx_mask2c); -#endif // CONFIG_CCSO_EDGE_CLF idx1 = _mm256_packs_epi16(idx1, idx1); idx1 = _mm256_permutevar8x32_epi32(idx1, masksub2); @@ -479,12 +408,7 @@ cal_filter_support(src_cls, &src_y[((yOff << y_uv_vscale) * src_y_stride + ((x + xOff) << y_uv_hscale))], - quant_step_size, inv_quant_step, src_loc -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); + quant_step_size, inv_quant_step, src_loc, edge_clf); src_cls0[(yOff << y_uv_vscale) * ccso_stride + ((x + xOff) << y_uv_hscale)] = src_cls[0]; src_cls1[(yOff << y_uv_vscale) * ccso_stride + @@ -499,15 +423,8 @@ const int ccso_stride, const int x, const int y, const int pic_width, const int pic_height, const int8_t *filter_offset, const int blk_size, const int y_uv_hscale, const int y_uv_vscale, const int max_val, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { -#if CONFIG_CCSO_BO_ONLY_OPTION + const uint8_t shift_bits, const uint8_t ccso_bo_only) { (void)ccso_bo_only; -#endif // CONFIG_CCSO_BO_ONLY_OPTION __m256i all0 = _mm256_set1_epi16(0); __m256i allmax = _mm256_set1_epi16(((short)max_val)); __m128i shufsub =
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 83921ea..2c40293 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -40,9 +40,7 @@ #include "av1/common/alloccommon.h" #include "av1/common/cdef.h" -#if CONFIG_CCSO #include "av1/common/ccso.h" -#endif #include "av1/common/cfl.h" #if CONFIG_INSPECTION #include "av1/decoder/inspection.h" @@ -3625,8 +3623,6 @@ } } -#if CONFIG_CCSO -#if CONFIG_CCSO_EDGE_CLF // read offset idx using truncated unary coding static AOM_INLINE int read_ccso_offset_idx(struct aom_read_bit_buffer *rb) { int offset_idx = 0; @@ -3637,32 +3633,22 @@ } return offset_idx; } -#endif // CONFIG_CCSO_EDGE_CLF static AOM_INLINE void setup_ccso(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) { if (is_global_intrabc_allowed(cm)) return; -#if CONFIG_CCSO_EXT const int ccso_offset[8] = { 0, 1, -1, 3, -3, 7, -7, -10 }; #if CONFIG_D143_CCSO_FM_FLAG cm->ccso_info.ccso_frame_flag = aom_rb_read_literal(rb, 1); if (cm->ccso_info.ccso_frame_flag) { #endif // CONFIG_D143_CCSO_FM_FLAG for (int plane = 0; plane < av1_num_planes(cm); plane++) { -#else - const int ccso_offset[8] = { 0, 1, -1, 3, -3, 5, -5, -7 }; - for (int plane = 0; plane < 2; plane++) { -#endif cm->ccso_info.ccso_enable[plane] = aom_rb_read_literal(rb, 1); if (cm->ccso_info.ccso_enable[plane]) { -#if CONFIG_CCSO_BO_ONLY_OPTION cm->ccso_info.ccso_bo_only[plane] = aom_rb_read_literal(rb, 1); -#endif // CONFIG_CCSO_BO_ONLY_OPTION #if !CONFIG_CCSO_SIGFIX cm->ccso_info.quant_idx[plane] = aom_rb_read_literal(rb, 2); cm->ccso_info.ext_filter_support[plane] = aom_rb_read_literal(rb, 3); #endif // !CONFIG_CCSO_SIGFIX -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { #if CONFIG_CCSO_SIGFIX cm->ccso_info.quant_idx[plane] = 0; @@ -3678,60 +3664,34 @@ #endif // CONFIG_CCSO_SIGFIX cm->ccso_info.max_band_log2[plane] = aom_rb_read_literal(rb, 2); } -#else - cm->ccso_info.max_band_log2[plane] = aom_rb_read_literal(rb, 2); -#endif // CONFIG_CCSO_BO_ONLY_OPTION const int max_band = 1 << cm->ccso_info.max_band_log2[plane]; -#endif -#if CONFIG_CCSO_EDGE_CLF #if !CONFIG_CCSO_SIGFIX cm->ccso_info.edge_clf[plane] = aom_rb_read_bit(rb); #endif // !CONFIG_CCSO_SIGFIX const int edge_clf = cm->ccso_info.edge_clf[plane]; const int max_edge_interval = edge_clf_to_edge_interval[edge_clf]; -#if CONFIG_CCSO_BO_ONLY_OPTION const int num_edge_offset_intervals = cm->ccso_info.ccso_bo_only[plane] ? 1 : max_edge_interval; for (int d0 = 0; d0 < num_edge_offset_intervals; d0++) { for (int d1 = 0; d1 < num_edge_offset_intervals; d1++) { -#else - for (int d0 = 0; d0 < max_edge_interval; d0++) { - for (int d1 = 0; d1 < max_edge_interval; d1++) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION -#else - for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { - for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { -#endif // CONFIG_CCSO_EDGE_CLF -#if !CONFIG_CCSO_EXT - const int lut_idx_ext = (d0 << 2) + d1; -#else - for (int band_num = 0; band_num < max_band; band_num++) { - const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; -#endif -#if CONFIG_CCSO_EDGE_CLF - const int offset_idx = read_ccso_offset_idx(rb); -#else - const int offset_idx = aom_rb_read_literal(rb, 3); -#endif // CONFIG_CCSO_EDGE_CLF - cm->ccso_info.filter_offset[plane][lut_idx_ext] = - ccso_offset[offset_idx]; + for (int band_num = 0; band_num < max_band; band_num++) { + const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; + const int offset_idx = read_ccso_offset_idx(rb); + cm->ccso_info.filter_offset[plane][lut_idx_ext] = + ccso_offset[offset_idx]; + } } -#if CONFIG_CCSO_EXT } -#endif } } - } #if CONFIG_D143_CCSO_FM_FLAG -} -else { - cm->ccso_info.ccso_enable[0] = 0; - cm->ccso_info.ccso_enable[1] = 0; - cm->ccso_info.ccso_enable[2] = 0; -} + } else { + cm->ccso_info.ccso_enable[0] = 0; + cm->ccso_info.ccso_enable[1] = 0; + cm->ccso_info.ccso_enable[2] = 0; + } #endif // CONFIG_D143_CCSO_FM_FLAG } -#endif static INLINE int read_delta_q(struct aom_read_bit_buffer *rb) { return aom_rb_read_bit(rb) ? aom_rb_read_inv_signed_literal(rb, 6) : 0; @@ -5597,7 +5557,7 @@ #if CONFIG_THROUGHPUT_ANALYSIS aom_accounting_cal_total(pbi); #else - aom_accounting_dump(&pbi->accounting); + aom_accounting_dump(&pbi->accounting); #endif // CONFIG_THROUGHPUT_ANALYSIS aom_accounting_reset(&pbi->accounting); } @@ -6504,9 +6464,7 @@ seq_params->enable_imp_msk_bld = aom_rb_read_bit(rb); #endif // CONFIG_D071_IMP_MSK_BLD seq_params->enable_fsc = aom_rb_read_bit(rb); -#if CONFIG_CCSO seq_params->enable_ccso = aom_rb_read_bit(rb); -#endif seq_params->enable_pef = aom_rb_read_bit(rb); #if CONFIG_LF_SUB_PU seq_params->enable_lf_sub_pu = aom_rb_read_bit(rb); @@ -6516,7 +6474,7 @@ #if CONFIG_LF_SUB_PU seq_params->enable_lf_sub_pu #else - seq_params->enable_pef + seq_params->enable_pef #endif // CONFIG_LF_SUB_PU ) { seq_params->enable_tip_explicit_qp = aom_rb_read_bit(rb); @@ -6695,8 +6653,8 @@ const int our_ref_order_hint = buf->display_order_hint; const int their_ref_order_hint = buf->ref_display_order_hint[their_ref]; #else - const int our_ref_order_hint = buf->order_hint; - const int their_ref_order_hint = buf->ref_order_hints[their_ref]; + const int our_ref_order_hint = buf->order_hint; + const int their_ref_order_hint = buf->ref_order_hints[their_ref]; #endif // CONFIG_EXPLICIT_TEMPORAL_DIST_CALC cm->base_global_motion_model = buf->global_motion[their_ref]; cm->base_global_motion_distance = @@ -6715,8 +6673,8 @@ const int ref_order_hint = ref_buf->display_order_hint; const int cur_order_hint = cm->cur_frame->display_order_hint; #else - const int ref_order_hint = ref_buf->order_hint; - const int cur_order_hint = cm->cur_frame->order_hint; + const int ref_order_hint = ref_buf->order_hint; + const int cur_order_hint = cm->cur_frame->order_hint; #endif // CONFIG_EXPLICIT_TEMPORAL_DIST_CALC temporal_distance = get_relative_dist(&seq_params->order_hint_info, cur_order_hint, ref_order_hint); @@ -8020,11 +7978,9 @@ if (!features->all_lossless && seq_params->enable_restoration) { decode_restoration_mode(cm, rb); } -#if CONFIG_CCSO if (!features->coded_lossless && seq_params->enable_ccso) { setup_ccso(cm, rb); } -#endif if (features->coded_lossless || !cm->seq_params.enable_parity_hiding) features->allow_parity_hiding = false; @@ -8368,14 +8324,10 @@ } } -#if CONFIG_CCSO const int use_ccso = !pbi->skip_loop_filter && !cm->features.coded_lossless && - (cm->ccso_info.ccso_enable[0] || cm->ccso_info.ccso_enable[1] -#if CONFIG_CCSO_EXT - || cm->ccso_info.ccso_enable[2] -#endif - ); + (cm->ccso_info.ccso_enable[0] || cm->ccso_info.ccso_enable[1] || + cm->ccso_info.ccso_enable[2]); uint16_t *ext_rec_y; if (use_ccso) { av1_setup_dst_planes(xd->plane, &cm->cur_frame->buf, 0, 0, 0, num_planes, @@ -8390,33 +8342,20 @@ int pic_height = xd->plane[pli].dst.height; int pic_width = xd->plane[pli].dst.width; const int dst_stride = xd->plane[pli].dst.stride; -#if CONFIG_CCSO_EXT ext_rec_y += CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; -#endif for (int r = 0; r < pic_height; ++r) { for (int c = 0; c < pic_width; ++c) { -#if CONFIG_CCSO_EXT ext_rec_y[c] = xd->plane[pli].dst.buf[c]; -#else - ext_rec_y[(r + CCSO_PADDING_SIZE) * ccso_stride_ext + c + - CCSO_PADDING_SIZE] = - xd->plane[pli].dst.buf[r * dst_stride + c]; -#endif } -#if CONFIG_CCSO_EXT ext_rec_y += ccso_stride_ext; xd->plane[0].dst.buf += dst_stride; } ext_rec_y -= CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; ext_rec_y -= pic_height * ccso_stride_ext; xd->plane[0].dst.buf -= pic_height * ccso_stride_ext; -#else - } -#endif } extend_ccso_border(ext_rec_y, CCSO_PADDING_SIZE, xd); } -#endif const int do_loop_restoration = cm->rst_info[0].frame_restoration_type != RESTORE_NONE || @@ -8434,10 +8373,7 @@ const int do_superres = av1_superres_scaled(cm); const int optimized_loop_restoration = -#if CONFIG_CCSO - !use_ccso && -#endif - !do_cdef && !do_superres; + !use_ccso && !do_cdef && !do_superres; if (!optimized_loop_restoration) { if (do_loop_restoration) @@ -8448,12 +8384,10 @@ av1_cdef_frame(&pbi->common.cur_frame->buf, cm, &pbi->dcb.xd); } -#if CONFIG_CCSO if (use_ccso) { ccso_frame(&cm->cur_frame->buf, cm, xd, ext_rec_y); aom_free(ext_rec_y); } -#endif superres_post_decode(pbi);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 69589e6..f4ec8ab 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -90,7 +90,6 @@ } } -#if CONFIG_CCSO static void read_ccso(AV1_COMMON *cm, aom_reader *r, MACROBLOCKD *const xd) { if (cm->features.coded_lossless) return; if (is_global_intrabc_allowed(cm)) return; @@ -102,7 +101,6 @@ const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; -#if CONFIG_CCSO_EXT if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && cm->ccso_info.ccso_enable[0]) { const int blk_idc = @@ -113,17 +111,11 @@ (mi_col & ~blk_size_x)] ->ccso_blk_y = blk_idc; } -#endif if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && -#if CONFIG_CCSO_EXT cm->ccso_info.ccso_enable[1]) { const int blk_idc = aom_read_symbol(r, xd->tile_ctx->ccso_cdf[1], 2, ACCT_INFO("blk_idc")); -#else - cm->ccso_info.ccso_enable[0]) { - const int blk_idc = aom_read_bit(r, ACCT_INFO("blk_idc")); -#endif xd->ccso_blk_u = blk_idc; mi_params ->mi_grid_base[(mi_row & ~blk_size_y) * mi_params->mi_stride + @@ -132,14 +124,9 @@ } if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && -#if CONFIG_CCSO_EXT cm->ccso_info.ccso_enable[2]) { const int blk_idc = aom_read_symbol(r, xd->tile_ctx->ccso_cdf[2], 2, ACCT_INFO("blk_idc")); -#else - cm->ccso_info.ccso_enable[1]) { - const int blk_idc = aom_read_bit(r, ACCT_INFO("blk_idc")); -#endif xd->ccso_blk_v = blk_idc; mi_params ->mi_grid_base[(mi_row & ~blk_size_y) * mi_params->mi_stride + @@ -147,7 +134,6 @@ ->ccso_blk_v = blk_idc; } } -#endif static int read_delta_qindex(AV1_COMMON *cm, const MACROBLOCKD *xd, aom_reader *r, MB_MODE_INFO *const mbmi) { @@ -2018,16 +2004,8 @@ if (xd->tree_type != CHROMA_PART) read_cdef(cm, r, xd); -#if CONFIG_CCSO - if (cm->seq_params.enable_ccso -#if CONFIG_CCSO_EXT - && xd->tree_type != CHROMA_PART -#else - && xd->tree_type != LUMA_PART -#endif - ) + if (cm->seq_params.enable_ccso && xd->tree_type != CHROMA_PART) read_ccso(cm, r, xd); -#endif read_delta_q_params(cm, xd, r); @@ -4509,9 +4487,7 @@ read_cdef(cm, r, xd); -#if CONFIG_CCSO if (cm->seq_params.enable_ccso) read_ccso(cm, r, xd); -#endif read_delta_q_params(cm, xd, r);
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 2b30928..8fde4d8 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -34,9 +34,7 @@ #include "av1/common/blockd.h" #include "av1/common/cdef.h" -#if CONFIG_CCSO #include "av1/common/ccso.h" -#endif #include "av1/common/cfl.h" #include "av1/common/entropy.h" #include "av1/common/entropymode.h" @@ -1892,7 +1890,6 @@ } } -#if CONFIG_CCSO static AOM_INLINE void write_ccso(AV1_COMMON *cm, MACROBLOCKD *const xd, aom_writer *w) { if (cm->features.coded_lossless) return; @@ -1908,40 +1905,27 @@ mi_params->mi_grid_base[(mi_row & ~blk_size_y) * mi_params->mi_stride + (mi_col & ~blk_size_x)]; -#if CONFIG_CCSO_EXT if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && cm->ccso_info.ccso_enable[0]) { aom_write_symbol(w, mbmi->ccso_blk_y == 0 ? 0 : 1, xd->tile_ctx->ccso_cdf[0], 2); xd->ccso_blk_y = mbmi->ccso_blk_y; } -#endif if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && -#if CONFIG_CCSO_EXT cm->ccso_info.ccso_enable[1]) { aom_write_symbol(w, mbmi->ccso_blk_u == 0 ? 0 : 1, xd->tile_ctx->ccso_cdf[1], 2); -#else - cm->ccso_info.ccso_enable[0]) { - aom_write_bit(w, mbmi->ccso_blk_u == 0 ? 0 : 1); -#endif xd->ccso_blk_u = mbmi->ccso_blk_u; } if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && -#if CONFIG_CCSO_EXT cm->ccso_info.ccso_enable[2]) { aom_write_symbol(w, mbmi->ccso_blk_v == 0 ? 0 : 1, xd->tile_ctx->ccso_cdf[2], 2); -#else - cm->ccso_info.ccso_enable[1]) { - aom_write_bit(w, mbmi->ccso_blk_v == 0 ? 0 : 1); -#endif xd->ccso_blk_v = mbmi->ccso_blk_v; } } -#endif static AOM_INLINE void write_inter_segment_id( AV1_COMP *cpi, aom_writer *w, const struct segmentation *const seg, @@ -2460,9 +2444,7 @@ write_cdef(cm, xd, w, skip); -#if CONFIG_CCSO if (cm->seq_params.enable_ccso) write_ccso(cm, xd, w); -#endif write_delta_q_params(cpi, skip, w); @@ -3153,16 +3135,8 @@ if (xd->tree_type != CHROMA_PART) write_cdef(cm, xd, w, skip); -#if CONFIG_CCSO - if (cm->seq_params.enable_ccso -#if CONFIG_CCSO_EXT - && xd->tree_type != CHROMA_PART -#else - && xd->tree_type != LUMA_PART -#endif - ) + if (cm->seq_params.enable_ccso && xd->tree_type != CHROMA_PART) write_ccso(cm, xd, w); -#endif write_delta_q_params(cpi, skip, w); if (av1_allow_intrabc(cm, xd @@ -4796,8 +4770,6 @@ } } -#if CONFIG_CCSO -#if CONFIG_CCSO_EDGE_CLF // write CCSO offset idx using truncated unary coding static AOM_INLINE void write_ccso_offset_idx(struct aom_write_bit_buffer *wb, int offset_idx) { @@ -4806,32 +4778,22 @@ if (offset_idx == idx) break; } } -#endif // CONFIG_CCSO_EDGE_CLF static AOM_INLINE void encode_ccso(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) { if (is_global_intrabc_allowed(cm)) return; -#if CONFIG_CCSO_EXT const int ccso_offset[8] = { 0, 1, -1, 3, -3, 7, -7, -10 }; #if CONFIG_D143_CCSO_FM_FLAG aom_wb_write_literal(wb, cm->ccso_info.ccso_frame_flag, 1); if (cm->ccso_info.ccso_frame_flag) { #endif // CONFIG_D143_CCSO_FM_FLAG for (int plane = 0; plane < av1_num_planes(cm); plane++) { -#else - const int ccso_offset[8] = { 0, 1, -1, 3, -3, 5, -5, -7 }; - for (int plane = 0; plane < 2; plane++) { -#endif aom_wb_write_literal(wb, cm->ccso_info.ccso_enable[plane], 1); if (cm->ccso_info.ccso_enable[plane]) { -#if CONFIG_CCSO_BO_ONLY_OPTION aom_wb_write_literal(wb, cm->ccso_info.ccso_bo_only[plane], 1); -#endif // CONFIG_CCSO_BO_ONLY_OPTION #if !CONFIG_CCSO_SIGFIX aom_wb_write_literal(wb, cm->ccso_info.quant_idx[plane], 2); aom_wb_write_literal(wb, cm->ccso_info.ext_filter_support[plane], 3); #endif // !CONFIG_CCSO_SIGFIX -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION if (cm->ccso_info.ccso_bo_only[plane]) { aom_wb_write_literal(wb, cm->ccso_info.max_band_log2[plane], 3); } else { @@ -4842,59 +4804,34 @@ #endif // CONFIG_CCSO_SIGFIX aom_wb_write_literal(wb, cm->ccso_info.max_band_log2[plane], 2); } -#else - aom_wb_write_literal(wb, cm->ccso_info.max_band_log2[plane], 2); -#endif // CONFIG_CCSO_BO_ONLY_OPTION const int max_band = 1 << cm->ccso_info.max_band_log2[plane]; -#endif -#if CONFIG_CCSO_EDGE_CLF const int edge_clf = cm->ccso_info.edge_clf[plane]; #if !CONFIG_CCSO_SIGFIX aom_wb_write_bit(wb, edge_clf); #endif // !CONFIG_CCSO_SIGFIX const int max_edge_interval = edge_clf_to_edge_interval[edge_clf]; -#if CONFIG_CCSO_BO_ONLY_OPTION const int num_edge_offset_intervals = cm->ccso_info.ccso_bo_only[plane] ? 1 : max_edge_interval; for (int d0 = 0; d0 < num_edge_offset_intervals; d0++) { for (int d1 = 0; d1 < num_edge_offset_intervals; d1++) { -#else - for (int d0 = 0; d0 < max_edge_interval; d0++) { - for (int d1 = 0; d1 < max_edge_interval; d1++) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION -#else - for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { - for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { -#endif // CONFIG_CCSO_EDGE_CLF -#if !CONFIG_CCSO_EXT - const int lut_idx_ext = (d0 << 2) + d1; -#else - for (int band_num = 0; band_num < max_band; band_num++) { - const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; -#endif - for (int offset_idx = 0; offset_idx < 8; offset_idx++) { - if (cm->ccso_info.filter_offset[plane][lut_idx_ext] == - ccso_offset[offset_idx]) { -#if CONFIG_CCSO_EDGE_CLF - write_ccso_offset_idx(wb, offset_idx); -#else - aom_wb_write_literal(wb, offset_idx, 3); -#endif // CONFIG_CCSO_EDGE_CLF - break; + for (int band_num = 0; band_num < max_band; band_num++) { + const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; + for (int offset_idx = 0; offset_idx < 8; offset_idx++) { + if (cm->ccso_info.filter_offset[plane][lut_idx_ext] == + ccso_offset[offset_idx]) { + write_ccso_offset_idx(wb, offset_idx); + break; + } } } -#if CONFIG_CCSO_EXT } -#endif } } } - } #if CONFIG_D143_CCSO_FM_FLAG -} + } #endif // CONFIG_D143_CCSO_FM_FLAG } -#endif static AOM_INLINE void write_delta_q(struct aom_write_bit_buffer *wb, int delta_q) { @@ -5609,9 +5546,7 @@ aom_wb_write_bit(wb, seq_params->enable_imp_msk_bld); #endif // CONFIG_D071_IMP_MSK_BLD aom_wb_write_bit(wb, seq_params->enable_fsc); -#if CONFIG_CCSO aom_wb_write_bit(wb, seq_params->enable_ccso); -#endif aom_wb_write_bit(wb, seq_params->enable_pef); #if CONFIG_LF_SUB_PU aom_wb_write_bit(wb, seq_params->enable_lf_sub_pu); @@ -5621,7 +5556,7 @@ #if CONFIG_LF_SUB_PU seq_params->enable_lf_sub_pu #else - seq_params->enable_pef + seq_params->enable_pef #endif // CONFIG_LF_SUB_PU ) { aom_wb_write_bit(wb, seq_params->enable_tip_explicit_qp); @@ -5801,8 +5736,8 @@ const int ref_order_hint = ref_buf->display_order_hint; const int cur_order_hint = cm->cur_frame->display_order_hint; #else - const int ref_order_hint = ref_buf->order_hint; - const int cur_order_hint = cm->cur_frame->order_hint; + const int ref_order_hint = ref_buf->order_hint; + const int cur_order_hint = cm->cur_frame->order_hint; #endif // CONFIG_EXPLICIT_TEMPORAL_DIST_CALC temporal_distance = get_relative_dist(&seq_params->order_hint_info, cur_order_hint, ref_order_hint); @@ -6360,11 +6295,9 @@ encode_cdef(cm, wb); } encode_restoration_mode(cm, wb); -#if CONFIG_CCSO if (!features->coded_lossless && cm->seq_params.enable_ccso) { encode_ccso(cm, wb); } -#endif } if (features->coded_lossless || !cm->seq_params.enable_parity_hiding) {
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c index f2aaae0..6068c93 100644 --- a/av1/encoder/encodeframe_utils.c +++ b/av1/encoder/encodeframe_utils.c
@@ -1643,11 +1643,9 @@ AVERAGE_CDF(ctx_left->switchable_flex_restore_cdf, ctx_tr->switchable_flex_restore_cdf, 2); AVERAGE_CDF(ctx_left->wiener_restore_cdf, ctx_tr->wiener_restore_cdf, 2); -#if CONFIG_CCSO_EXT for (int plane = 0; plane < MAX_MB_PLANE; plane++) { AVERAGE_CDF(ctx_left->ccso_cdf[plane], ctx_tr->ccso_cdf[plane], 2); } -#endif AVERAGE_CDF(ctx_left->sgrproj_restore_cdf, ctx_tr->sgrproj_restore_cdf, 2); AVERAGE_CDF(ctx_left->wienerns_restore_cdf, ctx_tr->wienerns_restore_cdf, 2); AVERAGE_CDF(ctx_left->wienerns_length_cdf, ctx_tr->wienerns_length_cdf, 2);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index f18b681..39b6712 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -70,9 +70,7 @@ #include "av1/encoder/mv_prec.h" #include "av1/encoder/pass2_strategy.h" #include "av1/encoder/pickcdef.h" -#if CONFIG_CCSO #include "av1/encoder/pickccso.h" -#endif #include "av1/encoder/picklpf.h" #include "av1/encoder/pickrst.h" #include "av1/encoder/random.h" @@ -413,9 +411,7 @@ seq->enable_superres = oxcf->superres_cfg.enable_superres; seq->enable_cdef = tool_cfg->enable_cdef; seq->enable_restoration = tool_cfg->enable_restoration; -#if CONFIG_CCSO seq->enable_ccso = tool_cfg->enable_ccso; -#endif seq->enable_pef = tool_cfg->enable_pef; #if CONFIG_LF_SUB_PU seq->enable_lf_sub_pu = tool_cfg->enable_lf_sub_pu; @@ -2270,7 +2266,6 @@ static void cdef_restoration_frame(AV1_COMP *cpi, AV1_COMMON *cm, MACROBLOCKD *xd, int use_restoration, int use_cdef) { -#if CONFIG_CCSO uint16_t *rec_uv[CCSO_NUM_COMPONENTS]; uint16_t *org_uv[CCSO_NUM_COMPONENTS]; uint16_t *ext_rec_y = NULL; @@ -2310,7 +2305,6 @@ } extend_ccso_border(ext_rec_y, CCSO_PADDING_SIZE, xd); } -#endif MultiThreadInfo *const mt_info = &cpi->mt_info; const int num_workers = mt_info->num_workers; @@ -2345,16 +2339,11 @@ #endif // CONFIG_FIX_CDEF_SYNTAX } -#if CONFIG_CCSO if (use_ccso) { av1_setup_dst_planes(xd->plane, &cm->cur_frame->buf, 0, 0, 0, num_planes, NULL); // Reading original and reconstructed chroma samples as input -#if CONFIG_CCSO_EXT for (int pli = 0; pli < num_planes; pli++) { -#else - for (int pli = 1; pli < num_planes; pli++) { -#endif const int pic_height = xd->plane[pli].dst.height; const int pic_width = xd->plane[pli].dst.width; const int dst_stride = xd->plane[pli].dst.stride; @@ -2385,15 +2374,10 @@ ccso_frame(&cm->cur_frame->buf, cm, xd, ext_rec_y); aom_free(ext_rec_y); } -#if CONFIG_CCSO_EXT for (int pli = 0; pli < num_planes; pli++) { -#else - for (int pli = 1; pli < num_planes; pli++) { -#endif aom_free(rec_uv[pli]); aom_free(org_uv[pli]); } -#endif av1_superres_post_encode(cpi);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index bd6ce1c..b55468b 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -851,10 +851,8 @@ bool enable_pc_wiener; // Indicates if nonsep wiener in loop restoration filter should be enabled. bool enable_wiener_nonsep; -#if CONFIG_CCSO // Indicates if ccso should be enabled. bool enable_ccso; -#endif // Indicates if prediction enhancement filter should be enabled. bool enable_pef; #if CONFIG_LF_SUB_PU @@ -1662,9 +1660,7 @@ unsigned int switchable_flex_restore_cnts[MAX_LR_FLEX_SWITCHABLE_BITS] [MAX_MB_PLANE][2]; // placeholder -#if CONFIG_CCSO_EXT unsigned int default_ccso_cnts[3][2]; -#endif unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EOB_TX_CTXS][EXT_TX_SIZES] [TX_TYPES];
diff --git a/av1/encoder/pickccso.c b/av1/encoder/pickccso.c index f4de50e..9a1d320 100644 --- a/av1/encoder/pickccso.c +++ b/av1/encoder/pickccso.c
@@ -24,29 +24,21 @@ #include "av1/encoder/encoder.h" #include "av1/encoder/pickccso.h" -#if CONFIG_CCSO_EXT uint8_t final_band_log2; -#endif int8_t best_filter_offset[CCSO_NUM_COMPONENTS][CCSO_BAND_NUM * 16] = { { 0 } }; int8_t final_filter_offset[CCSO_NUM_COMPONENTS][CCSO_BAND_NUM * 16] = { { 0 } }; bool best_filter_enabled[CCSO_NUM_COMPONENTS]; bool final_filter_enabled[CCSO_NUM_COMPONENTS]; uint8_t final_ext_filter_support[CCSO_NUM_COMPONENTS]; uint8_t final_quant_idx[CCSO_NUM_COMPONENTS]; -#if CONFIG_CCSO_BO_ONLY_OPTION uint8_t final_ccso_bo_only[CCSO_NUM_COMPONENTS]; -#endif // CONFIG_CCSO_BO_ONLY_OPTION int chroma_error[CCSO_BAND_NUM * 16] = { 0 }; int chroma_count[CCSO_BAND_NUM * 16] = { 0 }; -#if CONFIG_CCSO_EXT int *total_class_err[CCSO_INPUT_INTERVAL][CCSO_INPUT_INTERVAL][CCSO_BAND_NUM]; int *total_class_cnt[CCSO_INPUT_INTERVAL][CCSO_INPUT_INTERVAL][CCSO_BAND_NUM]; -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION int *total_class_err_bo[CCSO_BAND_NUM]; int *total_class_cnt_bo[CCSO_BAND_NUM]; -#endif // CONFIG_CCSO_BO_ONLY_OPTION int ccso_stride; int ccso_stride_ext; bool *filter_control; @@ -57,27 +49,17 @@ uint64_t *unfiltered_dist_block; uint64_t *training_dist_block; -#if CONFIG_CCSO_EXT const int ccso_offset[8] = { -10, -7, -3, -1, 0, 1, 3, 7 }; -#else -const int ccso_offset[8] = { -7, -5, -3, -1, 0, 1, 3, 5 }; -#endif // CONFIG_CCSO_EXT const uint8_t quant_sz[4] = { 16, 8, 32, 64 }; -#if CONFIG_CCSO_EXT - void ccso_derive_src_block_c(const uint16_t *src_y, uint8_t *const src_cls0, uint8_t *const src_cls1, const int src_y_stride, const int src_cls_stride, const int x, const int y, const int pic_width, const int pic_height, const int y_uv_hscale, const int y_uv_vscale, const int qstep, const int neg_qstep, - const int *src_loc, const int blk_size -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const int *src_loc, const int blk_size, + const int edge_clf) { int src_cls[2]; const int y_end = AOMMIN(pic_height - y, blk_size); const int x_end = AOMMIN(pic_width - x, blk_size); @@ -88,12 +70,7 @@ cal_filter_support(src_cls, &src_y[(y_pos << y_uv_vscale) * src_y_stride + (x_pos << y_uv_hscale)], - qstep, neg_qstep, src_loc -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); + qstep, neg_qstep, src_loc, edge_clf); src_cls0[(y_pos << y_uv_vscale) * src_cls_stride + (x_pos << y_uv_hscale)] = src_cls[0]; src_cls1[(y_pos << y_uv_vscale) * src_cls_stride + @@ -106,12 +83,7 @@ void ccso_derive_src_info(MACROBLOCKD *xd, const int plane, const uint16_t *src_y, const uint8_t qstep, const uint8_t filter_sup, uint8_t *src_cls0, - uint8_t *src_cls1 -#if CONFIG_CCSO_EDGE_CLF - , - int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + uint8_t *src_cls1, int edge_clf) { const int pic_height = xd->plane[plane].dst.height; const int pic_width = xd->plane[plane].dst.width; const int y_uv_hscale = xd->plane[plane].subsampling_x; @@ -127,12 +99,7 @@ ccso_derive_src_block(src_y, src_cls0, src_cls1, ccso_stride_ext, ccso_stride, x, y, pic_width, pic_height, y_uv_hscale, y_uv_vscale, qstep, neg_qstep, src_loc, - blk_size -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); + blk_size, edge_clf); } src_y += (ccso_stride_ext << (blk_log2 + y_uv_vscale)); src_cls0 += (ccso_stride << (blk_log2 + y_uv_vscale)); @@ -193,7 +160,6 @@ } } -#if CONFIG_CCSO_BO_ONLY_OPTION void ccso_pre_compute_class_err_bo(MACROBLOCKD *xd, const int plane, const uint16_t *src_y, const uint16_t *ref, const uint16_t *dst, @@ -232,7 +198,6 @@ src_y += (ccso_stride_ext << (blk_log2 + y_uv_vscale)); } } -#endif // CONFIG_CCSO_BO_ONLY_OPTION void ccso_filter_block_hbd_with_buf_c( const uint16_t *src_y, uint16_t *dst_yuv, const uint8_t *src_cls0, @@ -240,18 +205,11 @@ const int src_cls_stride, const int x, const int y, const int pic_width, const int pic_height, const int8_t *filter_offset, const int blk_size, const int y_uv_hscale, const int y_uv_vscale, const int max_val, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { -#if CONFIG_CCSO_BO_ONLY_OPTION + const uint8_t shift_bits, const uint8_t ccso_bo_only) { if (ccso_bo_only) { (void)src_cls0; (void)src_cls1; } -#endif // CONFIG_CCSO_BO_ONLY_OPTION int cur_src_cls0; int cur_src_cls1; const int y_end = AOMMIN(pic_height - y, blk_size); @@ -260,19 +218,15 @@ const int y_pos = y_start; for (int x_start = 0; x_start < x_end; x_start++) { const int x_pos = x + x_start; -#if CONFIG_CCSO_BO_ONLY_OPTION if (!ccso_bo_only) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION cur_src_cls0 = src_cls0[(y_pos << y_uv_vscale) * src_cls_stride + (x_pos << y_uv_hscale)]; cur_src_cls1 = src_cls1[(y_pos << y_uv_vscale) * src_cls_stride + (x_pos << y_uv_hscale)]; -#if CONFIG_CCSO_BO_ONLY_OPTION } else { cur_src_cls0 = 0; cur_src_cls1 = 0; } -#endif // CONFIG_CCSO_BO_ONLY_OPTION const int band_num = src_y[(y_pos << y_uv_vscale) * src_y_stride + (x_pos << y_uv_hscale)] >> shift_bits; @@ -289,12 +243,8 @@ const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const int8_t *filter_offset, uint8_t *src_cls0, uint8_t *src_cls1, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { + const uint8_t shift_bits, + const uint8_t ccso_bo_only) { const int pic_height = xd->plane[plane].dst.height; const int pic_width = xd->plane[plane].dst.width; const int max_val = (1 << cm->seq_params.bit_depth) - 1; @@ -303,7 +253,6 @@ src_y += CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; for (int y = 0; y < pic_height; y += blk_size) { for (int x = 0; x < pic_width; x += blk_size) { -#if CONFIG_CCSO_BO_ONLY_OPTION if (ccso_bo_only) { ccso_filter_block_hbd_with_buf_c( src_y, dst_yuv, src_cls0, src_cls1, ccso_stride_ext, dst_stride, @@ -311,20 +260,12 @@ // y_uv_scale in h and v shall be zero 0, 0, max_val, shift_bits, ccso_bo_only); } else { -#endif ccso_filter_block_hbd_with_buf( src_y, dst_yuv, src_cls0, src_cls1, ccso_stride_ext, dst_stride, ccso_stride, x, y, pic_width, pic_height, filter_offset, blk_size, // y_uv_scale in h and v shall be zero - 0, 0, max_val, shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + 0, 0, max_val, shift_bits, 0); } -#endif } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_stride_ext << blk_log2); @@ -338,12 +279,8 @@ const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const int8_t *filter_offset, uint8_t *src_cls0, uint8_t *src_cls1, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -) { + const uint8_t shift_bits, + const uint8_t ccso_bo_only) { const int pic_height = xd->plane[plane].dst.height; const int pic_width = xd->plane[plane].dst.width; const int y_uv_hscale = xd->plane[plane].subsampling_x; @@ -354,26 +291,17 @@ src_y += CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; for (int y = 0; y < pic_height; y += blk_size) { for (int x = 0; x < pic_width; x += blk_size) { -#if CONFIG_CCSO_BO_ONLY_OPTION if (ccso_bo_only) { ccso_filter_block_hbd_with_buf_c( src_y, dst_yuv, src_cls0, src_cls1, ccso_stride_ext, dst_stride, ccso_stride, x, y, pic_width, pic_height, filter_offset, blk_size, y_uv_hscale, y_uv_vscale, max_val, shift_bits, ccso_bo_only); } else { -#endif ccso_filter_block_hbd_with_buf( src_y, dst_yuv, src_cls0, src_cls1, ccso_stride_ext, dst_stride, ccso_stride, x, y, pic_width, pic_height, filter_offset, blk_size, - y_uv_hscale, y_uv_vscale, max_val, shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + y_uv_hscale, y_uv_vscale, max_val, shift_bits, 0); } -#endif } dst_yuv += (dst_stride << blk_log2); src_y += (ccso_stride_ext << (blk_log2 + y_uv_vscale)); @@ -381,7 +309,6 @@ src_cls1 += (ccso_stride << (blk_log2 + y_uv_vscale)); } } -#endif // CONFIG_CCSO_EXT uint64_t compute_distortion_block_c(const uint16_t *org, const int org_stride, const uint16_t *rec16, const int rec_stride, @@ -438,17 +365,10 @@ const uint64_t *unfiltered_dist, const uint64_t *training_dist, bool *m_filter_control, uint64_t *cur_total_dist, int *cur_total_rate, - bool *filter_enable -#if !CONFIG_CCSO_EDGE_CLF - , - const int rdmult -#endif // !CONFIG_CCSO_EDGE_CLF -) { -#if CONFIG_CCSO_EXT + bool *filter_enable) { aom_cdf_prob ccso_cdf[CDF_SIZE(2)]; static const aom_cdf_prob default_ccso_cdf[CDF_SIZE(2)] = { AOM_CDF2(11570) }; av1_copy(ccso_cdf, default_ccso_cdf); -#endif const int log2_filter_unit_size = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; const CommonModeInfoParams *const mi_params = &cm->mi_params; @@ -462,22 +382,14 @@ (1 << log2_filter_unit_size >> 2); bool cur_filter_enabled = false; int sb_idx = 0; -#if !CONFIG_CCSO_EXT - const int rate = av1_cost_literal(1); -#endif for (int y_sb = 0; y_sb < ccso_nvfb; y_sb++) { for (int x_sb = 0; x_sb < ccso_nhfb; x_sb++) { uint64_t ssd; uint64_t best_ssd = UINT64_MAX; int best_rate = INT_MAX; -#if !CONFIG_CCSO_EDGE_CLF - uint64_t best_cost = UINT64_MAX; -#endif // !CONFIG_CCSO_EDGE_CLF uint8_t cur_best_filter_control = 0; -#if CONFIG_CCSO_EXT int cost_from_cdf[2]; av1_cost_tokens_from_cdf(cost_from_cdf, ccso_cdf, NULL); -#endif for (int cur_filter_control = 0; cur_filter_control < 2; cur_filter_control++) { if (!(*filter_enable)) { @@ -488,31 +400,14 @@ } else { ssd = training_dist[sb_idx]; } -#if !CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT - const uint64_t rd_cost = - RDCOST(rdmult, cost_from_cdf[cur_filter_control], ssd * 16); -#else - const uint64_t rd_cost = RDCOST(rdmult, rate, ssd * 16); -#endif - if (rd_cost < best_cost) { - best_cost = rd_cost; -#else if (ssd < best_ssd) { -#endif // !CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT best_rate = cost_from_cdf[cur_filter_control]; -#else - best_rate = rate; -#endif best_ssd = ssd; cur_best_filter_control = cur_filter_control; m_filter_control[sb_idx] = cur_filter_control; } } -#if CONFIG_CCSO_EXT update_cdf(ccso_cdf, cur_best_filter_control, 2); -#endif if (cur_best_filter_control != 0) { cur_filter_enabled = true; } @@ -530,16 +425,8 @@ const int plane, const uint16_t *org_chroma, const uint16_t *rec_uv_16, const uint8_t quant_step_size, - const uint8_t ext_filter_support -#if CONFIG_CCSO_EXT - , - const int shift_bits -#endif -#if CONFIG_CCSO_EDGE_CLF - , - int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -) { + const uint8_t ext_filter_support, const int shift_bits, + int edge_clf) { const int log2_filter_unit_size = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; const int pic_height_c = xd->plane[plane].dst.height; @@ -596,36 +483,23 @@ for (int y_off = 0; y_off < y_offset; y_off++) { for (int x_off = 0; x_off < x_offset; x_off++) { -#if CONFIG_CCSO_EXT const int band_num = ext_rec_luma[((ccso_stride_ext_idx[y_off] << y_uv_vert_scale) + ((x + x_off) << y_uv_hori_scale)) + pad_stride] >> shift_bits; -#endif cal_filter_support( rec_luma_idx, &ext_rec_luma[((ccso_stride_ext_idx[y_off] << y_uv_vert_scale) + ((x + x_off) << y_uv_hori_scale)) + pad_stride], - quant_step_size, inv_quant_step, rec_idx -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); - chroma_error[ -#if CONFIG_CCSO_EXT - (band_num << 4) + -#endif - (rec_luma_idx[0] << 2) + rec_luma_idx[1]] += + quant_step_size, inv_quant_step, rec_idx, edge_clf); + chroma_error[(band_num << 4) + (rec_luma_idx[0] << 2) + + rec_luma_idx[1]] += org_chroma[ccso_stride_idx[y_off] + x + x_off] - rec_uv_16[ccso_stride_idx[y_off] + x + x_off]; - chroma_count[ -#if CONFIG_CCSO_EXT - (band_num << 4) + -#endif - (rec_luma_idx[0] << 2) + rec_luma_idx[1]]++; + chroma_count[(band_num << 4) + (rec_luma_idx[0] << 2) + + rec_luma_idx[1]]++; } } } @@ -636,21 +510,13 @@ } } -#if CONFIG_CCSO_EXT /* Compute the residual for each entry of the LUT using CCSO enabled filter * blocks */ void ccso_compute_class_err(AV1_COMMON *cm, const int plane, MACROBLOCKD *xd, - const int max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -) { + const int max_band_log2, + const int max_edge_interval, + const uint8_t ccso_bo_only) { const CommonModeInfoParams *const mi_params = &cm->mi_params; const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; const int nvfb = ((mi_params->mi_rows >> xd->plane[plane].subsampling_y) + @@ -662,7 +528,6 @@ const int fb_count = nvfb * nhfb; for (int fb_idx = 0; fb_idx < fb_count; fb_idx++) { if (!filter_control[fb_idx]) continue; -#if CONFIG_CCSO_BO_ONLY_OPTION if (ccso_bo_only) { int d0 = 0; int d1 = 0; @@ -672,14 +537,8 @@ chroma_count[lut_idx_ext] += total_class_cnt_bo[band_num][fb_idx]; } } else { -#endif // CONFIG_CCSO_BO_ONLY_OPTION -#if CONFIG_CCSO_EDGE_CLF for (int d0 = 0; d0 < max_edge_interval; d0++) { for (int d1 = 0; d1 < max_edge_interval; d1++) { -#else - for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { - for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { -#endif // CONFIG_CCSO_EDGE_CLF for (int band_num = 0; band_num < (1 << max_band_log2); band_num++) { const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; chroma_error[lut_idx_ext] += @@ -689,108 +548,50 @@ } } } -#if CONFIG_CCSO_BO_ONLY_OPTION } -#endif // CONFIG_CCSO_BO_ONLY_OPTION } } -#endif -#if CONFIG_CCSO_EDGE_CLF /* Count the bits for signaling the offset index */ -static INLINE int count_lut_bits(int8_t *temp_filter_offset -#if CONFIG_CCSO_EXT - , - const int max_band_log2 -#endif - , - const int max_edge_interval -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION -) { -#if CONFIG_CCSO_EXT +static INLINE int count_lut_bits(int8_t *temp_filter_offset, + const int max_band_log2, + const int max_edge_interval, + const uint8_t ccso_bo_only) { const int ccso_offset_reordered[8] = { 0, 1, -1, 3, -3, 7, -7, -10 }; -#else - const int ccso_offset_reordered[8] = { 0, 1, -1, 3, -3, 5, -5, -7 }; -#endif // CONFIG_CCSO_EXT int temp_bits = 0; -#if CONFIG_CCSO_BO_ONLY_OPTION int num_edge_offset_intervals = ccso_bo_only ? 1 : max_edge_interval; for (int d0 = 0; d0 < num_edge_offset_intervals; d0++) { for (int d1 = 0; d1 < num_edge_offset_intervals; d1++) { -#else - for (int d0 = 0; d0 < max_edge_interval; d0++) { - for (int d1 = 0; d1 < max_edge_interval; d1++) { -#endif -#if CONFIG_CCSO_EXT for (int band_num = 0; band_num < (1 << max_band_log2); band_num++) { const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; -#else - const int lut_idx_ext = (d0 << 2) + d1; -#endif for (int idx = 0; idx < 7; ++idx) { temp_bits++; if (ccso_offset_reordered[idx] == temp_filter_offset[lut_idx_ext]) break; } -#if CONFIG_CCSO_EXT } -#endif } } return temp_bits; } -#endif // CONFIG_CCSO_EDGE_CLF /* Derive the offset value in the look-up table */ -void derive_lut_offset(int8_t *temp_filter_offset -#if CONFIG_CCSO_EXT - , - const int max_band_log2 -#endif -#if CONFIG_CCSO_EDGE_CLF - , - const int max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -) { +void derive_lut_offset(int8_t *temp_filter_offset, const int max_band_log2, + const int max_edge_interval, + const uint8_t ccso_bo_only) { float temp_offset = 0; -#if CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION int num_edge_offset_intervals = ccso_bo_only ? 1 : max_edge_interval; for (int d0 = 0; d0 < num_edge_offset_intervals; d0++) { for (int d1 = 0; d1 < num_edge_offset_intervals; d1++) { -#else - for (int d0 = 0; d0 < max_edge_interval; d0++) { - for (int d1 = 0; d1 < max_edge_interval; d1++) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION -#else - for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { - for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT for (int band_num = 0; band_num < (1 << max_band_log2); band_num++) { const int lut_idx_ext = (band_num << 4) + (d0 << 2) + d1; -#else - const int lut_idx_ext = (d0 << 2) + d1; -#endif if (chroma_count[lut_idx_ext]) { temp_offset = (float)chroma_error[lut_idx_ext] / chroma_count[lut_idx_ext]; -#if CONFIG_CCSO_EXT if ((temp_offset < ccso_offset[0]) || (temp_offset >= ccso_offset[7])) { temp_filter_offset[lut_idx_ext] = clamp((int)temp_offset, ccso_offset[0], ccso_offset[7]); -#else - if ((temp_offset < -7) || (temp_offset >= 5)) { - temp_filter_offset[lut_idx_ext] = clamp((int)temp_offset, -7, 5); -#endif } else { for (int offset_idx = 0; offset_idx < 7; offset_idx++) { if ((temp_offset >= ccso_offset[offset_idx]) && @@ -806,9 +607,7 @@ } } } -#if CONFIG_CCSO_EXT } -#endif } } } @@ -846,7 +645,6 @@ memset(final_filter_control, 0, sizeof(*final_filter_control) * sb_count); temp_rec_uv_buf = aom_malloc(sizeof(*temp_rec_uv_buf) * xd->plane[0].dst.height * ccso_stride); -#if CONFIG_CCSO_EXT for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { for (int band_num = 0; band_num < CCSO_BAND_NUM; band_num++) { @@ -857,19 +655,15 @@ } } } -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION for (int band_num = 0; band_num < CCSO_BAND_NUM; band_num++) { total_class_err_bo[band_num] = aom_malloc(sizeof(*total_class_err_bo[band_num]) * sb_count); total_class_cnt_bo[band_num] = aom_malloc(sizeof(*total_class_cnt_bo[band_num]) * sb_count); } -#endif // CONFIG_CCSO_BO_ONLY_OPTION compute_distortion(org_uv, ccso_stride, rec_uv, ccso_stride, log2_filter_unit_size, pic_height_c, pic_width_c, unfiltered_dist_block, ccso_nhfb, &unfiltered_dist_frame); -#if CONFIG_CCSO_EDGE_CLF const double best_unfiltered_cost = RDCOST_DBL_WITH_NATIVE_BD_DIST( rdmult, 1, unfiltered_dist_frame, cm->seq_params.bit_depth); double best_filtered_cost; @@ -877,26 +671,10 @@ uint8_t best_edge_classifier = 0; uint8_t final_edge_classifier = 0; const int total_edge_classifier = 2; -#else - const uint64_t best_unfiltered_cost = - RDCOST(rdmult, av1_cost_literal(1), unfiltered_dist_frame * 16); - uint64_t best_filtered_cost; - uint64_t final_filtered_cost = UINT64_MAX; -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION int8_t filter_offset[CCSO_BAND_NUM * 16]; -#else - int8_t filter_offset[8 * 16]; -#endif // CONFIG_CCSO_BO_ONLY_OPTION -#else - int8_t filter_offset[16]; -#endif const int total_filter_support = 6; const int total_quant_idx = 4; -#if CONFIG_CCSO_EXT const int total_band_log2_plus1 = 4; -#endif uint8_t frame_bits = 1; #if CONFIG_CCSO_SIGFIX uint8_t frame_bits_bo_only = 1; // enabling flag @@ -905,11 +683,8 @@ #endif // CONFIG_CCSO_SIGFIX frame_bits += 2; // quant step size frame_bits += 3; // filter support index -#if CONFIG_CCSO_EDGE_CLF - frame_bits += 1; // edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT - frame_bits += 2; // band number log2 + frame_bits += 1; // edge_clf + frame_bits += 2; // band number log2 #if CONFIG_CCSO_SIGFIX frame_bits_bo_only += 3; // band number log2 #endif // CONFIG_CCSO_SIGFIX @@ -923,69 +698,39 @@ sizeof(*src_cls0) * xd->plane[0].dst.height * xd->plane[0].dst.width); memset(src_cls1, 0, sizeof(*src_cls1) * xd->plane[0].dst.height * xd->plane[0].dst.width); -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION for (uint8_t ccso_bo_only = 0; ccso_bo_only < 2; ccso_bo_only++) { -#endif #if CONFIG_CCSO_SIGFIX int num_filter_iter = ccso_bo_only ? 1 : total_filter_support; int num_quant_iter = ccso_bo_only ? 1 : total_quant_idx; int num_edge_clf_iter = ccso_bo_only ? 1 : total_edge_classifier; #else - int num_filter_iter = total_filter_support; - int num_quant_iter = total_quant_idx; - int num_edge_clf_iter = total_edge_classifier; + int num_filter_iter = total_filter_support; + int num_quant_iter = total_quant_idx; + int num_edge_clf_iter = total_edge_classifier; #endif // CONFIG_CCSO_SIGFIX for (int ext_filter_support = 0; ext_filter_support < num_filter_iter; ext_filter_support++) { for (int quant_idx = 0; quant_idx < num_quant_iter; quant_idx++) { -#if CONFIG_CCSO_EDGE_CLF for (int edge_clf = 0; edge_clf < num_edge_clf_iter; edge_clf++) { const int max_edge_interval = edge_clf_to_edge_interval[edge_clf]; -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION if (!ccso_bo_only) { -#endif ccso_derive_src_info(xd, plane, ext_rec_y, quant_sz[quant_idx], - ext_filter_support, src_cls0, src_cls1 -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); -#if CONFIG_CCSO_BO_ONLY_OPTION + ext_filter_support, src_cls0, src_cls1, + edge_clf); } -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION int num_band_iter = total_band_log2_plus1; if (ccso_bo_only) { num_band_iter = total_band_log2_plus1 + 4; } for (int max_band_log2 = 0; max_band_log2 < num_band_iter; max_band_log2++) { -#else - for (int max_band_log2 = 0; max_band_log2 < total_band_log2_plus1; - max_band_log2++) { -#endif // CONFIG_CCSO_BO_ONLY_OPTION const int shift_bits = cm->seq_params.bit_depth - max_band_log2; -#if CONFIG_CCSO_EDGE_CLF const int max_band = 1 << max_band_log2; -#endif // CONFIG_CCSO_EDGE_CLF -#endif -#if CONFIG_CCSO_EDGE_CLF best_filtered_cost = DBL_MAX; -#else - best_filtered_cost = UINT64_MAX; -#endif // CONFIG_CCSO_EDGE_CLF bool ccso_enable = true; bool keep_training = true; bool improvement = false; -#if CONFIG_CCSO_EDGE_CLF double prev_total_cost = DBL_MAX; -#else - uint64_t prev_total_cost = UINT64_MAX; -#endif // CONFIG_CCSO_EDGE_CLF int control_idx = 0; for (int y = 0; y < ccso_nvfb; y++) { for (int x = 0; x < ccso_nhfb; x++) { @@ -993,8 +738,6 @@ control_idx++; } } -#if CONFIG_CCSO_EXT -#if CONFIG_CCSO_BO_ONLY_OPTION if (ccso_bo_only) { for (int band_num = 0; band_num < CCSO_BAND_NUM; band_num++) { memset(total_class_err_bo[band_num], 0, @@ -1005,16 +748,9 @@ ccso_pre_compute_class_err_bo(xd, plane, ext_rec_y, org_uv, rec_uv, shift_bits); } else { -#endif -#if CONFIG_CCSO_EDGE_CLF for (int d0 = 0; d0 < max_edge_interval; d0++) { for (int d1 = 0; d1 < max_edge_interval; d1++) { for (int band_num = 0; band_num < max_band; band_num++) { -#else - for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { - for (int d1 = 0; d1 < CCSO_INPUT_INTERVAL; d1++) { - for (int band_num = 0; band_num < CCSO_BAND_NUM; band_num++) { -#endif // CONFIG_CCSO_EDGE_CLF memset( total_class_err[d0][d1][band_num], 0, sizeof(*total_class_err[d0][d1][band_num]) * sb_count); @@ -1026,10 +762,7 @@ } ccso_pre_compute_class_err(xd, plane, ext_rec_y, org_uv, rec_uv, src_cls0, src_cls1, shift_bits); -#if CONFIG_CCSO_BO_ONLY_OPTION } -#endif -#endif int training_iter_count = 0; while (keep_training) { improvement = false; @@ -1040,72 +773,23 @@ memcpy(temp_rec_uv_buf, rec_uv, sizeof(*temp_rec_uv_buf) * xd->plane[0].dst.height * ccso_stride); -#if CONFIG_CCSO_EXT - ccso_compute_class_err(cm, plane, xd, max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - ccso_bo_only -#endif - ); -#else - compute_total_error(xd, ext_rec_y, plane, org_uv, temp_rec_uv_buf, - quant_sz[quant_idx], ext_filter_support -#if CONFIG_CCSO_EXT - , - shift_bits -#endif -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf -#endif // CONFIG_CCSO_EDGE_CLF - ); -#endif - derive_lut_offset(filter_offset -#if CONFIG_CCSO_EXT - , - max_band_log2 -#endif -#if CONFIG_CCSO_EDGE_CLF - , - max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - ccso_bo_only -#endif - ); + ccso_compute_class_err(cm, plane, xd, max_band_log2, + max_edge_interval, ccso_bo_only); + derive_lut_offset(filter_offset, max_band_log2, + max_edge_interval, ccso_bo_only); } memcpy(temp_rec_uv_buf, rec_uv, sizeof(*temp_rec_uv_buf) * xd->plane[0].dst.height * ccso_stride); -#if CONFIG_CCSO_EXT if (plane > 0) - ccso_try_chroma_filter( - cm, xd, plane, ext_rec_y, temp_rec_uv_buf, ccso_stride, - filter_offset, src_cls0, src_cls1, shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - ccso_bo_only -#endif - ); + ccso_try_chroma_filter(cm, xd, plane, ext_rec_y, + temp_rec_uv_buf, ccso_stride, + filter_offset, src_cls0, src_cls1, + shift_bits, ccso_bo_only); else ccso_try_luma_filter(cm, xd, plane, ext_rec_y, temp_rec_uv_buf, ccso_stride, filter_offset, src_cls0, - src_cls1, shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - ccso_bo_only -#endif - ); -#else - apply_ccso_filter_hbd(cm, xd, plane, ext_rec_y, temp_rec_uv_buf, - ccso_stride, filter_offset, quant_sz[quant_idx], - ext_filter_support); -#endif + src_cls1, shift_bits, ccso_bo_only); filtered_dist_frame = 0; compute_distortion(org_uv, ccso_stride, temp_rec_uv_buf, ccso_stride, log2_filter_unit_size, @@ -1115,21 +799,11 @@ int cur_total_rate = 0; derive_blk_md(cm, xd, plane, unfiltered_dist_block, training_dist_block, filter_control, - &cur_total_dist, &cur_total_rate, &ccso_enable -#if !CONFIG_CCSO_EDGE_CLF - , - rdmult -#endif // !CONFIG_CCSO_EDGE_CLF - ); + &cur_total_dist, &cur_total_rate, &ccso_enable); if (ccso_enable) { -#if CONFIG_CCSO_EDGE_CLF - const int lut_bits = count_lut_bits( - filter_offset, max_band_log2, max_edge_interval -#if CONFIG_CCSO_BO_ONLY_OPTION - , - ccso_bo_only -#endif // CONFIG_CCSO_BO_ONLY_OPTION - ); + const int lut_bits = + count_lut_bits(filter_offset, max_band_log2, + max_edge_interval, ccso_bo_only); const int cur_total_bits = lut_bits + ( @@ -1141,39 +815,16 @@ const double cur_total_cost = RDCOST_DBL_WITH_NATIVE_BD_DIST( rdmult, cur_total_bits, cur_total_dist, cm->seq_params.bit_depth); -#else -#if CONFIG_CCSO_EXT - const int lut_bits = (1 << max_band_log2) * 9; -#else - const int lut_bits = 9; -#endif - cur_total_rate += av1_cost_literal(lut_bits * 3) + - av1_cost_literal( -#if CONFIG_CCSO_SIGFIX - ccso_bo_only ? frame_bits_bo_only : -#endif // CONFIG_CCSO_SIGFIX - frame_bits); - const uint64_t cur_total_cost = - RDCOST(rdmult, cur_total_rate, cur_total_dist * 16); -#endif // CONFIG_CCSO_EDGE_CLF if (cur_total_cost < prev_total_cost) { prev_total_cost = cur_total_cost; improvement = true; } if (cur_total_cost < best_filtered_cost) { best_filtered_cost = cur_total_cost; -#if CONFIG_CCSO_EXT best_filter_enabled[plane] = ccso_enable; memcpy(best_filter_offset[plane], filter_offset, sizeof(filter_offset)); -#else - best_filter_enabled[plane - 1] = ccso_enable; - memcpy(best_filter_offset[plane - 1], filter_offset, - sizeof(filter_offset)); -#endif -#if CONFIG_CCSO_EDGE_CLF best_edge_classifier = edge_clf; -#endif // CONFIG_CCSO_EDGE_CLF memcpy(best_filter_control, filter_control, sizeof(*filter_control) * sb_count); } @@ -1186,67 +837,32 @@ if (best_filtered_cost < final_filtered_cost) { final_filtered_cost = best_filtered_cost; -#if CONFIG_CCSO_EXT final_filter_enabled[plane] = best_filter_enabled[plane]; final_quant_idx[plane] = quant_idx; final_ext_filter_support[plane] = ext_filter_support; -#if CONFIG_CCSO_BO_ONLY_OPTION final_ccso_bo_only[plane] = ccso_bo_only; -#endif memcpy(final_filter_offset[plane], best_filter_offset[plane], sizeof(best_filter_offset[plane])); final_band_log2 = max_band_log2; -#else - final_filter_enabled[plane - 1] = best_filter_enabled[plane - 1]; - final_quant_idx[plane - 1] = quant_idx; - final_ext_filter_support[plane - 1] = ext_filter_support; - memcpy(final_filter_offset[plane - 1], best_filter_offset[plane - 1], - sizeof(best_filter_offset[plane - 1])); -#endif -#if CONFIG_CCSO_EDGE_CLF final_edge_classifier = best_edge_classifier; -#endif // CONFIG_CCSO_EDGE_CLF memcpy(final_filter_control, best_filter_control, sizeof(*best_filter_control) * sb_count); } -#if CONFIG_CCSO_EXT } -#endif -#if CONFIG_CCSO_EDGE_CLF } -#endif // CONFIG_CCSO_EDGE_CLF } } -#if CONFIG_CCSO_BO_ONLY_OPTION - } // end bo only -#endif + } if (best_unfiltered_cost < final_filtered_cost) { memset(final_filter_control, 0, sizeof(*final_filter_control) * sb_count); -#if CONFIG_CCSO_EXT cm->ccso_info.ccso_enable[plane] = false; } else { cm->ccso_info.ccso_enable[plane] = true; -#endif } -#if CONFIG_CCSO_EXT if (cm->ccso_info.ccso_enable[plane]) { -#else - bool at_least_one_sb_use_ccso = false; - for (int control_idx2 = 0; - final_filter_enabled[plane - 1] && control_idx2 < sb_count; - control_idx2++) { - if (final_filter_control[control_idx2]) { - at_least_one_sb_use_ccso = true; - break; - } - } - cm->ccso_info.ccso_enable[plane - 1] = at_least_one_sb_use_ccso; - if (at_least_one_sb_use_ccso) { -#endif for (int y_sb = 0; y_sb < ccso_nvfb; y_sb++) { for (int x_sb = 0; x_sb < ccso_nhfb; x_sb++) { -#if CONFIG_CCSO_EXT if (plane == AOM_PLANE_Y) { mi_params ->mi_grid_base[(1 << CCSO_BLK_SIZE >> @@ -1256,9 +872,7 @@ (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * x_sb] ->ccso_blk_y = final_filter_control[y_sb * ccso_nhfb + x_sb]; - } else -#endif - if (plane == AOM_PLANE_U) { + } else if (plane == AOM_PLANE_U) { mi_params ->mi_grid_base[(1 << CCSO_BLK_SIZE >> (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * @@ -1279,26 +893,13 @@ } } } -#if CONFIG_CCSO_EXT memcpy(cm->ccso_info.filter_offset[plane], final_filter_offset[plane], sizeof(final_filter_offset[plane])); cm->ccso_info.quant_idx[plane] = final_quant_idx[plane]; cm->ccso_info.ext_filter_support[plane] = final_ext_filter_support[plane]; -#if CONFIG_CCSO_BO_ONLY_OPTION cm->ccso_info.ccso_bo_only[plane] = final_ccso_bo_only[plane]; -#endif cm->ccso_info.max_band_log2[plane] = final_band_log2; -#else - memcpy(cm->ccso_info.filter_offset[plane - 1], - final_filter_offset[plane - 1], - sizeof(final_filter_offset[plane - 1])); - cm->ccso_info.quant_idx[plane - 1] = final_quant_idx[plane - 1]; - cm->ccso_info.ext_filter_support[plane - 1] = - final_ext_filter_support[plane - 1]; -#endif -#if CONFIG_CCSO_EDGE_CLF cm->ccso_info.edge_clf[plane] = final_edge_classifier; -#endif // CONFIG_CCSO_EDGE_CLF } aom_free(unfiltered_dist_block); aom_free(training_dist_block); @@ -1306,7 +907,6 @@ aom_free(final_filter_control); aom_free(temp_rec_uv_buf); aom_free(best_filter_control); -#if CONFIG_CCSO_EXT aom_free(src_cls0); aom_free(src_cls1); for (int d0 = 0; d0 < CCSO_INPUT_INTERVAL; d0++) { @@ -1317,43 +917,32 @@ } } } -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION for (int band_num = 0; band_num < CCSO_BAND_NUM; band_num++) { aom_free(total_class_err_bo[band_num]); aom_free(total_class_cnt_bo[band_num]); } -#endif } /* Derive the look-up table for a frame */ void ccso_search(AV1_COMMON *cm, MACROBLOCKD *xd, int rdmult, const uint16_t *ext_rec_y, uint16_t *rec_uv[3], uint16_t *org_uv[3]) { -#if CONFIG_CCSO_EDGE_CLF int rdmult_weight = clamp(cm->quant_params.base_qindex >> 3, 1, 37); -#else - double rdmult_weight = - clamp_dbl(0.012 * pow(2, 0.0456 * cm->quant_params.base_qindex), 1, 37); -#endif // CONFIG_CCSO_EDGE_CLF int64_t rdmult_temp = (int64_t)rdmult * (int64_t)rdmult_weight; - if (rdmult_temp < INT_MAX) rdmult = (int)rdmult_temp; -#if CONFIG_CCSO_EXT + if (rdmult_temp < INT_MAX) + rdmult = (int)rdmult_temp; else return; -#endif const int num_planes = av1_num_planes(cm); av1_setup_dst_planes(xd->plane, &cm->cur_frame->buf, 0, 0, 0, num_planes, NULL); ccso_stride = xd->plane[0].dst.width; ccso_stride_ext = xd->plane[0].dst.width + (CCSO_PADDING_SIZE << 1); -#if CONFIG_CCSO_EXT derive_ccso_filter(cm, AOM_PLANE_Y, xd, org_uv[AOM_PLANE_Y], ext_rec_y, rec_uv[AOM_PLANE_Y], rdmult); #if CONFIG_D143_CCSO_FM_FLAG cm->ccso_info.ccso_frame_flag = cm->ccso_info.ccso_enable[0]; #endif // CONFIG_D143_CCSO_FM_FLAG -#endif if (num_planes > 1) { derive_ccso_filter(cm, AOM_PLANE_U, xd, org_uv[AOM_PLANE_U], ext_rec_y, rec_uv[AOM_PLANE_U], rdmult);
diff --git a/av1/encoder/pickccso.h b/av1/encoder/pickccso.h index 9d4b164..a47b603 100644 --- a/av1/encoder/pickccso.h +++ b/av1/encoder/pickccso.h
@@ -29,39 +29,26 @@ void ccso_search(AV1_COMMON *cm, MACROBLOCKD *xd, int rdmult, const uint16_t *ext_rec_y, uint16_t *rec_uv[3], uint16_t *org_uv[3]); -#if CONFIG_CCSO_EXT void ccso_pre_compute_class_err(MACROBLOCKD *xd, const int plane, const uint16_t *src_y, const uint16_t *ref, const uint16_t *dst, uint8_t *src_cls0, uint8_t *src_cls1, const uint8_t shift_bits); -#if CONFIG_CCSO_BO_ONLY_OPTION // pre compute classes for band offset only option void ccso_pre_compute_class_err_bo(MACROBLOCKD *xd, const int plane, const uint16_t *src_y, const uint16_t *ref, const uint16_t *dst, const uint8_t shift_bits); -#endif void ccso_try_luma_filter(AV1_COMMON *cm, MACROBLOCKD *xd, const int plane, const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const int8_t *filter_offset, uint8_t *src_cls0, uint8_t *src_cls1, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); + const uint8_t shift_bits, const uint8_t ccso_bo_only); void ccso_try_chroma_filter(AV1_COMMON *cm, MACROBLOCKD *xd, const int plane, const uint16_t *src_y, uint16_t *dst_yuv, const int dst_stride, const int8_t *filter_offset, uint8_t *src_cls0, uint8_t *src_cls1, - const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); -#endif + const uint8_t shift_bits, + const uint8_t ccso_bo_only); void derive_ccso_filter(AV1_COMMON *cm, const int plane, MACROBLOCKD *xd, const uint16_t *org_uv, const uint16_t *ext_rec_y, @@ -71,54 +58,21 @@ const uint64_t *unfiltered_dist, const uint64_t *training_dist, bool *m_filter_control, uint64_t *cur_total_dist, int *cur_total_rate, - bool *filter_enable -#if !CONFIG_CCSO_EDGE_CLF - , - const int rdmult -#endif // !CONFIG_CCSO_EDGE_CLF -); + bool *filter_enable); void compute_total_error(MACROBLOCKD *xd, const uint16_t *ext_rec_luma, const int plane, const uint16_t *org_chroma, const uint16_t *rec_uv_16, const uint8_t quanStep, - const uint8_t ext_filter_support -#if CONFIG_CCSO_EXT - , - const int shift_bits -#endif -#if CONFIG_CCSO_EDGE_CLF - , - int edge_clf -#endif // CONFIG_CCSO_EDGE_CLF -); -#if CONFIG_CCSO_EXT -void ccso_compute_class_err(AV1_COMMON *cm, const int plane, MACROBLOCKD *xd, - const int max_band_log2 -#if CONFIG_CCSO_EDGE_CLF - , - const int max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); -#endif + const uint8_t ext_filter_support, const int shift_bits, + int edge_clf); -void derive_lut_offset(int8_t *temp_filter_offset -#if CONFIG_CCSO_EXT - , - const int max_band_log2 -#endif -#if CONFIG_CCSO_EDGE_CLF - , - const int max_edge_interval -#endif // CONFIG_CCSO_EDGE_CLF -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); +void ccso_compute_class_err(AV1_COMMON *cm, const int plane, MACROBLOCKD *xd, + const int max_band_log2, + const int max_edge_interval, + const uint8_t ccso_bo_only); + +void derive_lut_offset(int8_t *temp_filter_offset, const int max_band_log2, + const int max_edge_interval, const uint8_t ccso_bo_only); #ifdef __cplusplus } // extern "C"
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake index 8258b2d..7f68173 100644 --- a/build/cmake/aom_config_defaults.cmake +++ b/build/cmake/aom_config_defaults.cmake
@@ -178,10 +178,6 @@ "AV2 experiment flag to disable ORIP for non-DC modes.") set_aom_config_var(CONFIG_MVP_IMPROVEMENT 1 "Enable MVP improvement") set_aom_config_var( - CONFIG_CCSO 1 "AV2 experiment flag to enable cross component sample offset.") -set_aom_config_var(CONFIG_CCSO_EDGE_CLF 1 - "Enable adaptive edge classifier for CCSO.") -set_aom_config_var( CONFIG_IBP_DC 1 "AV2 experiment flag to enable intra bi-prediction for DC mode.") set_aom_config_var(CONFIG_AIMC 1 "AV2 adaptive intra mode coding flag.") @@ -226,8 +222,6 @@ "Enables BV improvements for IBC") set_aom_config_var(CONFIG_IBC_MAX_DRL 1 "Enables Max DRL index signaling for IntraBC") -set_aom_config_var(CONFIG_CCSO_EXT 1 - "AV2 experiment flag to enable extended CCSO.") set_aom_config_var( CONFIG_PALETTE_IMPROVEMENTS 1 @@ -385,9 +379,6 @@ set_aom_config_var(CONFIG_D143_CCSO_FM_FLAG 1 "Enable CCSO frame level joint flag.") -set_aom_config_var(CONFIG_CCSO_BO_ONLY_OPTION 1 - "Enable CCSO band offset only option.") - set_aom_config_var( CONFIG_TX_SKIP_FLAG_MODE_DEP_CTX 1 "CWG-D086: Context modeling for transform block zero flag signaling")
diff --git a/build/cmake/aom_experiment_deps.cmake b/build/cmake/aom_experiment_deps.cmake index 4e8c66c..dee2d62 100644 --- a/build/cmake/aom_experiment_deps.cmake +++ b/build/cmake/aom_experiment_deps.cmake
@@ -40,12 +40,6 @@ change_config_and_warn(CONFIG_THROUGHPUT_ANALYSIS 0 !CONFIG_ACCOUNTING) endif() - # CONFIG_CCSO_EXT is dependent on CONFIG_CCSO. If CONFIG_CCSO is off, - # CONFIG_CCSO_EXT needs to be turned off. - if(NOT CONFIG_CCSO AND CONFIG_CCSO_EXT) - change_config_and_warn(CONFIG_CCSO_EXT 0 !CONFIG_CCSO) - endif() - # CONFIG_EXPLICIT_BAWP is dependent on CONFIG_BAWP. If CONFIG_BAWP is off, # CONFIG_EXPLICIT_BAWP needs to be turned off. if(NOT CONFIG_BAWP AND CONFIG_EXPLICIT_BAWP) @@ -141,11 +135,6 @@ change_config_and_warn(CONFIG_TMVP_IMPROVE 0 !CONFIG_MVP_IMPROVEMENT) endif() - # CONFIG_CCSO_SIGFIX depends on CONFIG_CCSO_BO_ONLY_OPTION - if(NOT CONFIG_CCSO_BO_ONLY_OPTION AND CONFIG_CCSO_SIGFIX) - change_config_and_warn(CONFIG_CCSO_SIGFIX 0 !CONFIG_CCSO_BO_ONLY_OPTION) - endif() - if(CONFIG_ML_PART_SPLIT) change_config_and_warn(CONFIG_TENSORFLOW_LITE 1 CONFIG_ML_PART_SPLIT) endif()
diff --git a/common/args.c b/common/args.c index e911792..6318b67 100644 --- a/common/args.c +++ b/common/args.c
@@ -130,9 +130,7 @@ GET_PARAMS(enable_deblocking); GET_PARAMS(enable_cdef); GET_PARAMS(enable_restoration); -#if CONFIG_CCSO GET_PARAMS(enable_ccso); -#endif GET_PARAMS(enable_pef); #if CONFIG_LF_SUB_PU GET_PARAMS(enable_lf_sub_pu);
diff --git a/common/av1_config.c b/common/av1_config.c index d2fe7e7..4cd6a9f 100644 --- a/common/av1_config.c +++ b/common/av1_config.c
@@ -272,9 +272,7 @@ AV1C_READ_BIT_OR_RETURN_ERROR(enable_imp_msk_bld); #endif // CONFIG_D071_IMP_MSK_BLD AV1C_READ_BIT_OR_RETURN_ERROR(enable_fsc); -#if CONFIG_CCSO AV1C_READ_BIT_OR_RETURN_ERROR(enable_ccso); -#endif AV1C_READ_BIT_OR_RETURN_ERROR(enable_pef); #if CONFIG_LF_SUB_PU AV1C_READ_BIT_OR_RETURN_ERROR(enable_lf_sub_pu);
diff --git a/test/av1_ccso_simd_cmp.cc b/test/av1_ccso_simd_cmp.cc index ff96c7a..479746a 100644 --- a/test/av1_ccso_simd_cmp.cc +++ b/test/av1_ccso_simd_cmp.cc
@@ -42,16 +42,8 @@ const int y_uv_vscale, const int thr, const int neg_thr, const int *src_loc, const int max_val, const int blk_size, - const bool isSingleBand, const uint8_t shift_bits -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); + const bool isSingleBand, const uint8_t shift_bits, + const int edge_clf, const uint8_t ccso_bo_only); typedef libaom_test::FuncParam<CCSO_WO_BUF> TestFuncsCCSO_WO_BUF; template <typename F> @@ -121,9 +113,7 @@ int max_val_; bool isSingleBand_; uint8_t shift_bits_; -#if CONFIG_CCSO_EDGE_CLF int edge_clf_; -#endif }; class CCSOWOBUFTest : public CCSOFilterTest<CCSO_WO_BUF> { @@ -132,30 +122,13 @@ params_.ref_func(src_y_, dst_ref_, 0, 0, pic_width_, pic_height_, src_cls_, offset_buf_, src_y_stride_, dst_stride_, y_uv_hscale_, y_uv_vscale_, thr_, neg_thr_, src_loc_, max_val_, - blk_size_, isSingleBand_, shift_bits_ -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf_ -#endif -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif - ); + blk_size_, isSingleBand_, shift_bits_, edge_clf_, 0); ASM_REGISTER_STATE_CHECK(params_.tst_func( src_y_, dst_tst_, 0, 0, pic_width_, pic_height_, src_cls_, offset_buf_, src_y_stride_, dst_stride_, y_uv_hscale_, y_uv_vscale_, thr_, neg_thr_, - src_loc_, max_val_, blk_size_, isSingleBand_, shift_bits_ -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf_ -#endif -#if CONFIG_CCSO_EDGE_CLF - , - 0 -#endif - )); + src_loc_, max_val_, blk_size_, isSingleBand_, shift_bits_, edge_clf_, + 0)); for (int r = 0; r < blk_size_; ++r) { for (int c = 0; c < blk_size_; ++c) { @@ -193,12 +166,8 @@ const int pic_width, const int pic_height, const int8_t *offset_buf, const int blk_size, const int y_uv_hscale, const int y_uv_vscale, - const int max_val, const uint8_t shift_bits -#if CONFIG_CCSO_BO_ONLY_OPTION - , - const uint8_t ccso_bo_only -#endif -); + const int max_val, const uint8_t shift_bits, + const uint8_t ccso_bo_only); typedef libaom_test::FuncParam<CCSO_With_BUF> TestFuncsCCSO_With_BUF; class CCSOWITHBUFTest : public CCSOFilterTest<CCSO_With_BUF> { @@ -208,22 +177,12 @@ params_.ref_func(src_y_, dst_ref_, src_cls0_, src_cls1_, src_y_stride_, dst_stride_, ccso_stride_, 0, 0, pic_width_, pic_height_, offset_buf_, blk_size_, y_uv_hscale_, y_uv_vscale_, - max_val_, shift_bits_ -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif - ); + max_val_, shift_bits_, 0); ASM_REGISTER_STATE_CHECK(params_.tst_func( src_y_, dst_tst_, src_cls0_, src_cls1_, src_y_stride_, dst_stride_, ccso_stride_, 0, 0, pic_width_, pic_height_, offset_buf_, blk_size_, - y_uv_hscale_, y_uv_vscale_, max_val_, shift_bits_ -#if CONFIG_CCSO_BO_ONLY_OPTION - , - 0 -#endif - )); + y_uv_hscale_, y_uv_vscale_, max_val_, shift_bits_, 0)); for (int r = 0; r < blk_size_; ++r) { for (int c = 0; c < blk_size_; ++c) { @@ -264,12 +223,8 @@ const int pic_width, const int pic_height, const int y_uv_hscale, const int y_uv_vscale, const int thr, const int neg_thr, - const int *src_loc, const int blk_size -#if CONFIG_CCSO_EDGE_CLF - , - const int edge_clf -#endif -); + const int *src_loc, const int blk_size, + const int edge_clf); typedef libaom_test::FuncParam<CCSO_Derive_Src> TestFuncsCCSO_Derive_Src; class CCSODeriveSrcTest : public CCSOFilterTest<CCSO_Derive_Src> { @@ -278,22 +233,13 @@ ccso_stride_ = src_y_stride_ - (CCSO_PADDING_SIZE << 1); params_.ref_func(src_y_, src_cls0_ref, src_cls1_ref, src_y_stride_, ccso_stride_, 0, 0, pic_width_, pic_height_, y_uv_hscale_, - y_uv_vscale_, thr_, neg_thr_, src_loc_, blk_size_ -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf_ -#endif - ); + y_uv_vscale_, thr_, neg_thr_, src_loc_, blk_size_, + edge_clf_); ASM_REGISTER_STATE_CHECK(params_.tst_func( src_y_, src_cls0_tst, src_cls1_tst, src_y_stride_, ccso_stride_, 0, 0, pic_width_, pic_height_, y_uv_hscale_, y_uv_vscale_, thr_, neg_thr_, - src_loc_, blk_size_ -#if CONFIG_CCSO_EDGE_CLF - , - edge_clf_ -#endif - )); + src_loc_, blk_size_, edge_clf_)); for (int r = 0; r < blk_size_; ++r) { for (int c = 0; c < blk_size_; ++c) {
diff --git a/tools/aom_entropy_optimizer.c b/tools/aom_entropy_optimizer.c index 65a8e36..87721d2 100644 --- a/tools/aom_entropy_optimizer.c +++ b/tools/aom_entropy_optimizer.c
@@ -1779,7 +1779,6 @@ "default_filter_intra_mode_cdf[CDF_SIZE(FILTER_INTRA_MODES)]", 0, &total_count, 0, mem_wanted, "Intra"); -#if CONFIG_CCSO_EXT #if CONFIG_ENTROPY_PARA cts_each_dim[0] = 3; cts_each_dim[1] = 2; @@ -1794,7 +1793,6 @@ "default_ccso_cdf[2]", 0, &total_count, 0, mem_wanted, "Intra"); #endif -#endif cts_each_dim[0] = MAX_LR_FLEX_SWITCHABLE_BITS; cts_each_dim[1] = MAX_MB_PLANE;