MMAL Image decoder
Hi,
Is there a way to force the image decoder to use the pixel format on output port chosen by the user when enbaling the port, instead of being modified by MMAL_EVENT_FORMAT_CHANGED.
I'm writing my own c++ image decoder class (wrapper around mmal decoder, based on this: https://github.com/6by9/userland/blob/h ... peg/jpeg.c).
More precisely, the output port supports the following formats:
image decoder port vc.ril.image_decode:out:0 supported encodings: RGB2 //aka RGB_5_6_5
image decoder port vc.ril.image_decode:out:0 supported encodings: I420
image decoder port vc.ril.image_decode:out:0 supported encodings: I422
image decoder port vc.ril.image_decode:out:0 supported encodings: RGBA
image decoder port vc.ril.image_decode:out:0 supported encodings: BGRA
I set RGB2, in the setup phase, but when i decode :
-in a PNG image the MMAL_EVENT_FORMAT_CHANGED switches to RGBA.
-in a JPEG image the MMAL_EVENT_FORMAT_CHANGED switches to I420.
Is there a way to avoid that and force the decoder to use the format chosen by the user ?
Another question: the MMAL_ENCODING_OPAQUE is not listed, is it correct? I'm using firmware of 12/02/2020. (There was a similar problem with the video decoder viewtopic.php?f=67&t=226416&p=1390005#p1390005).
Thanks,
Alessandro
Is there a way to force the image decoder to use the pixel format on output port chosen by the user when enbaling the port, instead of being modified by MMAL_EVENT_FORMAT_CHANGED.
I'm writing my own c++ image decoder class (wrapper around mmal decoder, based on this: https://github.com/6by9/userland/blob/h ... peg/jpeg.c).
More precisely, the output port supports the following formats:
image decoder port vc.ril.image_decode:out:0 supported encodings: RGB2 //aka RGB_5_6_5
image decoder port vc.ril.image_decode:out:0 supported encodings: I420
image decoder port vc.ril.image_decode:out:0 supported encodings: I422
image decoder port vc.ril.image_decode:out:0 supported encodings: RGBA
image decoder port vc.ril.image_decode:out:0 supported encodings: BGRA
I set RGB2, in the setup phase, but when i decode :
-in a PNG image the MMAL_EVENT_FORMAT_CHANGED switches to RGBA.
-in a JPEG image the MMAL_EVENT_FORMAT_CHANGED switches to I420.
Is there a way to avoid that and force the decoder to use the format chosen by the user ?
Another question: the MMAL_ENCODING_OPAQUE is not listed, is it correct? I'm using firmware of 12/02/2020. (There was a similar problem with the video decoder viewtopic.php?f=67&t=226416&p=1390005#p1390005).
Thanks,
Alessandro
- 6by9
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 18476
- Joined: Wed Dec 04, 2013 11:27 am
Re: MMAL Image decoder
If you wish to change the format, then do so after the MMAL_EVENT_FORMAT_CHANGED event.longo92 wrote: ↑Mon Jul 13, 2020 11:48 amHi,
Is there a way to force the image decoder to use the pixel format on output port chosen by the user when enbaling the port, instead of being modified by MMAL_EVENT_FORMAT_CHANGED.
I'm writing my own c++ image decoder class (wrapper around mmal decoder, based on this: https://github.com/6by9/userland/blob/h ... peg/jpeg.c).
More precisely, the output port supports the following formats:
image decoder port vc.ril.image_decode:out:0 supported encodings: RGB2 //aka RGB_5_6_5
image decoder port vc.ril.image_decode:out:0 supported encodings: I420
image decoder port vc.ril.image_decode:out:0 supported encodings: I422
image decoder port vc.ril.image_decode:out:0 supported encodings: RGBA
image decoder port vc.ril.image_decode:out:0 supported encodings: BGRA
I set RGB2, in the setup phase, but when i decode :
-in a PNG image the MMAL_EVENT_FORMAT_CHANGED switches to RGBA.
-in a JPEG image the MMAL_EVENT_FORMAT_CHANGED switches to I420.
Is there a way to avoid that and force the decoder to use the format chosen by the user ?
However there are restrictions in that the decoders are decoding directly into the provided output buffer, therefore the codec has to natively support decode into that format.
GIF supports RGB565
BMP, PNG, PPM, and TGA support RGBA.
JPEG supports I420 or I422.
So largely you don't have a choice of format.
OPAQUE means pass a reference to the internal image pool which is used for reference frames and similar.longo92 wrote:Another question: the MMAL_ENCODING_OPAQUE is not listed, is it correct? I'm using firmware of 12/02/2020. (There was a similar problem with the video decoder viewtopic.php?f=67&t=226416&p=1390005#p1390005).
The image codecs don't use an internal image pool as the codecs decode directly into the output buffer, therefore it is correct that they don't support MMAL_ENCODING_OPAQUE.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: MMAL Image decoder
Thanks for the clarification.
Is there some doc where i can get the detalide info you gave me, in particular:
Is there some doc where i can get the detalide info you gave me, in particular:
Or Do you gather them using OpenMax calls?GIF supports RGB565
BMP, PNG, PPM, and TGA support RGBA.
JPEG supports I420 or I422.
Do you mean that if i set RGBA will be a conversion stage (performed by isp) ?However there are restrictions in that the decoders are decoding directly into the provided output buffer, therefore the codec has to natively support decode into that format.
- 6by9
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 18476
- Joined: Wed Dec 04, 2013 11:27 am
Re: MMAL Image decoder
I don't know of any docs or functional calls to retrieve that. I referred back to the firmware source as I knnew there was a table of codecs and compatible formats towards the top of the file.
No, I mean you can swap between I420 and I422 for JPEG. I thought some of the other codecs supported a number of output bit depths, but seemingly not. I'm slightly surprised as for encode the codecs are more accepting on formats.longo92 wrote:Do you mean that if i set RGBA will be a conversion stage (performed by isp) ?However there are restrictions in that the decoders are decoding directly into the provided output buffer, therefore the codec has to natively support decode into that format.
There are no internal conversions available within image_decode.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion