[rc]: Fix bitrate error on low fps out case

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Idd74ae718d3a597c95ba541b9ae5a9fabfa4c871
This commit is contained in:
Herman Chen
2020-09-16 17:53:04 +08:00
parent 879c161b9b
commit 77a795a7fc

View File

@@ -283,7 +283,7 @@ MPP_RET bits_model_init(RcModelV2Ctx *ctx)
ctx->first_frm_flg = 1;
stat_len = fps->fps_in_num * ctx->usr_cfg.stat_times;
stat_len = fps->fps_out_num * ctx->usr_cfg.stat_times / fps->fps_out_denorm;
if ( ctx->usr_cfg.mode == RC_FIXQP) {
return MPP_OK;
} else if (ctx->usr_cfg.mode == RC_CBR) {
@@ -296,7 +296,7 @@ MPP_RET bits_model_init(RcModelV2Ctx *ctx)
if (gop_len >= 1)
gop_bits = (RK_S64)gop_len * target_bps * fps->fps_out_denorm;
else
gop_bits = (RK_S64)fps->fps_in_num * target_bps * fps->fps_out_denorm;
gop_bits = (RK_S64)fps->fps_out_num * target_bps * fps->fps_out_denorm;
ctx->gop_total_bits = gop_bits / fps->fps_out_num;
@@ -347,9 +347,9 @@ MPP_RET bits_model_init(RcModelV2Ctx *ctx)
return -1;
}
mpp_data_init_v2(&ctx->stat_rate, fps->fps_in_num);
mpp_data_init_v2(&ctx->stat_rate, fps->fps_out_num);
if (ctx->stat_rate == NULL) {
mpp_err("stat_rate init fail fps_in_num %d", fps->fps_in_num);
mpp_err("stat_rate init fail fps_out_num %d", fps->fps_out_num);
return -1;
}
@@ -368,7 +368,7 @@ MPP_RET bits_model_init(RcModelV2Ctx *ctx)
}
mpp_data_reset_v2(ctx->gop_bits, 0);
ctx->bit_per_frame = target_bps / fps->fps_in_num;
ctx->bit_per_frame = target_bps * fps->fps_out_denorm / fps->fps_out_num;
ctx->watl_thrd = 3 * target_bps;
ctx->stat_watl = ctx->watl_thrd >> 3;
ctx->watl_base = ctx->stat_watl;