shithub: openh264

Download patch

ref: 4ba216b000d823c95947752c70ead1840db4e92c
parent: 8591173d9867a65a6eae0fbf409d61e0ac496c24
parent: 79c0cec2481b41bddd02d6d3c4063643e38400a6
author: Licai Guo <[email protected]>
date: Wed Apr 9 05:12:22 EDT 2014

Merge pull request #655 from huili2/EC_interface

add interface for error concealment, to be continued

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -105,8 +105,16 @@
   DECODER_OPTION_IDR_PIC_ID,	// feedback current frame belong to which IDR period
   DECODER_OPTION_LTR_MARKING_FLAG,	// feedback wether current frame mark a LTR
   DECODER_OPTION_LTR_MARKED_FRAME_NUM,	// feedback frame num marked by current Frame
+  DECODER_OPTION_ERROR_CON_IDC, //not finished yet, indicate decoder error concealment status, in progress
 
 } DECODER_OPTION;
+
+//enuerate the types of error concealment methods
+typedef enum {
+  ERROR_CON_DISABLE = 0,
+  ERROR_CON_SLICE_COPY,
+} ERROR_CON_IDC;
+
 typedef enum { //feedback that whether or not have VCL NAL in current AU
   FEEDBACK_NON_VCL_NAL = 0,
   FEEDBACK_VCL_NAL,
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -273,9 +273,10 @@
   uint16_t            uiCurIdrPicId;
 #endif
 
-  PGetIntraPredFunc 	pGetI16x16LumaPredFunc[7];		//h264_predict_copy_16x16;
-  PGetIntraPredFunc 	pGetI4x4LumaPredFunc[14];		// h264_predict_4x4_t
-  PGetIntraPredFunc 	pGetIChromaPredFunc[7];		// h264_predict_8x8_t
+  int32_t iErrorConMethod; //
+  PGetIntraPredFunc pGetI16x16LumaPredFunc[7];		//h264_predict_copy_16x16;
+  PGetIntraPredFunc pGetI4x4LumaPredFunc[14];		// h264_predict_4x4_t
+  PGetIntraPredFunc pGetIChromaPredFunc[7];		// h264_predict_8x8_t
   PIdctResAddPredFunc	pIdctResAddPredFunc;
   SMcFunc				sMcFunc;
   /* For Deblocking */
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -163,6 +163,7 @@
   pCtx->pPicBuff[LIST_1]		= NULL;
 
   pCtx->bAvcBasedFlag			= true;
+  pCtx->iErrorConMethod = ERROR_CON_DISABLE;
 
 }
 
@@ -530,6 +531,8 @@
         return pCtx->iErrorCode;
       }
     }
+
+    //TODO error concealment here
 
     if ((IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) || IS_SEI_NAL (pCtx->sCurNalHead.eNalUnitType))
         && pNalPayload) {
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -257,9 +257,15 @@
     m_pDecContext->bEndOfStreamFlag	= iVal ? true : false;
 
     return cmResultSuccess;
+  } else if (eOptID == DECODER_OPTION_ERROR_CON_IDC) { // Indicate error concealment status
+    if (pOption == NULL) //Default: SLICE_COPY, enable
+      iVal = ERROR_CON_SLICE_COPY;
+    else
+      iVal = * ((int*)pOption); //EC method
+    m_pDecContext->iErrorConMethod = iVal;
+    return cmResultSuccess;
   }
 
-
   return cmInitParaError;
 }
 
@@ -309,6 +315,10 @@
     return cmResultSuccess;
   } else if (DECODER_OPTION_TEMPORAL_ID == eOptID) { //if have VCL NAL in current AU, then feedback the temporal ID
     iVal = m_pDecContext->iFeedbackTidInAu;
+    * ((int*)pOption) = iVal;
+    return cmResultSuccess;
+  } else if (DECODER_OPTION_ERROR_CON_IDC == eOptID) {
+    iVal = m_pDecContext->iErrorConMethod;
     * ((int*)pOption) = iVal;
     return cmResultSuccess;
   }