mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[mpp_enc_v2]: Fix missing rc update on qp changed
When qp limit in codec_cfg is changed the rc_cfg should be also updated. Change-Id: Ia5da305c015e6bc11836b6c358ddee6be51e819a Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -337,6 +337,32 @@ static RK_S32 check_resend_hdr(MpiCmd cmd, void *param, MppEncCfgSet *cfg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static RK_S32 check_codec_to_rc_cfg_update(MppEncCodecCfg *codec)
|
||||
{
|
||||
MppCodingType coding = codec->coding;
|
||||
|
||||
switch (coding) {
|
||||
case MPP_VIDEO_CodingAVC : {
|
||||
MppEncH264Cfg *h264 = &codec->h264;
|
||||
if (h264->change | MPP_ENC_H264_CFG_CHANGE_QP_LIMIT)
|
||||
return 1;
|
||||
} break;
|
||||
case MPP_VIDEO_CodingHEVC : {
|
||||
MppEncH265Cfg *h265 = &codec->h265;
|
||||
if (h265->change | MPP_ENC_H265_CFG_RC_QP_CHANGE)
|
||||
return 1;
|
||||
} break;
|
||||
case MPP_VIDEO_CodingVP8 : {
|
||||
} break;
|
||||
case MPP_VIDEO_CodingMJPEG : {
|
||||
} break;
|
||||
default : {
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static RK_S32 check_rc_cfg_update(MpiCmd cmd, MppEncCfgSet *cfg)
|
||||
{
|
||||
if (cmd == MPP_ENC_SET_RC_CFG ||
|
||||
@@ -345,6 +371,11 @@ static RK_S32 check_rc_cfg_update(MpiCmd cmd, MppEncCfgSet *cfg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cmd == MPP_ENC_SET_CODEC_CFG) {
|
||||
if (check_codec_to_rc_cfg_update(&cfg->codec))
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cmd == MPP_ENC_SET_CFG) {
|
||||
RK_U32 change = cfg->prep.change;
|
||||
RK_U32 check_flag = MPP_ENC_PREP_CFG_CHANGE_INPUT |
|
||||
@@ -362,6 +393,9 @@ static RK_S32 check_rc_cfg_update(MpiCmd cmd, MppEncCfgSet *cfg)
|
||||
|
||||
if (change & check_flag)
|
||||
return 1;
|
||||
|
||||
if (check_codec_to_rc_cfg_update(&cfg->codec))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user