enlarge QP range when skipframeflag off on BitRate mode

This commit is contained in:
lyao2 2014-09-12 14:45:08 +08:00
parent 679cc4ac6c
commit 522aa4457a
12 changed files with 8462 additions and 8473 deletions

View File

@ -204,8 +204,7 @@ typedef enum {
typedef enum {
RC_QUALITY_MODE = 0, //Quality mode
RC_BITRATE_MODE = 1, //Bitrate mode
RC_LOW_BW_MODE = 2, //bitrate limited mode
RC_BUFFERBASED_MODE = 3,//no bitrate control,only using buffer status,adjust the video quality
RC_BUFFERBASED_MODE = 2,//no bitrate control,only using buffer status,adjust the video quality
RC_OFF_MODE = -1, // rate control off mode
} RC_MODES;

View File

@ -148,8 +148,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
if ((pCfg->iRCMode != RC_OFF_MODE) && (pCfg->iRCMode != RC_QUALITY_MODE) && (pCfg->iRCMode != RC_BUFFERBASED_MODE)
&& (pCfg->iRCMode != RC_BITRATE_MODE)
&& (pCfg->iRCMode != RC_LOW_BW_MODE)) {
&& (pCfg->iRCMode != RC_BITRATE_MODE)) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid iRCMode = %d", pCfg->iRCMode);
return ENC_RETURN_UNSUPPORTED_PARA;
}
@ -2955,8 +2954,7 @@ bool CheckFrameSkipBasedMaxbr (sWelsEncCtx* pCtx, int32_t iSpatialNum) {
SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
bool bSkipMustFlag = false;
if (pCtx->pSvcParam->bEnableFrameSkip) {
if ((RC_QUALITY_MODE == pCtx->pSvcParam->iRCMode) || (RC_BITRATE_MODE == pCtx->pSvcParam->iRCMode)
|| (RC_LOW_BW_MODE == pCtx->pSvcParam->iRCMode)) {
if ((RC_QUALITY_MODE == pCtx->pSvcParam->iRCMode) || (RC_BITRATE_MODE == pCtx->pSvcParam->iRCMode)) {
for (int32_t i = 0; i < iSpatialNum; i++) {
if (0 == pCtx->pSvcParam->sSpatialLayers[i].iMaxSpatialBitrate) {
break;

View File

@ -512,7 +512,7 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) {
iLumaQp = WELS_DIV_ROUND (iLumaQp * INT_MULTIPLY - pEncCtx->pVaa->sAdaptiveQuantParam.iAverMotionTextureIndexToDeltaQp,
INT_MULTIPLY);
if (pEncCtx->pSvcParam->iRCMode != RC_LOW_BW_MODE)
if (!(pEncCtx->pSvcParam->iRCMode == RC_BITRATE_MODE) && (pEncCtx->pSvcParam->bEnableFrameSkip == false))
iLumaQp = WELS_CLIP3 (iLumaQp, pWelsSvcRc->iMinQp, pWelsSvcRc->iMaxQp);
}
@ -554,10 +554,8 @@ void RcDecideTargetBits (sWelsEncCtx* pEncCtx) {
pWelsSvcRc->iRemainingWeights);
else //this case should be not hit. needs to more test case to verify this
pWelsSvcRc->iTargetBits = pWelsSvcRc->iRemainingBits;
if ((pWelsSvcRc->iTargetBits <= 0) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE)) {
if ((pWelsSvcRc->iTargetBits <= 0) && ((pEncCtx->pSvcParam->iRCMode == RC_BITRATE_MODE) && (pEncCtx->pSvcParam->bEnableFrameSkip == false))) {
pWelsSvcRc->iCurrentBitsLevel = BITS_EXCEEDED;
} else if ((pWelsSvcRc->iTargetBits <= pTOverRc->iMinBitsTl) && (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE)) {
pWelsSvcRc->iCurrentBitsLevel = BITS_LIMITED;
}
pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, pTOverRc->iMinBitsTl, pTOverRc->iMaxBitsTl);
}
@ -683,7 +681,7 @@ void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
pSOverRc->iCalculatedQpSlice = WELS_CLIP3 (pSOverRc->iCalculatedQpSlice,
pEncCtx->iGlobalQp - pWelsSvcRc->iQpRangeLowerInFrame, pEncCtx->iGlobalQp + pWelsSvcRc->iQpRangeUpperInFrame);
if (! (pEncCtx->pSvcParam->iRCMode == RC_LOW_BW_MODE))
if (!(pEncCtx->pSvcParam->iRCMode == RC_BITRATE_MODE) && (pEncCtx->pSvcParam->bEnableFrameSkip == false))
pSOverRc->iCalculatedQpSlice = WELS_CLIP3 (pSOverRc->iCalculatedQpSlice, pWelsSvcRc->iMinQp, pWelsSvcRc->iMaxQp);
pSOverRc->iGomBitsSlice = 0;
@ -1032,7 +1030,6 @@ void WelsRcInitModule (void* pCtx, RC_MODES iRcMode) {
break;
case RC_QUALITY_MODE:
case RC_BITRATE_MODE:
case RC_LOW_BW_MODE:
default:
pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom;
pRcf->pfWelsRcPicDelayJudge = WelsRcFrameDelayJudge;

View File

@ -94,7 +94,7 @@ static const EncodeFileParam kFileParamArray[] = {
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
"684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2
"086c9592dd505e43ab6e673ad4f7acc663f04a60", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2
},
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
@ -106,7 +106,7 @@ static const EncodeFileParam kFileParamArray[] = {
},
{
"res/CiscoVT2people_320x192_12fps.yuv",
"030d0e2d742ac039c2ab6333fe7cb18623c0d283", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
"2489cc737dd7924a263ff2b31eded887aecd4d31", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
},
{
"res/CiscoVT2people_160x96_6fps.yuv",
@ -114,7 +114,7 @@ static const EncodeFileParam kFileParamArray[] = {
},
{
"res/Static_152_100.yuv",
"494068b59aa9ed9118a9f33174b732024effc870", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
"352da745e605ffc0260a428628b4b2fb3c724b84", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
},
{
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",

View File

@ -29,8 +29,7 @@ LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
# 3: buffer based mode,can't control bitrate; -1: rc off mode;
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 5000 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 6000 # Unit: kbps, max bitrate overall
EnableFrameSkip 1 #Enable Frame Skip

View File

@ -30,8 +30,7 @@ LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
# 3: buffer based mode,can't control bitrate; -1: rc off mode;
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 5000 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 6000 # Unit: kbps, max bitrate overall

View File

@ -30,8 +30,7 @@ LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
# 3: buffer based mode,can't control bitrate; -1: rc off mode;
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 5000 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 6000 # Unit: kbps, max bitrate overall
EnableFrameSkip 1 #Enable Frame Skip

View File

@ -30,8 +30,7 @@ LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
# 3: buffer based mode,can't control bitrate; -1: rc off mode;
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 5000 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 6000 # Unit: kbps, max bitrate overall

View File

@ -30,8 +30,7 @@ LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
# 3: buffer based mode,can't control bitrate; -1: rc off mode;
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 600 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 800 # Unit: kbps, max bitrate overall