TuttleOFX  1
RawReaderPluginFactory.cpp
Go to the documentation of this file.
00001 #include "RawReaderPluginFactory.hpp"
00002 #include "RawReaderDefinitions.hpp"
00003 #include "RawReaderPlugin.hpp"
00004 
00005 #include <tuttle/plugin/context/ReaderPluginFactory.hpp>
00006 
00007 #include <boost/algorithm/string/join.hpp>
00008 #include <boost/assign/std/vector.hpp>
00009 
00010 #include <string>
00011 #include <vector>
00012 
00013 namespace tuttle {
00014 namespace plugin {
00015 namespace raw {
00016 namespace reader {
00017 
00018 /**
00019  * @brief Function called to describe the plugin main features.
00020  * @param[in, out]   desc     Effect descriptor
00021  */
00022 void RawReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00023 {
00024     desc.setLabels(
00025                         "TuttleRawReader",
00026                         "RawReader",
00027                         "Raw file reader"
00028                 );
00029     desc.setPluginGrouping( "tuttle/image/io" );
00030 
00031         using namespace boost::assign;
00032     std::vector<std::string> supportedExtensions;
00033         supportedExtensions += "3fr", "ari", "arw", "bay", "crw", "cr2", "cap", "dng", 
00034         "dcs", "dcr", "dng", "drf", "eip", "erf", "fff", "iiq", 
00035         "k25", "kdc", "mef", "mos", "mrw", "nef", "nrw", "obm", 
00036         "orf", "pef", "ptx", "pxn", "r3d", "rad", "raf", "rw2", 
00037         "raw", "rwl", "rwz", "srf", "sr2", "srw", "x3f";
00038 
00039     desc.setDescription( "Raw File reader\n"
00040                         "Plugin is used to read raw files.\n\n"
00041                         "supported extensions: \n" +
00042                         boost::algorithm::join( supportedExtensions, ", " )
00043                 );
00044 
00045     // add the supported contexts
00046     desc.addSupportedContext( OFX::eContextReader );
00047     desc.addSupportedContext( OFX::eContextGeneral );
00048 
00049     // add supported pixel depths
00050     desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00051     desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00052     desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00053 
00054     // add supported extensions
00055         desc.addSupportedExtensions( supportedExtensions );
00056 
00057     // plugin flags
00058     desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00059     desc.setHostFrameThreading( false );
00060     desc.setSupportsMultiResolution( false );
00061     desc.setSupportsMultipleClipDepths( true );
00062     desc.setSupportsTiles( kSupportTiles );
00063 }
00064 
00065 /**
00066  * @brief Function called to describe the plugin controls and features.
00067  * @param[in, out]   desc       Effect descriptor
00068  * @param[in]        context    Application context
00069  */
00070 void RawReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00071                                                 OFX::EContext               context )
00072 {
00073     // Create the mandated output clip
00074     OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00075     dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00076     dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00077     dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00078     dstClip->setSupportsTiles( kSupportTiles );
00079 
00080     describeReaderParamsInContext( desc, context );
00081 
00082         OFX::Double2DParamDescriptor* greyboxPoint = desc.defineDouble2DParam( kParamGreyboxPoint);
00083         greyboxPoint->setLabel( kParamGreyboxPointLabel );
00084         greyboxPoint->setHint( kParamGreyboxPointHint );
00085         greyboxPoint->setDisplayRange( 0, 0, 6000, 6000 );
00086         
00087         OFX::Double2DParamDescriptor* greyboxSize = desc.defineDouble2DParam( kParamGreyboxSize );
00088         greyboxSize->setLabel( kParamGreyboxSizeLabel );
00089         greyboxSize->setHint( kParamGreyboxSizeHint );
00090         greyboxSize->setDisplayRange( 0, 0, 6000, 6000 );
00091         
00092         OFX::DoubleParamDescriptor* redAbber = desc.defineDoubleParam( kParamRedAbber );
00093         redAbber->setLabel( kParamRedAbberLabel );
00094         redAbber->setHint( kParamRedAbberHint );
00095         redAbber->setDefault( 1.0 );
00096         redAbber->setDisplayRange( 0.999, 1.001 );
00097         
00098         OFX::DoubleParamDescriptor* greenAbber = desc.defineDoubleParam( kParamBlueAbber );
00099         greenAbber->setLabel( kParamBlueAbberLabel );
00100         greenAbber->setHint( kParamBlueAbberHint );
00101         greenAbber->setDefault( 1.0 );
00102         greenAbber->setDisplayRange( 0.999, 1.001 );
00103         
00104         OFX::DoubleParamDescriptor* gammaPower = desc.defineDoubleParam( kParamGammaPower );
00105         gammaPower->setLabel( kParamGammaPowerLabel );
00106         gammaPower->setHint( kParamGammaPowerHint );
00107         gammaPower->setDefault( 1.0 );
00108         gammaPower->setDisplayRange( 0.0, 10.0 );
00109 
00110         OFX::DoubleParamDescriptor* gammaToe = desc.defineDoubleParam( kParamGammaToe );
00111         gammaToe->setLabel( kParamGammaToeLabel );
00112         gammaToe->setHint( kParamGammaToeHint );
00113         gammaToe->setDefault( 1.0 );
00114         gammaToe->setDisplayRange( 0.0, 10.0 );
00115         
00116         OFX::DoubleParamDescriptor* bright = desc.defineDoubleParam( kParamBright );
00117         bright->setLabel( kParamBrightLabel );
00118         bright->setHint( kParamBrightHint );
00119         bright->setDefault( 1.0 );
00120         bright->setDisplayRange( -8.0, 8.0 );
00121 
00122         OFX::DoubleParamDescriptor* threshold = desc.defineDoubleParam( kParamThreshold );
00123         threshold->setLabel( kParamThresholdLabel );
00124         threshold->setHint( kParamThresholdHint );
00125         threshold->setDefault( 500.0 );
00126         threshold->setDisplayRange( 100, 1000.0 );
00127         
00128         OFX::BooleanParamDescriptor* fourColorRGB = desc.defineBooleanParam( kParamFourColorRgb );
00129         fourColorRGB->setLabel( kParamFourColorRgbLabel );
00130         fourColorRGB->setHint( kParamFourColorRgbHint );
00131         fourColorRGB->setDefault( false );
00132         
00133         OFX::ChoiceParamDescriptor* documentMode = desc.defineChoiceParam( kParamDocumentMode );
00134         documentMode->setLabel( kParamDocumentModeLabel );
00135         documentMode->setHint( kParamDocumentModeHint );
00136         documentMode->appendOption( kParamDocumentModeStd );
00137         documentMode->appendOption( kParamDocumentModeWwb );
00138         documentMode->appendOption( kParamDocumentModeWall );
00139         documentMode->setDefault( eDocumentModeStd );
00140         
00141         OFX::ChoiceParamDescriptor* highlight = desc.defineChoiceParam( kParamHighlight );
00142         highlight->setLabel( kParamHighlightLabel );
00143         highlight->setHint( kParamHighlightHint );
00144         highlight->appendOption( kParamHighlightClip );
00145         highlight->appendOption( kParamHighlightUnclip );
00146         highlight->appendOption( kParamHighlightBlend );
00147         highlight->appendOption( kParamHighlightRebuild1 );
00148         highlight->appendOption( kParamHighlightRebuild2 );
00149         highlight->appendOption( kParamHighlightRebuild3 );
00150         highlight->appendOption( kParamHighlightRebuild4 );
00151         highlight->appendOption( kParamHighlightRebuild5 );
00152         highlight->appendOption( kParamHighlightRebuild6 );
00153         highlight->appendOption( kParamHighlightRebuild7 );
00154         highlight->setDefault( eHighlightBlend );
00155         
00156         
00157         OFX::ChoiceParamDescriptor* interpolation = desc.defineChoiceParam( kParamInterpolation );
00158         interpolation->setLabel( kParamInterpolationLabel );
00159         interpolation->setHint( kParamInterpolationHint );
00160         interpolation->appendOption( kParamInterpolationLinear );
00161         interpolation->appendOption( kParamInterpolationVng );
00162         interpolation->appendOption( kParamInterpolationPpg );
00163         interpolation->appendOption( kParamInterpolationAhd );
00164         interpolation->appendOption( kParamInterpolationDcb );
00165         interpolation->appendOption( kParamInterpolationModifiedAhd );
00166         interpolation->appendOption( kParamInterpolationAfd );
00167         interpolation->appendOption( kParamInterpolationVcd );
00168         interpolation->appendOption( kParamInterpolationMixed );
00169         interpolation->appendOption( kParamInterpolationLmmse );
00170         interpolation->appendOption( kParamInterpolationAmaze );
00171         interpolation->setDefault( 3 );
00172         
00173         OFX::DoubleParamDescriptor* exposure = desc.defineDoubleParam( kParamExposure );
00174         exposure->setLabel( kParamExposureLabel );
00175         exposure->setHint( kParamExposureHint );
00176         exposure->setDefault( 1.0 );
00177         exposure->setDisplayRange( 0.0, 10.0 );
00178         
00179         OFX::DoubleParamDescriptor* preserve = desc.defineDoubleParam( kParamExposurePreserve );
00180         preserve->setLabel( kParamThresholdLabel );
00181         preserve->setHint( kParamThresholdHint );
00182         preserve->setDefault( 0.0 );
00183         preserve->setDisplayRange( 0, 1.0 );
00184         
00185         OFX::ChoiceParamDescriptor* whitebalance = desc.defineChoiceParam( kParamWhiteBalance );
00186         whitebalance->setLabel( kParamWhiteBalanceLabel );
00187         whitebalance->setHint( kParamWhiteBalanceHint );
00188         whitebalance->appendOption( kParamWhiteBalanceAutoWb );
00189         whitebalance->appendOption( kParamWhiteBalanceCameraWb );
00190 #ifndef TUTTLE_PRODUCTION
00191         whitebalance->appendOption( kParamWhiteBalanceManualWb );
00192         whitebalance->appendOption( kParamWhiteBalance2500 );
00193         whitebalance->appendOption( kParamWhiteBalance2550 );
00194         whitebalance->appendOption( kParamWhiteBalance2650 );
00195         whitebalance->appendOption( kParamWhiteBalance2700 );
00196         whitebalance->appendOption( kParamWhiteBalance2800 );
00197         whitebalance->appendOption( kParamWhiteBalance2850 );
00198         whitebalance->appendOption( kParamWhiteBalance2950 );
00199         whitebalance->appendOption( kParamWhiteBalance3000 );
00200         whitebalance->appendOption( kParamWhiteBalance3100 );
00201         whitebalance->appendOption( kParamWhiteBalance3200 );
00202         whitebalance->appendOption( kParamWhiteBalance3300 );
00203         whitebalance->appendOption( kParamWhiteBalance3400 );
00204         whitebalance->appendOption( kParamWhiteBalance3600 );
00205         whitebalance->appendOption( kParamWhiteBalance3700 );
00206         whitebalance->appendOption( kParamWhiteBalance3800 );
00207         whitebalance->appendOption( kParamWhiteBalance4000 );
00208         whitebalance->appendOption( kParamWhiteBalance4200 );
00209         whitebalance->appendOption( kParamWhiteBalance4300 );
00210         whitebalance->appendOption( kParamWhiteBalance4500 );
00211         whitebalance->appendOption( kParamWhiteBalance4800 );
00212         whitebalance->appendOption( kParamWhiteBalance5000 );
00213         whitebalance->appendOption( kParamWhiteBalance5300 );
00214         whitebalance->appendOption( kParamWhiteBalance5600 );
00215         whitebalance->appendOption( kParamWhiteBalance5900 );
00216         whitebalance->appendOption( kParamWhiteBalance6300 );
00217         whitebalance->appendOption( kParamWhiteBalance6700 );
00218         whitebalance->appendOption( kParamWhiteBalance7100 );
00219         whitebalance->appendOption( kParamWhiteBalance7700 );
00220         whitebalance->appendOption( kParamWhiteBalance8300 );
00221         whitebalance->appendOption( kParamWhiteBalance9100 );
00222         whitebalance->appendOption( kParamWhiteBalance10000 );
00223 #endif
00224         whitebalance->setDefault( eCameraWb );
00225         
00226         OFX::ChoiceParamDescriptor* filtering = desc.defineChoiceParam( kParamFiltering );
00227         filtering->setLabel( "Filtering" );
00228         filtering->appendOption( kParamFilteringAuto );
00229         filtering->appendOption( kParamFilteringNone );
00230         
00231         OFX::GroupParamDescriptor* metadata = desc.defineGroupParam( kParamMetadata );
00232         metadata->setLabel( kParamMetadata );
00233         
00234         OFX::StringParamDescriptor* manufacturer = desc.defineStringParam( kParamManufacturer );
00235         manufacturer->setLabel( kParamManufacturerLabel );
00236         manufacturer->setHint( kParamManufacturerHint );
00237         manufacturer->setEnabled( false );
00238         manufacturer->setParent( metadata );
00239         
00240         OFX::StringParamDescriptor* model = desc.defineStringParam( kParamModel );
00241         model->setLabel( kParamModelLabel );
00242         model->setHint( kParamModelHint );
00243         model->setEnabled( false );
00244         model->setParent( metadata );
00245 
00246         OFX::IntParamDescriptor* iso = desc.defineIntParam( kParamIso );
00247         iso->setLabel( kParamIsoLabel );
00248         iso->setHint( kParamIsoHint );
00249         iso->setEnabled( false );
00250         iso->setParent( metadata );
00251         
00252         OFX::IntParamDescriptor* shutter = desc.defineIntParam( kParamShutter );
00253         shutter->setLabel( kParamShutterLabel );
00254         shutter->setHint( kParamShutterHint );
00255         shutter->setEnabled( false );
00256         shutter->setParent( metadata );
00257         
00258         OFX::DoubleParamDescriptor* aperture = desc.defineDoubleParam( kParamAperture );
00259         aperture->setLabel( kParamApertureLabel );
00260         aperture->setHint( kParamApertureHint );
00261         aperture->setEnabled( false );
00262         aperture->setParent( metadata );
00263         
00264         OFX::StringParamDescriptor* date = desc.defineStringParam( kParamDateOfShooting );
00265         date->setLabel( kParamDateOfShootingLabel );
00266         date->setHint( kParamDateOfShootingHint );
00267         date->setEnabled( false );
00268         date->setParent( metadata );
00269         
00270         OFX::StringParamDescriptor* gps = desc.defineStringParam( kParamGPS );
00271         gps->setLabel( kParamGPSLabel );
00272         gps->setHint( kParamGPSHint );
00273         gps->setEnabled( false );
00274         gps->setParent( metadata );
00275         
00276         OFX::StringParamDescriptor* description = desc.defineStringParam( kParamDesc );
00277         description->setLabel( kParamDescLabel );
00278         description->setHint( kParamDescHint );
00279         description->setEnabled( false );
00280         description->setParent( metadata );
00281         
00282         OFX::StringParamDescriptor* artist = desc.defineStringParam( kParamArtist );
00283         artist->setLabel( kParamArtistLabel );
00284         artist->setHint( kParamArtistHint );
00285         artist->setEnabled( false );
00286         artist->setParent( metadata );
00287 }
00288 
00289 /**
00290  * @brief Function called to create a plugin effect instance
00291  * @param[in] handle  effect handle
00292  * @param[in] context  Application context
00293  * @return  plugin instance
00294  */
00295 OFX::ImageEffect* RawReaderPluginFactory::createInstance( OfxImageEffectHandle handle,
00296                                                           OFX::EContext        context )
00297 {
00298     return new RawReaderPlugin( handle );
00299 }
00300 
00301 }
00302 }
00303 }
00304 }