ImfDeepScanLineInputPart.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef IMFDEEPSCANLINEINPUTPART_H_
  6. #define IMFDEEPSCANLINEINPUTPART_H_
  7. #include "ImfForward.h"
  8. #include <cstdint>
  9. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  10. class IMF_EXPORT_TYPE DeepScanLineInputPart
  11. {
  12. public:
  13. IMF_EXPORT
  14. DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
  15. //------------------------
  16. // Access to the file name
  17. //------------------------
  18. IMF_EXPORT
  19. const char * fileName () const;
  20. //--------------------------
  21. // Access to the file header
  22. //--------------------------
  23. IMF_EXPORT
  24. const Header & header () const;
  25. //----------------------------------
  26. // Access to the file format version
  27. //----------------------------------
  28. IMF_EXPORT
  29. int version () const;
  30. //-----------------------------------------------------------
  31. // Set the current frame buffer -- copies the FrameBuffer
  32. // object into the InputFile object.
  33. //
  34. // The current frame buffer is the destination for the pixel
  35. // data read from the file. The current frame buffer must be
  36. // set at least once before readPixels() is called.
  37. // The current frame buffer can be changed after each call
  38. // to readPixels().
  39. //-----------------------------------------------------------
  40. IMF_EXPORT
  41. void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
  42. //-----------------------------------
  43. // Access to the current frame buffer
  44. //-----------------------------------
  45. IMF_EXPORT
  46. const DeepFrameBuffer & frameBuffer () const;
  47. //---------------------------------------------------------------
  48. // Check if the file is complete:
  49. //
  50. // isComplete() returns true if all pixels in the data window are
  51. // present in the input file, or false if any pixels are missing.
  52. // (Another program may still be busy writing the file, or file
  53. // writing may have been aborted prematurely.)
  54. //---------------------------------------------------------------
  55. IMF_EXPORT
  56. bool isComplete () const;
  57. //---------------------------------------------------------------
  58. // Read pixel data:
  59. //
  60. // readPixels(s1,s2) reads all scan lines with y coordinates
  61. // in the interval [min (s1, s2), max (s1, s2)] from the file,
  62. // and stores them in the current frame buffer.
  63. //
  64. // Both s1 and s2 must be within the interval
  65. // [header().dataWindow().min.y, header.dataWindow().max.y]
  66. //
  67. // The scan lines can be read from the file in random order, and
  68. // individual scan lines may be skipped or read multiple times.
  69. // For maximum efficiency, the scan lines should be read in the
  70. // order in which they were written to the file.
  71. //
  72. // readPixels(s) calls readPixels(s,s).
  73. //
  74. // If threading is enabled, readPixels (s1, s2) tries to perform
  75. // decopmression of multiple scanlines in parallel.
  76. //
  77. //---------------------------------------------------------------
  78. IMF_EXPORT
  79. void readPixels (int scanLine1, int scanLine2);
  80. IMF_EXPORT
  81. void readPixels (int scanLine);
  82. IMF_EXPORT
  83. void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
  84. int scanLine1,int scanLine2) const;
  85. //----------------------------------------------
  86. // Read a block of raw pixel data from the file,
  87. // without uncompressing it (this function is
  88. // used to implement OutputFile::copyPixels()).
  89. //----------------------------------------------
  90. IMF_EXPORT
  91. void rawPixelData (int firstScanLine,
  92. char * pixelData,
  93. uint64_t &pixelDataSize);
  94. //-----------------------------------------------------------
  95. // Read pixel sample counts into a slice in the frame buffer.
  96. //
  97. // readPixelSampleCounts(s1, s2) reads all the counts of
  98. // pixel samples with y coordinates in the interval
  99. // [min (s1, s2), max (s1, s2)] from the file, and stores
  100. // them in the slice naming "sample count".
  101. //
  102. // Both s1 and s2 must be within the interval
  103. // [header().dataWindow().min.y, header.dataWindow().max.y]
  104. //
  105. // readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
  106. //-----------------------------------------------------------
  107. IMF_EXPORT
  108. void readPixelSampleCounts(int scanline1,
  109. int scanline2);
  110. IMF_EXPORT
  111. void readPixelSampleCounts(int scanline);
  112. IMF_EXPORT
  113. void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
  114. int scanLine1 , int scanLine2) const;
  115. IMF_EXPORT
  116. int firstScanLineInChunk(int y) const;
  117. IMF_EXPORT
  118. int lastScanLineInChunk (int y) const;
  119. private:
  120. DeepScanLineInputFile *file;
  121. // needed for copyPixels
  122. friend class DeepScanLineOutputFile;
  123. };
  124. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  125. #endif /* IMFDEEPSCANLINEINPUTPART_H_ */