Blame IlmImfUtil/ImfDeepImageChannel.h

Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
//
Packit 0d464f
// Copyright (c) 2014, Industrial Light & Magic, a division of Lucas
Packit 0d464f
// Digital Ltd. LLC
Packit 0d464f
// 
Packit 0d464f
// All rights reserved.
Packit 0d464f
// 
Packit 0d464f
// Redistribution and use in source and binary forms, with or without
Packit 0d464f
// modification, are permitted provided that the following conditions are
Packit 0d464f
// met:
Packit 0d464f
// *       Redistributions of source code must retain the above copyright
Packit 0d464f
// notice, this list of conditions and the following disclaimer.
Packit 0d464f
// *       Redistributions in binary form must reproduce the above
Packit 0d464f
// copyright notice, this list of conditions and the following disclaimer
Packit 0d464f
// in the documentation and/or other materials provided with the
Packit 0d464f
// distribution.
Packit 0d464f
// *       Neither the name of Industrial Light & Magic nor the names of
Packit 0d464f
// its contributors may be used to endorse or promote products derived
Packit 0d464f
// from this software without specific prior written permission. 
Packit 0d464f
// 
Packit 0d464f
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 0d464f
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 0d464f
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 0d464f
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 0d464f
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 0d464f
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 0d464f
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 0d464f
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 0d464f
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 0d464f
//
Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
Packit 0d464f
#ifndef INCLUDED_IMF_DEEP_IMAGE_CHANNEL_H
Packit 0d464f
#define INCLUDED_IMF_DEEP_IMAGE_CHANNEL_H
Packit 0d464f
Packit 0d464f
//----------------------------------------------------------------------------
Packit 0d464f
//
Packit 0d464f
//      class DeepImageChannel,
Packit 0d464f
//      template class TypedDeepImageChannel<T>
Packit 0d464f
//
Packit 0d464f
//      For an explanation of images, levels and channels,
Packit 0d464f
//      see the comments in header file Image.h.
Packit 0d464f
//
Packit 0d464f
//----------------------------------------------------------------------------
Packit 0d464f
Packit 0d464f
#include "ImfImageChannel.h"
Packit 0d464f
#include <ImfDeepFrameBuffer.h>
Packit 0d464f
#include "ImfExport.h"
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit 0d464f
Packit 0d464f
class DeepImageLevel;
Packit 0d464f
class SampleCountChannel;
Packit 0d464f
Packit 0d464f
//
Packit 0d464f
// Image channels:
Packit 0d464f
//
Packit 0d464f
// A TypedDeepImageChannel<T> holds the pixel data for a single channel
Packit 0d464f
// of one level of a deep image.  Each pixel in the channel contains an
Packit 0d464f
// array of n samples of type T, where T is either half, float or
Packit 0d464f
// unsigned int, and n is stored in a separate sample count channel.
Packit 0d464f
// Sample storage is allocated only for pixels within the data window
Packit 0d464f
// of the level.
Packit 0d464f
//
Packit 0d464f
Packit 0d464f
class DeepImageChannel: public ImageChannel
Packit 0d464f
{
Packit 0d464f
  public:
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Construct an OpenEXR frame buffer slice for this channel.
Packit 0d464f
    // This function is needed reading an image from an OpenEXR
Packit 0d464f
    // file and for saving an image in an OpenEXR file.
Packit 0d464f
    // 
Packit 0d464f
Packit 0d464f
    virtual DeepSlice           slice () const = 0;
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to the image level to which this channel belongs.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
	IMF_EXPORT DeepImageLevel &            deepLevel();
Packit 0d464f
	IMF_EXPORT const DeepImageLevel &      deepLevel() const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to the sample count channel for this deep channel.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
	IMF_EXPORT SampleCountChannel &        sampleCounts();
Packit 0d464f
	IMF_EXPORT const SampleCountChannel &  sampleCounts() const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
  protected:
Packit 0d464f
Packit 0d464f
    friend class DeepImageLevel;
Packit 0d464f
Packit 0d464f
    DeepImageChannel (DeepImageLevel &level, bool pLinear);
Packit 0d464f
    virtual ~DeepImageChannel();
Packit 0d464f
Packit 0d464f
    virtual void setSamplesToZero
Packit 0d464f
                        (size_t i,
Packit 0d464f
                         unsigned int oldNumSamples,
Packit 0d464f
                         unsigned int newNumSamples) = 0;
Packit 0d464f
Packit 0d464f
    virtual void moveSampleList
Packit 0d464f
                        (size_t i,
Packit 0d464f
                         unsigned int oldNumSamples,
Packit 0d464f
                         unsigned int newNumSamples,
Packit 0d464f
                         size_t newSampleListPosition) = 0;
Packit 0d464f
Packit 0d464f
    virtual void moveSamplesToNewBuffer
Packit 0d464f
                        (const unsigned int * oldNumSamples,
Packit 0d464f
                         const unsigned int * newNumSamples,
Packit 0d464f
                         const size_t * newSampleListPositions) = 0;
Packit 0d464f
Packit 0d464f
    virtual void initializeSampleLists () = 0;
Packit 0d464f
Packit 0d464f
    virtual void resize ();
Packit 0d464f
Packit 0d464f
    virtual void resetBasePointer () = 0;
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
class TypedDeepImageChannel: public DeepImageChannel
Packit 0d464f
{
Packit 0d464f
  public:
Packit 0d464f
    
Packit 0d464f
    //
Packit 0d464f
    // The OpenEXR pixel type of this channel (HALF, FLOAT or UINT).
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    virtual PixelType   pixelType () const;
Packit 0d464f
Packit 0d464f
    
Packit 0d464f
    //
Packit 0d464f
    // Construct an OpenEXR frame buffer slice for this channel.
Packit 0d464f
    // This function is needed reading an image from an OpenEXR
Packit 0d464f
    // file and for saving an image in an OpenEXR file.
Packit 0d464f
    // 
Packit 0d464f
Packit 0d464f
    virtual DeepSlice   slice () const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to the pixel at pixel space location (x, y), without bounds
Packit 0d464f
    // checking.  Accessing a location outside the data window of the image
Packit 0d464f
    // level results in undefined behavior.
Packit 0d464f
    //
Packit 0d464f
    // The pixel contains a pointer to an array of samples to type T.  The
Packit 0d464f
    // number of samples in this array is sampleCounts().at(x,y).
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    T *                 operator () (int x, int y);
Packit 0d464f
    const T *           operator () (int x, int y) const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to the pixel at pixel space location (x, y), with bounds
Packit 0d464f
    // checking.  Accessing a location outside the data window of the
Packit 0d464f
    // image level throws an Iex::ArgExc exception.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    T *                 at (int x, int y);
Packit 0d464f
    const T *           at (int x, int y) const;
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Faster access to all pixels in a single horizontal row of the
Packit 0d464f
    // channel.  Access is not bounds checked; accessing out of bounds
Packit 0d464f
    // rows or pixels results in undefined behavior.
Packit 0d464f
    //
Packit 0d464f
    // Rows are numbered from 0 to pixelsPerColumn()-1, and each row
Packit 0d464f
    // contains pixelsPerRow() values.  The number of samples in
Packit 0d464f
    // row(r)[i] is sampleCounts().row(r)[i].
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    T * const *         row (int r);
Packit 0d464f
    const T * const *   row (int r) const;
Packit 0d464f
Packit 0d464f
  private:
Packit 0d464f
    
Packit 0d464f
    friend class DeepImageLevel;
Packit 0d464f
Packit 0d464f
    TypedDeepImageChannel (DeepImageLevel &level, bool pLinear);
Packit 0d464f
    virtual ~TypedDeepImageChannel ();
Packit 0d464f
Packit 0d464f
    virtual void setSamplesToZero
Packit 0d464f
                            (size_t i,
Packit 0d464f
                             unsigned int oldNumSamples,
Packit 0d464f
                             unsigned int newNumSamples);
Packit 0d464f
Packit 0d464f
    virtual void moveSampleList
Packit 0d464f
                            (size_t i,
Packit 0d464f
                             unsigned int oldNumSamples,
Packit 0d464f
                             unsigned int newNumSamples,
Packit 0d464f
                             size_t newSampleListPosition);
Packit 0d464f
Packit 0d464f
    virtual void moveSamplesToNewBuffer
Packit 0d464f
                            (const unsigned int * oldNumSamples,
Packit 0d464f
                             const unsigned int * newNumSamples,
Packit 0d464f
                             const size_t * newSampleListPositions);
Packit 0d464f
Packit 0d464f
    virtual void initializeSampleLists ();
Packit 0d464f
Packit 0d464f
    virtual void resize ();
Packit 0d464f
Packit 0d464f
    virtual void resetBasePointer ();
Packit 0d464f
Packit 0d464f
    T **    _sampleListPointers;    // Array of pointers to per-pixel
Packit 0d464f
                                    //sample lists
Packit 0d464f
Packit 0d464f
    T **    _base;                  // Base pointer for faster access
Packit 0d464f
                                    // to entries in _sampleListPointers
Packit 0d464f
Packit 0d464f
    T *     _sampleBuffer;          // Contiguous memory block that
Packit 0d464f
                                    // contains all sample lists for
Packit 0d464f
                                    // this channel
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
Packit 0d464f
//
Packit 0d464f
// Channel typedefs for the pixel data types supported by OpenEXR.
Packit 0d464f
//
Packit 0d464f
Packit 0d464f
typedef TypedDeepImageChannel<half>         DeepHalfChannel;
Packit 0d464f
typedef TypedDeepImageChannel<float>        DeepFloatChannel;
Packit 0d464f
typedef TypedDeepImageChannel<unsigned int> DeepUIntChannel;
Packit 0d464f
Packit 0d464f
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
// Implementation of templates and inline functions
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
TypedDeepImageChannel<T>::TypedDeepImageChannel
Packit 0d464f
    (DeepImageLevel &level,
Packit 0d464f
     bool pLinear)
Packit 0d464f
:
Packit 0d464f
    DeepImageChannel (level, pLinear),
Packit 0d464f
    _sampleListPointers (0),
Packit 0d464f
    _base (0),
Packit 0d464f
    _sampleBuffer (0)
Packit 0d464f
{
Packit 0d464f
    resize();
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
TypedDeepImageChannel<T>::~TypedDeepImageChannel ()
Packit 0d464f
{
Packit 0d464f
    delete [] _sampleListPointers;
Packit 0d464f
    delete [] _sampleBuffer;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <>
Packit 0d464f
inline PixelType
Packit 0d464f
DeepHalfChannel::pixelType () const
Packit 0d464f
{
Packit 0d464f
    return HALF;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <>
Packit 0d464f
inline PixelType
Packit 0d464f
DeepFloatChannel::pixelType () const
Packit 0d464f
{
Packit 0d464f
    return FLOAT;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <>
Packit 0d464f
inline PixelType
Packit 0d464f
DeepUIntChannel::pixelType () const
Packit 0d464f
{
Packit 0d464f
    return UINT;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
DeepSlice
Packit 0d464f
TypedDeepImageChannel<T>::slice () const
Packit 0d464f
{
Packit 0d464f
    return DeepSlice (pixelType(),                  // type
Packit 0d464f
                      (char *) _base,               // base
Packit 0d464f
                      sizeof (T*),                  // xStride
Packit 0d464f
                      pixelsPerRow() * sizeof (T*), // yStride
Packit 0d464f
                      sizeof (T),                   // sampleStride
Packit 0d464f
                      xSampling(),
Packit 0d464f
                      ySampling());
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline T *
Packit 0d464f
TypedDeepImageChannel<T>::operator () (int x, int y)
Packit 0d464f
{
Packit 0d464f
    return _base[y * pixelsPerRow() + x];
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline const T *
Packit 0d464f
TypedDeepImageChannel<T>::operator () (int x, int y) const
Packit 0d464f
{
Packit 0d464f
    return _base[y * pixelsPerRow() + x];
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline T *
Packit 0d464f
TypedDeepImageChannel<T>::at (int x, int y)
Packit 0d464f
{
Packit 0d464f
    boundsCheck (x, y);
Packit 0d464f
    return _base[y * pixelsPerRow() + x];
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline const T *
Packit 0d464f
TypedDeepImageChannel<T>::at (int x, int y) const
Packit 0d464f
{
Packit 0d464f
    boundsCheck (x, y);
Packit 0d464f
    return _base[y * pixelsPerRow() + x];
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline T * const *
Packit 0d464f
TypedDeepImageChannel<T>::row (int r)
Packit 0d464f
{
Packit 0d464f
    return _base + r * pixelsPerRow();
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
inline const T * const *
Packit 0d464f
TypedDeepImageChannel<T>::row (int r) const
Packit 0d464f
{
Packit 0d464f
    return _base + r * pixelsPerRow();
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::setSamplesToZero
Packit 0d464f
    (size_t i,
Packit 0d464f
     unsigned int oldNumSamples,
Packit 0d464f
     unsigned int newNumSamples)
Packit 0d464f
{
Packit 0d464f
    //
Packit 0d464f
    // Expand the size of a sample list for a single pixel and
Packit 0d464f
    // set the new samples in the list to 0.
Packit 0d464f
    //
Packit 0d464f
    // i                The position of the affected pixel in
Packit 0d464f
    //                  the channel's _sampleListPointers.
Packit 0d464f
    //
Packit 0d464f
    // oldNumSamples    Original number of samples in the sample list.
Packit 0d464f
    //
Packit 0d464f
    // newNumSamples    New number of samples in the sample list.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    for (int j = oldNumSamples; j < newNumSamples; ++j)
Packit 0d464f
        _sampleListPointers[i][j] = 0;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::moveSampleList
Packit 0d464f
    (size_t i,
Packit 0d464f
     unsigned int oldNumSamples,
Packit 0d464f
     unsigned int newNumSamples,
Packit 0d464f
     size_t newSampleListPosition)
Packit 0d464f
{
Packit 0d464f
    //
Packit 0d464f
    // Resize the sample list for a single pixel and move it to a new
Packit 0d464f
    // position in the sample buffer for this channel.
Packit 0d464f
    // 
Packit 0d464f
    // i                        The position of the affected pixel in
Packit 0d464f
    //                          the channel's _sampleListPointers.
Packit 0d464f
    //
Packit 0d464f
    // oldNumSamples            Original number of samples in sample list.
Packit 0d464f
    //
Packit 0d464f
    // newNumSamples            New number of samples in the sample list.
Packit 0d464f
    //                          If the new number of samples is larger than
Packit 0d464f
    //                          the old number of samples for a given sample
Packit 0d464f
    //                          list, then the end of the new sample list
Packit 0d464f
    //                          is filled with zeroes.  If the new number of
Packit 0d464f
    //                          samples is smaller than the old one, then
Packit 0d464f
    //                          samples at the end of the old sample list
Packit 0d464f
    //                          are discarded.
Packit 0d464f
    //
Packit 0d464f
    // newSampleListPosition    The new position of the sample list in the
Packit 0d464f
    //                          sample buffer.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    T * oldSampleList = _sampleListPointers[i];
Packit 0d464f
    T * newSampleList = _sampleBuffer + newSampleListPosition;
Packit 0d464f
Packit 0d464f
    if (oldNumSamples > newNumSamples)
Packit 0d464f
    {
Packit 0d464f
        for (int j = 0; j < newNumSamples; ++j)
Packit 0d464f
            newSampleList[j] = oldSampleList[j];
Packit 0d464f
    }
Packit 0d464f
    else
Packit 0d464f
    {
Packit 0d464f
        for (int j = 0; j < oldNumSamples; ++j)
Packit 0d464f
            newSampleList[j] = oldSampleList[j];
Packit 0d464f
Packit 0d464f
        for (int j = oldNumSamples; j < newNumSamples; ++j)
Packit 0d464f
            newSampleList[j] = 0;
Packit 0d464f
    }
Packit 0d464f
Packit 0d464f
    _sampleListPointers[i] = newSampleList;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::moveSamplesToNewBuffer
Packit 0d464f
    (const unsigned int * oldNumSamples,
Packit 0d464f
     const unsigned int * newNumSamples,
Packit 0d464f
     const size_t * newSampleListPositions)
Packit 0d464f
{
Packit 0d464f
    //
Packit 0d464f
    // Allocate a new sample buffer for this channel.
Packit 0d464f
    // Copy the sample lists for all pixels into the new buffer.
Packit 0d464f
    // Then delete the old sample buffer.
Packit 0d464f
    //
Packit 0d464f
    // oldNumSamples            Number of samples in each sample list in the
Packit 0d464f
    //                          old sample buffer.
Packit 0d464f
    //
Packit 0d464f
    // newNumSamples            Number of samples in each sample list in
Packit 0d464f
    //                          the new sample buffer.  If the new number
Packit 0d464f
    //                          of samples is larger than the old number of
Packit 0d464f
    //                          samples for a given sample list, then the
Packit 0d464f
    //                          end of the new sample list is filled with
Packit 0d464f
    //                          zeroes.  If the new number of samples is
Packit 0d464f
    //                          smaller than the old one, then samples at
Packit 0d464f
    //                          the end of the old sample list are discarded.
Packit 0d464f
    //
Packit 0d464f
    // newSampleListPositions   The positions of the new sample lists in the
Packit 0d464f
    //                          new sample buffer.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    T * oldSampleBuffer = _sampleBuffer;
Packit 0d464f
    _sampleBuffer = new T [sampleCounts().sampleBufferSize()];
Packit 0d464f
Packit 0d464f
    for (size_t i = 0; i < numPixels(); ++i)
Packit 0d464f
    {
Packit 0d464f
        T * oldSampleList = _sampleListPointers[i];
Packit 0d464f
        T * newSampleList = _sampleBuffer + newSampleListPositions[i];
Packit 0d464f
Packit 0d464f
        if (oldNumSamples[i] > newNumSamples[i])
Packit 0d464f
        {
Packit 0d464f
            for (int j = 0; j < newNumSamples[i]; ++j)
Packit 0d464f
                newSampleList[j] = oldSampleList[j];
Packit 0d464f
        }
Packit 0d464f
        else
Packit 0d464f
        {
Packit 0d464f
            for (int j = 0; j < oldNumSamples[i]; ++j)
Packit 0d464f
                newSampleList[j] = oldSampleList[j];
Packit 0d464f
Packit 0d464f
            for (int j = oldNumSamples[i]; j < newNumSamples[i]; ++j)
Packit 0d464f
                newSampleList[j] = 0;
Packit 0d464f
        }
Packit 0d464f
Packit 0d464f
        _sampleListPointers[i] = newSampleList;
Packit 0d464f
    }
Packit 0d464f
Packit 0d464f
    delete [] oldSampleBuffer;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::initializeSampleLists ()
Packit 0d464f
{
Packit 0d464f
    //
Packit 0d464f
    // Allocate a new set of sample lists for this channel, and
Packit 0d464f
    // construct zero-filled sample lists for the pixels.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    delete [] _sampleBuffer;
Packit 0d464f
Packit 0d464f
    _sampleBuffer = 0;          // set to 0 to prevent double deletion
Packit 0d464f
                                // in case of an exception
Packit 0d464f
Packit 0d464f
    const unsigned int * numSamples = sampleCounts().numSamples();
Packit 0d464f
    const size_t * sampleListPositions = sampleCounts().sampleListPositions();
Packit 0d464f
Packit 0d464f
    _sampleBuffer = new T [sampleCounts().sampleBufferSize()];
Packit 0d464f
    
Packit 0d464f
    resetBasePointer();
Packit 0d464f
Packit 0d464f
    for (size_t i = 0; i < numPixels(); ++i)
Packit 0d464f
    {
Packit 0d464f
        _sampleListPointers[i] = _sampleBuffer + sampleListPositions[i];
Packit 0d464f
Packit 0d464f
        for (unsigned int j = 0; j < numSamples[i]; ++j)
Packit 0d464f
            _sampleListPointers[i][j] = T (0);
Packit 0d464f
    }
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::resize ()
Packit 0d464f
{
Packit 0d464f
    DeepImageChannel::resize();
Packit 0d464f
Packit 0d464f
    delete [] _sampleListPointers;
Packit 0d464f
    _sampleListPointers = 0;
Packit 0d464f
    _sampleListPointers = new T * [numPixels()];
Packit 0d464f
    initializeSampleLists();
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
Packit 0d464f
template <class T>
Packit 0d464f
void
Packit 0d464f
TypedDeepImageChannel<T>::resetBasePointer ()
Packit 0d464f
{
Packit 0d464f
    _base = _sampleListPointers -
Packit 0d464f
            level().dataWindow().min.y * pixelsPerRow() -
Packit 0d464f
            level().dataWindow().min.x;
Packit 0d464f
}
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit 0d464f
Packit 0d464f
#endif