[h264e_control]: fix the rate control bug

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1178 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
GaoZhili
2016-08-09 03:01:05 +00:00
parent e68d663c13
commit a9b047a379
3 changed files with 10 additions and 5 deletions

View File

@@ -968,7 +968,7 @@ H264EncRet H264EncStrmEncodeAfter(H264ECtx *pEncInst,
if (stat == H264RC_OVERFLOW) { if (stat == H264RC_OVERFLOW) {
/* pEncOut->codingType = H264ENC_NOTCODED_FRAME; */ /* pEncOut->codingType = H264ENC_NOTCODED_FRAME; */
pSlice->frameNum = pSlice->prevFrameNum; /* revert frame_num */ pSlice->frameNum = pSlice->prevFrameNum; /* revert frame_num */
h264e_dbg_func("H264EncStrmEncode: OK, Frame discarded (HRD overflow)"); mpp_err("H264EncStrmEncode: OK, Frame discarded (HRD overflow)!");
return H264ENC_FRAME_READY; return H264ENC_FRAME_READY;
} }
} }

View File

@@ -322,8 +322,8 @@ MPP_RET h264e_config(void *ctx, RK_S32 cmd, void *param)
if (mpp_cfg->rc_mode) { if (mpp_cfg->rc_mode) {
/* VBR / CBR mode */ /* VBR / CBR mode */
RK_S32 max_qp = MPP_MAX(mpp_cfg->qp + 6, 48); RK_S32 max_qp = MPP_MAX(mpp_cfg->qp + 6, 51);
RK_S32 min_qp = MPP_MIN(mpp_cfg->qp - 6, 16); RK_S32 min_qp = MPP_MIN(mpp_cfg->qp - 6, 18);
enc_rc_cfg->pictureRc = 1; enc_rc_cfg->pictureRc = 1;
enc_rc_cfg->mbRc = 1; enc_rc_cfg->mbRc = 1;
@@ -353,7 +353,7 @@ MPP_RET h264e_config(void *ctx, RK_S32 cmd, void *param)
enc_rc_cfg->bitPerSecond = mpp_cfg->bps; enc_rc_cfg->bitPerSecond = mpp_cfg->bps;
enc_rc_cfg->gopLen = mpp_cfg->gop; enc_rc_cfg->gopLen = mpp_cfg->gop;
enc_rc_cfg->fixedIntraQp = 0; enc_rc_cfg->fixedIntraQp = 0;
enc_rc_cfg->mbQpAdjustment = 3; enc_rc_cfg->mbQpAdjustment = 0;
enc_rc_cfg->hrdCpbSize = mpp_cfg->bps; enc_rc_cfg->hrdCpbSize = mpp_cfg->bps;
enc->intraPicRate = enc_rc_cfg->intraPicRate; enc->intraPicRate = enc_rc_cfg->intraPicRate;
@@ -437,6 +437,7 @@ MPP_RET h264e_config(void *ctx, RK_S32 cmd, void *param)
MPP_RET h264e_callback(void *ctx, void *feedback) MPP_RET h264e_callback(void *ctx, void *feedback)
{ {
H264ECtx *enc = (H264ECtx *)ctx; H264ECtx *enc = (H264ECtx *)ctx;
H264EncIn *encIn = &(enc->encIn);
regValues_s *val = &(enc->asic.regs); regValues_s *val = &(enc->asic.regs);
h264e_feedback *fb = (h264e_feedback *)feedback; h264e_feedback *fb = (h264e_feedback *)feedback;
H264EncOut *encOut = &(enc->encOut); H264EncOut *encOut = &(enc->encOut);
@@ -484,6 +485,8 @@ MPP_RET h264e_callback(void *ctx, void *feedback)
break; break;
} }
encIn->timeIncrement = 1;
return MPP_OK; return MPP_OK;
} }

View File

@@ -343,11 +343,13 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
enc_param->height = cmd->height; enc_param->height = cmd->height;
enc_param->format = ENC_INPUT_YUV420_PLANAR; enc_param->format = ENC_INPUT_YUV420_PLANAR;
enc_param->rc_mode = 0; enc_param->rc_mode = 0;
enc_param->bitRate = 100000; enc_param->bitRate = 4000000;
enc_param->framerate = 25; enc_param->framerate = 25;
enc_param->enableCabac = 1; enc_param->enableCabac = 1;
enc_param->cabacInitIdc = 0; enc_param->cabacInitIdc = 0;
enc_param->intraPicRate = 30; enc_param->intraPicRate = 30;
enc_param->profileIdc = 66;
enc_param->levelIdc = 40;
if ((ret = ctx->init(ctx, NULL, 0)) != 0) { if ((ret = ctx->init(ctx, NULL, 0)) != 0) {
mpp_log("init vpu api context fail, ret: 0x%X\n", ret); mpp_log("init vpu api context fail, ret: 0x%X\n", ret);