shithub: openh264

Download patch

ref: 4fec6d581e6f3d2568680a3a0e507e784b11958b
parent: e490215990d8d03a6d8b3fc84f5a382d4c827699
author: Sindre Aamås <[email protected]>
date: Mon May 23 09:10:48 EDT 2016

[UT] Test generic downsampling routines with a wider variety of width ratios

Get coverage of all code paths for routines that branch to different
paths for different scaling ratios.

--- a/test/processing/ProcessUT_DownSample.cpp
+++ b/test/processing/ProcessUT_DownSample.cpp
@@ -296,21 +296,23 @@
   int src_stride_a; \
   int src_width_a; \
   int src_height_a; \
-  dst_stride_c = dst_stride_a = 320; \
-  src_stride_c = src_stride_a = 320; \
-  src_width_c = src_width_a = 320; \
-  src_height_c = src_height_a = 180; \
-  dst_width_c = dst_width_a = 300; \
-  dst_height_c = dst_height_a = 160; \
-  for (int j = 0; j < 70000; j++) { \
-    dst_c[j] = dst_a[j] = rand() % 256; \
-    src_c[j] = src_a[j] = rand() % 256; \
-  } \
-  ref (dst_c, dst_stride_c, dst_width_c, dst_height_c, src_c, src_stride_c, src_width_c, src_height_c); \
-  func (dst_a, dst_stride_a, dst_width_a, dst_height_a, src_a, src_stride_a, src_width_a, src_height_a); \
-  for (int j = 0; j < dst_height_c; j++) { \
-    for (int m = 0; m < dst_width_c ; m++) { \
-      ASSERT_EQ (dst_c[m + j * dst_stride_c], dst_a[m + j * dst_stride_a]); \
+  for (int i = 0; i < 5; i++) { \
+    dst_stride_c = dst_stride_a = 320; \
+    src_stride_c = src_stride_a = 320; \
+    src_width_c = src_width_a = 320; \
+    src_height_c = src_height_a = 180; \
+    dst_width_c = dst_width_a = (src_width_c >> (i + 1)) + rand() % (src_width_c >> (i + 1)); \
+    dst_height_c = dst_height_a = 160; \
+    for (int j = 0; j < 70000; j++) { \
+      dst_c[j] = dst_a[j] = rand() % 256; \
+      src_c[j] = src_a[j] = rand() % 256; \
+    } \
+    ref (dst_c, dst_stride_c, dst_width_c, dst_height_c, src_c, src_stride_c, src_width_c, src_height_c); \
+    func (dst_a, dst_stride_a, dst_width_a, dst_height_a, src_a, src_stride_a, src_width_a, src_height_a); \
+    for (int j = 0; j < dst_height_c; j++) { \
+      for (int m = 0; m < dst_width_c ; m++) { \
+        ASSERT_EQ (dst_c[m + j * dst_stride_c], dst_a[m + j * dst_stride_a]); \
+      } \
     } \
   } \
 }