shithub: openh264

Download patch

ref: 47d8a840c045a43ca2693844caa629ebee39599e
parent: ad8ba85136a92c496f29e8d3a27e981142686321
parent: b12b39a47b691f6800fa93a879939b36122fe983
author: huili2 <huili2@cisco.com>
date: Wed Dec 31 08:14:47 EST 2014

Merge pull request #1682 from huili2/parseonly_initial_no_colorformat

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;