IMX8QXP jpeg decoder

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

IMX8QXP jpeg decoder

跳至解决方案
1,312 次查看
saber_hosseini
Contributor II

Hi,

We are experiencing an issue with the JPEG encoder on our IMX8QXP (var-som) system. We are using Yocto Scarthgap and require the encoder to convert JPEG images to raw NV12 or BGR24 formats.
Currently, we are only receiving YUV444 (YUV3) output. Previously, with Yocto Sumo, we were able to obtain NV12 output successfully.
The mxc-jpeg device driver appears to support multiple output formats, including BGR24, NV12, and NV12M. Furthermore, the command #v4l2-ctl --list-formats-ext -d /dev/video2 lists 13 compatible output types.
We would appreciate assistance in understanding the specific requirements necessary to achieve NV12 or BGR24 output from the driver.

A simplified version of our C code is attached for your reference.

Sincerely,
//Saber

0 项奖励
回复
1 解答
948 次查看
joanxie
NXP TechSupport
NXP TechSupport

"8QXP JPEG decoder only support such case of RGB format, for example if the input jpeg is encoding use RGB color space, then JPEG decoder output is RGB fmt; But if input jpeg is encoding use YUV color space, then output still is YUV fmt.If customer must use input YUV JPEG , but output need RGB fmt, suggest customer use hardware video convert, such as imxvideoconvert, other than software video convert."

在原帖中查看解决方案

0 项奖励
回复
8 回复数
1,277 次查看
joanxie
NXP TechSupport
NXP TechSupport

did you test the gstreamer with jpeg encoder on the imx8qxp? do you have any log or print information to share?

0 项奖励
回复
1,263 次查看
saber_hosseini
Contributor II

Hi,

Thanks for your replay.

I have attached the output from gstreamer. I used the command below, as you can see in the logs, gstreamer uses HW JPEG coder to convert the input image to V308 (YUV444) and then converts YUV444 to RGB using software.

 

# GST_DEBUG=3 gst-launch-1.0 -v filesrc location=/ANPR/DPRGremlin1080p.jpg ! jpegparse ! v4l2jpegdec capture-io-mode=dmabuf ! videoconvert ! video/x-raw,format=RGB ! filesink location=output.rgb

 

 

I have also used the example code from https://github.com/nxp-imx/imx-test/tree/lf-6.6.23_2.0.0/test/mxc_jpeg_test

It seems like, when we want to use ioctl and VIDIOC_STREAMON, then the output format changes to YUV444.

0 项奖励
回复
1,235 次查看
joanxie
NXP TechSupport
NXP TechSupport

what format of your jpg source is? do you mean you can output nv12 on Yocto Sumo using the same command, right? if yes pls send your jpg file to me, and I checked the source code, it seems can support different format as output

linux-imx/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c at lf-6.6.y · nxp-imx/linux-imx

0 项奖励
回复
1,219 次查看
saber_hosseini
Contributor II

Yes, you are correct. Our product has Sumo right now and it can convert JPEG to NV12. However, with Scarthgap (kernel 6.6.23) the only output we get is YUV444, despite of whatever we configure the decoder.

I have attached two images we are using for test. 

0 项奖励
回复
961 次查看
joanxie
NXP TechSupport
NXP TechSupport

couldn't reproduce this on nxp board with official bsp

I didnot reproduce any issue,

below is cmd for make v4l2jpegdec plugin output fmt is NV12.

root@imx8qxpc0mek:~# cat /proc/version
Linux version 6.6.23-lts-next-06236-gb586a521770e (oe-user@oe-host) (aarch64-poky-linux-gcc (GCC) 13.2.0, GNU ld (GNU Binutils) 2.42.0.20240216) #1 SMP PREEMPT Fri Jun 7 13:15:57 UTC 2024
root@imx8qxpc0mek:~# gst-launch-1.0 filesrc location=/root/thumbnail_image004.jpg ! jpegparse ! v4l2jpegdec ! "video/x-raw,format=NV12" ! filesink location=dmp.nv12
Setting pipeline to PAUSED ...

====== V4L2DEC: 1.24.0 build on May 6 2024 08:51:28. ======
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.007471000
Setting pipeline to NULL ...
Freeing pipeline .

0 项奖励
回复
957 次查看
saber_hosseini
Contributor II

Hi,

 

Would you please try RGB or BGR?

 

Regards,

Saber

0 项奖励
回复
1,169 次查看
saber_hosseini
Contributor II

My main question is, how do we get RGB (or BGR) out of decoder!

0 项奖励
回复
949 次查看
joanxie
NXP TechSupport
NXP TechSupport

"8QXP JPEG decoder only support such case of RGB format, for example if the input jpeg is encoding use RGB color space, then JPEG decoder output is RGB fmt; But if input jpeg is encoding use YUV color space, then output still is YUV fmt.If customer must use input YUV JPEG , but output need RGB fmt, suggest customer use hardware video convert, such as imxvideoconvert, other than software video convert."

0 项奖励
回复