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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Nov 21 18:09:53 CET 2022


Hi Dave,

On Mon, Nov 21, 2022 at 04:52:41PM +0000, Dave Stevenson via libcamera-devel wrote:
> On Mon, 21 Nov 2022 at 16:32, Pavel Machek via libcamera-devel 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

I have been told that the most recent trend from camera sensor vendors
was to output the PDAF pixels in the image again and let the host do all
the processing. I don't know how true that is though, but there is at
least one ISP vendor that has added PDAF hardware processing in the
latest version of their ISP.

> 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...

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list