From dd63dfa08670e787738e11c84d99e86514347346 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 9 Apr 2022 18:08:18 +0000 Subject: Fix wrong bt709<->srgb gamma tables git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4323 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pnmgamma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editor/pnmgamma.c') diff --git a/editor/pnmgamma.c b/editor/pnmgamma.c index 1fdf20eb..e10e138b 100644 --- a/editor/pnmgamma.c +++ b/editor/pnmgamma.c @@ -516,7 +516,7 @@ buildBt709ToSrgbGamma(xelval table[], if (radiance < linearCutoffSrgb * normalizer) srgb = radiance * linearExpansionSrgb; else - srgb = 1.055 * pow(normalized, oneOverGammaSrgb) - 0.055; + srgb = 1.055 * pow(radiance, oneOverGammaSrgb) - 0.055; assert(srgb <= 1.0); @@ -567,14 +567,14 @@ buildSrgbToBt709Gamma(xelval table[], if (i < linearCutoffSrgb / linearCompressionSrgb) radiance = normalized * linearCompressionSrgb; else - radiance = pow((normalized + 0.099) / 1.099, gammaSrgb); + radiance = pow((normalized + 0.055) / 1.055, gammaSrgb); assert(radiance <= 1.0); if (radiance < linearCutoff709 * normalizer) bt709 = radiance * linearExpansion709; else - bt709 = 1.055 * pow(normalized, oneOverGamma709) - 0.055; + bt709 = 1.099 * pow(radiance, oneOverGamma709) - 0.099; assert(bt709 <= 1.0); -- cgit 1.4.1