[enc_utils]: Format source code

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I92f133f89920b125d3f2d44ee718ed394acd7aab
This commit is contained in:
Herman Chen
2020-04-20 09:28:28 +08:00
parent c2d9a16c24
commit e8cb0d49f2

View File

@@ -63,7 +63,7 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
opt++; opt++;
switch (*opt) { switch (*opt) {
case 'i': case 'i' : {
if (next) { if (next) {
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH); size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) { if (len) {
@@ -75,8 +75,8 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
mpp_err("input file is invalid\n"); mpp_err("input file is invalid\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'o': case 'o' : {
if (next) { if (next) {
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH); size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) { if (len) {
@@ -88,8 +88,8 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
mpp_log("output file is invalid\n"); mpp_log("output file is invalid\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'w': case 'w' : {
if (next) { if (next) {
cmd->width = atoi(next); cmd->width = atoi(next);
if (!cmd->hor_stride) if (!cmd->hor_stride)
@@ -98,8 +98,8 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
mpp_err("invalid input width\n"); mpp_err("invalid input width\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'h': case 'h' : {
if (!next) if (!next)
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
@@ -110,24 +110,24 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
if (!cmd->ver_stride) if (!cmd->ver_stride)
cmd->ver_stride = cmd->height; cmd->ver_stride = cmd->height;
} }
break; } break;
case 'u': case 'u' : {
if (next) { if (next) {
cmd->hor_stride = atoi(next); cmd->hor_stride = atoi(next);
} else { } else {
mpp_err("invalid input width\n"); mpp_err("invalid input width\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'v': case 'v' : {
if (next) { if (next) {
cmd->ver_stride = atoi(next); cmd->ver_stride = atoi(next);
} else { } else {
mpp_log("input height is invalid\n"); mpp_log("input height is invalid\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'f': case 'f' : {
if (next) { if (next) {
cmd->format = (MppFrameFormat)atoi(next); cmd->format = (MppFrameFormat)atoi(next);
ret = ((cmd->format >= MPP_FMT_YUV_BUTT && cmd->format < MPP_FRAME_FMT_RGB) || ret = ((cmd->format >= MPP_FMT_YUV_BUTT && cmd->format < MPP_FRAME_FMT_RGB) ||
@@ -138,8 +138,8 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
mpp_err("invalid input format %d\n", cmd->format); mpp_err("invalid input format %d\n", cmd->format);
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 't': case 't' : {
if (next) { if (next) {
cmd->type = (MppCodingType)atoi(next); cmd->type = (MppCodingType)atoi(next);
ret = mpp_check_support_format(MPP_CTX_ENC, cmd->type); ret = mpp_check_support_format(MPP_CTX_ENC, cmd->type);
@@ -149,86 +149,86 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
mpp_err("invalid input coding type\n"); mpp_err("invalid input coding type\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'n': case 'n' : {
if (next) { if (next) {
cmd->num_frames = atoi(next); cmd->num_frames = atoi(next);
} else { } else {
mpp_err("invalid input max number of frames\n"); mpp_err("invalid input max number of frames\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'g': case 'g' : {
if (next) { if (next) {
cmd->gop_mode = atoi(next); cmd->gop_mode = atoi(next);
} else { } else {
mpp_err("invalid gop mode\n"); mpp_err("invalid gop mode\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'b': case 'b' : {
if (next) { if (next) {
cmd->bps_target = atoi(next); cmd->bps_target = atoi(next);
} else { } else {
mpp_err("invalid bit rate\n"); mpp_err("invalid bit rate\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'r': case 'r' : {
if (next) { if (next) {
RK_S32 num = sscanf(next, "%d:%d:%d/%d:%d:%d", RK_S32 num = sscanf(next, "%d:%d:%d/%d:%d:%d",
&cmd->fps_in_num, &cmd->fps_in_den, &cmd->fps_in_flex, &cmd->fps_in_num, &cmd->fps_in_den, &cmd->fps_in_flex,
&cmd->fps_out_num, &cmd->fps_out_den, &cmd->fps_out_flex); &cmd->fps_out_num, &cmd->fps_out_den, &cmd->fps_out_flex);
switch(num) { switch (num) {
case 1: case 1 : {
cmd->fps_out_num = cmd->fps_in_num; cmd->fps_out_num = cmd->fps_in_num;
cmd->fps_out_den = cmd->fps_in_den = 1; cmd->fps_out_den = cmd->fps_in_den = 1;
cmd->fps_out_flex = cmd->fps_in_flex = 0; cmd->fps_out_flex = cmd->fps_in_flex = 0;
break; } break;
case 2: case 2 : {
cmd->fps_out_num = cmd->fps_in_num; cmd->fps_out_num = cmd->fps_in_num;
cmd->fps_out_den = cmd->fps_in_den; cmd->fps_out_den = cmd->fps_in_den;
cmd->fps_out_flex = cmd->fps_in_flex = 0; cmd->fps_out_flex = cmd->fps_in_flex = 0;
break; } break;
case 3: case 3 : {
cmd->fps_out_num = cmd->fps_in_num; cmd->fps_out_num = cmd->fps_in_num;
cmd->fps_out_den = cmd->fps_in_den; cmd->fps_out_den = cmd->fps_in_den;
cmd->fps_out_flex = cmd->fps_in_flex; cmd->fps_out_flex = cmd->fps_in_flex;
break; } break;
case 4: case 4 : {
cmd->fps_out_den = 1; cmd->fps_out_den = 1;
cmd->fps_out_flex = 0; cmd->fps_out_flex = 0;
break; } break;
case 5: case 5 : {
cmd->fps_out_flex = 0; cmd->fps_out_flex = 0;
break; } break;
case 6: case 6 : {
break; } break;
default: default : {
mpp_err("invalid in/out frame rate," mpp_err("invalid in/out frame rate,"
" use \"-r numerator:denominator:flex\"" " use \"-r numerator:denominator:flex\""
" for set the input to the same fps as the output, such as 50:1:1\n" " for set the input to the same fps as the output, such as 50:1:1\n"
" or \"-r numerator:denominator/flex-numerator:denominator:flex\"" " or \"-r numerator:denominator/flex-numerator:denominator:flex\""
" for set input and output separately, such as 40:1:1/30:1:0\n"); " for set input and output separately, such as 40:1:1/30:1:0\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
break; } break;
} }
} else { } else {
mpp_err("invalid output frame rate\n"); mpp_err("invalid output frame rate\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
case 'l': case 'l' : {
if (next) { if (next) {
cmd->loop_cnt = atoi(next); cmd->loop_cnt = atoi(next);
} else { } else {
mpp_err("invalid loop count\n"); mpp_err("invalid loop count\n");
goto PARSE_OPINIONS_OUT; goto PARSE_OPINIONS_OUT;
} }
break; } break;
default: default : {
mpp_err("skip invalid opt %c\n", *opt); mpp_err("skip invalid opt %c\n", *opt);
break; } break;
} }
optindex++; optindex++;