exr_compression.odin 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package vendor_openexr
  2. import "core:c"
  3. @(link_prefix="exr_", default_calling_convention="c")
  4. foreign lib {
  5. /** Computes a buffer that will be large enough to hold the compressed
  6. * data. This may include some extra padding for headers / scratch */
  7. compress_max_buffer_size :: proc(in_bytes: c.size_t) -> c.size_t ---
  8. /** Compresses a buffer using a zlib style compression.
  9. *
  10. * If the level is -1, will use the default compression set to the library
  11. * \ref set_default_zip_compression_level
  12. * data. This may include some extra padding for headers / scratch */
  13. compress_buffer :: proc(
  14. ctxt: const_context_t,
  15. level: c.int,
  16. in_: rawptr,
  17. in_bytes: c.size_t,
  18. out: rawptr,
  19. out_bytes_avail: c.size_t,
  20. actual_out: ^c.size_t) -> result_t ---
  21. /** Decompresses a buffer using a zlib style compression. */
  22. uncompress_buffer :: proc(
  23. ctxt: const_context_t,
  24. in_: rawptr,
  25. in_bytes: c.size_t,
  26. out: rawptr,
  27. out_bytes_avail: c.size_t,
  28. actual_out: ^c.size_t) -> result_t ---
  29. /** Apply simple run length encoding and put in the output buffer. */
  30. rle_compress_buffer :: proc(
  31. in_bytes: c.size_t,
  32. in_: rawptr,
  33. out: rawptr,
  34. out_bytes_avail: c.size_t) -> c.size_t ---
  35. /** Decode run length encoding and put in the output buffer. */
  36. rle_uncompress_buffer :: proc(
  37. in_bytes: c.size_t,
  38. max_len: c.size_t,
  39. in_: rawptr,
  40. out: rawptr) -> c.size_t ---
  41. /** Routine to query the lines required per chunk to compress with the
  42. * specified method.
  43. *
  44. * This is only meaningful for scanline encodings, tiled
  45. * representations have a different interpretation of this.
  46. *
  47. * These are constant values, this function returns -1 if the compression
  48. * type is unknown.
  49. */
  50. compression_lines_per_chunk :: proc(comptype: compression_t) -> c.int ---
  51. /** Exposes a method to apply compression to a chunk of data.
  52. *
  53. * This can be useful for inheriting default behavior of the
  54. * compression stage of an encoding pipeline, or other helper classes
  55. * to expose compression.
  56. *
  57. * NB: As implied, this function will be used during a normal encode
  58. * and write operation but can be used directly with a temporary
  59. * context (i.e. not running the full encode pipeline).
  60. */
  61. compress_chunk :: proc(encode_state: ^encode_pipeline_t) -> result_t ---
  62. /** Exposes a method to decompress a chunk of data.
  63. *
  64. * This can be useful for inheriting default behavior of the
  65. * uncompression stage of an decoding pipeline, or other helper classes
  66. * to expose compress / uncompress operations.
  67. *
  68. * NB: This function will be used during a normal read and decode
  69. * operation but can be used directly with a temporary context (i.e.
  70. * not running the full decode pipeline).
  71. */
  72. uncompress_chunk :: proc(decode_state: ^decode_pipeline_t) -> result_t ---
  73. }