mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 08:46:24 +08:00
fix[utils]: fix convert format error
Change-Id: I9994ab4671dbf9c0f7b0b0476c9fd2710294805d Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
This commit is contained in:
@@ -195,32 +195,23 @@ RK_S32 mpi_enc_opt_vstride(void *ctx, const char *next)
|
||||
RK_S32 mpi_enc_opt_f(void *ctx, const char *next)
|
||||
{
|
||||
MpiEncTestArgs *cmd = (MpiEncTestArgs *)ctx;
|
||||
MppFrameFormat format = MPP_FMT_BUTT;
|
||||
|
||||
if (next) {
|
||||
if (strstr(next, "x") || strstr(next, "X")) {
|
||||
/* hex value with 0x prefix, use sscanf */
|
||||
sscanf(next, "0x%x", &format);
|
||||
} else if (strstr(next, "a") || strstr(next, "A") ||
|
||||
strstr(next, "b") || strstr(next, "B") ||
|
||||
strstr(next, "c") || strstr(next, "C") ||
|
||||
strstr(next, "d") || strstr(next, "D") ||
|
||||
strstr(next, "e") || strstr(next, "E") ||
|
||||
strstr(next, "f") || strstr(next, "F")) {
|
||||
/* hex value without 0x prefix, use sscanf */
|
||||
sscanf(next, "%x", &format);
|
||||
} else {
|
||||
/* decimal value, use atoi */
|
||||
format = (MppFrameFormat)atoi(next);
|
||||
}
|
||||
if (MPP_FRAME_FMT_IS_BE(format) &&
|
||||
(MPP_FRAME_FMT_IS_YUV(format) || MPP_FRAME_FMT_IS_RGB(format))) {
|
||||
cmd->format = format;
|
||||
return 1;
|
||||
long number = 0;
|
||||
MppFrameFormat format = MPP_FMT_BUTT;
|
||||
|
||||
if (MPP_OK == str_to_frm_fmt(next, &number)) {
|
||||
format = (MppFrameFormat)number;
|
||||
|
||||
if (MPP_FRAME_FMT_IS_BE(format) &&
|
||||
(MPP_FRAME_FMT_IS_YUV(format) || MPP_FRAME_FMT_IS_RGB(format))) {
|
||||
cmd->format = format;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mpp_err("invalid input format %x\n", format);
|
||||
mpp_err("invalid input format\n");
|
||||
cmd->format = MPP_FMT_YUV420SP;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user