Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all
Unified · Split
| @@ -132,10 +132,6 @@ void CheckProfileSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int · 131 unmodified lines | |||
| 132 | uiProfileIdc); | 132 | uiProfileIdc); |
| 133 | pLayerInfo->uiProfileIdc = PRO_BASELINE; | 133 | pLayerInfo->uiProfileIdc = PRO_BASELINE; |
| 134 | } | 134 | } |
| 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 | } | ||
| 139 | } else { | 135 | } else { |
| 140 | if (iLayer == SPATIAL_LAYER_0) { | 136 | if (iLayer == SPATIAL_LAYER_0) { |
| 141 | if ((uiProfileIdc != PRO_BASELINE) && (uiProfileIdc != PRO_MAIN) && (uiProfileIdc != PRO_HIGH)) { | 137 | if ((uiProfileIdc != PRO_BASELINE) && (uiProfileIdc != PRO_MAIN) && (uiProfileIdc != PRO_HIGH)) { |
| @@ -143,20 +139,12 @@ void CheckProfileSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int · 1 unmodified line | |||
| 143 | uiProfileIdc); | 139 | uiProfileIdc); |
| 144 | pLayerInfo->uiProfileIdc = PRO_BASELINE; | 140 | pLayerInfo->uiProfileIdc = PRO_BASELINE; |
| 145 | } | 141 | } |
| 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 | } | ||
| 150 | } else { | 142 | } else { |
| 151 | if ((uiProfileIdc != PRO_SCALABLE_BASELINE) && (uiProfileIdc != PRO_SCALABLE_HIGH)) { | 143 | if ((uiProfileIdc != PRO_SCALABLE_BASELINE) && (uiProfileIdc != PRO_SCALABLE_HIGH)) { |
| 152 | pLayerInfo->uiProfileIdc = PRO_SCALABLE_BASELINE; | 144 | pLayerInfo->uiProfileIdc = PRO_SCALABLE_BASELINE; |
| 153 | WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) doesn't support profile(%d), change to scalable baseline profile", | 145 | WelsLog (pLogCtx, WELS_LOG_WARNING, "layerId(%d) doesn't support profile(%d), change to scalable baseline profile", |
| 154 | iLayer, uiProfileIdc); | 146 | iLayer, uiProfileIdc); |
| 155 | } | 147 | } |
| 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 | } | ||
| 160 | } | 148 | } |
| 161 | } | 149 | } |
| 162 | } | 150 | } |
| @@ -645,7 +633,15 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 482 unmodified lines | |||
| 645 | break; | 633 | break; |
| 646 | } | 634 | } |
| 647 | } | 635 | } |
| 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 | } | ||
| 649 | return ParamValidation (pLogCtx, pCodingParam); | 645 | return ParamValidation (pLogCtx, pCodingParam); |
| 650 | } | 646 | } |
| 651 | 647 | ||
| @@ -728,7 +724,7 @@ int32_t WelsEncoderApplyBitVaryRang (SLogContext* pLogCtx, SWelsSvcCodingParam* · 76 unmodified lines | |||
| 728 | * \return 0 - successful; otherwise failed | 724 | * \return 0 - successful; otherwise failed |
| 729 | */ | 725 | */ |
| 730 | int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers, | 726 | int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, int32_t* pCountLayers, |
| 731 | int32_t* pCountNals) { | 727 | int32_t* pCountNals) { |
| 732 | int32_t iCountNumLayers = 0; | 728 | int32_t iCountNumLayers = 0; |
| 733 | int32_t iCountNumNals = 0; | 729 | int32_t iCountNumNals = 0; |
| 734 | int32_t iNumDependencyLayers = 0; | 730 | int32_t iNumDependencyLayers = 0; |
| @@ -2415,7 +2411,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 1680 unmodified lines | |||
| 2415 | else if (iPartitionNum > AVERSLICENUM_CONSTRAINT) | 2411 | else if (iPartitionNum > AVERSLICENUM_CONSTRAINT) |
| 2416 | iPartitionNum = AVERSLICENUM_CONSTRAINT; // AVERSLICENUM_CONSTRAINT might be variable, however not fixed by MACRO | 2412 | iPartitionNum = AVERSLICENUM_CONSTRAINT; // AVERSLICENUM_CONSTRAINT might be variable, however not fixed by MACRO |
| 2417 | iCountMbNumPerPartition /= iPartitionNum; | 2413 | iCountMbNumPerPartition /= iPartitionNum; |
| 2418 | if(iCountMbNumPerPartition == 0 || iCountMbNumPerPartition == 1) { | 2414 | if (iCountMbNumPerPartition == 0 || iCountMbNumPerPartition == 1) { |
| 2419 | iCountMbNumPerPartition = kiMbNumInFrame; | 2415 | iCountMbNumPerPartition = kiMbNumInFrame; |
| 2420 | iPartitionNum = 1; | 2416 | iPartitionNum = 1; |
| 2421 | } | 2417 | } |
| @@ -2444,7 +2440,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 22 unmodified lines | |||
| 2444 | ++ i; | 2440 | ++ i; |
| 2445 | } | 2441 | } |
| 2446 | 2442 | ||
| 2447 | while(i<MAX_THREADS_NUM) { | 2443 | while (i < MAX_THREADS_NUM) { |
| 2448 | pCurDq->FirstMbIdxOfPartition[i] = 0; | 2444 | pCurDq->FirstMbIdxOfPartition[i] = 0; |
| 2449 | pCurDq->EndMbIdxOfPartition[i] = 0; | 2445 | pCurDq->EndMbIdxOfPartition[i] = 0; |
| 2450 | pCurDq->LastCodedMbIdxOfPartition[i] = 0; | 2446 | pCurDq->LastCodedMbIdxOfPartition[i] = 0; |
| @@ -2489,7 +2485,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 38 unmodified lines | |||
| 2489 | //MINPACKETSIZE_CONSTRAINT | 2485 | //MINPACKETSIZE_CONSTRAINT |
| 2490 | //suppose 16 byte per mb at average | 2486 | //suppose 16 byte per mb at average |
| 2491 | uiMiniPacketSize = (uint32_t) (uiFrmByte / pSliceCtx->iMaxSliceNumConstraint); | 2487 | uiMiniPacketSize = (uint32_t) (uiFrmByte / pSliceCtx->iMaxSliceNumConstraint); |
| 2492 | if (pSliceCtx->uiSliceSizeConstraint < uiMiniPacketSize ) { | 2488 | if (pSliceCtx->uiSliceSizeConstraint < uiMiniPacketSize) { |
| 2493 | WelsLog (& (pCtx->sLogCtx), | 2489 | WelsLog (& (pCtx->sLogCtx), |
| 2494 | WELS_LOG_WARNING, | 2490 | WELS_LOG_WARNING, |
| 2495 | "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!", | 2491 | "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 | |||
| 3655 | 3651 | ||
| 3656 | WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc); | 3652 | WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc); |
| 3657 | assert (0 == (int) pCurSlice->iSliceIdx); | 3653 | assert (0 == (int) pCurSlice->iSliceIdx); |
| 3658 | pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, 0); | 3654 | pCtx->iEncoderError = SetSliceBoundaryInfo (pCtx->pCurDqLayer, pCurSlice, 0); |
| 3659 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3655 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3660 | 3656 | ||
| 3661 | pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType); | 3657 | pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType); |
| @@ -3748,10 +3744,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 86 unmodified lines | |||
| 3748 | ++ iIdx; | 3744 | ++ iIdx; |
| 3749 | } | 3745 | } |
| 3750 | 3746 | ||
| 3751 | int32_t iRet = InitAllSlicesInThread(pCtx); | 3747 | int32_t iRet = InitAllSlicesInThread (pCtx); |
| 3752 | if (iRet) { | 3748 | if (iRet) { |
| 3753 | WelsLog (pLogCtx, WELS_LOG_ERROR, | 3749 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| 3754 | "WelsEncoderEncodeExt(), multi-slice (mode %d) InitAllSlicesInThread() error!", | 3750 | "WelsEncoderEncodeExt(), multi-slice (mode %d) InitAllSlicesInThread() error!", |
| 3755 | pParam->sSliceArgument.uiSliceMode); | 3751 | pParam->sSliceArgument.uiSliceMode); |
| 3756 | return ENC_RETURN_UNEXPECTED; | 3752 | return ENC_RETURN_UNEXPECTED; |
| 3757 | } | 3753 | } |
| @@ -3796,7 +3792,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 38 unmodified lines | |||
| 3796 | 3792 | ||
| 3797 | pCurSlice = &pCtx->pCurDqLayer->sSliceBufferInfo[0].pSliceBuffer[iSliceIdx]; | 3793 | pCurSlice = &pCtx->pCurDqLayer->sSliceBufferInfo[0].pSliceBuffer[iSliceIdx]; |
| 3798 | assert (iSliceIdx == pCurSlice->iSliceIdx); | 3794 | assert (iSliceIdx == pCurSlice->iSliceIdx); |
| 3799 | pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx); | 3795 | pCtx->iEncoderError = SetSliceBoundaryInfo (pCtx->pCurDqLayer, pCurSlice, iSliceIdx); |
| 3800 | 3796 | ||
| 3801 | pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType); | 3797 | pCtx->iEncoderError = WelsCodeOneSlice (pCtx, pCurSlice, eNalType); |
| 3802 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3798 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| @@ -4426,7 +4422,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 623 unmodified lines | |||
| 4426 | int32_t iRet = 0; | 4422 | int32_t iRet = 0; |
| 4427 | 4423 | ||
| 4428 | iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum); | 4424 | iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum); |
| 4429 | if(ENC_RETURN_SUCCESS != iRet) { | 4425 | if (ENC_RETURN_SUCCESS != iRet) { |
| 4430 | return iRet; | 4426 | return iRet; |
| 4431 | } | 4427 | } |
| 4432 | 4428 | ||
| @@ -4470,7 +4466,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 37 unmodified lines | |||
| 4470 | int32_t iPayloadSize = 0; | 4466 | int32_t iPayloadSize = 0; |
| 4471 | SSlice* pCurSlice = NULL; | 4467 | SSlice* pCurSlice = NULL; |
| 4472 | 4468 | ||
| 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[] | ||
| 4474 | if (pCtx->iActiveThreadsNum == 1) { | 4471 | if (pCtx->iActiveThreadsNum == 1) { |
| 4475 | //only single thread support re-alloc now | 4472 | //only single thread support re-alloc now |
| 4476 | if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) { | 4473 | if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) { |