[mpi_enc_utils]: Add step config for slt test.

Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I95720c7ec22f952b318e6997a63a383b2542a018
This commit is contained in:
xueman.ruan 2023-03-02 17:54:52 +08:00 committed by Herman Chen
parent e168077ff5
commit a034b888c2
4 changed files with 30 additions and 6 deletions

View file

@ -47,6 +47,7 @@ typedef struct {
RK_S32 frame_num; RK_S32 frame_num;
RK_S32 frm_cnt_in; RK_S32 frm_cnt_in;
RK_S32 frm_cnt_out; RK_S32 frm_cnt_out;
RK_S32 frm_step;
RK_U64 stream_size; RK_U64 stream_size;
/* end of encoding flag when set quit the loop */ /* end of encoding flag when set quit the loop */
volatile RK_U32 loop_end; volatile RK_U32 loop_end;
@ -176,6 +177,8 @@ MPP_RET mt_test_ctx_init(MpiEncMtCtxInfo *info)
mpp_log("jpege default encode only one frame. Use -n [num] for rc case\n"); mpp_log("jpege default encode only one frame. Use -n [num] for rc case\n");
p->frame_num = 1; p->frame_num = 1;
} }
p->frm_step = cmd->frm_step;
p->gop_mode = cmd->gop_mode; p->gop_mode = cmd->gop_mode;
p->gop_len = cmd->gop_len; p->gop_len = cmd->gop_len;
p->vi_len = cmd->vi_len; p->vi_len = cmd->vi_len;
@ -721,9 +724,8 @@ void *enc_test_input(void *arg)
break; break;
} else { } else {
if (p->cam_ctx == NULL) { if (p->cam_ctx == NULL) {
ret = MPP_OK;
ret = fill_image((RK_U8 *)buf, p->width, p->height, p->hor_stride, ret = fill_image((RK_U8 *)buf, p->width, p->height, p->hor_stride,
p->ver_stride, p->fmt, p->frm_cnt_in); p->ver_stride, p->fmt, p->frm_cnt_in * p->frm_step);
if (ret) if (ret)
break; break;
} else { } else {

View file

@ -75,6 +75,8 @@ typedef struct {
RK_U32 frm_pkt_cnt; RK_U32 frm_pkt_cnt;
RK_S32 frame_num; RK_S32 frame_num;
RK_S32 frame_count; RK_S32 frame_count;
RK_S32 frm_step;
RK_U64 stream_size; RK_U64 stream_size;
/* end of encoding flag when set quit the loop */ /* end of encoding flag when set quit the loop */
volatile RK_U32 loop_end; volatile RK_U32 loop_end;
@ -284,6 +286,8 @@ MPP_RET test_ctx_init(MpiEncMultiCtxInfo *info)
mpp_log("jpege default encode only one frame. Use -n [num] for rc case\n"); mpp_log("jpege default encode only one frame. Use -n [num] for rc case\n");
p->frame_num = 1; p->frame_num = 1;
} }
p->frm_step = cmd->frm_step;
p->gop_mode = cmd->gop_mode; p->gop_mode = cmd->gop_mode;
p->gop_len = cmd->gop_len; p->gop_len = cmd->gop_len;
p->vi_len = cmd->vi_len; p->vi_len = cmd->vi_len;
@ -807,7 +811,7 @@ MPP_RET test_mpp_run(MpiEncMultiCtxInfo *info)
if (p->cam_ctx == NULL) { if (p->cam_ctx == NULL) {
mpp_buffer_sync_begin(p->frm_buf); mpp_buffer_sync_begin(p->frm_buf);
ret = fill_image(buf, p->width, p->height, p->hor_stride, ret = fill_image(buf, p->width, p->height, p->hor_stride,
p->ver_stride, p->fmt, p->frame_count); p->ver_stride, p->fmt, p->frame_count * p->frm_step);
if (ret) if (ret)
goto RET; goto RET;
mpp_buffer_sync_end(p->frm_buf); mpp_buffer_sync_end(p->frm_buf);

View file

@ -94,8 +94,10 @@ MpiEncTestArgs *mpi_enc_test_cmd_get(void)
{ {
MpiEncTestArgs *args = mpp_calloc(MpiEncTestArgs, 1); MpiEncTestArgs *args = mpp_calloc(MpiEncTestArgs, 1);
if (args) if (args) {
args->nthreads = 1; args->nthreads = 1;
args->frm_step = 1;
}
return args; return args;
} }
@ -475,6 +477,19 @@ RK_S32 mpi_enc_opt_slt(void *ctx, const char *next)
return 0; return 0;
} }
RK_S32 mpi_enc_opt_step(void *ctx, const char *next)
{
MpiEncTestArgs *cmd = (MpiEncTestArgs *)ctx;
if (next) {
cmd->frm_step = atoi(next);
return 1;
}
mpp_err("invalid input frame step\n");
return 0;
}
RK_S32 mpi_enc_opt_sm(void *ctx, const char *next) RK_S32 mpi_enc_opt_sm(void *ctx, const char *next)
{ {
MpiEncTestArgs *cmd = (MpiEncTestArgs *)ctx; MpiEncTestArgs *cmd = (MpiEncTestArgs *)ctx;
@ -745,6 +760,7 @@ static MppOptInfo enc_opts[] = {
{"l", "loop count", "loop encoding times for each frame", mpi_enc_opt_l}, {"l", "loop count", "loop encoding times for each frame", mpi_enc_opt_l},
{"ini", "ini file", "encoder extra ini config file", mpi_enc_opt_ini}, {"ini", "ini file", "encoder extra ini config file", mpi_enc_opt_ini},
{"slt", "slt file", "slt verify data file", mpi_enc_opt_slt}, {"slt", "slt file", "slt verify data file", mpi_enc_opt_slt},
{"step", "frame step", "frame step, only for NV12 in slt test", mpi_enc_opt_step},
{"sm", "scene mode", "scene_mode, 0:default 1:ipc", mpi_enc_opt_sm}, {"sm", "scene mode", "scene_mode, 0:default 1:ipc", mpi_enc_opt_sm},
{"qpdd", "cu_qp_delta_depth", "cu_qp_delta_depth, 0:1:2", mpi_enc_opt_qpdd}, {"qpdd", "cu_qp_delta_depth", "cu_qp_delta_depth, 0:1:2", mpi_enc_opt_qpdd},
{"dbe", "deblur enable", "deblur_en or qpmap_en, 0:close 1:open", mpi_enc_opt_dbe}, {"dbe", "deblur enable", "deblur_en or qpmap_en, 0:close 1:open", mpi_enc_opt_dbe},
@ -834,7 +850,6 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
cmd->rc_mode = MPP_ENC_RC_MODE_BUTT; cmd->rc_mode = MPP_ENC_RC_MODE_BUTT;
mpp_opt_init(&opts); mpp_opt_init(&opts);
/* should change node count when option increases */
mpp_opt_setup(opts, cmd); mpp_opt_setup(opts, cmd);
for (i = 0; i < enc_opt_cnt; i++) for (i = 0; i < enc_opt_cnt; i++)
@ -1262,8 +1277,10 @@ MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* cmd)
mpp_log("height : %d\n", cmd->height); mpp_log("height : %d\n", cmd->height);
mpp_log("format : %d\n", cmd->format); mpp_log("format : %d\n", cmd->format);
mpp_log("type : %d\n", cmd->type); mpp_log("type : %d\n", cmd->type);
if (cmd->file_slt) if (cmd->file_slt) {
mpp_log("verify : %s\n", cmd->file_slt); mpp_log("verify : %s\n", cmd->file_slt);
mpp_log("frame step : %d\n", cmd->frm_step);
}
return MPP_OK; return MPP_OK;
} }

View file

@ -34,6 +34,7 @@ typedef struct MpiEncTestArgs_t {
RK_S32 frame_num; RK_S32 frame_num;
RK_S32 loop_cnt; RK_S32 loop_cnt;
RK_S32 nthreads; RK_S32 nthreads;
RK_S32 frm_step;
RK_S32 width; RK_S32 width;
RK_S32 height; RK_S32 height;