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