Blame IlmImf/ImfDeepScanLineInputPart.h

Packit Service 6754ca
///////////////////////////////////////////////////////////////////////////
Packit Service 6754ca
//
Packit Service 6754ca
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
Packit Service 6754ca
// Digital Ltd. LLC
Packit Service 6754ca
//
Packit Service 6754ca
// All rights reserved.
Packit Service 6754ca
//
Packit Service 6754ca
// Redistribution and use in source and binary forms, with or without
Packit Service 6754ca
// modification, are permitted provided that the following conditions are
Packit Service 6754ca
// met:
Packit Service 6754ca
// *       Redistributions of source code must retain the above copyright
Packit Service 6754ca
// notice, this list of conditions and the following disclaimer.
Packit Service 6754ca
// *       Redistributions in binary form must reproduce the above
Packit Service 6754ca
// copyright notice, this list of conditions and the following disclaimer
Packit Service 6754ca
// in the documentation and/or other materials provided with the
Packit Service 6754ca
// distribution.
Packit Service 6754ca
// *       Neither the name of Industrial Light & Magic nor the names of
Packit Service 6754ca
// its contributors may be used to endorse or promote products derived
Packit Service 6754ca
// from this software without specific prior written permission.
Packit Service 6754ca
//
Packit Service 6754ca
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 6754ca
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 6754ca
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 6754ca
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 6754ca
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 6754ca
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 6754ca
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 6754ca
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 6754ca
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 6754ca
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 6754ca
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 6754ca
//
Packit Service 6754ca
///////////////////////////////////////////////////////////////////////////
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
#ifndef IMFDEEPSCANLINEINPUTPART_H_
Packit Service 6754ca
#define IMFDEEPSCANLINEINPUTPART_H_
Packit Service 6754ca
Packit Service 6754ca
#include "ImfMultiPartInputFile.h"
Packit Service 6754ca
#include "ImfDeepScanLineInputFile.h"
Packit Service 6754ca
#include "ImfDeepScanLineOutputFile.h"
Packit Service 6754ca
#include "ImfNamespace.h"
Packit Service 6754ca
#include "ImfExport.h"
Packit Service 6754ca
Packit Service 6754ca
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit Service 6754ca
Packit Service 6754ca
class IMF_EXPORT DeepScanLineInputPart
Packit Service 6754ca
{
Packit Service 6754ca
  public:
Packit Service 6754ca
Packit Service 6754ca
    DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
Packit Service 6754ca
Packit Service 6754ca
    //------------------------
Packit Service 6754ca
    // Access to the file name
Packit Service 6754ca
    //------------------------
Packit Service 6754ca
Packit Service 6754ca
    const char *        fileName () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //--------------------------
Packit Service 6754ca
    // Access to the file header
Packit Service 6754ca
    //--------------------------
Packit Service 6754ca
Packit Service 6754ca
    const Header &      header () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //----------------------------------
Packit Service 6754ca
    // Access to the file format version
Packit Service 6754ca
    //----------------------------------
Packit Service 6754ca
Packit Service 6754ca
    int                 version () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-----------------------------------------------------------
Packit Service 6754ca
    // Set the current frame buffer -- copies the FrameBuffer
Packit Service 6754ca
    // object into the InputFile object.
Packit Service 6754ca
    //
Packit Service 6754ca
    // The current frame buffer is the destination for the pixel
Packit Service 6754ca
    // data read from the file.  The current frame buffer must be
Packit Service 6754ca
    // set at least once before readPixels() is called.
Packit Service 6754ca
    // The current frame buffer can be changed after each call
Packit Service 6754ca
    // to readPixels().
Packit Service 6754ca
    //-----------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                setFrameBuffer (const DeepFrameBuffer &frameBuffer);
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-----------------------------------
Packit Service 6754ca
    // Access to the current frame buffer
Packit Service 6754ca
    //-----------------------------------
Packit Service 6754ca
Packit Service 6754ca
    const DeepFrameBuffer & frameBuffer () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //---------------------------------------------------------------
Packit Service 6754ca
    // Check if the file is complete:
Packit Service 6754ca
    //
Packit Service 6754ca
    // isComplete() returns true if all pixels in the data window are
Packit Service 6754ca
    // present in the input file, or false if any pixels are missing.
Packit Service 6754ca
    // (Another program may still be busy writing the file, or file
Packit Service 6754ca
    // writing may have been aborted prematurely.)
Packit Service 6754ca
    //---------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    bool                isComplete () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //---------------------------------------------------------------
Packit Service 6754ca
    // Read pixel data:
Packit Service 6754ca
    //
Packit Service 6754ca
    // readPixels(s1,s2) reads all scan lines with y coordinates
Packit Service 6754ca
    // in the interval [min (s1, s2), max (s1, s2)] from the file,
Packit Service 6754ca
    // and stores them in the current frame buffer.
Packit Service 6754ca
    //
Packit Service 6754ca
    // Both s1 and s2 must be within the interval
Packit Service 6754ca
    // [header().dataWindow().min.y, header.dataWindow().max.y]
Packit Service 6754ca
    //
Packit Service 6754ca
    // The scan lines can be read from the file in random order, and
Packit Service 6754ca
    // individual scan lines may be skipped or read multiple times.
Packit Service 6754ca
    // For maximum efficiency, the scan lines should be read in the
Packit Service 6754ca
    // order in which they were written to the file.
Packit Service 6754ca
    //
Packit Service 6754ca
    // readPixels(s) calls readPixels(s,s).
Packit Service 6754ca
    //
Packit Service 6754ca
    // If threading is enabled, readPixels (s1, s2) tries to perform
Packit Service 6754ca
    // decopmression of multiple scanlines in parallel.
Packit Service 6754ca
    //
Packit Service 6754ca
    //---------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                readPixels (int scanLine1, int scanLine2);
Packit Service 6754ca
    void                readPixels (int scanLine);
Packit Service 6754ca
    void                readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
Packit Service 6754ca
                                    int scanLine1,int scanLine2) const;
