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