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 /** @brief Retrieve the chunk table offset for the part in question.
20  */
22  exr_const_context_t ctxt, int part_index, uint64_t* chunk_offset_out);
23 
24 /**
25  * Struct describing raw data information about a chunk.
26  *
27  * A chunk is the generic term for a pixel data block in an EXR file,
28  * as described in the OpenEXR File Layout documentation. This is
29  * common between all different forms of data that can be stored.
30  */
31 typedef struct
32 {
33  int32_t idx;
34 
35  /** For tiles, this is the tilex; for scans it is the x. */
36  int32_t start_x;
37  /** For tiles, this is the tiley; for scans it is the scanline y. */
38  int32_t start_y;
39  int32_t height; /**< For this chunk. */
40  int32_t width; /**< For this chunk. */
41 
42  uint8_t level_x; /**< For tiled files. */
43  uint8_t level_y; /**< For tiled files. */
44 
45  uint8_t type;
46  uint8_t compression;
47 
48  uint64_t data_offset;
49  uint64_t packed_size;
50  uint64_t unpacked_size;
51 
55 
56 /**************************************/
57 
58 /** initialize chunk info with the default values from the specified part
59  *
60  * The 'x' and 'y' parameters are used to indicate the starting position
61  * of the chunk being initialized. This does not perform any I/O to validate
62  * and so the values are only indicative. (but can be used to do things
63  * like compress / decompress a chunk without having a file to actually
64  * read
65  */
68  exr_context_t ctxt, int part_index,
69  const exr_attr_box2i_t *box,
70  int levelx, int levely,
71  exr_chunk_info_t* cinfo);
72 
73 /**************************************/
74 
77  exr_const_context_t ctxt, int part_index, int y, exr_chunk_info_t* cinfo);
78 
82  int part_index,
83  int tilex,
84  int tiley,
85  int levelx,
86  int levely,
87  exr_chunk_info_t* cinfo);
88 
89 /** Read the packed data block for a chunk.
90  *
91  * This assumes that the buffer pointed to by @p packed_data is
92  * large enough to hold the chunk block info packed_size bytes.
93  */
97  int part_index,
98  const exr_chunk_info_t* cinfo,
99  void* packed_data);
100 
101 /**
102  * Read chunk for deep data.
103  *
104  * This allows one to read the packed data, the sample count data, or both.
105  * \c exr_read_chunk also works to read deep data packed data,
106  * but this is a routine to get the sample count table and the packed
107  * data in one go, or if you want to pre-read the sample count data,
108  * you can get just that buffer.
109  */
112  exr_const_context_t ctxt,
113  int part_index,
114  const exr_chunk_info_t* cinfo,
115  void* packed_data,
116  void* sample_data);
117 
118 /**************************************/
119 
120 /** Initialize a \c exr_chunk_info_t structure when encoding scanline
121  * data (similar to read but does not do anything with a chunk
122  * table).
123  */
126  exr_context_t ctxt, int part_index, int y, exr_chunk_info_t* cinfo);
127 
128 /** Initialize a \c exr_chunk_info_t structure when encoding tiled data
129  * (similar to read but does not do anything with a chunk table).
130  */
133  exr_context_t ctxt,
134  int part_index,
135  int tilex,
136  int tiley,
137  int levelx,
138  int levely,
139  exr_chunk_info_t* cinfo);
140 
141 /**
142  * @p y must the appropriate starting y for the specified chunk.
143  */
146  exr_context_t ctxt,
147  int part_index,
148  int y,
149  const void* packed_data,
150  uint64_t packed_size);
151 
152 /**
153  * @p y must the appropriate starting y for the specified chunk.
154  */
157  exr_context_t ctxt,
158  int part_index,
159  int y,
160  const void* packed_data,
161  uint64_t packed_size,
162  uint64_t unpacked_size,
163  const void* sample_data,
164  uint64_t sample_data_size);
165 
168  exr_context_t ctxt,
169  int part_index,
170  int tilex,
171  int tiley,
172  int levelx,
173  int levely,
174  const void* packed_data,
175  uint64_t packed_size);
176 
179  exr_context_t ctxt,
180  int part_index,
181  int tilex,
182  int tiley,
183  int levelx,
184  int levely,
185  const void* packed_data,
186  uint64_t packed_size,
187  uint64_t unpacked_size,
188  const void* sample_data,
189  uint64_t sample_data_size);
190 
191 #ifdef __cplusplus
192 } /* extern "C" */
193 #endif
194 
195 #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)
Struct to hold an integer box/region definition.
Definition: openexr_attr.h:223
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)
EXR_EXPORT exr_result_t exr_get_chunk_table_offset(exr_const_context_t ctxt, int part_index, uint64_t *chunk_offset_out)
Retrieve the chunk table offset for the part in question.
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
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)
EXR_EXPORT exr_result_t exr_chunk_default_initialize(exr_context_t ctxt, int part_index, const exr_attr_box2i_t *box, int levelx, int levely, exr_chunk_info_t *cinfo)
uint64_t sample_count_table_size