ImfHuf.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_HUF_H
  6. #define INCLUDED_IMF_HUF_H
  7. #include "ImfExport.h"
  8. #include "ImfNamespace.h"
  9. //-----------------------------------------------------------------------------
  10. //
  11. // 16-bit Huffman compression and decompression:
  12. //
  13. // hufCompress (r, nr, c)
  14. //
  15. // Compresses the contents of array r (of length nr),
  16. // stores the compressed data in array c, and returns
  17. // the size of the compressed data (in bytes).
  18. //
  19. // To avoid buffer overflows, the size of array c should
  20. // be at least 2 * nr + 65536.
  21. //
  22. // hufUncompress (c, nc, r, nr)
  23. //
  24. // Uncompresses the data in array c (with length nc),
  25. // and stores the results in array r (with length nr).
  26. //
  27. //-----------------------------------------------------------------------------
  28. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  29. IMF_EXPORT
  30. int
  31. hufCompress (const unsigned short raw[/*nRaw*/],
  32. int nRaw,
  33. char compressed[/*2 * nRaw + 65536*/]);
  34. IMF_EXPORT
  35. void
  36. hufUncompress (const char compressed[/*nCompressed*/],
  37. int nCompressed,
  38. unsigned short raw[/*nRaw*/],
  39. int nRaw);
  40. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  41. #endif