HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openexr_chunkio.h
Go to the documentation of this file.
1 /*
2 ** SPDX-License-Identifier: BSD-3-Clause
3 ** Copyright Contributors to the OpenEXR Project.
4 */
5 
6 #ifndef OPENEXR_CORE_CHUNKIO_H
7 #define OPENEXR_CORE_CHUNKIO_H
8 
9 #include "openexr_part.h"
10 
11 #include <stdint.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /** @file */
18 
19 /**
20  * Struct describing raw data information about a chunk.
21  *
22  * A chunk is the generic term for a pixel data block in an EXR file,
23  * as described in the OpenEXR File Layout documentation. This is
24  * common between all different forms of data that can be stored.
25  */
26 typedef struct
27 {
28  int32_t idx;
29 
30  /** For tiles, this is the tilex; for scans it is the x. */
31  int32_t start_x;
32  /** For tiles, this is the tiley; for scans it is the scanline y. */
33  int32_t start_y;
34  int32_t height; /**< For this chunk. */
35  int32_t width; /**< For this chunk. */
36 
37  uint8_t level_x; /**< For tiled files. */
38  uint8_t level_y; /**< For tiled files. */
39 
40  uint8_t type;
41  uint8_t compression;
42 
43  uint64_t data_offset;
44  uint64_t packed_size;
45  uint64_t unpacked_size;
46 
50 
53  exr_const_context_t ctxt, int part_index, int y, exr_chunk_info_t* cinfo);
54 
58  int part_index,
59  int tilex,
60  int tiley,
61  int levelx,
62  int levely,
63  exr_chunk_info_t* cinfo);
64 
65 /** Read the packed data block for a chunk.
66  *
67  * This assumes that the buffer pointed to by @p packed_data is
68  * large enough to hold the chunk block info packed_size bytes.
69  */
73  int part_index,
74  const exr_chunk_info_t* cinfo,
75  void* packed_data);
76 
77 /**
78  * Read chunk for deep data.
79  *
80  * This allows one to read the packed data, the sample count data, or both.
81  * \c exr_read_chunk also works to read deep data packed data,
82  * but this is a routine to get the sample count table and the packed
83  * data in one go, or if you want to pre-read the sample count data,
84  * you can get just that buffer.
85  */
89  int part_index,
90  const exr_chunk_info_t* cinfo,
91  void* packed_data,
92  void* sample_data);
93 
94 /**************************************/
95 
96 /** Initialize a \c exr_chunk_info_t structure when encoding scanline
97  * data (similar to read but does not do anything with a chunk
98  * table).
99  */
102  exr_context_t ctxt, int part_index, int y, exr_chunk_info_t* cinfo);
103 
104 /** Initialize a \c exr_chunk_info_t structure when encoding tiled data
105  * (similar to read but does not do anything with a chunk table).
106  */
109  exr_context_t ctxt,
110  int part_index,
111  int tilex,
112  int tiley,
113  int levelx,
114  int levely,
115  exr_chunk_info_t* cinfo);
116 
117 /**
118  * @p y must the appropriate starting y for the specified chunk.
119  */
122  exr_context_t ctxt,
123  int part_index,
124  int y,
125  const void* packed_data,
126  uint64_t packed_size);
127 
128 /**
129  * @p y must the appropriate starting y for the specified chunk.
130  */
133  exr_context_t ctxt,
134  int part_index,
135  int y,
136  const void* packed_data,
137  uint64_t packed_size,
138  uint64_t unpacked_size,
139  const void* sample_data,
140  uint64_t sample_data_size);
141 
144  exr_context_t ctxt,
145  int part_index,
146  int tilex,
147  int tiley,
148  int levelx,
149  int levely,
150  const void* packed_data,
151  uint64_t packed_size);
152 
155  exr_context_t ctxt,
156  int part_index,
157  int tilex,
158  int tiley,
159  int levelx,
160  int levely,
161  const void* packed_data,
162  uint64_t packed_size,
163  uint64_t unpacked_size,
164  const void* sample_data,
165  uint64_t sample_data_size);
166 
167 #ifdef __cplusplus
168 } /* extern "C" */
169 #endif
170 
171 #endif /* OPENEXR_CORE_CHUNKIO_H */
EXR_EXPORT exr_result_t exr_read_deep_chunk(exr_const_context_t ctxt, int part_index, const exr_chunk_info_t *cinfo, void *packed_data, void *sample_data)
EXR_EXPORT exr_result_t exr_write_tile_chunk_info(exr_context_t ctxt, int part_index, int tilex, int tiley, int levelx, int levely, exr_chunk_info_t *cinfo)
uint64_t sample_count_data_offset
EXR_EXPORT exr_result_t exr_write_deep_tile_chunk(exr_context_t ctxt, int part_index, int tilex, int tiley, int levelx, int levely, const void *packed_data, uint64_t packed_size, uint64_t unpacked_size, const void *sample_data, uint64_t sample_data_size)
GLint y
Definition: glcorearb.h:103
const struct _priv_exr_context_t * exr_const_context_t
EXR_EXPORT exr_result_t exr_read_chunk(exr_const_context_t ctxt, int part_index, const exr_chunk_info_t *cinfo, void *packed_data)
int32_t exr_result_t
EXR_EXPORT exr_result_t exr_write_tile_chunk(exr_context_t ctxt, int part_index, int tilex, int tiley, int levelx, int levely, const void *packed_data, uint64_t packed_size)
EXR_EXPORT exr_result_t exr_write_scanline_chunk_info(exr_context_t ctxt, int part_index, int y, exr_chunk_info_t *cinfo)
#define EXR_EXPORT
Definition: openexr_conf.h:29
struct _priv_exr_context_t * exr_context_t
EXR_EXPORT exr_result_t exr_read_tile_chunk_info(exr_const_context_t ctxt, int part_index, int tilex, int tiley, int levelx, int levely, exr_chunk_info_t *cinfo)
uint64_t unpacked_size
EXR_EXPORT exr_result_t exr_write_deep_scanline_chunk(exr_context_t ctxt, int part_index, int y, const void *packed_data, uint64_t packed_size, uint64_t unpacked_size, const void *sample_data, uint64_t sample_data_size)
EXR_EXPORT exr_result_t exr_read_scanline_chunk_info(exr_const_context_t ctxt, int part_index, int y, exr_chunk_info_t *cinfo)
EXR_EXPORT exr_result_t exr_write_scanline_chunk(exr_context_t ctxt, int part_index, int y, const void *packed_data, uint64_t packed_size)
uint64_t sample_count_table_size