Blame IlmImf/ImfDeepTiledOutputFile.h

Packit Service 6754ca
///////////////////////////////////////////////////////////////////////////
Packit Service 6754ca
//
Packit Service 6754ca
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
Packit Service 6754ca
// Digital Ltd. LLC
Packit Service 6754ca
//
Packit Service 6754ca
// All rights reserved.
Packit Service 6754ca
//
Packit Service 6754ca
// Redistribution and use in source and binary forms, with or without
Packit Service 6754ca
// modification, are permitted provided that the following conditions are
Packit Service 6754ca
// met:
Packit Service 6754ca
// *       Redistributions of source code must retain the above copyright
Packit Service 6754ca
// notice, this list of conditions and the following disclaimer.
Packit Service 6754ca
// *       Redistributions in binary form must reproduce the above
Packit Service 6754ca
// copyright notice, this list of conditions and the following disclaimer
Packit Service 6754ca
// in the documentation and/or other materials provided with the
Packit Service 6754ca
// distribution.
Packit Service 6754ca
// *       Neither the name of Industrial Light & Magic nor the names of
Packit Service 6754ca
// its contributors may be used to endorse or promote products derived
Packit Service 6754ca
// from this software without specific prior written permission.
Packit Service 6754ca
//
Packit Service 6754ca
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 6754ca
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 6754ca
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 6754ca
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 6754ca
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 6754ca
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 6754ca
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 6754ca
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 6754ca
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 6754ca
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 6754ca
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 6754ca
//
Packit Service 6754ca
///////////////////////////////////////////////////////////////////////////
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
#ifndef INCLUDED_IMF_DEEP_TILED_OUTPUT_FILE_H
Packit Service 6754ca
#define INCLUDED_IMF_DEEP_TILED_OUTPUT_FILE_H
Packit Service 6754ca
Packit Service 6754ca
//-----------------------------------------------------------------------------
Packit Service 6754ca
//
Packit Service 6754ca
//      class DeepTiledOutputFile
Packit Service 6754ca
//
Packit Service 6754ca
//-----------------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
#include "ImfHeader.h"
Packit Service 6754ca
#include "ImfFrameBuffer.h"
Packit Service 6754ca
#include "ImathBox.h"
Packit Service 6754ca
#include "ImfThreading.h"
Packit Service 6754ca
#include "ImfGenericOutputFile.h"
Packit Service 6754ca
#include "ImfNamespace.h"
Packit Service 6754ca
#include "ImfForward.h"
Packit Service 6754ca
#include "ImfExport.h"
Packit Service 6754ca
Packit Service 6754ca
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
class IMF_EXPORT DeepTiledOutputFile : public GenericOutputFile
Packit Service 6754ca
{
Packit Service 6754ca
  public:
Packit Service 6754ca
Packit Service 6754ca
    //-------------------------------------------------------------------
Packit Service 6754ca
    // A constructor that opens the file with the specified name, and
Packit Service 6754ca
    // writes the file header.  The file header is also copied into the
Packit Service 6754ca
    // TiledOutputFile object, and can later be accessed via the header()
Packit Service 6754ca
    // method.
Packit Service 6754ca
    //
Packit Service 6754ca
    // Destroying TiledOutputFile constructed with this constructor
Packit Service 6754ca
    // automatically closes the corresponding files.
Packit Service 6754ca
    //
Packit Service 6754ca
    // The header must contain a TileDescriptionAttribute called "tiles".
Packit Service 6754ca
    //
Packit Service 6754ca
    // The x and y subsampling factors for all image channels must be 1;
Packit Service 6754ca
    // subsampling is not supported.
Packit Service 6754ca
    //
Packit Service 6754ca
    // Tiles can be written to the file in arbitrary order.  The line
Packit Service 6754ca
    // order attribute can be used to cause the tiles to be sorted in
Packit Service 6754ca
    // the file.  When the file is read later, reading the tiles in the
Packit Service 6754ca
    // same order as they are in the file tends to be significantly
Packit Service 6754ca
    // faster than reading the tiles in random order (see writeTile,
Packit Service 6754ca
    // below).
Packit Service 6754ca
    //-------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    DeepTiledOutputFile (const char fileName[],
Packit Service 6754ca
                         const Header &header,
Packit Service 6754ca
                         int numThreads = globalThreadCount ());
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    // ----------------------------------------------------------------
Packit Service 6754ca
    // A constructor that attaches the new TiledOutputFile object to
