Ccso filter size fix
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 5f8a3ac..a4f7c7f 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c
@@ -1824,7 +1824,8 @@ #else part_cfg->enable_1to4_partitions = extra_cfg->enable_1to4_partitions; #endif // CONFIG_EXT_RECUR_PARTITIONS - part_cfg->enable_sdp = extra_cfg->enable_sdp; + part_cfg->enable_sdp = + tool_cfg->enable_monochrome ? 0 : extra_cfg->enable_sdp; #if CONFIG_EXT_RECUR_PARTITIONS part_cfg->erp_pruning_level = extra_cfg->erp_pruning_level; part_cfg->use_ml_erp_pruning = extra_cfg->use_ml_erp_pruning;
diff --git a/av1/common/av1_common_int.h b/av1/common/av1_common_int.h index dcc4222..5ae1461 100644 --- a/av1/common/av1_common_int.h +++ b/av1/common/av1_common_int.h
@@ -2245,12 +2245,21 @@ if (buf->ccso_info.sb_filter_control[pli]) { aom_free(buf->ccso_info.sb_filter_control[pli]); } +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size_y = + pli == 0 ? CCSO_BLK_SIZE + : CCSO_BLK_SIZE - cm->seq_params.subsampling_y; + const int log2_filter_unit_size_x = + pli == 0 ? CCSO_BLK_SIZE + : CCSO_BLK_SIZE - cm->seq_params.subsampling_x; +#else const int log2_filter_unit_size_y = pli > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + cm->seq_params.subsampling_y; const int log2_filter_unit_size_x = pli > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + cm->seq_params.subsampling_x; +#endif // CONFIG_CCSO_FU_BUGFIX const int ccso_nvfb = ((cm->mi_params.mi_rows >> (pli ? cm->seq_params.subsampling_y : 0)) +
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index c921e37..5c133fc 100644 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl
@@ -616,31 +616,63 @@ } # Cross-component Sample Offset -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"; +if (aom_config("CONFIG_CCSO_FU_BUGFIX") 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_x, const int blk_size_y, 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, const uint8_t ccso_bo_only"; +} specialize qw/ccso_filter_block_hbd_wo_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/; + if (aom_config("CONFIG_CCSO_FU_BUGFIX") 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_x, + const int blk_size_y, + 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/void ccso_filter_block_hbd_with_buf_bo_only/, "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_bo_only avx2/; + add_proto qw/void ccso_filter_block_hbd_with_buf_bo_only/, "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_x, + const int blk_size_y, + 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_bo_only avx2/; + } + 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, + const uint8_t ccso_bo_only"; + specialize qw/ccso_filter_block_hbd_with_buf avx2/; + + add_proto qw/void ccso_filter_block_hbd_with_buf_bo_only/, "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_bo_only 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, @@ -648,12 +680,23 @@ const int width"; specialize qw/compute_distortion_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/ + if (aom_config("CONFIG_CCSO_FU_BUGFIX") 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_x, + const int blk_size_y, const int edge_clf"; + specialize qw/ccso_derive_src_block avx2/ + } + 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, const int edge_clf"; + specialize qw/ccso_derive_src_block avx2/ + } } # WARPED_MOTION / GLOBAL_MOTION functions
diff --git a/av1/common/ccso.c b/av1/common/ccso.c index a5c148e..3eac4a5 100644 --- a/av1/common/ccso.c +++ b/av1/common/ccso.c
@@ -150,10 +150,20 @@ 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, - const int edge_clf, const uint8_t ccso_bo_only) { +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + const bool isSingleBand, const uint8_t shift_bits, const int edge_clf, + const uint8_t ccso_bo_only) { +#if CONFIG_CCSO_FU_BUGFIX + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); +#else const int y_end = AOMMIN(pic_height - y, blk_size); const int x_end = AOMMIN(pic_width - x, blk_size); +#endif // CONFIG_CCSO_FU_BUGFIX 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++) { @@ -202,30 +212,48 @@ const int neg_thr = thr * -1; int src_loc[2]; derive_ccso_sample_pos(cm, src_loc, ccso_ext_stride, filter_sup); +#if CONFIG_CCSO_FU_BUGFIX + assert(plane == 0); // function must only be called for plane == 0 + const int blk_log2 = CCSO_BLK_SIZE; +#else const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; +#endif // CONFIG_CCSO_FU_BUGFIX const int blk_size = 1 << blk_log2; src_y += CCSO_PADDING_SIZE * ccso_ext_stride + 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_FU_BUGFIX + const int ccso_blk_idx = + (blk_size >> MI_SIZE_LOG2) * (y >> blk_log2) * mi_params->mi_stride + + (blk_size >> MI_SIZE_LOG2) * (x >> blk_log2); +#else const int ccso_blk_idx = (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * (y >> blk_log2) * mi_params->mi_stride + (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * (x >> blk_log2); +#endif // CONFIG_CCSO_FU_BUGFIX const bool use_ccso = mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_y; if (!use_ccso) continue; 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, - edge_clf, cm->ccso_info.ccso_bo_only[plane]); + 0, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size, false, shift_bits, edge_clf, + cm->ccso_info.ccso_bo_only[plane]); } else { 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, - edge_clf, 0); + 0, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size, false, shift_bits, edge_clf, 0); } } dst_yuv += (dst_stride << blk_log2); @@ -256,30 +284,48 @@ const int neg_thr = thr * -1; int src_loc[2]; derive_ccso_sample_pos(cm, src_loc, ccso_ext_stride, filter_sup); +#if CONFIG_CCSO_FU_BUGFIX + assert(plane == 0); // function must only be called for plane == 0 + const int blk_log2 = CCSO_BLK_SIZE; +#else const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; +#endif // CONFIG_CCSO_FU_BUGFIX const int blk_size = 1 << blk_log2; src_y += CCSO_PADDING_SIZE * ccso_ext_stride + 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_FU_BUGFIX + const int ccso_blk_idx = + (blk_size >> MI_SIZE_LOG2) * (y >> blk_log2) * mi_params->mi_stride + + (blk_size >> MI_SIZE_LOG2) * (x >> blk_log2); +#else const int ccso_blk_idx = (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * (y >> blk_log2) * mi_params->mi_stride + (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * (x >> blk_log2); +#endif // CONFIG_CCSO_FU_BUGFIX const bool use_ccso = mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_y; if (!use_ccso) continue; 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, - edge_clf, cm->ccso_info.ccso_bo_only[plane]); + 0, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size, true, shift_bits, edge_clf, + cm->ccso_info.ccso_bo_only[plane]); } else { 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, - edge_clf, 0); + 0, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size, true, shift_bits, edge_clf, 0); } } dst_yuv += (dst_stride << blk_log2); @@ -311,16 +357,32 @@ const int neg_thr = thr * -1; int src_loc[2]; derive_ccso_sample_pos(cm, src_loc, ccso_ext_stride, filter_sup); - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + assert(plane > 0); // function must only be called for plane > 0 + const int blk_size = 1 << CCSO_BLK_SIZE; + const int blk_log2_y = CCSO_BLK_SIZE - cm->seq_params.subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - cm->seq_params.subsampling_x; + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = blk_size_x; +#endif // CONFIG_CCSO_FU_BUGFIX src_y += CCSO_PADDING_SIZE * ccso_ext_stride + CCSO_PADDING_SIZE; - for (int y = 0; y < pic_height; y += blk_size) { - for (int x = 0; x < pic_width; x += blk_size) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { +#if CONFIG_CCSO_FU_BUGFIX + const int ccso_blk_idx = (blk_size >> MI_SIZE_LOG2) * (y >> blk_log2_y) * + mi_params->mi_stride + + (blk_size >> MI_SIZE_LOG2) * (x >> blk_log2_x); +#else const int ccso_blk_idx = - (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * - (y >> blk_log2) * mi_params->mi_stride + - (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * - (x >> blk_log2); + (blk_size_y >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * + (y >> blk_log2_y) * mi_params->mi_stride + + (blk_size_x >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * + (x >> blk_log2_y); +#endif // CONFIG_CCSO_FU_BUGFIX const bool use_ccso = (plane == 1) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_u : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; @@ -329,18 +391,25 @@ 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, edge_clf, cm->ccso_info.ccso_bo_only[plane]); + y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, false, shift_bits, edge_clf, + cm->ccso_info.ccso_bo_only[plane]); } else { 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, edge_clf, 0); + y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, false, shift_bits, edge_clf, 0); } } - dst_yuv += (dst_stride << blk_log2); - src_y += (ccso_ext_stride << (blk_log2 + y_uv_vscale)); + dst_yuv += (dst_stride << blk_log2_y); + src_y += (ccso_ext_stride << (blk_log2_y + y_uv_vscale)); } } @@ -369,16 +438,32 @@ const int neg_thr = thr * -1; int src_loc[2]; derive_ccso_sample_pos(cm, src_loc, ccso_ext_stride, filter_sup); - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + assert(plane > 0); // function must only be called for plane > 0 + const int blk_size = 1 << CCSO_BLK_SIZE; + const int blk_log2_y = CCSO_BLK_SIZE - cm->seq_params.subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - cm->seq_params.subsampling_x; + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = blk_size_x; +#endif // CONFIG_CCSO_FU_BUGFIX src_y += CCSO_PADDING_SIZE * ccso_ext_stride + CCSO_PADDING_SIZE; - for (int y = 0; y < pic_height; y += blk_size) { - for (int x = 0; x < pic_width; x += blk_size) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { +#if CONFIG_CCSO_FU_BUGFIX + const int ccso_blk_idx = (blk_size >> MI_SIZE_LOG2) * (y >> blk_log2_y) * + mi_params->mi_stride + + (blk_size >> MI_SIZE_LOG2) * (x >> blk_log2_x); +#else const int ccso_blk_idx = - (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * - (y >> blk_log2) * mi_params->mi_stride + - (blk_size >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * - (x >> blk_log2); + (blk_size_y >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_y)) * + (y >> blk_log2_y) * mi_params->mi_stride + + (blk_size_x >> (MI_SIZE_LOG2 - xd->plane[plane].subsampling_x)) * + (x >> blk_log2_y); +#endif // CONFIG_CCSO_FU_BUGFIX const bool use_ccso = (plane == 1) ? mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_u : mi_params->mi_grid_base[ccso_blk_idx]->ccso_blk_v; @@ -387,18 +472,25 @@ 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, edge_clf, cm->ccso_info.ccso_bo_only[plane]); + y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, true, shift_bits, edge_clf, + cm->ccso_info.ccso_bo_only[plane]); } else { 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, edge_clf, 0); + y_uv_hscale, y_uv_vscale, thr, neg_thr, src_loc, max_val, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, true, shift_bits, edge_clf, 0); } } - dst_yuv += (dst_stride << blk_log2); - src_y += (ccso_ext_stride << (blk_log2 + y_uv_vscale)); + dst_yuv += (dst_stride << blk_log2_y); + src_y += (ccso_ext_stride << (blk_log2_y + y_uv_vscale)); } } @@ -465,4 +557,4 @@ to->ccso_enable[plane] = from->ccso_enable[plane]; } -#endif // CONFIG_CCSO_IMPROVE \ No newline at end of file +#endif // CONFIG_CCSO_IMPROVE
diff --git a/av1/common/enums.h b/av1/common/enums.h index a4046cd..39d2c9b 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h
@@ -131,11 +131,13 @@ #define IBP_WEIGHT_SIZE (1 << IBP_WEIGHT_SIZE_LOG2) #endif // CONFIG_IBP_WEIGHT +#if !CONFIG_CCSO_FU_BUGFIX // Cross-Component Sample Offset (CCSO) #define CCSO_BLK_SIZE 7 #define CCSO_PADDING_SIZE 5 #define CCSO_BAND_NUM 128 #define CCSO_NUM_COMPONENTS 3 +#endif // !CONFIG_CCSO_FU_BUGFIX #define BUGFIX_AMVD_AMVR 1 // Supported scale modes for JOINT_NEWMV @@ -153,6 +155,14 @@ #define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE) #define BLOCK_128_MI_SIZE_LOG2 5 +#if CONFIG_CCSO_FU_BUGFIX +// Cross-Component Sample Offset (CCSO) +#define CCSO_BLK_SIZE MAX_SB_SIZE_LOG2 +#define CCSO_PADDING_SIZE 5 +#define CCSO_BAND_NUM 128 +#define CCSO_NUM_COMPONENTS 3 +#endif // CONFIG_CCSO_FU_BUGFIX + #if CONFIG_ENABLE_MHCCP #define MHCCP_CONTEXT_GROUP_SIZE 7 #define LINE_NUM 3
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c index 02922f8..93c2afa 100644 --- a/av1/common/pred_common.c +++ b/av1/common/pred_common.c
@@ -523,10 +523,15 @@ bool av1_check_ccso_mbmi_inside_tile(const MACROBLOCKD *xd, const MB_MODE_INFO *const mbmi) { const TileInfo *const tile = &xd->tile; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX return (((mbmi->mi_row_start & ~blk_size_y) >= tile->mi_row_start) && ((mbmi->mi_col_start & ~blk_size_x) >= tile->mi_col_start) && @@ -558,10 +563,15 @@ neighbor1_ccso_available = av1_check_ccso_mbmi_inside_tile(xd, neighbor1); } +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX if (neighbor0_ccso_available && neighbor1_ccso_available) { int is_neighbor0_ccso = 0;
diff --git a/av1/common/x86/highbd_ccso_avx2.c b/av1/common/x86/highbd_ccso_avx2.c index 9c2ac24..35c0001 100644 --- a/av1/common/x86/highbd_ccso_avx2.c +++ b/av1/common/x86/highbd_ccso_avx2.c
@@ -51,8 +51,14 @@ const int y_uv_vscale, // 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, const int edge_clf, const uint8_t ccso_bo_only) { + const int max_val, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + const bool isSingleBand, const uint8_t shift_bits, const int edge_clf, + const uint8_t ccso_bo_only) { assert(ccso_bo_only == 0); (void)ccso_bo_only; __m256i cmp_thr1 = _mm256_set1_epi16(quant_step_size); @@ -82,16 +88,22 @@ int y_offset; int x_offset, x_remainder; - if (y + blk_size >= pic_height) + +#if !CONFIG_CCSO_FU_BUGFIX + const int blk_size_x = blk_size; + const int blk_size_y = blk_size; +#endif // !CONFIG_CCSO_FU_BUGFIX + + if (y + blk_size_y >= pic_height) y_offset = pic_height - y; else - y_offset = blk_size; + y_offset = blk_size_y; - if (x + blk_size >= pic_width) { + if (x + blk_size_x >= pic_width) { x_offset = ((pic_width - x) >> 4) << 4; x_remainder = pic_width - x - x_offset; } else { - x_offset = blk_size; + x_offset = blk_size_x; x_remainder = 0; } for (int yOff = 0; yOff < y_offset; yOff++) { @@ -245,7 +257,12 @@ 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 *src_loc, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX const int edge_clf) { const int quant_step_size = qstep; const int inv_quant_step = neg_qstep; @@ -275,16 +292,22 @@ int y_offset; int x_offset, x_remainder; - if (y + blk_size >= pic_height) + +#if !CONFIG_CCSO_FU_BUGFIX + const int blk_size_x = blk_size; + const int blk_size_y = blk_size; +#endif // !CONFIG_CCSO_FU_BUGFIX + + if (y + blk_size_y >= pic_height) y_offset = pic_height - y; else - y_offset = blk_size; + y_offset = blk_size_y; - if (x + blk_size >= pic_width) { + if (x + blk_size_x >= pic_width) { x_offset = ((pic_width - x) >> 4) << 4; x_remainder = pic_width - x - x_offset; } else { - x_offset = blk_size; + x_offset = blk_size_x; x_remainder = 0; } for (int yOff = 0; yOff < y_offset; yOff++) { @@ -421,7 +444,12 @@ const uint16_t *src_y, uint16_t *dts_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 pic_height, const int8_t *filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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) { (void)ccso_bo_only; @@ -440,16 +468,22 @@ int y_offset; int x_offset, x_remainder; - if (y + blk_size >= pic_height) + +#if !CONFIG_CCSO_FU_BUGFIX + const int blk_size_x = blk_size; + const int blk_size_y = blk_size; +#endif // !CONFIG_CCSO_FU_BUGFIX + + if (y + blk_size_y >= pic_height) y_offset = pic_height - y; else - y_offset = blk_size; + y_offset = blk_size_y; - if (x + blk_size >= pic_width) { + if (x + blk_size_x >= pic_width) { x_offset = ((pic_width - x) >> 4) << 4; x_remainder = pic_width - x - x_offset; } else { - x_offset = blk_size; + x_offset = blk_size_x; x_remainder = 0; } for (int yOff = 0; yOff < y_offset; yOff++) { @@ -528,7 +562,12 @@ const uint16_t *src_y, uint16_t *dts_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 pic_height, const int8_t *filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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) { (void)ccso_bo_only; @@ -547,16 +586,22 @@ int y_offset; int x_offset, x_remainder; - if (y + blk_size >= pic_height) + +#if !CONFIG_CCSO_FU_BUGFIX + const int blk_size_x = blk_size; + const int blk_size_y = blk_size; +#endif // !CONFIG_CCSO_FU_BUGFIX + + if (y + blk_size_y >= pic_height) y_offset = pic_height - y; else - y_offset = blk_size; + y_offset = blk_size_y; - if (x + blk_size >= pic_width) { + if (x + blk_size_x >= pic_width) { x_offset = ((pic_width - x) >> 4) << 4; x_remainder = pic_width - x - x_offset; } else { - x_offset = blk_size; + x_offset = blk_size_x; x_remainder = 0; } for (int yOff = 0; yOff < y_offset; yOff++) {
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 4031ec1..ac26c3e 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -6908,7 +6908,7 @@ #if CONFIG_SAME_REF_COMPOUND seq_params->num_same_ref_compound = aom_rb_read_literal(rb, 2); #endif // CONFIG_SAME_REF_COMPOUND - seq_params->enable_sdp = aom_rb_read_bit(rb); + seq_params->enable_sdp = seq_params->monochrome ? 0 : aom_rb_read_bit(rb); seq_params->enable_ist = aom_rb_read_bit(rb); seq_params->enable_inter_ist = aom_rb_read_bit(rb); #if CONFIG_CHROMA_TX
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 19efb9b..20c1eed 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -154,8 +154,13 @@ const BLOCK_SIZE bsize = xd->mi[0]->sb_type[PLANE_TYPE_Y]; const int bw = mi_size_wide[bsize]; const int bh = mi_size_high[bsize]; +#if CONFIG_CCSO_FU_BUGFIX + const int log2_w = CCSO_BLK_SIZE; + const int log2_h = CCSO_BLK_SIZE; +#else const int log2_w = CCSO_BLK_SIZE + xd->plane[1].subsampling_x; const int log2_h = CCSO_BLK_SIZE + xd->plane[1].subsampling_y; +#endif // CONFIG_CCSO_FU_BUGFIX const int f_w = 1 << log2_w >> MI_SIZE_LOG2; const int f_h = 1 << log2_h >> MI_SIZE_LOG2; const int ccso_nhfb = (mi_params->mi_cols + f_w - 1) / f_w; @@ -175,18 +180,27 @@ const CommonModeInfoParams *const mi_params = &cm->mi_params; const int mi_row = xd->mi_row; const int mi_col = xd->mi_col; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX #if CONFIG_CCSO_IMPROVE int blk_idc; #endif if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && cm->ccso_info.ccso_enable[0]) { #if CONFIG_CCSO_IMPROVE +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size = CCSO_BLK_SIZE; +#else const int log2_filter_unit_size = CCSO_BLK_SIZE + xd->plane[1].subsampling_x; +#endif // CONFIG_CCSO_FU_BUGFIX const int ccso_nhfb = ((mi_params->mi_cols >> xd->plane[0].subsampling_x) + (1 << log2_filter_unit_size >> 2) - 1) / (1 << log2_filter_unit_size >> 2); @@ -227,7 +241,12 @@ if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && cm->ccso_info.ccso_enable[1]) { #if CONFIG_CCSO_IMPROVE +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size = + (CCSO_BLK_SIZE - xd->plane[1].subsampling_x); +#else const int log2_filter_unit_size = CCSO_BLK_SIZE; +#endif // CONFIG_CCSO_FU_BUGFIX const int ccso_nhfb = ((mi_params->mi_cols >> xd->plane[1].subsampling_x) + (1 << log2_filter_unit_size >> 2) - 1) / (1 << log2_filter_unit_size >> 2); @@ -268,7 +287,12 @@ if (!(mi_row & blk_size_y) && !(mi_col & blk_size_x) && cm->ccso_info.ccso_enable[2]) { #if CONFIG_CCSO_IMPROVE +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size = + (CCSO_BLK_SIZE - xd->plane[2].subsampling_x); +#else const int log2_filter_unit_size = CCSO_BLK_SIZE; +#endif // CONFIG_CCSO_FU_BUGFIX const int ccso_nhfb = ((mi_params->mi_cols >> xd->plane[2].subsampling_x) + (1 << log2_filter_unit_size >> 2) - 1) / (1 << log2_filter_unit_size >> 2);
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index a80b11a..00a4f82 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -2052,10 +2052,15 @@ const CommonModeInfoParams *const mi_params = &cm->mi_params; const int mi_row = xd->mi_row; const int mi_col = xd->mi_col; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX const MB_MODE_INFO *mbmi = mi_params->mi_grid_base[(mi_row & ~blk_size_y) * mi_params->mi_stride + (mi_col & ~blk_size_x)]; @@ -6104,7 +6109,7 @@ #if CONFIG_SAME_REF_COMPOUND aom_wb_write_literal(wb, seq_params->num_same_ref_compound, 2); #endif // CONFIG_SAME_REF_COMPOUND - aom_wb_write_bit(wb, seq_params->enable_sdp); + if (!seq_params->monochrome) aom_wb_write_bit(wb, seq_params->enable_sdp); aom_wb_write_bit(wb, seq_params->enable_ist); aom_wb_write_bit(wb, seq_params->enable_inter_ist); #if CONFIG_CHROMA_TX
diff --git a/av1/encoder/pickccso.c b/av1/encoder/pickccso.c index 3dddb31..981ef2e 100644 --- a/av1/encoder/pickccso.c +++ b/av1/encoder/pickccso.c
@@ -75,11 +75,17 @@ 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) { + const int *src_loc, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + const int blk_size_y, 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); +#if !CONFIG_CCSO_FU_BUGFIX + const int blk_size_x = blk_size_y; +#endif // !CONFIG_CCSO_FU_BUGFIX + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); 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++) { @@ -114,19 +120,29 @@ const int neg_qstep = qstep * -1; int src_loc[2]; derive_ccso_sample_pos(cm, src_loc, ccso_stride_ext, filter_sup); - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2_y = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_log2_x = blk_log2_y; +#endif // CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; 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) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { 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, edge_clf); +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, edge_clf); } - src_y += (ccso_stride_ext << (blk_log2 + y_uv_vscale)); - src_cls0 += (ccso_stride << (blk_log2 + y_uv_vscale)); - src_cls1 += (ccso_stride << (blk_log2 + y_uv_vscale)); + src_y += (ccso_stride_ext << (blk_log2_y + y_uv_vscale)); + src_cls0 += (ccso_stride << (blk_log2_y + y_uv_vscale)); + src_cls1 += (ccso_stride << (blk_log2_y + y_uv_vscale)); } } @@ -144,16 +160,23 @@ int fb_idx = 0; uint8_t cur_src_cls0; uint8_t cur_src_cls1; - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2_y = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_log2_x = blk_log2_y; +#endif // CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; const int scaled_ext_stride = (ctx->ccso_stride_ext << y_uv_vscale); const int scaled_stride = (ctx->ccso_stride << y_uv_vscale); src_y += CCSO_PADDING_SIZE * ctx->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) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { fb_idx++; - const int y_end = AOMMIN(pic_height - y, blk_size); - const int x_end = AOMMIN(pic_width - x, blk_size); + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); for (int y_start = 0; y_start < y_end; y_start++) { for (int x_start = 0; x_start < x_end; x_start++) { const int x_pos = x + x_start; @@ -177,11 +200,11 @@ src_cls0 -= scaled_stride * y_end; src_cls1 -= scaled_stride * y_end; } - ref += (ctx->ccso_stride << blk_log2); - dst += (ctx->ccso_stride << blk_log2); - src_y += (ctx->ccso_stride_ext << (blk_log2 + y_uv_vscale)); - src_cls0 += (ctx->ccso_stride << (blk_log2 + y_uv_vscale)); - src_cls1 += (ctx->ccso_stride << (blk_log2 + y_uv_vscale)); + ref += (ctx->ccso_stride << blk_log2_y); + dst += (ctx->ccso_stride << blk_log2_y); + src_y += (ctx->ccso_stride_ext << (blk_log2_y + y_uv_vscale)); + src_cls0 += (ctx->ccso_stride << (blk_log2_y + y_uv_vscale)); + src_cls1 += (ctx->ccso_stride << (blk_log2_y + y_uv_vscale)); } } @@ -194,15 +217,22 @@ const int y_uv_hscale = xd->plane[plane].subsampling_x; const int y_uv_vscale = xd->plane[plane].subsampling_y; int fb_idx = 0; - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2_y = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_log2_x = blk_log2_y; +#endif // CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; const int scaled_ext_stride = (ctx->ccso_stride_ext << y_uv_vscale); src_y += CCSO_PADDING_SIZE * ctx->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) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { fb_idx++; - const int y_end = AOMMIN(pic_height - y, blk_size); - const int x_end = AOMMIN(pic_width - x, blk_size); + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); for (int y_start = 0; y_start < y_end; y_start++) { for (int x_start = 0; x_start < x_end; x_start++) { const int x_pos = x + x_start; @@ -219,9 +249,9 @@ dst -= ctx->ccso_stride * y_end; src_y -= scaled_ext_stride * y_end; } - ref += (ctx->ccso_stride << blk_log2); - dst += (ctx->ccso_stride << blk_log2); - src_y += (ctx->ccso_stride_ext << (blk_log2 + y_uv_vscale)); + ref += (ctx->ccso_stride << blk_log2_y); + dst += (ctx->ccso_stride << blk_log2_y); + src_y += (ctx->ccso_stride_ext << (blk_log2_y + y_uv_vscale)); } } @@ -230,7 +260,12 @@ 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 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 pic_height, const int8_t *filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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) { assert(ccso_bo_only == 1); @@ -242,8 +277,13 @@ int cur_src_cls0; int cur_src_cls1; +#if CONFIG_CCSO_FU_BUGFIX + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); +#else const int y_end = AOMMIN(pic_height - y, blk_size); const int x_end = AOMMIN(pic_width - x, blk_size); +#endif // CONFIG_CCSO_FU_BUGFIX 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++) { @@ -266,7 +306,12 @@ 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 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 pic_height, const int8_t *filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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) { if (ccso_bo_only) { @@ -275,8 +320,13 @@ } int cur_src_cls0; int cur_src_cls1; +#if CONFIG_CCSO_FU_BUGFIX + const int y_end = AOMMIN(pic_height - y, blk_size_y); + const int x_end = AOMMIN(pic_width - x, blk_size_x); +#else const int y_end = AOMMIN(pic_height - y, blk_size); const int x_end = AOMMIN(pic_width - x, blk_size); +#endif // CONFIG_CCSO_FU_BUGFIX 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++) { @@ -311,7 +361,11 @@ 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; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2 = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; +#else const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; +#endif // CONFIG_CCSO_FU_BUGFIX const int blk_size = 1 << blk_log2; src_y += CCSO_PADDING_SIZE * ccso_stride_ext + CCSO_PADDING_SIZE; for (int y = 0; y < pic_height; y += blk_size) { @@ -324,13 +378,19 @@ #endif // CONFIG_CCSO_IMPROVE 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 +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + // y_uv_scale in h and v shall be zero 0, 0, max_val, shift_bits, ccso_bo_only); } else { 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 +#if CONFIG_CCSO_FU_BUGFIX + blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX + // y_uv_scale in h and v shall be zero 0, 0, max_val, shift_bits, 0); } } @@ -352,11 +412,18 @@ const int y_uv_hscale = xd->plane[plane].subsampling_x; const int y_uv_vscale = xd->plane[plane].subsampling_y; const int max_val = (1 << cm->seq_params.bit_depth) - 1; - const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; - const int blk_size = 1 << blk_log2; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2_y = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; + const int blk_log2_x = CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else + const int blk_log2_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; + const int blk_log2_x = blk_log2_y; +#endif // CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = 1 << blk_log2_y; + const int blk_size_x = 1 << blk_log2_x; 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) { + for (int y = 0; y < pic_height; y += blk_size_y) { + for (int x = 0; x < pic_width; x += blk_size_x) { if (ccso_bo_only) { #if CONFIG_CCSO_IMPROVE ccso_filter_block_hbd_with_buf_bo_only( @@ -364,19 +431,26 @@ ccso_filter_block_hbd_with_buf_c( #endif // CONFIG_CCSO_IMPROVE 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); + ccso_stride, x, y, pic_width, pic_height, filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, y_uv_hscale, y_uv_vscale, max_val, shift_bits, + ccso_bo_only); } else { 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, 0); + ccso_stride, x, y, pic_width, pic_height, filter_offset, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_x, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_y, y_uv_hscale, y_uv_vscale, max_val, shift_bits, 0); } } - dst_yuv += (dst_stride << blk_log2); - src_y += (ccso_stride_ext << (blk_log2 + y_uv_vscale)); - src_cls0 += (ccso_stride << (blk_log2 + y_uv_vscale)); - src_cls1 += (ccso_stride << (blk_log2 + y_uv_vscale)); + dst_yuv += (dst_stride << blk_log2_y); + src_y += (ccso_stride_ext << (blk_log2_y + y_uv_vscale)); + src_cls0 += (ccso_stride << (blk_log2_y + y_uv_vscale)); + src_cls1 += (ccso_stride << (blk_log2_y + y_uv_vscale)); } } @@ -484,9 +558,14 @@ uint64_t *cur_total_dist, int *cur_total_rate, bool *filter_enable, const int rdmult) { aom_cdf_prob ccso_cdf[CCSO_CONTEXT][CDF_SIZE(2)]; +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size = + CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else const int log2_filter_unit_size = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + xd->plane[1].subsampling_x; ; +#endif // CONFIG_CCSO_FU_BUGFIX const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_nhfb = ((mi_params->mi_cols >> xd->plane[plane].subsampling_x) + @@ -499,10 +578,15 @@ const int tile_cols = tiles->cols; const int tile_rows = tiles->rows; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX *cur_total_dist = 0; @@ -590,9 +674,14 @@ bool *filter_enable, const int rdmult) { (void)rdmult; +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size = + CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else const int log2_filter_unit_size = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + xd->plane[1].subsampling_x; ; +#endif // CONFIG_CCSO_FU_BUGFIX const CommonModeInfoParams *const mi_params = &cm->mi_params; const int ccso_nhfb = ((mi_params->mi_cols >> xd->plane[plane].subsampling_x) + @@ -605,10 +694,15 @@ const int tile_cols = tiles->cols; const int tile_rows = tiles->rows; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; + const int blk_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)) - 1; +#else const int blk_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)) - 1; const int blk_size_x = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_x - MI_SIZE_LOG2)) - 1; +#endif // CONFIG_CCSO_FU_BUGFIX *cur_total_dist = 0; *cur_total_rate = 0; @@ -724,7 +818,11 @@ const int max_edge_interval, const uint8_t ccso_bo_only) { const CommonModeInfoParams *const mi_params = &cm->mi_params; +#if CONFIG_CCSO_FU_BUGFIX + const int blk_log2 = CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; +#else const int blk_log2 = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + 1; +#endif // CONFIG_CCSO_FU_BUGFIX const int nvfb = ((mi_params->mi_rows >> xd->plane[plane].subsampling_y) + (1 << blk_log2 >> MI_SIZE_LOG2) - 1) / (1 << blk_log2 >> MI_SIZE_LOG2); @@ -879,10 +977,17 @@ #endif ) { const CommonModeInfoParams *const mi_params = &cm->mi_params; +#if CONFIG_CCSO_FU_BUGFIX + const int log2_filter_unit_size_y = + CCSO_BLK_SIZE - xd->plane[plane].subsampling_y; + const int log2_filter_unit_size_x = + CCSO_BLK_SIZE - xd->plane[plane].subsampling_x; +#else const int log2_filter_unit_size_y = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + xd->plane[1].subsampling_y; const int log2_filter_unit_size_x = plane > 0 ? CCSO_BLK_SIZE : CCSO_BLK_SIZE + xd->plane[1].subsampling_x; +#endif // CONFIG_CCSO_FU_BUGFIX const int ccso_nvfb = ((mi_params->mi_rows >> xd->plane[plane].subsampling_y) + @@ -1458,8 +1563,13 @@ const BLOCK_SIZE bsize = xd->mi[0]->sb_type[PLANE_TYPE_Y]; const int bw = mi_size_wide[bsize]; const int bh = mi_size_high[bsize]; +#if CONFIG_CCSO_FU_BUGFIX + const int log2_w = CCSO_BLK_SIZE; + const int log2_h = CCSO_BLK_SIZE; +#else const int log2_w = CCSO_BLK_SIZE + xd->plane[1].subsampling_x; const int log2_h = CCSO_BLK_SIZE + xd->plane[1].subsampling_y; +#endif // CONFIG_CCSO_FU_BUGFIX const int f_w = 1 << log2_w >> MI_SIZE_LOG2; const int f_h = 1 << log2_h >> MI_SIZE_LOG2; const int step_h = (bh + f_h - 1) / f_h; @@ -1476,41 +1586,64 @@ cm->cur_frame->ccso_info.sb_filter_control[plane][sb_idx] = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; #endif // CONFIG_CCSO_IMPROVE +#if CONFIG_CCSO_FU_BUGFIX + const int grid_idx_mbmi = + (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * row * + mi_params->mi_stride + + (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * col; + MB_MODE_INFO *const mbmi = mi_params->mi_grid_base[grid_idx_mbmi]; +#endif // CONFIG_CCSO_FU_BUGFIX if (plane == AOM_PLANE_Y) { - mi_params - ->mi_grid_base - [(1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * - row * mi_params->mi_stride + - (1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * - col] - ->ccso_blk_y = +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_y = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#else + mi_params + ->mi_grid_base[(1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * + row * mi_params->mi_stride + + (1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * + col] + ->ccso_blk_y = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } else if (plane == AOM_PLANE_U) { - mi_params - ->mi_grid_base - [(1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * - row * mi_params->mi_stride + - (1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * - col] - ->ccso_blk_u = +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_u = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#else + mi_params + ->mi_grid_base[(1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * + row * mi_params->mi_stride + + (1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * + col] + ->ccso_blk_u = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } else { - mi_params - ->mi_grid_base - [(1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[2].subsampling_y)) * - row * mi_params->mi_stride + - (1 << CCSO_BLK_SIZE >> - (MI_SIZE_LOG2 - xd->plane[2].subsampling_x)) * - col] - ->ccso_blk_v = +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_v = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#else + mi_params + ->mi_grid_base[(1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[2].subsampling_y)) * + row * mi_params->mi_stride + + (1 << CCSO_BLK_SIZE >> + (MI_SIZE_LOG2 - xd->plane[2].subsampling_x)) * + col] + ->ccso_blk_v = ctx->final_filter_control[y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } #if CONFIG_CCSO_IMPROVE +#if CONFIG_CCSO_FU_BUGFIX + const int ccso_mib_size_y = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)); + const int ccso_mib_size_x = (1 << (CCSO_BLK_SIZE - MI_SIZE_LOG2)); + + int mi_row = (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * row; + int mi_col = (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * col; +#else const int ccso_mib_size_y = (1 << (CCSO_BLK_SIZE + xd->plane[1].subsampling_y - MI_SIZE_LOG2)); @@ -1524,6 +1657,7 @@ int mi_col = (1 << CCSO_BLK_SIZE >> (MI_SIZE_LOG2 - xd->plane[1].subsampling_x)) * col; +#endif // CONFIG_CCSO_FU_BUGFIX for (int j = 0; j < AOMMIN(ccso_mib_size_y, cm->mi_params.mi_rows - mi_row); j++) { @@ -1572,7 +1706,18 @@ 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_FU_BUGFIX + const int grid_idx = (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * y_sb * + mi_params->mi_stride + + (1 << CCSO_BLK_SIZE >> MI_SIZE_LOG2) * x_sb; + MB_MODE_INFO *const mbmi = mi_params->mi_grid_base[grid_idx]; +#endif // CONFIG_CCSO_FU_BUGFIX if (plane == AOM_PLANE_Y) { +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_y = + ref_frame_ccso_info + ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#else mi_params ->mi_grid_base[(1 << CCSO_BLK_SIZE >> (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * @@ -1583,7 +1728,13 @@ ->ccso_blk_y = ref_frame_ccso_info ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } else if (plane == AOM_PLANE_U) { +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_u = + ref_frame_ccso_info + ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#else mi_params ->mi_grid_base[(1 << CCSO_BLK_SIZE >> (MI_SIZE_LOG2 - xd->plane[1].subsampling_y)) * @@ -1594,7 +1745,13 @@ ->ccso_blk_u = ref_frame_ccso_info ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } else { +#if CONFIG_CCSO_FU_BUGFIX + mbmi->ccso_blk_v = + ref_frame_ccso_info + ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#else mi_params ->mi_grid_base[(1 << CCSO_BLK_SIZE >> (MI_SIZE_LOG2 - xd->plane[2].subsampling_y)) * @@ -1605,6 +1762,7 @@ ->ccso_blk_v = ref_frame_ccso_info ->sb_filter_control[plane][y_sb * ccso_nhfb + x_sb]; +#endif // CONFIG_CCSO_FU_BUGFIX } } }
diff --git a/av1/encoder/trellis_quant.c b/av1/encoder/trellis_quant.c index e681dc6..e81bc63 100644 --- a/av1/encoder/trellis_quant.c +++ b/av1/encoder/trellis_quant.c
@@ -553,6 +553,8 @@ uint8_t next_mid_mag[32 + 8][TCQ_MAX_STATES]; uint8_t(*next_base)[TCQ_MAX_STATES] = &next_base_mag[4]; uint8_t(*next_mid)[TCQ_MAX_STATES] = &next_mid_mag[4]; + uint8_t(*mag_base)[TCQ_MAX_STATES] = &tcq_ctx->mag_base[4]; + uint8_t(*mag_mid)[TCQ_MAX_STATES] = &tcq_ctx->mag_mid[4]; int idx_start = col; int idx_end = 1 << bwl; @@ -566,11 +568,13 @@ } } else { for (int i = 0; i < 32; i++) { - next_base[i][st] = tcq_ctx->mag_base[i][orig_st]; - next_mid[i][st] = tcq_ctx->mag_mid[i][orig_st]; + next_base[i][st] = mag_base[i][orig_st]; + next_mid[i][st] = mag_mid[i][orig_st]; } } } + memset(next_base_mag, 0, sizeof(next_base_mag[0]) * 4); + memset(next_mid_mag, 0, sizeof(next_mid_mag[0]) * 4); memset(tcq_ctx->mag_base, 0, sizeof(tcq_ctx->mag_base)); memset(tcq_ctx->mag_mid, 0, sizeof(tcq_ctx->mag_mid)); int diag = row + col; @@ -591,11 +595,11 @@ next_mid[i - 1][st] += lev; // Update base positions {2, 0}, {1. 1}, {0, 2} int base2 = AOMMIN(lev, max2); - tcq_ctx->mag_base[i][st] += base2; - tcq_ctx->mag_base[i - 1][st] += base2; - tcq_ctx->mag_base[i - 2][st] += base2; + mag_base[i][st] += base2; + mag_base[i - 1][st] += base2; + mag_base[i - 2][st] += base2; // Update mid position {1, 1} - tcq_ctx->mag_mid[i - 1][st] = lev; + mag_mid[i - 1][st] = lev; } } // Calc next context info
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake index 9088e3a..468c697 100644 --- a/build/cmake/aom_config_defaults.cmake +++ b/build/cmake/aom_config_defaults.cmake
@@ -360,6 +360,7 @@ set_aom_config_var(CONFIG_PARTITION_CONTEXT_REDUCE 1 "Enable to reduce partition contexts") set_aom_config_var(CONFIG_CCSO_IMPROVE 1 "Enable CCSO improvements") +set_aom_config_var(CONFIG_CCSO_FU_BUGFIX 1 "Bugfix to CCSO FU size") set_aom_config_var(CONFIG_OPT_INTER_MODE_CTX 1 "Improvement of all inter mode related contexts")
diff --git a/test/av1_ccso_simd_cmp.cc b/test/av1_ccso_simd_cmp.cc index e06ea67..d2a1919 100644 --- a/test/av1_ccso_simd_cmp.cc +++ b/test/av1_ccso_simd_cmp.cc
@@ -41,7 +41,12 @@ 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 int max_val, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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; @@ -122,13 +127,19 @@ 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_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX 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_, edge_clf_, - 0)); + src_loc_, max_val_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_, isSingleBand_, shift_bits_, edge_clf_, 0)); for (int r = 0; r < blk_size_; ++r) { for (int c = 0; c < blk_size_; ++c) { @@ -164,7 +175,12 @@ 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 *offset_buf, const int blk_size, + const int8_t *offset_buf, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX 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); @@ -174,14 +190,20 @@ protected: void Execute() { ccso_stride_ = src_y_stride_ - (CCSO_PADDING_SIZE << 1); - 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_, 0); + 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_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_, y_uv_hscale_, y_uv_vscale_, 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_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX y_uv_hscale_, y_uv_vscale_, max_val_, shift_bits_, 0)); for (int r = 0; r < blk_size_; ++r) { @@ -223,7 +245,12 @@ 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, + const int *src_loc, +#if CONFIG_CCSO_FU_BUGFIX + const int blk_size_x, const int blk_size_y, +#else + const int blk_size, +#endif // CONFIG_CCSO_FU_BUGFIX const int edge_clf); typedef libaom_test::FuncParam<CCSO_Derive_Src> TestFuncsCCSO_Derive_Src; @@ -233,13 +260,20 @@ 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_, - edge_clf_); + y_uv_vscale_, thr_, neg_thr_, src_loc_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX + 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_, 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_, +#if CONFIG_CCSO_FU_BUGFIX + blk_size_, +#endif // CONFIG_CCSO_FU_BUGFIX + blk_size_, edge_clf_)); for (int r = 0; r < blk_size_; ++r) { for (int c = 0; c < blk_size_; ++c) {