diff --git a/av2/common/av2_rtcd_defs.pl b/av2/common/av2_rtcd_defs.pl index 1c99843c25..504bcd2864 100644 --- a/av2/common/av2_rtcd_defs.pl +++ b/av2/common/av2_rtcd_defs.pl @@ -423,16 +423,16 @@ () add_proto qw/void av2_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd"; add_proto qw/void av2_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd"; add_proto qw/void av2_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, int bd"; -add_proto qw/void av2_highbd_dist_wtd_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd"; -add_proto qw/void av2_highbd_dist_wtd_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd"; -add_proto qw/void av2_highbd_dist_wtd_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, ConvolveParams *conv_params, int bd"; -add_proto qw/void av2_highbd_dist_wtd_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, ConvolveParams *conv_params, int bd"; +add_proto qw/void av2_highbd_cwp_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd"; +add_proto qw/void av2_highbd_cwp_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd"; +add_proto qw/void av2_highbd_cwp_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, ConvolveParams *conv_params, int bd"; +add_proto qw/void av2_highbd_cwp_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, ConvolveParams *conv_params, int bd"; add_proto qw/void av2_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_qn, const int y_step_qn, ConvolveParams *conv_params, int bd"; -specialize qw/av2_highbd_dist_wtd_convolve_2d sse4_1 avx2/; -specialize qw/av2_highbd_dist_wtd_convolve_x sse4_1 avx2/; -specialize qw/av2_highbd_dist_wtd_convolve_y sse4_1 avx2/; -specialize qw/av2_highbd_dist_wtd_convolve_2d_copy sse4_1 avx2/; +specialize qw/av2_highbd_cwp_convolve_2d sse4_1 avx2/; +specialize qw/av2_highbd_cwp_convolve_x sse4_1 avx2/; +specialize qw/av2_highbd_cwp_convolve_y sse4_1 avx2/; +specialize qw/av2_highbd_cwp_convolve_2d_copy sse4_1 avx2/; specialize qw/av2_highbd_convolve_2d_sr ssse3 avx2/; specialize qw/av2_highbd_convolve_x_sr ssse3 avx2/; specialize qw/av2_highbd_convolve_y_sr ssse3 avx2/; diff --git a/av2/common/blockd.h b/av2/common/blockd.h index f85734a713..faeb8198e4 100644 --- a/av2/common/blockd.h +++ b/av2/common/blockd.h @@ -1794,10 +1794,10 @@ typedef struct cfl_ctx { #endif // CONFIG_DEBUG } CFL_CTX; -typedef struct dist_wtd_comp_params { +typedef struct cwp_params { int fwd_offset; int bck_offset; -} DIST_WTD_COMP_PARAMS; +} CWP_PARAMS; struct scale_factors; diff --git a/av2/common/convolve.c b/av2/common/convolve.c index fb8d041682..099a497302 100644 --- a/av2/common/convolve.c +++ b/av2/common/convolve.c @@ -153,11 +153,12 @@ void av2_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride, } } -void av2_highbd_dist_wtd_convolve_2d_c( - const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, - int h, const InterpFilterParams *filter_params_x, - const InterpFilterParams *filter_params_y, const int subpel_x_qn, - const int subpel_y_qn, ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_2d_c(const uint16_t *src, int src_stride, + uint16_t *dst, int dst_stride, int w, int h, + const InterpFilterParams *filter_params_x, + const InterpFilterParams *filter_params_y, + const int subpel_x_qn, const int subpel_y_qn, + ConvolveParams *conv_params, int bd) { int x, y, k; int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE]; CONV_BUF_TYPE *dst16 = conv_params->dst; @@ -221,12 +222,11 @@ void av2_highbd_dist_wtd_convolve_2d_c( } } -void av2_highbd_dist_wtd_convolve_x_c(const uint16_t *src, int src_stride, - uint16_t *dst, int dst_stride, int w, - int h, - const InterpFilterParams *filter_params_x, - const int subpel_x_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_x_c(const uint16_t *src, int src_stride, + uint16_t *dst, int dst_stride, int w, int h, + const InterpFilterParams *filter_params_x, + const int subpel_x_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst16 = conv_params->dst; int dst16_stride = conv_params->dst_stride; const int fo_horiz = filter_params_x->taps / 2 - 1; @@ -271,12 +271,11 @@ void av2_highbd_dist_wtd_convolve_x_c(const uint16_t *src, int src_stride, } } -void av2_highbd_dist_wtd_convolve_y_c(const uint16_t *src, int src_stride, - uint16_t *dst, int dst_stride, int w, - int h, - const InterpFilterParams *filter_params_y, - const int subpel_y_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_y_c(const uint16_t *src, int src_stride, + uint16_t *dst, int dst_stride, int w, int h, + const InterpFilterParams *filter_params_y, + const int subpel_y_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst16 = conv_params->dst; int dst16_stride = conv_params->dst_stride; const int fo_vert = filter_params_y->taps / 2 - 1; @@ -320,11 +319,10 @@ void av2_highbd_dist_wtd_convolve_y_c(const uint16_t *src, int src_stride, } } -void av2_highbd_dist_wtd_convolve_2d_copy_c(const uint16_t *src, int src_stride, - uint16_t *dst, int dst_stride, - int w, int h, - ConvolveParams *conv_params, - int bd) { +void av2_highbd_cwp_convolve_2d_copy_c(const uint16_t *src, int src_stride, + uint16_t *dst, int dst_stride, int w, + int h, ConvolveParams *conv_params, + int bd) { CONV_BUF_TYPE *dst16 = conv_params->dst; int dst16_stride = conv_params->dst_stride; const int bits = @@ -453,21 +451,19 @@ static void highbd_convolve_2d_facade_compound( const bool need_x = subpel_x_qn != 0; const bool need_y = subpel_y_qn != 0; if (!need_x && !need_y) { - av2_highbd_dist_wtd_convolve_2d_copy(src, src_stride, dst, dst_stride, w, h, - conv_params, bd); + av2_highbd_cwp_convolve_2d_copy(src, src_stride, dst, dst_stride, w, h, + conv_params, bd); } else if (need_x && !need_y) { - av2_highbd_dist_wtd_convolve_x(src, src_stride, dst, dst_stride, w, h, - filter_params_x, subpel_x_qn, conv_params, - bd); + av2_highbd_cwp_convolve_x(src, src_stride, dst, dst_stride, w, h, + filter_params_x, subpel_x_qn, conv_params, bd); } else if (!need_x && need_y) { - av2_highbd_dist_wtd_convolve_y(src, src_stride, dst, dst_stride, w, h, - filter_params_y, subpel_y_qn, conv_params, - bd); + av2_highbd_cwp_convolve_y(src, src_stride, dst, dst_stride, w, h, + filter_params_y, subpel_y_qn, conv_params, bd); } else { assert(need_x && need_y); - av2_highbd_dist_wtd_convolve_2d(src, src_stride, dst, dst_stride, w, h, - filter_params_x, filter_params_y, - subpel_x_qn, subpel_y_qn, conv_params, bd); + av2_highbd_cwp_convolve_2d(src, src_stride, dst, dst_stride, w, h, + filter_params_x, filter_params_y, subpel_x_qn, + subpel_y_qn, conv_params, bd); } } diff --git a/av2/common/x86/highbd_convolve_2d_sse4.c b/av2/common/x86/highbd_convolve_2d_sse4.c index e0423567fe..11be9c138c 100644 --- a/av2/common/x86/highbd_convolve_2d_sse4.c +++ b/av2/common/x86/highbd_convolve_2d_sse4.c @@ -22,11 +22,11 @@ #include "avm_dsp/x86/convolve_sse4_1.h" #include "av2/common/convolve.h" -void av2_highbd_dist_wtd_convolve_2d_copy_sse4_1(const uint16_t *src, - int src_stride, uint16_t *dst0, - int dst_stride0, int w, int h, - ConvolveParams *conv_params, - int bd) { +void av2_highbd_cwp_convolve_2d_copy_sse4_1(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, + int w, int h, + ConvolveParams *conv_params, + int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; @@ -163,7 +163,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_sse4_1(const uint16_t *src, } } -void av2_highbd_dist_wtd_convolve_2d_sse4_1( +void av2_highbd_cwp_convolve_2d_sse4_1( const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, diff --git a/av2/common/x86/highbd_jnt_convolve_avx2.c b/av2/common/x86/highbd_jnt_convolve_avx2.c index f676d7e882..742eda0519 100644 --- a/av2/common/x86/highbd_jnt_convolve_avx2.c +++ b/av2/common/x86/highbd_jnt_convolve_avx2.c @@ -23,7 +23,7 @@ #include "avm_dsp/avm_filter.h" #include "av2/common/convolve.h" -#define CONVOLVE_DIST_WTD_VERT_FILTER_8TAP \ +#define CONVOLVE_CWP_VERT_FILTER_8TAP \ const __m256i s0 = \ _mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \ const __m256i s1 = \ @@ -182,7 +182,7 @@ } \ } -#define CONVOLVE_DIST_WTD_VERT_FILTER_6TAP \ +#define CONVOLVE_CWP_VERT_FILTER_6TAP \ const __m256i s0 = \ _mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \ const __m256i s1 = \ @@ -331,7 +331,7 @@ } \ } -#define CONVOLVE_DIST_WTD_VERT_FILTER_4TAP \ +#define CONVOLVE_CWP_VERT_FILTER_4TAP \ const __m256i s0 = \ _mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \ const __m256i s1 = \ @@ -470,7 +470,7 @@ } \ } -#define CONVOLVE_DIST_WTD_VERT_FILTER_2TAP \ +#define CONVOLVE_CWP_VERT_FILTER_2TAP \ if (w - j < 8) { \ for (i = 0; i < h; i += 2) { \ const int16_t *data = &im_block[i * im_stride]; \ @@ -605,7 +605,7 @@ static INLINE void _mm_storeh_epi64(__m128i *const d, __m128i s) { _mm_storeh_pi((__m64 *)d, _mm_castsi128_ps(s)); } -static INLINE void highbd_dist_wtd_convolve_2d_copy_do_average( +static INLINE void highbd_cwp_convolve_2d_copy_do_average( __m256i data, __m256i zero, __m256i res, const __m256i *offset_const, const __m256i *wt0, const __m256i *wt1, int use_wtd_comp_avg, const __m256i *const rounding_const, int rounding_shift, @@ -634,11 +634,10 @@ static INLINE void highbd_dist_wtd_convolve_2d_copy_do_average( *res_clip = _mm256_min_epi16(res_16b, clip_pixel_to_bd); } -void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src, - int src_stride, uint16_t *dst0, - int dst_stride0, int w, int h, - ConvolveParams *conv_params, - int bd) { +void av2_highbd_cwp_convolve_2d_copy_avx2(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, + int w, int h, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; @@ -680,7 +679,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src, const __m256i data_0 = _mm256_loadu_si256((__m256i *)(&dst[i * dst_stride + j])); - highbd_dist_wtd_convolve_2d_copy_do_average( + highbd_cwp_convolve_2d_copy_do_average( data_0, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg, &rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip); @@ -709,7 +708,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src, const __m256i data_01 = _mm256_permute2x128_si256(data_0, data_1, 0x20); - highbd_dist_wtd_convolve_2d_copy_do_average( + highbd_cwp_convolve_2d_copy_do_average( data_01, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg, &rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip); @@ -749,7 +748,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src, const __m256i data_01 = _mm256_permute2x128_si256(data_0, data_1, 0x20); - highbd_dist_wtd_convolve_2d_copy_do_average( + highbd_cwp_convolve_2d_copy_do_average( data_01, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg, &rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip); @@ -845,10 +844,12 @@ DECLARE_ALIGNED(32, static const uint8_t, shuffle_mask1[32]) = { 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13 }; -static INLINE void dist_wtd_convolve_horiz_w4( - const uint16_t *src_ptr, int src_stride, const __m256i *const coeffs, - int im_h, int16_t *im_block, int im_stride, const __m256i *round_const_x, - const __m128i *round_shift_x) { +static INLINE void cwp_convolve_horiz_w4(const uint16_t *src_ptr, + int src_stride, + const __m256i *const coeffs, int im_h, + int16_t *im_block, int im_stride, + const __m256i *round_const_x, + const __m128i *round_shift_x) { __m256i s[2]; for (int i = 0; i < im_h; i += 2) { const __m256i row0 = @@ -872,7 +873,7 @@ static INLINE void dist_wtd_convolve_horiz_w4( } } -void av2_highbd_dist_wtd_convolve_2d_avx2( +void av2_highbd_cwp_convolve_2d_avx2( const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, @@ -951,8 +952,8 @@ void av2_highbd_dist_wtd_convolve_2d_avx2( /* Horizontal filter */ if (w == 4) { assert(tap_x == 2 || tap_x == 4); - dist_wtd_convolve_horiz_w4(src_ptr, src_stride, coeffs_x, im_h, im_block, - im_stride, &round_const_x, &round_shift_x); + cwp_convolve_horiz_w4(src_ptr, src_stride, coeffs_x, im_h, im_block, + im_stride, &round_const_x, &round_shift_x); } else { if (tap_x == 8) { CONVOLVE_HORIZ_FILTER_8TAP @@ -967,21 +968,23 @@ void av2_highbd_dist_wtd_convolve_2d_avx2( /* Vertical filter */ if (tap_y == 8) { - CONVOLVE_DIST_WTD_VERT_FILTER_8TAP + CONVOLVE_CWP_VERT_FILTER_8TAP } else if (tap_y == 6) { - CONVOLVE_DIST_WTD_VERT_FILTER_6TAP + CONVOLVE_CWP_VERT_FILTER_6TAP } else if (tap_y == 4) { - CONVOLVE_DIST_WTD_VERT_FILTER_4TAP + CONVOLVE_CWP_VERT_FILTER_4TAP } else { - CONVOLVE_DIST_WTD_VERT_FILTER_2TAP + CONVOLVE_CWP_VERT_FILTER_2TAP } } } -void av2_highbd_dist_wtd_convolve_x_avx2( - const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, - int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_x_avx2(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, int w, + int h, + const InterpFilterParams *filter_params_x, + const int subpel_x_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; const int fo_horiz = filter_params_x->taps / 2 - 1; @@ -1142,10 +1145,12 @@ void av2_highbd_dist_wtd_convolve_x_avx2( } } -void av2_highbd_dist_wtd_convolve_y_avx2( - const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, - int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_y_avx2(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, int w, + int h, + const InterpFilterParams *filter_params_y, + const int subpel_y_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; const int fo_vert = filter_params_y->taps / 2 - 1; diff --git a/av2/common/x86/highbd_jnt_convolve_sse4.c b/av2/common/x86/highbd_jnt_convolve_sse4.c index 20819f0f64..e13fd272cb 100644 --- a/av2/common/x86/highbd_jnt_convolve_sse4.c +++ b/av2/common/x86/highbd_jnt_convolve_sse4.c @@ -18,10 +18,12 @@ #include "avm_dsp/x86/convolve_sse2.h" #include "avm_dsp/x86/convolve_sse4_1.h" -void av2_highbd_dist_wtd_convolve_y_sse4_1( - const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, - int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_y_sse4_1(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, int w, + int h, + const InterpFilterParams *filter_params_y, + const int subpel_y_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; const int fo_vert = filter_params_y->taps / 2 - 1; @@ -255,10 +257,12 @@ void av2_highbd_dist_wtd_convolve_y_sse4_1( } } -void av2_highbd_dist_wtd_convolve_x_sse4_1( - const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w, - int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, - ConvolveParams *conv_params, int bd) { +void av2_highbd_cwp_convolve_x_sse4_1(const uint16_t *src, int src_stride, + uint16_t *dst0, int dst_stride0, int w, + int h, + const InterpFilterParams *filter_params_x, + const int subpel_x_qn, + ConvolveParams *conv_params, int bd) { CONV_BUF_TYPE *dst = conv_params->dst; int dst_stride = conv_params->dst_stride; const int fo_horiz = filter_params_x->taps / 2 - 1; diff --git a/av2/encoder/encoder_utils.h b/av2/encoder/encoder_utils.h index 56495121d0..7716b86129 100644 --- a/av2/encoder/encoder_utils.h +++ b/av2/encoder/encoder_utils.h @@ -143,16 +143,16 @@ static AVM_INLINE void init_buffer_indices( cpi->fn_ptr[BT].jsdaf = JSDAF; \ cpi->fn_ptr[BT].jsvaf = JSVAF; -#define HIGHBD_BFP_WRAPPER(WIDTH, HEIGHT, BD) \ - HIGHBD_BFP( \ - BLOCK_##WIDTH##X##HEIGHT, avm_highbd_sad##WIDTH##x##HEIGHT##_bits##BD, \ - avm_highbd_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ - avm_highbd_##BD##_variance##WIDTH##x##HEIGHT, \ - avm_highbd_##BD##_sub_pixel_variance##WIDTH##x##HEIGHT, \ - avm_highbd_##BD##_sub_pixel_avg_variance##WIDTH##x##HEIGHT, \ - avm_highbd_sad##WIDTH##x##HEIGHT##x4d_bits##BD, \ - avm_highbd_dist_wtd_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ - avm_highbd_##BD##_dist_wtd_sub_pixel_avg_variance##WIDTH##x##HEIGHT) +#define HIGHBD_BFP_WRAPPER(WIDTH, HEIGHT, BD) \ + HIGHBD_BFP(BLOCK_##WIDTH##X##HEIGHT, \ + avm_highbd_sad##WIDTH##x##HEIGHT##_bits##BD, \ + avm_highbd_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ + avm_highbd_##BD##_variance##WIDTH##x##HEIGHT, \ + avm_highbd_##BD##_sub_pixel_variance##WIDTH##x##HEIGHT, \ + avm_highbd_##BD##_sub_pixel_avg_variance##WIDTH##x##HEIGHT, \ + avm_highbd_sad##WIDTH##x##HEIGHT##x4d_bits##BD, \ + avm_highbd_cwp_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ + avm_highbd_##BD##_cwp_sub_pixel_avg_variance##WIDTH##x##HEIGHT) #define MAKE_BFP_SAD_WRAPPER(fnname) \ static unsigned int fnname##_bits8( \ @@ -215,24 +215,24 @@ static AVM_INLINE void init_buffer_indices( static unsigned int fnname##_bits8( \ const uint16_t *src_ptr, int source_stride, const uint16_t *ref_ptr, \ int ref_stride, const uint16_t *second_pred, \ - const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const CWP_PARAMS *cwp_param) { \ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ - jcp_param); \ + cwp_param); \ } \ static unsigned int fnname##_bits10( \ const uint16_t *src_ptr, int source_stride, const uint16_t *ref_ptr, \ int ref_stride, const uint16_t *second_pred, \ - const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const CWP_PARAMS *cwp_param) { \ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ - jcp_param) >> \ + cwp_param) >> \ 2; \ } \ static unsigned int fnname##_bits12( \ const uint16_t *src_ptr, int source_stride, const uint16_t *ref_ptr, \ int ref_stride, const uint16_t *second_pred, \ - const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const CWP_PARAMS *cwp_param) { \ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ - jcp_param) >> \ + cwp_param) >> \ 4; \ } @@ -336,38 +336,38 @@ MAKE_BFP_SAD_WRAPPER(avm_highbd_sad4x32) MAKE_BFP_SADAVG_WRAPPER(avm_highbd_sad4x32_avg) MAKE_BFP_SAD4D_WRAPPER(avm_highbd_sad4x32x4d) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad256x256_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad256x128_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad128x256_avg) - -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad128x128_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad128x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x128_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad32x16_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad16x32_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x32_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad32x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad32x32_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad16x16_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad16x8_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad8x16_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad8x8_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad8x4_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad4x8_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad4x4_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad4x16_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad16x4_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad8x32_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad32x8_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad16x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x16_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad8x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x8_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad4x64_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad64x4_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad4x32_avg) -MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_dist_wtd_sad32x4_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad256x256_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad256x128_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad128x256_avg) + +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad128x128_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad128x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x128_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad32x16_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad16x32_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x32_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad32x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad32x32_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad16x16_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad16x8_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad8x16_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad8x8_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad8x4_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad4x8_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad4x4_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad4x16_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad16x4_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad8x32_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad32x8_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad16x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x16_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad8x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x8_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad4x64_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad64x4_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad4x32_avg) +MAKE_BFP_JSADAVG_WRAPPER(avm_highbd_cwp_sad32x4_avg) #define HIGHBD_MBFP(BT, MCSDF, MCSVF) \ cpi->fn_ptr[BT].msdf = MCSDF; \ diff --git a/av2/encoder/mcomp.c b/av2/encoder/mcomp.c index 99195db462..e7c410415d 100644 --- a/av2/encoder/mcomp.c +++ b/av2/encoder/mcomp.c @@ -1083,11 +1083,11 @@ static INLINE int get_mvpred_compound_var_cost( // Set weighting factor for two reference frames static INLINE void set_cmp_weight(const MB_MODE_INFO *mi, int invert_mask, - DIST_WTD_COMP_PARAMS *jcp_param) { + CWP_PARAMS *cwp_param) { int weight = get_cwp_idx(mi); weight = invert_mask ? (1 << CWP_WEIGHT_BITS) - weight : weight; - jcp_param->fwd_offset = weight; - jcp_param->bck_offset = (1 << CWP_WEIGHT_BITS) - weight; + cwp_param->fwd_offset = weight; + cwp_param->bck_offset = (1 << CWP_WEIGHT_BITS) - weight; } static INLINE int get_mvpred_compound_sad( @@ -1109,11 +1109,11 @@ static INLINE int get_mvpred_compound_sad( } else if (second_pred) { const MB_MODE_INFO *mi = ms_params->xd->mi[0]; if (get_cwp_idx(mi) != CWP_EQUAL) { - DIST_WTD_COMP_PARAMS jcp_param; - set_cmp_weight(mi, invert_mask, &jcp_param); + CWP_PARAMS cwp_param; + set_cmp_weight(mi, invert_mask, &cwp_param); return vfp->jsdaf(src_buf, src_stride, ref_address, ref_stride, - second_pred, &jcp_param); + second_pred, &cwp_param); } return vfp->sdaf(src_buf, src_stride, ref_address, ref_stride, second_pred); } else { @@ -2854,13 +2854,13 @@ int upsampled_pref_error(MACROBLOCKD *xd, const AV2_COMMON *cm, subpel_search_type, is_scaled_ref); } else { if (get_cwp_idx(xd->mi[0]) != CWP_EQUAL) { - DIST_WTD_COMP_PARAMS jcp_param; - set_cmp_weight(xd->mi[0], invert_mask, &jcp_param); + CWP_PARAMS cwp_param; + set_cmp_weight(xd->mi[0], invert_mask, &cwp_param); - avm_highbd_dist_wtd_comp_avg_upsampled_pred( - xd, cm, mi_row, mi_col, this_mv, pred, second_pred, w, h, - subpel_x_q3, subpel_y_q3, ref, ref_stride, xd->bd, &jcp_param, - subpel_search_type, is_scaled_ref); + avm_highbd_cwp_upsampled(xd, cm, mi_row, mi_col, this_mv, pred, + second_pred, w, h, subpel_x_q3, subpel_y_q3, + ref, ref_stride, xd->bd, &cwp_param, + subpel_search_type, is_scaled_ref); } else avm_highbd_comp_avg_upsampled_pred(xd, cm, mi_row, mi_col, this_mv, diff --git a/avm_dsp/avm_dsp_rtcd_defs.pl b/avm_dsp/avm_dsp_rtcd_defs.pl index 82da0aaf4a..312268fd72 100644 --- a/avm_dsp/avm_dsp_rtcd_defs.pl +++ b/avm_dsp/avm_dsp_rtcd_defs.pl @@ -338,7 +338,7 @@ () specialize "avm_highbd_sad${w}x${h}_avg", qw/sse2/; } } - add_proto qw/unsigned int/, "avm_highbd_dist_wtd_sad${w}x${h}_avg", "const uint16_t *src_ptr, int src_stride, const uint16_t *ref_ptr, int ref_stride, const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS* jcp_param"; + add_proto qw/unsigned int/, "avm_highbd_cwp_sad${w}x${h}_avg", "const uint16_t *src_ptr, int src_stride, const uint16_t *ref_ptr, int ref_stride, const uint16_t *second_pred, const CWP_PARAMS* cwp_param"; } specialize qw/avm_highbd_sad256x256 avx2/; specialize qw/avm_highbd_sad256x128 avx2/; @@ -593,11 +593,11 @@ () int bd, int subpel_search, int is_scaled_ref"; specialize qw/avm_highbd_comp_avg_upsampled_pred sse2 avx2/; - add_proto qw/void avm_highbd_dist_wtd_comp_avg_upsampled_pred/, "MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, + add_proto qw/void avm_highbd_cwp_upsampled/, "MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, const MV *const mv, uint16_t *comp_pred8, const uint16_t *pred8, int width, int height, int subpel_x_q3, int subpel_y_q3, const uint16_t *ref8, - int ref_stride, int bd, const DIST_WTD_COMP_PARAMS *jcp_param, int subpel_search, int is_scaled_ref"; - specialize qw/avm_highbd_dist_wtd_comp_avg_upsampled_pred sse2/; + int ref_stride, int bd, const CWP_PARAMS *cwp_param, int subpel_search, int is_scaled_ref"; + specialize qw/avm_highbd_cwp_upsampled sse2/; add_proto qw/void avm_highbd_comp_mask_upsampled_pred/, "MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, const MV *const mv, uint16_t *comp_pred8, const uint16_t *pred8, int width, @@ -650,7 +650,7 @@ () } } - add_proto qw/uint32_t/, "avm_highbd_${bd}_dist_wtd_sub_pixel_avg_variance${w}x${h}", "const uint16_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint16_t *ref_ptr, int ref_stride, uint32_t *sse, const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS* jcp_param"; + add_proto qw/uint32_t/, "avm_highbd_${bd}_cwp_sub_pixel_avg_variance${w}x${h}", "const uint16_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint16_t *ref_ptr, int ref_stride, uint32_t *sse, const uint16_t *second_pred, const CWP_PARAMS* cwp_param"; } } # @@ -916,8 +916,8 @@ () add_proto qw/void avm_highbd_comp_avg_pred/, "uint16_t *comp_pred8, const uint16_t *pred8, int width, int height, const uint16_t *ref8, int ref_stride"; - add_proto qw/void avm_highbd_dist_wtd_comp_avg_pred/, "uint16_t *comp_pred8, const uint16_t *pred8, int width, int height, const uint16_t *ref8, int ref_stride, const DIST_WTD_COMP_PARAMS *jcp_param"; - specialize qw/avm_highbd_dist_wtd_comp_avg_pred sse2/; + add_proto qw/void avm_highbd_cwp/, "uint16_t *comp_pred8, const uint16_t *pred8, int width, int height, const uint16_t *ref8, int ref_stride, const CWP_PARAMS *cwp_param"; + specialize qw/avm_highbd_cwp sse2/; add_proto qw/uint64_t/, "avm_mse_wxh_16bit_highbd", "uint16_t *dst, int dstride,uint16_t *src, int sstride, int w, int h"; specialize qw/avm_mse_wxh_16bit_highbd sse2 avx2/; diff --git a/avm_dsp/sad4d.c b/avm_dsp/sad4d.c index 1195faf336..27be36ac9e 100644 --- a/avm_dsp/sad4d.c +++ b/avm_dsp/sad4d.c @@ -59,13 +59,12 @@ static INLINE unsigned int highbd_sadb(const uint16_t *a, int a_stride, avm_highbd_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \ return highbd_sadb(src, src_stride, comp_pred, m, m, n); \ } \ - unsigned int avm_highbd_dist_wtd_sad##m##x##n##_avg_c( \ + unsigned int avm_highbd_cwp_sad##m##x##n##_avg_c( \ const uint16_t *src, int src_stride, const uint16_t *ref, \ int ref_stride, const uint16_t *second_pred, \ - const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const CWP_PARAMS *cwp_param) { \ uint16_t comp_pred[m * n]; \ - avm_highbd_dist_wtd_comp_avg_pred(comp_pred, second_pred, m, n, ref, \ - ref_stride, jcp_param); \ + avm_highbd_cwp(comp_pred, second_pred, m, n, ref, ref_stride, cwp_param); \ return highbd_sadb(src, src_stride, comp_pred, m, m, n); \ } \ unsigned int avm_highbd_sad_skip_##m##x##n##_c( \ diff --git a/avm_dsp/variance.c b/avm_dsp/variance.c index f262962604..b4f1a3d374 100644 --- a/avm_dsp/variance.c +++ b/avm_dsp/variance.c @@ -374,10 +374,10 @@ void avm_highbd_var_filter_block2d_bil_second_pass( sse); \ } \ \ - uint32_t avm_highbd_8_dist_wtd_sub_pixel_avg_variance##W##x##H##_c( \ + uint32_t avm_highbd_8_cwp_sub_pixel_avg_variance##W##x##H##_c( \ const uint16_t *src, int src_stride, int xoffset, int yoffset, \ const uint16_t *dst, int dst_stride, uint32_t *sse, \ - const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const uint16_t *second_pred, const CWP_PARAMS *cwp_param) { \ uint16_t fdata3[(H + 1) * W]; \ uint16_t temp2[H * W]; \ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \ @@ -387,16 +387,15 @@ void avm_highbd_var_filter_block2d_bil_second_pass( avm_highbd_var_filter_block2d_bil_second_pass( \ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \ \ - avm_highbd_dist_wtd_comp_avg_pred((temp3), second_pred, W, H, (temp2), W, \ - jcp_param); \ + avm_highbd_cwp((temp3), second_pred, W, H, (temp2), W, cwp_param); \ \ return avm_highbd_8_variance##W##x##H((temp3), W, dst, dst_stride, sse); \ } \ \ - uint32_t avm_highbd_10_dist_wtd_sub_pixel_avg_variance##W##x##H##_c( \ + uint32_t avm_highbd_10_cwp_sub_pixel_avg_variance##W##x##H##_c( \ const uint16_t *src, int src_stride, int xoffset, int yoffset, \ const uint16_t *dst, int dst_stride, uint32_t *sse, \ - const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const uint16_t *second_pred, const CWP_PARAMS *cwp_param) { \ uint16_t fdata3[(H + 1) * W]; \ uint16_t temp2[H * W]; \ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \ @@ -406,16 +405,15 @@ void avm_highbd_var_filter_block2d_bil_second_pass( avm_highbd_var_filter_block2d_bil_second_pass( \ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \ \ - avm_highbd_dist_wtd_comp_avg_pred((temp3), second_pred, W, H, (temp2), W, \ - jcp_param); \ + avm_highbd_cwp((temp3), second_pred, W, H, (temp2), W, cwp_param); \ \ return avm_highbd_10_variance##W##x##H((temp3), W, dst, dst_stride, sse); \ } \ \ - uint32_t avm_highbd_12_dist_wtd_sub_pixel_avg_variance##W##x##H##_c( \ + uint32_t avm_highbd_12_cwp_sub_pixel_avg_variance##W##x##H##_c( \ const uint16_t *src, int src_stride, int xoffset, int yoffset, \ const uint16_t *dst, int dst_stride, uint32_t *sse, \ - const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param) { \ + const uint16_t *second_pred, const CWP_PARAMS *cwp_param) { \ uint16_t fdata3[(H + 1) * W]; \ uint16_t temp2[H * W]; \ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \ @@ -425,8 +423,7 @@ void avm_highbd_var_filter_block2d_bil_second_pass( avm_highbd_var_filter_block2d_bil_second_pass( \ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \ \ - avm_highbd_dist_wtd_comp_avg_pred((temp3), second_pred, W, H, (temp2), W, \ - jcp_param); \ + avm_highbd_cwp((temp3), second_pred, W, H, (temp2), W, cwp_param); \ \ return avm_highbd_12_variance##W##x##H((temp3), W, dst, dst_stride, sse); \ } @@ -591,13 +588,12 @@ void avm_highbd_comp_avg_upsampled_pred_c( } } -void avm_highbd_dist_wtd_comp_avg_pred_c( - uint16_t *comp_pred, const uint16_t *pred, int width, int height, - const uint16_t *ref, int ref_stride, - const DIST_WTD_COMP_PARAMS *jcp_param) { +void avm_highbd_cwp_c(uint16_t *comp_pred, const uint16_t *pred, int width, + int height, const uint16_t *ref, int ref_stride, + const CWP_PARAMS *cwp_param) { int i, j; - const int fwd_offset = jcp_param->fwd_offset; - const int bck_offset = jcp_param->bck_offset; + const int fwd_offset = cwp_param->fwd_offset; + const int bck_offset = cwp_param->bck_offset; for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { @@ -611,15 +607,15 @@ void avm_highbd_dist_wtd_comp_avg_pred_c( } } -void avm_highbd_dist_wtd_comp_avg_upsampled_pred_c( +void avm_highbd_cwp_upsampled_c( MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, const MV *const mv, uint16_t *comp_pred, const uint16_t *pred, int width, int height, int subpel_x_q3, int subpel_y_q3, const uint16_t *ref, - int ref_stride, int bd, const DIST_WTD_COMP_PARAMS *jcp_param, - int subpel_search, int is_scaled_ref) { + int ref_stride, int bd, const CWP_PARAMS *cwp_param, int subpel_search, + int is_scaled_ref) { int i, j; - const int fwd_offset = jcp_param->fwd_offset; - const int bck_offset = jcp_param->bck_offset; + const int fwd_offset = cwp_param->fwd_offset; + const int bck_offset = cwp_param->bck_offset; avm_highbd_upsampled_pred_c(xd, cm, mi_row, mi_col, mv, comp_pred, width, height, subpel_x_q3, subpel_y_q3, ref, ref_stride, bd, subpel_search, is_scaled_ref); diff --git a/avm_dsp/variance.h b/avm_dsp/variance.h index 553befd6ca..9da6efdb46 100644 --- a/avm_dsp/variance.h +++ b/avm_dsp/variance.h @@ -52,14 +52,15 @@ typedef unsigned int (*avm_subp_avg_variance_fn_t)( const uint16_t *b, int b_stride, unsigned int *sse, const uint16_t *second_pred); -typedef unsigned int (*avm_dist_wtd_sad_avg_fn_t)( - const uint16_t *a, int a_stride, const uint16_t *b, int b_stride, - const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param); +typedef unsigned int (*avm_cwp_sad_avg_fn_t)(const uint16_t *a, int a_stride, + const uint16_t *b, int b_stride, + const uint16_t *second_pred, + const CWP_PARAMS *cwp_param); -typedef unsigned int (*avm_dist_wtd_subp_avg_variance_fn_t)( +typedef unsigned int (*avm_cwp_subp_avg_variance_fn_t)( const uint16_t *a, int a_stride, int xoffset, int yoffset, const uint16_t *b, int b_stride, unsigned int *sse, - const uint16_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param); + const uint16_t *second_pred, const CWP_PARAMS *cwp_param); typedef unsigned int (*avm_masked_sad_fn_t)(const uint16_t *src, int src_stride, const uint16_t *ref, int ref_stride, @@ -84,8 +85,8 @@ typedef struct avm_variance_vtable { avm_sad_multi_d_fn_t sdsx4df; avm_masked_sad_fn_t msdf; avm_masked_subpixvariance_fn_t msvf; - avm_dist_wtd_sad_avg_fn_t jsdaf; - avm_dist_wtd_subp_avg_variance_fn_t jsvaf; + avm_cwp_sad_avg_fn_t jsdaf; + avm_cwp_subp_avg_variance_fn_t jsvaf; } avm_variance_fn_ptr_t; void avm_highbd_var_filter_block2d_bil_first_pass( diff --git a/avm_dsp/x86/convolve_avx2.h b/avm_dsp/x86/convolve_avx2.h index 058794d91d..95057353b9 100644 --- a/avm_dsp/x86/convolve_avx2.h +++ b/avm_dsp/x86/convolve_avx2.h @@ -447,7 +447,7 @@ DECLARE_ALIGNED(32, static const uint8_t, filt4_global_avx2[32]) = { s[6] = s[7]; \ } -#define DIST_WTD_CONVOLVE_HORIZONTAL_FILTER_8TAP \ +#define CWP_CONVOLVE_HORIZONTAL_FILTER_8TAP \ for (i = 0; i < im_h; i += 2) { \ __m256i data = _mm256_castsi128_si256(_mm_loadu_si128((__m128i *)src_h)); \ if (i + 1 < im_h) \ @@ -464,7 +464,7 @@ DECLARE_ALIGNED(32, static const uint8_t, filt4_global_avx2[32]) = { // In optical flow MV refinement, unaligned store (_mm_storeu_si128) is used // in this function to avoid a subblock boundary error. -#define DIST_WTD_CONVOLVE_VERTICAL_FILTER_8TAP \ +#define CWP_CONVOLVE_VERTICAL_FILTER_8TAP \ __m256i s[8]; \ __m256i s0 = _mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \ __m256i s1 = _mm256_loadu_si256((__m256i *)(im_block + 1 * im_stride)); \ diff --git a/avm_dsp/x86/convolve_sse2.h b/avm_dsp/x86/convolve_sse2.h index 861a853f2d..bca38b172a 100644 --- a/avm_dsp/x86/convolve_sse2.h +++ b/avm_dsp/x86/convolve_sse2.h @@ -79,9 +79,9 @@ static INLINE __m128i convolve_hi_y(const __m128i *const s, static INLINE __m128i comp_avg(const __m128i *const data_ref_0, const __m128i *const res_unsigned, const __m128i *const wt, - const int use_dist_wtd_avg) { + const int use_comp_wtd_avg) { __m128i res; - if (use_dist_wtd_avg) { + if (use_comp_wtd_avg) { const __m128i data_lo = _mm_unpacklo_epi16(*data_ref_0, *res_unsigned); const __m128i data_hi = _mm_unpackhi_epi16(*data_ref_0, *res_unsigned); diff --git a/avm_dsp/x86/convolve_sse4_1.h b/avm_dsp/x86/convolve_sse4_1.h index 413685c680..3221f6b516 100644 --- a/avm_dsp/x86/convolve_sse4_1.h +++ b/avm_dsp/x86/convolve_sse4_1.h @@ -42,9 +42,9 @@ static INLINE __m128i highbd_comp_avg_sse4_1(const __m128i *const data_ref_0, const __m128i *const res_unsigned, const __m128i *const wt0, const __m128i *const wt1, - const int use_dist_wtd_avg) { + const int use_comp_wtd_avg) { __m128i res; - if (use_dist_wtd_avg) { + if (use_comp_wtd_avg) { const __m128i wt0_res = _mm_mullo_epi32(*data_ref_0, *wt0); const __m128i wt1_res = _mm_mullo_epi32(*res_unsigned, *wt1); diff --git a/avm_dsp/x86/highbd_variance_sse2.c b/avm_dsp/x86/highbd_variance_sse2.c index 36fdfa51d9..f19357ba7a 100644 --- a/avm_dsp/x86/highbd_variance_sse2.c +++ b/avm_dsp/x86/highbd_variance_sse2.c @@ -820,11 +820,11 @@ void avm_highbd_comp_avg_upsampled_pred_sse2( } } -static INLINE void highbd_compute_dist_wtd_comp_avg(__m128i *p0, __m128i *p1, - const __m128i *w0, - const __m128i *w1, - const __m128i *r, - void *const result) { +static INLINE void highbd_compute_comp_wtd_avg(__m128i *p0, __m128i *p1, + const __m128i *w0, + const __m128i *w1, + const __m128i *r, + void *const result) { assert(DIST_PRECISION_BITS <= 4); __m128i mult0 = _mm_mullo_epi16(*p0, *w0); __m128i mult1 = _mm_mullo_epi16(*p1, *w1); @@ -835,13 +835,12 @@ static INLINE void highbd_compute_dist_wtd_comp_avg(__m128i *p0, __m128i *p1, xx_storeu_128(result, shift); } -void avm_highbd_dist_wtd_comp_avg_pred_sse2( - uint16_t *comp_pred, const uint16_t *pred, int width, int height, - const uint16_t *ref, int ref_stride, - const DIST_WTD_COMP_PARAMS *jcp_param) { +void avm_highbd_cwp_sse2(uint16_t *comp_pred, const uint16_t *pred, int width, + int height, const uint16_t *ref, int ref_stride, + const CWP_PARAMS *cwp_param) { int i; - const uint16_t wt0 = (uint16_t)jcp_param->fwd_offset; - const uint16_t wt1 = (uint16_t)jcp_param->bck_offset; + const uint16_t wt0 = (uint16_t)cwp_param->fwd_offset; + const uint16_t wt1 = (uint16_t)cwp_param->bck_offset; const __m128i w0 = _mm_set_epi16(wt0, wt0, wt0, wt0, wt0, wt0, wt0, wt0); const __m128i w1 = _mm_set_epi16(wt1, wt1, wt1, wt1, wt1, wt1, wt1, wt1); const uint16_t round = ((1 << DIST_PRECISION_BITS) >> 1); @@ -857,7 +856,7 @@ void avm_highbd_dist_wtd_comp_avg_pred_sse2( __m128i p0 = xx_loadu_128(ref); __m128i p1 = xx_loadu_128(pred); - highbd_compute_dist_wtd_comp_avg(&p0, &p1, &w0, &w1, &r, comp_pred); + highbd_compute_comp_wtd_avg(&p0, &p1, &w0, &w1, &r, comp_pred); comp_pred += 8; pred += 8; @@ -874,7 +873,7 @@ void avm_highbd_dist_wtd_comp_avg_pred_sse2( __m128i p0 = _mm_unpacklo_epi64(p0_0, p0_1); __m128i p1 = xx_loadu_128(pred); - highbd_compute_dist_wtd_comp_avg(&p0, &p1, &w0, &w1, &r, comp_pred); + highbd_compute_comp_wtd_avg(&p0, &p1, &w0, &w1, &r, comp_pred); comp_pred += 8; pred += 8; @@ -883,12 +882,12 @@ void avm_highbd_dist_wtd_comp_avg_pred_sse2( } } -void avm_highbd_dist_wtd_comp_avg_upsampled_pred_sse2( +void avm_highbd_cwp_upsampled_sse2( MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, const MV *const mv, uint16_t *comp_pred16, const uint16_t *pred, int width, int height, int subpel_x_q3, int subpel_y_q3, const uint16_t *ref, - int ref_stride, int bd, const DIST_WTD_COMP_PARAMS *jcp_param, - int subpel_search, int is_scaled_ref) { + int ref_stride, int bd, const CWP_PARAMS *cwp_param, int subpel_search, + int is_scaled_ref) { int n; int i; avm_highbd_upsampled_pred(xd, cm, mi_row, mi_col, mv, comp_pred16, width, @@ -897,8 +896,8 @@ void avm_highbd_dist_wtd_comp_avg_upsampled_pred_sse2( assert(!(width * height & 7)); n = width * height >> 3; - const uint16_t wt0 = (uint16_t)jcp_param->fwd_offset; - const uint16_t wt1 = (uint16_t)jcp_param->bck_offset; + const uint16_t wt0 = (uint16_t)cwp_param->fwd_offset; + const uint16_t wt1 = (uint16_t)cwp_param->bck_offset; const __m128i w0 = _mm_set_epi16(wt0, wt0, wt0, wt0, wt0, wt0, wt0, wt0); const __m128i w1 = _mm_set_epi16(wt1, wt1, wt1, wt1, wt1, wt1, wt1, wt1); const uint16_t round = ((1 << DIST_PRECISION_BITS) >> 1); @@ -909,7 +908,7 @@ void avm_highbd_dist_wtd_comp_avg_upsampled_pred_sse2( __m128i p0 = xx_loadu_128(comp_pred16); __m128i p1 = xx_loadu_128(pred); - highbd_compute_dist_wtd_comp_avg(&p0, &p1, &w0, &w1, &r, comp_pred16); + highbd_compute_comp_wtd_avg(&p0, &p1, &w0, &w1, &r, comp_pred16); comp_pred16 += 8; pred += 8; diff --git a/test/av2_convolve_test.cc b/test/av2_convolve_test.cc index 1deb3f02c8..d377c59286 100644 --- a/test/av2_convolve_test.cc +++ b/test/av2_convolve_test.cc @@ -628,13 +628,13 @@ std::vector> GetHighbdLumaTestParams(T test_func) { } TEST_F(AV2ConvolveParametersTest, GetHighbdLumaTestParams) { - auto v = GetHighbdLumaTestParams(av2_highbd_dist_wtd_convolve_x_c); + auto v = GetHighbdLumaTestParams(av2_highbd_cwp_convolve_x_c); ASSERT_EQ(static_cast(BLOCK_SIZES_ALL * 2), v.size()); int num_10 = 0; int num_12 = 0; for (const auto &e : v) { ASSERT_TRUE(10 == e.BitDepth() || 12 == e.BitDepth()); - bool same_fn = av2_highbd_dist_wtd_convolve_x_c == e.TestFunction(); + bool same_fn = av2_highbd_cwp_convolve_x_c == e.TestFunction(); ASSERT_TRUE(same_fn); if (e.BitDepth() == 10) { ++num_10; @@ -726,7 +726,7 @@ class AV2ConvolveXHighbdCompoundTest } virtual highbd_convolve_x_func ReferenceFunc() const { - return av2_highbd_dist_wtd_convolve_x_c; + return av2_highbd_cwp_convolve_x_c; } private: @@ -773,20 +773,18 @@ class AV2ConvolveXHighbdCompoundTest TEST_P(AV2ConvolveXHighbdCompoundTest, RunTest) { RunTest(); } -INSTANTIATE_TEST_SUITE_P( - C, AV2ConvolveXHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_x_c)); +INSTANTIATE_TEST_SUITE_P(C, AV2ConvolveXHighbdCompoundTest, + BuildHighbdLumaParams(av2_highbd_cwp_convolve_x_c)); #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, AV2ConvolveXHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_x_sse4_1)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_x_sse4_1)); #endif #if HAVE_AVX2 -INSTANTIATE_TEST_SUITE_P( - AVX2, AV2ConvolveXHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_x_avx2)); +INSTANTIATE_TEST_SUITE_P(AVX2, AV2ConvolveXHighbdCompoundTest, + BuildHighbdLumaParams(av2_highbd_cwp_convolve_x_avx2)); #endif ///////////////////////////////////////////////// @@ -796,7 +794,7 @@ INSTANTIATE_TEST_SUITE_P( // Again, the X and Y convolve functions have the same type signature and logic. class AV2ConvolveYHighbdCompoundTest : public AV2ConvolveXHighbdCompoundTest { virtual highbd_convolve_x_func ReferenceFunc() const override { - return av2_highbd_dist_wtd_convolve_y_c; + return av2_highbd_cwp_convolve_y_c; } virtual const InterpFilterParams *FilterParams( InterpFilter f, const BlockSize &block) const override { @@ -806,20 +804,18 @@ class AV2ConvolveYHighbdCompoundTest : public AV2ConvolveXHighbdCompoundTest { TEST_P(AV2ConvolveYHighbdCompoundTest, RunTest) { RunTest(); } -INSTANTIATE_TEST_SUITE_P( - C, AV2ConvolveYHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_y_c)); +INSTANTIATE_TEST_SUITE_P(C, AV2ConvolveYHighbdCompoundTest, + BuildHighbdLumaParams(av2_highbd_cwp_convolve_y_c)); #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, AV2ConvolveYHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_y_sse4_1)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_y_sse4_1)); #endif #if HAVE_AVX2 -INSTANTIATE_TEST_SUITE_P( - AVX2, AV2ConvolveYHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_y_avx2)); +INSTANTIATE_TEST_SUITE_P(AVX2, AV2ConvolveYHighbdCompoundTest, + BuildHighbdLumaParams(av2_highbd_cwp_convolve_y_avx2)); #endif /////////////////////////////////////////////////////// @@ -869,12 +865,11 @@ class AV2Convolve2DCopyHighbdCompoundTest avm_usec_timer timer; avm_usec_timer_start(&timer); for (int i = 0; i < nob; i++) { - av2_highbd_dist_wtd_convolve_2d_copy_c(input, width, conv_buf, - kOutputStride, width, height, - &conv_params, bit_depth); - av2_highbd_dist_wtd_convolve_2d_copy_c(input, width, conv_buf, - kOutputStride, width, height, - &conv_params_do_avg, bit_depth); + av2_highbd_cwp_convolve_2d_copy_c(input, width, conv_buf, kOutputStride, + width, height, &conv_params, bit_depth); + av2_highbd_cwp_convolve_2d_copy_c(input, width, conv_buf, kOutputStride, + width, height, &conv_params_do_avg, + bit_depth); } avm_usec_timer_mark(&timer); const int elapsed_time = static_cast(avm_usec_timer_elapsed(&timer)); @@ -903,7 +898,7 @@ class AV2Convolve2DCopyHighbdCompoundTest const uint16_t *input2 = SecondRandomInput12(GetParam()); DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); DECLARE_ALIGNED(32, CONV_BUF_TYPE, reference_conv_buf[MAX_SB_SQUARE]); - Convolve(av2_highbd_dist_wtd_convolve_2d_copy_c, input1, input2, reference, + Convolve(av2_highbd_cwp_convolve_2d_copy_c, input1, input2, reference, reference_conv_buf, compound); DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); @@ -940,18 +935,18 @@ TEST_P(AV2Convolve2DCopyHighbdCompoundTest, DISABLED_SpeedTest) { SpeedTest(); } INSTANTIATE_TEST_SUITE_P( C, AV2Convolve2DCopyHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_copy_c)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_copy_c)); #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, AV2Convolve2DCopyHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_copy_sse4_1)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_copy_sse4_1)); #endif #if HAVE_AVX2 INSTANTIATE_TEST_SUITE_P( AVX2, AV2Convolve2DCopyHighbdCompoundTest, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_copy_avx2)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_copy_avx2)); #endif ////////////////////////////////////////////////// @@ -1000,7 +995,7 @@ class AV2Convolve2DHighbdCompoundTestLarge const uint16_t *input2 = SecondRandomInput12(GetParam()); DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); DECLARE_ALIGNED(32, CONV_BUF_TYPE, reference_conv_buf[MAX_SB_SQUARE]); - Convolve(av2_highbd_dist_wtd_convolve_2d_c, input1, input2, reference, + Convolve(av2_highbd_cwp_convolve_2d_c, input1, input2, reference, reference_conv_buf, compound, h_f, v_f, sub_x, sub_y); DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); @@ -1038,14 +1033,14 @@ class AV2Convolve2DHighbdCompoundTestLarge avm_usec_timer timer; avm_usec_timer_start(&timer); for (int i = 0; i < num_iters; ++i) { - av2_highbd_dist_wtd_convolve_2d_c(input1, width, reference, kOutputStride, - width, height, filter_params_x, - filter_params_y, sub_x, sub_y, - &conv_params_ref1, bit_depth); - av2_highbd_dist_wtd_convolve_2d_c(input1, width, reference, kOutputStride, - width, height, filter_params_x, - filter_params_y, sub_x, sub_y, - &conv_params_ref2, bit_depth); + av2_highbd_cwp_convolve_2d_c(input1, width, reference, kOutputStride, + width, height, filter_params_x, + filter_params_y, sub_x, sub_y, + &conv_params_ref1, bit_depth); + av2_highbd_cwp_convolve_2d_c(input1, width, reference, kOutputStride, + width, height, filter_params_x, + filter_params_y, sub_x, sub_y, + &conv_params_ref2, bit_depth); } avm_usec_timer_mark(&timer); const int time1 = static_cast(avm_usec_timer_elapsed(&timer)); @@ -1104,20 +1099,19 @@ class AV2Convolve2DHighbdCompoundTestLarge TEST_P(AV2Convolve2DHighbdCompoundTestLarge, RunTest) { RunTest(); } TEST_P(AV2Convolve2DHighbdCompoundTestLarge, DISABLED_Speed) { SpeedTest(); } -INSTANTIATE_TEST_SUITE_P( - C, AV2Convolve2DHighbdCompoundTestLarge, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_c)); +INSTANTIATE_TEST_SUITE_P(C, AV2Convolve2DHighbdCompoundTestLarge, + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_c)); #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, AV2Convolve2DHighbdCompoundTestLarge, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_sse4_1)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_sse4_1)); #endif #if HAVE_AVX2 INSTANTIATE_TEST_SUITE_P( AVX2, AV2Convolve2DHighbdCompoundTestLarge, - BuildHighbdLumaParams(av2_highbd_dist_wtd_convolve_2d_avx2)); + BuildHighbdLumaParams(av2_highbd_cwp_convolve_2d_avx2)); #endif ////////////////////////////////////////////////////////// diff --git a/test/comp_avg_pred_test.cc b/test/comp_avg_pred_test.cc deleted file mode 100644 index 39f5da574b..0000000000 --- a/test/comp_avg_pred_test.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2021, Alliance for Open Media. All rights reserved - * - * This source code is subject to the terms of the BSD 3-Clause Clear License - * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear - * License was not distributed with this source code in the LICENSE file, you - * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the - * Alliance for Open Media Patent License 1.0 was not distributed with this - * source code in the PATENTS file, you can obtain it at - * aomedia.org/license/patent-license/. - */ - -#include "test/comp_avg_pred_test.h" - -using libavm_test::ACMRandom; -using libavm_test::AV2DISTWTDCOMPAVG::AV2HighBDDISTWTDCOMPAVGTest; -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AV2HighBDDISTWTDCOMPAVGTest); -using libavm_test::AV2DISTWTDCOMPAVG::AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest; -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST( - AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest); -using std::make_tuple; -using std::tuple; - -namespace { - -TEST_P(AV2HighBDDISTWTDCOMPAVGTest, DISABLED_Speed) { - RunSpeedTest(GET_PARAM(1)); -} - -TEST_P(AV2HighBDDISTWTDCOMPAVGTest, CheckOutput) { - RunCheckOutput(GET_PARAM(1)); -} - -#if HAVE_SSE2 -INSTANTIATE_TEST_SUITE_P(SSE2, AV2HighBDDISTWTDCOMPAVGTest, - libavm_test::AV2DISTWTDCOMPAVG::BuildParams( - avm_highbd_dist_wtd_comp_avg_pred_sse2, 1)); -#endif - -TEST_P(AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest, DISABLED_Speed) { - RunSpeedTest(GET_PARAM(1)); -} - -TEST_P(AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest, CheckOutput) { - RunCheckOutput(GET_PARAM(1)); -} - -#if HAVE_SSE2 -INSTANTIATE_TEST_SUITE_P(SSE2, AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest, - libavm_test::AV2DISTWTDCOMPAVG::BuildParams( - avm_highbd_dist_wtd_comp_avg_upsampled_pred_sse2)); -#endif - -} // namespace diff --git a/test/comp_weigh_pred_test.cc b/test/comp_weigh_pred_test.cc new file mode 100644 index 0000000000..8868df40b3 --- /dev/null +++ b/test/comp_weigh_pred_test.cc @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 3-Clause Clear License + * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear + * License was not distributed with this source code in the LICENSE file, you + * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the + * Alliance for Open Media Patent License 1.0 was not distributed with this + * source code in the PATENTS file, you can obtain it at + * aomedia.org/license/patent-license/. + */ + +#include "test/comp_weigh_pred_test.h" + +using libavm_test::ACMRandom; +using libavm_test::AV2CWP::AV2HighbdCwpTest; +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AV2HighbdCwpTest); +using libavm_test::AV2CWP::AV2HighbdCwpUpsampledTest; +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AV2HighbdCwpUpsampledTest); +using std::make_tuple; +using std::tuple; + +namespace { + +TEST_P(AV2HighbdCwpTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(1)); } + +TEST_P(AV2HighbdCwpTest, CheckOutput) { RunCheckOutput(GET_PARAM(1)); } + +#if HAVE_SSE2 +INSTANTIATE_TEST_SUITE_P(SSE2, AV2HighbdCwpTest, + libavm_test::AV2CWP::BuildParams(avm_highbd_cwp_sse2, + 1)); +#endif + +TEST_P(AV2HighbdCwpUpsampledTest, DISABLED_Speed) { + RunSpeedTest(GET_PARAM(1)); +} + +TEST_P(AV2HighbdCwpUpsampledTest, CheckOutput) { RunCheckOutput(GET_PARAM(1)); } + +#if HAVE_SSE2 +INSTANTIATE_TEST_SUITE_P( + SSE2, AV2HighbdCwpUpsampledTest, + libavm_test::AV2CWP::BuildParams(avm_highbd_cwp_upsampled_sse2)); +#endif + +} // namespace diff --git a/test/comp_avg_pred_test.h b/test/comp_weigh_pred_test.h similarity index 61% rename from test/comp_avg_pred_test.h rename to test/comp_weigh_pred_test.h index 0ff06eba4d..cc54c705e7 100644 --- a/test/comp_avg_pred_test.h +++ b/test/comp_weigh_pred_test.h @@ -10,8 +10,8 @@ * aomedia.org/license/patent-license/. */ -#ifndef AVM_TEST_COMP_AVG_PRED_TEST_H_ -#define AVM_TEST_COMP_AVG_PRED_TEST_H_ +#ifndef AVM_TEST_COMP_WEIGH_PRED_TEST_H_ +#define AVM_TEST_COMP_WEIGH_PRED_TEST_H_ #include @@ -28,75 +28,72 @@ namespace libavm_test { const int kMaxSize = MAX_SB_SIZE + 32; // padding -namespace AV2DISTWTDCOMPAVG { +namespace AV2CWP { -typedef void (*distwtdcompavg_func)(uint16_t *comp_pred, const uint16_t *pred, - int width, int height, const uint16_t *ref, - int ref_stride, - const DIST_WTD_COMP_PARAMS *jcp_param); +typedef void (*cwp_func)(uint16_t *comp_pred, const uint16_t *pred, int width, + int height, const uint16_t *ref, int ref_stride, + const CWP_PARAMS *cwp_param); -typedef void (*distwtdcompavgupsampled_func)( - MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, - const MV *const mv, uint8_t *comp_pred, const uint8_t *pred, int width, - int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref, - int ref_stride, const DIST_WTD_COMP_PARAMS *jcp_param, int subpel_search, - int is_scaled_ref); +typedef void (*cwp_upsampled_func)(MACROBLOCKD *xd, + const struct AV2Common *const cm, int mi_row, + int mi_col, const MV *const mv, + uint8_t *comp_pred, const uint8_t *pred, + int width, int height, int subpel_x_q3, + int subpel_y_q3, const uint8_t *ref, + int ref_stride, const CWP_PARAMS *cwp_param, + int subpel_search, int is_scaled_ref); -typedef std::tuple DISTWTDCOMPAVGParam; +typedef std::tuple CwpParam; -typedef std::tuple - DISTWTDCOMPAVGUPSAMPLEDParam; +typedef std::tuple CwpUpsampledParam; -typedef void (*highbddistwtdcompavgupsampled_func)( +typedef void (*highbd_cwp_upsampled_func)( MACROBLOCKD *xd, const struct AV2Common *const cm, int mi_row, int mi_col, const MV *const mv, uint16_t *comp_pred8, const uint16_t *pred8, int width, int height, int subpel_x_q3, int subpel_y_q3, const uint16_t *ref8, - int ref_stride, int bd, const DIST_WTD_COMP_PARAMS *jcp_param, - int subpel_search, int is_scaled_ref); + int ref_stride, int bd, const CWP_PARAMS *cwp_param, int subpel_search, + int is_scaled_ref); -typedef std::tuple - HighbdDISTWTDCOMPAVGUPSAMPLEDParam; +typedef std::tuple + HighbdCwpUpsampledParam; -typedef std::tuple - HighbdDISTWTDCOMPAVGParam; +typedef std::tuple HighbdCwpParam; -::testing::internal::ParamGenerator BuildParams( - distwtdcompavg_func filter, int is_hbd) { +::testing::internal::ParamGenerator BuildParams(cwp_func filter, + int is_hbd) { (void)is_hbd; return ::testing::Combine(::testing::Range(8, 13, 2), ::testing::Values(filter), ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL)); } -::testing::internal::ParamGenerator -BuildParams(highbddistwtdcompavgupsampled_func filter) { +::testing::internal::ParamGenerator BuildParams( + highbd_cwp_upsampled_func filter) { return ::testing::Combine(::testing::Range(8, 13, 2), ::testing::Values(filter), ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL)); } -::testing::internal::ParamGenerator BuildParams( - distwtdcompavg_func filter) { +::testing::internal::ParamGenerator BuildParams(cwp_func filter) { return ::testing::Combine(::testing::Values(filter), ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL)); } -::testing::internal::ParamGenerator BuildParams( - distwtdcompavgupsampled_func filter) { +::testing::internal::ParamGenerator BuildParams( + cwp_upsampled_func filter) { return ::testing::Combine(::testing::Values(filter), ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL)); } -class AV2HighBDDISTWTDCOMPAVGTest - : public ::testing::TestWithParam { +class AV2HighbdCwpTest : public ::testing::TestWithParam { public: - ~AV2HighBDDISTWTDCOMPAVGTest() {} + ~AV2HighbdCwpTest() {} void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); } void TearDown() { libavm_test::ClearSystemState(); } protected: - void RunCheckOutput(distwtdcompavg_func test_impl) { + void RunCheckOutput(cwp_func test_impl) { const int w = kMaxSize, h = kMaxSize; const int block_idx = GET_PARAM(2); const int bd = GET_PARAM(0); @@ -113,26 +110,25 @@ class AV2HighBDDISTWTDCOMPAVGTest const int in_w = block_size_wide[block_idx]; const int in_h = block_size_high[block_idx]; - DIST_WTD_COMP_PARAMS dist_wtd_comp_params; + CWP_PARAMS cwp_params; for (int ii = 0; ii < 2; ii++) { for (int jj = 0; jj < 4; jj++) { - dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii]; - dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[jj][1 - ii]; + cwp_params.fwd_offset = quant_dist_lookup_table[jj][ii]; + cwp_params.bck_offset = quant_dist_lookup_table[jj][1 - ii]; const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7); const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7); - avm_highbd_dist_wtd_comp_avg_pred_c( - output, pred8 + offset_r * w + offset_c, in_w, in_h, - ref8 + offset_r * w + offset_c, in_w, &dist_wtd_comp_params); + avm_highbd_cwp_c(output, pred8 + offset_r * w + offset_c, in_w, in_h, + ref8 + offset_r * w + offset_c, in_w, &cwp_params); test_impl(output2, pred8 + offset_r * w + offset_c, in_w, in_h, - ref8 + offset_r * w + offset_c, in_w, &dist_wtd_comp_params); + ref8 + offset_r * w + offset_c, in_w, &cwp_params); for (int i = 0; i < in_h; ++i) { for (int j = 0; j < in_w; ++j) { int idx = i * in_w + j; ASSERT_EQ(output[idx], output2[idx]) - << "Mismatch at unit tests for AV2HighBDDISTWTDCOMPAVGTest\n" + << "Mismatch at unit tests for AV2HighbdCwpTest\n" << in_w << "x" << in_h << " Pixel mismatch at index " << idx << " = (" << i << ", " << j << ")"; } @@ -140,7 +136,7 @@ class AV2HighBDDISTWTDCOMPAVGTest } } } - void RunSpeedTest(distwtdcompavg_func test_impl) { + void RunSpeedTest(cwp_func test_impl) { const int w = kMaxSize, h = kMaxSize; const int block_idx = GET_PARAM(2); const int bd = GET_PARAM(0); @@ -157,48 +153,47 @@ class AV2HighBDDISTWTDCOMPAVGTest const int in_w = block_size_wide[block_idx]; const int in_h = block_size_high[block_idx]; - DIST_WTD_COMP_PARAMS dist_wtd_comp_params; + CWP_PARAMS cwp_params; - dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0]; - dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1]; + cwp_params.fwd_offset = quant_dist_lookup_table[0][0]; + cwp_params.bck_offset = quant_dist_lookup_table[0][1]; const int num_loops = 1000000000 / (in_w + in_h); avm_usec_timer timer; avm_usec_timer_start(&timer); for (int i = 0; i < num_loops; ++i) - avm_highbd_dist_wtd_comp_avg_pred_c(output, pred8, in_w, in_h, ref8, in_w, - &dist_wtd_comp_params); + avm_highbd_cwp_c(output, pred8, in_w, in_h, ref8, in_w, &cwp_params); avm_usec_timer_mark(&timer); const int elapsed_time = static_cast(avm_usec_timer_elapsed(&timer)); - printf("highbddistwtdcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h, + printf("highbdcwp c_code %3dx%-3d: %7.2f us\n", in_w, in_h, 1000.0 * elapsed_time / num_loops); avm_usec_timer timer1; avm_usec_timer_start(&timer1); for (int i = 0; i < num_loops; ++i) - test_impl(output2, pred8, in_w, in_h, ref8, in_w, &dist_wtd_comp_params); + test_impl(output2, pred8, in_w, in_h, ref8, in_w, &cwp_params); avm_usec_timer_mark(&timer1); const int elapsed_time1 = static_cast(avm_usec_timer_elapsed(&timer1)); - printf("highbddistwtdcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h, + printf("highbdcwp test_code %3dx%-3d: %7.2f us\n", in_w, in_h, 1000.0 * elapsed_time1 / num_loops); } libavm_test::ACMRandom rnd_; -}; // class AV2HighBDDISTWTDCOMPAVGTest +}; // class AV2HighbdCwpTest -class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest - : public ::testing::TestWithParam { +class AV2HighbdCwpUpsampledTest + : public ::testing::TestWithParam { public: - ~AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest() {} + ~AV2HighbdCwpUpsampledTest() {} void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); } void TearDown() { libavm_test::ClearSystemState(); } protected: - void RunCheckOutput(highbddistwtdcompavgupsampled_func test_impl) { + void RunCheckOutput(highbd_cwp_upsampled_func test_impl) { const int w = kMaxSize, h = kMaxSize; const int block_idx = GET_PARAM(2); const int bd = GET_PARAM(0); @@ -215,7 +210,7 @@ class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest const int in_w = block_size_wide[block_idx]; const int in_h = block_size_high[block_idx]; - DIST_WTD_COMP_PARAMS dist_wtd_comp_params; + CWP_PARAMS cwp_params; int sub_x_q3, sub_y_q3; int subpel_search; for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS; @@ -224,29 +219,28 @@ class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) { for (int ii = 0; ii < 2; ii++) { for (int jj = 0; jj < 4; jj++) { - dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii]; - dist_wtd_comp_params.bck_offset = - quant_dist_lookup_table[jj][1 - ii]; + cwp_params.fwd_offset = quant_dist_lookup_table[jj][ii]; + cwp_params.bck_offset = quant_dist_lookup_table[jj][1 - ii]; const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7); const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7); - avm_highbd_dist_wtd_comp_avg_upsampled_pred_c( - NULL, NULL, 0, 0, NULL, output, - pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3, - sub_y_q3, ref8 + offset_r * w + offset_c, in_w, bd, - &dist_wtd_comp_params, subpel_search, 0); + avm_highbd_cwp_upsampled_c(NULL, NULL, 0, 0, NULL, output, + pred8 + offset_r * w + offset_c, in_w, + in_h, sub_x_q3, sub_y_q3, + ref8 + offset_r * w + offset_c, in_w, + bd, &cwp_params, subpel_search, 0); test_impl(NULL, NULL, 0, 0, NULL, output2, pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3, sub_y_q3, ref8 + offset_r * w + offset_c, in_w, bd, - &dist_wtd_comp_params, subpel_search, 0); + &cwp_params, subpel_search, 0); for (int i = 0; i < in_h; ++i) { for (int j = 0; j < in_w; ++j) { int idx = i * in_w + j; ASSERT_EQ(output[idx], output2[idx]) << "Mismatch at unit tests for " - "AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest\n" + "AV2HighbdCwpUpsampledTest\n" << in_w << "x" << in_h << " Pixel mismatch at index " << idx << " = (" << i << ", " << j << "), sub pixel offset = (" << sub_y_q3 << ", " @@ -259,7 +253,7 @@ class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest } } } - void RunSpeedTest(highbddistwtdcompavgupsampled_func test_impl) { + void RunSpeedTest(highbd_cwp_upsampled_func test_impl) { const int w = kMaxSize, h = kMaxSize; const int block_idx = GET_PARAM(2); const int bd = GET_PARAM(0); @@ -276,10 +270,10 @@ class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest const int in_w = block_size_wide[block_idx]; const int in_h = block_size_high[block_idx]; - DIST_WTD_COMP_PARAMS dist_wtd_comp_params; + CWP_PARAMS cwp_params; - dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0]; - dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1]; + cwp_params.fwd_offset = quant_dist_lookup_table[0][0]; + cwp_params.bck_offset = quant_dist_lookup_table[0][1]; int sub_x_q3 = 0; int sub_y_q3 = 0; const int num_loops = 1000000000 / (in_w + in_h); @@ -287,33 +281,32 @@ class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest avm_usec_timer_start(&timer); int subpel_search = USE_8_TAPS; // set to USE_4_TAPS to test 4-tap filter. for (int i = 0; i < num_loops; ++i) - avm_highbd_dist_wtd_comp_avg_upsampled_pred_c( - NULL, NULL, 0, 0, NULL, output, pred8, in_w, in_h, sub_x_q3, sub_y_q3, - ref8, in_w, bd, &dist_wtd_comp_params, subpel_search, 0); + avm_highbd_cwp_upsampled_c(NULL, NULL, 0, 0, NULL, output, pred8, in_w, + in_h, sub_x_q3, sub_y_q3, ref8, in_w, bd, + &cwp_params, subpel_search, 0); avm_usec_timer_mark(&timer); const int elapsed_time = static_cast(avm_usec_timer_elapsed(&timer)); - printf("highbddistwtdcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, - in_h, 1000.0 * elapsed_time / num_loops); + printf("highbdcwpupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h, + 1000.0 * elapsed_time / num_loops); avm_usec_timer timer1; avm_usec_timer_start(&timer1); for (int i = 0; i < num_loops; ++i) test_impl(NULL, NULL, 0, 0, NULL, output2, pred8, in_w, in_h, sub_x_q3, - sub_y_q3, ref8, in_w, bd, &dist_wtd_comp_params, subpel_search, - 0); + sub_y_q3, ref8, in_w, bd, &cwp_params, subpel_search, 0); avm_usec_timer_mark(&timer1); const int elapsed_time1 = static_cast(avm_usec_timer_elapsed(&timer1)); - printf("highbddistwtdcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w, - in_h, 1000.0 * elapsed_time1 / num_loops); + printf("highbdcwpupsampled test_code %3dx%-3d: %7.2f us\n", in_w, in_h, + 1000.0 * elapsed_time1 / num_loops); } libavm_test::ACMRandom rnd_; -}; // class AV2HighBDDISTWTDCOMPAVGUPSAMPLEDTest +}; // class AV2HighbdCwpUpsampledTest -} // namespace AV2DISTWTDCOMPAVG +} // namespace AV2CWP } // namespace libavm_test -#endif // AVM_TEST_COMP_AVG_PRED_TEST_H_ +#endif // AVM_TEST_COMP_WEIGH_PRED_TEST_H_ diff --git a/test/sad_test.cc b/test/sad_test.cc index 104aeca572..467b2a24d2 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -45,26 +45,21 @@ typedef uint32_t (*SadMxNAvgFunc)(const uint16_t *src_ptr, int src_stride, const uint16_t *second_pred); typedef std::tuple SadMxNAvgParam; -typedef void (*DistWtdCompAvgFunc)(uint16_t *comp_pred, const uint16_t *pred, - int width, int height, const uint16_t *ref, - int ref_stride, - const DIST_WTD_COMP_PARAMS *jcp_param); -typedef std::tuple DistWtdCompAvgParam; - -typedef unsigned int (*DistWtdSadMxhFunc)(const uint16_t *src_ptr, - int src_stride, - const uint16_t *ref_ptr, - int ref_stride, int width, - int height); -typedef std::tuple DistWtdSadMxhParam; - -typedef uint32_t (*DistWtdSadMxNAvgFunc)(const uint16_t *src_ptr, - int src_stride, - const uint16_t *ref_ptr, - int ref_stride, - const uint16_t *second_pred, - const DIST_WTD_COMP_PARAMS *jcp_param); -typedef std::tuple DistWtdSadMxNAvgParam; +typedef void (*CwpFunc)(uint16_t *comp_pred, const uint16_t *pred, int width, + int height, const uint16_t *ref, int ref_stride, + const CWP_PARAMS *cwp_param); +typedef std::tuple CwpParam; + +typedef unsigned int (*CwpSadMxhFunc)(const uint16_t *src_ptr, int src_stride, + const uint16_t *ref_ptr, int ref_stride, + int width, int height); +typedef std::tuple CwpSadMxhParam; + +typedef uint32_t (*CwpSadMxNAvgFunc)(const uint16_t *src_ptr, int src_stride, + const uint16_t *ref_ptr, int ref_stride, + const uint16_t *second_pred, + const CWP_PARAMS *cwp_param); +typedef std::tuple CwpSadMxNAvgParam; typedef void (*SadMxNx4Func)(const uint16_t *src_ptr, int src_stride, const uint16_t *const ref_ptr[], int ref_stride, @@ -207,21 +202,21 @@ class SADTestBase : public ::testing::Test { return sad; } - void ReferenceDistWtdCompAvg(int block_idx) { + void ReferenceCwp(int block_idx) { const uint16_t *const reference16 = GetReference(block_idx); const uint16_t *const second_pred16 = second_pred_; uint16_t *const comp_pred16 = comp_pred_; for (int h = 0; h < height_; ++h) { for (int w = 0; w < width_; ++w) { const int tmp = - second_pred16[h * width_ + w] * jcp_param_.bck_offset + - reference16[h * reference_stride_ + w] * jcp_param_.fwd_offset; + second_pred16[h * width_ + w] * cwp_param_.bck_offset + + reference16[h * reference_stride_ + w] * cwp_param_.fwd_offset; comp_pred16[h * width_ + w] = ROUND_POWER_OF_TWO(tmp, 4); } } } - unsigned int ReferenceDistWtdSADavg(int block_idx) { + unsigned int ReferenceCwpSadAvg(int block_idx) { unsigned int sad = 0; const uint16_t *const reference16 = GetReference(block_idx); const uint16_t *const source16 = source_data_; @@ -229,8 +224,8 @@ class SADTestBase : public ::testing::Test { for (int h = 0; h < height_; ++h) { for (int w = 0; w < width_; ++w) { const int tmp = - second_pred16[h * width_ + w] * jcp_param_.bck_offset + - reference16[h * reference_stride_ + w] * jcp_param_.fwd_offset; + second_pred16[h * width_ + w] * cwp_param_.bck_offset + + reference16[h * reference_stride_ + w] * cwp_param_.fwd_offset; const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 4); sad += abs(source16[h * source_stride_ + w] - comp_pred); } @@ -270,7 +265,7 @@ class SADTestBase : public ::testing::Test { static uint16_t *comp_pred16_; static uint16_t *comp_pred_test_; static uint16_t *comp_pred16_test_; - DIST_WTD_COMP_PARAMS jcp_param_; + CWP_PARAMS cwp_param_; ACMRandom rnd_; }; @@ -521,30 +516,28 @@ class SADavgTest : public ::testing::WithParamInterface, } }; -class DistWtdCompAvgTest - : public ::testing::WithParamInterface, - public SADTestBase { +class CwpTest : public ::testing::WithParamInterface, + public SADTestBase { public: - DistWtdCompAvgTest() - : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} + CwpTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} protected: - void dist_wtd_comp_avg(int block_idx) { + void CompWtdPred(int block_idx) { const uint16_t *const reference = GetReference(block_idx); ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(comp_pred_test_, second_pred_, width_, height_, reference, reference_stride_, - &jcp_param_)); + &cwp_param_)); } void CheckCompAvg() { for (int j = 0; j < 2; ++j) { for (int i = 0; i < 4; ++i) { - jcp_param_.fwd_offset = quant_dist_lookup_table[i][j]; - jcp_param_.bck_offset = quant_dist_lookup_table[i][1 - j]; + cwp_param_.fwd_offset = quant_dist_lookup_table[i][j]; + cwp_param_.bck_offset = quant_dist_lookup_table[i][1 - j]; - ReferenceDistWtdCompAvg(0); - dist_wtd_comp_avg(0); + ReferenceCwp(0); + CompWtdPred(0); for (int y = 0; y < height_; ++y) for (int x = 0; x < width_; ++x) @@ -554,12 +547,12 @@ class DistWtdCompAvgTest } } }; -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DistWtdCompAvgTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CwpTest); -class DistWtdSADTest : public ::testing::WithParamInterface, - public SADTestBase { +class CwpSadTest : public ::testing::WithParamInterface, + public SADTestBase { public: - DistWtdSADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} + CwpSadTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} protected: unsigned int SAD(int block_idx) { @@ -587,40 +580,39 @@ class DistWtdSADTest : public ::testing::WithParamInterface, } } }; -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DistWtdSADTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CwpSadTest); -class DistWtdSADavgTest - : public ::testing::WithParamInterface, - public SADTestBase { +class CwpSadAvgTest : public ::testing::WithParamInterface, + public SADTestBase { public: - DistWtdSADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} + CwpSadAvgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {} protected: - unsigned int dist_wtd_SAD_avg(int block_idx) { + unsigned int CwpSadAvg(int block_idx) { unsigned int ret; const uint16_t *const reference = GetReference(block_idx); ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, reference, reference_stride_, - second_pred_, &jcp_param_)); + second_pred_, &cwp_param_)); return ret; } void CheckSAD() { for (int j = 0; j < 2; ++j) { for (int i = 0; i < 4; ++i) { - jcp_param_.fwd_offset = quant_dist_lookup_table[i][j]; - jcp_param_.bck_offset = quant_dist_lookup_table[i][1 - j]; + cwp_param_.fwd_offset = quant_dist_lookup_table[i][j]; + cwp_param_.bck_offset = quant_dist_lookup_table[i][1 - j]; - const unsigned int reference_sad = ReferenceDistWtdSADavg(0); - const unsigned int exp_sad = dist_wtd_SAD_avg(0); + const unsigned int reference_sad = ReferenceCwpSadAvg(0); + const unsigned int exp_sad = CwpSadAvg(0); ASSERT_EQ(reference_sad, exp_sad); } } } }; -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DistWtdSADavgTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CwpSadAvgTest); uint16_t *SADTestBase::source_data_ = NULL; uint16_t *SADTestBase::reference_data_ = NULL; @@ -844,19 +836,19 @@ TEST_P(SADavgTest, ShortSrc) { source_stride_ = tmp_stride; } -TEST_P(DistWtdCompAvgTest, MaxRef) { +TEST_P(CwpTest, MaxRef) { FillConstant(reference_data_, reference_stride_, mask_); FillConstant(second_pred_, width_, 0); CheckCompAvg(); } -TEST_P(DistWtdCompAvgTest, MaxSecondPred) { +TEST_P(CwpTest, MaxSecondPred) { FillConstant(reference_data_, reference_stride_, 0); FillConstant(second_pred_, width_, mask_); CheckCompAvg(); } -TEST_P(DistWtdCompAvgTest, ShortRef) { +TEST_P(CwpTest, ShortRef) { const int tmp_stride = reference_stride_; reference_stride_ >>= 1; FillRandom(reference_data_, reference_stride_); @@ -865,7 +857,7 @@ TEST_P(DistWtdCompAvgTest, ShortRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdCompAvgTest, UnalignedRef) { +TEST_P(CwpTest, UnalignedRef) { // The reference frame, but not the source frame, may be unaligned for // certain types of searches. const int tmp_stride = reference_stride_; @@ -876,19 +868,19 @@ TEST_P(DistWtdCompAvgTest, UnalignedRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdSADTest, MaxRef) { +TEST_P(CwpSadTest, MaxRef) { FillConstant(source_data_, source_stride_, 0); FillConstant(reference_data_, reference_stride_, mask_); CheckSAD(); } -TEST_P(DistWtdSADTest, MaxSrc) { +TEST_P(CwpSadTest, MaxSrc) { FillConstant(source_data_, source_stride_, mask_); FillConstant(reference_data_, reference_stride_, 0); CheckSAD(); } -TEST_P(DistWtdSADTest, ShortRef) { +TEST_P(CwpSadTest, ShortRef) { const int tmp_stride = reference_stride_; reference_stride_ >>= 1; FillRandom(source_data_, source_stride_); @@ -897,7 +889,7 @@ TEST_P(DistWtdSADTest, ShortRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdSADTest, UnalignedRef) { +TEST_P(CwpSadTest, UnalignedRef) { // The reference frame, but not the source frame, may be unaligned for // certain types of searches. const int tmp_stride = reference_stride_; @@ -908,7 +900,7 @@ TEST_P(DistWtdSADTest, UnalignedRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdSADTest, ShortSrc) { +TEST_P(CwpSadTest, ShortSrc) { const int tmp_stride = source_stride_; source_stride_ >>= 1; int test_count = 2000; @@ -921,20 +913,20 @@ TEST_P(DistWtdSADTest, ShortSrc) { source_stride_ = tmp_stride; } -TEST_P(DistWtdSADavgTest, MaxRef) { +TEST_P(CwpSadAvgTest, MaxRef) { FillConstant(source_data_, source_stride_, 0); FillConstant(reference_data_, reference_stride_, mask_); FillConstant(second_pred_, width_, 0); CheckSAD(); } -TEST_P(DistWtdSADavgTest, MaxSrc) { +TEST_P(CwpSadAvgTest, MaxSrc) { FillConstant(source_data_, source_stride_, mask_); FillConstant(reference_data_, reference_stride_, 0); FillConstant(second_pred_, width_, 0); CheckSAD(); } -TEST_P(DistWtdSADavgTest, ShortRef) { +TEST_P(CwpSadAvgTest, ShortRef) { const int tmp_stride = reference_stride_; reference_stride_ >>= 1; FillRandom(source_data_, source_stride_); @@ -944,7 +936,7 @@ TEST_P(DistWtdSADavgTest, ShortRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdSADavgTest, UnalignedRef) { +TEST_P(CwpSadAvgTest, UnalignedRef) { // The reference frame, but not the source frame, may be unaligned for // certain types of searches. const int tmp_stride = reference_stride_; @@ -956,7 +948,7 @@ TEST_P(DistWtdSADavgTest, UnalignedRef) { reference_stride_ = tmp_stride; } -TEST_P(DistWtdSADavgTest, ShortSrc) { +TEST_P(CwpSadAvgTest, ShortSrc) { const int tmp_stride = source_stride_; source_stride_ >>= 1; int test_count = 2000; diff --git a/test/test.cmake b/test/test.cmake index 87254db90e..4fe046b3fd 100644 --- a/test/test.cmake +++ b/test/test.cmake @@ -212,10 +212,10 @@ if(NOT BUILD_SHARED_LIBS) "${AVM_ROOT}/test/av2_ccso_simd_cmp.cc" "${AVM_ROOT}/test/blend_a64_mask_1d_test.cc" "${AVM_ROOT}/test/blend_a64_mask_test.cc" - "${AVM_ROOT}/test/comp_avg_pred_test.cc" - "${AVM_ROOT}/test/comp_avg_pred_test.h" "${AVM_ROOT}/test/comp_avg_test.cc" "${AVM_ROOT}/test/comp_mask_variance_test.cc" + "${AVM_ROOT}/test/comp_weigh_pred_test.cc" + "${AVM_ROOT}/test/comp_weigh_pred_test.h" "${AVM_ROOT}/test/edge_detect_test.cc" "${AVM_ROOT}/test/encodetxb_test.cc" "${AVM_ROOT}/test/error_block_test.cc" diff --git a/test/variance_test.cc b/test/variance_test.cc index 1673d6346f..df5657fd3b 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -48,10 +48,12 @@ typedef unsigned int (*SubpixAvgVarMxNFunc)(const uint16_t *a, int a_stride, typedef unsigned int (*Get4x4SseFunc)(const uint16_t *a, int a_stride, const uint16_t *b, int b_stride); typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src); -typedef unsigned int (*DistWtdSubpixAvgVarMxNFunc)( - const uint16_t *a, int a_stride, int xoffset, int yoffset, - const uint16_t *b, int b_stride, uint32_t *sse, const uint16_t *second_pred, - const DIST_WTD_COMP_PARAMS *jcp_param); +typedef unsigned int (*CwpSubpixAvgVarMxNFunc)(const uint16_t *a, int a_stride, + int xoffset, int yoffset, + const uint16_t *b, int b_stride, + uint32_t *sse, + const uint16_t *second_pred, + const CWP_PARAMS *cwp_param); using libavm_test::ACMRandom; @@ -519,7 +521,7 @@ class SubpelVarianceTest uint16_t *ref_; uint16_t *sec_; TestParams params_; - DIST_WTD_COMP_PARAMS jcp_param_; + CWP_PARAMS cwp_param_; // some relay helpers int byte_shift() const { return params_.bit_depth - 8; } @@ -661,7 +663,7 @@ INSTANTIATE_TEST_SUITE_P(C, SumOfSquaresTest, typedef TestParams VarianceParams; typedef TestParams SubpelVarianceParams; typedef TestParams SubpelAvgVarianceParams; -typedef TestParams DistWtdSubpelAvgVarianceParams; +typedef TestParams CwpSubpelAvgVarianceParams; typedef uint64_t (*MseHBDWxH16bitFunc)(uint16_t *dst, int dstride, uint16_t *src, int sstride, int w,