How to set IMX8MM colour space for G2D conversions

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

How to set IMX8MM colour space for G2D conversions

3,736 次查看
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.

...

标签 (1)
标记 (2)
0 项奖励
回复
11 回复数

2,867 次查看
malik_cisse
Senior Contributor I

Hi

Any feedback would be appreciated.

BR

0 项奖励
回复

2,868 次查看
malik_cisse
Senior Contributor I

Hallo,
Any feedback would be appreciated.

Thx

0 项奖励
回复

2,909 次查看
malik_cisse
Senior Contributor I

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

0 项奖励
回复

3,560 次查看
joanxie
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

3,560 次查看
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 项奖励
回复

3,560 次查看
joanxie
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

3,560 次查看
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 项奖励
回复

3,560 次查看
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 项奖励
回复

3,560 次查看
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 项奖励
回复

3,560 次查看
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 项奖励
回复

2,911 次查看
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 项奖励
回复