History

use cavlc if profile is baseline(following profile set)

Karina committed 9 years ago

Commit 6a8f6c91 parent f6c37b03 files · +25 −32Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+20−23
@@ -132,10 +132,6 @@ void CheckProfileSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int · 131 unmodified lines
132132 uiProfileIdc);
133133 pLayerInfo->uiProfileIdc = PRO_BASELINE;
134134 }
135− if (pParam->iEntropyCodingModeFlag && pLayerInfo->uiProfileIdc == PRO_BASELINE) {
136− pLayerInfo->uiProfileIdc = PRO_MAIN;
137− WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) change to main profile because cabac is enabled", iLayer);
138− }
139135 } else {
140136 if (iLayer == SPATIAL_LAYER_0) {
141137 if ((uiProfileIdc != PRO_BASELINE) && (uiProfileIdc != PRO_MAIN) && (uiProfileIdc != PRO_HIGH)) {
@@ -143,20 +139,12 @@ void CheckProfileSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int · 1 unmodified line
143139 uiProfileIdc);
144140 pLayerInfo->uiProfileIdc = PRO_BASELINE;
145141 }
146− if (pParam->iEntropyCodingModeFlag && (pLayerInfo->uiProfileIdc == PRO_BASELINE)) {
147− pLayerInfo->uiProfileIdc = PRO_MAIN;
148− WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) change to main profile because cabac is enabled", iLayer);
149− }
150142 } else {
151143 if ((uiProfileIdc != PRO_SCALABLE_BASELINE) && (uiProfileIdc != PRO_SCALABLE_HIGH)) {
152144 pLayerInfo->uiProfileIdc = PRO_SCALABLE_BASELINE;
153145 WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) doesn't support profile(%d), change to scalable baseline profile",
154146 iLayer, uiProfileIdc);
155147 }
156− if (pParam->iEntropyCodingModeFlag && (pLayerInfo->uiProfileIdc == PRO_SCALABLE_BASELINE)) {
157− pLayerInfo->uiProfileIdc = PRO_SCALABLE_HIGH;
158− WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) change to scalable hight profile because cabac is enabled", iLayer);
159− }
160148 }
161149 }
162150 }
@@ -645,7 +633,15 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 482 unmodified lines
645633 break;
646634 }
647635 }
648−
636+ for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) {
637+ SSpatialLayerConfig* pLayerInfo = &pCodingParam->sSpatialLayers[i];
638+ if ((pLayerInfo->uiProfileIdc == PRO_BASELINE) || (pLayerInfo->uiProfileIdc == PRO_SCALABLE_BASELINE)) {
639+ if (pCodingParam->iEntropyCodingModeFlag != 0) {
640+ pCodingParam->iEntropyCodingModeFlag = 0;
641+ WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) Profile is baseline, Change CABAC to CAVLC",i);
642+ }
643+ }
644+ }
649645 return ParamValidation (pLogCtx, pCodingParam);
650646 }
651647
@@ -728,7 +724,7 @@ int32_t WelsEncoderApplyBitVaryRang (SLogContext* pLogCtx, SWelsSvcCodingParam* · 76 unmodified lines
728724 * \return 0 - successful; otherwise failed
729725 */
730726 int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers,
731− int32_t* pCountNals) {
727+ int32_t* pCountNals) {
732728 int32_t iCountNumLayers = 0;
733729 int32_t iCountNumNals = 0;
734730 int32_t iNumDependencyLayers = 0;
@@ -2415,7 +2411,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 1680 unmodified lines
24152411 else if (iPartitionNum > AVERSLICENUM_CONSTRAINT)
24162412 iPartitionNum = AVERSLICENUM_CONSTRAINT; // AVERSLICENUM_CONSTRAINT might be variable, however not fixed by MACRO
24172413 iCountMbNumPerPartition /= iPartitionNum;
2418− if(iCountMbNumPerPartition == 0 || iCountMbNumPerPartition == 1) {
2414+ if (iCountMbNumPerPartition == 0 || iCountMbNumPerPartition == 1) {
24192415 iCountMbNumPerPartition = kiMbNumInFrame;
24202416 iPartitionNum = 1;
24212417 }
@@ -2444,7 +2440,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 22 unmodified lines
24442440 ++ i;
24452441 }
24462442
2447− while(i<MAX_THREADS_NUM) {
2443+ while (i < MAX_THREADS_NUM) {
24482444 pCurDq->FirstMbIdxOfPartition[i] = 0;
24492445 pCurDq->EndMbIdxOfPartition[i] = 0;
24502446 pCurDq->LastCodedMbIdxOfPartition[i] = 0;
@@ -2489,7 +2485,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 38 unmodified lines
24892485 //MINPACKETSIZE_CONSTRAINT
24902486 //suppose 16 byte per mb at average
24912487 uiMiniPacketSize = (uint32_t) (uiFrmByte / pSliceCtx->iMaxSliceNumConstraint);
2492− if (pSliceCtx->uiSliceSizeConstraint < uiMiniPacketSize ) {
2488+ if (pSliceCtx->uiSliceSizeConstraint < uiMiniPacketSize) {
24932489 WelsLog (& (pCtx->sLogCtx),
24942490 WELS_LOG_WARNING,
24952491 "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!",
@@ -3655,7 +3651,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1159 unmodified lines
36553651
36563652 WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc);
36573653 assert (0 == (int) pCurSlice->iSliceIdx);
3658− pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, 0);
3654+ pCtx->iEncoderError = SetSliceBoundaryInfo (pCtx->pCurDqLayer, pCurSlice, 0);
36593655 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
36603656
36613657 pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType);
@@ -3748,10 +3744,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 86 unmodified lines
37483744 ++ iIdx;
37493745 }
37503746
3751− int32_t iRet = InitAllSlicesInThread(pCtx);
3747+ int32_t iRet = InitAllSlicesInThread (pCtx);
37523748 if (iRet) {
37533749 WelsLog (pLogCtx, WELS_LOG_ERROR,
3754− "WelsEncoderEncodeExt(), multi-slice (mode %d) InitAllSlicesInThread() error!",
3750+ "WelsEncoderEncodeExt(), multi-slice (mode %d) InitAllSlicesInThread() error!",
37553751 pParam->sSliceArgument.uiSliceMode);
37563752 return ENC_RETURN_UNEXPECTED;
37573753 }
@@ -3796,7 +3792,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 38 unmodified lines
37963792
37973793 pCurSlice = &pCtx->pCurDqLayer->sSliceBufferInfo[0].pSliceBuffer[iSliceIdx];
37983794 assert (iSliceIdx == pCurSlice->iSliceIdx);
3799− pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx);
3795+ pCtx->iEncoderError = SetSliceBoundaryInfo (pCtx->pCurDqLayer, pCurSlice, iSliceIdx);
38003796
38013797 pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType);
38023798 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
@@ -4426,7 +4422,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 623 unmodified lines
44264422 int32_t iRet = 0;
44274423
44284424 iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum);
4429− if(ENC_RETURN_SUCCESS != iRet) {
4425+ if (ENC_RETURN_SUCCESS != iRet) {
44304426 return iRet;
44314427 }
44324428
@@ -4470,7 +4466,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 37 unmodified lines
44704466 int32_t iPayloadSize = 0;
44714467 SSlice* pCurSlice = NULL;
44724468
4473− if (iSliceIdx >= (pCurLayer->sSliceBufferInfo[uSlcBuffIdx].iMaxSliceNum - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
4469+ if (iSliceIdx >= (pCurLayer->sSliceBufferInfo[uSlcBuffIdx].iMaxSliceNum -
4470+ kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
44744471 if (pCtx->iActiveThreadsNum == 1) {
44754472 //only single thread support re-alloc now
44764473 if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t