From eaf1e8f76beee36899b5c146e626b8f9cd3603ab Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Thu, 31 Dec 2020 10:22:23 +0800 Subject: [PATCH] [mpi_dec_test]: Organize the common func of each dec test 1. Set these func into mpi_dec_utils 2. Note: num of threads: -n -> -s Signed-off-by: Yandong Lin Change-Id: If733fb0fdd7110313d2e140d3c50aad37260b6d2 --- test/mpi_dec_mt_test.c | 159 +-------------------------- test/mpi_dec_multi_test.c | 165 +---------------------------- test/mpi_dec_test.c | 208 +----------------------------------- utils/CMakeLists.txt | 1 + utils/mpi_dec_utils.c | 218 ++++++++++++++++++++++++++++++++++++++ utils/mpi_dec_utils.h | 58 ++++++++++ 6 files changed, 281 insertions(+), 528 deletions(-) create mode 100644 utils/mpi_dec_utils.c create mode 100644 utils/mpi_dec_utils.h diff --git a/test/mpi_dec_mt_test.c b/test/mpi_dec_mt_test.c index cf8780ad..d4121712 100644 --- a/test/mpi_dec_mt_test.c +++ b/test/mpi_dec_mt_test.c @@ -32,10 +32,7 @@ #include "mpp_common.h" #include "utils.h" - -#define MPI_DEC_LOOP_COUNT 4 -#define MPI_DEC_STREAM_SIZE (SZ_4K) -#define MAX_FILE_NAME_LENGTH 256 +#include "mpi_dec_utils.h" typedef struct { MppCtx ctx; @@ -57,30 +54,6 @@ typedef struct { RK_U64 frame_count; } MpiDecLoopData; -typedef struct { - char file_input[MAX_FILE_NAME_LENGTH]; - char file_output[MAX_FILE_NAME_LENGTH]; - MppCodingType type; - RK_U32 width; - RK_U32 height; - RK_U32 debug; - - RK_U32 have_input; - RK_U32 have_output; - - RK_S32 timeout; -} MpiDecTestCmd; - -static OptionInfo mpi_dec_cmd[] = { - {"i", "input_file", "input bitstream file"}, - {"o", "output_file", "output bitstream file, "}, - {"w", "width", "the width of input bitstream"}, - {"h", "height", "the height of input bitstream"}, - {"t", "type", "input stream coding type"}, - {"d", "debug", "debug flag"}, - {"x", "timeout", "output timeout interval"}, -}; - void *thread_input(void *arg) { MpiDecLoopData *data = (MpiDecLoopData *)arg; @@ -457,136 +430,6 @@ MPP_TEST_OUT: return ret; } -static void mpi_dec_test_help() -{ - mpp_log("usage: mpi_dec_test [options]\n"); - show_options(mpi_dec_cmd); - mpp_show_support_format(); -} - -static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd) -{ - const char *opt; - const char *next; - RK_S32 optindex = 1; - RK_S32 handleoptions = 1; - RK_S32 err = MPP_NOK; - - if ((argc < 2) || (cmd == NULL)) { - err = 1; - return err; - } - - /* parse options */ - while (optindex < argc) { - opt = (const char*)argv[optindex++]; - next = (const char*)argv[optindex]; - - if (handleoptions && opt[0] == '-' && opt[1] != '\0') { - if (opt[1] == '-') { - if (opt[2] != '\0') { - opt++; - } else { - handleoptions = 0; - continue; - } - } - - opt++; - - switch (*opt) { - case 'i': - if (next) { - strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_input = 1; - } else { - mpp_err("input file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'o': - if (next) { - strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_output = 1; - } else { - mpp_log("output file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'd': - if (next) { - cmd->debug = atoi(next);; - } else { - mpp_err("invalid debug flag\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'w': - if (next) { - cmd->width = atoi(next); - } else { - mpp_err("invalid input width\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'h': - if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) { - mpi_dec_test_help(); - err = 1; - goto PARSE_OPINIONS_OUT; - } else if (next) { - cmd->height = atoi(next); - } else { - mpp_log("input height is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 't': - if (next) { - cmd->type = (MppCodingType)atoi(next); - err = mpp_check_support_format(MPP_CTX_DEC, cmd->type); - } - - if (!next || err) { - mpp_err("invalid input coding type\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'x': - if (next) { - cmd->timeout = atoi(next); - } - if (!next || cmd->timeout < 0) { - mpp_err("invalid output timeout interval\n"); - goto PARSE_OPINIONS_OUT; - } - break; - default: - mpp_err("skip invalid opt %c\n", *opt); - break; - } - - optindex++; - } - } - - err = 0; - -PARSE_OPINIONS_OUT: - return err; -} - -static void mpi_dec_test_show_options(MpiDecTestCmd* cmd) -{ - 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); - mpp_log("width : %4d\n", cmd->width); - mpp_log("height : %4d\n", cmd->height); - mpp_log("type : %d\n", cmd->type); - mpp_log("debug flag : %x\n", cmd->debug); -} - int main(int argc, char **argv) { RK_S32 ret = 0; diff --git a/test/mpi_dec_multi_test.c b/test/mpi_dec_multi_test.c index ff964812..bbf809f3 100644 --- a/test/mpi_dec_multi_test.c +++ b/test/mpi_dec_multi_test.c @@ -30,29 +30,9 @@ #include "mpp_common.h" #include "utils.h" - +#include "mpi_dec_utils.h" #include -#define MPI_DEC_LOOP_COUNT 4 -#define MPI_DEC_STREAM_SIZE (SZ_4K) -#define MAX_FILE_NAME_LENGTH 256 - -/* For overall configure setup */ -typedef struct { - char file_input[MAX_FILE_NAME_LENGTH]; - char file_output[MAX_FILE_NAME_LENGTH]; - MppCodingType type; - RK_U32 width; - RK_U32 height; - - RK_U32 have_input; - RK_U32 have_output; - - RK_U32 simple; - RK_S32 timeout; - RK_S32 nthreads; -} MpiDecTestCmd; - /* For each instance thread setup */ typedef struct { MppCtx ctx; @@ -94,17 +74,6 @@ typedef struct { MpiDecCtxRet ret; // return of decoder } MpiDecCtxInfo; - -static OptionInfo mpi_dec_cmd[] = { - {"i", "input_file", "input bitstream file"}, - {"o", "output_file", "output bitstream file, "}, - {"w", "width", "the width of input bitstream"}, - {"h", "height", "the height of input bitstream"}, - {"t", "type", "input stream coding type"}, - {"x", "timeout", "output timeout interval"}, - {"n", "instance_nb", "number of instances"}, -}; - static int decode_simple(MpiDecCtx *data) { RK_U32 pkt_done = 0; @@ -613,136 +582,6 @@ MPP_TEST_OUT: return NULL; } -static void mpi_dec_test_help() -{ - mpp_log("usage: mpi_dec_test [options]\n"); - show_options(mpi_dec_cmd); - mpp_show_support_format(); -} - -static RK_S32 mpi_dec_multi_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd) -{ - const char *opt; - const char *next; - RK_S32 optindex = 1; - RK_S32 handleoptions = 1; - RK_S32 err = MPP_NOK; - - if ((argc < 2) || (cmd == NULL)) { - err = 1; - return err; - } - - /* parse options */ - while (optindex < argc) { - opt = (const char*)argv[optindex++]; - next = (const char*)argv[optindex]; - - if (handleoptions && opt[0] == '-' && opt[1] != '\0') { - if (opt[1] == '-') { - if (opt[2] != '\0') { - opt++; - } else { - handleoptions = 0; - continue; - } - } - - opt++; - - switch (*opt) { - case 'i': - if (next) { - strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_input = 1; - } else { - mpp_err("input file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'o': - if (next) { - strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_output = 1; - } else { - mpp_log("output file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'w': - if (next) { - cmd->width = atoi(next); - } else { - mpp_err("invalid input width\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'h': - if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) { - mpi_dec_test_help(); - err = 1; - goto PARSE_OPINIONS_OUT; - } else if (next) { - cmd->height = atoi(next); - } else { - mpp_log("input height is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 't': - if (next) { - cmd->type = (MppCodingType)atoi(next); - err = mpp_check_support_format(MPP_CTX_DEC, cmd->type); - } - - if (!next || err) { - mpp_err("invalid input coding type\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'x': - if (next) { - cmd->timeout = atoi(next); - } - if (!next || cmd->timeout < 0) { - mpp_err("invalid output timeout interval\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'n': - if (next) { - cmd->nthreads = atoi(next); - } - if (!next || cmd->nthreads < 0) { - mpp_err("invalid nthreads\n"); - goto PARSE_OPINIONS_OUT; - } - break; - default: - mpp_err("skip invalid opt %c\n", *opt); - break; - } - - optindex++; - } - } - - err = 0; - -PARSE_OPINIONS_OUT: - return err; -} - -static void mpi_dec_test_show_options(MpiDecTestCmd* cmd) -{ - 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); - mpp_log("width : %4d\n", cmd->width); - mpp_log("height : %4d\n", cmd->height); - mpp_log("type : %d\n", cmd->type); -} - int main(int argc, char **argv) { RK_S32 ret = 0; @@ -756,7 +595,7 @@ int main(int argc, char **argv) cmd->nthreads = 1; // parse the cmd option - ret = mpi_dec_multi_test_parse_options(argc, argv, cmd); + ret = mpi_dec_test_parse_options(argc, argv, cmd); if (ret) { if (ret < 0) { mpp_err("mpi_dec_multi_test_parse_options: input parameter invalid\n"); diff --git a/test/mpi_dec_test.c b/test/mpi_dec_test.c index 65b089a5..1f10814d 100644 --- a/test/mpi_dec_test.c +++ b/test/mpi_dec_test.c @@ -28,13 +28,9 @@ #include "mpp_env.h" #include "mpp_time.h" #include "mpp_common.h" - +#include "mpi_dec_utils.h" #include "utils.h" -#define MPI_DEC_LOOP_COUNT 4 -#define MPI_DEC_STREAM_SIZE (SZ_4K) -#define MAX_FILE_NAME_LENGTH 256 - typedef struct { MppCtx ctx; MppApi *mpi; @@ -60,42 +56,6 @@ typedef struct { size_t max_usage; } MpiDecLoopData; -typedef struct { - char file_input[MAX_FILE_NAME_LENGTH]; - char file_output[MAX_FILE_NAME_LENGTH]; - char file_config[MAX_FILE_NAME_LENGTH]; - MppCodingType type; - MppFrameFormat format; - RK_U32 width; - RK_U32 height; - RK_U32 debug; - - RK_U32 have_input; - RK_U32 have_output; - RK_U32 have_config; - - RK_U32 simple; - RK_S32 timeout; - RK_S32 frame_num; - size_t pkt_size; - - // report information - size_t max_usage; -} MpiDecTestCmd; - -static OptionInfo mpi_dec_cmd[] = { - {"i", "input_file", "input bitstream file"}, - {"o", "output_file", "output bitstream file, "}, - {"c", "ops_file", "input operation config file"}, - {"w", "width", "the width of input bitstream"}, - {"h", "height", "the height of input bitstream"}, - {"t", "type", "input stream coding type"}, - {"f", "format", "output frame format type"}, - {"d", "debug", "debug flag"}, - {"x", "timeout", "output timeout interval"}, - {"n", "frame_number", "max output frame number"}, -}; - static int decode_simple(MpiDecLoopData *data) { RK_U32 pkt_done = 0; @@ -772,172 +732,6 @@ MPP_TEST_OUT: return ret; } -static void mpi_dec_test_help() -{ - mpp_log("usage: mpi_dec_test [options]\n"); - show_options(mpi_dec_cmd); - mpp_show_support_format(); -} - -static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd) -{ - const char *opt; - const char *next; - RK_S32 optindex = 1; - RK_S32 handleoptions = 1; - RK_S32 err = MPP_NOK; - - if ((argc < 2) || (cmd == NULL)) { - err = 1; - return err; - } - - /* parse options */ - while (optindex < argc) { - opt = (const char*)argv[optindex++]; - next = (const char*)argv[optindex]; - - if (handleoptions && opt[0] == '-' && opt[1] != '\0') { - if (opt[1] == '-') { - if (opt[2] != '\0') { - opt++; - } else { - handleoptions = 0; - continue; - } - } - - opt++; - - switch (*opt) { - case 'i': - if (next) { - strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_input = 1; - name_to_coding_type(cmd->file_input, &cmd->type); - } else { - mpp_err("input file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'o': - if (next) { - strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_output = 1; - } else { - mpp_log("output file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'c': - if (next) { - strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH - 1); - cmd->have_config = 1; - - // enlarge packet buffer size for large input stream case - cmd->pkt_size = SZ_1M; - } else { - mpp_log("output file is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'd': - if (next) { - cmd->debug = atoi(next);; - } else { - mpp_err("invalid debug flag\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'w': - if (next) { - cmd->width = atoi(next); - } else { - mpp_err("invalid input width\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'h': - if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) { - mpi_dec_test_help(); - err = 1; - goto PARSE_OPINIONS_OUT; - } else if (next) { - cmd->height = atoi(next); - } else { - mpp_log("input height is invalid\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 't': - if (next) { - cmd->type = (MppCodingType)atoi(next); - err = mpp_check_support_format(MPP_CTX_DEC, cmd->type); - } - - if (!next || err) { - mpp_err("invalid input coding type\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'f': - if (next) { - cmd->format = (MppFrameFormat)atoi(next); - } - - if (!next || err) { - mpp_err("invalid input coding type\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'x': - if (next) { - cmd->timeout = atoi(next); - } - - if (!next || cmd->timeout < 0) { - mpp_err("invalid output timeout interval\n"); - goto PARSE_OPINIONS_OUT; - } - break; - case 'n': - if (next) { - cmd->frame_num = atoi(next); - if (cmd->frame_num < 0) - mpp_log("infinite loop decoding mode\n"); - } else { - mpp_err("invalid frame number\n"); - goto PARSE_OPINIONS_OUT; - } - break; - default: - mpp_err("skip invalid opt %c\n", *opt); - break; - } - - optindex++; - } - } - - err = 0; - -PARSE_OPINIONS_OUT: - return err; -} - -static void mpi_dec_test_show_options(MpiDecTestCmd* cmd) -{ - 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); - mpp_log("config file name: %s\n", cmd->file_config); - mpp_log("width : %4d\n", cmd->width); - mpp_log("height : %4d\n", cmd->height); - mpp_log("type : %d\n", cmd->type); - mpp_log("debug flag : %x\n", cmd->debug); - mpp_log("max frames : %d\n", cmd->frame_num); -} - int main(int argc, char **argv) { RK_S32 ret = 0; diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index ceb7b7ce..d411974b 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,6 +4,7 @@ # ---------------------------------------------------------------------------- add_library(utils STATIC mpi_enc_utils.c + mpi_dec_utils.c utils.c iniparser.c dictionary.c diff --git a/utils/mpi_dec_utils.c b/utils/mpi_dec_utils.c new file mode 100644 index 00000000..d4add453 --- /dev/null +++ b/utils/mpi_dec_utils.c @@ -0,0 +1,218 @@ +/* + * Copyright 2020 Rockchip Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define MODULE_TAG "mpi_dec_utils" + +#include + +#include "mpp_mem.h" +#include "mpp_log.h" +#include "mpp_buffer.h" + +#include "rk_mpi.h" +#include "utils.h" +#include "mpp_common.h" +#include "mpi_dec_utils.h" + +OptionInfo mpi_dec_cmd[] = { + {"i", "input_file", "input bitstream file"}, + {"o", "output_file", "output bitstream file, "}, + {"c", "ops_file", "input operation config file"}, + {"w", "width", "the width of input bitstream"}, + {"h", "height", "the height of input bitstream"}, + {"t", "type", "input stream coding type"}, + {"f", "format", "output frame format type"}, + {"d", "debug", "debug flag"}, + {"x", "timeout", "output timeout interval"}, + {"n", "frame_number", "max output frame number"}, + {"s", "instance_nb", "number of instances"}, + {NULL}, +}; + +void mpi_dec_test_help() +{ + mpp_log("usage: mpi_dec_test [options]\n"); + show_options(mpi_dec_cmd); + mpp_show_support_format(); +} + +RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd) +{ + const char *opt; + const char *next; + RK_S32 optindex = 1; + RK_S32 handleoptions = 1; + RK_S32 err = MPP_NOK; + + if ((argc < 2) || (cmd == NULL)) { + err = 1; + return err; + } + + /* parse options */ + while (optindex < argc) { + opt = (const char*)argv[optindex++]; + next = (const char*)argv[optindex]; + + if (handleoptions && opt[0] == '-' && opt[1] != '\0') { + if (opt[1] == '-') { + if (opt[2] != '\0') { + opt++; + } else { + handleoptions = 0; + continue; + } + } + + opt++; + + switch (*opt) { + case 'i': + if (next) { + strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1); + cmd->have_input = 1; + name_to_coding_type(cmd->file_input, &cmd->type); + } else { + mpp_err("input file is invalid\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'o': + if (next) { + strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1); + cmd->have_output = 1; + } else { + mpp_log("output file is invalid\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'c': + if (next) { + strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH - 1); + cmd->have_config = 1; + + // enlarge packet buffer size for large input stream case + cmd->pkt_size = SZ_1M; + } else { + mpp_log("output file is invalid\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'd': + if (next) { + cmd->debug = atoi(next);; + } else { + mpp_err("invalid debug flag\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'w': + if (next) { + cmd->width = atoi(next); + } else { + mpp_err("invalid input width\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'h': + if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) { + mpi_dec_test_help(); + err = 1; + goto PARSE_OPINIONS_OUT; + } else if (next) { + cmd->height = atoi(next); + } else { + mpp_log("input height is invalid\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 't': + if (next) { + cmd->type = (MppCodingType)atoi(next); + err = mpp_check_support_format(MPP_CTX_DEC, cmd->type); + } + + if (!next || err) { + mpp_err("invalid input coding type\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'f': + if (next) { + cmd->format = (MppFrameFormat)atoi(next); + } + + if (!next || err) { + mpp_err("invalid input coding type\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'x': + if (next) { + cmd->timeout = atoi(next); + } + + if (!next || cmd->timeout < 0) { + mpp_err("invalid output timeout interval\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 'n': + if (next) { + cmd->frame_num = atoi(next); + if (cmd->frame_num < 0) + mpp_log("infinite loop decoding mode\n"); + } else { + mpp_err("invalid frame number\n"); + goto PARSE_OPINIONS_OUT; + } + break; + case 's': + if (next) { + cmd->nthreads = atoi(next); + } + if (!next || cmd->nthreads < 0) { + mpp_err("invalid nthreads\n"); + goto PARSE_OPINIONS_OUT; + } + break; + default: + mpp_err("skip invalid opt %c\n", *opt); + break; + } + + optindex++; + } + } + + err = 0; + +PARSE_OPINIONS_OUT: + return err; +} + +void mpi_dec_test_show_options(MpiDecTestCmd* cmd) +{ + 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); + mpp_log("config file name: %s\n", cmd->file_config); + mpp_log("width : %4d\n", cmd->width); + mpp_log("height : %4d\n", cmd->height); + mpp_log("type : %d\n", cmd->type); + mpp_log("debug flag : %x\n", cmd->debug); + mpp_log("max frames : %d\n", cmd->frame_num); +} \ No newline at end of file diff --git a/utils/mpi_dec_utils.h b/utils/mpi_dec_utils.h new file mode 100644 index 00000000..911b9903 --- /dev/null +++ b/utils/mpi_dec_utils.h @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Rockchip Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __MPI_DEC_UTILS_H__ +#define __MPI_DEC_UTILS_H__ + +#include +#include "utils.h" + +#define MAX_FILE_NAME_LENGTH 256 +#define MPI_DEC_STREAM_SIZE (SZ_4K) +#define MPI_DEC_LOOP_COUNT 4 + +/* For overall configure setup */ +typedef struct { + char file_input[MAX_FILE_NAME_LENGTH]; + char file_output[MAX_FILE_NAME_LENGTH]; + char file_config[MAX_FILE_NAME_LENGTH]; + MppCodingType type; + MppFrameFormat format; + RK_U32 width; + RK_U32 height; + RK_U32 debug; + + RK_U32 have_input; + RK_U32 have_output; + RK_U32 have_config; + + RK_U32 simple; + RK_S32 timeout; + RK_S32 frame_num; + size_t pkt_size; + /* use for mpi_dec_multi_test */ + RK_S32 nthreads; + // report information + size_t max_usage; +} MpiDecTestCmd; + +extern OptionInfo mpi_dec_cmd[]; + +RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd); +void mpi_dec_test_show_options(MpiDecTestCmd* cmd); +void mpi_dec_test_help(); + +#endif \ No newline at end of file