PBRT
/home/felix/UBC/projects/AdaptiveLightfieldSampling/pbrt_v2/src/3rdparty/openexr-1.7.0/ImfPxr24Compressor.h
00001 #ifndef INCLUDED_IMF_PXR24_COMPRESSOR_H
00002 #define INCLUDED_IMF_PXR24_COMPRESSOR_H
00003 
00005 //
00006 // Copyright (c) 2004, Pixar Animation Studios
00007 //
00008 // All rights reserved.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions  are
00012 // met:
00013 // *       Redistributions of source code must retain the above  copyright
00014 // notice, this list of conditions and the following disclaimer.
00015 // *       Redistributions in binary form must reproduce the above
00016 // copyright notice, this list of conditions and the following  disclaimer
00017 // in the documentation and/or other materials provided with the
00018 // distribution.
00019 // *       Neither the name of Pixar Animation Studios nor the names of
00020 // its contributors may be used to endorse or promote products derived
00021 // from this software without specific prior written permission.
00022 //
00023 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00026 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00027 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00028 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00029 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00030 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00031 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 //
00036 
00037 //-----------------------------------------------------------------------------
00038 //
00039 //      class Pxr24Compressor -- Loren Carpenter's 24-bit float compressor
00040 //
00041 //-----------------------------------------------------------------------------
00042 
00043 #include <ImfCompressor.h>
00044 
00045 namespace Imf {
00046 
00047 class ChannelList;
00048 
00049 
00050 class Pxr24Compressor: public Compressor
00051 {
00052   public:
00053 
00054     Pxr24Compressor (const Header &hdr, 
00055                      size_t maxScanLineSize,
00056                      size_t numScanLines);
00057 
00058     virtual ~Pxr24Compressor ();
00059 
00060     virtual int         numScanLines () const;
00061 
00062     virtual Format      format () const;
00063 
00064     virtual int         compress (const char *inPtr,
00065                                   int inSize,
00066                                   int minY,
00067                                   const char *&outPtr);                  
00068                   
00069     virtual int         compressTile (const char *inPtr,
00070                                       int inSize,
00071                                       Imath::Box2i range,
00072                                       const char *&outPtr);
00073 
00074     virtual int         uncompress (const char *inPtr,
00075                                     int inSize,
00076                                     int minY,
00077                                     const char *&outPtr);
00078                     
00079     virtual int         uncompressTile (const char *inPtr,
00080                                         int inSize,
00081                                         Imath::Box2i range,
00082                                         const char *&outPtr);
00083   private:
00084 
00085     int                 compress (const char *inPtr,
00086                                   int inSize,
00087                                   Imath::Box2i range,
00088                                   const char *&outPtr);
00089  
00090     int                 uncompress (const char *inPtr,
00091                                     int inSize,
00092                                     Imath::Box2i range,
00093                                     const char *&outPtr);
00094 
00095     int                 _maxScanLineSize;
00096     int                 _numScanLines;
00097     unsigned char *     _tmpBuffer;
00098     char *              _outBuffer;
00099     const ChannelList & _channels;
00100     int                 _minX;
00101     int                 _maxX;
00102     int                 _maxY;
00103 };
00104 
00105 
00106 } // namespace Imf
00107 
00108 #endif