unsupported
  A   ˆl–ß=¿JÕ!®Å	@ãb¸&ÔÅ£�þE#aY¹ÊÓ"i¦�üÿÂ„\ Á_ˆI|¥�+y,ÁÀ -Q    /*
** SPDX-License-Identifier: BSD-3-Clause
** Copyright Contributors to the OpenEXR Project.
*/

#ifndef OPENEXR_CORE_DECODE_H
#define OPENEXR_CORE_DECODE_H

#include "openexr_chunkio.h"
#include "openexr_coding.h"

#ifdef __cplusplus
extern "C" {
#endif

/** @file */

/** Can be bit-wise or'ed into the decode_flags in the decode pipeline.
 *
 * Indicates that the sample count table should be decoded to a an
 * individual sample count list (n, m, o, ...), with an extra int at
 * the end containing the total samples.
 *
 * Without this (i.e. a value of 0 in that bit), indicates the sample
 * count table should be decoded to a cumulative list (n, n+m, n+m+o,
 * ...), which is the on-disk representation.
 */
#define EXR_DECODE_SAMPLE_COUNTS_AS_INDIVIDUAL ((uint16_t) (1 << 0))

/** Can be bit-wise or'ed into the decode_flags in the decode pipeline.
 *
 * Indicates that the data in the channel pointers to decode to is not
 * a direct pointer, but instead is a pointer-to-pointers. In this
 * mode, the user_pixel_stride and user_line_stride are used to
 * advance the pointer offsets for each pixel in the output, but the
 * user_bytes_per_element and user_data_type are used to put
 * (successive) entries into each destination pointer (if not `NULL`).
 *
 * So each channel pointer must then point to an array of
 * chunk.width * chunk.height pointers.
 *
 * With this, you can only extract desired pixels (although all the
 * pixels must be initially decompressed) to handle such operations
 * like proxying where you might want to read every other pixel.
 *
 * If this is NOT set (0), the default unpacking routine assumes the
 * data will be planar and contiguous (each channel is a separate
 * memory block), ignoring user_line_stride and user_pixel_stride.
 */
#define EXR_DECODE_NON_IMAGE_DATA_AS_POINTERS ((uint16_t) (1 << 1))

/**
 * When reading non-image data (i.e. deep), only read the sample table.
 */
#define EXR_DECODE_SAMPLE_DATA_ONLY ((uint16_t) (1 << 2))

/**
 * Struct meant to be used on a per-thread basis for reading exr data
 *
 * As should be obvious, this structure is NOT thread safe, but rather
 * meant to be used by separate threads, which can all be accessing
 * the same context concurrently.
 */
typedef struct _exr_decode_pipeline
{
    /** The output channel information for this chunk.
     *
     * User is expected to fill the channel pointers for the desired
     * output channels (any that are `NULL` will be skipped) if you are
     * going to use exr_decoding_choose_default_routines(). If all that is
     * desired is to read and decompress the data, this can be left
     * uninitialized.
     *
     * Describes the channel information. This information is
     * allocated dynamically during exr_decoding_initialize().
     */
    exr_coding_channel_info_t* channels;
    int16_t                    channel_count;

    /** Decode flags to control the behavior. */
    uint16_t decode_flags;

    /** Copy of the parameters given to the initialize/update for
     * convenience.
     */
    int                 part_index;
    exr_const_context_t context;
    exr_chunk_info_t    chunk;

    /** Can be used by the user to pass custom context data through
     * the decode pipeline.
     */
    void* decoding_user_data;

    /** The (compressed) buffer.
     *
     * If `NULL`, will be allocated during the run of the pipeline.
     *
     * If the caller wishes to take control of the buffer, simple
     * adopt the pointer and set it to `NULL` here. Be cognizant of any
     * custom allocators.
     */
    void* packed_buffer;

    /** Used when re-using the same decode pipeline struct to know if
     * chunk is changed size whether current buffer is large enough.
     */
    size_t packed_alloc_size;

    /** The decompressed buffer (unpacked_size from the chunk block
     * info), but still packed into storage order, only needed for
     * compressed files.
     *
     * If `NULL`, will be allocated during the run of the pipe