HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ImfDeepScanLineInputFile.h
Go to the documentation of this file.
1
//
2
// SPDX-License-Identifier: BSD-3-Clause
3
// Copyright (c) Contributors to the OpenEXR Project.
4
//
5
6
#ifndef INCLUDED_IMF_DEEP_SCAN_LINE_INPUT_FILE_H
7
#define INCLUDED_IMF_DEEP_SCAN_LINE_INPUT_FILE_H
8
9
//-----------------------------------------------------------------------------
10
//
11
// class DeepScanLineInputFile
12
//
13
//-----------------------------------------------------------------------------
14
15
#include "
ImfForward.h
"
16
17
#include "
ImfContext.h
"
18
19
#include "
ImfDeepScanLineOutputFile.h
"
20
21
#include "
ImfThreading.h
"
22
23
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
24
25
class
IMF_EXPORT_TYPE
DeepScanLineInputFile
26
{
27
public
:
28
//------------
29
// Constructor
30
//------------
31
32
IMF_EXPORT
33
DeepScanLineInputFile
(
34
const
char
*
filename
,
35
const
ContextInitializer
& ctxtinit,
36
int
numThreads =
globalThreadCount
());
37
38
IMF_EXPORT
39
DeepScanLineInputFile
(
40
const
char
fileName[],
int
numThreads =
globalThreadCount
());
41
42
IMF_EXPORT
43
DeepScanLineInputFile
(
44
OPENEXR_IMF_INTERNAL_NAMESPACE::IStream
& is,
45
int
numThreads =
globalThreadCount
());
46
47
IMF_EXPORT
48
DeepScanLineInputFile
(
49
const
Header
& header,
50
OPENEXR_IMF_INTERNAL_NAMESPACE::IStream
* is,
51
int
version
,
/*version field from file*/
52
int
numThreads =
globalThreadCount
());
53
54
//------------------------
55
// Access to the file name
56
//------------------------
57
58
IMF_EXPORT
59
const
char
* fileName ()
const
;
60
61
//--------------------------
62
// Access to the file header
63
//--------------------------
64
65
IMF_EXPORT
66
const
Header
& header ()
const
;
67
68
//----------------------------------
69
// Access to the file format version
70
//----------------------------------
71
72
IMF_EXPORT
73
int
version
()
const
;
74
75
//-----------------------------------------------------------
76
// Set the current frame buffer -- copies the FrameBuffer
77
// object into the InputFile object.
78
//
79
// The current frame buffer is the destination for the pixel
80
// data read from the file. The current frame buffer must be
81
// set at least once before readPixels() is called.
82
// The current frame buffer can be changed after each call
83
// to readPixels().
84
//-----------------------------------------------------------
85
86
IMF_EXPORT
87
void
setFrameBuffer (
const
DeepFrameBuffer
& frameBuffer);
88
89
//-----------------------------------
90
// Access to the current frame buffer
91
//-----------------------------------
92
93
IMF_EXPORT
94
const
DeepFrameBuffer
& frameBuffer ()
const
;
95
96
//---------------------------------------------------------------
97
// Check if the file is complete:
98
//
99
// isComplete() returns true if all pixels in the data window are
100
// present in the input file, or false if any pixels are missing.
101
// (Another program may still be busy writing the file, or file
102
// writing may have been aborted prematurely.)
103
//---------------------------------------------------------------
104
105
IMF_EXPORT
106
bool
isComplete ()
const
;
107
108
//---------------------------------------------------------------
109
// Read pixel data:
110
//
111
// readPixels(s1,s2) reads all scan lines with y coordinates
112
// in the interval [min (s1, s2), max (s1, s2)] from the file,
113
// and stores them in the current frame buffer.
114
//
115
// Both s1 and s2 must be within the interval
116
// [header().dataWindow().min.y, header.dataWindow().max.y]
117
//
118
// The scan lines can be read from the file in random order, and
119
// individual scan lines may be skipped or read multiple times.
120
// For maximum efficiency, the scan lines should be read in the
121
// order in which they were written to the file.
122
//
123
// readPixels(s) calls readPixels(s,s).
124
//
125
// If threading is enabled, readPixels (s1, s2) tries to perform
126
// decopmression of multiple scanlines in parallel.
127
//
128
//---------------------------------------------------------------
129
130
IMF_EXPORT
131
void
readPixels (
int
scanLine1,
int
scanLine2);
132
IMF_EXPORT
133
void
readPixels (
int
scanLine);
134
135
//---------------------------------------------------------------
136
// Extract pixel data from pre-read block
137
//
138
// readPixels(rawPixelData,frameBuffer,s1,s2) reads all scan lines with y coordinates
139
// in the interval [min (s1, s2), max (s1, s2)] from the data provided and
140
// stores them in the provided frameBuffer.
141
// the data can be obtained from a call to rawPixelData()
142
//
143
//
144
// Both s1 and s2 must be within the data specified
145
//
146
// you must provide a frameBuffer with a samplecountslice, which must have been read
147
// and the data valid - readPixels uses your sample count buffer to compute
148
// offsets to the data it needs
149
//
150
// This call does not block, and is thread safe for clients with an existing
151
// threading model. The InputFile's frameBuffer is not used in this call.
152
//
153
// This call is only provided for clients which have an existing threading model in place
154
// and unpredictable access patterns to the data.
155
// The fastest way to read an entire image is to enable threading,use setFrameBuffer then
156
// readPixels(header().dataWindow().min.y, header.dataWindow().max.y)
157
//
158
//---------------------------------------------------------------
159
160
IMF_EXPORT
161
void
readPixels (
162
const
char
* rawPixelData,
163
const
DeepFrameBuffer
& frameBuffer,
164
int
scanLine1,
165
int
scanLine2)
const
;
166
167
//----------------------------------------------
168
// Read a block of raw pixel data from the file,
169
// without uncompressing it (this function is
170
// used to implement OutputFile::copyPixels()).
171
// note: returns the entire payload of the relevant chunk of data, not including part number
172
// including compressed and uncompressed sizes
173
// on entry, if pixelDataSize is insufficiently large, no bytes are read (pixelData can safely be NULL)
174
// on exit, pixelDataSize is the number of bytes required to read the chunk
175
//
176
//----------------------------------------------
177
178
IMF_EXPORT
179
void
180
rawPixelData (
int
firstScanLine,
char
* pixelData, uint64_t& pixelDataSize);
181
182
//-------------------------------------------------
183
// firstScanLineInChunk() returns the row number of the first row that's stored in the
184
// same chunk as scanline y. Depending on the compression mode, this may not be the same as y
185
//
186
// lastScanLineInChunk() returns the row number of the last row that's stored in the same
187
// chunk as scanline y. Depending on the compression mode, this may not be the same as y.
188
// The last chunk in the file may be smaller than all the others
189
//
190
//------------------------------------------------
191
IMF_EXPORT
192
int
firstScanLineInChunk (
int
y
)
const
;
193
IMF_EXPORT
194
int
lastScanLineInChunk (
int
y)
const
;
195
196
//-----------------------------------------------------------
197
// Read pixel sample counts into a slice in the frame buffer.
198
//
199
// readPixelSampleCounts(s1, s2) reads all the counts of
200
// pixel samples with y coordinates in the interval
201
// [min (s1, s2), max (s1, s2)] from the file, and stores
202
// them in the slice naming "sample count".
203
//
204
// Both s1 and s2 must be within the interval
205
// [header().dataWindow().min.y, header.dataWindow().max.y]
206
//
207
// readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
208
//
209
//-----------------------------------------------------------
210
211
IMF_EXPORT
212
void
readPixelSampleCounts (
int
scanline1,
int
scanline2);
213
IMF_EXPORT
214
void
readPixelSampleCounts (
int
scanline);
215
216
//----------------------------------------------------------
217
// Read pixel sample counts into the provided frameBuffer
218
// using a block read of data read by rawPixelData
219
// for multi-scanline compression schemes, you must decode the entire block
220
// so scanline1=firstScanLineInChunk(y) and scanline2=lastScanLineInChunk(y)
221
//
222
// This call does not block, and is thread safe for clients with an existing
223
// threading model. The InputFile's frameBuffer is not used in this call.
224
//
225
// The fastest way to read an entire image is to enable threading in OpenEXR, use setFrameBuffer then
226
// readPixelSampleCounts(header().dataWindow().min.y, header.dataWindow().max.y)
227
//
228
//----------------------------------------------------------
229
IMF_EXPORT
230
void
readPixelSampleCounts (
231
const
char
* rawdata,
232
const
DeepFrameBuffer
& frameBuffer,
233
int
scanLine1,
234
int
scanLine2)
const
;
235
236
private
:
237
Context
_ctxt;
238
struct
IMF_HIDDEN
Data;
239
std::shared_ptr<Data> _data;
240
241
IMF_HIDDEN
DeepScanLineInputFile
(InputPartData* part);
242
243
friend
class
MultiPartInputFile
;
244
friend
class
InputFile
;
245
246
friend
void
DeepScanLineOutputFile::copyPixels
(DeepScanLineInputFile&);
247
};
248
249
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
250
251
#endif
GT_Names::filename
GT_API const UT_StringHolder filename
DeepScanLineInputFile
Definition:
ImfDeepScanLineInputFile.h:25
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition:
ImfNamespace.h:83
ImfThreading.h
ImfContext.h
InputFile
Provides generic access to read an image from an EXR file.
Definition:
ImfInputFile.h:64
y
GLint y
Definition:
glcorearb.h:103
IMF_HIDDEN
#define IMF_HIDDEN
Definition:
ImfExport.h:55
ContextInitializer
ContextInitializer provides a basic type to initialize a Context with.
Definition:
ImfContextInit.h:20
MultiPartInputFile
TODO: Document this.
Definition:
ImfMultiPartInputFile.h:20
ImfDeepScanLineOutputFile.h
IMF_EXPORT
#define IMF_EXPORT
Definition:
ImfExport.h:54
ImfForward.h
GT_Names::version
GT_API const UT_StringHolder version
DeepScanLineInputFile
class IMF_EXPORT_TYPE DeepScanLineInputFile
Definition:
ImfForward.h:38
DeepScanLineOutputFile::copyPixels
IMF_EXPORT void copyPixels(DeepScanLineInputFile &in)
globalThreadCount
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER IMF_EXPORT int globalThreadCount()
Context
Context provides a wrapper around the Core library context object.
Definition:
ImfContext.h:30
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition:
ImfNamespace.h:80
Header
Definition:
ImfHeader.h:36
DeepFrameBuffer
Definition:
ImfDeepFrameBuffer.h:66
IMF_EXPORT_TYPE
#define IMF_EXPORT_TYPE
Definition:
ImfExport.h:57
IStream
class IMF_EXPORT_TYPE IStream
Definition:
ImfForward.h:87
OpenEXR
ImfDeepScanLineInputFile.h
Generated on Wed Aug 27 2025 03:06:53 for HDK by
1.8.6