kaikeraut
Posts: 30
Joined: Tue Apr 29, 2014 8:18 am

How camera preview is working

Wed Jun 11, 2014 10:50 am

Hello All,
By seeing the RaspStill.c code i am unable to figure out how preview is continuously displaying,
when we pass raspistill -k from command line.
Can anyone help me out in understanding.

I am going through the code but unable to understand.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23082
Joined: Sat Jul 30, 2011 7:41 pm

Re: How camera preview is working

Wed Jun 11, 2014 11:00 am

The preview is done by the MMAL_COMPONENT_DEFAULT_VIDEO_RENDER component - see the RaspiPreview.c code.

The work is all done on the GPU - the data is never sent to the ARM, it's tunnelled directly from the camera to the video render and the encoder. The 'viewfinder' is a bitmap superimposed over the top of the framebuffer, not added to the framebuffer.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

kaikeraut
Posts: 30
Joined: Tue Apr 29, 2014 8:18 am

Re: How camera preview is working

Wed Jun 11, 2014 11:32 am

jamesh wrote:The preview is done by the MMAL_COMPONENT_DEFAULT_VIDEO_RENDER component - see the RaspiPreview.c code.

The work is all done on the GPU - the data is never sent to the ARM, it's tunnelled directly from the camera to the video render and the encoder. The 'viewfinder' is a bitmap superimposed over the top of the framebuffer, not added to the framebuffer.
Thanks for the reply jamesh,
For better understanding, do we have any reference.?

And what if i want to dump the raw frames of preview in YUV format, Is possible to do by modifying RaspiPreview.c .?

Or any way to get the encoded buffer from the video render.?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23082
Joined: Sat Jul 30, 2011 7:41 pm

Re: How camera preview is working

Wed Jun 11, 2014 12:23 pm

Look at raspiyuv.c. This takes buffers directly from the camera component and uses them on the ARM. Same technique applies to all components. Do the buffer handling yourself to get at the buffers directly.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “Beginners”