Add test suite for av1_highbd_convolve_x_sr_intrabc Add test suite for IntraBC version of high bitdepth horizontal convolution. Change-Id: I241142998e1fc02e29534b23570c6f2574a55ddd
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index 752ec25..ff74c16 100644 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl
@@ -582,6 +582,7 @@ add_proto qw/void av1_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 av1_highbd_convolve_2d_sr_intrabc/, "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 av1_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 av1_highbd_convolve_x_sr_intrabc/, "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 av1_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 av1_highbd_convolve_y_sr_intrabc/, "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 av1_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";
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc index b913eff..5e7f725 100644 --- a/test/av1_convolve_test.cc +++ b/test/av1_convolve_test.cc
@@ -631,6 +631,88 @@ BuildHighbdParams(av1_highbd_convolve_x_sr_neon)); #endif +///////////////////////////////////////////////////////////////// +// Single reference convolve-x IntraBC functions (high bit-depth) +///////////////////////////////////////////////////////////////// + +class AV1ConvolveXHighbdIntraBCTest + : public AV1ConvolveTest<highbd_convolve_x_func> { + public: + void RunTest() { + // IntraBC functions only operate for subpel_x_qn = 8. + constexpr int kSubX = 8; + const int width = GetParam().Block().Width(); + const int height = GetParam().Block().Height(); + const int bit_depth = GetParam().BitDepth(); + const InterpFilterParams *filter_params_x = &av1_intrabc_filter_params; + const uint16_t *input = FirstRandomInput16(GetParam()); + + ConvolveParams conv_params1 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, bit_depth); + DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); + // Use a stride different from width to avoid potential storing errors that + // would go undetected. The input buffer is filled using a padding of 12, so + // the stride can be anywhere between width and width + 12. + av1_highbd_convolve_x_sr_intrabc_c( + input, width + 2, reference, kOutputStride, width, height, + filter_params_x, kSubX, &conv_params1, bit_depth); + + ConvolveParams conv_params2 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, bit_depth); + DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); + GetParam().TestFunction()(input, width + 2, test, kOutputStride, width, + height, filter_params_x, kSubX, &conv_params2, + bit_depth); + + AssertOutputBufferEq(reference, test, width, height); + } + + void SpeedTest() { + constexpr int kNumIters = 10000; + const InterpFilter filter = static_cast<InterpFilter>(BILINEAR); + const int width = GetParam().Block().Width(); + const int height = GetParam().Block().Height(); + const int bit_depth = GetParam().BitDepth(); + const InterpFilterParams *filter_params_x = &av1_intrabc_filter_params; + const uint16_t *input = FirstRandomInput16(GetParam()); + + ConvolveParams conv_params1 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, 8); + DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); + aom_usec_timer timer; + aom_usec_timer_start(&timer); + for (int i = 0; i < kNumIters; ++i) { + av1_highbd_convolve_x_sr_intrabc_c(input, width, reference, kOutputStride, + width, height, filter_params_x, 0, + &conv_params1, bit_depth); + } + aom_usec_timer_mark(&timer); + const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer)); + + ConvolveParams conv_params2 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, 8); + highbd_convolve_x_func test_func = GetParam().TestFunction(); + DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); + aom_usec_timer_start(&timer); + for (int i = 0; i < kNumIters; ++i) { + test_func(input, width, test, kOutputStride, width, height, + filter_params_x, 0, &conv_params2, bit_depth); + } + aom_usec_timer_mark(&timer); + const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer)); + + printf("%d %3dx%-3d:%7.2f/%7.2fns (%3.2f)\n", filter, width, height, time1, + time2, time1 / time2); + } +}; + +TEST_P(AV1ConvolveXHighbdIntraBCTest, RunTest) { RunTest(); } + +TEST_P(AV1ConvolveXHighbdIntraBCTest, DISABLED_SpeedTest) { SpeedTest(); } + +INSTANTIATE_TEST_SUITE_P(C, AV1ConvolveXHighbdIntraBCTest, + BuildHighbdParams(av1_highbd_convolve_x_sr_intrabc_c)); + #endif // CONFIG_AV1_HIGHBITDEPTH ////////////////////////////////////////////////////////