diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 720a83e..48057bf 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -351,6 +351,8 @@ Void PlaYUVerFrame::setPixelValue( Int xPos, Int yPos, PlaYUVerPixel pixel ) Int ratioW = ch > 0 ? m_pcPelFormat->log2ChromaHeight : 0; m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )] = pixel.Components()[ch]; } + m_bHasHistogram = false; + m_bHasRGBPel = false; } Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame ) diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 54fb28f..d775d88 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -63,9 +63,9 @@ public: { NO_FMT = -1, YUV420p = 0, - YUV444p, YUV422p, YUYV422, + YUV444p, GRAY, RGB24, BRG24, @@ -205,7 +205,6 @@ public: PlaYUVerPixel getPixelValue( Int xPos, Int yPos ); PlaYUVerPixel getPixelValue( Int xPos, Int yPos, PlaYUVerPixel::ColorSpace eColorSpace ); - Void setPixelValue( Int xPos, Int yPos, PlaYUVerPixel pixel ); Void copyFrom( PlaYUVerFrame* ); diff --git a/modules/FrameMask.cpp b/modules/FrameMask.cpp index 89c6d96..aa85a77 100644 --- a/modules/FrameMask.cpp +++ b/modules/FrameMask.cpp @@ -41,7 +41,7 @@ FrameMask::FrameMask() m_dWeigth = 0.3; - m_pcFrameMask = NULL; + m_pcFrameProcessed = NULL; } Bool FrameMask::create( std::vector apcFrameList ) @@ -56,47 +56,40 @@ Bool FrameMask::create( std::vector apcFrameList ) return false; } } - - m_pcFrameMask = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() ); + Int iPelFmt = apcFrameList[0]->getPelFormat(); + iPelFmt = apcFrameList[1]->getPelFormat() > iPelFmt ? apcFrameList[1]->getPelFormat() : iPelFmt; + m_pcFrameProcessed = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), iPelFmt, apcFrameList[0]->getBitsPel() ); return true; } PlaYUVerFrame* FrameMask::process( std::vector apcFrameList ) { - Pel* pInput1PelYUV = apcFrameList[0]->getPelBufferYUV()[0][0]; - Pel* pInput2PelYUV = apcFrameList[1]->getPelBufferYUV()[0][0]; - Pel* pOutputPelYUV = m_pcFrameMask->getPelBufferYUV()[0][0]; - Double aux_pel_1, aux_pel_2, aux_pel_mask; + PlaYUVerFrame* InputFrame = apcFrameList[0]; + PlaYUVerFrame* MaskFrame = apcFrameList[1]; + PlaYUVerPixel pixelImg; + PlaYUVerPixel pixelMask; + PlaYUVerPixel pixelOut; - for( UInt y = 0; y < m_pcFrameMask->getHeight(); y++ ) - for( UInt x = 0; x < m_pcFrameMask->getWidth(); x++ ) + for( UInt y = 0; y < m_pcFrameProcessed->getHeight(); y++ ) + { + for( UInt x = 0; x < m_pcFrameProcessed->getWidth(); x++ ) { - aux_pel_1 = *pInput1PelYUV++; - aux_pel_2 = *pInput2PelYUV++; - aux_pel_mask = aux_pel_1 * ( 1 - m_dWeigth ) + aux_pel_2 * m_dWeigth; - *pOutputPelYUV++ = aux_pel_mask; + pixelImg = InputFrame->getPixelValue( x, y ); + pixelMask = MaskFrame->getPixelValue( x, y ); + pixelOut = pixelImg * ( 1 - m_dWeigth ) + pixelMask * m_dWeigth; + m_pcFrameProcessed->setPixelValue( x, y, pixelOut ); } - - for( UInt c = 1; c < m_pcFrameMask->getNumberChannels(); c++ ) - for( UInt y = 0; y < m_pcFrameMask->getChromaHeight(); y++ ) - for( UInt x = 0; x < m_pcFrameMask->getChromaWidth(); x++ ) - { - aux_pel_1 = *pInput1PelYUV++; - aux_pel_2 = *pInput2PelYUV++; - aux_pel_mask = aux_pel_1 * ( 1 - m_dWeigth ) + aux_pel_2 * m_dWeigth; - *pOutputPelYUV++ = aux_pel_mask; - } - - return m_pcFrameMask; + } + return m_pcFrameProcessed; } Void FrameMask::destroy() { - if( m_pcFrameMask ) + if( m_pcFrameProcessed ) { - delete m_pcFrameMask; + delete m_pcFrameProcessed; } - m_pcFrameMask = NULL; + m_pcFrameProcessed = NULL; } } // NAMESPACE diff --git a/modules/FrameMask.h b/modules/FrameMask.h index bf5f3b7..4d74455 100644 --- a/modules/FrameMask.h +++ b/modules/FrameMask.h @@ -38,7 +38,7 @@ class FrameMask: public PlaYUVerModuleIf private: Double m_dWeigth; - PlaYUVerFrame* m_pcFrameMask; + PlaYUVerFrame* m_pcFrameProcessed; public: FrameMask();