diff --git a/mpp/codec/rc/rc_model_v2.c b/mpp/codec/rc/rc_model_v2.c index 2ed9d7f3..6eb37868 100644 --- a/mpp/codec/rc/rc_model_v2.c +++ b/mpp/codec/rc/rc_model_v2.c @@ -667,6 +667,11 @@ MPP_RET rc_model_v2_start(void *ctx, EncRcTask *task) rc_dbg_func("enter %p\n", ctx); if (p->usr_cfg.mode == RC_FIXQP) { + if (p->usr_cfg.init_quality <= 0) { + mpp_log("invalid fix %d qp found set default qp 26\n", + p->usr_cfg.init_quality); + p->usr_cfg.init_quality = 26; + } info->quality_max = p->usr_cfg.init_quality; info->quality_min = p->usr_cfg.init_quality; info->quality_target = p->usr_cfg.init_quality; diff --git a/mpp/hal/vpu/h264e/hal_h264e_vepu_v2.c b/mpp/hal/vpu/h264e/hal_h264e_vepu_v2.c index ea588dbb..10071410 100644 --- a/mpp/hal/vpu/h264e/hal_h264e_vepu_v2.c +++ b/mpp/hal/vpu/h264e/hal_h264e_vepu_v2.c @@ -582,26 +582,16 @@ MPP_RET h264e_vepu_mbrc_prepare(HalH264eVepuMbRcCtx ctx, HalH264eVepuMbRc *mbrc, RK_S32 tmp, nonZeroTarget; RK_S32 coeffCntMax = p->mbs * 24 * 16; - if (!p->mb_bit_rc_enable) { - if (codec->qp_init == -1) { - mpp_log("fix qp case but qp no set default qp = 26"); - mbrc->qp_init = 26; - } else { - mbrc->qp_init = codec->qp_init; - } - - mbrc->qp_min = mbrc->qp_init; - mbrc->qp_max = mbrc->qp_init; - return MPP_OK; - } - - p->pre_frame_type = p->frame_type; - p->frame_type = (frm->is_intra) ? INTRA_FRAME : INTER_P_FRAME; - mbrc->qp_init = info->quality_target; mbrc->qp_min = codec->qp_min; mbrc->qp_max = codec->qp_max; + if (!p->mb_bit_rc_enable) + return MPP_OK; + + p->pre_frame_type = p->frame_type; + p->frame_type = (frm->is_intra) ? INTRA_FRAME : INTER_P_FRAME; + if (mbrc->rlc_count == 0) { mbrc->rlc_count = 1; }