iMX8QXP: Use JPEG decoder in M4 SDK

cancel
Showing results for 
Search instead for 
Did you mean: 

iMX8QXP: Use JPEG decoder in M4 SDK

iMX8QXP: Use JPEG decoder in M4 SDK

iMX8QXP/iMX8QM have hardware JPEG decoder: The JPEG-D-X core. This is the example code to use this hw decoder in M4 SDK to decode JPEG files.

M4_JPEG_DECODER_SDK_2.5.1.7z

The attached "rear_view_camera_jpegdec.tar.bz2" is the updated source code for "SDK\boards\mekmimx8qx\demo_apps\rear_view_camera". It is based on SDK 2.5.1 for iMX8QXP MEK.

The "rear_view_camera_jpegdec.patch" is the modified code, it hasn't included the added "fsl_jpeg_dec.c" and "fsl_jpeg_dec.h".

 

The testing used two 256*256 JPEG files, they are RGB color space. We used followed commands to build them into flash.bin:

./mkimage_imx8 -soc QX -rev B0 -append ahab-container.img -c -scfw scfw_tcm.bin -m4 m4_rear_view_camera.bin 0 0x34FE0000 --data demo_rgb.jpg 0x84000000 --data demo_rgb2.jpg 0x84008000 -out flash.bin

 

If customer need change the JPEG resoluion, they can change them in file "fsl_jpeg_dec.h", APP_JPEG_SIZE_OF_KB is the JPEG file length in memory, aligned in KB.
 

#define APP_JPEG_WIDTH (256)
#define APP_JPEG_HEIGHT (256)
#define APP_JPEG_SIZE_OF_KB (32)
#define APP_JPEG_FORMAT JPEG_RGB

#define APP_JPEG_BUFFER (0x84000000)

 

To created RGB format JPEG file from RGB data, the customer can use linux unit test application "/unit_tests/JPEG/encoder_test.out".

M4_JPEG_DECODER_WINDOW_MODE_SDK_2.5.1.7z

Based on JEPG decoder, added DPU CSC support and render JEPG decoded video in overlay window.

The architecture is followed: NXP logo is put in FetchLayer0 with RGB565 format, after LayerBlend0, it will be the prim layer for LayberBlend1 (FetchLayer0 can't be used as prim layer for LayerBlend), the JPEG decoder output is put to FetchDecoder0. RGB888 format, and it will be resize to 640*480, and put to x=100, y=100 of the display. (Only the sec layer of LayerBlend can be window mode).

02.png

Some limitation for layer selection in LayerBlend:

01.jpg

Tags (2)
Attachments
Comments

I am using the Media SDK 2014 R2 for Clients that I recently downloaded from the Intel site.  I also downloaded the Intel Media SDK Samples and built the Video Decoding Sample and was able to successfully decode and render an output image as well as convert the resulting output to YUV frames My Lowes Life.

This reference decoder code is based on the hardware JPEG decoder in iMX8QXP chip, it is not software based decoder.

where can get the tools("/unit_tests/JPEG/encoder_test.out").

If you had built the Yocto BSP successfully, in the download folder, there is a package "linux-test-xxx.tar.gz", it includes all unit tests codes.

I am porting according to your patch. Found that M4 is directly attached to APP_InitJpeg_Dec(), then I applied for SC_R_MJPEG_DEC_MP and SC_R_MJPEG_DEC_S0 in scfw. M4 can run, but there is no picture display, and the JPEG interrupt program does not run.

The memory buffer used in M4 for jpeg file and decoder should also be checked. They should be assigned to M4 in SCFW too.

Can you send me the relevant configuration of SCFW?

For shared memory related issue, you can reference to Android BSP and https://community.nxp.com/docs/DOC-343706.

微信图片_20200119150629.jpg

微信图片_20200119150635.jpg

I found that after decoding the jpg image, the color of the displayed image is incorrect

There are many different kinds of JPEG files, you use set the correct one in M4:

 JPEG_YUV420 = 0x0, /* 2 Plannar, Y=1st plane UV=2nd plane */
 JPEG_YUV422 = 0x1, /* 1 Plannar, YUYV sequence */
 JPEG_RGB = 0x2, /* RGBRGB packed format */
 JPEG_YUV444 = 0x3, /* 1 Plannar, YUVYUV sequence */
 JPEG_GRAY = 0x4, /* Y8 or Y12 or Single Component */
 JPEG_RESERVED = 0x5,
 JPEG_ARGB = 0x6,

Are there any patch for imx8qm-mek?

Hi Chen King

The JPEG module is same in iMX8QM and iMX8QXP, so the code can be used on iMX8QM too.

Looks good, thank you. JPEG.jpg

Version history
Revision #:
1 of 1
Last update:
‎07-31-2019 07:55 PM
Updated by: