mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 01:02:39 +08:00
[test]: Fix not enough buffer on YUV444 jpeg decode
When decoding YUV444 jpeg image the buffer size should be larger. Also we add user specified output format support for jpeg decoding. Change-Id: If8defbc23162dac111aafee6d96d2726c366b7da Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -522,7 +522,7 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
* YUV422 buffer is 2 times of w*h.
|
* YUV422 buffer is 2 times of w*h.
|
||||||
* So create larger buffer with 2 times w*h.
|
* So create larger buffer with 2 times w*h.
|
||||||
*/
|
*/
|
||||||
ret = mpp_buffer_get(data.frm_grp, &frm_buf, hor_stride * ver_stride * 2);
|
ret = mpp_buffer_get(data.frm_grp, &frm_buf, hor_stride * ver_stride * 4);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
mpp_err("failed to get buffer for input frame ret %d\n", ret);
|
mpp_err("failed to get buffer for input frame ret %d\n", ret);
|
||||||
goto MPP_TEST_OUT;
|
goto MPP_TEST_OUT;
|
||||||
@@ -597,6 +597,10 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
decode_simple(&data);
|
decode_simple(&data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* NOTE: change output format before jpeg decoding */
|
||||||
|
if (cmd->format < MPP_FMT_BUTT)
|
||||||
|
ret = mpi->control(ctx, MPP_DEC_SET_OUTPUT_FORMAT, &cmd->format);
|
||||||
|
|
||||||
while (!data.eos) {
|
while (!data.eos) {
|
||||||
decode_advanced(&data);
|
decode_advanced(&data);
|
||||||
}
|
}
|
||||||
@@ -827,6 +831,7 @@ int main(int argc, char **argv)
|
|||||||
MpiDecTestCmd* cmd = &cmd_ctx;
|
MpiDecTestCmd* cmd = &cmd_ctx;
|
||||||
|
|
||||||
memset((void*)cmd, 0, sizeof(*cmd));
|
memset((void*)cmd, 0, sizeof(*cmd));
|
||||||
|
cmd->format = MPP_FMT_BUTT;
|
||||||
|
|
||||||
// parse the cmd option
|
// parse the cmd option
|
||||||
ret = mpi_dec_test_parse_options(argc, argv, cmd);
|
ret = mpi_dec_test_parse_options(argc, argv, cmd);
|
||||||
|
Reference in New Issue
Block a user