1 /*
2  * This file is part of openfx-arena <https://github.com/olear/openfx-arena>,
3  * Copyright (C) 2016 INRIA
4  *
5  * openfx-arena is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation.
8  *
9  * openfx-arena is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with openfx-arena.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
16 */
17 
18 #include "OCLPlugin.h"
19 
20 using namespace OFX;
21 OFXS_NAMESPACE_ANONYMOUS_ENTER
22 
23 #define kPluginName "Edge"
24 #define kPluginGrouping "Filter"
25 #define kPluginIdentifier "net.fxarena.opencl.Edge"
26 #define kPluginDescription "Edge filter effect using OpenCL."
27 #define kPluginVersionMajor 1
28 #define kPluginVersionMinor 0
29 
30 #define kSupportsTiles 0
31 #define kSupportsMultiResolution 1
32 #define kSupportsRenderScale 1
33 #define kRenderThreadSafety eRenderFullySafe
34 #define kHostFrameThreading false
35 #define kHostMasking true
36 #define kHostMixing true
37 
38 class EdgeCLPlugin
39     : public OCLPluginHelper<kSupportsRenderScale>
40 {
41 public:
EdgeCLPlugin(OfxImageEffectHandle handle)42     EdgeCLPlugin(OfxImageEffectHandle handle)
43         : OCLPluginHelper<kSupportsRenderScale>(handle, "", kPluginIdentifier)
44     {
45     }
46 
render(const OFX::RenderArguments &,cl::Kernel)47     virtual void render(const OFX::RenderArguments &/*args*/, cl::Kernel /*kernel*/) OVERRIDE FINAL
48     {
49     }
50 };
51 
52 mDeclarePluginFactory(EdgeCLPluginFactory, {}, {});
53 
describe(ImageEffectDescriptor & desc)54 void EdgeCLPluginFactory::describe(ImageEffectDescriptor &desc)
55 {
56     desc.setLabel(kPluginName);
57     desc.setPluginGrouping(kPluginGrouping);
58     desc.setPluginDescription(kPluginDescription);
59     desc.addSupportedContext(eContextGeneral);
60     desc.addSupportedContext(eContextFilter);
61     desc.addSupportedBitDepth(eBitDepthFloat);
62     desc.setSupportsTiles(kSupportsTiles);
63     desc.setSupportsMultiResolution(kSupportsMultiResolution);
64     desc.setRenderThreadSafety(kRenderThreadSafety);
65     desc.setHostFrameThreading(kHostFrameThreading);
66     desc.setHostMaskingEnabled(kHostMasking);
67     desc.setHostMixingEnabled(kHostMixing);
68 }
69 
describeInContext(ImageEffectDescriptor & desc,ContextEnum context)70 void EdgeCLPluginFactory::describeInContext(ImageEffectDescriptor &desc, ContextEnum context)
71 {
72     OFX::PageParamDescriptor *page = EdgeCLPlugin::describeInContextBegin(desc, context);
73     EdgeCLPlugin::describeInContextEnd(desc, context, page);
74 }
75 
76 OFX::ImageEffect*
createInstance(OfxImageEffectHandle handle,ContextEnum)77 EdgeCLPluginFactory::createInstance(OfxImageEffectHandle handle, ContextEnum /*context*/)
78 {
79     return new EdgeCLPlugin(handle);
80 }
81 
82 static EdgeCLPluginFactory p(kPluginIdentifier, kPluginVersionMajor, kPluginVersionMinor);
83 mRegisterPluginFactoryInstance(p)
84 
85 OFXS_NAMESPACE_ANONYMOUS_EXIT
86