From 99ab86a3c960634cb288853aa2b31bd6a2ca8544 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 25 Jun 2014 03:03:54 +0100 Subject: [PATCH] Clean code of the public lib PlaYUVerFrame PlaYUVerFrame --- source/app/PlaYUVerModuleIf.cpp | 4 ++-- source/lib/PlaYUVerFrame.cpp | 23 +++++++++++++++-------- source/lib/PlaYUVerFrame.h | 13 ++++--------- source/lib/PlaYUVerStream.cpp | 3 ++- source/lib/PlaYUVerStream.h | 12 ++---------- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/source/app/PlaYUVerModuleIf.cpp b/source/app/PlaYUVerModuleIf.cpp index 7e1d36e..96e531a 100644 --- a/source/app/PlaYUVerModuleIf.cpp +++ b/source/app/PlaYUVerModuleIf.cpp @@ -31,8 +31,8 @@ namespace plaYUVer PlaYUVerModuleIf::PlaYUVerModuleIf() : m_pcAction( NULL ), m_pcDisplaySubWindow( NULL ), - m_pcProcessedFrame( NULL ), - m_pcModuleStream( NULL ) + m_pcModuleStream( NULL ), + m_pcProcessedFrame( NULL ) { for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ ) { diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index b3968c0..d651205 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -21,10 +21,17 @@ * \file PlaYUVerFrame.cpp * \brief Video Frame handling */ -#include -#include "PlaYUVerFrame.h" +#include "config.h" +#include #include "LibMemory.h" +#include "PlaYUVerFrame.h" +#ifdef USE_OPENCV +#include +#endif +#ifdef USE_PIXFC +#include "pixfc-sse.h" +#endif namespace plaYUVer { @@ -125,9 +132,9 @@ Void PlaYUVerFrame::closePixfc() #endif } -#ifdef USE_PIXFC -inline Void PlaYUVerFrame::FrametoRGB8Pixfc() +Void PlaYUVerFrame::FrametoRGB8Pixfc() { +#ifdef USE_PIXFC switch( m_iPixelFormat ) { case YUV420p: @@ -148,9 +155,8 @@ inline Void PlaYUVerFrame::FrametoRGB8Pixfc() break; } m_bHasRGBPel = true; -} - #endif +} template Void yuvToRgb( T iY, T iU, T iV, T &iR, T &iG, T &iB ) @@ -599,8 +605,6 @@ Pixel PlaYUVerFrame::ConvertPixel( Pixel sInputPixel, Int eOutputSpace ) return sOutputPixel; } -// Format conversion - #ifdef USE_OPENCV cv::Mat PlaYUVerFrame::getCvMat() { @@ -634,7 +638,10 @@ cv::Mat PlaYUVerFrame::getCvMat() } return opencvFrame; } +#endif + +#ifdef USE_OPENCV Void PlaYUVerFrame::copyFrom( cv::Mat* opencvFrame ) { if( m_iPixelFormat == NO_FMT ) diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index ce20338..8c04c44 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -33,14 +33,12 @@ #include #include #include + #ifdef USE_OPENCV #include #endif -#ifdef USE_PIXFC -#include "pixfc-sse.h" -#endif -class QImage; +class PixFcSSE; namespace plaYUVer { @@ -140,10 +138,9 @@ public: static Pixel ConvertPixel( Pixel, Int ); -#ifdef USE_OPENCV cv::Mat getCvMat(); Void copyFrom( cv::Mat* ); -#endif + UInt getWidth() const { @@ -184,10 +181,8 @@ private: Void init( UInt width, UInt height, Int pel_format ); Void openPixfc(); Void closePixfc(); -#ifdef USE_PIXFC PixFcSSE* m_pcPixfc; - inline Void FrametoRGB8Pixfc(); -#endif + Void FrametoRGB8Pixfc(); } ; diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index 426171e..d7aa028 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -22,12 +22,13 @@ * \brief Input stream handling */ +#include "config.h" #include +#include "LibMemory.h" #include "PlaYUVerStream.h" #ifdef USE_FFMPEG #include "LibAvContextHandle.h" #endif -#include "LibMemory.h" namespace plaYUVer { diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index f4bef0e..5a6c298 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -25,22 +25,14 @@ #ifndef __PLAYUVERSTREAM_H__ #define __PLAYUVERSTREAM_H__ -#ifdef PLAYUVER -#include "config.h" -#endif #include "PlaYUVerDefs.h" #include #include #include -#ifdef USE_OPENCV -#include -#endif - -#ifdef USE_FFMPEG -#include "LibAvContextHandle.h" -#endif #include "PlaYUVerFrame.h" +class LibAvContextHandle; + namespace plaYUVer {