Add test suite for av1_highbd_convolve_2d_sr_intrabc Add test suite for IntraBC version of high bitdepth 2d convolution. Change-Id: I37a1cc37b18d917deb02a79750e7477a1303328c
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index 7acc306..feb81eb 100644 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl
@@ -580,6 +580,7 @@ add_proto qw/void av1_dist_wtd_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, ConvolveParams *conv_params"; if(aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") { 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_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_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 d026adc..393f557 100644 --- a/test/av1_convolve_test.cc +++ b/test/av1_convolve_test.cc
@@ -1355,6 +1355,97 @@ BuildHighbdParams(av1_highbd_convolve_2d_sr_neon)); #endif +////////////////////////////////////////////////////////////////// +// Single reference convolve-2d IntraBC functions (high bit-depth) +////////////////////////////////////////////////////////////////// + +class AV1Convolve2DHighbdIntraBCTest + : public AV1ConvolveTest<highbd_convolve_2d_func> { + public: + void RunTest() { + // IntraBC functions only operate for subpel_x_qn = 8 and subpel_y_qn = 8. + constexpr int kSubX = 8; + constexpr int kSubY = 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 InterpFilterParams *filter_params_y = &av1_intrabc_filter_params; + const uint16_t *input = FirstRandomInput16(GetParam()); + + DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); + ConvolveParams conv_params1 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, bit_depth); + // 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_2d_sr_intrabc_c(input, width + 2, reference, + kOutputStride, width, height, + filter_params_x, filter_params_y, kSubX, + kSubY, &conv_params1, bit_depth); + + DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); + ConvolveParams conv_params2 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, bit_depth); + GetParam().TestFunction()(input, width + 2, test, kOutputStride, width, + height, filter_params_x, filter_params_y, kSubX, + kSubY, &conv_params2, bit_depth); + + AssertOutputBufferEq(reference, test, width, height); + } + + void SpeedTest() { + constexpr int kNumIters = 10000; + const InterpFilter h_f = static_cast<InterpFilter>(BILINEAR); + const InterpFilter v_f = 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_get_interp_filter_params_with_block_size(h_f, width); + const InterpFilterParams *filter_params_y = + av1_get_interp_filter_params_with_block_size(v_f, height); + const uint16_t *input = FirstRandomInput16(GetParam()); + + DECLARE_ALIGNED(32, uint16_t, reference[MAX_SB_SQUARE]); + ConvolveParams conv_params1 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, 8); + aom_usec_timer timer; + aom_usec_timer_start(&timer); + for (int i = 0; i < kNumIters; ++i) { + av1_highbd_convolve_2d_sr_intrabc_c( + input, width, reference, kOutputStride, width, height, + filter_params_x, filter_params_y, 0, 0, &conv_params1, bit_depth); + } + aom_usec_timer_mark(&timer); + const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer)); + + DECLARE_ALIGNED(32, uint16_t, test[MAX_SB_SQUARE]); + highbd_convolve_2d_func test_func = GetParam().TestFunction(); + ConvolveParams conv_params2 = + get_conv_params_no_round(0, 0, nullptr, 0, 0, 8); + aom_usec_timer_start(&timer); + for (int i = 0; i < kNumIters; ++i) { + test_func(input, width, test, kOutputStride, width, height, + filter_params_x, filter_params_y, 0, 0, &conv_params2, + bit_depth); + } + aom_usec_timer_mark(&timer); + const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer)); + + printf("%d - %d %3dx%-3d:%7.2f/%7.2fns (%3.2f)\n", h_f, v_f, width, height, + time1, time2, time1 / time2); + } +}; + +TEST_P(AV1Convolve2DHighbdIntraBCTest, RunTest) { RunTest(); } + +TEST_P(AV1Convolve2DHighbdIntraBCTest, DISABLED_SpeedTest) { SpeedTest(); } + +INSTANTIATE_TEST_SUITE_P( + C, AV1Convolve2DHighbdIntraBCTest, + BuildHighbdParams(av1_highbd_convolve_2d_sr_intrabc_c)); + #endif // CONFIG_AV1_HIGHBITDEPTH //////////////////////////