Packit Service 6754ca
    // a file that has already been opened.  Destroying TiledOutputFile
Packit Service 6754ca
    // objects constructed with this constructor does not automatically
Packit Service 6754ca
    // close the corresponding files.
Packit Service 6754ca
    // ----------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    DeepTiledOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
Packit Service 6754ca
                         const Header &header,
Packit Service 6754ca
                         int numThreads = globalThreadCount ());
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-----------------------------------------------------
Packit Service 6754ca
    // Destructor
Packit Service 6754ca
    //
Packit Service 6754ca
    // Destroying a TiledOutputFile object before all tiles
Packit Service 6754ca
    // have been written results in an incomplete file.
Packit Service 6754ca
    //-----------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    virtual ~DeepTiledOutputFile ();
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //------------------------
Packit Service 6754ca
    // Access to the file name
Packit Service 6754ca
    //------------------------
Packit Service 6754ca
Packit Service 6754ca
    const char *        fileName () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //--------------------------
Packit Service 6754ca
    // Access to the file header
Packit Service 6754ca
    //--------------------------
Packit Service 6754ca
Packit Service 6754ca
    const Header &      header () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-------------------------------------------------------
Packit Service 6754ca
    // Set the current frame buffer -- copies the FrameBuffer
Packit Service 6754ca
    // object into the TiledOutputFile object.
Packit Service 6754ca
    //
Packit Service 6754ca
    // The current frame buffer is the source of the pixel
Packit Service 6754ca
    // data written to the file.  The current frame buffer
Packit Service 6754ca
    // must be set at least once before writeTile() is
Packit Service 6754ca
    // called.  The current frame buffer can be changed
Packit Service 6754ca
    // after each call to writeTile().
Packit Service 6754ca
    //-------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                setFrameBuffer (const DeepFrameBuffer &frameBuffer);
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-----------------------------------
Packit Service 6754ca
    // Access to the current frame buffer
Packit Service 6754ca
    //-----------------------------------
Packit Service 6754ca
Packit Service 6754ca
    const DeepFrameBuffer & frameBuffer () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-------------------
Packit Service 6754ca
    // Utility functions:
Packit Service 6754ca
    //-------------------
Packit Service 6754ca
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
    // Multiresolution mode and tile size:
Packit Service 6754ca
    // The following functions return the xSize, ySize and mode
Packit Service 6754ca
    // fields of the file header's TileDescriptionAttribute.
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    unsigned int        tileXSize () const;
Packit Service 6754ca
    unsigned int        tileYSize () const;
Packit Service 6754ca
    LevelMode           levelMode () const;
Packit Service 6754ca
    LevelRoundingMode   levelRoundingMode () const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //--------------------------------------------------------------------
Packit Service 6754ca
    // Number of levels:
Packit Service 6754ca
    //
Packit Service 6754ca
    // numXLevels() returns the file's number of levels in x direction.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == ONE_LEVEL:
Packit Service 6754ca
    //      return value is: 1
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == MIPMAP_LEVELS:
Packit Service 6754ca
    //      return value is: rfunc (log (max (w, h)) / log (2)) + 1
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == RIPMAP_LEVELS:
Packit Service 6754ca
    //      return value is: rfunc (log (w) / log (2)) + 1
Packit Service 6754ca
    //
Packit Service 6754ca
    //  where
Packit Service 6754ca
    //      w is the width of the image's data window,  max.x - min.x + 1,
Packit Service 6754ca
    //      y is the height of the image's data window, max.y - min.y + 1,
Packit Service 6754ca
    //      and rfunc(x) is either floor(x), or ceil(x), depending on
