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
45namespace Imf {
46
47class ChannelList;
48
49
50class Pxr24Compressor: public Compressor
51{
52  public:
53
54    Pxr24Compressor (const Header &hdr, int maxScanLineSize, int numScanLines);
55    virtual ~Pxr24Compressor ();
56
57    virtual int		numScanLines () const;
58
59    virtual Format	format () const;
60
61    virtual int		compress (const char *inPtr,
62				  int inSize,
63				  int minY,
64				  const char *&outPtr);
65
66    virtual int		compressTile (const char *inPtr,
67				      int inSize,
68				      Imath::Box2i range,
69				      const char *&outPtr);
70
71    virtual int		uncompress (const char *inPtr,
72				    int inSize,
73				    int minY,
74				    const char *&outPtr);
75
76    virtual int		uncompressTile (const char *inPtr,
77					int inSize,
78					Imath::Box2i range,
79					const char *&outPtr);
80  private:
81
82    int			compress (const char *inPtr,
83				  int inSize,
84				  Imath::Box2i range,
85				  const char *&outPtr);
86
87    int			uncompress (const char *inPtr,
88				    int inSize,
89				    Imath::Box2i range,
90				    const char *&outPtr);
91
92    int			_maxScanLineSize;
93    int			_numScanLines;
94    unsigned char *	_tmpBuffer;
95    char *		_outBuffer;
96    const ChannelList &	_channels;
97    int			_minX;
98    int			_maxX;
99    int			_maxY;
100};
101
102
103} // namespace Imf
104
105#endif
106