From 4e292f8ae7dbef7a305a01078376e66a6b054f61 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Wed, 25 Feb 2015 04:50:04 -0500 Subject: [PATCH] Working on making the WX threaded filter process more clear. I'm starting to get a handle on what's happening. --- src/filters/filters.hpp | 22 +++++++++------------- src/wx/panel.cpp | 36 ++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/filters/filters.hpp b/src/filters/filters.hpp index eb327fd9..80ba1d1c 100644 --- a/src/filters/filters.hpp +++ b/src/filters/filters.hpp @@ -77,19 +77,11 @@ private: FilterFunc myFilter; ///The internal scale int myScale; - ///If the filter even exists - bool isGood; public: - filter(std::string myName): name(myName) + filter(std::string myName): + name(myName), myFilter(filters::GetFilter(myName)), myScale(filters::GetFilterScale(myName)) { - myFilter=filters::GetFilter(myName); - myScale=filters::GetFilterScale(myName); - if (myFilter==NULL) - isGood = false; - else - isGood = true; - -// std::cerr << myName << std::endl; +// std::cerr << name << std::endl; } std::string getName() { @@ -101,7 +93,8 @@ public: } void run(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height) { - if(isGood) +// std::cerr << name <<": srcPitch: "<> 3; int inrb = systemColorDepth == 16 ? 2 : systemColorDepth == 24 ? 0 : 1; - int instride = (width + inrb) * inbpp; + int instride = (width + inrb) * bytes_per_pixel; int outbpp = out_16 ? 2 : systemColorDepth == 24 ? 3 : 4; int outrb = systemColorDepth == 24 ? 0 : 4; int outstride = width * outbpp * scale + outrb; - delta += instride * procy; + delta += instride * band_lower; // + 1 for stupid top border - dst += outstride * (procy + 1) * scale; + dst += outstride * (band_lower + 1) * scale; while(nthreads == 1 || sig.Wait() == wxCOND_NO_ERROR) { if(!src /* && nthreads > 1 */ ) { - lock.Unlock(); - return 0; + lock.Unlock(); + return 0; } // + 1 for stupid top border src += instride; // interframe blending filter // definitely not thread safe by default - // added procy param to provide offset into accum buffers + // added band_lower param to provide offset into accum buffers if(gopts.ifb != IFB_NONE) { switch(gopts.ifb) { case IFB_SMART: if(systemColorDepth == 16) - SmartIB(src, instride, width, procy, height); + SmartIB(src, instride, width, band_lower, band_height); else - SmartIB32(src, instride, width, procy, height); + SmartIB32(src, instride, width, band_lower, band_height); break; case IFB_MOTION_BLUR: // FIXME: if(renderer == d3d/gl && filter == NONE) break; if(systemColorDepth == 16) - MotionBlurIB(src, instride, width, procy, height); + MotionBlurIB(src, instride, width, band_lower, band_height); else - MotionBlurIB32(src, instride, width, procy, height); + MotionBlurIB32(src, instride, width, band_lower, band_height); break; } } @@ -1129,11 +1133,11 @@ public: continue; } - src += instride * procy; + src += instride * band_lower; // naturally, any of these with accumulation buffers like those of // the IFB filters will screw up royally as well - mainFilter->run(src, instride, delta, dst, outstride, width, height); + mainFilter->run(src, instride, delta, dst, outstride, width, band_height); if(nthreads == 1) return 0;