Packit Service 6754ca
    //      whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP.
Packit Service 6754ca
    //
Packit Service 6754ca
    // numYLevels() returns the file's number of levels in y direction.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
Packit Service 6754ca
    //      return value is the same as for numXLevels()
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == RIPMAP_LEVELS:
Packit Service 6754ca
    //      return value is: rfunc (log (h) / log (2)) + 1
Packit Service 6754ca
    //
Packit Service 6754ca
    //
Packit Service 6754ca
    // numLevels() is a convenience function for use with MIPMAP_LEVELS
Packit Service 6754ca
    // files.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
Packit Service 6754ca
    //      return value is the same as for numXLevels()
Packit Service 6754ca
    //
Packit Service 6754ca
    //  if levelMode() == RIPMAP_LEVELS:
Packit Service 6754ca
    //      an IEX_NAMESPACE::LogicExc exception is thrown
Packit Service 6754ca
    //
Packit Service 6754ca
    // isValidLevel(lx, ly) returns true if the file contains
Packit Service 6754ca
    // a level with level number (lx, ly), false if not.
Packit Service 6754ca
    //
Packit Service 6754ca
    //--------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    int                 numLevels () const;
Packit Service 6754ca
    int                 numXLevels () const;
Packit Service 6754ca
    int                 numYLevels () const;
Packit Service 6754ca
    bool                isValidLevel (int lx, int ly) const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
    // Dimensions of a level:
Packit Service 6754ca
    //
Packit Service 6754ca
    // levelWidth(lx) returns the width of a level with level
Packit Service 6754ca
    // number (lx, *), where * is any number.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is:
Packit Service 6754ca
    //      max (1, rfunc (w / pow (2, lx)))
Packit Service 6754ca
    //
Packit Service 6754ca
    //
Packit Service 6754ca
    // levelHeight(ly) returns the height of a level with level
Packit Service 6754ca
    // number (*, ly), where * is any number.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is:
Packit Service 6754ca
    //      max (1, rfunc (h / pow (2, ly)))
Packit Service 6754ca
    //
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    int                 levelWidth  (int lx) const;
Packit Service 6754ca
    int                 levelHeight (int ly) const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //----------------------------------------------------------
Packit Service 6754ca
    // Number of tiles:
Packit Service 6754ca
    //
Packit Service 6754ca
    // numXTiles(lx) returns the number of tiles in x direction
Packit Service 6754ca
    // that cover a level with level number (lx, *), where * is
Packit Service 6754ca
    // any number.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is:
Packit Service 6754ca
    //      (levelWidth(lx) + tileXSize() - 1) / tileXSize()
Packit Service 6754ca
    //
Packit Service 6754ca
    //
Packit Service 6754ca
    // numYTiles(ly) returns the number of tiles in y direction
Packit Service 6754ca
    // that cover a level with level number (*, ly), where * is
Packit Service 6754ca
    // any number.
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is:
Packit Service 6754ca
    //      (levelHeight(ly) + tileXSize() - 1) / tileXSize()
Packit Service 6754ca
    //
Packit Service 6754ca
    //----------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    int                 numXTiles (int lx = 0) const;
Packit Service 6754ca
    int                 numYTiles (int ly = 0) const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
    // Level pixel ranges:
Packit Service 6754ca
    //
Packit Service 6754ca
    // dataWindowForLevel(lx, ly) returns a 2-dimensional
Packit Service 6754ca
    // region of valid pixel coordinates for a level with
Packit Service 6754ca
    // level number (lx, ly)
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is a Box2i with min value:
Packit Service 6754ca
    //      (dataWindow.min.x, dataWindow.min.y)
Packit Service 6754ca
    //
Packit Service 6754ca
    //  and max value:
Packit Service 6754ca
    //      (dataWindow.min.x + levelWidth(lx) - 1,
Packit Service 6754ca
    //       dataWindow.min.y + levelHeight(ly) - 1)
Packit Service 6754ca
    //
Packit Service 6754ca
    // dataWindowForLevel(level) is a convenience function used
