ImfDeepScanLineInputPart.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. #ifndef IMFDEEPSCANLINEINPUTPART_H_
  35. #define IMFDEEPSCANLINEINPUTPART_H_
  36. #include "ImfMultiPartInputFile.h"
  37. #include "ImfDeepScanLineInputFile.h"
  38. #include "ImfDeepScanLineOutputFile.h"
  39. #include "ImfNamespace.h"
  40. #include "ImfExport.h"
  41. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  42. class DeepScanLineInputPart
  43. {
  44. public:
  45. IMF_EXPORT
  46. DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
  47. //------------------------
  48. // Access to the file name
  49. //------------------------
  50. IMF_EXPORT
  51. const char * fileName () const;
  52. //--------------------------
  53. // Access to the file header
  54. //--------------------------
  55. IMF_EXPORT
  56. const Header & header () const;
  57. //----------------------------------
  58. // Access to the file format version
  59. //----------------------------------
  60. IMF_EXPORT
  61. int version () const;
  62. //-----------------------------------------------------------
  63. // Set the current frame buffer -- copies the FrameBuffer
  64. // object into the InputFile object.
  65. //
  66. // The current frame buffer is the destination for the pixel
  67. // data read from the file. The current frame buffer must be
  68. // set at least once before readPixels() is called.
  69. // The current frame buffer can be changed after each call
  70. // to readPixels().
  71. //-----------------------------------------------------------
  72. IMF_EXPORT
  73. void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
  74. //-----------------------------------
  75. // Access to the current frame buffer
  76. //-----------------------------------
  77. IMF_EXPORT
  78. const DeepFrameBuffer & frameBuffer () const;
  79. //---------------------------------------------------------------
  80. // Check if the file is complete:
  81. //
  82. // isComplete() returns true if all pixels in the data window are
  83. // present in the input file, or false if any pixels are missing.
  84. // (Another program may still be busy writing the file, or file
  85. // writing may have been aborted prematurely.)
  86. //---------------------------------------------------------------
  87. IMF_EXPORT
  88. bool isComplete () const;
  89. //---------------------------------------------------------------
  90. // Read pixel data:
  91. //
  92. // readPixels(s1,s2) reads all scan lines with y coordinates
  93. // in the interval [min (s1, s2), max (s1, s2)] from the file,
  94. // and stores them in the current frame buffer.
  95. //
  96. // Both s1 and s2 must be within the interval
  97. // [header().dataWindow().min.y, header.dataWindow().max.y]
  98. //
  99. // The scan lines can be read from the file in random order, and
  100. // individual scan lines may be skipped or read multiple times.
  101. // For maximum efficiency, the scan lines should be read in the
  102. // order in which they were written to the file.
  103. //
  104. // readPixels(s) calls readPixels(s,s).
  105. //
  106. // If threading is enabled, readPixels (s1, s2) tries to perform
  107. // decopmression of multiple scanlines in parallel.
  108. //
  109. //---------------------------------------------------------------
  110. IMF_EXPORT
  111. void readPixels (int scanLine1, int scanLine2);
  112. IMF_EXPORT
  113. void readPixels (int scanLine);
  114. IMF_EXPORT
  115. void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
  116. int scanLine1,int scanLine2) const;
  117. //----------------------------------------------
  118. // Read a block of raw pixel data from the file,
  119. // without uncompressing it (this function is
  120. // used to implement OutputFile::copyPixels()).
  121. //----------------------------------------------
  122. IMF_EXPORT
  123. void rawPixelData (int firstScanLine,
  124. char * pixelData,
  125. Int64 &pixelDataSize);
  126. //-----------------------------------------------------------
  127. // Read pixel sample counts into a slice in the frame buffer.
  128. //
  129. // readPixelSampleCounts(s1, s2) reads all the counts of
  130. // pixel samples with y coordinates in the interval
  131. // [min (s1, s2), max (s1, s2)] from the file, and stores
  132. // them in the slice naming "sample count".
  133. //
  134. // Both s1 and s2 must be within the interval
  135. // [header().dataWindow().min.y, header.dataWindow().max.y]
  136. //
  137. // readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
  138. //-----------------------------------------------------------
  139. IMF_EXPORT
  140. void readPixelSampleCounts(int scanline1,
  141. int scanline2);
  142. IMF_EXPORT
  143. void readPixelSampleCounts(int scanline);
  144. IMF_EXPORT
  145. void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
  146. int scanLine1 , int scanLine2) const;
  147. IMF_EXPORT
  148. int firstScanLineInChunk(int y) const;
  149. IMF_EXPORT
  150. int lastScanLineInChunk (int y) const;
  151. private:
  152. DeepScanLineInputFile *file;
  153. // needed for copyPixels
  154. friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputPart &);
  155. };
  156. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  157. #endif /* IMFDEEPSCANLINEINPUTPART_H_ */