Blame IlmImf/ImfTileOffsets.h

Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
//
Packit 0d464f
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
Packit 0d464f
// Digital Ltd. LLC
Packit 0d464f
// 
Packit 0d464f
// All rights reserved.
Packit 0d464f
// 
Packit 0d464f
// Redistribution and use in source and binary forms, with or without
Packit 0d464f
// modification, are permitted provided that the following conditions are
Packit 0d464f
// met:
Packit 0d464f
// *       Redistributions of source code must retain the above copyright
Packit 0d464f
// notice, this list of conditions and the following disclaimer.
Packit 0d464f
// *       Redistributions in binary form must reproduce the above
Packit 0d464f
// copyright notice, this list of conditions and the following disclaimer
Packit 0d464f
// in the documentation and/or other materials provided with the
Packit 0d464f
// distribution.
Packit 0d464f
// *       Neither the name of Industrial Light & Magic nor the names of
Packit 0d464f
// its contributors may be used to endorse or promote products derived
Packit 0d464f
// from this software without specific prior written permission. 
Packit 0d464f
// 
Packit 0d464f
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 0d464f
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 0d464f
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 0d464f
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 0d464f
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 0d464f
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 0d464f
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 0d464f
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 0d464f
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 0d464f
//
Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
Packit 0d464f
Packit 0d464f
#ifndef INCLUDED_IMF_TILE_OFFSETS_H
Packit 0d464f
#define INCLUDED_IMF_TILE_OFFSETS_H
Packit 0d464f
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
//
Packit 0d464f
//	class TileOffsets
Packit 0d464f
//
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
Packit 0d464f
#include "ImfTileDescription.h"
Packit 0d464f
#include "ImfInt64.h"
Packit 0d464f
#include <vector>
Packit 0d464f
#include "ImfNamespace.h"
Packit 0d464f
#include "ImfForward.h"
Packit 0d464f
#include "ImfExport.h"
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit 0d464f
Packit 0d464f
Packit 0d464f
class IMF_EXPORT TileOffsets
Packit 0d464f
{
Packit 0d464f
  public:
Packit 0d464f
Packit 0d464f
    TileOffsets (LevelMode mode = ONE_LEVEL,
Packit 0d464f
		 int numXLevels = 0,
Packit 0d464f
		 int numYLevels = 0,
Packit 0d464f
		 const int *numXTiles = 0,
Packit 0d464f
		 const int *numYTiles = 0);    
Packit 0d464f
Packit 0d464f
    // --------
Packit 0d464f
    // File I/O
Packit 0d464f
    // --------
Packit 0d464f
Packit 0d464f
    void		readFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,  bool &complete,bool isMultiPart,bool isDeep);
Packit 0d464f
    void                readFrom (std::vector<Int64> chunkOffsets,bool &complete);
Packit 0d464f
    Int64		writeTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os) const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //-----------------------------------------------------------
Packit 0d464f
    // Test if the tileOffsets array is empty (all entries are 0)
Packit 0d464f
    //-----------------------------------------------------------
Packit 0d464f
Packit 0d464f
    bool		isEmpty () const;
Packit 0d464f
    
Packit 0d464f
    
Packit 0d464f
    
Packit 0d464f
    //-----------------------------------------------------------
Packit 0d464f
    // populate 'list' with tiles coordinates in the order they appear
Packit 0d464f
    // in the offset table (assumes full table!
Packit 0d464f
    // each array myst be at leat totalTiles long
Packit 0d464f
    //-----------------------------------------------------------
Packit 0d464f
    void getTileOrder(int dx_table[], int dy_table[], int lx_table[], int ly_table[]) const;
Packit 0d464f
    
Packit 0d464f
    
Packit 0d464f
    //-----------------------
Packit 0d464f
    // Access to the elements
Packit 0d464f
    //-----------------------
Packit 0d464f
Packit 0d464f
    Int64 &		operator () (int dx, int dy, int lx, int ly);
Packit 0d464f
    Int64 &		operator () (int dx, int dy, int l);
Packit 0d464f
    const Int64 &	operator () (int dx, int dy, int lx, int ly) const;
Packit 0d464f
    const Int64 &	operator () (int dx, int dy, int l) const;
Packit 0d464f
    bool        isValidTile (int dx, int dy, int lx, int ly) const;
Packit 0d464f
    const std::vector<std::vector<std::vector <Int64> > >& getOffsets() const;
Packit 0d464f
    
Packit 0d464f
  private:
Packit 0d464f
Packit 0d464f
    void		findTiles (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, bool isMultiPartFile,
Packit 0d464f
                                   bool isDeep,
Packit 0d464f
        		           bool skipOnly);
Packit 0d464f
    void		reconstructFromFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,bool isMultiPartFile,bool isDeep);
Packit 0d464f
    bool		readTile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is);
Packit 0d464f
    bool		anyOffsetsAreInvalid () const;
Packit 0d464f
Packit 0d464f
    LevelMode		_mode;
Packit 0d464f
    int			_numXLevels;
Packit 0d464f
    int			_numYLevels;
Packit 0d464f
Packit 0d464f
    std::vector<std::vector<std::vector <Int64> > > _offsets;
Packit 0d464f
    
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit 0d464f
Packit 0d464f
Packit 0d464f
Packit 0d464f
Packit 0d464f
Packit 0d464f
#endif