HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ImfDeepScanLineInputPart.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
4 // Digital Ltd. LLC
5 //
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 // * Neither the name of Industrial Light & Magic nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
33 ///////////////////////////////////////////////////////////////////////////
34 
35 
36 #ifndef IMFDEEPSCANLINEINPUTPART_H_
37 #define IMFDEEPSCANLINEINPUTPART_H_
38 
39 #include "ImfMultiPartInputFile.h"
42 #include "ImfNamespace.h"
43 #include "ImfExport.h"
44 
46 
48 {
49  public:
50 
51  DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
52 
53  //------------------------
54  // Access to the file name
55  //------------------------
56 
57  const char * fileName () const;
58 
59 
60  //--------------------------
61  // Access to the file header
62  //--------------------------
63 
64  const Header & header () const;
65 
66 
67  //----------------------------------
68  // Access to the file format version
69  //----------------------------------
70 
71  int version () const;
72 
73 
74  //-----------------------------------------------------------
75  // Set the current frame buffer -- copies the FrameBuffer
76  // object into the InputFile object.
77  //
78  // The current frame buffer is the destination for the pixel
79  // data read from the file. The current frame buffer must be
80  // set at least once before readPixels() is called.
81  // The current frame buffer can be changed after each call
82  // to readPixels().
83  //-----------------------------------------------------------
84 
85  void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
86 
87 
88  //-----------------------------------
89  // Access to the current frame buffer
90  //-----------------------------------
91 
92  const DeepFrameBuffer & frameBuffer () const;
93 
94 
95  //---------------------------------------------------------------
96  // Check if the file is complete:
97  //
98  // isComplete() returns true if all pixels in the data window are
99  // present in the input file, or false if any pixels are missing.
100  // (Another program may still be busy writing the file, or file
101  // writing may have been aborted prematurely.)
102  //---------------------------------------------------------------
103 
104  bool isComplete () const;
105 
106 
107  //---------------------------------------------------------------
108  // Read pixel data:
109  //
110  // readPixels(s1,s2) reads all scan lines with y coordinates
111  // in the interval [min (s1, s2), max (s1, s2)] from the file,
112  // and stores them in the current frame buffer.
113  //
114  // Both s1 and s2 must be within the interval
115  // [header().dataWindow().min.y, header.dataWindow().max.y]
116  //
117  // The scan lines can be read from the file in random order, and
118  // individual scan lines may be skipped or read multiple times.
119  // For maximum efficiency, the scan lines should be read in the
120  // order in which they were written to the file.
121  //
122  // readPixels(s) calls readPixels(s,s).
123  //
124  // If threading is enabled, readPixels (s1, s2) tries to perform
125  // decopmression of multiple scanlines in parallel.
126  //
127  //---------------------------------------------------------------
128 
129  void readPixels (int scanLine1, int scanLine2);
130  void readPixels (int scanLine);
131  void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
132  int scanLine1,int scanLine2) const;
133 
134  //----------------------------------------------
135  // Read a block of raw pixel data from the file,
136  // without uncompressing it (this function is
137  // used to implement OutputFile::copyPixels()).
138  //----------------------------------------------
139 
140  void rawPixelData (int firstScanLine,
141  char * pixelData,
142  Int64 &pixelDataSize);
143 
144 
145  //-----------------------------------------------------------
146  // Read pixel sample counts into a slice in the frame buffer.
147  //
148  // readPixelSampleCounts(s1, s2) reads all the counts of
149  // pixel samples with y coordinates in the interval
150  // [min (s1, s2), max (s1, s2)] from the file, and stores
151  // them in the slice naming "sample count".
152  //
153  // Both s1 and s2 must be within the interval
154  // [header().dataWindow().min.y, header.dataWindow().max.y]
155  //
156  // readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
157  //-----------------------------------------------------------
158 
159  void readPixelSampleCounts(int scanline1,
160  int scanline2);
161  void readPixelSampleCounts(int scanline);
162 
163  void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
164  int scanLine1 , int scanLine2) const;
165 
166  int firstScanLineInChunk(int y) const;
167  int lastScanLineInChunk (int y) const;
168  private:
169  DeepScanLineInputFile *file;
170 
171  // needed for copyPixels
173 };
174 
176 
177 
178 
179 
180 
181 #endif /* IMFDEEPSCANLINEINPUTPART_H_ */
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
void copyPixels(DeepScanLineInputFile &in)
GLint y
Definition: glcorearb.h:102
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER typedef long long unsigned int Int64
Definition: ImathInt64.h:56
#define IMF_EXPORT
Definition: ImfExport.h:59
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108