mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-12-26 11:17:44 +01:00
[hal_h264e_vepu1/2]: Add stream amend to hal flow
Change-Id: Ic92959a922983e2e251b03dbc58bf91ab67f9050 Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
This commit is contained in:
parent
197bda000f
commit
23d3e82c0c
2 changed files with 32 additions and 16 deletions
|
|
@ -65,9 +65,7 @@ typedef struct HalH264eVepu1Ctx_t {
|
|||
H264eMarkingInfo *marking;
|
||||
|
||||
/* special TSVC stream header fixup */
|
||||
size_t buf_size;
|
||||
RK_U8 *src_buf;
|
||||
RK_U8 *dst_buf;
|
||||
HalH264eVepuStreamAmend amend;
|
||||
|
||||
/* vepu1 macroblock ratecontrol context */
|
||||
HalH264eVepuMbRcCtx rc_ctx;
|
||||
|
|
@ -94,8 +92,7 @@ static MPP_RET hal_h264e_vepu1_deinit_v2(void *hal)
|
|||
p->rc_ctx = NULL;
|
||||
}
|
||||
|
||||
MPP_FREE(p->src_buf);
|
||||
MPP_FREE(p->dst_buf);
|
||||
h264e_vepu_stream_amend_deinit(&p->amend);
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", p);
|
||||
|
||||
|
|
@ -136,9 +133,7 @@ static MPP_RET hal_h264e_vepu1_init_v2(void *hal, MppEncHalCfg *cfg)
|
|||
}
|
||||
|
||||
/* create buffer to TSVC stream */
|
||||
p->buf_size = SZ_128K;
|
||||
p->src_buf = mpp_calloc(RK_U8, p->buf_size);
|
||||
p->dst_buf = mpp_calloc(RK_U8, p->buf_size);
|
||||
h264e_vepu_stream_amend_init(&p->amend);
|
||||
|
||||
DONE:
|
||||
if (ret)
|
||||
|
|
@ -230,6 +225,9 @@ static MPP_RET hal_h264e_vepu1_get_task_v2(void *hal, HalEncTask *task)
|
|||
hw_addr->recn[1] = hw_addr->recn[0] + (yuv_size << 10);
|
||||
hw_addr->refr[1] = hw_addr->refr[0] + (yuv_size << 10);
|
||||
|
||||
h264e_vepu_stream_amend_config(&ctx->amend, task->packet, ctx->cfg,
|
||||
ctx->slice, &task->rc_task->frm);
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", hal);
|
||||
|
||||
return MPP_OK;
|
||||
|
|
@ -625,6 +623,16 @@ static MPP_RET hal_h264e_vepu1_wait_v2(void *hal, HalEncTask *task)
|
|||
|
||||
h264e_vepu1_get_mbrc(hw_mbrc, &ctx->regs_get);
|
||||
h264e_vepu_mbrc_update(ctx->rc_ctx, hw_mbrc);
|
||||
|
||||
{
|
||||
HalH264eVepuStreamAmend *amend = &ctx->amend;
|
||||
if (amend->enable) {
|
||||
amend->old_length = hw_mbrc->out_strm_size;
|
||||
h264e_vepu_stream_amend_proc(amend);
|
||||
ctx->hw_mbrc.out_strm_size = amend->new_length;
|
||||
}
|
||||
}
|
||||
|
||||
task->hw_length += ctx->hw_mbrc.out_strm_size;
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", hal);
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ typedef struct HalH264eVepu2Ctx_t {
|
|||
H264eMarkingInfo *marking;
|
||||
|
||||
/* special TSVC stream header fixup */
|
||||
size_t buf_size;
|
||||
RK_U8 *src_buf;
|
||||
RK_U8 *dst_buf;
|
||||
HalH264eVepuStreamAmend amend;
|
||||
|
||||
/* vepu2 macroblock ratecontrol context */
|
||||
HalH264eVepuMbRcCtx rc_ctx;
|
||||
|
|
@ -94,8 +92,7 @@ static MPP_RET hal_h264e_vepu2_deinit_v2(void *hal)
|
|||
p->rc_ctx = NULL;
|
||||
}
|
||||
|
||||
MPP_FREE(p->src_buf);
|
||||
MPP_FREE(p->dst_buf);
|
||||
h264e_vepu_stream_amend_deinit(&p->amend);
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", p);
|
||||
|
||||
|
|
@ -136,9 +133,7 @@ static MPP_RET hal_h264e_vepu2_init_v2(void *hal, MppEncHalCfg *cfg)
|
|||
}
|
||||
|
||||
/* create buffer to TSVC stream */
|
||||
p->buf_size = SZ_128K;
|
||||
p->src_buf = mpp_calloc(RK_U8, p->buf_size);
|
||||
p->dst_buf = mpp_calloc(RK_U8, p->buf_size);
|
||||
h264e_vepu_stream_amend_init(&p->amend);
|
||||
|
||||
DONE:
|
||||
if (ret)
|
||||
|
|
@ -230,6 +225,9 @@ static MPP_RET hal_h264e_vepu2_get_task_v2(void *hal, HalEncTask *task)
|
|||
hw_addr->recn[1] = hw_addr->recn[0] + (yuv_size << 10);
|
||||
hw_addr->refr[1] = hw_addr->refr[0] + (yuv_size << 10);
|
||||
|
||||
h264e_vepu_stream_amend_config(&ctx->amend, task->packet, ctx->cfg,
|
||||
ctx->slice, &task->rc_task->frm);
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", hal);
|
||||
|
||||
return MPP_OK;
|
||||
|
|
@ -652,6 +650,16 @@ static MPP_RET hal_h264e_vepu2_wait_v2(void *hal, HalEncTask *task)
|
|||
|
||||
h264e_vepu2_get_mbrc(hw_mbrc, &ctx->regs_get);
|
||||
h264e_vepu_mbrc_update(ctx->rc_ctx, hw_mbrc);
|
||||
|
||||
{
|
||||
HalH264eVepuStreamAmend *amend = &ctx->amend;
|
||||
if (amend->enable) {
|
||||
amend->old_length = hw_mbrc->out_strm_size;
|
||||
h264e_vepu_stream_amend_proc(amend);
|
||||
ctx->hw_mbrc.out_strm_size = amend->new_length;
|
||||
}
|
||||
}
|
||||
|
||||
task->hw_length += ctx->hw_mbrc.out_strm_size;
|
||||
|
||||
hal_h264e_dbg_func("leave %p\n", hal);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue