Skip to content

Commit

Permalink
[test]: Fix not enough buffer on YUV444 jpeg decode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
HermanChen committed Oct 12, 2018
1 parent ae93472 commit 203ff53
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/mpi_dec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
* YUV422 buffer is 2 times of 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) {
mpp_err("failed to get buffer for input frame ret %d\n", ret);
goto MPP_TEST_OUT;
Expand Down Expand Up @@ -597,6 +597,10 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
decode_simple(&data);
}
} 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) {
decode_advanced(&data);
}
Expand Down Expand Up @@ -827,6 +831,7 @@ int main(int argc, char **argv)
MpiDecTestCmd* cmd = &cmd_ctx;

memset((void*)cmd, 0, sizeof(*cmd));
cmd->format = MPP_FMT_BUTT;

// parse the cmd option
ret = mpi_dec_test_parse_options(argc, argv, cmd);
Expand Down

0 comments on commit 203ff53

Please sign in to comment.