sharpyuv_gamma.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #ifndef WEBP_SHARPYUV_SHARPYUV_GAMMA_H_
  12. #define WEBP_SHARPYUV_SHARPYUV_GAMMA_H_
  13. #include "src/webp/types.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. // Initializes precomputed tables. Must be called once before calling
  18. // SharpYuvGammaToLinear or SharpYuvLinearToGamma.
  19. void SharpYuvInitGammaTables(void);
  20. // Converts a gamma color value on 'bit_depth' bits to a 16 bit linear value.
  21. uint32_t SharpYuvGammaToLinear(uint16_t v, int bit_depth);
  22. // Converts a 16 bit linear color value to a gamma value on 'bit_depth' bits.
  23. uint16_t SharpYuvLinearToGamma(uint32_t value, int bit_depth);
  24. #ifdef __cplusplus
  25. } // extern "C"
  26. #endif
  27. #endif // WEBP_SHARPYUV_SHARPYUV_GAMMA_H_