shithub: openh264

Download patch

ref: d6f0dee0c4d53edd7b347a34917414f8ff818d18
parent: a4eea4c64dd4ea8f31794a47ffc6f69eec970f91
author: ruil2 <ruil2@cisco.com>
date: Tue Aug 26 07:06:30 EDT 2014

add more LTR parameters

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -89,7 +89,7 @@
 
   ENCODER_LTR_RECOVERY_REQUEST,
   ENCODER_LTR_MARKING_FEEDBACK,
-  ENCOCER_LTR_MARKING_PERIOD,
+  ENCODER_LTR_MARKING_PERIOD,
   ENCODER_OPTION_LTR,
   ENCODER_OPTION_COMPLEXITY,
 
@@ -177,6 +177,10 @@
   int			  iLTRFrameNum; //specify current decoder frame_num
 } SLTRMarkingFeedback;
 
+typedef struct {
+  bool   bEnableLongTermReference; // 1: on, 0: off
+  int	   iLTRRefNum;
+}SLTRConfig;
 typedef struct {
   unsigned int
   uiSliceMbNum[MAX_SLICES_NUM_TMP];  //here we use a tmp fixed value since MAX_SLICES_NUM is not defined here and its definition may be changed;
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -818,16 +818,20 @@
     FilterLTRMarkingFeedback (m_pEncContext, fb);
   }
   break;
-  case ENCOCER_LTR_MARKING_PERIOD: {
+  case ENCODER_LTR_MARKING_PERIOD: {
     uint32_t iValue = * ((uint32_t*) (pOption));
     m_pEncContext->pSvcParam->iLtrMarkPeriod = iValue;
   }
   break;
   case ENCODER_OPTION_LTR: {
-    uint32_t iValue = * ((uint32_t*) (pOption));
-    m_pEncContext->pSvcParam->bEnableLongTermReference = iValue ? true : false;
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, " CWelsH264SVCEncoder::SetOption enable LTR = %d",
-             m_pEncContext->pSvcParam->bEnableLongTermReference);
+    SLTRConfig* pLTRValue = ((SLTRConfig*) (pOption));
+    SWelsSvcCodingParam	sConfig;
+    memcpy (&sConfig, m_pEncContext->pSvcParam, sizeof (SWelsSvcCodingParam));
+    sConfig.bEnableLongTermReference = pLTRValue->bEnableLongTermReference;
+    sConfig.iLTRRefNum = pLTRValue->iLTRRefNum;
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, " CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d",
+             sConfig.bEnableLongTermReference, sConfig.iLTRRefNum);
+    WelsEncoderParamAdjust (&m_pEncContext, &sConfig);
   }
   break;
   case ENCODER_OPTION_ENABLE_SSEI: {