MJPEG hardware decoder not work correctly

Hi.

I’m trying to capture from webcam to file.

My webcam records image by MJPEG, so I have to convert from MJPEG to H.264 for disk space.

The software conversion of MJPEG to H264 works correctly, but the hardware conversion does not.

After various attempts, I could finally reproduce it with the following command.

$ sudo mpi_dec_test -w 800 -h 600 -t 8 -i mjpeg.mjpg -o mjpeg.yuv -d -1
mpi_dec_test: cmd parse result:
mpi_dec_test: input file name: mjpeg.mjpg
mpi_dec_test: output file name: mjpeg.yuv
mpi_dec_test: config file name:
mpi_dec_test: width : 800
mpi_dec_test: height : 600
mpi_dec_test: type : 8
mpi_dec_test: debug flag : ffffffff
mpi_dec_test: max frames : 0
mpi_dec_test: mpi_dec_test start
mpi_dec_test: input file size 9052394
mpp_rt: NOT found ion allocator
mpp_rt: found drm allocator
mpi_dec_test: mpi_dec_test decoder test start w 800 h 600 type 8
mpi: mpp_create enter ctx 0x7fea181a10 mpi 0x7fea181a08
mpi: mpp version: 056e17df author: Herman Chen [hal_jpegd]: Improve address setup
mpi: mpp_create leave ret 0 ctx 0x55c3132f20 mpi 0x7fb6355650
mpi: mpi_control enter ctx 0x55c3132f20 cmd 310005 parm 0x7fea1819f4
mpi: mpi_control leave ret 0
mpi: mpp_init enter ctx 0x55c3132f20 type 0 coding 8
mpi: mpp_init leave ret 0
mpi: mpi_poll enter ctx 0x55c3132f20 type 0 timeout -1
mpi: mpi_poll leave ret 0
mpi: mpi_dequeue enter ctx 0x55c3132f20 type 0 task 0x7fea181910
mpi: mpi_dequeue leave ret 0
mpi: mpi_enqueue enter ctx 0x55c3132f20 type 0 task 0x55c31369c0
mpi: mpi_enqueue leave ret 0
mpi: mpi_poll enter ctx 0x55c3132f20 type 1 timeout -1
jpegd_parser: input img maybe png format,check it
HAL_JPEG_VDPU2: hal_jpegd_vdpu2_wait IRQ STREAM ERROR!
mpi: mpi_poll leave ret 0
mpi: mpi_dequeue enter ctx 0x55c3132f20 type 1 task 0x7fea181910
mpi: mpi_dequeue leave ret 0
mpi_dec_test: decoded frame 1
mpi: mpi_enqueue enter ctx 0x55c3132f20 type 1 task 0x55c3136b20
mpi: mpi_enqueue leave ret 0
mpi_dec_test: found last packet
mpi: mpi_poll enter ctx 0x55c3132f20 type 0 timeout -1
mpi: mpi_poll leave ret 0
mpi: mpi_dequeue enter ctx 0x55c3132f20 type 0 task 0x7fea181910
mpi: mpi_dequeue leave ret 0
mpi: mpi_enqueue enter ctx 0x55c3132f20 type 0 task 0x55c31369c0
mpi: mpi_enqueue leave ret 0
mpi: mpi_poll enter ctx 0x55c3132f20 type 1 timeout -1
mpi: mpi_poll leave ret 0
mpi: mpi_dequeue enter ctx 0x55c3132f20 type 1 task 0x7fea181910
mpi: mpi_dequeue leave ret 0
mpi_dec_test: decoded frame 2
mpi_dec_test: found eos frame
mpi: mpi_enqueue enter ctx 0x55c3132f20 type 1 task 0x55c3136b20
mpi: mpi_enqueue leave ret 0
mpi: mpi_reset enter ctx 0x55c3132f20
mpi: mpi_reset leave ret 0
mpi: mpp_destroy enter ctx 0x55c3132f20
mpi: mpp_destroy leave ret 0
mpi_dec_test: test success max memory 0.00 MB

$ dmesg
– snip –
3511.221343] rk_vcodec: vpu_service_ioctl:1875: error: unknown vpu service ioctl cmd 40086c01
[ 3511.373037] rk-vcodec ff650000.vpu_service: resetting…
[ 3511.373095] rk-vcodec ff650000.vpu_service: reset done
[ 3511.373107] rk-vcodec ff650000.vpu_service: reset done

OS: Armbian 5.67
Kernel: 4.4.154-rk3399rockpi4b

H.264 hardware decoder works correctly.

I’d be happy if you’d help me.

Thank you.