Packit Service 6754ca
Packit Service 6754ca
    //----------------------------------------------
Packit Service 6754ca
    // Read a block of raw pixel data from the file,
Packit Service 6754ca
    // without uncompressing it (this function is
Packit Service 6754ca
    // used to implement OutputFile::copyPixels()).
Packit Service 6754ca
    //----------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                rawPixelData (int firstScanLine,
Packit Service 6754ca
                                      char * pixelData,
Packit Service 6754ca
                                      Int64 &pixelDataSize);
Packit Service 6754ca
                             
Packit Service 6754ca
                                      
Packit Service 6754ca
    //-----------------------------------------------------------
Packit Service 6754ca
    // Read pixel sample counts into a slice in the frame buffer.
Packit Service 6754ca
    //
Packit Service 6754ca
    // readPixelSampleCounts(s1, s2) reads all the counts of
Packit Service 6754ca
    // pixel samples with y coordinates in the interval
Packit Service 6754ca
    // [min (s1, s2), max (s1, s2)] from the file, and stores
Packit Service 6754ca
    // them in the slice naming "sample count".
Packit Service 6754ca
    //
Packit Service 6754ca
    // Both s1 and s2 must be within the interval
Packit Service 6754ca
    // [header().dataWindow().min.y, header.dataWindow().max.y]
Packit Service 6754ca
    //
Packit Service 6754ca
    // readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
Packit Service 6754ca
    //-----------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                readPixelSampleCounts(int scanline1,
Packit Service 6754ca
                                              int scanline2);
Packit Service 6754ca
    void                readPixelSampleCounts(int scanline);
Packit Service 6754ca
    
Packit Service 6754ca
    void                readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
Packit Service 6754ca
                                               int scanLine1 , int scanLine2) const;
Packit Service 6754ca
                                               
Packit Service 6754ca
    int                 firstScanLineInChunk(int y) const;
Packit Service 6754ca
    int                 lastScanLineInChunk (int y) const;
Packit Service 6754ca
  private:
Packit Service 6754ca
    DeepScanLineInputFile *file;
Packit Service 6754ca
    
Packit Service 6754ca
    // needed for copyPixels 
Packit Service 6754ca
    friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputPart &);
Packit Service 6754ca
};
Packit Service 6754ca
Packit Service 6754ca
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
#endif /* IMFDEEPSCANLINEINPUTPART_H_ */