Add SetChromaHalfScale module
This commit is contained in:
1 parent
8c5c8966a3
commit
4c8b6376d7
5 files changed
+131
-1
No files matched your search
@@ -38,6 +38,7 @@ ADD_MODULE( FilterComponentChromaV "FilterComponent" )
|
||||
ADD_MODULE( FrameDifference "FrameDifference" )
|
||||
ADD_MODULE( AbsoluteFrameDifference "AbsoluteFrameDifference" )
|
||||
ADD_MODULE( FrameBinarization "FrameBinarization" )
|
||||
ADD_MODULE( SetChromaHalfScale "SetChromaHalfScale" )
|
||||
ADD_MODULE( EightBitsSampling "EightBitsSampling" )
|
||||
ADD_MODULE( FrameCrop "FrameCrop" )
|
||||
ADD_MODULE( LumaAverage "LumaAverage" )
|
||||
|
||||
@@ -50,5 +50,5 @@ public:
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __LUMAAVERAGE_H__
|
||||
#endif // __FRAMEBINARIZATION_H__
|
||||
|
||||
@@ -38,6 +38,7 @@ PlaYUVerModuleFactory::PlaYUVerModuleFactory()
|
||||
Register( "FilterComponentChromaV", &FilterComponentChromaV::Create );
|
||||
Register( "FrameDifference", &FrameDifference::Create );
|
||||
Register( "AbsoluteFrameDifference", &AbsoluteFrameDifference::Create );
|
||||
Register( "SetChromaHalfScale", &SetChromaHalfScale::Create );
|
||||
Register( "FrameCrop", &FrameCrop::Create );
|
||||
Register( "FrameBinarization", &FrameBinarization::Create );
|
||||
Register( "EightBitsSampling", &EightBitsSampling::Create );
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SetChromaHalfScale.cpp
|
||||
* \brief Binarize frame module
|
||||
*/
|
||||
|
||||
#include "SetChromaHalfScale.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
SetChromaHalfScale::SetChromaHalfScale()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleName = "SetChromaHalfScale";
|
||||
m_pchModuleTooltip = "Copy frame only keeping luma component";
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
|
||||
m_pcProcessedFrame = NULL;
|
||||
|
||||
}
|
||||
|
||||
Void SetChromaHalfScale::create( PlaYUVerFrame* frame )
|
||||
{
|
||||
m_pcProcessedFrame = NULL;
|
||||
m_pcProcessedFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), frame->getPelFormat(), frame->getBitsPel() );
|
||||
}
|
||||
|
||||
PlaYUVerFrame* SetChromaHalfScale::process( PlaYUVerFrame* frame )
|
||||
{
|
||||
Pel* pPelInput = frame->getPelBufferYUV()[LUMA][0];
|
||||
Pel* pPelOut = m_pcProcessedFrame->getPelBufferYUV()[0][0];
|
||||
Pel halfScaleValue = 1 << ( frame->getBitsPel() - 1 );
|
||||
for( UInt i = 0; i < frame->getHeight() * frame->getWidth(); i++ )
|
||||
{
|
||||
*pPelOut++ = *pPelInput++;
|
||||
}
|
||||
pPelInput = frame->getPelBufferYUV()[CHROMA_U][0];
|
||||
for( UInt i = 0; i < m_pcProcessedFrame->getChromaLength() * 2; i++ )
|
||||
{
|
||||
*pPelOut++ = halfScaleValue;
|
||||
}
|
||||
return m_pcProcessedFrame;
|
||||
}
|
||||
|
||||
Void SetChromaHalfScale::destroy()
|
||||
{
|
||||
if( m_pcProcessedFrame )
|
||||
delete m_pcProcessedFrame;
|
||||
m_pcProcessedFrame = NULL;
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SetChromaHalfScale.h
|
||||
* \brief Binarize frame module
|
||||
*/
|
||||
|
||||
#ifndef __CHROMA128_H__
|
||||
#define __CHROMA128_H__
|
||||
|
||||
#include "PlaYUVerModuleIf.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class SetChromaHalfScale: public PlaYUVerModuleIf
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( SetChromaHalfScale )
|
||||
|
||||
private:
|
||||
PlaYUVerFrame* m_pcProcessedFrame;
|
||||
public:
|
||||
SetChromaHalfScale();
|
||||
virtual ~SetChromaHalfScale()
|
||||
{
|
||||
}
|
||||
Void create( PlaYUVerFrame* );
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* );
|
||||
Void destroy();
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __CHROMA128_H__
|
||||
|
||||
Reference in new issue
Block a user