mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 09:36:49 +08:00
[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:
@@ -269,6 +269,12 @@ MPP_RET mpp_enc_ref_cfg_check(MppEncRefCfg ref)
|
|||||||
ready = 0;
|
ready = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg->repeat < 0) {
|
||||||
|
mpp_err_f("ref cfg %p st cfg %d with negative repeat %d set to zero\n",
|
||||||
|
ref, pos, cfg->repeat);
|
||||||
|
cfg->repeat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* constrain on head and tail frame */
|
/* constrain on head and tail frame */
|
||||||
if (pos == 0 || (pos == st_cfg_cnt - 1)) {
|
if (pos == 0 || (pos == st_cfg_cnt - 1)) {
|
||||||
if (cfg->is_non_ref) {
|
if (cfg->is_non_ref) {
|
||||||
|
@@ -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];
|
MppEncRefStFrmCfg st_ref[16];
|
||||||
RK_S32 lt_cnt = 1;
|
RK_S32 lt_cnt = 1;
|
||||||
RK_S32 st_cnt = 8;
|
RK_S32 st_cnt = 8;
|
||||||
|
RK_S32 pos = 0;
|
||||||
MPP_RET ret = MPP_OK;
|
MPP_RET ret = MPP_OK;
|
||||||
|
|
||||||
memset(<_ref, 0, sizeof(lt_ref));
|
memset(<_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);
|
ret = mpp_enc_ref_cfg_add_lt_cfg(ref, 1, lt_ref);
|
||||||
|
|
||||||
/* st 0 layer 0 - ref */
|
/* st 0 layer 0 - ref */
|
||||||
st_ref[0].is_non_ref = 0;
|
st_ref[pos].is_non_ref = 0;
|
||||||
st_ref[0].temporal_id = 0;
|
st_ref[pos].temporal_id = 0;
|
||||||
st_ref[0].ref_mode = REF_TO_PREV_INTRA;
|
st_ref[pos].ref_mode = REF_TO_PREV_INTRA;
|
||||||
st_ref[0].ref_arg = 0;
|
st_ref[pos].ref_arg = 0;
|
||||||
st_ref[0].repeat = 0;
|
st_ref[pos].repeat = 0;
|
||||||
|
pos++;
|
||||||
|
|
||||||
/* st 1 layer 3 - non-ref */
|
/* st 1 layer 1 - non-ref */
|
||||||
st_ref[1].is_non_ref = 0;
|
if (vi_len > 1) {
|
||||||
st_ref[1].temporal_id = 1;
|
st_ref[pos].is_non_ref = 0;
|
||||||
st_ref[1].ref_mode = REF_TO_PREV_REF_FRM;
|
st_ref[pos].temporal_id = 1;
|
||||||
st_ref[1].ref_arg = 0;
|
st_ref[pos].ref_mode = REF_TO_PREV_REF_FRM;
|
||||||
st_ref[1].repeat = vi_len - 2;
|
st_ref[pos].ref_arg = 0;
|
||||||
|
st_ref[pos].repeat = vi_len - 2;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
st_ref[2].is_non_ref = 0;
|
st_ref[pos].is_non_ref = 0;
|
||||||
st_ref[2].temporal_id = 0;
|
st_ref[pos].temporal_id = 0;
|
||||||
st_ref[2].ref_mode = REF_TO_PREV_INTRA;
|
st_ref[pos].ref_mode = REF_TO_PREV_INTRA;
|
||||||
st_ref[2].ref_arg = 0;
|
st_ref[pos].ref_arg = 0;
|
||||||
st_ref[2].repeat = 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 */
|
/* check and get dpb size */
|
||||||
ret = mpp_enc_ref_cfg_check(ref);
|
ret = mpp_enc_ref_cfg_check(ref);
|
||||||
|
Reference in New Issue
Block a user