How to set IMX8MM colour space for G2D conversions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set IMX8MM colour space for G2D conversions

2,689 Views
brenhale
Contributor I

The IMX8MM reference manual section on the G2D specifies support for BT.601 and BT.709 YUV to RGB color conversions, including the formulas used. How are these set as they are not exposed in the G2D API?

14.2.2.4.8 YUV to RGB Conversion
YUV data can be converted into 8-bit per component RGB format at the output of the
cache only. Once converted, there is no way back to YUV format. GPU supports BT.601
and BT.709 YUV to RGB color conversion standards.

...

Labels (1)
Tags (2)
0 Kudos
11 Replies

1,820 Views
malik_cisse
Senior Contributor I

Hi

Any feedback would be appreciated.

BR

0 Kudos

1,821 Views
malik_cisse
Senior Contributor I

Hallo,
Any feedback would be appreciated.

Thx

0 Kudos

1,862 Views
malik_cisse
Senior Contributor I

Hi Brenhale,
How did you actually solve this problem?
thx

0 Kudos

2,513 Views
joanxie
NXP TechSupport
NXP TechSupport

don't you want to use G2D to convert yuv to rgb?

0 Kudos

2,513 Views
brenhale
Contributor I

Yes i do want to use the G2D, but I would like to switch between BT.601 and BT.709, and do not understand how.

0 Kudos

2,513 Views
joanxie
NXP TechSupport
NXP TechSupport

why do you need to convert BT601 to BT709? I.mx8mm should can support them without conversion

0 Kudos

2,513 Views
brenhale
Contributor I

Why does it matter why we need these? Our application requires it. The IMX8MM manual states the G2D supports this, but the supplied G2D library does not appear to actually support it? I would like to understand how we achieve this? 

0 Kudos

2,513 Views
joanxie
NXP TechSupport
NXP TechSupport

RM mentions GPU can convert yuv to rgb, and supports BT601 and BT709, not convert BT601 to BT709, that's why I ask this question.

0 Kudos

2,513 Views
brenhale
Contributor I

I don't want to convert "BT601 to BT709".  As per original question I want to configure the G2D to use the correct formulas for a YUV to RGB conversion using either BT601 or BT709 maths. The maths are different for these conversions, and the API does not define how this is configured, despite saying it is supported in the G2D section.

0 Kudos

2,513 Views
joanxie
NXP TechSupport
NXP TechSupport

if you use linux bsp, you can use gstreamer command like this to do the color conversion:

"gst-launch-1.0 videotestsrc ! video/x-raw,format=NV12 ! imxvideoconvert_g2d ! video/xraw,
format=RGB16 ! ximagesink display=:0"

this is just an example, you can change your yuv format and rgb format, then g2d would convert from yuv to rgb

0 Kudos

1,864 Views
malik_cisse
Senior Contributor I

Hi,

I am resurrecting this thread since I face the exact same issue.

The same issue is also discussed here without answer:
https://community.nxp.com/t5/i-MX-Processors/YUV-to-RGB-conversion/td-p/629789

@brenhale actually clearly specified the problem. 

@joanxie suggested to use gstreamer but this is not what I want.

I already wrote a G2D code that implements BT.601:

g2d_open(&handle);
src.planes[0] = buf_y;
src.planes[1] = buf_u;
src.planes[2] = buf_v;
src.left = crop.left;
src.top = crop.top;
src.right = crop.right;
src.bottom = crop.bottom;
src.stride = y_stride;
src.width = y_width;
src.height = y_height;
src.rot = G2D_ROTATION_0;
src.format = G2D_I420;
dst.planes[0] = buf_rgba;
dst.left = 0;
dst.top = 0;
dst.right = disp_width;
dst.bottom = disp_height;
dst.stride = disp_width;
dst.width = disp_width;
dst.height = disp_height;
dst.rot = G2D_ROTATION_0;
dst.format = G2D_RGBA8888;
g2d_blit(handle, &src, &dst);
g2d_finish(handle);
g2d_close(handle);

The problem with this is that it provides RGBA (RGB32) while I want RGB 24bit

From the formula in the imx8mp ref manual it appears BT.709 has only RGB no alpha channel.

The question is:
How do I configure G2D programmatically to do YUV to RGB conversion?

How do I configure BT.709 ?

Thx

0 Kudos