libtuning: lsc: rkisp1: Do not calculate ratios to green

The current LSC algorithm for the rkisp1 just forwards the LSC tables to
the hardware, so absolute factors are needed and not ratios compared to
green. Therefore every channel needs to be calculated independently.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Stefan Klug 2024-06-14 12:35:50 +02:00
parent e0f41b7401
commit e91f6c384f

View file

@ -33,13 +33,13 @@ class LSCRkISP1(LSC):
# table, flattened array of (blue's) green calibration table # table, flattened array of (blue's) green calibration table
def _do_single_lsc(self, image: lt.Image): def _do_single_lsc(self, image: lt.Image):
cgr, gr = self._lsc_single_channel(image.channels[lt.Color.GR], image) # Perform LSC on each colour channel independently. A future enhancement
cgb, gb = self._lsc_single_channel(image.channels[lt.Color.GB], image) # worth investigating would be splitting the luminance and chrominance
# LSC as done by Raspberry Pi.
# \todo Should these ratio against the average of both greens or just cgr, _ = self._lsc_single_channel(image.channels[lt.Color.GR], image)
# each green like we've done here? cgb, _ = self._lsc_single_channel(image.channels[lt.Color.GB], image)
cr, _ = self._lsc_single_channel(image.channels[lt.Color.R], image, gr) cr, _ = self._lsc_single_channel(image.channels[lt.Color.R], image)
cb, _ = self._lsc_single_channel(image.channels[lt.Color.B], image, gb) cb, _ = self._lsc_single_channel(image.channels[lt.Color.B], image)
return image.color, cr.flatten(), cb.flatten(), cgr.flatten(), cgb.flatten() return image.color, cr.flatten(), cb.flatten(), cgr.flatten(), cgb.flatten()