sorbonne
Posts: 49
Joined: Thu Jan 14, 2016 10:25 am

Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Sat Oct 15, 2016 8:20 pm

Hi,

is it possible to convert from one of RGB24 or RGBA or RGB565 to YUV420 with some MMAL component? I tried "vc.ril.isp" and "vc.ril.resize" but I get "zero'ed" buffers (black) from both the components.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 9866
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Sat Oct 15, 2016 8:46 pm

Hold fire for a few days - I've got a bundle of updates to vc.ril.isp.
RGB565, RGB888, BGR888, BGRA, RGBA, or I420 to I420 with any scaling, plus a few bug fixes for lockup conditions :o

Output to RGBA/BGRA/RGB888/BGR888/RGB565 is to come - it's being awkward at the moment.
It should also support YUYV (x4 variants), NV12, NV21, or YV12 in and out.
As you can guess, lots of testing of the combinations needed, and there are some formats that don't have a useful source or sink component (some others may get updates to make testing easier).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

sorbonne
Posts: 49
Joined: Thu Jan 14, 2016 10:25 am

Re: Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Sat Oct 15, 2016 8:50 pm

6by9 wrote:Hold fire for a few days - I've got a bundle of updates to vc.ril.isp.
Great news! Will you update this post or write a new one in another forum? I do not want to miss the event. Thanks

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 9866
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Sat Oct 15, 2016 9:23 pm

sorbonne wrote:Great news! Will you update this post or write a new one in another forum? I do not want to miss the event. Thanks
Happy to update this one, but mainly it's for viewtopic.php?f=38&t=120702
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 9866
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Thu Oct 20, 2016 9:17 pm

vc.ril.isp component updates released in the latest rpi-update firmware.

If you want to an example use case, then there is a test app under https://github.com/6by9/userland/tree/isptest which hooks up the source component producing coloured blocks, to the ISP for resolution and format conversions, to video_render to stick the images on the screen, and runs for 5 seconds.
Command line is
isptest <src_w> <src_h> <src_enc> <dst_w> <dst_h> <dst_enc> <window x,y,w,h>
to set source width, height, and encoding, ISP output width, height, and encoding, and the display window
Source supports encodings RGB2, RGB3, RGBA, I420, and YV12, although the ISP should also be able to consume BGR3, BGRA, NV12, NV21, YUYV, YVYU, UYVY, VYUY (though I haven't tested the YUYV formats).
Supported ISP output encodings are pretty much the same list, though video_render can't consume the YUYV formats, and again I haven't tested them recently.

Yes you can run multiple instances of it simultaneously. For example:

Code: Select all

./isptest  1024 768 I420 640 480 RGB2 0,0,150,150 & ./isptest  1024 768 I420 640 480 I420 0,150,150,150 & ./isptest  1024 768 I420 640 480 RGBA 0,300,150,150 & ./isptest  1024 768 I420 640 480 RGB3 150,0,150,150 & ./isptest  1024 768 I420 640 480 BGRA 150,150,150,150 & ./isptest  1024 768 I420 640 480 I420  150,300,150,150 &
should run 6 instances to show I420 to the 6 different RGB output formats simultaneously.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

sorbonne
Posts: 49
Joined: Thu Jan 14, 2016 10:25 am

Re: Convert from RGB24 or RGBA or RGB565 to YUV420 with MMAL

Thu Oct 20, 2016 11:11 pm

Many thanks!

I am testing this update with my basic program at the moment which only creates the vc.ril.isp component to do some colour conversions. The program fills the input port with some buffers and waits for the output buffers on the output port.

Before raspi-update everything worked as expected except I was always getting "black images" in the buffers. Buffers had the right length though. Now the output buffers keeps reporting a length of zero instead. The code has not changed at all. Do you know what the reason could be? I'll certainly test your testing application, trying to isolate vc.ril.isp from the other components. the but let me say that I already looked at the source code to see if there was something noticeable different from my implementation.

Return to “Graphics, sound and multimedia”