tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

compressed_icc.h (2737B)


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