sd_jpeg on imxrt1176

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

sd_jpeg on imxrt1176

Jump to solution
1,885 Views
Devaharsha
Contributor III

Hi,

My project uses the "sd_jpeg" SDK example on imxrt1176. It's working. But I want to port it to FreeRTOS and I have tried it as attached. It's not working like this.

Can anyone help me figure out where it's going wrong? 

 

There are no compilation errors but the code doesn't work. It gets stuck in the do-while loop (freeFb  == NULL each time) as below:

do
{
oldIntStat = DisableGlobalIRQ();
freeFb = APP_GetFrameBuffer();
EnableGlobalIRQ(oldIntStat);
} while (NULL == freeFb);

0 Kudos
1 Solution
1,787 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

This is because each layer has max size. You changed offset, but didn't changed size. 

g_dc.ops->getLayerDefaultConfig(&g_dc, 0, &fbInfo);
fbInfo.pixelFormat = APP_FB_FORMAT;
fbInfo.width = APP_FB_WIDTH-200;
fbInfo.height = APP_FB_HEIGHT-100;
fbInfo.startX = 200;
fbInfo.startY = 100;
fbInfo.strideBytes = APP_FB_STRIDE_BYTE;
if (kStatus_Success != g_dc.ops->setLayerConfig(&g_dc, 0, &fbInfo))

...

Regards,

Jing

View solution in original post

0 Kudos
13 Replies
1,707 Views
smartpavan333
Contributor I

In the normal sd_jpeg  IMXRT1176 SDK example on IMXRT1176 code, i worked on  jpg file and working fine. now i moved  to run GIF files to run this platform. I tried run GIF files on sd_jpeg  SDK example it's not working. 

 

Can you please help me in were to modify in the code?

0 Kudos
1,702 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @smartpavan333 ,

The jpeg decoder in SDK doesn't support gif.  You have to find a decoder elsewhere.

 

Regard,

Jing

0 Kudos
1,851 Views
Devaharsha
Contributor III

Using infinite for loop "for(;;)" instead of "while(True)", frame buffer is getting updated and the entire is code is working fine when ported to FreeRTOS.

If I want to rotate the jpg file in sd card, It's not getting rotated on the display. Can anyone help me in where the modification is required in the above sdk code?

0 Kudos
1,842 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

You can use PXP to rotate the picture. Otherwise you have to use your own code.

 

Regards,

Jing

0 Kudos
1,839 Views
Devaharsha
Contributor III

ok, thanks.I will try.

0 Kudos
1,836 Views
Devaharsha
Contributor III

Can you help how sd_jpeg sdk example can be added with pxp_flip sdk code? I want to integrate both example code so that I can rotate the image.

I am confused as what to put the value for ".bufferAddr=" in the below structure (which I assume would be same for output buffer structure to):

 /* PS configure. */
const pxp_ps_buffer_config_t psBufferConfig = {
.pixelFormat = APP_PXP_PS_FORMAT,
.swapByte = false,
.bufferAddr = (uint32_t)s_psBufferPxp,
.bufferAddrU = 0U,
.bufferAddrV = 0U,
.pitchBytes = APP_PS_SIZE * APP_BPP,
};
 

0 Kudos
1,827 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

If the picture is RGB format, bufferAddr point to picture start address. If the picture format is YUV one plane, bufferAddr point to Y. If the picture format is YUV two/three plane, bufferAddr point to Y start address and bufferAddrU/bufferAddrV point to the other plane.

 

Regards,

Jing

0 Kudos
1,869 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

That means it can't get frame buffer.  Can you trace in and see why it can't?

 

Regards,

Jing

0 Kudos
1,797 Views
Devaharsha
Contributor III

In the normal sd_jpeg SDK example code, I want to move the image. I have tried changing

"fbinfo->startx" & "fbinfo->starty"

but the image is not shifting. I think that the wrong way to do.

Can you please help me in were to modify in the code? (Im not using PXP driver, used image: 720x720 px)

0 Kudos
1,788 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

This is because each layer has max size. You changed offset, but didn't changed size. 

g_dc.ops->getLayerDefaultConfig(&g_dc, 0, &fbInfo);
fbInfo.pixelFormat = APP_FB_FORMAT;
fbInfo.width = APP_FB_WIDTH-200;
fbInfo.height = APP_FB_HEIGHT-100;
fbInfo.startX = 200;
fbInfo.startY = 100;
fbInfo.strideBytes = APP_FB_STRIDE_BYTE;
if (kStatus_Success != g_dc.ops->setLayerConfig(&g_dc, 0, &fbInfo))

...

Regards,

Jing

0 Kudos
1,785 Views
Devaharsha
Contributor III

Ok thanks, I will try it.

Another thing, as you mentioned like if you want to rotate image, manually you can or use PXP driver. But PXP driver is taking more time than expected. So, we are going with manual way. 

Manually if I rotate image in Paint, its still displaying correctly. So, can you tell how to do it manually? 

0 Kudos
1,778 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Devaharsha ,

PXP is much more faster than manually.

There isn't image rotate software or library in SDK driver. You can search in LVGL library but I'm not sure.

Here is some doc about how to rotate a image.

https://www.sciencedirect.com/topics/computer-science/image-rotation

https://homepages.inf.ed.ac.uk/rbf/HIPR2/rotate.htm

 

Regards,

Jing

0 Kudos
1,764 Views
Devaharsha
Contributor III

The image is getting rotated manually i.e. if I rotate it in paint, save it and store it in SDcard. It's working.

 

Thanks, @jingpan  for the shifting part. I have tried it and it's working. But it's shifting from the center of the panel.

Shifting is also working by changing the ratio below:

buffer += row_stride * ((APP_FB_HEIGHT - cinfo.output_height) / 2);
buffer += APP_FB_BPP * ((APP_FB_WIDTH - cinfo.output_width) / 2);

0 Kudos