bryn
Posts: 11
Joined: Thu Nov 21, 2013 3:21 pm

OpenMAX JPEG/PNG decoding issues

Mon Nov 25, 2013 2:29 am

Hi,

I've written some code that uses OpenMAX and works with JPEGs and PNGs, that uses the decoder->resize->egl_render pipeline, as well as implemented a progressive->baseline handler for when the decoder can't deal with progressive JPEGs directly. It's working well enough with a selection of images (tried 500 or so), as well as large 7000x4000 type JPGs. I really want this thing to be able to handle any file thrown at it (more media player dreams) and so a few of the image files are causing me problems and I'm unhappy with the workarounds I have in place so was wondering if some experts could help?

1. Is there a better way to detect bad JPEGs where the decoder won't acknowledge that it was a bad file. Some of them are short and not JPEGy at all (i.e. if you put a 4 byte file into it), but I also have a 139K corrupted JPEG which also results in silence. Means I have to wait for a timeout rather than 0x8000100b (OMX_ErrorStreamCorrupt) which I normally get. That timeout can be mighty long, since if I'm decoding a big file it can legitimately be busy. Is there anyway I can figure out that it's time to give up quicker?

2. At least one PNG where the height is not the same as the slice height (140px image height vs 144px slice height), results in corruption of part of the last slice. If I expand the image to 144px or shrink to 128px it all works nicely. What am I doing wrong with PNG decoding, since the same pipeline works great with JPEGs? The correct stride and slice height appears to be showing on the ports.

3. I initially tried to use multiple buffers of the default size required by the decoder, but I have one special progressive JPEG which gives me the expected 0x8000100b (OMX_ErrorStreamCorrupt) error, but then 25% of the time it causes the OpenMAX stack to become unreliable afterwards. Calls such as OMX_SetParameter/OMX_FreeHandle and intermittent OMX_SendCommand's will freeze the application. But if I make the buffer the size of the JPG I don't get this problem. I want to be able to avoid this to take advantage of the normal streaming nature of OpenMAX. Is it required that there just be one big buffer per JPEG and only movies should be "streaming" in? I saw from Matt Ownby's code he just used one big buffer.

I'm running firmware/Linux version:

Nov 15 2013 14:17:01
Copyright (c) 2012 Broadcom
version 162026b1448f491e97e3b3b57cdca29be6a1d61a
Linux raspberrypi 3.10.19+ #600 PREEMPT Sat Nov 16 20:34:43

Thanks!

lenod
Posts: 21
Joined: Wed May 23, 2012 3:57 pm

Re: OpenMAX JPEG/PNG decoding issues

Fri Mar 07, 2014 4:10 pm

I'm affraid I have no answer to your questions.
Just saying that i'm interrested in what you are doing.
Have you thought about integrating this (even partial solution) into raspbmc? It is really annoying that trying to display progressive jpegs often freezes the Rpi.

Keep up the good work.

ameypg
Posts: 3
Joined: Wed Oct 02, 2013 8:56 am

Re: OpenMAX JPEG/PNG decoding issues

Thu May 01, 2014 11:03 am

Now that the driver code is out, we can fix the error handling stuff in the OpenMAX driver.

mpr
Posts: 22
Joined: Wed Mar 27, 2013 6:56 pm

Re: OpenMAX JPEG/PNG decoding issues

Sun Jan 04, 2015 4:46 pm

I don't have a fix but I can confirm that you're not crazy with regard to the PNG height issue. We're seeing it too.

SteveBooth
Posts: 10
Joined: Sun Mar 15, 2015 2:30 pm

Re: OpenMAX JPEG/PNG decoding issues

Sun Mar 15, 2015 2:35 pm

Ive been trying to figure out how to display a png file, and after many days of searching, Googling, and coding, it just doesnt seem to work. Im wondering if there has been any progress on this thread, or if anyone might have some example code. OpenMax/IL is a toughie.

SteveBooth
Posts: 10
Joined: Sun Mar 15, 2015 2:30 pm

Re: OpenMAX JPEG/PNG decoding issues

Sun Mar 15, 2015 8:37 pm

(Oh... and Bryn, I would be very interested to see the code you got working, if it's still available, please.)

bryn
Posts: 11
Joined: Thu Nov 21, 2013 3:21 pm

Re: OpenMAX JPEG/PNG decoding issues

Sun Mar 22, 2015 10:10 pm

SteveBooth wrote:(Oh... and Bryn, I would be very interested to see the code you got working, if it's still available, please.)
It's all over at https://github.com/brynthomas/omx_image

You just have to change the call to omx_image_loader from JPEG to PNG to use it with PNGs (and follow the code to see the relatively small changes needed between the two image formats).

bilhew8078
Posts: 10
Joined: Tue Mar 12, 2013 10:15 pm
Location: California

Re: OpenMAX JPEG/PNG decoding issues

Mon Apr 20, 2015 10:16 pm

Bryn,
I've got an OpenMAX JPEG/PNG decoder working as well. Mine sets up a pipeline from the decoder to the video renderer - just like the hello_video example. I have also noticed issues with PNG files with height not divisible by 16. My issue now is PNG files with alpha transparency. They decode fine, but the transparent areas are displaying as white. Are you able to display PNG files with transparency through to layers below the PNG layer? I know there are flags for alpha compositing in dispmanx, but there don't seem to be any in the OpenMAX port configuration structures. (at least that I have found!!) Any ideas???

Return to “OpenMAX”