Packit Service 6754ca
    // for ONE_LEVEL and MIPMAP_LEVELS files.  It returns
Packit Service 6754ca
    // dataWindowForLevel(level, level).
Packit Service 6754ca
    //
Packit Service 6754ca
    //---------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    IMATH_NAMESPACE::Box2i        dataWindowForLevel (int l = 0) const;
Packit Service 6754ca
    IMATH_NAMESPACE::Box2i        dataWindowForLevel (int lx, int ly) const;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-------------------------------------------------------------------
Packit Service 6754ca
    // Tile pixel ranges:
Packit Service 6754ca
    //
Packit Service 6754ca
    // dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional
Packit Service 6754ca
    // region of valid pixel coordinates for a tile with tile coordinates
Packit Service 6754ca
    // (dx,dy) and level number (lx, ly).
Packit Service 6754ca
    //
Packit Service 6754ca
    //  return value is a Box2i with min value:
Packit Service 6754ca
    //      (dataWindow.min.x + dx * tileXSize(),
Packit Service 6754ca
    //       dataWindow.min.y + dy * tileYSize())
Packit Service 6754ca
    //
Packit Service 6754ca
    //  and max value:
Packit Service 6754ca
    //      (dataWindow.min.x + (dx + 1) * tileXSize() - 1,
Packit Service 6754ca
    //       dataWindow.min.y + (dy + 1) * tileYSize() - 1)
Packit Service 6754ca
    //
Packit Service 6754ca
    // dataWindowForTile(dx, dy, level) is a convenience function
Packit Service 6754ca
    // used for ONE_LEVEL and MIPMAP_LEVELS files.  It returns
Packit Service 6754ca
    // dataWindowForTile(dx, dy, level, level).
Packit Service 6754ca
    //
Packit Service 6754ca
    //-------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    IMATH_NAMESPACE::Box2i        dataWindowForTile (int dx, int dy,
Packit Service 6754ca
                                           int l = 0) const;
Packit Service 6754ca
Packit Service 6754ca
    IMATH_NAMESPACE::Box2i        dataWindowForTile (int dx, int dy,
Packit Service 6754ca
                                           int lx, int ly) const;
Packit Service 6754ca
Packit Service 6754ca
    //------------------------------------------------------------------
Packit Service 6754ca
    // Write pixel data:
Packit Service 6754ca
    //
Packit Service 6754ca
    // writeTile(dx, dy, lx, ly) writes the tile with tile
Packit Service 6754ca
    // coordinates (dx, dy), and level number (lx, ly) to
Packit Service 6754ca
    // the file.
Packit Service 6754ca
    //
Packit Service 6754ca
    //   dx must lie in the interval [0, numXTiles(lx) - 1]
Packit Service 6754ca
    //   dy must lie in the interval [0, numYTiles(ly) - 1]
Packit Service 6754ca
    //
Packit Service 6754ca
    //   lx must lie in the interval [0, numXLevels() - 1]
Packit Service 6754ca
    //   ly must lie in the inverval [0, numYLevels() - 1]
Packit Service 6754ca
    //
Packit Service 6754ca
    // writeTile(dx, dy, level) is a convenience function
Packit Service 6754ca
    // used for ONE_LEVEL and MIPMAP_LEVEL files.  It calls
Packit Service 6754ca
    // writeTile(dx, dy, level, level).
Packit Service 6754ca
    //
Packit Service 6754ca
    // The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow
Packit Service 6754ca
    // writing multiple tiles at once.  If multi-threading is used
Packit Service 6754ca
    // multiple tiles are written concurrently.  The tile coordinates,
Packit Service 6754ca
    // dx1, dx2 and dy1, dy2, specify inclusive ranges of tile
Packit Service 6754ca
    // coordinates.  It is valid for dx1 < dx2 or dy1 < dy2; the
Packit Service 6754ca
    // tiles are always written in the order specified by the line
Packit Service 6754ca
    // order attribute.  Hence, it is not possible to specify an
Packit Service 6754ca
    // "invalid" or empty tile range.
Packit Service 6754ca
    //
