Problems with G2D API

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with G2D API

Jump to solution
128 Views
christhi
Contributor II

Hi everybody,

I use the I.MX 8M Plus with Hardknott Yocto.

I have a problem understanding and using the G2D API. I try to implement the following:

Input Image ( ARGB32 format, Size(x1,y1)  ) should be converted to Output Image ( RGB format, Size(x2, y2) )

I create the input and output buffers and surfaces in the constructor like that:

g2dInputBuffer  = g2d_alloc(m_inputCameraFormat.height * m_inputCameraFormat.width * 4, 1);
g2dOutputBuffer = g2d_alloc(m_modelInputInformations.height * m_modelInputInformations.width * 3, 1);
inputSurface = new g2d_surface();
inputSurface->format = G2D_XRGB8888;
inputSurface->left = 0;
inputSurface->top = 0;
inputSurface->right = m_inputCameraFormat.width;
inputSurface->bottom = m_inputCameraFormat.height;
inputSurface->stride = m_inputCameraFormat.width;
inputSurface->width = m_inputCameraFormat.width;
inputSurface->height = m_inputCameraFormat.height;
inputSurface->rot = G2D_ROTATION_0;

outputSurface = new g2d_surface();
outputSurface->format = G2D_RGB888;
outputSurface->left = 0;
outputSurface->top = 0;
outputSurface->right = m_modelInputInformations.width;
outputSurface->bottom = m_modelInputInformations.height;
outputSurface->stride = m_modelInputInformations.width;
outputSurface->width = m_modelInputInformations.width;
outputSurface->height = m_modelInputInformations.height;
outputSurface->rot = G2D_ROTATION_0;

 

After that I want the converting for every incoming input frame like that:

    void *handle = nullptr;
g2d_open(&handle);
g2dInputBuffer->buf_vaddr = const_cast<void*>(inputBuffer);
inputSurface->planes[0] = g2dInputBuffer->buf_paddr;
outputSurface->planes[0] = g2dOutputBuffer->buf_paddr;
g2d_blit(handle, inputSurface, outputSurface);
g2d_close(handle);

 

I get the following error message: g2d_blit_2d, line1397: Invalid dst format 10!

Has anybody some help or advice?

Thank you !

Tags (2)
0 Kudos
1 Solution
92 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello christhi,

RGB888 is not supported for CSC. Supported SRC/DST CSC format can be found in i.MX_Graphics_User's_Guide.pdf:

Bio_TICFSL_0-1635423072730.png

 

RGBs format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR }

Regards

View solution in original post

3 Replies
93 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello christhi,

RGB888 is not supported for CSC. Supported SRC/DST CSC format can be found in i.MX_Graphics_User's_Guide.pdf:

Bio_TICFSL_0-1635423072730.png

 

RGBs format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR }

Regards

View solution in original post

65 Views
christhi
Contributor II

Hello,

is it possible to "delete" the alpha channel from the RGBA8888 image using only the G2D API? I need a RGB888 image and at this moment I use the sharing buffers mechanism. For scaling I use the g2d API and after that I convert the image to RGB888 using OpenCV. Because I can't use OpenCV for GPU acceleration I would prefer only using the G2D API.

Thank you for your help !

0 Kudos
70 Views
christhi
Contributor II

Hello,

thank you for that !

I thought the RGBs format contains the RGB888 format.

0 Kudos