[libcamera-devel] libcamera on Librem 5, phase detection auto focus

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Nov 22 11:50:29 CET 2022


Hi Pavel,

On Tue, Nov 22, 2022 at 10:43:55AM +0100, Pavel Machek wrote:
> Hi!
> 
> > > > correlation between them, and adjust focus according to that.
> > > >
> > > > Does not sound too bad...? But if someone already has code / tools to
> > > > help, let me know.
> > >
> > > Ok, so I'm pretty sure I have right pixels, I'll need to compute the
> > > correlations, but it no longer looks as easy as it looked before.
> > >
> > > Am I right that I should be able to do the AF using subset of special
> > > pixels? I'm thinking about single horizontal line in the middle of screen...
> > 
> > Are you still talking about PDAF (for which I'm afraid I cannot help
> > with reverse engineering) or are you looking at contrast-based
> > algorithms here ?
> 
> PDAF. It was easier than expected (and reverse engineering similar
> chip should be relatively easy) and I got it to work. Fun project :-).

That's great to hear :-) Do you have a high-level, executive summary of
what was required ? I would assume splitting the "right" and "left" PDAF
pixels into two images, and computing cross-correlation with different
offsets ?

> It needs 13Mp images, which is a bit of challenge from performance
> standpoint.

Do you mean the performance impact on the processing of the image data
(debayering, ...) in full resolution, or is the performance of PDAF
pixels processing an issue too ?

Another issue is that you'll need software defective pixel correction to
hide the PDAF pixels in the final image, so that's another performance
hit. I expect the GPU to help there eventually.

> > > I pushed work-in-progress code to
> > > https://gitlab.com/tui/millipixels/-/merge_requests/new?merge_request%5Bsource_branch%5D=pdaf
> > > .
> > 
> > br0ken it seems :)
> 
> Maybe only for logged-in users or something. Anyway, it is also here:
> 
> https://gitlab.com/tui/millipixels/-/tree/pdaf

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list