TuttleOFX
1
|
00001 #include "DiffPluginFactory.hpp" 00002 #include "DiffPlugin.hpp" 00003 #include "DiffDefinitions.hpp" 00004 00005 #include <tuttle/plugin/ImageGilProcessor.hpp> 00006 00007 namespace tuttle { 00008 namespace plugin { 00009 namespace quality { 00010 00011 /** 00012 * @brief Function called to describe the plugin main features. 00013 * @param[in, out] desc Effect descriptor 00014 */ 00015 void DiffPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00016 { 00017 desc.setLabels( "TuttleDiff", "Diff", "Diff" ); 00018 desc.setPluginGrouping( "tuttle/param/analysis" ); 00019 00020 // add the supported contexts, only filter at the moment 00021 desc.addSupportedContext( OFX::eContextGeneral ); 00022 00023 // add supported pixel depths 00024 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00025 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00026 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00027 00028 // plugin flags 00029 desc.setSupportsTiles( kSupportTiles ); 00030 } 00031 00032 /** 00033 * @brief Function called to describe the plugin controls and features. 00034 * @param[in, out] desc Effect descriptor 00035 * @param[in] context Application context 00036 */ 00037 void DiffPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00038 OFX::EContext context ) 00039 { 00040 OFX::ClipDescriptor* srcClipA = desc.defineClip( kDiffSourceA ); 00041 00042 assert( srcClipA ); 00043 srcClipA->addSupportedComponent( OFX::ePixelComponentRGBA ); 00044 srcClipA->addSupportedComponent( OFX::ePixelComponentRGB ); 00045 srcClipA->addSupportedComponent( OFX::ePixelComponentAlpha ); 00046 srcClipA->setSupportsTiles( kSupportTiles ); 00047 srcClipA->setOptional( false ); 00048 00049 OFX::ClipDescriptor* srcClipB = desc.defineClip( kDiffSourceB ); 00050 assert( srcClipB ); 00051 srcClipB->addSupportedComponent( OFX::ePixelComponentRGBA ); 00052 srcClipB->addSupportedComponent( OFX::ePixelComponentRGB ); 00053 srcClipB->addSupportedComponent( OFX::ePixelComponentAlpha ); 00054 srcClipB->setSupportsTiles( kSupportTiles ); 00055 srcClipB->setOptional( false ); 00056 00057 // Create the mandated output clip 00058 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00059 assert( dstClip ); 00060 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00061 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00062 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00063 dstClip->setSupportsTiles( kSupportTiles ); 00064 00065 OFX::ChoiceParamDescriptor* diffFunction = desc.defineChoiceParam( kMeasureFunction ); 00066 assert( diffFunction ); 00067 diffFunction->setLabel( kMeasureFunctionLabel ); 00068 diffFunction->appendOption( kMeasureFunctionMSE ); 00069 diffFunction->appendOption( kMeasureFunctionPSNR ); 00070 // diffFunction->appendOption( kMeasureFunctionSSIM ); 00071 diffFunction->setDefault( eMeasureFunctionPSNR ); 00072 00073 OFX::RGBAParamDescriptor* outputQualityMesure = desc.defineRGBAParam( kOutputQualityMesure ); 00074 assert( outputQualityMesure ); 00075 outputQualityMesure->setLabel( kOutputQualityMesureLabel ); 00076 outputQualityMesure->setEvaluateOnChange( false ); 00077 00078 } 00079 00080 /** 00081 * @brief Function called to create a plugin effect instance 00082 * @param[in] handle Effect handle 00083 * @param[in] context Application context 00084 * @return plugin instance 00085 */ 00086 OFX::ImageEffect* DiffPluginFactory::createInstance( OfxImageEffectHandle handle, 00087 OFX::EContext context ) 00088 { 00089 return new DiffPlugin( handle ); 00090 } 00091 00092 } 00093 } 00094 }