sharpyuv_gamma.h 1.3 KB

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