From 7b86c1abe4e6145fb58897437270f110e34d6c70 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Tue, 19 Oct 2021 14:12:50 +0800 Subject: [PATCH] [mpi_dec_utils]: Add decoder frame rate print Change-Id: I46006cb51205ea98204c803f4753039409e8171d Signed-off-by: Herman Chen --- utils/mpi_dec_utils.c | 9 +++++++++ utils/mpi_dec_utils.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/utils/mpi_dec_utils.c b/utils/mpi_dec_utils.c index fd825eb4..1dc1c59f 100644 --- a/utils/mpi_dec_utils.c +++ b/utils/mpi_dec_utils.c @@ -377,6 +377,15 @@ void reader_stop(FileReader reader) pthread_join(impl->thd, NULL); } +void show_dec_fps(RK_S64 total_time, RK_S64 total_count, RK_S64 last_time, RK_S64 last_count) +{ + float avg_fps = (float)total_count * 1000000 / total_time; + float ins_fps = (float)last_count * 1000000 / last_time; + + mpp_log("decoded %10lld frame fps avg %7.2f ins %7.2f\n", + total_count, avg_fps, ins_fps); +} + void mpi_dec_test_help() { mpp_log("usage: mpi_dec_test [options]\n"); diff --git a/utils/mpi_dec_utils.h b/utils/mpi_dec_utils.h index 33427ceb..812a7e5b 100644 --- a/utils/mpi_dec_utils.h +++ b/utils/mpi_dec_utils.h @@ -27,7 +27,7 @@ typedef void* FileReader; /* For overall configure setup */ -typedef struct { +typedef struct MpiDecTestCmd_t { char file_input[MAX_FILE_NAME_LENGTH]; char file_output[MAX_FILE_NAME_LENGTH]; char file_config[MAX_FILE_NAME_LENGTH]; @@ -69,4 +69,6 @@ RK_U32 reader_read(FileReader reader, char** buf, size_t *size); RK_U32 reader_index_read(FileReader reader, RK_S32 index, char** buf, size_t *size); void reader_rewind(FileReader reader); +void show_dec_fps(RK_S64 total_time, RK_S64 total_count, RK_S64 last_time, RK_S64 last_count); + #endif