use the exact constant for the gamma transfer function

As found in BT2020 reference:
https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf

The difference in output-size/PSNR are under the noise level.

Change-Id: I42c12000b61dca791226f3af772c5bd9d58201b8
This commit is contained in:
skal 2017-04-27 10:57:09 -07:00
parent a9c701e04f
commit da3e4dfb6f

View File

@ -171,7 +171,7 @@ typedef uint16_t fixed_y_t; // unsigned type with extra SFIX precision for W
#if defined(USE_GAMMA_COMPRESSION)
// float variant of gamma-correction
// We use tables of different size and precision for the Rec709
// We use tables of different size and precision for the Rec709 / BT2020
// transfer function.
#define kGammaF (1./0.45)
static float kGammaToLinearTabF[MAX_Y_T + 1]; // size scales with Y_FIX
@ -183,8 +183,8 @@ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {
int v;
const double norm = 1. / MAX_Y_T;
const double scale = 1. / kGammaTabSize;
const double a = 0.099;
const double thresh = 0.018;
const double a = 0.09929682680944;
const double thresh = 0.018053968510807;
for (v = 0; v <= MAX_Y_T; ++v) {
const double g = norm * v;
if (g <= thresh * 4.5) {