Posts: 27
Joined: Sun Aug 05, 2012 3:32 pm

MMAL encodings or effects

Wed May 20, 2015 9:40 am

I'm digging a bit the codes involved with the camera module. I'd like to get a monochrome video stream and made some trial by modifying raspivid. It is possible to get the raw YUV, even RGB. But for optimization, I wondering if it is possible get directly only one byte per pixel with camera parameters such as :

Is some one knows which 'fourCC' codes are actually supported ?

I have some difficulties as well to find where are implemented the "effects" on the videos, such as 'oilpaint' 'negative' or 'gpen', is it accessible ?

Thanks a lot !

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

Re: MMAL encodings or effects

Wed May 20, 2015 10:14 am

Look at ... piVidYUV.c
That is selecting MMAL_ENCODING_I420 -
They comprise an NxN Y plane followed by (N/2)x(N/2) U and V planes.
The Y (luma) plane is exactly what you want for mono. Just ignore the chroma bytes.

If you want RGB, then change the encoding to MMAL_ENCODING_[BGR24|RGB24|RGB565|RGBA|BGRA] for the various flavours of RGB.

Want to know the supported formats on any port of any component? mmal_port_parameter_get for MMAL_PARAMETER_SUPPORTED_ENCODINGS (you need to construct a parameter structure that contains sufficient array entries for the result - I thought there was a utility function that did that for you, but I can't see it)

All image effects are implemented on the closed source GPU.
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.

Posts: 27
Joined: Sun Aug 05, 2012 3:32 pm

Re: MMAL encodings or effects

Wed May 20, 2015 1:02 pm

Wow, that was a short delay answer, thank you very much !

You're perfectly right, Luma channel is exactly the monochrome component. I asked in case we can make economy of some streamed bytes.
That is now pretty clear for the effects, I ignored it is closed source.

tl;dr :
What I'm trying to achieved is to generate on the fly a pure monochrome (1bit per pixel) image with the error diffusion Floyd–Steinberg dithering method.

Thanks again, have a nice day !

Posts: 1
Joined: Mon May 21, 2018 6:49 pm

Re: MMAL encodings or effects

Mon May 21, 2018 6:50 pm

@muth – did you get that working? Strangely, I need exactly what you mentioned below re realtime dithering!

Return to “Camera board”