[libcamera-devel] softISP for libcamera

Pavel Machek pavel at ucw.cz
Tue Dec 5 18:32:11 CET 2023


Hi!

> > > With "-Dpipelines=simple/linaro -Dipas=simple/linaro" the libcamera/ipa/soft_ipa_interface.h
> > > will be generated OK.
> > 
> > Thank you, that got me something working.
> > 
> > I believe modifying the code to support bayer8 was fairly easy (but I
> > did not look at the results yet).
> > 
> > Unfortunately processing is quite slow:
> > 
...
> > 58759.057586 (0.45 fps) cam0-stream0 seq: 000111 bytesused: 2752812
> 
> On a sm8250 board (pre-release version of RB5) with imx219 camera I am getting:
> 
> 1) <snip>cam -c1 -C --stream pixelformat=RGB888,width=3278,height=2462
> 
> 548.839035 (5.00 fps) cam0-stream0 seq: 000003 bytesused: 24211308

Seems better, yes. PinePhone is slow and there's probably still
problem with the caches.

> That said, debayering and statistics calculation on CPU aren't very fast.
> But your numbers still look too low for me...
> 
> The statistics calculations for AWB aren't optimized in the current
> patch set (use all the pixels instead of a subset of them), but even
> dropping the stats calculations completely could improve the fps by
> a factor of two or so.

Yes, but we'd need factor on 20 or so...

I'd really like to take still photos. It is one of main use cases.

That means

1) showing some kind of preview, best at 30fps but 10fps would
do. Fortunately screen does have way lower resolution than sensor, and
low-quality debayer+downscale is rather easy to do. Just treat GRRB
block as one pixel...

2) saving full resolution photo. Best saving raw bayer data.

For that, it would be very nice to have statistics computation
decoupled from actual debayer. Most of the time, it is enough to
sample 100 (or so) points in the picture to get good enough statistics
for AE, and some more for auto focus. No need to process full frame.

Application can just do debayer+downscale, and display preview, maybe
using GPU. Anyway CPU is fast enough to do it at 10fps and screen
resolution. But when user presses the trigger, we still have full
frame to save, and can save it to disk or (do one-off high-quality
jpeg processing).

> > Am I right that you only use top 8 bits from the bayer10 data?
> 
> Yes, this is correct.

And that's wrong, right? :-).

Let me explain. RGB888 has 8 bits per pixel, non-linear. So debayer
should really take 10 bits, and apply the correction. It may be called
gamma or something, I'm sure list knows.

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20231205/8ca9bd18/attachment.sig>


More information about the libcamera-devel mailing list