Packit Service 6754ca
    // Pixels that are outside the pixel coordinate range for the tile's
Packit Service 6754ca
    // level, are never accessed by writeTile().
Packit Service 6754ca
    //
Packit Service 6754ca
    // Each tile in the file must be written exactly once.
Packit Service 6754ca
    //
Packit Service 6754ca
    // The file's line order attribute determines the order of the tiles
Packit Service 6754ca
    // in the file:
Packit Service 6754ca
    //
Packit Service 6754ca
    //   INCREASING_Y   In the file, the tiles for each level are stored
Packit Service 6754ca
    //                  in a contiguous block.  The levels are ordered
Packit Service 6754ca
    //                  like this:
Packit Service 6754ca
    //
Packit Service 6754ca
    //                      (0, 0)   (1, 0)   ... (nx-1, 0)
Packit Service 6754ca
    //                      (0, 1)   (1, 1)   ... (nx-1, 1)
Packit Service 6754ca
    //                       ...
Packit Service 6754ca
    //                      (0,ny-1) (1,ny-1) ... (nx-1,ny-1)
Packit Service 6754ca
    //
Packit Service 6754ca
    //                  where nx = numXLevels(), and ny = numYLevels().
Packit Service 6754ca
    //                  In an individual level, (lx, ly), the tiles
Packit Service 6754ca
    //                  are stored in the following order:
Packit Service 6754ca
    //
Packit Service 6754ca
    //                      (0, 0)   (1, 0)   ... (tx-1, 0)
Packit Service 6754ca
    //                      (0, 1)   (1, 1)   ... (tx-1, 1)
Packit Service 6754ca
    //                       ...
Packit Service 6754ca
    //                      (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
Packit Service 6754ca
    //
Packit Service 6754ca
    //                  where tx = numXTiles(lx),
Packit Service 6754ca
    //                  and   ty = numYTiles(ly).
Packit Service 6754ca
    //
Packit Service 6754ca
    //   DECREASING_Y   As for INCREASING_Y, the tiles for each level
Packit Service 6754ca
    //                  are stored in a contiguous block.  The levels
Packit Service 6754ca
    //                  are ordered the same way as for INCREASING_Y,
Packit Service 6754ca
    //                  but within an individual level, the tiles
Packit Service 6754ca
    //                  are stored in this order:
Packit Service 6754ca
    //
Packit Service 6754ca
    //                      (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
Packit Service 6754ca
    //                       ...
Packit Service 6754ca
    //                      (0, 1)   (1, 1)   ... (tx-1, 1)
Packit Service 6754ca
    //                      (0, 0)   (1, 0)   ... (tx-1, 0)
Packit Service 6754ca
    //
Packit Service 6754ca
    //
Packit Service 6754ca
    //   RANDOM_Y       The order of the calls to writeTile() determines
Packit Service 6754ca
    //                  the order of the tiles in the file.
Packit Service 6754ca
    //
Packit Service 6754ca
    //------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                writeTile  (int dx, int dy, int l = 0);
Packit Service 6754ca
    void                writeTile  (int dx, int dy, int lx, int ly);
Packit Service 6754ca
Packit Service 6754ca
    void                writeTiles (int dx1, int dx2, int dy1, int dy2,
Packit Service 6754ca
                                    int lx, int ly);
Packit Service 6754ca
Packit Service 6754ca
    void                writeTiles (int dx1, int dx2, int dy1, int dy2,
Packit Service 6754ca
                                    int l = 0);
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //------------------------------------------------------------------
Packit Service 6754ca
    // Shortcut to copy all pixels from a TiledInputFile into this file,
Packit Service 6754ca
    // without uncompressing and then recompressing the pixel data.
Packit Service 6754ca
    // This file's header must be compatible with the TiledInputFile's
Packit Service 6754ca
    // header:  The two header's "dataWindow", "compression",
Packit Service 6754ca
    // "lineOrder", "channels", and "tiles" attributes must be the same.
Packit Service 6754ca
    //------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                copyPixels (DeepTiledInputFile &in);
