diff --git a/modules/FrameMask.cpp b/modules/FrameMask.cpp index 12b5c39..baf5b64 100644 --- a/modules/FrameMask.cpp +++ b/modules/FrameMask.cpp @@ -41,9 +41,9 @@ FrameMask::FrameMask() m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS | MODULE_USES_KEYS; m_cModuleOptions.addOptions()/**/ - ( "MaskWeigth", m_uiWeight, "Influence of the mask [60%]" ); + ( "MaskWeigth", m_iWeight, "Influence of the mask [60%]" ); - m_uiWeight = 6; + m_iWeight = 6; m_pcFrameProcessed = NULL; } @@ -60,6 +60,9 @@ Bool FrameMask::create( std::vector apcFrameList ) return false; } } + + m_iWeight = m_iWeight > 100 || m_iWeight < 0 ? 5 : m_iWeight; + m_iWeight = m_iWeight > 10 ? m_iWeight / 10 : m_iWeight; Int iPelFmt = 0; Int iColorSpace = apcFrameList[0]->getColorSpace(); @@ -98,7 +101,7 @@ PlaYUVerFrame* FrameMask::process( std::vector apcFrameList ) { pixelImg = InputFrame->getPixelValue( x, y ); pixelMask = MaskFrame->getPixelValue( x, y ); - pixelOut = pixelImg * ( 10 - m_uiWeight ) + pixelMask * m_uiWeight; + pixelOut = pixelImg * ( 10 - m_iWeight ) + pixelMask * m_iWeight; pixelOut = pixelOut * 0.1; m_pcFrameProcessed->setPixelValue( x, y, pixelOut ); } @@ -108,14 +111,14 @@ PlaYUVerFrame* FrameMask::process( std::vector apcFrameList ) Bool FrameMask::keyPressed( enum Module_Key_Supported value ) { - if( value == MODULE_KEY_UP ) + if( value == MODULE_KEY_UP && m_iWeight < 10) { - m_uiWeight -= 1; + m_iWeight += 1; return true; } - if( value == MODULE_KEY_DOWN ) + if( value == MODULE_KEY_DOWN && m_iWeight > 0 ) { - m_uiWeight += 1; + m_iWeight -= 1; return true; } return false; diff --git a/modules/FrameMask.h b/modules/FrameMask.h index d247507..ad797d9 100644 --- a/modules/FrameMask.h +++ b/modules/FrameMask.h @@ -37,7 +37,7 @@ class FrameMask: public PlaYUVerModuleIf REGISTER_CLASS_FACTORY( FrameMask ) private: - UInt m_uiWeight; + Int m_iWeight; PlaYUVerFrame* m_pcFrameProcessed; public: diff --git a/modules/FrameShift.cpp b/modules/FrameShift.cpp index 91950c5..8f2872b 100644 --- a/modules/FrameShift.cpp +++ b/modules/FrameShift.cpp @@ -135,6 +135,7 @@ Bool FrameShift::keyPressed( enum Module_Key_Supported value ) m_iShiftVer += 1; return true; } + return false; }