compressed_icc.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Copyright (c) the JPEG XL Project Authors. All rights reserved.
  2. *
  3. * Use of this source code is governed by a BSD-style
  4. * license that can be found in the LICENSE file.
  5. */
  6. /** @addtogroup libjxl_metadata
  7. * @{
  8. * @file compressed_icc.h
  9. * @brief Utility functions to compress and decompress ICC streams.
  10. */
  11. #ifndef JXL_COMPRESSED_ICC_H_
  12. #define JXL_COMPRESSED_ICC_H_
  13. #include <jxl/jxl_export.h>
  14. #include <jxl/memory_manager.h>
  15. #include <jxl/types.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * Allocates a buffer using the memory manager, fills it with a compressed
  21. * representation of an ICC profile, returns the result through @c output_buffer
  22. * and indicates its size through @c output_size.
  23. *
  24. * The result must be freed using the memory manager once it is not of any more
  25. * use.
  26. *
  27. * @param[in] memory_manager Pointer to a JxlMemoryManager.
  28. * @param[in] icc Pointer to a buffer containing the uncompressed ICC profile.
  29. * @param[in] icc_size Size of the buffer containing the ICC profile.
  30. * @param[out] compressed_icc Will be set to a pointer to the buffer containing
  31. * the result.
  32. * @param[out] compressed_icc_size Will be set to the size of the buffer
  33. * containing the result.
  34. * @return Whether compressing the profile was successful.
  35. */
  36. JXL_EXPORT JXL_BOOL JxlICCProfileEncode(const JxlMemoryManager* memory_manager,
  37. const uint8_t* icc, size_t icc_size,
  38. uint8_t** compressed_icc,
  39. size_t* compressed_icc_size);
  40. /**
  41. * Allocates a buffer using the memory manager, fills it with the decompressed
  42. * version of the ICC profile in @c compressed_icc, returns the result through
  43. * @c output_buffer and indicates its size through @c output_size.
  44. *
  45. * The result must be freed using the memory manager once it is not of any more
  46. * use.
  47. *
  48. * @param[in] memory_manager Pointer to a JxlMemoryManager.
  49. * @param[in] compressed_icc Pointer to a buffer containing the compressed ICC
  50. * profile.
  51. * @param[in] compressed_icc_size Size of the buffer containing the compressed
  52. * ICC profile.
  53. * @param[out] icc Will be set to a pointer to the buffer containing the result.
  54. * @param[out] icc_size Will be set to the size of the buffer containing the
  55. * result.
  56. * @return Whether decompressing the profile was successful.
  57. */
  58. JXL_EXPORT JXL_BOOL JxlICCProfileDecode(const JxlMemoryManager* memory_manager,
  59. const uint8_t* compressed_icc,
  60. size_t compressed_icc_size,
  61. uint8_t** icc, size_t* icc_size);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* JXL_COMPRESSED_ICC_H_ */
  66. /** @} */