This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 27ba457b60374787ad82b0d037796631f136ca61
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Sat Oct 24 04:06:38 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Wed Oct 28 19:22:28 2026 +0000

    avfilter/colorspace: derive the RGB to XYZ matrix without dividing by y
    
    The matrix columns were the primaries scaled to Y = 1, x/y and
    (1 - x - y)/y, and were then rescaled to fit the white point, so the
    division by y cancels out. Use the xyz chromaticity vectors directly,
    which gives the same matrix and also works for a primary with y = 0,
    such as the Z axis of the CIE 1931 XYZ.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavfilter/colorspace.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c
index f0bd14be18..2655d96363 100644
--- a/libavfilter/colorspace.c
+++ b/libavfilter/colorspace.c
@@ -86,13 +86,15 @@ void ff_fill_rgb2xyz_table(const AVPrimaryCoefficients 
*coeffs,
     double xb = av_q2d(coeffs->b.x), yb = av_q2d(coeffs->b.y);
     double xw = av_q2d(wp->x), yw = av_q2d(wp->y);
 
-    rgb2xyz[0][0] = xr / yr;
-    rgb2xyz[0][1] = xg / yg;
-    rgb2xyz[0][2] = xb / yb;
-    rgb2xyz[1][0] = rgb2xyz[1][1] = rgb2xyz[1][2] = 1.0;
-    rgb2xyz[2][0] = (1.0 - xr - yr) / yr;
-    rgb2xyz[2][1] = (1.0 - xg - yg) / yg;
-    rgb2xyz[2][2] = (1.0 - xb - yb) / yb;
+    rgb2xyz[0][0] = xr;
+    rgb2xyz[0][1] = xg;
+    rgb2xyz[0][2] = xb;
+    rgb2xyz[1][0] = yr;
+    rgb2xyz[1][1] = yg;
+    rgb2xyz[1][2] = yb;
+    rgb2xyz[2][0] = 1.0 - xr - yr;
+    rgb2xyz[2][1] = 1.0 - xg - yg;
+    rgb2xyz[2][2] = 1.0 - xb - yb;
     ff_matrix_invert_3x3(rgb2xyz, i);
     zw = 1.0 - xw - yw;
     sr = i[0][0] * xw + i[0][1] * yw + i[0][2] * zw;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to