avutil/csp: fix the negative segment of the BT.1361 transfer

See Rec. ITU-R BT.1361.
This commit is contained in:
Kacper Michajłow committed 2026-11-04 02:31:56 +00:00
1 parent ef53ec02d8
commit 39ccb3ca12
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -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);
}
+3 -3
View File
@@ -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