[PATCH v2 21/25] libtuning: lsc: rkisp1: Do not calculate ratios to green

Stefan Klug stefan.klug at ideasonboard.com
Fri Jun 28 12:47:14 CEST 2024


The hardware in the imx8mp treats the lsc tables as absolute factors and
not as ratios compared to green. Therefore every channel must calculated
independently.

Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
---
 utils/tuning/libtuning/modules/lsc/rkisp1.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/utils/tuning/libtuning/modules/lsc/rkisp1.py b/utils/tuning/libtuning/modules/lsc/rkisp1.py
index 5874f10c936f..a8ba454a7139 100644
--- a/utils/tuning/libtuning/modules/lsc/rkisp1.py
+++ b/utils/tuning/libtuning/modules/lsc/rkisp1.py
@@ -38,8 +38,11 @@ class LSCRkISP1(LSC):
 
         # \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)
+
+        # the lsc tables in the rkisp1 are gains on the corresponding channel,
+        # not ratios with respect to green, so calculate them independently
+        cr, _ = self._lsc_single_channel(image.channels[lt.Color.R], image, None)
+        cb, _ = self._lsc_single_channel(image.channels[lt.Color.B], image, None)
 
         return image.color, cr.flatten(), cb.flatten(), cgr.flatten(), cgb.flatten()
 
-- 
2.43.0



More information about the libcamera-devel mailing list