ColorCorrecterBase(OFX::ImageEffect &instance,const OFX::RenderArguments &args)
    : OFX::ImageProcessor(instance)
    , _srcImg(0)
    , _maskImg(0)
    , _premult(false)
    , _premultChannel(3)
    , _doMasking(false)
    , _mix(1.)
    , _maskInvert(false)
    {
        // build the LUT
        OFX::ParametricParam  *lookupTable = instance.fetchParametricParam(kParamColorCorrectToneRanges);
        assert(lookupTable);
        for (int curve = 0; curve < 2; ++curve) {
            for (int position = 0; position <= LUT_MAX_PRECISION; ++position) {
                // position to evaluate the param at
                double parametricPos = double(position)/LUT_MAX_PRECISION;

                // evaluate the parametric param
                double value = lookupTable->getValue(curve, args.time, parametricPos);

                // set that in the lut
                _lookupTable[curve][position] = (float)std::max(0.,std::min(value*LUT_MAX_PRECISION+0.5, double(LUT_MAX_PRECISION)));
            }
        }
    }
ImageGilFilterProcessor<SView, DView>::ImageGilFilterProcessor( OFX::ImageEffect& effect, const EImageOrientation imageOrientation )
	: ImageGilProcessor<DView>( effect, imageOrientation )
{
	_clipSrc = effect.fetchClip( kOfxImageEffectSimpleSourceClipName );
	
	if( ! _clipSrc->isConnected() )
		BOOST_THROW_EXCEPTION( exception::ImageNotConnected() );
}
Esempio n. 3
0
	/** @brief ctor */
	ImageProcessor( OFX::ImageEffect& effect, const EImageOrientation imageOrientation )
		: OfxProgress( effect )
		, _effect( effect )
		, _nbThreads( 0 ) // auto, maximum allowable number of CPUs will be used
		, _imageOrientation( imageOrientation )
	{
		_renderArgs.renderWindow.x1 = _renderArgs.renderWindow.y1 = _renderArgs.renderWindow.x2 = _renderArgs.renderWindow.y2 = 0;
		_renderArgs.renderScale.x   = _renderArgs.renderScale.y = 0;
		_renderArgs.time            = -1;
		_renderArgs.fieldToRender   = OFX::eFieldNone;

		_clipDst = effect.fetchClip( kOfxImageEffectOutputClipName );
	}
Esempio n. 4
0
ImageGilProcessor<View>::ImageGilProcessor( OFX::ImageEffect& effect )
	: OfxProgress( effect )
	, _nbThreads( 0 )
	,                 // auto, maximum allowable number of CPUs will be used
	_effect( effect )
{
	_renderArgs.renderWindow.x1 = _renderArgs.renderWindow.y1 = _renderArgs.renderWindow.x2 = _renderArgs.renderWindow.y2 = 0;
	_renderArgs.renderScale.x   = _renderArgs.renderScale.y = 0;
	_renderArgs.time            = -1;
	_renderArgs.fieldToRender   = OFX::eFieldNone;

	_clipDst = effect.fetchClip( kOfxImageEffectOutputClipName );
}
Esempio n. 5
0
    ColorCorrecter(OFX::ImageEffect &instance, const OFX::RenderArguments &args, bool supportsParametricParameter)
    : ColorCorrecterBase(instance,args)
    {
        // build the LUT
        OFX::ParametricParam  *lookupTable = 0;
        if (supportsParametricParameter) {
            lookupTable = instance.fetchParametricParam(kParamColorCorrectToneRanges);
        }
        for (int curve = 0; curve < 2; ++curve) {
            for (int position = 0; position <= LUT_MAX_PRECISION; ++position) {
                // position to evaluate the param at
                double parametricPos = double(position)/LUT_MAX_PRECISION;

                // evaluate the parametric param
                double value;
                if (lookupTable) {
                    value = lookupTable->getValue(curve, args.time, parametricPos);
                } else if (curve == 0) {
                    if (parametricPos < 0.09) {
                        value = 1. - parametricPos/0.09;
                    } else {
                        value = 0.;
                    }
                } else {
                    assert(curve == 1);
                    if (parametricPos <= 0.5) {
                        value = 0.;
                    } else {
                        value = (parametricPos - 0.5) / 0.5;
                    }
                }
                // set that in the lut
                _lookupTable[curve][position] = (float)clamp<PIX>(value, maxValue);
            }
        }

    }
ImageGilFilterProcessor<SView, DView>::ImageGilFilterProcessor( OFX::ImageEffect& effect )
	: ImageGilProcessor<DView>( effect )
{
	_clipSrc = effect.fetchClip( kOfxImageEffectSimpleSourceClipName );
}