shithub: openh264

Download patch

ref: b12b39a47b691f6800fa93a879939b36122fe983
parent: 26ccd837f19c76326780ff498720703c9c67bf8e
author: huili2 <huili2@cisco.com>
date: Sun Dec 28 18:33:53 EST 2014

disable color format check for parse only

--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -516,9 +516,11 @@
 
   memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
   pCtx->eOutputColorFormat	= pCtx->pParam->eOutputColorFormat;
-  int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
-  if (iRet)
-    return iRet;
+  if (!pCtx->bParseOnly) {
+    int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
+    if (iRet)
+      return iRet;
+  }
   pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
 
   if (pCtx->bParseOnly) //parse only, disable EC method
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -258,6 +258,11 @@
     return dsInitialOptExpected;
 
   if (eOptID == DECODER_OPTION_DATAFORMAT) { // Set color space of decoding output frame
+    if (m_pDecContext->bParseOnly) {
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
+               "CWelsDecoder::SetOption for data format meaningless for parseonly.");
+      return cmResultSuccess;
+    }
     if (pOption == NULL)
       return cmInitParaError;
 
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -2337,7 +2337,7 @@
       decoder_->Uninitialize();
     SDecodingParam decParam;
     memset (&decParam, 0, sizeof (SDecodingParam));
-    decParam.eOutputColorFormat = videoFormatI420;
+    decParam.eOutputColorFormat = videoFormatRGB;
     decParam.uiTargetDqLayer = UCHAR_MAX;
     decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
     decParam.bParseOnly = true;