[v4,21/23] libtuning: lsc: rkisp1: Do not calculate ratios to green
diff mbox series

Message ID 20240705144209.418906-22-stefan.klug@ideasonboard.com
State Accepted
Headers show
Series
  • Add ccm calibration to libtuning
Related show

Commit Message

Stefan Klug July 5, 2024, 2:41 p.m. UTC
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>
---
 utils/tuning/libtuning/modules/lsc/rkisp1.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch
diff mbox series

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