NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ImageTiffIO.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2011, NVIDIA Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA Corporation nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "io/ImageTiffIO.hpp"
29 #include "gui/Image.hpp"
30 #include "base/Hash.hpp"
31 #include "io/Stream.hpp"
32 
33 using namespace FW;
34 
35 //------------------------------------------------------------------------
36 
37 namespace FW
38 {
39 
40 class Input
41 {
42 public:
43  Input (InputStream& s, bool le, int ofs) : m_stream(s), m_littleEndian(le), m_data(NULL, ofs), m_ofs(ofs) {}
44  ~Input (void) {}
45 
46  U32 tell (void) const { return m_ofs; }
47  void seek (U32 ofs) { fill(ofs); m_ofs = ofs; }
48 
49  const U8* read (int num) { m_ofs += num; fill(m_ofs); return m_data.getPtr(m_ofs - num); }
50  U8 readU8 (void) { return *read(1); }
51  U16 readU16 (void) { const U8* p = read(2); return (U16)((m_littleEndian) ? (p[0] | (p[1] << 8)) : ((p[0] << 8) | p[1])); }
52  U32 readU32 (void) { const U8* p = read(4); return (m_littleEndian) ? (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)) : ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); }
53 
54 private:
55  void fill (U32 ofs) { U32 old = m_data.getSize(); if (ofs > old) { m_data.resize(ofs); m_stream.readFully(m_data.getPtr(old), ofs - old); } }
56 
57 private:
58  Input (const Input&); // forbidden
59  Input& operator= (const Input&); // forbidden
60 
61 private:
62  InputStream& m_stream;
63  bool m_littleEndian;
64  Array<U8> m_data;
65  U32 m_ofs;
66 };
67 
69 {
70  Tiff_Byte = 1,
73  Tiff_Long = 4,
75 };
76 
77 }
78 
79 //------------------------------------------------------------------------
80 
82 {
83  // Detect endianess and check format.
84 
85  U8 endianTag = stream.readU8();
86  Input in(stream, (endianTag == 'I'), 1);
87  if ((endianTag != 'I' && endianTag != 'M') || in.readU8() != endianTag || in.readU16() != 42)
88  setError("Not a TIFF file!");
89 
90  // Read directory header.
91 
92  U32 dirOfs = in.readU32();
93  in.seek(dirOfs);
94  int numEntries = in.readU16();
95  if (!dirOfs || !numEntries)
96  setError("Corrupt TIFF directory!");
97 
98  // Read directory entries.
99 
100  Hash<U32, Array<U32> > entries;
101  for (int i = 0; i < numEntries && !hasError(); i++)
102  {
103  U16 tag = in.readU16();
104  U16 type = in.readU16();
105  U32 count = in.readU32();
106  U32 ofs = in.readU32();
107 
108  // Check type and count.
109 
110  int typeSize;
111  switch (type)
112  {
113  case 1: typeSize = 1; break; // BYTE
114  case 3: typeSize = 2; break; // SHORT
115  case 4: typeSize = 4; break; // LONG
116  default: typeSize = 0; break;
117  }
118 
119  if (!typeSize)
120  continue;
121 
122  // Seek to the value.
123 
124  U32 oldOfs = in.tell();
125  if (typeSize * count <= 4)
126  in.seek(oldOfs - 4);
127  else
128  in.seek(ofs);
129 
130  // Read value.
131 
132  Array<U32>& data = entries.add(tag);
133  data.resize(count);
134  for (int j = 0; j < (int)count; j++)
135  {
136  switch (typeSize)
137  {
138  case 1: data[j] = in.readU8(); break;
139  case 2: data[j] = in.readU16(); break;
140  case 4: data[j] = in.readU32(); break;
141  default: FW_ASSERT(false); break;
142  }
143  }
144  in.seek(oldOfs);
145  }
146 
147  // Find relevant entries and check their sizes.
148 
149  const Array<U32>* width = entries.search(256); // ImageWidth
150  const Array<U32>* height = entries.search(257); // ImageLength
151  const Array<U32>* numBits = entries.search(258); // BitsPerSample
152  const Array<U32>* compression = entries.search(259); // Compression
153  const Array<U32>* photometric = entries.search(262); // PhotometricInterpretation
154  const Array<U32>* stripOfs = entries.search(273); // StripOffsets
155  const Array<U32>* numChannels = entries.search(277); // SamplesPerPixel
156  const Array<U32>* stripBytes = entries.search(279); // StripByteCounts
157  const Array<U32>* predictor = entries.search(317); // Predictor
158  const Array<U32>* extraSamples = entries.search(338); // ExtraSamples
159  const Array<U32>* sampleFormat = entries.search(339); // SampleFormat
160 
161  if (!width || width->getSize() != 1 ||
162  !height || height->getSize() != 1 ||
163  !numBits || numBits->getSize() == 0 ||
164  !compression || compression->getSize() != 1 ||
165  !photometric || photometric->getSize() != 1 ||
166  !stripOfs || stripOfs->getSize() == 0 ||
167  !numChannels || numChannels->getSize() != 1 ||
168  !stripBytes || stripBytes->getSize() != stripOfs->getSize() ||
169  (predictor && predictor->getSize() != 1) ||
170  (extraSamples && extraSamples->getSize() != 1) ||
171  (sampleFormat && sampleFormat->getSize() != 1))
172  {
173  setError("Corrupt TIFF directory!");
174  }
175 
176  if (hasError())
177  return NULL;
178 
179  // Interpret size.
180 
181  Vec2i size(width->get(0), height->get(0));
182  if (size.min() <= 0)
183  setError("Invalid TIFF size!");
184 
185  // Interpret compression.
186 
187  bool packBits = false;
188  switch (compression->get(0))
189  {
190  case 1: packBits = false; break;
191  case 32773: packBits = true; break;
192  default: setError("Unsupported TIFF compression %d!", compression->get(0)); break;
193  }
194 
195  if (predictor && predictor->get(0) != 1)
196  setError("Unsupported TIFF predictor %d!", predictor->get(0));
197 
198  // Read color format.
199 
200  bool floats = false;
201  if (sampleFormat)
202  {
203  switch (sampleFormat->get(0))
204  {
205  case 1: floats = false; break;
206  case 3: floats = true; break;
207  default: setError("Unsupported TIFF sample format %d!", sampleFormat->get(0)); break;
208  }
209  }
210 
211  U32 photo = photometric->get(0);
212  int numColor = numChannels->get(0);
213  int numAlpha = (extraSamples) ? extraSamples->get(0) : 0;
214  if (numBits->getSize() != numColor + numAlpha)
215  setError("Invalid TIFF color format!");
216  for (int i = 0; i < numBits->getSize(); i++)
217  if (numBits->get(i) != ((floats) ? 32u : 8u))
218  setError("Invalid TIFF color format!");
219 
220  // Interpret color format.
221 
223  switch (photo)
224  {
225  case 1: // MinIsBlack
226  if ((numColor == 0 && numAlpha == 1) || (numColor == 1 && numAlpha == 0))
227  format = (floats) ? ImageFormat::A_F32 : ImageFormat::A8;
228  else
229  setError("Unsupported TIFF monochrome color format!");
230  break;
231 
232  case 2: // RGB
233  if (numColor == 3 && numAlpha == 0)
234  format = (floats) ? ImageFormat::RGB_Vec3f : ImageFormat::R8_G8_B8;
235  else if ((numColor == 3 && numAlpha == 1) || (numColor == 4 && numAlpha == 0))
237  else
238  setError("Unsupported TIFF RGB color format!");
239  break;
240 
241  default:
242  setError("Unsupported TIFF photometric interpretation %d!", photo);
243  }
244 
245  // Error => fail.
246 
247  if (hasError())
248  return NULL;
249 
250  // Create image.
251 
252  Image* image = new Image(size, format);
253  U8* data = image->getMutablePtr();
254  const U8* dataEnd = data + image->getStride() * size.y;
255 
256  // Read each strip of image data.
257 
258  U8* dst = data;
259  for (int i = 0; i < stripOfs->getSize() && !hasError(); i++)
260  {
261  int size = stripBytes->get(i);
262  in.seek(stripOfs->get(i));
263  const U8* src = in.read(size);
264  const U8* srcEnd = src + size;
265 
266  // Uncompressed => just read the bytes.
267 
268  if (!packBits)
269  {
270  dst += size;
271  if (dst > dataEnd)
272  break;
273  memcpy(dst - size, src, size);
274  continue;
275  }
276 
277  // PackBits => read each RLE packet.
278 
279  while (src < srcEnd)
280  {
281  int n = *src++;
282  if (n < 128)
283  {
284  n++;
285  dst += n;
286  src += n;
287  if (dst > dataEnd || src > srcEnd)
288  break;
289  memcpy(dst - n, src - n, n);
290  }
291  else if (n > 128)
292  {
293  n = 257 - n;
294  dst += n;
295  src++;
296  if (dst > dataEnd || src > srcEnd)
297  break;
298  memset(dst - n, src[-1], n);
299  }
300  }
301 
302  if (dst > dataEnd || src != srcEnd)
303  setError("Corrupt TIFF image data!");
304  }
305 
306  if (dst != dataEnd)
307  setError("Corrupt TIFF image data!");
308 
309  // Float-based format => fix endianess.
310 
311  if (floats)
312  for (U8* ptr = data; ptr < dataEnd; ptr += 4)
313  if (endianTag == 'I')
314  *(U32*)ptr = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
315  else
316  *(U32*)ptr = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3];
317 
318  // Handle errors.
319 
320  if (hasError())
321  {
322  delete image;
323  return NULL;
324  }
325  return image;
326 }
327 
328 //------------------------------------------------------------------------
329 
331 {
332  // Select format and convert.
333  // - RGBA and floats are not well-supported.
334  // - PackBits compression does not make sense for RGB data.
335 
336  FW_ASSERT(image);
337  Vec2i size = image->getSize();
338  bool empty = (size.min() <= 0);
339  const Image* source = image;
340  Image* converted = NULL;
341 
342  if (empty ||
343  image->getFormat().getID() != ImageFormat::R8_G8_B8 ||
344  (int)image->getStride() != size.x * 4)
345  {
346  size = Vec2i(max(size.x, 1), max(size.y, 1));
347  converted = new Image(size, ImageFormat::R8_G8_B8);
348  if (empty)
349  converted->clear();
350  else
351  *converted = *image;
352  source = converted;
353  }
354 
355  int numBytes = (int)source->getStride() * size.y;
356 
357  // Write.
358 
359  stream.writeU8('I'); // 0x00: endianess tag
360  stream.writeU8('I'); // 0x01: (little-endian)
361  stream.writeU16LE(42); // 0x02: format identifier
362  stream.writeU32LE(0x08); // 0x04: IFD offset
363  stream.writeU16LE(12); // 0x08: number of IFD entries
364 
365  stream.writeU16LE(256); // 0x0A: Tag = ImageWidth
366  stream.writeU16LE(4); // 0x0C: Type = LONG
367  stream.writeU32LE(1); // 0x0E: Count
368  stream.writeU32LE(size.x); // 0x12: Value
369 
370  stream.writeU16LE(257); // 0x16: Tag = ImageLength
371  stream.writeU16LE(4); // 0x18: Type = LONG
372  stream.writeU32LE(1); // 0x1A: Count
373  stream.writeU32LE(size.y); // 0x1E: Value
374 
375  stream.writeU16LE(258); // 0x22: Tag = BitsPerSample
376  stream.writeU16LE(3); // 0x24: Type = SHORT
377  stream.writeU32LE(3); // 0x26: Count
378  stream.writeU32LE(0x9E); // 0x2A: Value offset
379 
380  stream.writeU16LE(259); // 0x2E: Tag = Compression
381  stream.writeU16LE(3); // 0x30: Type = SHORT
382  stream.writeU32LE(1); // 0x32: Count
383  stream.writeU32LE(1); // 0x36: Value = No compression
384 
385  stream.writeU16LE(262); // 0x3A: Tag = PhotometricInterpretation
386  stream.writeU16LE(3); // 0x3C: Type = SHORT
387  stream.writeU32LE(1); // 0x3E: Count
388  stream.writeU32LE(2); // 0x42: Value = RGB
389 
390  stream.writeU16LE(273); // 0x46: Tag = StripOffsets
391  stream.writeU16LE(4); // 0x48: Type = LONG
392  stream.writeU32LE(1); // 0x4A: Count
393  stream.writeU32LE(0xAC); // 0x4E: Value
394 
395  stream.writeU16LE(277); // 0x52: Tag = SamplesPerPixel
396  stream.writeU16LE(3); // 0x54: Type = SHORT
397  stream.writeU32LE(1); // 0x56: Count
398  stream.writeU32LE(3); // 0x5A: Value
399 
400  stream.writeU16LE(278); // 0x5E: Tag = RowsPerStrip
401  stream.writeU16LE(4); // 0x60: Type = LONG
402  stream.writeU32LE(1); // 0x62: Count
403  stream.writeU32LE(size.y); // 0x66: Value
404 
405  stream.writeU16LE(279); // 0x6A: Tag = StripByteCounts
406  stream.writeU16LE(4); // 0x6C: Type = LONG
407  stream.writeU32LE(1); // 0x6E: Count
408  stream.writeU32LE(numBytes); // 0x72: Value
409 
410  stream.writeU16LE(282); // 0x76: Tag = XResolution
411  stream.writeU16LE(5); // 0x78: Type = RATIONAL
412  stream.writeU32LE(1); // 0x7A: Count
413  stream.writeU32LE(0xA4); // 0x7E: Value offset
414 
415  stream.writeU16LE(283); // 0x82: Tag = YResolution
416  stream.writeU16LE(5); // 0x84: Type = RATIONAL
417  stream.writeU32LE(1); // 0x86: Count
418  stream.writeU32LE(0xA4); // 0x8A: Value offset
419 
420  stream.writeU16LE(296); // 0x8E: Tag = ResolutionUnit
421  stream.writeU16LE(3); // 0x90: Type = SHORT
422  stream.writeU32LE(1); // 0x92: Count
423  stream.writeU32LE(2); // 0x96: Value = Inch
424 
425  stream.writeU32LE(0); // 0x9A: next IFD offset
426  stream.writeU16LE(8); // 0x9E: BitsPerSample[0]
427  stream.writeU16LE(8); // 0xA0: BitsPerSample[1]
428  stream.writeU16LE(8); // 0xA2: BitsPerSample[2]
429  stream.writeU32LE(72); // 0xA4: Resolution numerator
430  stream.writeU32LE(1); // 0xA8: Resolution denominator
431 
432  stream.write(source->getPtr(), numBytes); // 0xAC: image data
433 
434  // Clean up.
435 
436  delete converted;
437 }
438 
439 //------------------------------------------------------------------------
#define NULL
Definition: Defs.hpp:39
void writeU16LE(U32 v)
Definition: Stream.hpp:71
U8 readU8(void)
Definition: ImageTiffIO.cpp:50
void clear(U32 abgr=0)
Definition: Image.hpp:160
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid * data
Definition: DLLImports.inl:319
void seek(U32 ofs)
Definition: ImageTiffIO.cpp:47
void setError(const char *fmt,...)
Definition: Defs.cpp:253
void ** ptr
Definition: DLLImports.cpp:74
TiffType
Definition: ImageTiffIO.cpp:68
ID getID(void) const
Definition: Image.cpp:78
virtual void write(const void *ptr, int size)=0
U32 tell(void) const
Definition: ImageTiffIO.cpp:46
const U8 * getPtr(const Vec2i &pos=0) const
Definition: Image.hpp:150
void exportTiffImage(OutputStream &stream, const Image *image)
Image * importTiffImage(InputStream &stream)
Definition: ImageTiffIO.cpp:81
const T & get(S idx) const
Definition: Array.hpp:232
void writeU8(U32 v)
Definition: Stream.hpp:69
Input(InputStream &s, bool le, int ofs)
Definition: ImageTiffIO.cpp:43
U8 readU8(void)
Definition: Stream.hpp:49
void readFully(void *ptr, int size)
Definition: Stream.cpp:36
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
Definition: Math.hpp:462
#define FW_ASSERT(X)
Definition: Defs.hpp:67
U8 * getMutablePtr(const Vec2i &pos=0)
Definition: Image.hpp:151
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei count
Definition: DLLImports.inl:351
V & add(const K &key, const V &value)
Definition: Hash.hpp:143
unsigned int U32
Definition: Defs.hpp:85
bool hasError(void)
Definition: Defs.cpp:289
U32 readU32(void)
Definition: ImageTiffIO.cpp:52
const Vec2i & getSize(void) const
Definition: Image.hpp:143
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei n
Definition: DLLImports.inl:325
const ImageFormat & getFormat(void) const
Definition: Image.hpp:144
S64 getStride(void) const
Definition: Image.hpp:146
U16 readU16(void)
Definition: ImageTiffIO.cpp:51
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: DLLImports.inl:349
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei width
Definition: DLLImports.inl:347
unsigned char U8
Definition: Defs.hpp:83
unsigned short U16
Definition: Defs.hpp:84
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height
Definition: DLLImports.inl:347
const V * search(const K &key) const
Definition: Hash.hpp:128
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void * p
Definition: DLLImports.inl:66
const U8 * read(int num)
Definition: ImageTiffIO.cpp:49
void writeU32LE(U32 v)
Definition: Stream.hpp:73
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type
Definition: DLLImports.inl:323
const T * getPtr(S idx=0) const
Definition: Array.hpp:202
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void * image
Definition: DLLImports.inl:60
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr size
Definition: DLLImports.inl:319
~Input(void)
Definition: ImageTiffIO.cpp:44
void resize(S size)
Definition: Array.hpp:366
S getSize(void) const
Definition: Array.hpp:188
FW_CUDA_FUNC T min(void) const
Definition: Math.hpp:146