PR #25722 opened by Kacper Michajłow (kasper93) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25722 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25722.patch
See Rec. ITU-R BT.1361. From f0d3e1d96a0238ba00ccbad8eb21fd8c78eee48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Tue, 3 Nov 2026 15:55:57 +0100 Subject: [PATCH] avutil/csp: fix the negative segment of the BT.1361 transfer See Rec. ITU-R BT.1361. --- libavutil/csp.c | 4 ++-- tests/ref/fate/color_utils | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavutil/csp.c b/libavutil/csp.c index 5f379844292..2058297738a 100644 --- a/libavutil/csp.c +++ b/libavutil/csp.c @@ -308,7 +308,7 @@ static double trc_bt1361(double Lc) const double a = BT709_alpha; const double b = BT709_beta; - return (-0.0045 >= Lc) ? -(a * pow(-4.0 * Lc, 0.45) + (a - 1.0)) / 4.0 + return (-0.0045 >= Lc) ? -(a * pow(-4.0 * Lc, 0.45) - (a - 1.0)) / 4.0 : ( b > Lc) ? 4.500 * Lc : a * pow( Lc, 0.45) - (a - 1.0); } @@ -318,7 +318,7 @@ static double trc_bt1361_inv(double E) const double a = BT709_alpha; const double b = 4.500 * BT709_beta; - return (-0.02025 >= E) ? -pow((-4.0 * E - (a - 1.0)) / a, 1.0 / 0.45) / 4.0 + return (-0.02025 >= E) ? -pow((-4.0 * E + (a - 1.0)) / a, 1.0 / 0.45) / 4.0 : ( b > E) ? E / 4.500 : pow(( E + (a - 1.0)) / a, 1.0 / 0.45); } diff --git a/tests/ref/fate/color_utils b/tests/ref/fate/color_utils index 07a61c313ec..0f63bd8cea8 100644 --- a/tests/ref/fate/color_utils +++ b/tests/ref/fate/color_utils @@ -169,9 +169,9 @@ trc=iec61966-2-4 calling func(15123.456700) expected=83.452916 roundtrip=15123.4 trc=iec61966-2-4 calling func(19845.889230) expected=94.321297 roundtrip=19845.889230 trc=iec61966-2-4 calling func(98678.423100) expected=194.219568 roundtrip=98678.423100 trc=iec61966-2-4 calling func(99999.899998) expected=195.386306 roundtrip=99999.899998 -trc=bt1361e calling func(-0.100000) expected=-0.206787 roundtrip=-0.100000 -trc=bt1361e calling func(-0.018054) expected=-0.109049 roundtrip=-0.018054 -trc=bt1361e calling func(-0.010000) expected=-0.089387 roundtrip=-0.010000 +trc=bt1361e calling func(-0.100000) expected=-0.157138 roundtrip=-0.100000 +trc=bt1361e calling func(-0.018054) expected=-0.059401 roundtrip=-0.018054 +trc=bt1361e calling func(-0.010000) expected=-0.039739 roundtrip=-0.010000 trc=bt1361e calling func(-0.004490) expected=-0.020205 roundtrip=-0.004490 trc=bt1361e calling func(0.000000) expected=0.000000 roundtrip=0.000000 trc=bt1361e calling func(0.003162) expected=0.014230 roundtrip=0.003162 -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
