diff --git a/test/mpi_dec_mt_test.c b/test/mpi_dec_mt_test.c index 22f061a4..c4c25944 100644 --- a/test/mpi_dec_mt_test.c +++ b/test/mpi_dec_mt_test.c @@ -49,7 +49,6 @@ typedef struct { size_t packet_size; MppFrame frame; - FILE *fp_input; FILE *fp_output; RK_S32 frame_count; RK_S32 frame_num; @@ -71,7 +70,6 @@ void *thread_input(void *arg) mpp_log_q(quiet, "put packet thread start\n"); do { - RK_U32 pkt_done = 0; RK_U32 pkt_eos = 0; FileBufSlot *slot = NULL; MPP_RET ret = reader_read(reader, &slot); @@ -100,13 +98,13 @@ void *thread_input(void *arg) do { ret = mpi->decode_put_packet(ctx, packet); if (MPP_OK == ret) { - pkt_done = 1; mpp_assert(0 == mpp_packet_get_length(packet)); - } else { - // if failed wait a moment and retry - msleep(5); + break; + } - } while (!pkt_done && !data->loop_end); + // if failed wait a moment and retry + msleep(1); + } while (!data->loop_end); if (pkt_eos) break; @@ -123,7 +121,6 @@ void *thread_output(void *arg) MpiDecTestCmd *cmd = data->cmd; MppCtx ctx = data->ctx; MppApi *mpi = data->mpi; - MppFrame frame = NULL; RK_U32 quiet = data->quiet; mpp_log_q(quiet, "get frame thread start\n"); @@ -131,115 +128,105 @@ void *thread_output(void *arg) // then get all available frame and release do { RK_U32 frm_eos = 0; - RK_S32 times = 5; - MPP_RET ret = MPP_OK; + MppFrame frame = NULL; + MPP_RET ret = mpi->decode_get_frame(ctx, &frame); - GET_AGAIN: - ret = mpi->decode_get_frame(ctx, &frame); - if (MPP_ERR_TIMEOUT == ret) { - if (times > 0) { - times--; - msleep(2); - goto GET_AGAIN; - } - mpp_err("decode_get_frame failed too much time\n"); - } if (ret) { mpp_err("decode_get_frame failed ret %d\n", ret); continue; } - if (frame) { - if (mpp_frame_get_info_change(frame)) { - // found info change and create buffer group for decoding - RK_U32 width = mpp_frame_get_width(frame); - RK_U32 height = mpp_frame_get_height(frame); - RK_U32 hor_stride = mpp_frame_get_hor_stride(frame); - RK_U32 ver_stride = mpp_frame_get_ver_stride(frame); - RK_U32 buf_size = mpp_frame_get_buf_size(frame); + if (NULL == frame) { + msleep(1); + continue; + } - mpp_log_q(quiet, "decode_get_frame get info changed found\n"); - mpp_log_q(quiet, "decoder require buffer w:h [%d:%d] stride [%d:%d] size %d\n", - width, height, hor_stride, ver_stride, buf_size); + if (mpp_frame_get_info_change(frame)) { + // found info change and create buffer group for decoding + RK_U32 width = mpp_frame_get_width(frame); + RK_U32 height = mpp_frame_get_height(frame); + RK_U32 hor_stride = mpp_frame_get_hor_stride(frame); + RK_U32 ver_stride = mpp_frame_get_ver_stride(frame); + RK_U32 buf_size = mpp_frame_get_buf_size(frame); - if (NULL == data->frm_grp) { - /* If buffer group is not set create one and limit it */ - ret = mpp_buffer_group_get_internal(&data->frm_grp, MPP_BUFFER_TYPE_ION); - if (ret) { - mpp_err("get mpp buffer group failed ret %d\n", ret); - break; - } + mpp_log_q(quiet, "decode_get_frame get info changed found\n"); + mpp_log_q(quiet, "decoder require buffer w:h [%d:%d] stride [%d:%d] size %d\n", + width, height, hor_stride, ver_stride, buf_size); - /* Set buffer to mpp decoder */ - ret = mpi->control(ctx, MPP_DEC_SET_EXT_BUF_GROUP, data->frm_grp); - if (ret) { - mpp_err("set buffer group failed ret %d\n", ret); - break; - } - } else { - /* If old buffer group exist clear it */ - ret = mpp_buffer_group_clear(data->frm_grp); - if (ret) { - mpp_err("clear buffer group failed ret %d\n", ret); - break; - } - } - - /* Use limit config to limit buffer count to 24 */ - ret = mpp_buffer_group_limit_config(data->frm_grp, buf_size, 24); + if (NULL == data->frm_grp) { + /* If buffer group is not set create one and limit it */ + ret = mpp_buffer_group_get_internal(&data->frm_grp, MPP_BUFFER_TYPE_ION); if (ret) { - mpp_err("limit buffer group failed ret %d\n", ret); + mpp_err("get mpp buffer group failed ret %d\n", ret); break; } - ret = mpi->control(ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL); + /* Set buffer to mpp decoder */ + ret = mpi->control(ctx, MPP_DEC_SET_EXT_BUF_GROUP, data->frm_grp); if (ret) { - mpp_err("info change ready failed ret %d\n", ret); + mpp_err("set buffer group failed ret %d\n", ret); break; } } else { - char log_buf[256]; - RK_S32 log_size = sizeof(log_buf) - 1; - RK_S32 log_len = 0; - RK_U32 err_info = mpp_frame_get_errinfo(frame); - RK_U32 discard = mpp_frame_get_discard(frame); - - log_len += snprintf(log_buf + log_len, log_size - log_len, - "decode get frame %d", data->frame_count); - - if (mpp_frame_has_meta(frame)) { - MppMeta meta = mpp_frame_get_meta(frame); - RK_S32 temporal_id = 0; - - mpp_meta_get_s32(meta, KEY_TEMPORAL_ID, &temporal_id); - - log_len += snprintf(log_buf + log_len, log_size - log_len, - " tid %d", temporal_id); + /* If old buffer group exist clear it */ + ret = mpp_buffer_group_clear(data->frm_grp); + if (ret) { + mpp_err("clear buffer group failed ret %d\n", ret); + break; } - - if (err_info || discard) { - log_len += snprintf(log_buf + log_len, log_size - log_len, - " err %x discard %x", err_info, discard); - } - mpp_log_q(quiet, "%p %s\n", ctx, log_buf); - - data->frame_count++; - if (data->fp_output && !err_info) - dump_mpp_frame_to_file(frame, data->fp_output); - - fps_calc_inc(cmd->fps); } - frm_eos = mpp_frame_get_eos(frame); - mpp_frame_deinit(&frame); - frame = NULL; - - if ((data->frame_num > 0 && (data->frame_count >= data->frame_num)) || - ((data->frame_num == 0) && frm_eos)) { - data->loop_end = 1; + /* Use limit config to limit buffer count to 24 */ + ret = mpp_buffer_group_limit_config(data->frm_grp, buf_size, 24); + if (ret) { + mpp_err("limit buffer group failed ret %d\n", ret); break; } + + ret = mpi->control(ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL); + if (ret) { + mpp_err("info change ready failed ret %d\n", ret); + break; + } + } else { + char log_buf[256]; + RK_S32 log_size = sizeof(log_buf) - 1; + RK_S32 log_len = 0; + RK_U32 err_info = mpp_frame_get_errinfo(frame); + RK_U32 discard = mpp_frame_get_discard(frame); + + log_len += snprintf(log_buf + log_len, log_size - log_len, + "decode get frame %d", data->frame_count); + + if (mpp_frame_has_meta(frame)) { + MppMeta meta = mpp_frame_get_meta(frame); + RK_S32 temporal_id = 0; + + mpp_meta_get_s32(meta, KEY_TEMPORAL_ID, &temporal_id); + + log_len += snprintf(log_buf + log_len, log_size - log_len, + " tid %d", temporal_id); + } + + if (err_info || discard) { + log_len += snprintf(log_buf + log_len, log_size - log_len, + " err %x discard %x", err_info, discard); + } + mpp_log_q(quiet, "%p %s\n", ctx, log_buf); + + data->frame_count++; + if (data->fp_output && !err_info) + dump_mpp_frame_to_file(frame, data->fp_output); + + fps_calc_inc(cmd->fps); } + + frm_eos = mpp_frame_get_eos(frame); + mpp_frame_deinit(&frame); + + if ((data->frame_num > 0 && (data->frame_count >= data->frame_num)) || + ((data->frame_num == 0) && frm_eos)) + data->loop_end = 1; } while (!data->loop_end); mpp_log_q(quiet, "get frame thread end\n"); @@ -260,25 +247,21 @@ int mt_dec_decode(MpiDecTestCmd *cmd) MppPacket packet = NULL; MppFrame frame = NULL; - MpiCmd mpi_cmd = MPP_CMD_BASE; - MppParam param = NULL; + // config for runtime mode + MppDecCfg cfg = NULL; RK_U32 need_split = 1; - MppPollType timeout = cmd->timeout; // paramter for resource malloc RK_U32 width = cmd->width; RK_U32 height = cmd->height; MppCodingType type = cmd->type; - // resources - size_t packet_size = MPI_DEC_STREAM_SIZE; - pthread_t thd_in; pthread_t thd_out; pthread_attr_t attr; MpiDecMtLoopData data; - mpp_log("mpi_dec_test start\n"); + mpp_log("mpi_dec_mt_test start\n"); memset(&data, 0, sizeof(data)); if (cmd->have_output) { @@ -295,7 +278,7 @@ int mt_dec_decode(MpiDecTestCmd *cmd) goto MPP_TEST_OUT; } - mpp_log("mpi_dec_test decoder test start w %d h %d type %d\n", width, height, type); + mpp_log("mpi_dec_mt_test decoder test start w %d h %d type %d\n", width, height, type); // decoder demo ret = mpp_create(&ctx, &mpi); @@ -304,12 +287,9 @@ int mt_dec_decode(MpiDecTestCmd *cmd) goto MPP_TEST_OUT; } - // NOTE: decoder split mode need to be set before init - mpi_cmd = MPP_DEC_SET_PARSER_SPLIT_MODE; - param = &need_split; - ret = mpi->control(ctx, mpi_cmd, param); + ret = mpp_init(ctx, MPP_CTX_DEC, type); if (ret) { - mpp_err("mpi->control failed\n"); + mpp_err("mpp_init failed\n"); goto MPP_TEST_OUT; } @@ -317,8 +297,10 @@ int mt_dec_decode(MpiDecTestCmd *cmd) // 0 - non-block call (default) // -1 - block call // +val - timeout value in ms - if (timeout) { - param = &timeout; + { + MppPollType timeout = MPP_POLL_BLOCK; + MppParam param = &timeout; + ret = mpi->control(ctx, MPP_SET_OUTPUT_TIMEOUT, param); if (ret) { mpp_err("Failed to set output timeout %d ret %d\n", timeout, ret); @@ -326,9 +308,28 @@ int mt_dec_decode(MpiDecTestCmd *cmd) } } - ret = mpp_init(ctx, MPP_CTX_DEC, type); + mpp_dec_cfg_init(&cfg); + + /* get default config from decoder context */ + ret = mpi->control(ctx, MPP_DEC_GET_CFG, cfg); if (ret) { - mpp_err("mpp_init failed\n"); + mpp_err("%p failed to get decoder cfg ret %d\n", ctx, ret); + goto MPP_TEST_OUT; + } + + /* + * split_parse is to enable mpp internal frame spliter when the input + * packet is not aplited into frames. + */ + ret = mpp_dec_cfg_set_u32(cfg, "base:split_parse", need_split); + if (ret) { + mpp_err("%p failed to set split_parse ret %d\n", ctx, ret); + goto MPP_TEST_OUT; + } + + ret = mpi->control(ctx, MPP_DEC_SET_CFG, cfg); + if (ret) { + mpp_err("%p failed to set cfg %p ret %d\n", ctx, cfg, ret); goto MPP_TEST_OUT; } @@ -337,7 +338,6 @@ int mt_dec_decode(MpiDecTestCmd *cmd) data.mpi = mpi; data.loop_end = 0; data.packet = packet; - data.packet_size = packet_size; data.frame = frame; data.frame_count = 0; data.frame_num = cmd->frame_num; @@ -407,9 +407,9 @@ MPP_TEST_OUT: data.fp_output = NULL; } - if (data.fp_input) { - fclose(data.fp_input); - data.fp_input = NULL; + if (cfg) { + mpp_dec_cfg_deinit(cfg); + cfg = NULL; } return ret; diff --git a/test/mpi_dec_multi_test.c b/test/mpi_dec_multi_test.c index 8ec06151..fa593e63 100644 --- a/test/mpi_dec_multi_test.c +++ b/test/mpi_dec_multi_test.c @@ -46,15 +46,13 @@ typedef struct { MppPacket packet; MppFrame frame; - FILE *fp_input; FILE *fp_output; RK_S32 packet_count; RK_S32 frame_count; + RK_S32 frame_num; RK_S64 first_pkt; RK_S64 first_frm; - RK_S32 frame_num; - FileReader reader; /* runtime flag */ RK_U32 quiet; @@ -81,15 +79,11 @@ static int multi_dec_simple(MpiDecMultiCtx *data) MpiDecTestCmd *cmd = data->cmd; RK_U32 pkt_done = 0; RK_U32 pkt_eos = 0; - RK_U32 err_info = 0; MppCtx ctx = data->ctx; MppApi *mpi = data->mpi; - char *buf = NULL; MppPacket packet = data->packet; - MppFrame frame = NULL; - FileReader reader = data->reader; + FileReader reader = cmd->reader; FileBufSlot *slot = NULL; - size_t read_size = 0; RK_U32 quiet = data->quiet; MPP_RET ret = reader_index_read(reader, data->packet_count++, &slot); @@ -97,8 +91,6 @@ static int multi_dec_simple(MpiDecMultiCtx *data) mpp_assert(slot); pkt_eos = slot->eos; - buf = slot->data; - read_size = slot->size; if (pkt_eos) { if (data->frame_num < 0 || data->frame_num > data->frame_count) { @@ -111,11 +103,10 @@ static int multi_dec_simple(MpiDecMultiCtx *data) } } - mpp_packet_set_data(packet, buf); - if (read_size > mpp_packet_get_size(packet)) - mpp_packet_set_size(packet, read_size); - mpp_packet_set_pos(packet, buf); - mpp_packet_set_length(packet, read_size); + mpp_packet_set_data(packet, slot->data); + mpp_packet_set_size(packet, slot->size); + mpp_packet_set_pos(packet, slot->data); + mpp_packet_set_length(packet, slot->size); // setup eos flag if (pkt_eos) mpp_packet_set_eos(packet); @@ -136,6 +127,7 @@ static int multi_dec_simple(MpiDecMultiCtx *data) // then get all available frame and release do { RK_S32 get_frm = 0; + MppFrame frame = NULL; try_again: ret = mpi->decode_get_frame(ctx, &frame); @@ -204,6 +196,8 @@ static int multi_dec_simple(MpiDecMultiCtx *data) break; } } else { + RK_U32 err_info = 0; + if (!data->first_frm) data->first_frm = mpp_time(); @@ -225,7 +219,6 @@ static int multi_dec_simple(MpiDecMultiCtx *data) } frm_eos = mpp_frame_get_eos(frame); mpp_frame_deinit(&frame); - frame = NULL; get_frm = 1; } @@ -311,6 +304,9 @@ static int multi_dec_advanced(MpiDecMultiCtx *data) return ret; } + if (!data->first_pkt) + data->first_pkt = mpp_time(); + /* poll and wait here */ ret = mpi->poll(ctx, MPP_PORT_OUTPUT, MPP_POLL_BLOCK); if (ret) { @@ -332,6 +328,9 @@ static int multi_dec_advanced(MpiDecMultiCtx *data) mpp_task_meta_get_frame(task, KEY_OUTPUT_FRAME, &frame_out); if (frame) { + if (!data->first_frm) + data->first_frm = mpp_time(); + if (data->fp_output) dump_mpp_frame_to_file(frame, data->fp_output); @@ -399,7 +398,6 @@ void* multi_dec_decode(void *cmd_ctx) MpiDecMultiCtx *dec_ctx = &info->ctx; MpiDecMultiCtxRet *rets = &info->ret; MpiDecTestCmd *cmd = info->cmd; - FileReader reader = cmd->reader; MPP_RET ret = MPP_OK; // base flow context @@ -410,10 +408,9 @@ void* multi_dec_decode(void *cmd_ctx) MppPacket packet = NULL; MppFrame frame = NULL; - MpiCmd mpi_cmd = MPP_CMD_BASE; - MppParam param = NULL; + // config for runtime mode + MppDecCfg cfg = NULL; RK_U32 need_split = 1; - MppPollType timeout = cmd->timeout; // paramter for resource malloc RK_U32 width = cmd->width; @@ -479,34 +476,37 @@ void* multi_dec_decode(void *cmd_ctx) mpp_log("%p mpi_dec_test decoder test start w %d h %d type %d\n", ctx, width, height, type); - // NOTE: decoder split mode need to be set before init - mpi_cmd = MPP_DEC_SET_PARSER_SPLIT_MODE; - param = &need_split; - ret = mpi->control(ctx, mpi_cmd, param); - if (ret) { - mpp_err("mpi->control failed\n"); - goto MPP_TEST_OUT; - } - - // NOTE: timeout value please refer to MppPollType definition - // 0 - non-block call (default) - // -1 - block call - // +val - timeout value in ms - if (timeout) { - param = &timeout; - ret = mpi->control(ctx, MPP_SET_OUTPUT_TIMEOUT, param); - if (ret) { - mpp_err("Failed to set output timeout %d ret %d\n", timeout, ret); - goto MPP_TEST_OUT; - } - } - ret = mpp_init(ctx, MPP_CTX_DEC, type); if (ret) { mpp_err("mpp_init failed\n"); goto MPP_TEST_OUT; } + mpp_dec_cfg_init(&cfg); + + /* get default config from decoder context */ + ret = mpi->control(ctx, MPP_DEC_GET_CFG, cfg); + if (ret) { + mpp_err("%p failed to get decoder cfg ret %d\n", ctx, ret); + goto MPP_TEST_OUT; + } + + /* + * split_parse is to enable mpp internal frame spliter when the input + * packet is not aplited into frames. + */ + ret = mpp_dec_cfg_set_u32(cfg, "base:split_parse", need_split); + if (ret) { + mpp_err("%p failed to set split_parse ret %d\n", ctx, ret); + goto MPP_TEST_OUT; + } + + ret = mpi->control(ctx, MPP_DEC_SET_CFG, cfg); + if (ret) { + mpp_err("%p failed to set cfg %p ret %d\n", ctx, cfg, ret); + goto MPP_TEST_OUT; + } + dec_ctx->cmd = cmd; dec_ctx->ctx = ctx; dec_ctx->mpi = mpi; @@ -515,7 +515,6 @@ void* multi_dec_decode(void *cmd_ctx) dec_ctx->packet_count = 0; dec_ctx->frame_count = 0; dec_ctx->frame_num = cmd->frame_num; - dec_ctx->reader = reader; dec_ctx->quiet = cmd->quiet; RK_S64 t_s, t_e; @@ -574,9 +573,9 @@ MPP_TEST_OUT: dec_ctx->fp_output = NULL; } - if (dec_ctx->fp_input) { - fclose(dec_ctx->fp_input); - dec_ctx->fp_input = NULL; + if (cfg) { + mpp_dec_cfg_deinit(cfg); + cfg = NULL; } return NULL; diff --git a/test/mpi_dec_test.c b/test/mpi_dec_test.c index 11569f07..571e2f8a 100644 --- a/test/mpi_dec_test.c +++ b/test/mpi_dec_test.c @@ -44,11 +44,17 @@ typedef struct { MppPacket packet; MppFrame frame; - FILE *fp_input; FILE *fp_output; RK_S32 frame_count; RK_S32 frame_num; + + RK_S64 first_pkt; + RK_S64 first_frm; + size_t max_usage; + float frame_rate; + RK_S64 elapsed_time; + RK_S64 delay; } MpiDecLoopData; static int dec_simple(MpiDecLoopData *data) @@ -60,7 +66,6 @@ static int dec_simple(MpiDecLoopData *data) MppCtx ctx = data->ctx; MppApi *mpi = data->mpi; MppPacket packet = data->packet; - MppFrame frame = NULL; FileBufSlot *slot = NULL; RK_U32 quiet = data->quiet; @@ -93,24 +98,29 @@ static int dec_simple(MpiDecLoopData *data) do { RK_U32 frm_eos = 0; - RK_S32 times = 5; + RK_S32 times = 30; + // send the packet first if packet is not done if (!pkt_done) { ret = mpi->decode_put_packet(ctx, packet); - if (MPP_OK == ret) + if (MPP_OK == ret) { pkt_done = 1; + if (!data->first_pkt) + data->first_pkt = mpp_time(); + } } // then get all available frame and release do { RK_S32 get_frm = 0; + MppFrame frame = NULL; try_again: ret = mpi->decode_get_frame(ctx, &frame); if (MPP_ERR_TIMEOUT == ret) { if (times > 0) { times--; - msleep(2); + msleep(1); goto try_again; } mpp_err("%p decode_get_frame failed too much time\n", ctx); @@ -238,6 +248,9 @@ static int dec_simple(MpiDecLoopData *data) RK_U32 err_info = mpp_frame_get_errinfo(frame); RK_U32 discard = mpp_frame_get_discard(frame); + if (!data->first_frm) + data->first_frm = mpp_time(); + log_len += snprintf(log_buf + log_len, log_size - log_len, "decode get frame %d", data->frame_count); @@ -265,7 +278,6 @@ static int dec_simple(MpiDecLoopData *data) } frm_eos = mpp_frame_get_eos(frame); mpp_frame_deinit(&frame); - frame = NULL; get_frm = 1; } @@ -278,7 +290,7 @@ static int dec_simple(MpiDecLoopData *data) // if last packet is send but last frame is not found continue if (pkt_eos && pkt_done && !frm_eos) { - msleep(10); + msleep(1); continue; } @@ -309,10 +321,10 @@ static int dec_simple(MpiDecLoopData *data) * why sleep here: * mpi->decode_put_packet will failed when packet in internal queue is * full,waiting the package is consumed .Usually hardware decode one - * frame which resolution is 1080p needs 2 ms,so here we sleep 3ms + * frame which resolution is 1080p needs 2 ms,so here we sleep 1ms * * is enough. */ - msleep(3); + msleep(1); } while (1); return ret; @@ -363,6 +375,9 @@ static int dec_advanced(MpiDecLoopData *data) return ret; } + if (!data->first_pkt) + data->first_pkt = mpp_time(); + /* poll and wait here */ ret = mpi->poll(ctx, MPP_PORT_OUTPUT, MPP_POLL_BLOCK); if (ret) { @@ -384,6 +399,9 @@ static int dec_advanced(MpiDecLoopData *data) mpp_task_meta_get_frame(task, KEY_OUTPUT_FRAME, &frame_out); if (frame) { + if (!data->first_frm) + data->first_frm = mpp_time(); + /* write frame to file here */ if (data->fp_output) dump_mpp_frame_to_file(frame, data->fp_output); @@ -452,6 +470,9 @@ void *thread_decode(void *arg) MpiDecTestCmd *cmd = data->cmd; MppCtx ctx = data->ctx; MppApi *mpi = data->mpi; + RK_S64 t_s, t_e; + + t_s = mpp_time(); if (cmd->simple) { while (!data->loop_end) @@ -470,6 +491,16 @@ void *thread_decode(void *arg) dec_advanced(data); } + t_e = mpp_time(); + data->elapsed_time = t_e - t_s; + data->frame_count = data->frame_count; + data->frame_rate = (float)data->frame_count * 1000000 / data->elapsed_time; + data->delay = data->first_frm - data->first_pkt; + + mpp_log("decode %d frames time %lld ms delay %3d ms fps %3.2f\n", + data->frame_count, (RK_S64)(data->elapsed_time / 1000), + (RK_S32)(data->delay / 1000), data->frame_rate); + return NULL; } @@ -483,11 +514,6 @@ int dec_decode(MpiDecTestCmd *cmd) MppPacket packet = NULL; MppFrame frame = NULL; - MpiCmd mpi_cmd = MPP_CMD_BASE; - MppParam param = NULL; - RK_U32 need_split = 1; - MppPollType timeout = cmd->timeout; - // paramter for resource malloc RK_U32 width = cmd->width; RK_U32 height = cmd->height; @@ -495,6 +521,7 @@ int dec_decode(MpiDecTestCmd *cmd) // config for runtime mode MppDecCfg cfg = NULL; + RK_U32 need_split = 1; // resources MppBuffer frm_buf = NULL; @@ -565,29 +592,6 @@ int dec_decode(MpiDecTestCmd *cmd) mpp_log("%p mpi_dec_test decoder test start w %d h %d type %d\n", ctx, width, height, type); - // NOTE: decoder split mode need to be set before init - mpi_cmd = MPP_DEC_SET_PARSER_SPLIT_MODE; - param = &need_split; - ret = mpi->control(ctx, mpi_cmd, param); - if (ret) { - mpp_err("%p mpi->control failed\n", ctx); - goto MPP_TEST_OUT; - } - - // NOTE: timeout value please refer to MppPollType definition - // 0 - non-block call (default) - // -1 - block call - // +val - timeout value in ms - if (timeout) { - param = &timeout; - ret = mpi->control(ctx, MPP_SET_OUTPUT_TIMEOUT, param); - if (ret) { - mpp_err("%p failed to set output timeout %d ret %d\n", - ctx, timeout, ret); - goto MPP_TEST_OUT; - } - } - ret = mpp_init(ctx, MPP_CTX_DEC, type); if (ret) { mpp_err("%p mpp_init failed\n", ctx); @@ -650,25 +654,6 @@ int dec_decode(MpiDecTestCmd *cmd) pthread_join(thd, NULL); cmd->max_usage = data.max_usage; - { - MppDecQueryCfg query; - - memset(&query, 0, sizeof(query)); - query.query_flag = MPP_DEC_QUERY_ALL; - ret = mpi->control(ctx, MPP_DEC_QUERY, &query); - if (ret) { - mpp_err("%p mpi->control query failed\n", ctx); - goto MPP_TEST_OUT; - } - - /* - * NOTE: - * 1. Output frame count included info change frame and empty eos frame. - * 2. Hardware run count is real decoded frame count. - */ - mpp_log("%p input %d pkt output %d frm decode %d frames\n", ctx, - query.dec_in_pkt_cnt, query.dec_out_frm_cnt, query.dec_hw_run_cnt); - } ret = mpi->reset(ctx); if (ret) { diff --git a/utils/mpi_dec_utils.c b/utils/mpi_dec_utils.c index 1fa14719..457ccceb 100644 --- a/utils/mpi_dec_utils.c +++ b/utils/mpi_dec_utils.c @@ -602,6 +602,9 @@ RK_S32 mpi_dec_test_cmd_deinit(MpiDecTestCmd* cmd) void mpi_dec_test_cmd_options(MpiDecTestCmd* cmd) { + if (cmd->quiet) + return; + mpp_log("cmd parse result:\n"); mpp_log("input file name: %s\n", cmd->file_input); mpp_log("output file name: %s\n", cmd->file_output);