ImfPxr24Compressor.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef INCLUDED_IMF_PXR24_COMPRESSOR_H
  2. #define INCLUDED_IMF_PXR24_COMPRESSOR_H
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright (c) 2004, Pixar Animation Studios
  6. //
  7. // All rights reserved.
  8. //
  9. // Redistribution and use in source and binary forms, with or without
  10. // modification, are permitted provided that the following conditions are
  11. // met:
  12. // * Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. // * Redistributions in binary form must reproduce the above
  15. // copyright notice, this list of conditions and the following disclaimer
  16. // in the documentation and/or other materials provided with the
  17. // distribution.
  18. // * Neither the name of Pixar Animation Studios nor the names of
  19. // its contributors may be used to endorse or promote products derived
  20. // from this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. //
  34. /////////////////////////////////////////////////////////////////////////////
  35. //-----------------------------------------------------------------------------
  36. //
  37. // class Pxr24Compressor -- Loren Carpenter's 24-bit float compressor
  38. //
  39. //-----------------------------------------------------------------------------
  40. #include "ImfCompressor.h"
  41. #include "ImfNamespace.h"
  42. #include "ImfExport.h"
  43. #include "ImfForward.h"
  44. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  45. class Pxr24Compressor: public Compressor
  46. {
  47. public:
  48. IMF_EXPORT
  49. Pxr24Compressor (const Header &hdr,
  50. size_t maxScanLineSize,
  51. size_t numScanLines);
  52. IMF_EXPORT
  53. virtual ~Pxr24Compressor ();
  54. IMF_EXPORT
  55. virtual int numScanLines () const;
  56. IMF_EXPORT
  57. virtual Format format () const;
  58. IMF_EXPORT
  59. virtual int compress (const char *inPtr,
  60. int inSize,
  61. int minY,
  62. const char *&outPtr);
  63. IMF_EXPORT
  64. virtual int compressTile (const char *inPtr,
  65. int inSize,
  66. IMATH_NAMESPACE::Box2i range,
  67. const char *&outPtr);
  68. IMF_EXPORT
  69. virtual int uncompress (const char *inPtr,
  70. int inSize,
  71. int minY,
  72. const char *&outPtr);
  73. IMF_EXPORT
  74. virtual int uncompressTile (const char *inPtr,
  75. int inSize,
  76. IMATH_NAMESPACE::Box2i range,
  77. const char *&outPtr);
  78. private:
  79. int compress (const char *inPtr,
  80. int inSize,
  81. IMATH_NAMESPACE::Box2i range,
  82. const char *&outPtr);
  83. int uncompress (const char *inPtr,
  84. int inSize,
  85. IMATH_NAMESPACE::Box2i range,
  86. const char *&outPtr);
  87. int _maxScanLineSize;
  88. int _numScanLines;
  89. unsigned char * _tmpBuffer;
  90. char * _outBuffer;
  91. const ChannelList & _channels;
  92. int _minX;
  93. int _maxX;
  94. int _maxY;
  95. };
  96. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  97. #endif