diff --git a/src/filters/filters.hpp b/src/filters/filters.hpp index 3961865d..b3dc98b5 100644 --- a/src/filters/filters.hpp +++ b/src/filters/filters.hpp @@ -13,13 +13,6 @@ // Function pointer type for a filter function typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int); -//WX - -enum ifbfunc { - // this order must match order of option enum and selector widget - IFB_NONE, IFB_SMART, IFB_MOTION_BLUR -}; - typedef std::pair filterpair; typedef std::pair namedfilter; diff --git a/src/filters/new_interframe.cpp b/src/filters/new_interframe.cpp index 56ec739d..c04a8098 100644 --- a/src/filters/new_interframe.cpp +++ b/src/filters/new_interframe.cpp @@ -60,7 +60,7 @@ void SmartIB::run(u8 *srcPtr, unsigned int num_threads,unsigned int thread_numbe u32 colorMask = 0xfefefe; - for (int i = 0; i < width*band_height; i++) + for (unsigned int i = 0; i < width*band_height; i++) { u32 color = src0[i]; src0[i] = @@ -117,7 +117,7 @@ void MotionBlurIB::run(u8 *srcPtr, unsigned int num_threads,unsigned int thread_ u32 colorMask = 0xfefefe; - for (int i = 0; i < width*band_height; i++) + for (unsigned int i = 0; i < width*band_height; i++) { u32 color = src0[i]; src0[i] = (((color & colorMask) >> 1) + diff --git a/src/filters/new_interframe.hpp b/src/filters/new_interframe.hpp index 80643b76..78649107 100644 --- a/src/filters/new_interframe.hpp +++ b/src/filters/new_interframe.hpp @@ -67,7 +67,31 @@ public: void run(u8 *srcPtr, unsigned int num_threads=1,unsigned int thread_number=0); }; +//WX +enum ifbfunc { + // this order must match order of option enum and selector widget + IFB_NONE, IFB_SMART, IFB_MOTION_BLUR +}; +///Use this to select/create the filter to use +class interframe_factory +{ +public: + static interframe_filter * createIFB(ifbfunc filter_select) + { + switch(filter_select) { + case IFB_SMART: + return new SmartIB(); + break; + case IFB_MOTION_BLUR: + return new MotionBlurIB(); + break; + default: + return new interframe_filter(); + break; + } + } +}; #endif //NEW_INTERFRAME_HPP diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index bb0f4d08..65b87370 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -986,20 +986,7 @@ DrawingPanel::DrawingPanel(int _width, int _height) : myFilter = new filter(std::string(gopts.filter.mb_str(wxConvUTF8))); - if(gopts.ifb != IFB_NONE) { - switch(gopts.ifb) { - case IFB_SMART: - iFilter = new SmartIB(); - break; - case IFB_MOTION_BLUR: - iFilter = new MotionBlurIB(); - break; - } - } - else - { - iFilter = new interframe_filter(); - } + iFilter = interframe_factory::createIFB((ifbfunc)gopts.ifb); scale = myFilter->getScale(); myFilter->setWidth(width);