[mpp_enc_ref]: Add st_cfg repeat value check

1. When repeat in st_cfg is negative set it to zero.
2. Do not insert non-reference frame when smart oop vi_len less than 2.

Change-Id: Icdf2be21fbbe0a919f7c3006d9c1dde5dfc5ffcb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2020-09-11 15:10:15 +08:00
parent 74cc83f69e
commit a2c289bbce
2 changed files with 29 additions and 17 deletions

View File

@@ -542,6 +542,7 @@ MPP_RET mpi_enc_gen_smart_gop_ref_cfg(MppEncRefCfg ref, RK_S32 gop_len, RK_S32 v
MppEncRefStFrmCfg st_ref[16];
RK_S32 lt_cnt = 1;
RK_S32 st_cnt = 8;
RK_S32 pos = 0;
MPP_RET ret = MPP_OK;
memset(&lt_ref, 0, sizeof(lt_ref));
@@ -559,26 +560,31 @@ MPP_RET mpi_enc_gen_smart_gop_ref_cfg(MppEncRefCfg ref, RK_S32 gop_len, RK_S32 v
ret = mpp_enc_ref_cfg_add_lt_cfg(ref, 1, lt_ref);
/* st 0 layer 0 - ref */
st_ref[0].is_non_ref = 0;
st_ref[0].temporal_id = 0;
st_ref[0].ref_mode = REF_TO_PREV_INTRA;
st_ref[0].ref_arg = 0;
st_ref[0].repeat = 0;
st_ref[pos].is_non_ref = 0;
st_ref[pos].temporal_id = 0;
st_ref[pos].ref_mode = REF_TO_PREV_INTRA;
st_ref[pos].ref_arg = 0;
st_ref[pos].repeat = 0;
pos++;
/* st 1 layer 3 - non-ref */
st_ref[1].is_non_ref = 0;
st_ref[1].temporal_id = 1;
st_ref[1].ref_mode = REF_TO_PREV_REF_FRM;
st_ref[1].ref_arg = 0;
st_ref[1].repeat = vi_len - 2;
/* st 1 layer 1 - non-ref */
if (vi_len > 1) {
st_ref[pos].is_non_ref = 0;
st_ref[pos].temporal_id = 1;
st_ref[pos].ref_mode = REF_TO_PREV_REF_FRM;
st_ref[pos].ref_arg = 0;
st_ref[pos].repeat = vi_len - 2;
pos++;
}
st_ref[2].is_non_ref = 0;
st_ref[2].temporal_id = 0;
st_ref[2].ref_mode = REF_TO_PREV_INTRA;
st_ref[2].ref_arg = 0;
st_ref[2].repeat = 0;
st_ref[pos].is_non_ref = 0;
st_ref[pos].temporal_id = 0;
st_ref[pos].ref_mode = REF_TO_PREV_INTRA;
st_ref[pos].ref_arg = 0;
st_ref[pos].repeat = 0;
pos++;
ret = mpp_enc_ref_cfg_add_st_cfg(ref, 3, st_ref);
ret = mpp_enc_ref_cfg_add_st_cfg(ref, pos, st_ref);
/* check and get dpb size */
ret = mpp_enc_ref_cfg_check(ref);