History

use the external setting for max_qp and min_qp

karina li committed 11 years ago

Commit f2d39191 parent b2c08597 files · +7721 −7705Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+19−4
@@ -202,7 +202,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 201 unmodified lines
202202 if (pCfg->iSpatialLayerNum > 1) {
203203 for (i = pCfg->iSpatialLayerNum - 1; i > 0; i--) {
204204 SSpatialLayerConfig* fDlpUp = &pCfg->sSpatialLayers[i];
205− SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i-1];
205+ SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i - 1];
206206 if ((fDlp->iVideoWidth > fDlpUp->iVideoWidth) || (fDlp->iVideoHeight > fDlpUp->iVideoHeight)) {
207207 WelsLog (pLogCtx, WELS_LOG_ERROR,
208208 "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) should be less than the upper spatial layer resolution(%d x %d) ",
@@ -271,6 +271,18 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 62 unmodified lines
271271 WelsLog (pLogCtx, WELS_LOG_WARNING,
272272 "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.",
273273 pCfg->bEnableFrameSkip);
274+ if (pCfg->iRCMode == RC_QUALITY_MODE) {
275+ pCfg->iMinQp = WELS_CLIP3 (pCfg->iMinQp , GOM_MIN_QP_MODE, GOM_MAX_QP_MODE);
276+ pCfg->iMaxQp = WELS_CLIP3 (pCfg->iMaxQp , GOM_MIN_QP_MODE, GOM_MAX_QP_MODE);
277+ if (pCfg->iMaxQp < pCfg->iMinQp)
278+ pCfg->iMaxQp = GOM_MAX_QP_MODE;
279+ } else {
280+ pCfg->iMinQp = WELS_CLIP3 (pCfg->iMinQp , 0, 51);
281+ pCfg->iMaxQp = WELS_CLIP3 (pCfg->iMaxQp , 0, 51);
282+ if (pCfg->iMaxQp < pCfg->iMinQp)
283+ pCfg->iMaxQp = 51;
284+
285+ }
274286 }
275287 // ref-frames validation
276288 if (((pCfg->iUsageType == CAMERA_VIDEO_REAL_TIME) || (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME))
@@ -3709,7 +3721,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3432 unmodified lines
37093721 if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
37103722 ++ pCtx->iCodingIndex;
37113723 pFbi->eFrameType = videoFrameTypeSkip;
3712− WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else), continual skipped %d frames",
3724+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
3725+ "[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else), continual skipped %d frames",
37133726 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
37143727 return ENC_RETURN_SUCCESS;
37153728 }
@@ -3719,7 +3732,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines
37193732 if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip)
37203733 pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum);
37213734 pFbi->eFrameType = eFrameType;
3722− WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames",
3735+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
3736+ "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames",
37233737 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
37243738 return ENC_RETURN_SUCCESS;
37253739 }
@@ -3730,7 +3744,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 4 unmodified lines
37303744 (uint32_t)pSrcPic->uiTimeStamp);
37313745 if (bSkip) {
37323746 pFbi->eFrameType = videoFrameTypeSkip;
3733− WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames",
3747+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
3748+ "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames",
37343749 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
37353750 return ENC_RETURN_SUCCESS;
37363751 }

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