[test]: Add delay calculation on performance test

Change-Id: Idc058e900c46ebce406ff0739d6e73e4e78b3cd8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2018-04-03 15:25:18 +08:00
parent 3b4c3eaf2f
commit 77f33cbcb4

View File

@@ -74,6 +74,9 @@ typedef struct {
FILE *fp_input; FILE *fp_input;
FILE *fp_output; FILE *fp_output;
RK_U32 frame_count; RK_U32 frame_count;
RK_S64 first_pkt;
RK_S64 first_frm;
} MpiDecCtx; } MpiDecCtx;
/* For each instance thread return value */ /* For each instance thread return value */
@@ -136,8 +139,11 @@ static int decode_simple(MpiDecCtx *data)
// send the packet first if packet is not done // send the packet first if packet is not done
if (!pkt_done) { if (!pkt_done) {
ret = mpi->decode_put_packet(ctx, packet); ret = mpi->decode_put_packet(ctx, packet);
if (MPP_OK == ret) if (MPP_OK == ret) {
pkt_done = 1; pkt_done = 1;
if (!data->first_pkt)
data->first_pkt = mpp_time();
}
} }
// then get all available frame and release // then get all available frame and release
@@ -181,6 +187,9 @@ static int decode_simple(MpiDecCtx *data)
mpi->control(ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL); mpi->control(ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL);
} else { } else {
if (!data->first_frm)
data->first_frm = mpp_time();
err_info = mpp_frame_get_errinfo(frame) | mpp_frame_get_discard(frame); err_info = mpp_frame_get_errinfo(frame) | mpp_frame_get_discard(frame);
if (err_info) { if (err_info) {
mpp_log("decoder_get_frame get err info:%d discard:%d.\n", mpp_log("decoder_get_frame get err info:%d discard:%d.\n",
@@ -755,7 +764,9 @@ int main(int argc, char **argv)
for (i = 0; i < cmd->nthreads; i++) { for (i = 0; i < cmd->nthreads; i++) {
total_rate += ctxs[i].ret.frame_rate; total_rate += ctxs[i].ret.frame_rate;
mpp_log("payload %d frame rate: %.2f\n", i, ctxs[i].ret.frame_rate); mpp_log("payload %d frame rate: %.2f first delay %d ms\n", i,
ctxs[i].ret.frame_rate,
(ctxs[i].ctx.first_frm - ctxs[i].ctx.first_pkt) / 1000);
} }
mpp_free(ctxs); mpp_free(ctxs);
ctxs = NULL; ctxs = NULL;