shithub: openh264

Download patch

ref: 43dc6f01e1aac695bffec42cab67459d895da61d
parent: 199d19a7859a6554adcd0ad9bfcfe664d7755422
parent: 4ece8efaedb02a3f0cdf09203e108cfe82770070
author: huili2 <[email protected]>
date: Fri Sep 5 05:39:56 EDT 2014

Merge pull request #1322 from ruil2/MinCr_waring

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,