Blame IlmImf/ImfDeepCompositing.h

Packit Service 6754ca
///////////////////////////////////////////////////////////////////////////
Packit Service 6754ca
//
Packit Service 6754ca
// Copyright (c) 2012, Weta Digital Ltd
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 Weta Digital 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_DEEPCOMPOSITING_H
Packit Service 6754ca
#define INCLUDED_IMF_DEEPCOMPOSITING_H
Packit Service 6754ca
Packit Service 6754ca
//-----------------------------------------------------------------------------
Packit Service 6754ca
//
Packit Service 6754ca
//	Class to sort and composite deep samples into a frame buffer
Packit Service 6754ca
//      You may derive from this class to change the way that CompositeDeepScanLine
Packit Service 6754ca
//      and CompositeDeepTile combine samples together - pass an instance of your derived
Packit Service 6754ca
//      class to the compositing engine
Packit Service 6754ca
//
Packit Service 6754ca
//-----------------------------------------------------------------------------
Packit Service 6754ca
Packit Service 6754ca
#include "ImfForward.h"
Packit Service 6754ca
#include "ImfNamespace.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
class IMF_EXPORT DeepCompositing
Packit Service 6754ca
{
Packit Service 6754ca
    public:
Packit Service 6754ca
        DeepCompositing();
Packit Service 6754ca
        virtual ~DeepCompositing();
Packit Service 6754ca
        
Packit Service 6754ca
        
Packit Service 6754ca
        //////////////////////////////////////////////
Packit Service 6754ca
        ///
Packit Service 6754ca
        /// composite together the given channels
Packit Service 6754ca
        /// 
Packit Service 6754ca
        ///  @param outputs       - return array of pixel values - 
Packit Service 6754ca
        ///  @param inputs        - arrays of input sample
Packit Service 6754ca
        ///  @param channel_names - array of channel names for corresponding channels
Packit Service 6754ca
        ///  @param num_channels  - number of active channels (3 or greater)    
Packit Service 6754ca
        ///  @param num_samples   - number of values in all input arrays
Packit Service 6754ca
        ///  @param sources       - number of different sources
Packit Service 6754ca
        ///
Packit Service 6754ca
        /// each array input has num_channels entries: outputs[n] should be the composited
Packit Service 6754ca
        /// values in array inputs[n], whose name will be given by channel_names[n]
Packit Service 6754ca
        /// 
Packit Service 6754ca
        /// The channel ordering shall be as follows:
Packit Service 6754ca
        /// Position Channel
Packit Service 6754ca
        ///    0     Z
Packit Service 6754ca
        ///    1     ZBack (if no ZBack, then inputs[1]==inputs[0] and channel_names[1]==channel_names[0])
Packit Service 6754ca
        ///    2     A (alpha channel)
Packit Service 6754ca
        ///    3-n   other channels - only channels in the frame buffer will appear here
Packit Service 6754ca
        ///
Packit Service 6754ca
        /// since a Z and Alpha channel is required, and channel[1] is ZBack or another copy of Z
Packit Service 6754ca
        /// there will always be 3 or more channels.
Packit Service 6754ca
        ///
Packit Service 6754ca
        /// The default implementation calls sort() if and only if more than one source is active,
Packit Service 6754ca
        /// composites all samples together using the Over operator from front to back,
Packit Service 6754ca
        /// stopping as soon as a sample with alpha=1 is found
Packit Service 6754ca
        /// It also blanks all outputs if num_samples==0
Packit Service 6754ca
        ///
Packit Service 6754ca
        /// note - multiple threads may call composite_pixel simultaneously for different pixels
Packit Service 6754ca
        ///
Packit Service 6754ca
        ///
Packit Service 6754ca
        //////////////////////////////////////////////
Packit Service 6754ca
        virtual void composite_pixel(float outputs[],
Packit Service 6754ca
                                     const float * inputs[],
Packit Service 6754ca
                                     const char * channel_names[],
Packit Service 6754ca
                                     int num_channels,
Packit Service 6754ca
                                     int num_samples,
Packit Service 6754ca
                                     int sources
Packit Service 6754ca
                                     );
Packit Service 6754ca
                                     
Packit Service 6754ca
        
Packit Service 6754ca
       
Packit Service 6754ca
       ////////////////////////////////////////////////////////////////
Packit Service 6754ca
       ///
Packit Service 6754ca
       /// find the depth order for samples with given channel values
Packit Service 6754ca
       /// does not sort the values in-place. Instead it populates
Packit Service 6754ca
       /// array 'order' with the desired sorting order
Packit Service 6754ca
       ///
Packit Service 6754ca
       /// the default operation sorts samples from front to back according to their Z channel
Packit Service 6754ca
       ///
Packit Service 6754ca
       /// @param order         - required output order. order[n] shall be the nth closest sample
Packit Service 6754ca
       /// @param inputs        - arrays of input samples, one array per channel_name
Packit Service 6754ca
       /// @param channel_names - array of channel names for corresponding channels
Packit Service 6754ca
       /// @param num_channels  - number of channels (3 or greater)  
Packit Service 6754ca
       /// @param num_samples   - number of samples in each array
Packit Service 6754ca
       /// @param sources       - number of different sources the data arises from
Packit Service 6754ca
       ///
Packit Service 6754ca
       /// the channel layout is identical to composite_pixel() 
Packit Service 6754ca
       ///
Packit Service 6754ca
       ///////////////////////////////////////////////////////////////
Packit Service 6754ca
                                     
Packit Service 6754ca
       virtual void sort(int order[],
Packit Service 6754ca
                         const float * inputs[],
Packit Service 6754ca
                         const char * channel_names[],
Packit Service 6754ca
                         int num_channels,
Packit Service 6754ca
                         int num_samples,
Packit Service 6754ca
                         int sources);
Packit Service 6754ca
};
Packit Service 6754ca
Packit Service 6754ca
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit Service 6754ca
Packit Service 6754ca
#endif