Page 1 of 1

MMAL encodings or effects

Posted: Wed May 20, 2015 9:40 am
by muth
Hello,
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 :
MMAL_ENCODING_MONO8 MMAL_FOURCC('Y','8','0','0')

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 !

Re: MMAL encodings or effects

Posted: Wed May 20, 2015 10:14 am
by 6by9
Look at https://github.com/raspberrypi/userland ... piVidYUV.c
That is selecting MMAL_ENCODING_I420 - http://www.fourcc.org/yuv.php#IYUV
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.

Re: MMAL encodings or effects

Posted: Wed May 20, 2015 1:02 pm
by muth
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 !

Re: MMAL encodings or effects

Posted: Mon May 21, 2018 6:50 pm
by jeffthompson
@muth – did you get that working? Strangely, I need exactly what you mentioned below re realtime dithering!