shithub: openh264

Download patch

ref: c1aa2a1edb49e1583d380fbfd3f7e13c3d501dc5
parent: fcae7fd3001152a7aba94aa02c8691c5b1b3f195
author: Martin Storsjö <martin@martin.st>
date: Mon Jan 19 05:02:21 EST 2015

Use WelsClip3 instead of WELS_CLIP3 for random values

Since WELS_CLIP3 is a macro, using it will cause the arguments
to be evalated multiple times, which means that the clip will
not work as intended. If using a rand() argument, always use
WelsClip3 instead, which is an inline function.

--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -149,11 +149,11 @@
 
 
   virtual int GetRandWidth() {
-    return (WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH));
+    return WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
   }
 
   virtual int GetRandHeight() {
-    return (WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT));
+    return WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT);
   }
 
  protected: