From fa0664b8b33e6daa290a79009e2ce1d9a2bc3cc9 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Fri, 30 May 2014 12:17:54 +0100 Subject: [PATCH] Bugfix in FrameDifference module --- source/modules/FrameDifference.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/modules/FrameDifference.cpp b/source/modules/FrameDifference.cpp index 1be0f20..c58b849 100644 --- a/source/modules/FrameDifference.cpp +++ b/source/modules/FrameDifference.cpp @@ -34,8 +34,8 @@ static PlaYUVerModuleDefinition FrameDifferenceDef = { FRAME_LEVEL_MODULE, "Measurements", - "FrameDifference", - "Measure the difference between two images (Y plane)", + "AbsoluteFrameDifference", + "Measure the difference between two images (Y plane), e. g., abs( Y1 - Y2 ) / 2", MODULE_REQUIRES_TWO_FRAMES, MODULE_REQUIRES_NEW_WINDOW, APPLY_WHILE_PLAYING, @@ -57,11 +57,14 @@ PlaYUVerFrame* FrameDifference::process( PlaYUVerFrame* Input1, PlaYUVerFrame* I Pel* pInput1PelYUV = Input1->getPelBufferYUV()[0][0]; Pel* pInput2PelYUV = Input2->getPelBufferYUV()[0][0]; Pel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0]; + Int aux_pel_1, aux_pel_2; for( UInt y = 0; y < m_pcFrameDifference->getHeight(); y++ ) for( UInt x = 0; x < m_pcFrameDifference->getWidth(); x++ ) { - *pOutputPelYUV++ = *pInput1PelYUV++ - *pInput2PelYUV++; + aux_pel_1 = *pInput1PelYUV++; + aux_pel_2 = *pInput2PelYUV++; + *pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 ) / 2; } return m_pcFrameDifference; }