From 9835a6d37ebfce64af93fb206dba16c8d277fb9e Mon Sep 17 00:00:00 2001 From: "sayon.chen" Date: Fri, 10 Jan 2020 11:16:38 +0800 Subject: [PATCH] [h265e_api]: Clear change flag after proc & support tsvc Change-Id: I1c9860588b6aa7f043f19f00c9ee212820d6f77a Signed-off-by: sayon.chen --- mpp/codec/enc/h265/h265e_api_v2.c | 19 ++++++++++++------- mpp/codec/enc/h265/h265e_dpb.c | 2 ++ mpp/codec/enc/h265/h265e_ps.c | 4 ++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/mpp/codec/enc/h265/h265e_api_v2.c b/mpp/codec/enc/h265/h265e_api_v2.c index 40639507..a9f0c0a8 100644 --- a/mpp/codec/enc/h265/h265e_api_v2.c +++ b/mpp/codec/enc/h265/h265e_api_v2.c @@ -71,6 +71,7 @@ static MPP_RET h265e_init(void *ctx, EncImplCfg *ctrlCfg) h265->min_qp = 10; h265->max_i_qp = 51; h265->min_i_qp = 10; + h265->qpmap_mode = 1; h265->ip_qp_delta = 3; h265->raw_dealt_qp = 2; h265->max_delta_qp = 10; @@ -270,6 +271,7 @@ static MPP_RET h265e_start(void *ctx, HalEncTask *task) p->rc_ready = 1; rc->change = 0; + ref->change = 0; } if (codec->change) { @@ -303,7 +305,8 @@ static MPP_RET h265e_start(void *ctx, HalEncTask *task) * input and output frame rate. */ - task->valid = !rc_frm_check_drop(p->rc_ctx); + if (p->rc_ctx) + task->valid = !rc_frm_check_drop(p->rc_ctx); if (!task->valid) mpp_log_f("drop one frame\n"); @@ -501,20 +504,17 @@ static MPP_RET h265e_proc_cfg(void *ctx, MpiCmd cmd, void *param) h265e_get_extra_info(p, pkt_out); } break; case MPP_ENC_SET_PREP_CFG : { - MppEncPrepCfg *src = &p->set->prep; + MppEncPrepCfg *src = (MppEncPrepCfg *)param; MppEncPrepCfg *dst = &p->cfg->prep; - memcpy(src, param, sizeof(MppEncPrepCfg)); memcpy(dst, src, sizeof(MppEncPrepCfg)); } break; case MPP_ENC_SET_CODEC_CFG: { MppEncCodecCfg *cfg = (MppEncCodecCfg *)param; - MppEncH265Cfg *src = &p->set->codec.h265; + MppEncH265Cfg *src = &cfg->h265; MppEncH265Cfg *dst = &p->cfg->codec.h265; RK_U32 change = cfg->h265.change; - memcpy(src, &cfg->h265, sizeof(MppEncH265Cfg)); - // TODO: do codec check first if (change & MPP_ENC_H265_CFG_PROFILE_LEVEL_TILER_CHANGE) { dst->profile = src->profile; @@ -558,7 +558,6 @@ static MPP_RET h265e_proc_cfg(void *ctx, MpiCmd cmd, void *param) * When next encoding is trigger the change flag will be clear */ dst->change |= change; - src->change = 0; } break; case MPP_ENC_SET_RC_CFG : { MppEncRcCfg *src = (MppEncRcCfg *)param; @@ -637,6 +636,12 @@ static MPP_RET h265e_proc_cfg(void *ctx, MpiCmd cmd, void *param) } break; + case MPP_ENC_SET_GOPREF: { + MppEncGopRef *ref = (MppEncGopRef *)param; + MppEncCfgSet *cfg = p->cfg; + memcpy(&cfg->gop_ref, ref , sizeof(*ref)); + } break; + default: mpp_err("No correspond %08x found, and can not config!\n", cmd); ret = MPP_NOK; diff --git a/mpp/codec/enc/h265/h265e_dpb.c b/mpp/codec/enc/h265/h265e_dpb.c index b782234f..a5553c73 100644 --- a/mpp/codec/enc/h265/h265e_dpb.c +++ b/mpp/codec/enc/h265/h265e_dpb.c @@ -221,6 +221,8 @@ MPP_RET h265e_dpb_set_cfg(H265eDpbCfg *dpb_cfg, MppEncCfgSet* cfg) RK_S32 i = 0; RK_S32 st_gop_len = ref->ref_gop_len; + dpb_cfg->nLongTerm = 1; + dpb_cfg->vgop_size = st_gop_len; for (i = 0; i < st_gop_len + 1; i++) { MppGopRefInfo *info = &ref->gop_info[i]; RK_S32 is_non_ref = info->is_non_ref; diff --git a/mpp/codec/enc/h265/h265e_ps.c b/mpp/codec/enc/h265/h265e_ps.c index c7f6b472..7f92259f 100644 --- a/mpp/codec/enc/h265/h265e_ps.c +++ b/mpp/codec/enc/h265/h265e_ps.c @@ -194,9 +194,13 @@ MPP_RET h265e_set_sps(H265eCtx *ctx, H265eSps *sps, H265eVps *vps) sps->m_useStrongIntraSmoothing = codec->cu_cfg.strong_intra_smoothing_enabled_flag; if (codec->ref_cfg.num_lt_ref_pic > 0 || ctx->dpbcfg.nLongTerm) { h265e_dbg_ps("ctx->dpbcfg.nLongTerm = %d", ctx->dpbcfg.nLongTerm); + if (codec->ref_cfg.num_lt_ref_pic == 0) { + codec->ref_cfg.num_lt_ref_pic = 1; + } sps->m_numLongTermRefPicSPS = codec->ref_cfg.num_lt_ref_pic; sps->m_bLongTermRefsPresent = 1; sps->m_TMVPFlagsPresent = 0; + codec->tmvp_enable = 0; } sps->m_ptl = &vps->m_ptl;