Add module to filter the ChromaU and add new function to PlaYUVerFrame to get chroma size

This commit is contained in:
jfmcarreira committed 2014-10-03 00:17:15 +01:00
1 parent 285f784b8f
commit 2256667c7e
6 files changed
+102 -16

No files matched your search

+6 -3
View File
@@ -83,7 +83,6 @@ INCLUDE( cmake/LibPixfc.cmake )
######################################################################################
SET( MODULES_DIR ${SRC_DIR}/modules )
INCLUDE_DIRECTORIES( ${MODULES_DIR} )
FILE( GLOB ModuleCMakeFiles ModuleDefinition.cmake )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "// This files defines the macro to \n"
"// define a list of modules\n"
@@ -91,8 +90,12 @@ file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "// This files defin
"#define REGISTER_ALL_MODULES ")
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
INCLUDE( ${ModuleCMakeFiles} )
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
# FILE( GLOB ModuleCMakeFiles ModuleDefinition.cmake )
# INCLUDE( ${ModuleCMakeFiles} )
INCLUDE( ModuleDefinition.cmake )
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "\n#endif // __MODULESLISTMACRO_H__\n" )
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#endif // __MODULESLISTHEADER_H__\n" )
+3 -2
View File
@@ -2,8 +2,9 @@
# Default Modules
######################################################################################
ADD_MODULE( FilterComponentLuma "FilterComponentLuma" )
ADD_MODULE( FilterComponentChromaU "FilterComponentLuma" )
ADD_MODULE( FilterComponentLuma "FilterComponent" )
ADD_MODULE( FilterComponentChromaU "FilterComponent" )
ADD_MODULE( FilterComponentChromaV "FilterComponent" )
ADD_MODULE( FrameDifference "FrameDifference" )
ADD_MODULE( MeasurePSNR "MeasurePSNR" )
+43
View File
@@ -553,6 +553,49 @@ UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelF
return 0;
}
UInt PlaYUVerFrame::getChromaWidth() const
{
switch( m_iPixelFormat )
{
case YUV420p:
return m_uiWidth / 2;
break;
case YUV444p:
case YUV422p:
case YUYV422:
case RGB8:
return m_uiWidth;
break;
case GRAY:
return 0;
break;
default:
return 0;
}
return 0;
}
UInt PlaYUVerFrame::getChromaHeight() const
{
switch( m_iPixelFormat )
{
case YUV420p:
case YUV422p:
case YUYV422:
return m_uiHeight / 2;
break;
case YUV444p:
case RGB8:
return m_uiHeight;
case GRAY:
return 0;
break;
default:
return 0;
}
return 0;
}
UInt PlaYUVerFrame::getChromaLength() const
{
switch( m_iPixelFormat )
+2
View File
@@ -120,6 +120,8 @@ public:
UInt64 getBytesPerFrame();
static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat );
UInt getChromaWidth() const;
UInt getChromaHeight() const;
UInt getChromaLength() const;
Pel*** getPelBufferYUV() const
@@ -18,14 +18,13 @@
*/
/**
* \file FilterComponentLuma.cpp
* \brief Filter frame module
* \file FilterComponent.cpp
* \brief Filter component frame module
*/
#include <cstdio>
#include "FilterComponentLuma.h"
#include "PlaYUVerFrame.h"
#include "FilterComponent.h"
namespace plaYUVer
{
@@ -45,7 +44,7 @@ PlaYUVerFrame* FilterComponent::filterComponent( PlaYUVerFrame* InputFrame, Int
{
Pel*** pppOutputPelYUV = m_pcFilteredFrame->getPelBufferYUV();
Pel*** pppInputPelYUV = InputFrame->getPelBufferYUV();
memcpy( pppOutputPelYUV[Component][0], pppInputPelYUV[Component][0], m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof(Pel) );
memcpy( pppOutputPelYUV[LUMA][0], pppInputPelYUV[Component][0], m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof(Pel) );
return m_pcFilteredFrame;
}
@@ -60,7 +59,7 @@ Void FilterComponent::destroy()
PlaYUVerModuleDefinition FilterComponentLumaDef = {
FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence.
// Currently only support for frame
"Filter Component", // Category (sub-menu)
"Filter Component", // Category (sub-menu)
"Luma", // Name
"Filter Y matrix of YUV frame", // Description
MODULE_REQUIRES_ONE_FRAME, // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
@@ -84,7 +83,7 @@ PlaYUVerFrame* FilterComponentLuma::process( PlaYUVerFrame* InputFrame )
return filterComponent( InputFrame, LUMA );
}
PlaYUVerModuleDefinition FilterComponentCrDef = {
PlaYUVerModuleDefinition FilterComponentCbDef = {
FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence.
// Currently only support for frame
"Filter Component", // Category (sub-menu)
@@ -98,12 +97,12 @@ PlaYUVerModuleDefinition FilterComponentCrDef = {
FilterComponentChromaU::FilterComponentChromaU()
{
setModuleDefinition( FilterComponentCrDef );
setModuleDefinition( FilterComponentCbDef );
}
Void FilterComponentChromaU::create( PlaYUVerFrame* InputFrame )
{
createFilter( InputFrame->getWidth(), InputFrame->getHeight() );
createFilter( InputFrame->getChromaWidth(), InputFrame->getChromaHeight() );
}
PlaYUVerFrame* FilterComponentChromaU::process( PlaYUVerFrame* InputFrame )
@@ -111,5 +110,32 @@ PlaYUVerFrame* FilterComponentChromaU::process( PlaYUVerFrame* InputFrame )
return filterComponent( InputFrame, CHROMA_U );
}
PlaYUVerModuleDefinition FilterComponentCrDef = {
FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence.
// Currently only support for frame
"Filter Component", // Category (sub-menu)
"Chroma R", // Name
"Filter Y matrix of YUV frame", // Description
MODULE_REQUIRES_ONE_FRAME, // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
MODULE_REQUIRES_NOTHING, // Module requirements (check PlaYUVerModulesIf.h).
// Several requirements should be "or" between each others.
APPLY_WHILE_PLAYING, // Apply module while playing
};
FilterComponentChromaV::FilterComponentChromaV()
{
setModuleDefinition( FilterComponentCrDef );
}
Void FilterComponentChromaV::create( PlaYUVerFrame* InputFrame )
{
createFilter( InputFrame->getChromaWidth(), InputFrame->getChromaHeight() );
}
PlaYUVerFrame* FilterComponentChromaV::process( PlaYUVerFrame* InputFrame )
{
return filterComponent( InputFrame, CHROMA_V );
}
} // NAMESPACE
@@ -18,8 +18,8 @@
*/
/**
* \file FilterComponentLuma.h
* \brief Filter frame module
* \file FilterComponent.h
* \brief Filter component frame module
*/
#ifndef __FILTERCOMPONENT_H__
@@ -73,6 +73,17 @@ public:
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
};
class FilterComponentChromaV: public FilterComponent, public PlaYUVerModuleIf
{
public:
FilterComponentChromaV();
virtual ~FilterComponentChromaV()
{
}
Void create( PlaYUVerFrame* InputFrame );
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
};
} // NAMESPACE
#endif // __FILTERFRAME_H__