[test]: Update utils for encoder test

1. Move command parsing to util files.
2. Support frame format and coding type detection.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Id1df67ba61943bb7aa1f02ccccaa932fb5ae9842
This commit is contained in:
Herman Chen
2020-04-04 17:19:57 +08:00
parent b83158b23b
commit 681599f97f
6 changed files with 387 additions and 335 deletions

View File

@@ -127,17 +127,6 @@ typedef struct {
RK_S32 qp_init;
} MpiEncTestData;
static OptionInfo mpi_enc_cmd[] = {
{"i", "input_file", "input bitstream file"},
{"o", "output_file", "output bitstream file, "},
{"w", "width", "the width of input picture"},
{"h", "height", "the height of input picture"},
{"f", "format", "the format of input picture"},
{"t", "type", "output stream coding type"},
{"n", "max frame number", "max encoding frame number"},
{"d", "debug", "debug flag"},
};
MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestCmd *cmd)
{
MpiEncTestData *p = NULL;
@@ -853,14 +842,6 @@ MPP_TEST_OUT:
return rate;
}
static void mpi_enc_test_help()
{
mpp_log("usage: mpi_enc_test [options]\n");
show_options(mpi_enc_cmd);
mpp_show_support_format();
}
static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiEncTestCmd* cmd)
{
const char *opt;

View File

@@ -32,26 +32,6 @@
#include "utils.h"
#include "mpi_enc_utils.h"
#define MAX_FILE_NAME_LENGTH 256
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 hor_stride;
RK_U32 ver_stride;
MppFrameFormat format;
RK_U32 debug;
RK_U32 num_frames;
RK_S32 gop_mode;
RK_U32 target_bps;
RK_U32 fps_out;
RK_U32 have_input;
RK_U32 have_output;
} MpiEncTestCmd;
typedef struct {
// global flow control flag
RK_U32 frm_eos;
@@ -113,21 +93,7 @@ typedef struct {
MppEncGopRef ref;
} MpiEncTestData;
static OptionInfo mpi_enc_cmd[] = {
{"i", "input_file", "input bitstream file"},
{"o", "output_file", "output bitstream file, "},
{"w", "width", "the width of input picture"},
{"h", "height", "the height of input picture"},
{"f", "format", "the format of input picture"},
{"t", "type", "output stream coding type"},
{"n", "max frame number", "max encoding frame number"},
{"g", "gop_mode", "gop reference mode"},
{"d", "debug", "debug flag"},
{"b", "target bps", "set tareget bps"},
{"r", "output frame rate", "set output frame rate"},
};
MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestCmd *cmd)
MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestArgs *cmd)
{
MpiEncTestData *p = NULL;
MPP_RET ret = MPP_OK;
@@ -153,13 +119,13 @@ MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestCmd *cmd)
(MPP_ALIGN(cmd->height, 16));
p->fmt = cmd->format;
p->type = cmd->type;
p->bps = cmd->target_bps;
p->bps = cmd->bps_target;
if (cmd->type == MPP_VIDEO_CodingMJPEG)
cmd->num_frames = 1;
p->num_frames = cmd->num_frames;
p->gop_mode = cmd->gop_mode;
if (cmd->have_input) {
if (cmd->file_input) {
p->fp_input = fopen(cmd->file_input, "rb");
if (NULL == p->fp_input) {
mpp_err("failed to open input file %s\n", cmd->file_input);
@@ -167,7 +133,7 @@ MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestCmd *cmd)
}
}
if (cmd->have_output) {
if (cmd->file_output) {
p->fp_output = fopen(cmd->file_output, "w+b");
if (NULL == p->fp_output) {
mpp_err("failed to open output file %s\n", cmd->file_output);
@@ -789,7 +755,7 @@ RET:
return ret;
}
int mpi_enc_test(MpiEncTestCmd *cmd)
int mpi_enc_test(MpiEncTestArgs *cmd)
{
MPP_RET ret = MPP_OK;
MpiEncTestData *p = NULL;
@@ -882,297 +848,28 @@ MPP_TEST_OUT:
return ret;
}
static void mpi_enc_test_help()
{
mpp_log("usage: mpi_enc_test [options]\n");
show_options(mpi_enc_cmd);
mpp_show_support_format();
mpp_show_color_format();
}
static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiEncTestCmd* 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);
cmd->file_input[strlen(next)] = '\0';
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);
cmd->file_output[strlen(next)] = '\0';
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_enc_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 'u':
if (next) {
cmd->hor_stride = atoi(next);
} else {
mpp_err("invalid input width\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'v':
if (next) {
cmd->ver_stride = atoi(next);
} else {
mpp_log("input height is invalid\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'f':
if (next) {
cmd->format = (MppFrameFormat)atoi(next);
err = ((cmd->format >= MPP_FMT_YUV_BUTT && cmd->format < MPP_FRAME_FMT_RGB) ||
cmd->format >= MPP_FMT_RGB_BUTT);
}
if (!next || err) {
mpp_err("invalid input format %d\n", cmd->format);
goto PARSE_OPINIONS_OUT;
}
break;
case 't':
if (next) {
cmd->type = (MppCodingType)atoi(next);
err = mpp_check_support_format(MPP_CTX_ENC, cmd->type);
}
if (!next || err) {
mpp_err("invalid input coding type\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'n':
if (next) {
cmd->num_frames = atoi(next);
} else {
mpp_err("invalid input max number of frames\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'g':
if (next) {
cmd->gop_mode = atoi(next);
} else {
mpp_err("invalid gop mode\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'b':
if (next) {
cmd->target_bps = atoi(next);
} else {
mpp_err("invalid bit rate\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'r':
if (next) {
cmd->fps_out = atoi(next);
} else {
mpp_err("invalid output frame rate\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 get_extension(const char *file_name, char *extension)
{
size_t length = strlen(file_name);
size_t i = length - 1;
while (i) {
if (file_name[i] == '.') {
strcpy(extension, file_name + i + 1);
return ;
}
i--;
}
extension[0] = '\0';
}
void check_input_format(const char *name, MpiEncTestCmd* cmd)
{
char ext[50];
if (name == NULL) {
return;
}
get_extension(name, ext);
mpp_log("input file %s ext %s\n", name, ext);
if (!strcmp(ext, "YUV420p")) {
mpp_log("found YUV420p");
cmd->format = MPP_FMT_YUV420P;
} else if (!strcmp(ext, "YUV420sp")) {
mpp_log("found YUV420sp");
cmd->format = MPP_FMT_YUV420SP;
} else if (!strcmp(ext, "YUV422p")) {
mpp_log("found YUV422p");
cmd->format = MPP_FMT_YUV422P;
} else if (!strcmp(ext, "YUV422sp")) {
mpp_log("found YUV422sp");
cmd->format = MPP_FMT_YUV422SP;
} else if (!strcmp(ext, "YUV422uyvy")) {
mpp_log("found YUV422uyvy");
cmd->format = MPP_FMT_YUV422_UYVY;
} else if (!strcmp(ext, "YUV422vyuy")) {
mpp_log("found YUV422vyuy");
cmd->format = MPP_FMT_YUV422_VYUY;
} else if (!strcmp(ext, "YUV422yuyv")) {
mpp_log("found YUV422yuyv");
cmd->format = MPP_FMT_YUV422_YUYV;
} else if (!strcmp(ext, "YUV422yvyu")) {
mpp_log("found YUV422yvyu");
cmd->format = MPP_FMT_YUV422_YVYU;
} else if (!strcmp(ext, "ABGR8888")) {
mpp_log("found ABGR8888");
cmd->format = MPP_FMT_ABGR8888;
} else if (!strcmp(ext, "ARGB8888")) {
mpp_log("found ARGB8888");
cmd->format = MPP_FMT_ARGB8888;
} else if (!strcmp(ext, "BGR565")) {
mpp_log("found BGR565");
cmd->format = MPP_FMT_BGR565;
} else if (!strcmp(ext, "BGR888")) {
mpp_log("found BGR888");
cmd->format = MPP_FMT_BGR888;
} else if (!strcmp(ext, "BGRA8888")) {
mpp_log("found BGRA8888");
cmd->format = MPP_FMT_BGRA8888;
} else if (!strcmp(ext, "RGB565")) {
mpp_log("found RGB565");
cmd->format = MPP_FMT_RGB565;
} else if (!strcmp(ext, "RGB888")) {
mpp_log("found RGB888");
cmd->format = MPP_FMT_RGB888;
} else if (!strcmp(ext, "RGBA8888")) {
mpp_log("found RGBA8888");
cmd->format = MPP_FMT_RGBA8888;
}
return;
}
static void mpi_enc_test_show_options(MpiEncTestCmd* 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 : %d\n", cmd->width);
mpp_log("height : %d\n", cmd->height);
mpp_log("format : %d\n", cmd->format);
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;
MpiEncTestCmd cmd_ctx;
MpiEncTestCmd* cmd = &cmd_ctx;
RK_S32 ret = MPP_NOK;
MpiEncTestArgs* cmd = mpi_enc_test_cmd_get();
memset((void*)cmd, 0, sizeof(*cmd));
// parse the cmd option
ret = mpi_enc_test_parse_options(argc, argv, cmd);
if (ret) {
if (ret < 0) {
mpp_err("mpi_enc_test_parse_options: input parameter invalid\n");
}
if (argc > 1)
ret = mpi_enc_test_cmd_update_by_args(cmd, argc, argv);
if (ret) {
mpi_enc_test_help();
return ret;
}
mpi_enc_test_show_options(cmd);
mpi_enc_test_cmd_show_opt(cmd);
mpp_env_set_u32("mpi_debug", cmd->debug);
check_input_format(cmd->file_input, cmd);
ret = mpi_enc_test(cmd);
mpp_env_set_u32("mpi_debug", 0x0);
mpi_enc_test_cmd_put(cmd);
return ret;
}

View File

@@ -20,8 +20,215 @@
#include "mpp_mem.h"
#include "mpp_log.h"
#include "rk_mpi.h"
#include "utils.h"
#include "mpi_enc_utils.h"
#define MAX_FILE_NAME_LENGTH 256
MpiEncTestArgs *mpi_enc_test_cmd_get(void)
{
MpiEncTestArgs *args = mpp_calloc(MpiEncTestArgs, 1);
return args;
}
MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **argv)
{
const char *opt;
const char *next;
RK_S32 optindex = 1;
RK_S32 handleoptions = 1;
MPP_RET ret = MPP_NOK;
if ((argc < 2) || (cmd == NULL))
return ret;
/* 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) {
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) {
cmd->file_input = mpp_calloc(char, len + 1);
strncpy(cmd->file_input, next, len);
name_to_frame_format(cmd->file_input, &cmd->format);
}
} else {
mpp_err("input file is invalid\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'o':
if (next) {
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) {
cmd->file_output = mpp_calloc(char, len + 1);
strncpy(cmd->file_output, next, len);
name_to_coding_type(cmd->file_output, &cmd->type);
}
} else {
mpp_log("output file is invalid\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'w':
if (next) {
cmd->width = atoi(next);
if (!cmd->hor_stride)
cmd->hor_stride = cmd->width;
} else {
mpp_err("invalid input width\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'h':
if (!next)
goto PARSE_OPINIONS_OUT;
if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) {
goto PARSE_OPINIONS_OUT;
} else if (next) {
cmd->height = atoi(next);
if (!cmd->ver_stride)
cmd->ver_stride = cmd->height;
}
break;
case 'u':
if (next) {
cmd->hor_stride = atoi(next);
} else {
mpp_err("invalid input width\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'v':
if (next) {
cmd->ver_stride = atoi(next);
} else {
mpp_log("input height is invalid\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'f':
if (next) {
cmd->format = (MppFrameFormat)atoi(next);
ret = ((cmd->format >= MPP_FMT_YUV_BUTT && cmd->format < MPP_FRAME_FMT_RGB) ||
cmd->format >= MPP_FMT_RGB_BUTT);
}
if (!next || ret) {
mpp_err("invalid input format %d\n", cmd->format);
goto PARSE_OPINIONS_OUT;
}
break;
case 't':
if (next) {
cmd->type = (MppCodingType)atoi(next);
ret = mpp_check_support_format(MPP_CTX_ENC, cmd->type);
}
if (!next || ret) {
mpp_err("invalid input coding type\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'n':
if (next) {
cmd->num_frames = atoi(next);
} else {
mpp_err("invalid input max number of frames\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'g':
if (next) {
cmd->gop_mode = atoi(next);
} else {
mpp_err("invalid gop mode\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'b':
if (next) {
cmd->bps_target = atoi(next);
} else {
mpp_err("invalid bit rate\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'r':
if (next) {
cmd->fps_out = atoi(next);
} else {
mpp_err("invalid output frame rate\n");
goto PARSE_OPINIONS_OUT;
}
break;
case 'l':
if (next) {
cmd->loop_cnt = atoi(next);
} else {
mpp_err("invalid loop count\n");
goto PARSE_OPINIONS_OUT;
}
break;
default:
mpp_err("skip invalid opt %c\n", *opt);
break;
}
optindex++;
}
}
ret = MPP_OK;
/* check essential parameter */
if (cmd->type <= MPP_VIDEO_CodingAutoDetect) {
mpp_err("invalid type %d\n", cmd->type);
ret = MPP_NOK;
}
if (cmd->width <= 0 || cmd->height <= 0 ||
cmd->hor_stride <= 0 || cmd->ver_stride <= 0) {
mpp_err("invalid w:h [%d:%d] stride [%d:%d]\n",
cmd->width, cmd->height, cmd->hor_stride, cmd->ver_stride);
ret = MPP_NOK;
}
PARSE_OPINIONS_OUT:
return ret;
}
MPP_RET mpi_enc_test_cmd_put(MpiEncTestArgs* cmd)
{
if (NULL == cmd)
return MPP_OK;
MPP_FREE(cmd->file_input);
MPP_FREE(cmd->file_output);
MPP_FREE(cmd);
return MPP_OK;
}
MPP_RET mpi_enc_gen_osd_data(MppEncOSDData *osd_data, MppBuffer osd_buf, RK_U32 frame_cnt)
{
RK_U32 k = 0;
@@ -64,3 +271,38 @@ MPP_RET mpi_enc_gen_osd_plt(MppEncOSDPlt *osd_plt, RK_U32 *table)
return MPP_OK;
}
static OptionInfo mpi_enc_cmd[] = {
{"i", "input_file", "input bitstream file"},
{"o", "output_file", "output bitstream file, "},
{"w", "width", "the width of input picture"},
{"h", "height", "the height of input picture"},
{"f", "format", "the format of input picture"},
{"t", "type", "output stream coding type"},
{"n", "max frame number", "max encoding frame number"},
{"g", "gop_mode", "gop reference mode"},
{"d", "debug", "debug flag"},
{"b", "target bps", "set tareget bps"},
{"r", "output frame rate", "set output frame rate"},
{"l", "loop count", "loop encoding times for each frame"},
};
MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* 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 : %d\n", cmd->width);
mpp_log("height : %d\n", cmd->height);
mpp_log("format : %d\n", cmd->format);
mpp_log("type : %d\n", cmd->type);
return MPP_OK;
}
void mpi_enc_test_help(void)
{
mpp_log("usage: mpi_enc_test [options]\n");
show_options(mpi_enc_cmd);
mpp_show_support_format();
mpp_show_color_format();
}

View File

@@ -21,6 +21,30 @@
#include "rk_venc_cmd.h"
typedef struct MpiEncTestArgs_t {
char *file_input;
char *file_output;
MppCodingType type;
MppFrameFormat format;
RK_S32 num_frames;
RK_S32 loop_cnt;
RK_S32 width;
RK_S32 height;
RK_S32 hor_stride;
RK_S32 ver_stride;
RK_S32 bps_target;
RK_S32 fps_in;
RK_S32 fps_out;
RK_S32 gop_mode;
MppEncHeaderMode header_mode;
MppEncSliceSplit split;
} MpiEncTestArgs;
#ifdef __cplusplus
extern "C" {
#endif
@@ -28,6 +52,13 @@ extern "C" {
MPP_RET mpi_enc_gen_osd_data(MppEncOSDData *osd_data, MppBuffer osd_buf, RK_U32 frame_cnt);
MPP_RET mpi_enc_gen_osd_plt(MppEncOSDPlt *osd_plt, RK_U32 *table);
MpiEncTestArgs *mpi_enc_test_cmd_get(void);
MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **argv);
MPP_RET mpi_enc_test_cmd_put(MpiEncTestArgs* cmd);
MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* cmd);
void mpi_enc_test_help(void);
#ifdef __cplusplus
}
#endif

View File

@@ -449,3 +449,101 @@ RK_S32 parse_config_line(const char *str, OpsLine *info)
return cnt;
}
static void get_extension(const char *file_name, char *extension)
{
size_t length = strlen(file_name);
size_t i = length - 1;
while (i) {
if (file_name[i] == '.') {
strcpy(extension, file_name + i + 1);
return ;
}
i--;
}
extension[0] = '\0';
}
MPP_RET name_to_frame_format(const char *name, MppFrameFormat *fmt)
{
MPP_RET ret = MPP_OK;
char ext[50];
get_extension(name, ext);
if (!strcmp(ext, "YUV420p")) {
mpp_log("found YUV420p");
*fmt = MPP_FMT_YUV420P;
} else if (!strcmp(ext, "YUV420sp")) {
mpp_log("found YUV420sp");
*fmt = MPP_FMT_YUV420SP;
} else if (!strcmp(ext, "YUV422p")) {
mpp_log("found YUV422p");
*fmt = MPP_FMT_YUV422P;
} else if (!strcmp(ext, "YUV422sp")) {
mpp_log("found YUV422sp");
*fmt = MPP_FMT_YUV422SP;
} else if (!strcmp(ext, "YUV422uyvy")) {
mpp_log("found YUV422uyvy");
*fmt = MPP_FMT_YUV422_UYVY;
} else if (!strcmp(ext, "YUV422vyuy")) {
mpp_log("found YUV422vyuy");
*fmt = MPP_FMT_YUV422_VYUY;
} else if (!strcmp(ext, "YUV422yuyv")) {
mpp_log("found YUV422yuyv");
*fmt = MPP_FMT_YUV422_YUYV;
} else if (!strcmp(ext, "YUV422yvyu")) {
mpp_log("found YUV422yvyu");
*fmt = MPP_FMT_YUV422_YVYU;
} else if (!strcmp(ext, "ABGR8888")) {
mpp_log("found ABGR8888");
*fmt = MPP_FMT_ABGR8888;
} else if (!strcmp(ext, "ARGB8888")) {
mpp_log("found ARGB8888");
*fmt = MPP_FMT_ARGB8888;
} else if (!strcmp(ext, "BGR565")) {
mpp_log("found BGR565");
*fmt = MPP_FMT_BGR565;
} else if (!strcmp(ext, "BGR888")) {
mpp_log("found BGR888");
*fmt = MPP_FMT_BGR888;
} else if (!strcmp(ext, "BGRA8888")) {
mpp_log("found BGRA8888");
*fmt = MPP_FMT_BGRA8888;
} else if (!strcmp(ext, "RGB565")) {
mpp_log("found RGB565");
*fmt = MPP_FMT_RGB565;
} else if (!strcmp(ext, "RGB888")) {
mpp_log("found RGB888");
*fmt = MPP_FMT_RGB888;
} else if (!strcmp(ext, "RGBA8888")) {
mpp_log("found RGBA8888");
*fmt = MPP_FMT_RGBA8888;
} else {
ret = MPP_NOK;
}
return ret;
}
MPP_RET name_to_coding_type(const char *name, MppCodingType *coding)
{
MPP_RET ret = MPP_OK;
char ext[50];
get_extension(name, ext);
if (!strcmp(ext, "264") || !strcmp(ext, "h264")) {
*coding = MPP_VIDEO_CodingAVC;
} else if (!strcmp(ext, "265") || !strcmp(ext, "h265")) {
*coding = MPP_VIDEO_CodingHEVC;
} else if (!strcmp(ext, "jpeg") || !strcmp(ext, "mjpeg") || !strcmp(ext, "jpg")) {
*coding = MPP_VIDEO_CodingMJPEG;
} else {
ret = MPP_NOK;
}
return ret;
}

View File

@@ -75,6 +75,9 @@ typedef struct OpsLine_t {
RK_S32 parse_config_line(const char *str, OpsLine *info);
MPP_RET name_to_frame_format(const char *name, MppFrameFormat *fmt);
MPP_RET name_to_coding_type(const char *name, MppCodingType *coding);
#ifdef __cplusplus
}
#endif