shithub: openh264

Download patch

ref: e0b92bb633889aa872c163c21aab2aaebe40a7ca
parent: def2ae50ee3304c6849362db03318e8dd5076438
author: ruil2 <[email protected]>
date: Thu May 22 06:53:02 EDT 2014

miss a branch for auto reference frame setting

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -347,16 +347,20 @@
   if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
     if (pCfg->bEnableLongTermReference) {
       pCfg->iLTRRefNum = WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN);
-      pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
+      if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
+        pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
     } else {
       pCfg->iLTRRefNum = 0;
-      pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);
+      if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
+        pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);
     }
   } else {
     pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM) : 0;
-    pCfg->iNumRefFrame		= ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
-                            (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);
-    pCfg->iNumRefFrame		= WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
+    if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT){
+      pCfg->iNumRefFrame		= ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
+                              (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);
+      pCfg->iNumRefFrame		= WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
+    }
   }
 
   if (pCfg->iLtrMarkPeriod == 0) {