|
Packit |
0d464f |
///////////////////////////////////////////////////////////////////////////
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// Copyright (c) 2011, 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 IMFDEEPSCANLINEINPUTPART_H_
|
|
Packit |
0d464f |
#define IMFDEEPSCANLINEINPUTPART_H_
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
#include "ImfMultiPartInputFile.h"
|
|
Packit |
0d464f |
#include "ImfDeepScanLineInputFile.h"
|
|
Packit |
0d464f |
#include "ImfDeepScanLineOutputFile.h"
|
|
Packit |
0d464f |
#include "ImfNamespace.h"
|
|
Packit |
0d464f |
#include "ImfExport.h"
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
class IMF_EXPORT DeepScanLineInputPart
|
|
Packit |
0d464f |
{
|
|
Packit |
0d464f |
public:
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//------------------------
|
|
Packit |
0d464f |
// Access to the file name
|
|
Packit |
0d464f |
//------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
const char * fileName () const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//--------------------------
|
|
Packit |
0d464f |
// Access to the file header
|
|
Packit |
0d464f |
//--------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
const Header & header () const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//----------------------------------
|
|
Packit |
0d464f |
// Access to the file format version
|
|
Packit |
0d464f |
//----------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
int version () const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//-----------------------------------------------------------
|
|
Packit |
0d464f |
// Set the current frame buffer -- copies the FrameBuffer
|
|
Packit |
0d464f |
// object into the InputFile object.
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// The current frame buffer is the destination for the pixel
|
|
Packit |
0d464f |
// data read from the file. The current frame buffer must be
|
|
Packit |
0d464f |
// set at least once before readPixels() is called.
|
|
Packit |
0d464f |
// The current frame buffer can be changed after each call
|
|
Packit |
0d464f |
// to readPixels().
|
|
Packit |
0d464f |
//-----------------------------------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//-----------------------------------
|
|
Packit |
0d464f |
// Access to the current frame buffer
|
|
Packit |
0d464f |
//-----------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
const DeepFrameBuffer & frameBuffer () const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//---------------------------------------------------------------
|
|
Packit |
0d464f |
// Check if the file is complete:
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// isComplete() returns true if all pixels in the data window are
|
|
Packit |
0d464f |
// present in the input file, or false if any pixels are missing.
|
|
Packit |
0d464f |
// (Another program may still be busy writing the file, or file
|
|
Packit |
0d464f |
// writing may have been aborted prematurely.)
|
|
Packit |
0d464f |
//---------------------------------------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
bool isComplete () const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//---------------------------------------------------------------
|
|
Packit |
0d464f |
// Read pixel data:
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// readPixels(s1,s2) reads all scan lines with y coordinates
|
|
Packit |
0d464f |
// in the interval [min (s1, s2), max (s1, s2)] from the file,
|
|
Packit |
0d464f |
// and stores them in the current frame buffer.
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// Both s1 and s2 must be within the interval
|
|
Packit |
0d464f |
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// The scan lines can be read from the file in random order, and
|
|
Packit |
0d464f |
// individual scan lines may be skipped or read multiple times.
|
|
Packit |
0d464f |
// For maximum efficiency, the scan lines should be read in the
|
|
Packit |
0d464f |
// order in which they were written to the file.
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// readPixels(s) calls readPixels(s,s).
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// If threading is enabled, readPixels (s1, s2) tries to perform
|
|
Packit |
0d464f |
// decopmression of multiple scanlines in parallel.
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
//---------------------------------------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
void readPixels (int scanLine1, int scanLine2);
|
|
Packit |
0d464f |
void readPixels (int scanLine);
|
|
Packit |
0d464f |
void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
|
|
Packit |
0d464f |
int scanLine1,int scanLine2) const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//----------------------------------------------
|
|
Packit |
0d464f |
// Read a block of raw pixel data from the file,
|
|
Packit |
0d464f |
// without uncompressing it (this function is
|
|
Packit |
0d464f |
// used to implement OutputFile::copyPixels()).
|
|
Packit |
0d464f |
//----------------------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
void rawPixelData (int firstScanLine,
|
|
Packit |
0d464f |
char * pixelData,
|
|
Packit |
0d464f |
Int64 &pixelDataSize);
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
//-----------------------------------------------------------
|
|
Packit |
0d464f |
// Read pixel sample counts into a slice in the frame buffer.
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// readPixelSampleCounts(s1, s2) reads all the counts of
|
|
Packit |
0d464f |
// pixel samples with y coordinates in the interval
|
|
Packit |
0d464f |
// [min (s1, s2), max (s1, s2)] from the file, and stores
|
|
Packit |
0d464f |
// them in the slice naming "sample count".
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// Both s1 and s2 must be within the interval
|
|
Packit |
0d464f |
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
|
Packit |
0d464f |
//
|
|
Packit |
0d464f |
// readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
|
|
Packit |
0d464f |
//-----------------------------------------------------------
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
void readPixelSampleCounts(int scanline1,
|
|
Packit |
0d464f |
int scanline2);
|
|
Packit |
0d464f |
void readPixelSampleCounts(int scanline);
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
|
|
Packit |
0d464f |
int scanLine1 , int scanLine2) const;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
int firstScanLineInChunk(int y) const;
|
|
Packit |
0d464f |
int lastScanLineInChunk (int y) const;
|
|
Packit |
0d464f |
private:
|
|
Packit |
0d464f |
DeepScanLineInputFile *file;
|
|
Packit |
0d464f |
|
|
Packit |
0d464f |
// needed for copyPixels
|
|
Packit |
0d464f |
friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputPart &);
|
|
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 /* IMFDEEPSCANLINEINPUTPART_H_ */
|