From 915621addbfb57a2f103453173d049d352208ef8 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 5 Apr 2014 05:54:52 +0100 Subject: [PATCH] Improvements in PlaYUVerFrame Add bits per channel and number of channels Add const return in some methods --- source/lib/PlaYUVerFrame.cpp | 2 ++ source/lib/PlaYUVerFrame.h | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index b72adea..99e198b 100755 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -38,6 +38,8 @@ PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format ) m_uiHeight = height; m_iPixelFormat = pel_format; m_iNumberChannels = 3; + Int max_bits_per_pel = sizeof( Pel ) * 8; + m_iBitsChannels = assert( 8 <= max_bits_per_pel ); if( m_uiWidth == 0 || m_uiWidth == 0 || m_iPixelFormat == -1 ) { diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index b0a1266..4f36cd4 100755 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -97,7 +97,7 @@ public: static Pixel ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace ); Pixel getPixelValue( const QPoint &pos, ColorSpace color ); - UChar* getQImageBuffer() + UChar* getQImageBuffer() const { return m_pcRGBPelInterlaced; } @@ -106,24 +106,28 @@ public: cv::Mat getCvMat(); #endif - UInt getWidth() + UInt getWidth() const { return m_uiWidth; } - UInt getHeight() + UInt getHeight() const { return m_uiHeight; } - Int getPelFormat() + Int getPelFormat() const { return m_iPixelFormat; } - Int getNumberChannels() + Int getNumberChannels() const { return m_iNumberChannels; } + Int getBitsChannel() const + { + return m_iBitsChannels; + } - Bool isValid() + Bool isValid() const { return ( m_uiWidth > 0 ) && ( m_uiHeight > 0 ) && ( m_iPixelFormat >= 0 ); } @@ -133,6 +137,7 @@ private: UInt m_uiHeight; Int m_iPixelFormat; Int m_iNumberChannels; + Int m_iBitsChannels Bool m_bHasRGBPel; Pel*** m_pppcInputPel;