Packit Service 6754ca
    void                copyPixels (DeepTiledInputPart &in);
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //--------------------------------------------------------------
Packit Service 6754ca
    // Updating the preview image:
Packit Service 6754ca
    //
Packit Service 6754ca
    // updatePreviewImage() supplies a new set of pixels for the
Packit Service 6754ca
    // preview image attribute in the file's header.  If the header
Packit Service 6754ca
    // does not contain a preview image, updatePreviewImage() throws
Packit Service 6754ca
    // an IEX_NAMESPACE::LogicExc.
Packit Service 6754ca
    //
Packit Service 6754ca
    // Note: updatePreviewImage() is necessary because images are
Packit Service 6754ca
    // often stored in a file incrementally, a few tiles at a time,
Packit Service 6754ca
    // while the image is being generated.  Since the preview image
Packit Service 6754ca
    // is an attribute in the file's header, it gets stored in the
Packit Service 6754ca
    // file as soon as the file is opened, but we may not know what
Packit Service 6754ca
    // the preview image should look like until we have written the
Packit Service 6754ca
    // last tile of the main image.
Packit Service 6754ca
    //
Packit Service 6754ca
    //--------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                updatePreviewImage (const PreviewRgba newPixels[]);
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    //-------------------------------------------------------------
Packit Service 6754ca
    // Break a tile -- for testing and debugging only:
Packit Service 6754ca
    //
Packit Service 6754ca
    // breakTile(dx,dy,lx,ly,p,n,c) introduces an error into the
Packit Service 6754ca
    // output file by writing n copies of character c, starting
Packit Service 6754ca
    // p bytes from the beginning of the tile with tile coordinates
Packit Service 6754ca
    // (dx, dy) and level number (lx, ly).
Packit Service 6754ca
    //
Packit Service 6754ca
    // Warning: Calling this function usually results in a broken
Packit Service 6754ca
    // image file.  The file or parts of it may not be readable,
Packit Service 6754ca
    // or the file may contain bad data.
Packit Service 6754ca
    //
Packit Service 6754ca
    //-------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
    void                breakTile  (int dx, int dy,
Packit Service 6754ca
                                    int lx, int ly,
Packit Service 6754ca
                                    int offset,
Packit Service 6754ca
                                    int length,
Packit Service 6754ca
                                    char c);
Packit Service 6754ca
    struct Data;
Packit Service 6754ca
Packit Service 6754ca
  private:
Packit Service 6754ca
Packit Service 6754ca
    // ----------------------------------------------------------------
Packit Service 6754ca
    // A constructor attaches the OutputStreamMutex to the
Packit Service 6754ca
    // given one from MultiPartOutputFile. Set the previewPosition
Packit Service 6754ca
    // and lineOffsetsPosition which have been acquired from
Packit Service 6754ca
    // the constructor of MultiPartOutputFile as well.
Packit Service 6754ca
    // ----------------------------------------------------------------
Packit Service 6754ca
    DeepTiledOutputFile (const OutputPartData* part);
Packit Service 6754ca
Packit Service 6754ca
    DeepTiledOutputFile (const DeepTiledOutputFile &);              // not implemented
Packit Service 6754ca
    DeepTiledOutputFile & operator = (const DeepTiledOutputFile &); // not implemented
Packit Service 6754ca
Packit Service 6754ca
    void                initialize (const Header &header);
Packit Service 6754ca
Packit Service 6754ca
    bool                isValidTile (int dx, int dy,
Packit Service 6754ca
                                     int lx, int ly) const;
Packit Service 6754ca
Packit Service 6754ca
    size_t              bytesPerLineForTile (int dx, int dy,
Packit Service 6754ca
                                             int lx, int ly) const;
Packit Service 6754ca
Packit Service 6754ca
    Data *              _data;
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
    friend class MultiPartOutputFile;
Packit Service 6754ca
Packit Service 6754ca
};
Packit Service 6754ca
Packit Service 6754ca
Packit Service 6754ca
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit Service 6754ca
Packit Service 6754ca
#endif