1*b2055c35SXin Li // Copyright 2022 Google Inc. All Rights Reserved. 2*b2055c35SXin Li // 3*b2055c35SXin Li // Use of this source code is governed by a BSD-style license 4*b2055c35SXin Li // that can be found in the COPYING file in the root of the source 5*b2055c35SXin Li // tree. An additional intellectual property rights grant can be found 6*b2055c35SXin Li // in the file PATENTS. All contributing project authors may 7*b2055c35SXin Li // be found in the AUTHORS file in the root of the source tree. 8*b2055c35SXin Li // ----------------------------------------------------------------------------- 9*b2055c35SXin Li // 10*b2055c35SXin Li // Gamma correction utilities. 11*b2055c35SXin Li 12*b2055c35SXin Li #ifndef WEBP_SHARPYUV_SHARPYUV_GAMMA_H_ 13*b2055c35SXin Li #define WEBP_SHARPYUV_SHARPYUV_GAMMA_H_ 14*b2055c35SXin Li 15*b2055c35SXin Li #include "sharpyuv/sharpyuv.h" 16*b2055c35SXin Li #include "src/webp/types.h" 17*b2055c35SXin Li 18*b2055c35SXin Li #ifdef __cplusplus 19*b2055c35SXin Li extern "C" { 20*b2055c35SXin Li #endif 21*b2055c35SXin Li 22*b2055c35SXin Li // Initializes precomputed tables. Must be called once before calling 23*b2055c35SXin Li // SharpYuvGammaToLinear or SharpYuvLinearToGamma. 24*b2055c35SXin Li void SharpYuvInitGammaTables(void); 25*b2055c35SXin Li 26*b2055c35SXin Li // Converts a 'bit_depth'-bit gamma color value to a 16-bit linear value. 27*b2055c35SXin Li uint32_t SharpYuvGammaToLinear(uint16_t v, int bit_depth, 28*b2055c35SXin Li SharpYuvTransferFunctionType transfer_type); 29*b2055c35SXin Li 30*b2055c35SXin Li // Converts a 16-bit linear color value to a 'bit_depth'-bit gamma value. 31*b2055c35SXin Li uint16_t SharpYuvLinearToGamma(uint32_t value, int bit_depth, 32*b2055c35SXin Li SharpYuvTransferFunctionType transfer_type); 33*b2055c35SXin Li 34*b2055c35SXin Li #ifdef __cplusplus 35*b2055c35SXin Li } // extern "C" 36*b2055c35SXin Li #endif 37*b2055c35SXin Li 38*b2055c35SXin Li #endif // WEBP_SHARPYUV_SHARPYUV_GAMMA_H_ 39