1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
package vendor_openexr
import "core:c"
/**
* Struct describing raw data information about a chunk.
*
* A chunk is the generic term for a pixel data block in an EXR file,
* as described in the OpenEXR File Layout documentation. This is
* common between all different forms of data that can be stored.
*/
chunk_info_t :: struct {
idx: i32,
/** For tiles, this is the tilex; for scans it is the x. */
start_x: i32,
/** For tiles, this is the tiley; for scans it is the scanline y. */
start_y: i32,
height: i32, /**< For this chunk. */
width: i32, /**< For this chunk. */
level_x: u8, /**< For tiled files. */
level_y: u8, /**< For tiled files. */
type: u8,
compression: u8,
data_offset: u64,
packed_size: u64,
unpacked_size: u64,
sample_count_data_offset: u64,
sample_count_table_size: u64,
}
@(link_prefix="exr_", default_calling_convention="c")
foreign lib {
/** @brief Retrieve the chunk table offset for the part in question.
*/
get_chunk_table_offset :: proc(ctxt: const_context_t , part_index: c.int, chunk_offset_out: ^c.uint64_t) -> result_t ---
/** initialize chunk info with the default values from the specified part
*
* The 'x' and 'y' parameters are used to indicate the starting position
* of the chunk being initialized. This does not perform any I/O to validate
* and so the values are only indicative. (but can be used to do things
* like compress / decompress a chunk without having a file to actually
* read
*/
chunk_default_initialize :: proc(ctxt: context_t, part_index: c.int, box: ^attr_box2i_t, levelx: c.int, levely: c.int, cinfo: ^chunk_info_t) -> result_t ---
read_scanline_chunk_info :: proc(ctxt: const_context_t, part_index: c.int, y: c.int, cinfo: ^chunk_info_t) -> result_t ---
read_tile_chunk_info :: proc(
ctxt: const_context_t,
part_index: c.int,
tilex: c.int,
tiley: c.int,
levelx: c.int,
levely: c.int,
cinfo: ^chunk_info_t) -> result_t ---
/** Read the packed data block for a chunk.
*
* This assumes that the buffer pointed to by @p packed_data is
* large enough to hold the chunk block info packed_size bytes.
*/
read_chunk :: proc(
ctxt: const_context_t,
part_index: c.int,
cinfo: ^chunk_info_t,
packed_data: rawptr) -> result_t ---
/**
* Read chunk for deep data.
*
* This allows one to read the packed data, the sample count data, or both.
* \c exr_read_chunk also works to read deep data packed data,
* but this is a routine to get the sample count table and the packed
* data in one go, or if you want to pre-read the sample count data,
* you can get just that buffer.
*/
read_deep_chunk :: proc(
ctxt: const_context_t,
part_index: c.int,
cinfo: ^chunk_info_t,
packed_data: rawptr,
sample_data: rawptr) -> result_t ---
/**************************************/
/** Initialize a \c chunk_info_t structure when encoding scanline
* data (similar to read but does not do anything with a chunk
* table).
*/
write_scanline_chunk_info :: proc(ctxt: context_t, part_index: c.int, y: c.int, cinfo: ^chunk_info_t) -> result_t ---
/** Initialize a \c chunk_info_t structure when encoding tiled data
* (similar to read but does not do anything with a chunk table).
*/
write_tile_chunk_info :: proc(
ctxt: context_t,
part_index: c.int,
tilex: c.int,
tiley: c.int,
levelx: c.int,
levely: c.int,
cinfo: ^chunk_info_t) -> result_t ---
/**
* @p y must the appropriate starting y for the specified chunk.
*/
write_scanline_chunk :: proc(
ctxt: context_t,
part_index: int,
y: int,
packed_data: rawptr,
packed_size: u64) -> result_t ---
/**
* @p y must the appropriate starting y for the specified chunk.
*/
write_deep_scanline_chunk :: proc(
ctxt: context_t,
part_index: c.int,
y: c.int,
packed_data: rawptr,
packed_size: u64,
unpacked_size: u64,
sample_data: rawptr,
sample_data_size: u64) -> result_t ---
write_tile_chunk :: proc(
ctxt: context_t,
part_index: c.int,
tilex: c.int,
tiley: c.int,
levelx: c.int,
levely: c.int,
packed_data: rawptr,
packed_size: u64) -> result_t ---
write_deep_tile_chunk :: proc(
ctxt: context_t,
part_index: c.int,
tilex: c.int,
tiley: c.int,
levelx: c.int,
levely: c.int,
packed_data: rawptr,
packed_size: u64,
unpacked_size: u64,
sample_data: rawptr,
sample_data_size: u64) -> result_t ---
}
|