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

Dave Stevenson dave.stevenson at raspberrypi.com
Mon Nov 21 17:52:41 CET 2022


Hi Pavel

On Mon, 21 Nov 2022 at 16:32, Pavel Machek via libcamera-devel
<libcamera-devel at lists.libcamera.org> wrote:
>
> Hi!
>
> > > > So far I'm working with contrast detection, but samsung chip should
> > > > support phase detection auto focus, too. So far I hacked
> > > > drivers/media/i2c/s5k3l6xx.ko not to filter out those bits and took
> > > > photos (and looked at them in darktable), but I don't see any obvious
> > > > "defects" indicating presense of focus data. Do you have any pointers
> > > > to more information by chance?
> > > >
> > > > I took deliberately defocused photo to make "defects" easier to see. I
> > > > guess I should take another one with less gain to keep other noise
> > > > down. Any ideas how to locate those bits?
> > >
> > > The PDAF pixels will be located at fixed positions in the pixel array,
> > > documented by the sensor vendor. Some sensors will process the PDAF
> > > pixels and provide the processed information in the CSI-2 embedded data.
> > > I don't have access to the sensor datasheet, so I can't help much I'm
> > > afraid :-(
> > >
> > The focus pixels will appear sometimes - I haven't quite figured out when - when the resolution is full and when denoising is off. That's not described in the datasheet very well. I did prepare a bunch of scripts to mess with the sensors registers in this repo (beware, here be dragons) https://source.puri.sm/dorota.czaplejewicz/nani
> >
>
> Thanks for pointer.
>
> Is it possible to get the datasheet somewhere?

I can't help on a Samsung datasheet, but I will say that the sensors I
have seen that support PDAF data typically correct the image data so
the ISP doesn't have to, and then sends the PDAF data using a
different CSI data_type. Ideally you will want Tomi's multistream
support to be able to separate out the data streams (assuming the
hardware can do it).
There is no consistent output format for the PDAF data either, so you
really do require the information from the sensor vendor.

Good luck
  Dave

> Would you have example file with the focus pixels by chance? I guess
> first step is to figure out the pattern of the dots...
>
> Best regards,
>                                                                 Pavel
> --
> People of Russia, stop Putin before his war on Ukraine escalates.


More information about the libcamera-devel mailing list