shithub: openh264

Download patch

ref: e8cdbd2ea7cd882b6d99a0198905bfe569246c86
parent: 67664f4dc01afe36b2128b29e5a18d2b99d7874f
author: Martin Storsjö <martin@martin.st>
date: Sat Feb 28 09:57:00 EST 2015

Don't downsample to anything smaller than 4x4 pixels

This makes for a chroma plane of 2x2. The SIMD versionf of generic
downscalers assume that the width and height is at least 2, since
it does an unconditional loop for the body of the image, and a
separate step for the last pixel and last row. The SIMD versions
assume that (width-1) and (height-1) are larger than zero.

This fixes spurious crashes in EncodeDecodeTestAPI.SetOptionEncParamExt.

--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -430,9 +430,9 @@
 
     if (iInputWidthXDstHeight > iInputHeightXDstWidth) {
       pScaledPicture->iScaledWidth[iSpatialIdx] = iCurDstWidth;
-      pScaledPicture->iScaledHeight[iSpatialIdx] = WELS_MAX (iInputHeightXDstWidth / kiInputPicWidth, 2);
+      pScaledPicture->iScaledHeight[iSpatialIdx] = WELS_MAX (iInputHeightXDstWidth / kiInputPicWidth, 4);
     } else {
-      pScaledPicture->iScaledWidth[iSpatialIdx] = WELS_MAX (iInputWidthXDstHeight / kiInputPicHeight, 2);
+      pScaledPicture->iScaledWidth[iSpatialIdx] = WELS_MAX (iInputWidthXDstHeight / kiInputPicHeight, 4);
       pScaledPicture->iScaledHeight[iSpatialIdx] = iCurDstHeight;
     }
   }