[libcamera-devel] softISP for libcamera

Pavel Machek pavel at ucw.cz
Thu Dec 7 00:04:36 CET 2023


Hi!

> I have pushed a new version of my optimization work here:
> 
> https://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/SoftwareISP-v02-hans1/
> 
> As the branch name suggests this has been rebased on top
> of the SoftwareISP-v02 branch.
> 
> There are 2 new things here:
> 
> 1. The color gains for whitebalance now use a lookup table
> instead of a fixed 0-256 multiplication factor. This allows
> color gains > 1.0 without needing to call std::min() 6 million
> times per frame (for FHD) to clamp. Gains > 1.0 are is necessary
> to avoid overexposed white areas like a lamp on the ceiling
> or a window in the roof to not turn purple.

This is wrong in debayer, AFAICT?

void SwIspLinaro::IspWorker::debayerBGGR10PLine1(uint8_t *dst, const uint8_t *src)
{
...
	const uint8_t *prev = src - stride_;
	const uint8_t *curr = src;
	const uint8_t *next = src - stride_;

next should be "+ stride_".

Plus statistics:

	y_val = r * RED_Y_MUL;				\
	y_val += (g1 + g2) * GREEN_Y_MUL;		\
	y_val += b * BLUE_Y_MUL;			\
	if (y_val > BRIGHT_LVL) ++bright_sum;		\
	if (y_val > TOO_BRIGHT_LVL) ++too_bright_sum;

That's quite expensive to compute... as it even right? Lets say we are
looking at scene with bright red source. Sensor is saturated, red is
255 everywhere. g/b will be zero, we'll use 0.3 * red, that is less
than 240, and we'll turn the gain up. But we should be turning gain
down, since sensor is saturated.

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/20231207/a36a074c/attachment.sig>


More information about the libcamera-devel mailing list