From 3fefb08b3487f8816e6aaa5f6edb841a146f4f0e Mon Sep 17 00:00:00 2001 From: ruil2 Date: Mon, 23 Jun 2014 16:18:59 +0800 Subject: [PATCH 1/2] add iSubSeqId to make the meaning clearly. --- codec/api/svc/codec_app_def.h | 21 ++++--------------- codec/console/enc/src/welsenc.cpp | 2 +- codec/encoder/core/src/encoder_ext.cpp | 20 +++++++----------- .../core/src/slice_multi_threading.cpp | 1 - module/gmp-openh264.cpp | 4 ++-- 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/codec/api/svc/codec_app_def.h b/codec/api/svc/codec_app_def.h index 1aaebdb6..baa8ac42 100644 --- a/codec/api/svc/codec_app_def.h +++ b/codec/api/svc/codec_app_def.h @@ -247,19 +247,6 @@ enum { WELS_LOG_DEFAULT = WELS_LOG_DEBUG // Default log iLevel in Wels codec }; -typedef enum{ - FRAMEIDC_IDR = 0x00, - FRAMEIDC_I = 0x04, - FRAMEIDC_LTR = 0x08, - FRAMEIDC_T0 = 0x10, - FRAMEIDC_T1 = 0x11, - FRAMEIDC_T2 = 0x12, - FRAMEIDC_T3 = 0x13, - FRAMEIDC_T4 = 0x14, - FRAMEIDC_UNKNOWN = 0x20, - FRAMEIDC_INVALID = 0xFF, -}EFrameIDC; - typedef struct { SliceModeEnum uiSliceMode; //by default, uiSliceMode will be SM_SINGLE_SLICE SSliceArgument sSliceArgument; @@ -376,8 +363,6 @@ typedef struct { unsigned char uiSpatialId; unsigned char uiQualityId; - unsigned char uiPriorityId; //ignore it currently - unsigned char uiLayerType; int iNalCount; // Count number of NAL coded already @@ -388,12 +373,14 @@ typedef struct { typedef struct { int iTemporalId; // Temporal ID - EFrameIDC eFrameIdc; + //The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be + //predicted from any picture on any higher layer. + int iSubSeqId; //refer to D.2.11 Sub-sequence information SEI message semantics int iLayerNum; SLayerBSInfo sLayerInfo[MAX_LAYER_NUM_OF_FRAME]; - EVideoFrameType eOutputFrameType; + EVideoFrameType eFrameType; long long uiTimeStamp; } SFrameBSInfo, *PFrameBSInfo; diff --git a/codec/console/enc/src/welsenc.cpp b/codec/console/enc/src/welsenc.cpp index 11878511..1f2b6f72 100644 --- a/codec/console/enc/src/welsenc.cpp +++ b/codec/console/enc/src/welsenc.cpp @@ -805,7 +805,7 @@ int ProcessEncoding(ISVCEncoder* pPtrEnc, int argc, char** argv,bool bConfigFile iTotal += WelsTime() - iStart; // fixed issue in case dismatch source picture introduced by frame skipped, 1/12/2010 - if (videoFrameTypeSkip == sFbi.eOutputFrameType) { + if (videoFrameTypeSkip == sFbi.eFrameType) { continue; } diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index 2d33a3dd..874d74ec 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -2885,7 +2885,6 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal); WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->uiSpatialId = 0; pLayerBsInfo->uiTemporalId = 0; pLayerBsInfo->uiQualityId = 0; @@ -2948,13 +2947,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic); if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) ++ pCtx->iCodingIndex; - pFbi->eOutputFrameType = videoFrameTypeSkip; + pFbi->eFrameType = videoFrameTypeSkip; return ENC_RETURN_SUCCESS; } eFrameType = DecideFrameType (pCtx, iSpatialNum); if (eFrameType == videoFrameTypeSkip) { - pFbi->eOutputFrameType = eFrameType; + pFbi->eFrameType = eFrameType; return ENC_RETURN_SUCCESS; } @@ -2969,7 +2968,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour } } if (true == bSkipMustFlag) { - pFbi->eOutputFrameType = videoFrameTypeSkip; + pFbi->eFrameType = videoFrameTypeSkip; return ENC_RETURN_SUCCESS; } } @@ -2992,7 +2991,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal); WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->uiSpatialId = 0; pLayerBsInfo->uiTemporalId = 0; pLayerBsInfo->uiQualityId = 0; @@ -3095,7 +3093,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!\n", pCtx->iNumRef0); - pFbi->eOutputFrameType = videoFrameTypeIDR; + pFbi->eFrameType = videoFrameTypeIDR; pCtx->iEncoderError = ENC_RETURN_CORRECTED; return ENC_RETURN_CORRECTED; } @@ -3150,7 +3148,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour pLayerBsInfo->uiSpatialId = iCurDid; pLayerBsInfo->uiTemporalId = iCurTid; pLayerBsInfo->uiQualityId = 0; - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->iNalCount = ++ iNalIdxInLayer; } // for dynamic slicing single threading.. @@ -3336,7 +3333,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour pLayerBsInfo->uiSpatialId = iCurDid; pLayerBsInfo->uiTemporalId = iCurTid; pLayerBsInfo->uiQualityId = 0; - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->iNalCount = iNalIdxInLayer; } } @@ -3360,7 +3356,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour ForceCodingIDR (pCtx); WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!\n"); //the above is to set the next frame to be IDR - pFbi->eOutputFrameType = eFrameType; + pFbi->eFrameType = eFrameType; return ENC_RETURN_CORRECTED; } } @@ -3474,7 +3470,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize = 0; - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->uiSpatialId = 0; pLayerBsInfo->uiTemporalId = 0; pLayerBsInfo->uiQualityId = 0; @@ -3512,7 +3507,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour ForceCodingIDR (pCtx); WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n"); //the above is to set the next frame IDR - pFbi->eOutputFrameType = eFrameType; + pFbi->eFrameType = eFrameType; return ENC_RETURN_CORRECTED; } @@ -3548,7 +3543,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour WelsEmms(); - pFbi->eOutputFrameType = eFrameType; + pFbi->eFrameType = eFrameType; return ENC_RETURN_SUCCESS; } @@ -3934,7 +3929,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, pLayerBsInfo->uiSpatialId = pCtx->uiDependencyId; pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId; pLayerBsInfo->uiQualityId = 0; - pLayerBsInfo->uiPriorityId = 0; pLayerBsInfo->iNalCount = iNalIdxInLayer; return ENC_RETURN_SUCCESS; diff --git a/codec/encoder/core/src/slice_multi_threading.cpp b/codec/encoder/core/src/slice_multi_threading.cpp index 7ccefa6a..552b3d67 100644 --- a/codec/encoder/core/src/slice_multi_threading.cpp +++ b/codec/encoder/core/src/slice_multi_threading.cpp @@ -634,7 +634,6 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr pLbi->uiSpatialId = pNalHdrExt->uiDependencyId; pLbi->uiTemporalId = pNalHdrExt->uiTemporalId; pLbi->uiQualityId = 0; - pLbi->uiPriorityId = 0; pLbi->iNalCount = kiNalCnt; } else { pLbi->iNalCount += kiNalCnt; diff --git a/module/gmp-openh264.cpp b/module/gmp-openh264.cpp index aa64d883..32ebc7d4 100644 --- a/module/gmp-openh264.cpp +++ b/module/gmp-openh264.cpp @@ -360,7 +360,7 @@ class OpenH264VideoEncoder : public GMPVideoEncoder { GMPVideoFrameType encoded_type; bool has_frame = false; - switch (encoded.eOutputFrameType) { + switch (encoded.eFrameType) { case videoFrameTypeIDR: encoded_type = kGMPKeyFrame; has_frame = true; @@ -379,7 +379,7 @@ class OpenH264VideoEncoder : public GMPVideoEncoder { case videoFrameTypeIPMixed://this type is currently not suppported case videoFrameTypeInvalid: GMPLOG (GL_ERROR, "Couldn't encode frame. Type = " - << encoded.eOutputFrameType); + << encoded.eFrameType); break; default: // The API is defined as returning a type. From f40b964526150d17040484c71b7d4cbf6062e65f Mon Sep 17 00:00:00 2001 From: ruil2 Date: Mon, 23 Jun 2014 16:38:45 +0800 Subject: [PATCH 2/2] update unit test code to support name change --- test/api/BaseEncoderTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/BaseEncoderTest.cpp b/test/api/BaseEncoderTest.cpp index ede51a39..a91feac0 100644 --- a/test/api/BaseEncoderTest.cpp +++ b/test/api/BaseEncoderTest.cpp @@ -96,7 +96,7 @@ void BaseEncoderTest::EncodeStream(InputStream* in, EUsageType usageType, int wi while (in->read(buf.data(), frameSize) == frameSize) { rv = encoder_->EncodeFrame(&pic, &info); ASSERT_TRUE(rv == cmResultSuccess); - if (info.eOutputFrameType != videoFrameTypeSkip && cbk != NULL) { + if (info.eFrameType != videoFrameTypeSkip && cbk != NULL) { cbk->onEncodeFrame(info); } }