]> granicus.if.org Git - libvpx/commitdiff
Update convolve functions' assertions
authorLinfeng Zhang <linfengz@google.com>
Wed, 6 Sep 2017 19:01:07 +0000 (12:01 -0700)
committerLinfeng Zhang <linfengz@google.com>
Thu, 7 Sep 2017 19:33:58 +0000 (12:33 -0700)
So that 4 to 1 frame scaling can call them.

Change-Id: I9ec438aa63b923ba164ad3c59d7ecfa12789eab5

test/vp9_scale_test.cc
vpx_dsp/vpx_convolve.c
vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c

index 1deac81663ff3643bd61b00bc0da861322d01584..fddf99c9b9e0a3b800aa5b838e0389e578cf4bd0 100644 (file)
@@ -49,10 +49,10 @@ class ScaleTest : public VpxScaleBase,
 
   void RunTest() {
     static const int kNumSizesToTest = 4;
-    static const int kNumScaleFactorsToTest = 2;
+    static const int kNumScaleFactorsToTest = 4;
     static const int kWidthsToTest[] = { 16, 32, 48, 64 };
     static const int kHeightsToTest[] = { 16, 20, 24, 28 };
-    static const int kScaleFactors[] = { 1, 2 };
+    static const int kScaleFactors[] = { 1, 2, 3, 4 };
     for (INTERP_FILTER filter_type = 0; filter_type < 4; ++filter_type) {
       for (int phase_scaler = 0; phase_scaler < 16; ++phase_scaler) {
         for (int h = 0; h < kNumSizesToTest; ++h) {
@@ -132,8 +132,8 @@ TEST_P(ScaleTest, ScaleFrame) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
 
 TEST_P(ScaleTest, DISABLED_Speed) {
   static const int kCountSpeedTestBlock = 100;
-  static const int kNumScaleFactorsToTest = 2;
-  static const int kScaleFactors[] = { 1, 2 };
+  static const int kNumScaleFactorsToTest = 4;
+  static const int kScaleFactors[] = { 1, 2, 3, 4 };
   const int src_height = 1280;
   const int src_width = 720;
   for (INTERP_FILTER filter_type = 2; filter_type < 4; ++filter_type) {
index 76b5e47887abd464bf56a02ee2d145ebc48dbd4d..697e3ebb86afd32e5dc380cc4c74f5d961012796 100644 (file)
@@ -129,14 +129,17 @@ static void convolve(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
   // --Must round-up because block may be located at sub-pixel position.
   // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
   // --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
+  // When calling in frame scaling function, the smallest scaling factor is x1/4
+  // ==> y_step_q4 = 64. Since w and h are at most 16, the temp buffer is still
+  // big enough.
   uint8_t temp[64 * 135];
   const int intermediate_height =
       (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
 
   assert(w <= 64);
   assert(h <= 64);
-  assert(y_step_q4 <= 32);
-  assert(x_step_q4 <= 32);
+  assert(y_step_q4 <= 32 || (y_step_q4 <= 64 && h <= 32));
+  assert(x_step_q4 <= 64);
 
   convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, 64,
                  filter, x0_q4, x_step_q4, w, intermediate_height);
index c1b81f2d90687ecc99033219a3ec3622c5e67739..b41afa0284b15ae7cc09b96ca2d3fed97a587235 100644 (file)
@@ -828,14 +828,17 @@ static void scaledconvolve2d(const uint8_t *src, ptrdiff_t src_stride,
   // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
   // --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
   // --Require an additional 8 rows for the horiz_w8 transpose tail.
+  // When calling in frame scaling function, the smallest scaling factor is x1/4
+  // ==> y_step_q4 = 64. Since w and h are at most 16, the temp buffer is still
+  // big enough.
   DECLARE_ALIGNED(16, uint8_t, temp[(135 + 8) * 64]);
   const int intermediate_height =
       (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
 
   assert(w <= 64);
   assert(h <= 64);
-  assert(y_step_q4 <= 32);
-  assert(x_step_q4 <= 32);
+  assert(y_step_q4 <= 32 || (y_step_q4 <= 64 && h <= 32));
+  assert(x_step_q4 <= 64);
 
   if (w >= 8) {
     scaledconvolve_horiz_w8(src - src_stride * (SUBPEL_TAPS / 2 - 1),