ref: dc2cbe4a22981af01213c0f29d63661af3b245dc
parent: 991b05fb69056e753d181bfd31d56c6502c77b6d
author: huili2 <huili2@cisco.com>
date: Tue Nov 17 08:58:57 EST 2015
remove API data format in decoder in 1.6
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -148,8 +148,7 @@
* @brief Option types introduced in decoder application
*/
typedef enum {
- DECODER_OPTION_DATAFORMAT = 0, ///< color format, now supports 23 only (I420)
- DECODER_OPTION_END_OF_STREAM, ///< end of stream flag
+ DECODER_OPTION_END_OF_STREAM = 1, ///< end of stream flag
DECODER_OPTION_VCL_NAL, ///< feedback whether or not have VCL NAL in current AU for application layer
DECODER_OPTION_TEMPORAL_ID, ///< feedback temporal id for application layer
DECODER_OPTION_FRAME_NUM, ///< feedback current decoded frame number
@@ -477,7 +476,6 @@
typedef struct TagSVCDecodingParam {
char* pFileNameRestructed; ///< file name of reconstructed frame used for PSNR calculation based debug
- EVideoFormatType eOutputColorFormat; ///< color space format to be outputed, EVideoFormatType specified in codec_def.h
unsigned int uiCpuLoad; ///< CPU load
unsigned char uiTargetDqLayer; ///< setting target dq layer id
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -102,7 +102,6 @@
int32_t iLastWidth = 0, iLastHeight = 0;
int32_t iFrameCount = 0;
int32_t iEndOfStreamFlag = 0;
- int32_t iColorFormat = videoFormatInternal;
//for coverage test purpose
int32_t iErrorConMethod = (int32_t) ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
pDecoder->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iErrorConMethod);
@@ -168,11 +167,6 @@
memcpy (pBuf + iFileSize, &uiStartCode[0], 4); //confirmed_safe_unsafe_usage
- if (pDecoder->SetOption (DECODER_OPTION_DATAFORMAT, &iColorFormat)) {
- fprintf (stderr, "SetOption() failed, opt_id : %d ..\n", DECODER_OPTION_DATAFORMAT);
- goto label_exit;
- }
-
while (true) {
if (iBufPos >= iFileSize) {
@@ -201,8 +195,6 @@
}
//for coverage test purpose
- int32_t iOutputColorFormat;
- pDecoder->GetOption (DECODER_OPTION_DATAFORMAT, &iOutputColorFormat);
int32_t iEndOfStreamFlag;
pDecoder->GetOption (DECODER_OPTION_END_OF_STREAM, &iEndOfStreamFlag);
int32_t iCurIdrPicId;
@@ -376,8 +368,6 @@
strncpy (sDecParam.pFileNameRestructed, strReconFile.c_str(), iLen); //confirmed_safe_unsafe_usage
} else if (strTag[0].compare ("TargetDQID") == 0) {
sDecParam.uiTargetDqLayer = (uint8_t)atol (strTag[1].c_str());
- } else if (strTag[0].compare ("OutColorFormat") == 0) {
- sDecParam.eOutputColorFormat = (EVideoFormatType) atoi (strTag[1].c_str());
} else if (strTag[0].compare ("ErrorConcealmentIdc") == 0) {
sDecParam.eEcActiveIdc = (ERROR_CON_IDC)atol (strTag[1].c_str());
} else if (strTag[0].compare ("CPULoad") == 0) {
@@ -394,7 +384,6 @@
} else if (strstr (pArgV[1],
".264")) { // no output dump yuv file, just try to render the decoded pictures //confirmed_safe_unsafe_usage
strInputFile = pArgV[1];
- sDecParam.eOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -402,7 +391,6 @@
} else { //iArgC > 2
strInputFile = pArgV[1];
strOutputFile = pArgV[2];
- sDecParam.eOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
--- a/codec/decoder/core/inc/decoder.h
+++ b/codec/decoder/core/inc/decoder.h
@@ -114,11 +114,6 @@
*/
void WelsFreeMem (PWelsDecoderContext pCtx);
-/*
- * set colorspace format in decoder
- */
-int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat);
-
/*!
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
* over decoder internal
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -242,7 +242,6 @@
SDecodingParam* pParam;
uint32_t uiCpuFlag; // CPU compatibility detected
- EVideoFormatType eOutputColorFormat; // color space format to be outputed
VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection.
bool bHaveGotMemory; // global memory for decoder context related ever requested?
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -283,7 +283,6 @@
pCtx->pArgDec = NULL;
- pCtx->eOutputColorFormat = videoFormatI420; // yuv in default
pCtx->bHaveGotMemory = false; // not ever request memory blocks for decoder context related
pCtx->uiCpuFlag = 0;
@@ -530,12 +529,6 @@
return 1;
memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
- pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat;
- if (!pCtx->bParseOnly) {
- int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
- if (iRet)
- return iRet;
- }
if ((pCtx->pParam->eEcActiveIdc > ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
|| (pCtx->pParam->eEcActiveIdc < ERROR_CON_DISABLE)) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
@@ -801,29 +794,6 @@
}
return pCtx->iErrorCode;
-}
-
-/*
- * set colorspace format in decoder
- */
-int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat) {
- WELS_VERIFY_RETURN_IF (1, (NULL == pCtx));
-
- pCtx->eOutputColorFormat = (EVideoFormatType) kiColorFormat;
- if (pCtx->pParam != NULL) {
- pCtx->pParam->eOutputColorFormat = (EVideoFormatType) kiColorFormat;
- }
-
- //For now, support only videoFormatI420!
- if (kiColorFormat == (int32_t) videoFormatInternal) {
- pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420;
- } else if (kiColorFormat != (int32_t) videoFormatI420) {
- WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Support I420 output only for now! Change to I420...");
- pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420;
- return cmUnsupportedData;
- }
-
- return 0;
}
/*!
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -289,23 +289,10 @@
if (m_pDecContext == NULL && eOptID != DECODER_OPTION_TRACE_LEVEL &&
eOptID != DECODER_OPTION_TRACE_CALLBACK && eOptID != DECODER_OPTION_TRACE_CALLBACK_CONTEXT)
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 (eOptID == DECODER_OPTION_END_OF_STREAM) { // Indicate bit-stream of the final frame to be decoded
if (pOption == NULL)
return cmInitParaError;
- iVal = * ((int*)pOption); // is_rgb
-
- return DecoderSetCsp (m_pDecContext, iVal);
- } else if (eOptID == DECODER_OPTION_END_OF_STREAM) { // Indicate bit-stream of the final frame to be decoded
- if (pOption == NULL)
- return cmInitParaError;
-
iVal = * ((int*)pOption); // boolean value for whether enabled End Of Stream flag
m_pDecContext->bEndOfStreamFlag = iVal ? true : false;
@@ -371,11 +358,7 @@
if (pOption == NULL)
return cmInitParaError;
- if (DECODER_OPTION_DATAFORMAT == eOptID) {
- iVal = (int32_t) m_pDecContext->eOutputColorFormat;
- * ((int*)pOption) = iVal;
- return cmResultSuccess;
- } else if (DECODER_OPTION_END_OF_STREAM == eOptID) {
+ if (DECODER_OPTION_END_OF_STREAM == eOptID) {
iVal = m_pDecContext->bEndOfStreamFlag;
* ((int*)pOption) = iVal;
return cmResultSuccess;
--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -622,7 +622,6 @@
SDecodingParam param;
memset (¶m, 0, sizeof (param));
- param.eOutputColorFormat = videoFormatI420;
param.uiTargetDqLayer = UCHAR_MAX; // Default value
param.eEcActiveIdc = ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE; // Error concealment on.
param.sVideoProperty.size = sizeof(param.sVideoProperty);
--- a/test/api/BaseDecoderTest.cpp
+++ b/test/api/BaseDecoderTest.cpp
@@ -53,7 +53,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -500,7 +500,7 @@
//for slice mode = SM_RASTER_SLICE
if (SM_RASTER_SLICE == pSpatialLayer->sSliceArgument.uiSliceMode) {
- if (0!=pSpatialLayer->sSliceArgument.uiSliceMbNum[0]) {
+ if (0 != pSpatialLayer->sSliceArgument.uiSliceMbNum[0]) {
SliceParamValidationForMode2 (iSpatialIdx);
} else {
SliceParamValidationForMode3 (iSpatialIdx);
@@ -1069,7 +1069,6 @@
}
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_DISABLE;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -2422,7 +2421,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -2526,7 +2524,6 @@
decoder_->Uninitialize();
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatRGB;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.bParseOnly = true;
@@ -3182,7 +3179,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3300,7 +3296,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3377,8 +3372,8 @@
float fFrameRate = rand() + 0.5f;
int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
int iSliceNum = 1;
- iWidth = VALID_SIZE(iWidth);
- iHeight = VALID_SIZE(iHeight);
+ iWidth = VALID_SIZE (iWidth);
+ iHeight = VALID_SIZE (iHeight);
// prepare params
SEncParamExt sParam1;
SEncParamExt sParam2;
@@ -3414,7 +3409,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3533,7 +3527,7 @@
param_.sSpatialLayers[0].iVideoHeight = p.iHeight;
param_.sSpatialLayers[0].fFrameRate = p.fFramerate;
param_.sSpatialLayers[0].sSliceArgument.uiSliceMode = p.eSliceMode;
- if ( SM_FIXEDSLCNUM_SLICE == p.eSliceMode ) {
+ if (SM_FIXEDSLCNUM_SLICE == p.eSliceMode) {
param_.sSpatialLayers[0].sSliceArgument.uiSliceNum = 8;
}
@@ -3554,7 +3548,7 @@
unsigned char* pData[3] = { NULL };
//FIXME: remove this after the multi-thread case is correctly handled in encoder
- if (p.iThreads>1 && SM_SIZELIMITED_SLICE == p.eSliceMode) {
+ if (p.iThreads > 1 && SM_SIZELIMITED_SLICE == p.eSliceMode) {
p.bAllRandom = false;
}
@@ -3635,7 +3629,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3729,7 +3722,8 @@
TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) {
int iSpatialLayerNum = 3;
int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, (64 << 2), MAX_WIDTH);
- int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, (64 << 2), 2240);//TODO: use MAX_HEIGHT after the limit is removed
+ int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, (64 << 2),
+ 2240);//TODO: use MAX_HEIGHT after the limit is removed
float fFrameRate = rand() + 0.5f;
int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
@@ -3774,7 +3768,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3838,7 +3831,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3899,7 +3891,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -3961,7 +3952,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
--- a/test/api/encode_decode_api_test.template
+++ b/test/api/encode_decode_api_test.template
@@ -50,7 +50,6 @@
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
- decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -139,4 +138,4 @@
fclose (fEnc[i]);
}
#endif
-}
\ No newline at end of file
+}
--- a/test/decoder/DecUT_DecExt.cpp
+++ b/test/decoder/DecUT_DecExt.cpp
@@ -34,8 +34,6 @@
void DecoderBs (const char* sFileName);
//Test Initialize/Uninitialize
void TestInitUninit();
- //DECODER_OPTION_DATAFORMAT
- void TestDataFormat();
//DECODER_OPTION_END_OF_STREAM
void TestEndOfStream();
//DECODER_OPTION_VCL_NAL
@@ -78,7 +76,6 @@
memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
memset (&m_sDecParam, 0, sizeof (SDecodingParam));
m_sDecParam.pFileNameRestructed = NULL;
- m_sDecParam.eOutputColorFormat = (EVideoFormatType) (rand() % 100);
m_sDecParam.uiCpuLoad = rand() % 100;
m_sDecParam.uiTargetDqLayer = rand() % 100;
m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) (rand() & 7);
@@ -90,11 +87,7 @@
m_szBuffer[3] = 1;
m_iBufLength = 4;
CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam);
- if ((m_sDecParam.eOutputColorFormat != videoFormatI420) &&
- (m_sDecParam.eOutputColorFormat != videoFormatInternal))
- ASSERT_EQ (eRet, cmUnsupportedData);
- else
- ASSERT_EQ (eRet, cmResultSuccess);
+ ASSERT_EQ (eRet, cmResultSuccess);
}
void DecoderInterfaceTest::Uninit() {
@@ -210,12 +203,8 @@
EXPECT_EQ (eRet, cmInitExpected);
}
//Initialize first, can get input color format
- m_sDecParam.eOutputColorFormat = (EVideoFormatType) 20; //just for test
m_sDecParam.bParseOnly = false;
m_pDec->Initialize (&m_sDecParam);
- eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
- EXPECT_EQ (eRet, cmResultSuccess);
- EXPECT_EQ ((int32_t) videoFormatI420, iOutput);
//Uninitialize, no GetOption can be done
m_pDec->Uninitialize();
@@ -227,32 +216,6 @@
}
}
-//DECODER_OPTION_DATAFORMAT
-void DecoderInterfaceTest::TestDataFormat() {
- int iTmp = rand();
- int iOut;
- CM_RETURN eRet;
-
- Init();
-
- //invalid input
- eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, NULL);
- EXPECT_EQ (eRet, cmInitParaError);
-
- //valid input
- eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, &iTmp);
- if ((iTmp != (int32_t) videoFormatI420) && (iTmp != (int32_t) videoFormatInternal))
- EXPECT_EQ (eRet, cmUnsupportedData);
- else
- EXPECT_EQ (eRet, cmResultSuccess);
- eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOut);
- EXPECT_EQ (eRet, cmResultSuccess);
-
- EXPECT_EQ (iOut, (int32_t) videoFormatI420);
-
- Uninit();
-}
-
//DECODER_OPTION_END_OF_STREAM
void DecoderInterfaceTest::TestEndOfStream() {
int iTmp, iOut;
@@ -515,8 +478,6 @@
//Initialize Uninitialize
TestInitUninit();
- //DECODER_OPTION_DATAFORMAT
- TestDataFormat();
//DECODER_OPTION_END_OF_STREAM
TestEndOfStream();
//DECODER_OPTION_VCL_NAL
--- a/test/decoder/DecUT_ParseSyntax.cpp
+++ b/test/decoder/DecUT_ParseSyntax.cpp
@@ -157,7 +157,6 @@
memset (&m_sDecParam, 0, sizeof (SDecodingParam));
memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
m_sDecParam.pFileNameRestructed = NULL;
- m_sDecParam.eOutputColorFormat = videoFormatI420;
m_sDecParam.uiCpuLoad = rand() % 100;
m_sDecParam.uiTargetDqLayer = rand() % 100;
m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC)7;