shithub: openh264

Download patch

ref: 4ece8efaedb02a3f0cdf09203e108cfe82770070
parent: cef43e30fe3bb83ca72bdf431ac5fa7efa356dc2
author: ruil2 <ruil2@cisco.com>
date: Wed Sep 3 06:41:54 EDT 2014

add MinCr checking and output warings if the MinCr isn't met

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3444,7 +3444,14 @@
     }
 
     iFrameSize += iLayerSize;
-
+    //check MinCr
+    {
+      int32_t iImageSize = (pParam->iVideoWidth * pParam->iVideoHeight * 3) >> 1;
+      int32_t iMinCr = g_ksLevelLimits[pParam->uiLevelIdc - 1].uiMinCR;
+      if (iFrameSize > (iImageSize / iMinCr))
+        WelsLog (pLogCtx, WELS_LOG_WARNING,
+                 "WelsEncoderEncodeExt()MinCr Checking,codec bitstream size is larger than Level limitation");
+    }
 #ifdef ENABLE_FRAME_DUMP
     if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) {
       DumpDependencyRec (fsnr, &pSvcParam->sDependencyLayers[iCurDid].sRecFileName[0], iCurDid,