Commit graph

5 commits

Author SHA1 Message Date
Laurent Pinchart
5d1380f7df utils: rkisp1: gen-csc-table: Support printing CCM in decimal
Add an option to the gen-csc-table.py script to output the CCM matrix in
decimal format instead of hexadecimal. This makes no functional
difference, but is useful to adapt to different coding styles.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-04-17 14:50:44 +03:00
Laurent Pinchart
26d9e36d3e utils: rkisp1: gen-csc-table.py: Don't presume python3 location
The python3 binary may be present in a location other than /usr/bin/.
Use /usr/bin/env to locate it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-02-27 15:53:46 +02:00
Laurent Pinchart
daec83536d utils: rkisp1: gen-csc-table: Add support for inverting the CSC
Add a -i/--invert command line argument to invert the YCbCr encoding and
output a YCbCr to RGB matrix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-09-30 22:30:17 +03:00
Laurent Pinchart
4baaecb4ff utils: rkisp1: gen-csc-table: Specify coefficients with full precision
The Rec01, Rec709, Rec2020 and SMTPE 240M standards specify the Cb and
Cr coefficients of the RGB to Y'CbCr conversion matrix using a quotient
of two values. Use the exact same formulas instead of hardcoding the
division results with a lower precision.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-08-30 15:25:35 +03:00
Laurent Pinchart
3fad116f89 utils: rkisp1: Add script to generate CSC coefficients
This script generates fixed-point integer coefficients for the YCbCr
encoding 3x3 matrix. The encoding, quantization and fixed-point
precision can be selected through command line arguments.

The main purpose of the script is to generate coefficient tables to
extend the rkisp1 driver with support for additional YCbCr encodings,
but it may be useful for other purposes as well given that the rounding
isn't trivial.

The Rec. 601 full and limited range coefficients have been verified to
match the values currently used by the rkisp1 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-08-26 15:42:09 +03:00