diff --git a/av1/common/convolve.h b/av1/common/convolve.h index 15a308798500971e4d0a063773920b467964031f..48b476ed5b7fcb7a12d3992b646bd7bc7f24cba2 100644 --- a/av1/common/convolve.h +++ b/av1/common/convolve.h @@ -33,6 +33,7 @@ typedef struct ConvolveParams { int round_0; int round_1; int plane; + int do_post_rounding; } ConvolveParams; static INLINE ConvolveParams get_conv_params(int ref, int plane) { @@ -40,6 +41,7 @@ static INLINE ConvolveParams get_conv_params(int ref, int plane) { conv_params.ref = ref; conv_params.round = CONVOLVE_OPT_ROUND; conv_params.plane = plane; + conv_params.do_post_rounding = 0; return conv_params; } struct AV1Common; @@ -73,6 +75,7 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane, conv_params.dst = dst; conv_params.dst_stride = dst_stride; conv_params.plane = plane; + conv_params.do_post_rounding = 0; return conv_params; } diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index 8bb4a9b4f2b160827c14ff0711c4c15ed45726f9..8975b171043e969c9048afdf5a7f062b0d74f596 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c @@ -1151,19 +1151,21 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, } #if CONFIG_CONVOLVE_ROUND -// TODO(angiebird): This part needs optimization + // TODO(angiebird): This part needs optimization + if (conv_params.do_post_rounding) { #if CONFIG_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) - av1_highbd_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, - w, h, FILTER_BITS * 2 + is_compound - - conv_params.round_0 - - conv_params.round_1, - xd->bd); - else + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) + av1_highbd_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, + w, h, FILTER_BITS * 2 + is_compound - + conv_params.round_0 - + conv_params.round_1, + xd->bd); + else #endif // CONFIG_HIGHBITDEPTH - av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h, - FILTER_BITS * 2 + is_compound - - conv_params.round_0 - conv_params.round_1); + av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h, + FILTER_BITS * 2 + is_compound - + conv_params.round_0 - conv_params.round_1); + } #endif // CONFIG_CONVOLVE_ROUND } } diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index 1a6c7b8ce2717fb3e25e658b42d2b9da47f223be..8dcea8877b64bd6a24c54c6f70c8fd79e5b86c7d 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h @@ -72,6 +72,7 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride, &interp_filter, #endif // CONFIG_DUAL_FILTER subpel_x, xs, subpel_y, ys, conv_params); + conv_params->do_post_rounding = 1; #else assert(0); #endif // CONFIG_CONVOLVE_ROUND @@ -136,6 +137,7 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride, &interp_filter, #endif // CONFIG_DUAL_FILTER subpel_x, xs, subpel_y, ys, conv_params, bd); + conv_params->do_post_rounding = 1; #else assert(0); #endif // CONFIG_CONVOLVE_ROUND