aboutsummaryrefslogtreecommitdiff
path: root/vendor/OpenEXRCore/exr_part.odin
blob: 86024b273a5a719c426ce4872a246f2e34ef4a11 (plain)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
package vendor_openexr

import "core:c"

attr_list_access_mode_t :: enum c.int {
	FILE_ORDER,   /**< Order they appear in the file */
	SORTED_ORDER, /**< Alphabetically sorted */
}

@(link_prefix="exr_", default_calling_convention="c")
foreign lib {
	/** @brief Query how many parts are in the file. */
	get_count :: proc (ctxt: const_context_t, count: ^c.int) -> result_t ---

	/** @brief Query the part name for the specified part.
	 *
	 * NB: If this file is a single part file and name has not been set, this
	 * will return `NULL`.
	 */
	get_name :: proc(ctxt: const_context_t, part_index: c.int, out: ^cstring) -> result_t ---

	/** @brief Query the storage type for the specified part. */
	get_storage :: proc(ctxt: const_context_t, part_index: c.int, out: ^storage_t) -> result_t ---

	/** @brief Define a new part in the file. */
	add_part :: proc(
		ctxt:      context_t,
		partname:  rawptr,
		type:      storage_t,
		new_index: ^c.int) -> result_t ---

	/** @brief Query how many levels are in the specified part.
	 *
	 * If the part is a tiled part, fill in how many tile levels are present.
	 *
	 * Return `ERR_SUCCESS` on success, an error otherwise (i.e. if the part
	 * is not tiled).
	 *
	 * It is valid to pass `NULL` to either of the @p levelsx or @p levelsy
	 * arguments, which enables testing if this part is a tiled part, or
	 * if you don't need both (i.e. in the case of a mip-level tiled
	 * image)
	 */
	get_tile_levels :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		levelsx:    ^i32,
		levelsy:    ^i32) -> result_t ---

	/** @brief Query the tile size for a particular level in the specified part.
	 *
	 * If the part is a tiled part, fill in the tile size for the
	 * specified part/level.
	 *
	 * Return `ERR_SUCCESS` on success, an error otherwise (i.e. if the
	 * part is not tiled).
	 *
	 * It is valid to pass `NULL` to either of the @p tilew or @p tileh
	 * arguments, which enables testing if this part is a tiled part, or
	 * if you don't need both (i.e. in the case of a mip-level tiled
	 * image)
	 */
	get_tile_sizes :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		levelx:     c.int,
		levely:     c.int,
		tilew:      ^i32,
		tileh:      ^i32) -> result_t ---
	/** @brief Query the tile count for a particular level in the specified part.
	 *
	 * If the part is a tiled part, fills in the count for the
	 * specified levels.
	 *
	 * Return `ERR_SUCCESS` on success, an error otherwise (i.e. if the part
	 * is not tiled).
	 *
	 * It is valid to pass `NULL` to either of the @p countx or @p county
	 * arguments, which enables testing if this part is a tiled part, or
	 * if you don't need both for some reason.
	 */
	get_tile_counts :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		levelx:     c.int,
		levely:     c.int,
		countx:     ^i32,
		county:     ^i32) -> result_t ---

	/** @brief Query the data sizes for a particular level in the specified part.
	 *
	 * If the part is a tiled part, fill in the width/height for the
	 * specified levels.
	 *
	 * Return `ERR_SUCCESS` on success, an error otherwise (i.e. if the part
	 * is not tiled).
	 *
	 * It is valid to pass `NULL` to either of the @p levw or @p levh
	 * arguments, which enables testing if this part is a tiled part, or
	 * if you don't need both for some reason.
	 */
	get_level_sizes :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		levelx:     c.int,
		levely:     c.int,
		levw:       ^i32,
		levh:       ^i32) -> result_t ---

	/** Return the number of chunks contained in this part of the file.
	 *
	 * As in the technical documentation for OpenEXR, the chunk is the
	 * generic term for a pixel data block. This is the atomic unit that
	 * this library uses to negotiate data to and from a context.
	 *
	 * This should be used as a basis for splitting up how a file is
	 * processed. Depending on the compression, a different number of
	 * scanlines are encoded in each chunk, and since those need to be
	 * encoded/decoded as a block, the chunk should be the basis for I/O
	 * as well.
	 */
	get_chunk_count :: proc(ctxt: const_context_t, part_index: c.int, out: ^i32) -> result_t ---

	/** Return a pointer to the chunk table and the count
	 *
	 * TODO: consider removing this prior to release once C++ fully converted
	 */
	get_chunk_table :: proc(ctxt: const_context_t, part_index: c.int, table: [^][^]u64, count: ^i32) -> result_t ---

	/** Return whether the chunk table for this part is completely written.
	 *
	 * This only validates that all the offsets are valid.
	 *
	 * return EXR_ERR_INCOMPLETE_CHUNK_TABLE when incomplete, EXR_ERR_SUCCESS
	 * if it appears ok, or another error if otherwise problematic
	 */
	exr_validate_chunk_table :: proc(ctxt: context_t, part_index: c.int) -> result_t ---

	/** Return the number of scanlines chunks for this file part.
	 *
	 * When iterating over a scanline file, this may be an easier metric
	 * for multi-threading or other access than only negotiating chunk
	 * counts, and so is provided as a utility.
	 */
	get_scanlines_per_chunk :: proc(ctxt: const_context_t, part_index: c.int, out: ^i32) -> result_t ---

	/** Return the maximum unpacked size of a chunk for the file part.
	 *
	 * This may be used ahead of any actual reading of data, so can be
	 * used to pre-allocate buffers for multiple threads in one block or
	 * whatever your application may require.
	 */
	get_chunk_unpacked_size :: proc(ctxt: const_context_t, part_index: c.int, out: ^u64) -> result_t ---

	/** @brief Retrieve the zip compression level used for the specified part.
	 *
	 * This only applies when the compression method involves using zip
	 * compression (zip, zips, some modes of DWAA/DWAB).
	 *
	 * This value is NOT persisted in the file, and only exists for the
	 * lifetime of the context, so will be at the default value when just
	 * reading a file.
	 */
	get_zip_compression_level :: proc(ctxt: const_context_t, part_index: c.int, level: ^c.int) -> result_t ---

	/** @brief Set the zip compression method used for the specified part.
	 *
	 * This only applies when the compression method involves using zip
	 * compression (zip, zips, some modes of DWAA/DWAB).
	 *
	 * This value is NOT persisted in the file, and only exists for the
	 * lifetime of the context, so this value will be ignored when
	 * reading a file.
	 */
	set_zip_compression_level :: proc(ctxt: context_t, part_index: c.int, level: c.int) -> result_t ---

	/** @brief Retrieve the dwa compression level used for the specified part.
	 *
	 * This only applies when the compression method is DWAA/DWAB.
	 *
	 * This value is NOT persisted in the file, and only exists for the
	 * lifetime of the context, so will be at the default value when just
	 * reading a file.
	 */
	get_dwa_compression_level :: proc(ctxt: const_context_t, part_index: c.int, level: ^f32) -> result_t ---

	/** @brief Set the dwa compression method used for the specified part.
	 *
	 * This only applies when the compression method is DWAA/DWAB.
	 *
	 * This value is NOT persisted in the file, and only exists for the
	 * lifetime of the context, so this value will be ignored when
	 * reading a file.
	 */
	set_dwa_compression_level :: proc(ctxt: context_t, part_index: c.int, level: f32) -> result_t ---

	/**************************************/

	/** @defgroup PartMetadata Functions to get and set metadata for a particular part.
	 * @{
	 *
	 */

	/** @brief Query the count of attributes in a part. */
	get_attribute_count :: proc(ctxt: const_context_t, part_index: c.int, count: ^i32) -> result_t ---

	/** @brief Query a particular attribute by index. */
	get_attribute_by_index :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		mode:       attr_list_access_mode_t,
		idx:        i32,
		outattr:    ^^attribute_t) -> result_t ---

	/** @brief Query a particular attribute by name. */
	get_attribute_by_name :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		outattr:    ^^attribute_t) -> result_t ---

	/** @brief Query the list of attributes in a part.
	 *
	 * This retrieves a list of attributes currently defined in a part.
	 *
	 * If outlist is `NULL`, this function still succeeds, filling only the
	 * count. In this manner, the user can allocate memory for the list of
	 * attributes, then re-call this function to get the full list.
	 */
	get_attribute_list :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		mode:       attr_list_access_mode_t,
		count:      ^i32,
		outlist:    ^[^]attribute_t) -> result_t ---

	/** Declare an attribute within the specified part.
	 *
	 * Only valid when a file is opened for write.
	 */
	attr_declare_by_type :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		type:       cstring,
		newattr:    ^^attribute_t) -> result_t ---

	/** @brief Declare an attribute within the specified part.
	 *
	 * Only valid when a file is opened for write.
	 */
	attr_declare :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		type:       attribute_type_t,
		newattr:    ^^attribute_t) -> result_t ---

	/**
	 * @defgroup RequiredAttributeHelpers Required Attribute Utililities
	 *
	 * @brief These are a group of functions for attributes that are
	 * required to be in every part of every file.
	 *
	 * @{
	 */

	/** @brief Initialize all required attributes for all files.
	 *
	 * NB: other file types do require other attributes, such as the tile
	 * description for a tiled file.
	 */
	initialize_required_attr :: proc(
		ctxt:               context_t,
		part_index:         c.int,
		displayWindow:      ^attr_box2i_t,
		dataWindow:         ^attr_box2i_t,
		pixelaspectratio:   f32,
		screenWindowCenter: attr_v2f_t,
		screenWindowWidth:  f32,
		lineorder:          lineorder_t,
		ctype:              compression_t) -> result_t ---

	/** @brief Initialize all required attributes to default values:
	 *
	 * - `displayWindow` is set to (0, 0 -> @p width - 1, @p height - 1)
	 * - `dataWindow` is set to (0, 0 -> @p width - 1, @p height - 1)
	 * - `pixelAspectRatio` is set to 1.0
	 * - `screenWindowCenter` is set to 0.f, 0.f
	 * - `screenWindowWidth` is set to 1.f
	 * - `lineorder` is set to `INCREASING_Y`
	 * - `compression` is set to @p ctype
	 */
	initialize_required_attr_simple :: proc(
		ctxt:       context_t,
		part_index: c.int,
		width:      i32,
		height:     i32,
		ctype:      compression_t) -> result_t ---

	/** @brief Copy the attributes from one part to another.
	 *
	 * This allows one to quickly unassigned attributes from one source to another.
	 *
	 * If an attribute in the source part has not been yet set in the
	 * destination part, the item will be copied over.
	 *
	 * For example, when you add a part, the storage type and name
	 * attributes are required arguments to the definition of a new part,
	 * but channels has not yet been assigned. So by calling this with an
	 * input file as the source, you can copy the channel definitions (and
	 * any other unassigned attributes from the source).
	 */
	copy_unset_attributes :: proc(
		ctxt:           context_t,
		part_index:     c.int,
		source:         const_context_t,
		src_part_index: c.int) -> result_t ---

	/** @brief Retrieve the list of channels. */
	get_channels :: proc(ctxt: const_context_t, part_index: c.int, chlist: ^^attr_chlist_t) -> result_t ---

	/** @brief Define a new channel to the output file part.
	 *
	 * The @p percept parameter is used for lossy compression techniques
	 * to indicate that the value represented is closer to linear (1) or
	 * closer to logarithmic (0). For r, g, b, luminance, this is normally
	 * 0.
	 */
	add_channel :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		ptype:      pixel_type_t,
		percept:    perceptual_treatment_t,
		xsamp:      i32,
		ysamp:      i32) -> result_t ---

	/** @brief Copy the channels from another source.
	 *
	 * Useful if you are manually constructing the list or simply copying
	 * from an input file.
	 */
	set_channels :: proc(ctxt: context_t, part_index: c.int, channels: ^attr_chlist_t) -> result_t ---

	/** @brief Retrieve the compression method used for the specified part. */
	get_compression :: proc(ctxt: const_context_t, part_index: c.int, compression: ^compression_t) -> result_t ---
	/** @brief Set the compression method used for the specified part. */
	set_compression :: proc(ctxt: context_t, part_index: c.int, ctype: compression_t) -> result_t ---

	/** @brief Retrieve the data window for the specified part. */
	get_data_window :: proc(ctxt: const_context_t, part_index: c.int, out: ^attr_box2i_t) -> result_t ---
	/** @brief Set the data window for the specified part. */
	set_data_window :: proc(ctxt: context_t, part_index: c.int, dw: ^attr_box2i_t) -> c.int ---

	/** @brief Retrieve the display window for the specified part. */
	get_display_window :: proc(ctxt: const_context_t, part_index: c.int, out: ^attr_box2i_t) -> result_t ---
	/** @brief Set the display window for the specified part. */
	set_display_window :: proc(ctxt: context_t, part_index: c.int, dw: ^attr_box2i_t) -> c.int ---

	/** @brief Retrieve the line order for storing data in the specified part (use 0 for single part images). */
	get_lineorder :: proc(ctxt: const_context_t, part_index: c.int, out: ^lineorder_t) -> result_t ---
	/** @brief Set the line order for storing data in the specified part (use 0 for single part images). */
	set_lineorder :: proc(ctxt: context_t, part_index: c.int, lo: lineorder_t) -> result_t ---

	/** @brief Retrieve the pixel aspect ratio for the specified part (use 0 for single part images). */
	get_pixel_aspect_ratio :: proc(ctxt: const_context_t, part_index: c.int, par: ^f32) -> result_t ---
	/** @brief Set the pixel aspect ratio for the specified part (use 0 for single part images). */
	set_pixel_aspect_ratio :: proc(ctxt: context_t, part_index: c.int, par: f32) -> result_t ---

	/** @brief Retrieve the screen oriented window center for the specified part (use 0 for single part images). */
	get_screen_window_center :: proc(ctxt: const_context_t, part_index: c.int, wc: ^attr_v2f_t) -> result_t ---
	/** @brief Set the screen oriented window center for the specified part (use 0 for single part images). */
	set_screen_window_center :: proc(ctxt: context_t, part_index: c.int, wc: ^attr_v2f_t) -> c.int ---

	/** @brief Retrieve the screen oriented window width for the specified part (use 0 for single part images). */
	get_screen_window_width :: proc(ctxt: const_context_t, part_index: c.int, out: ^f32) -> result_t ---
	/** @brief Set the screen oriented window width for the specified part (use 0 for single part images). */
	set_screen_window_width :: proc(ctxt: context_t, part_index: c.int, ssw: f32) -> result_t ---

	/** @brief Retrieve the tiling info for a tiled part (use 0 for single part images). */
	get_tile_descriptor :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		xsize:      ^u32,
		ysize:      ^u32,
		level:      ^tile_level_mode_t,
		round:      ^tile_round_mode_t) -> result_t ---

	/** @brief Set the tiling info for a tiled part (use 0 for single part images). */
	set_tile_descriptor :: proc(
		ctxt:       context_t,
		part_index: c.int,
		x_size:     u32,
		y_size:     u32,
		level_mode: tile_level_mode_t,
		round_mode: tile_round_mode_t) -> result_t ---

	set_name :: proc(ctxt: context_t, part_index: c.int, val: cstring) -> result_t ---

	get_version :: proc(ctxt: const_context_t, part_index: c.int, out: ^i32) -> result_t ---

	set_version :: proc(ctxt: context_t, part_index: c.int, val: i32) -> result_t ---

	set_chunk_count :: proc(ctxt: context_t, part_index: c.int, val: i32) -> result_t ---

	/** @} */ /* required attr group. */

	/**
	 * @defgroup BuiltinAttributeHelpers Attribute utilities for builtin types
	 *
	 * @brief These are a group of functions for attributes that use the builtin types.
	 *
	 * @{
	 */

	attr_get_box2i :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		outval:     ^attr_box2i_t) -> result_t ---

	attr_set_box2i :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		val:        ^attr_box2i_t) -> result_t ---

	attr_get_box2f :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		outval:     ^attr_box2f_t) -> result_t ---

	attr_set_box2f :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		val:        ^attr_box2f_t) -> result_t ---

	/** @brief Zero-copy query of channel data.
	 *
	 * Do not free or manipulate the @p chlist data, or use
	 * after the lifetime of the context.
	 */
	attr_get_channels :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		chlist:     ^^attr_chlist_t) -> result_t ---

	/** @brief This allows one to quickly copy the channels from one file
	 * to another.
	 */
	attr_set_channels :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		channels:   ^attr_chlist_t) -> result_t ---

	attr_get_chromaticities :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		chroma:     ^attr_chromaticities_t) -> result_t ---

	attr_set_chromaticities :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		chroma:     ^attr_chromaticities_t) -> result_t ---

	attr_get_compression :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^compression_t) -> result_t ---

	attr_set_compression :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		comp:       compression_t) -> result_t ---

	attr_get_double :: proc(ctxt: const_context_t, part_index: c.int, name: cstring, out: f64) -> result_t ---

	attr_set_double :: proc(ctxt: context_t, part_index: c.int, name: cstring, val: f64) -> result_t ---

	attr_get_envmap :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^envmap_t) -> result_t ---

	attr_set_envmap :: proc(ctxt: context_t, part_index: c.int, name: cstring, emap: envmap_t) -> result_t ---

	attr_get_float :: proc(ctxt: const_context_t, part_index: c.int, name: cstring, out: ^f32) -> result_t ---

	attr_set_float :: proc(ctxt: context_t, part_index: c.int, name: cstring, val: f32) -> result_t ---

	/** @brief Zero-copy query of float data.
	 *
	 * Do not free or manipulate the @p out data, or use after the
	 * lifetime of the context.
	 */
	attr_get_float_vector :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		sz:         ^i32,
		out:        ^[^]f32) -> result_t ---

	attr_set_float_vector :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		sz:         i32,
		vals:       [^]f32) -> result_t ---

	attr_get_int :: proc(ctxt: const_context_t, part_index: c.int, name: cstring, out: ^i32) -> result_t ---

	attr_set_int :: proc(ctxt: context_t, part_index: c.int, name: cstring, val: i32) -> result_t ---

	attr_get_keycode :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_keycode_t) -> result_t ---

	attr_set_keycode :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		kc:         ^attr_keycode_t) -> result_t ---

	attr_get_lineorder :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^lineorder_t) -> result_t ---

	attr_set_lineorder :: proc(ctxt: context_t, part_index: c.int, name: cstring, lo: lineorder_t) -> result_t ---

	attr_get_m33f :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_m33f_t) -> result_t ---

	attr_set_m33f :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		m:          ^attr_m33f_t) -> result_t ---

	attr_get_m33d :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_m33d_t) -> result_t ---

	attr_set_m33d :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		m:          ^attr_m33d_t) -> result_t ---

	attr_get_m44f :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_m44f_t) -> result_t ---

	attr_set_m44f :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		m:          ^attr_m44f_t) -> result_t ---

	attr_get_m44d :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_m44d_t) -> result_t ---

	attr_set_m44d :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		m:          ^attr_m44d_t) -> result_t ---

	attr_get_preview :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_preview_t) -> result_t ---

	attr_set_preview :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		p:          ^attr_preview_t) -> result_t ---

	attr_get_rational :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_rational_t) -> result_t ---

	attr_set_rational :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		r:          ^attr_rational_t) -> result_t ---

	/** @brief Zero-copy query of string value.
	 *
	 * Do not modify the string pointed to by @p out, and do not use
	 * after the lifetime of the context.
	 */
	attr_get_string :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		length:     ^i32,
		out:        ^cstring) -> result_t ---

	attr_set_string :: proc(ctxt: context_t, part_index: c.int, name: cstring, s: cstring) -> result_t ---

	/** @brief Zero-copy query of string data.
	 *
	 * Do not free the strings pointed to by the array.
	 *
	 * Must provide @p size.
	 *
	 * \p out must be a ``^cstring`` array large enough to hold
	 * the string pointers for the string vector when provided.
	 */
	attr_get_string_vector :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		size:       ^i32,
		out: ^cstring) -> result_t ---

	attr_set_string_vector :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		size:       i32,
		sv: ^cstring) -> result_t ---

	attr_get_tiledesc :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_tiledesc_t) -> result_t ---

	attr_set_tiledesc :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		td:         ^attr_tiledesc_t) -> result_t ---

	attr_get_timecode :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_timecode_t) -> result_t ---

	attr_set_timecode :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		tc:         ^attr_timecode_t) -> result_t ---

	attr_get_v2i :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v2i_t) -> result_t ---

	attr_set_v2i :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v2i_t) -> result_t ---

	attr_get_v2f :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v2f_t) -> result_t ---

	attr_set_v2f :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v2f_t) -> result_t ---

	attr_get_v2d :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v2d_t) -> result_t ---

	attr_set_v2d :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v2d_t) -> result_t ---

	attr_get_v3i :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v3i_t) -> result_t ---

	attr_set_v3i :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v3i_t) -> result_t ---

	attr_get_v3f :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v3f_t) -> result_t ---

	attr_set_v3f :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v3f_t) -> result_t ---

	attr_get_v3d :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		out:        ^attr_v3d_t) -> result_t ---

	attr_set_v3d :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		v:          ^attr_v3d_t) -> result_t ---

	attr_get_user :: proc(
		ctxt:       const_context_t,
		part_index: c.int,
		name:       cstring,
		type:       ^cstring,
		size:       ^i32,
		out:        ^rawptr) -> result_t ---

	attr_set_user :: proc(
		ctxt:       context_t,
		part_index: c.int,
		name:       cstring,
		type:       cstring,
		size:       i32,
		out:        rawptr) -> result_t ---

}