Remove obmc from real time only build Reduce binary size by 280K. Realtime encoder is bitexact. Bug:aomedia:2865 Change-Id: I8f76b81adaf88f0eaa3ab467caf3cdf6965ef347
diff --git a/aom_dsp/aom_dsp.cmake b/aom_dsp/aom_dsp.cmake index 7deae83..7a56223 100644 --- a/aom_dsp/aom_dsp.cmake +++ b/aom_dsp/aom_dsp.cmake
@@ -254,6 +254,12 @@ "${AOM_ROOT}/aom_dsp/x86/highbd_variance_avx2.c") endif() + if(CONFIG_REALTIME_ONLY) + list(REMOVE_ITEM AOM_DSP_ENCODER_INTRIN_AVX2 + "${AOM_ROOT}/aom_dsp/x86/obmc_sad_avx2.c" + "${AOM_ROOT}/aom_dsp/x86/obmc_variance_avx2.c") + endif() + list(APPEND AOM_DSP_ENCODER_INTRIN_AVX "${AOM_ROOT}/aom_dsp/x86/aom_quantize_avx.c") @@ -279,6 +285,12 @@ "${AOM_ROOT}/aom_dsp/x86/highbd_variance_sse4.c") endif() + if(CONFIG_REALTIME_ONLY) + list(REMOVE_ITEM AOM_DSP_ENCODER_INTRIN_SSE4_1 + "${AOM_ROOT}/aom_dsp/x86/obmc_sad_sse4.c" + "${AOM_ROOT}/aom_dsp/x86/obmc_variance_sse4.c") + endif() + list(APPEND AOM_DSP_ENCODER_INTRIN_NEON "${AOM_ROOT}/aom_dsp/arm/sad4d_neon.c" "${AOM_ROOT}/aom_dsp/arm/sad_neon.c" "${AOM_ROOT}/aom_dsp/arm/subpel_variance_neon.c"
diff --git a/aom_dsp/aom_dsp_rtcd_defs.pl b/aom_dsp/aom_dsp_rtcd_defs.pl index 53ce507..6f8f19b 100755 --- a/aom_dsp/aom_dsp_rtcd_defs.pl +++ b/aom_dsp/aom_dsp_rtcd_defs.pl
@@ -851,20 +851,22 @@ # # OBMC SAD # - foreach (@block_sizes) { - ($w, $h) = @$_; - add_proto qw/unsigned int/, "aom_obmc_sad${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask"; - if (! (($w == 128 && $h == 32) || ($w == 32 && $h == 128))) { - specialize "aom_obmc_sad${w}x${h}", qw/sse4_1 avx2/; - } - } - - if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") { + if (aom_config("CONFIG_REALTIME_ONLY") ne "yes") { foreach (@block_sizes) { ($w, $h) = @$_; - add_proto qw/unsigned int/, "aom_highbd_obmc_sad${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask"; + add_proto qw/unsigned int/, "aom_obmc_sad${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask"; if (! (($w == 128 && $h == 32) || ($w == 32 && $h == 128))) { - specialize "aom_highbd_obmc_sad${w}x${h}", qw/sse4_1 avx2/; + specialize "aom_obmc_sad${w}x${h}", qw/sse4_1 avx2/; + } + } + + if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") { + foreach (@block_sizes) { + ($w, $h) = @$_; + add_proto qw/unsigned int/, "aom_highbd_obmc_sad${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask"; + if (! (($w == 128 && $h == 32) || ($w == 32 && $h == 128))) { + specialize "aom_highbd_obmc_sad${w}x${h}", qw/sse4_1 avx2/; + } } } } @@ -1392,21 +1394,23 @@ # # OBMC Variance / OBMC Subpixel Variance # - foreach (@block_sizes) { - ($w, $h) = @$_; - add_proto qw/unsigned int/, "aom_obmc_variance${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; - add_proto qw/unsigned int/, "aom_obmc_sub_pixel_variance${w}x${h}", "const uint8_t *pre, int pre_stride, int xoffset, int yoffset, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; - specialize "aom_obmc_variance${w}x${h}", qw/sse4_1 avx2/; - specialize "aom_obmc_sub_pixel_variance${w}x${h}", q/sse4_1/; - } + if (aom_config("CONFIG_REALTIME_ONLY") ne "yes") { + foreach (@block_sizes) { + ($w, $h) = @$_; + add_proto qw/unsigned int/, "aom_obmc_variance${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; + add_proto qw/unsigned int/, "aom_obmc_sub_pixel_variance${w}x${h}", "const uint8_t *pre, int pre_stride, int xoffset, int yoffset, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; + specialize "aom_obmc_variance${w}x${h}", qw/sse4_1 avx2/; + specialize "aom_obmc_sub_pixel_variance${w}x${h}", q/sse4_1/; + } - if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") { - foreach $bd ("_", "_10_", "_12_") { - foreach (@block_sizes) { - ($w, $h) = @$_; - add_proto qw/unsigned int/, "aom_highbd${bd}obmc_variance${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; - add_proto qw/unsigned int/, "aom_highbd${bd}obmc_sub_pixel_variance${w}x${h}", "const uint8_t *pre, int pre_stride, int xoffset, int yoffset, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; - specialize "aom_highbd${bd}obmc_variance${w}x${h}", qw/sse4_1/; + if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") { + foreach $bd ("_", "_10_", "_12_") { + foreach (@block_sizes) { + ($w, $h) = @$_; + add_proto qw/unsigned int/, "aom_highbd${bd}obmc_variance${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; + add_proto qw/unsigned int/, "aom_highbd${bd}obmc_sub_pixel_variance${w}x${h}", "const uint8_t *pre, int pre_stride, int xoffset, int yoffset, const int32_t *wsrc, const int32_t *mask, unsigned int *sse"; + specialize "aom_highbd${bd}obmc_variance${w}x${h}", qw/sse4_1/; + } } } }
diff --git a/aom_dsp/sad_av1.c b/aom_dsp/sad_av1.c index 4675181..3c90bf8 100644 --- a/aom_dsp/sad_av1.c +++ b/aom_dsp/sad_av1.c
@@ -156,6 +156,7 @@ HIGHBD_MASKSADMXN(64, 16) #endif // CONFIG_AV1_HIGHBITDEPTH +#if !CONFIG_REALTIME_ONLY // pre: predictor being evaluated // wsrc: target weighted prediction (has been *4096 to keep precision) // mask: 2d weights (scaled by 4096) @@ -262,3 +263,4 @@ HIGHBD_OBMCSADMXN(64, 16) /* clang-format on */ #endif // CONFIG_AV1_HIGHBITDEPTH +#endif // !CONFIG_REALTIME_ONLY
diff --git a/aom_dsp/variance.c b/aom_dsp/variance.c index 6ddb916..c0b0626 100644 --- a/aom_dsp/variance.c +++ b/aom_dsp/variance.c
@@ -1183,6 +1183,7 @@ HIGHBD_MASK_SUBPIX_VAR(64, 16) #endif // CONFIG_AV1_HIGHBITDEPTH +#if !CONFIG_REALTIME_ONLY static INLINE void obmc_variance(const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, int w, int h, unsigned int *sse, int *sum) { @@ -1482,6 +1483,7 @@ HIGHBD_OBMC_VAR(64, 16) HIGHBD_OBMC_SUBPIX_VAR(64, 16) #endif // CONFIG_AV1_HIGHBITDEPTH +#endif // !CONFIG_REALTIME_ONLY uint64_t aom_mse_wxh_16bit_c(uint8_t *dst, int dstride, uint16_t *src, int sstride, int w, int h) {
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index e84a55d..2101665 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -1174,6 +1174,7 @@ aom_sub_pixel_variance4x4, aom_sub_pixel_avg_variance4x4, aom_sad4x4x4d, aom_dist_wtd_sad4x4_avg, aom_dist_wtd_sub_pixel_avg_variance4x4) +#if !CONFIG_REALTIME_ONLY #define OBFP(BT, OSDF, OVF, OSVF) \ cpi->fn_ptr[BT].osdf = OSDF; \ cpi->fn_ptr[BT].ovf = OVF; \ @@ -1223,6 +1224,7 @@ aom_obmc_sub_pixel_variance16x64) OBFP(BLOCK_64X16, aom_obmc_sad64x16, aom_obmc_variance64x16, aom_obmc_sub_pixel_variance64x16) +#endif // !CONFIG_REALTIME_ONLY #define MBFP(BT, MCSDF, MCSVF) \ cpi->fn_ptr[BT].msdf = MCSDF; \
diff --git a/av1/encoder/encoder_utils.h b/av1/encoder/encoder_utils.h index f6fa621..cf9eefb 100644 --- a/av1/encoder/encoder_utils.h +++ b/av1/encoder/encoder_utils.h
@@ -465,6 +465,19 @@ MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_8x32x4d) #endif +#if !CONFIG_REALTIME_ONLY + +#define LOWBD_OBFP(BT, OSDF, OVF, OSVF) \ + cpi->fn_ptr[BT].osdf = OSDF; \ + cpi->fn_ptr[BT].ovf = OVF; \ + cpi->fn_ptr[BT].osvf = OSVF; + +#define LOWBD_OBFP_WRAPPER(WIDTH, HEIGHT) \ + LOWBD_OBFP(BLOCK_##WIDTH##X##HEIGHT, aom_obmc_sad##WIDTH##x##HEIGHT, \ + aom_obmc_variance##WIDTH##x##HEIGHT, \ + aom_obmc_sub_pixel_variance##WIDTH##x##HEIGHT) + +#if CONFIG_AV1_HIGHBITDEPTH #define HIGHBD_OBFP(BT, OSDF, OVF, OSVF) \ cpi->fn_ptr[BT].osdf = OSDF; \ cpi->fn_ptr[BT].ovf = OVF; \ @@ -476,18 +489,7 @@ aom_highbd_##BD##_obmc_variance##WIDTH##x##HEIGHT, \ aom_highbd_##BD##_obmc_sub_pixel_variance##WIDTH##x##HEIGHT) -#define LOWBD_OBFP_WRAPPER(WIDTH, HEIGHT) \ - HIGHBD_OBFP(BLOCK_##WIDTH##X##HEIGHT, \ - aom_highbd_obmc_sad##WIDTH##x##HEIGHT##_bits8, \ - aom_highbd_obmc_variance##WIDTH##x##HEIGHT, \ - aom_highbd_obmc_sub_pixel_variance##WIDTH##x##HEIGHT) - #define MAKE_OBFP_SAD_WRAPPER(fnname) \ - static unsigned int fnname##_bits8(const uint8_t *ref, int ref_stride, \ - const int32_t *wsrc, \ - const int32_t *msk) { \ - return fnname(ref, ref_stride, wsrc, msk); \ - } \ static unsigned int fnname##_bits10(const uint8_t *ref, int ref_stride, \ const int32_t *wsrc, \ const int32_t *msk) { \ @@ -498,8 +500,11 @@ const int32_t *msk) { \ return fnname(ref, ref_stride, wsrc, msk) >> 4; \ } +#endif // CONFIG_AV1_HIGHBITDEPTH +#endif // !CONFIG_REALTIME_ONLY #if CONFIG_AV1_HIGHBITDEPTH +#if !CONFIG_REALTIME_ONLY MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad128x128) MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad128x64) MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x128) @@ -522,6 +527,7 @@ MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad32x8) MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x64) MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x16) +#endif static AOM_INLINE void highbd_set_var_fns(AV1_COMP *const cpi) { AV1_COMMON *const cm = &cpi->common; @@ -574,6 +580,7 @@ HIGHBD_MBFP_WRAPPER(16, 4, 8) HIGHBD_MBFP_WRAPPER(4, 16, 8) +#if !CONFIG_REALTIME_ONLY LOWBD_OBFP_WRAPPER(128, 128) LOWBD_OBFP_WRAPPER(128, 64) LOWBD_OBFP_WRAPPER(64, 128) @@ -596,6 +603,7 @@ LOWBD_OBFP_WRAPPER(8, 32) LOWBD_OBFP_WRAPPER(16, 4) LOWBD_OBFP_WRAPPER(4, 16) +#endif HIGHBD_SDSFP_WRAPPER(128, 128, 8); HIGHBD_SDSFP_WRAPPER(128, 64, 8); @@ -665,6 +673,7 @@ HIGHBD_MBFP_WRAPPER(16, 4, 10) HIGHBD_MBFP_WRAPPER(4, 16, 10) +#if !CONFIG_REALTIME_ONLY HIGHBD_OBFP_WRAPPER(128, 128, 10) HIGHBD_OBFP_WRAPPER(128, 64, 10) HIGHBD_OBFP_WRAPPER(64, 128, 10) @@ -687,6 +696,7 @@ HIGHBD_OBFP_WRAPPER(8, 32, 10) HIGHBD_OBFP_WRAPPER(16, 4, 10) HIGHBD_OBFP_WRAPPER(4, 16, 10) +#endif HIGHBD_SDSFP_WRAPPER(128, 128, 10); HIGHBD_SDSFP_WRAPPER(128, 64, 10); @@ -756,6 +766,7 @@ HIGHBD_MBFP_WRAPPER(16, 4, 12) HIGHBD_MBFP_WRAPPER(4, 16, 12) +#if !CONFIG_REALTIME_ONLY HIGHBD_OBFP_WRAPPER(128, 128, 12) HIGHBD_OBFP_WRAPPER(128, 64, 12) HIGHBD_OBFP_WRAPPER(64, 128, 12) @@ -778,6 +789,7 @@ HIGHBD_OBFP_WRAPPER(8, 32, 12) HIGHBD_OBFP_WRAPPER(16, 4, 12) HIGHBD_OBFP_WRAPPER(4, 16, 12) +#endif HIGHBD_SDSFP_WRAPPER(128, 128, 12); HIGHBD_SDSFP_WRAPPER(128, 64, 12);
diff --git a/test/test.cmake b/test/test.cmake index 1d99540..274f51e 100644 --- a/test/test.cmake +++ b/test/test.cmake
@@ -239,6 +239,8 @@ if(CONFIG_REALTIME_ONLY) list(REMOVE_ITEM AOM_UNIT_TEST_ENCODER_SOURCES "${AOM_ROOT}/test/frame_error_test.cc" + "${AOM_ROOT}/test/obmc_sad_test.cc" + "${AOM_ROOT}/test/obmc_variance_test.cc" "${AOM_ROOT}/test/warp_filter_test.cc" "${AOM_ROOT}/test/warp_filter_test_util.cc" "${AOM_ROOT}/test/warp_filter_test_util.h")
diff --git a/test/variance_test.cc b/test/variance_test.cc index b72ac76..8583e47 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc
@@ -51,10 +51,13 @@ const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b, int b_stride, uint32_t *sse, const uint8_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param); + +#if !CONFIG_REALTIME_ONLY typedef uint32_t (*ObmcSubpelVarFunc)(const uint8_t *pre, int pre_stride, int xoffset, int yoffset, const int32_t *wsrc, const int32_t *mask, unsigned int *sse); +#endif using libaom_test::ACMRandom; @@ -277,6 +280,7 @@ return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h))); } +#if !CONFIG_REALTIME_ONLY static uint32_t obmc_subpel_variance_ref(const uint8_t *pre, int l2w, int l2h, int xoff, int yoff, const int32_t *wsrc, @@ -326,6 +330,7 @@ *sse_ptr = static_cast<uint32_t>(sse); return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h))); } +#endif //////////////////////////////////////////////////////////////////////////////// @@ -1017,6 +1022,8 @@ //////////////////////////////////////////////////////////////////////////////// +#if !CONFIG_REALTIME_ONLY + static const int kMaskMax = 64; typedef TestParams<ObmcSubpelVarFunc> ObmcSubpelVarianceParams; @@ -1172,6 +1179,8 @@ params_.bit_depth, elapsed_time); } +#endif // !CONFIG_REALTIME_ONLY + typedef MseWxHTestClass<MseWxH16bitFunc> MseWxHTest; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MseWxHTest); typedef MainTestClass<Get4x4SseFunc> AvxSseTest; @@ -1181,7 +1190,9 @@ typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> AvxSubpelAvgVarianceTest; typedef SubpelVarianceTest<DistWtdSubpixAvgVarMxNFunc> AvxDistWtdSubpelAvgVarianceTest; +#if !CONFIG_REALTIME_ONLY typedef ObmcVarianceTest<ObmcSubpelVarFunc> AvxObmcSubpelVarianceTest; +#endif typedef TestParams<MseWxH16bitFunc> MseWxHParams; TEST_P(AvxSseTest, RefSse) { RefTestSse(); } @@ -1202,9 +1213,11 @@ TEST_P(AvxSubpelVarianceTest, DISABLED_Speed) { SpeedTest(); } TEST_P(AvxSubpelAvgVarianceTest, Ref) { RefTest(); } TEST_P(AvxDistWtdSubpelAvgVarianceTest, Ref) { RefTest(); } +#if !CONFIG_REALTIME_ONLY TEST_P(AvxObmcSubpelVarianceTest, Ref) { RefTest(); } TEST_P(AvxObmcSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); } TEST_P(AvxObmcSubpelVarianceTest, DISABLED_Speed) { SpeedTest(); } +#endif INSTANTIATE_TEST_SUITE_P(C, SumOfSquaresTest, ::testing::Values(aom_get_mb_ss_c)); @@ -1348,6 +1361,7 @@ 2, 4, &aom_dist_wtd_sub_pixel_avg_variance4x16_c, 0))); +#if !CONFIG_REALTIME_ONLY INSTANTIATE_TEST_SUITE_P( C, AvxObmcSubpelVarianceTest, ::testing::Values( @@ -1375,6 +1389,7 @@ ObmcSubpelVarianceParams(3, 5, &aom_obmc_sub_pixel_variance8x32_c, 0), ObmcSubpelVarianceParams(4, 2, &aom_obmc_sub_pixel_variance16x4_c, 0), ObmcSubpelVarianceParams(2, 4, &aom_obmc_sub_pixel_variance4x16_c, 0))); +#endif #if CONFIG_AV1_HIGHBITDEPTH typedef uint64_t (*MseHBDWxH16bitFunc)(uint16_t *dst, int dstride, @@ -1487,7 +1502,9 @@ typedef MainTestClass<VarianceMxNFunc> AvxHBDVarianceTest; typedef SubpelVarianceTest<SubpixVarMxNFunc> AvxHBDSubpelVarianceTest; typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> AvxHBDSubpelAvgVarianceTest; +#if !CONFIG_REALTIME_ONLY typedef ObmcVarianceTest<ObmcSubpelVarFunc> AvxHBDObmcSubpelVarianceTest; +#endif GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AvxHBDObmcSubpelVarianceTest); TEST_P(MseHBDWxHTest, RefMse) { RefMatchTestMse(); } @@ -1785,6 +1802,7 @@ INSTANTIATE_TEST_SUITE_P(C, AvxHBDSubpelAvgVarianceTest, ::testing::ValuesIn(kArrayHBDSubpelAvgVariance_c)); +#if !CONFIG_REALTIME_ONLY const ObmcSubpelVarianceParams kArrayHBDObmcSubpelVariance_c[] = { ObmcSubpelVarianceParams(7, 7, &aom_highbd_obmc_sub_pixel_variance128x128_c, 8), @@ -1903,6 +1921,7 @@ }; INSTANTIATE_TEST_SUITE_P(C, AvxHBDObmcSubpelVarianceTest, ::testing::ValuesIn(kArrayHBDObmcSubpelVariance_c)); +#endif // !CONFIG_REALTIME_ONLY #endif // CONFIG_AV1_HIGHBITDEPTH #if HAVE_SSE2 @@ -2465,6 +2484,7 @@ #endif // HAVE_SSSE3 #if HAVE_SSE4_1 +#if !CONFIG_REALTIME_ONLY INSTANTIATE_TEST_SUITE_P( SSE4_1, AvxObmcSubpelVarianceTest, ::testing::Values( @@ -2513,6 +2533,7 @@ 0), ObmcSubpelVarianceParams(2, 4, &aom_obmc_sub_pixel_variance4x16_sse4_1, 0))); +#endif #endif // HAVE_SSE4_1 #if HAVE_AVX2