diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index 6d366d3..79d9c7b 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -524,23 +524,28 @@ Double PlaYUVerFrame::getPSNR( PlaYUVerFrame* Org, Int component ) UInt64 PlaYUVerFrame::getBytesPerFrame() { - switch( m_iPixelFormat ) + return getBytesPerFrame( m_uiWidth, m_uiHeight, m_iPixelFormat ); +} + +UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat ) +{ + switch( iPixelFormat ) { case YUV420p: - return m_uiWidth * m_uiHeight * 1.5; + return uiWidth * uiHeight * 1.5; break; case YUV444p: - return m_uiWidth * m_uiHeight * 3; + return uiWidth * uiHeight * 3; break; case YUV422p: case YUYV422: - return m_uiWidth * m_uiHeight * 2; + return uiWidth * uiHeight * 2; break; case GRAY: - return m_uiWidth * m_uiHeight; + return uiWidth * uiHeight; break; case RGB8: - return m_uiWidth * m_uiHeight * 3; + return uiWidth * uiHeight * 3; break; default: return 0; diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index a182bc5..1f3deb7 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -118,6 +118,7 @@ public: Double getPSNR( PlaYUVerFrame* Org, Int component ); UInt64 getBytesPerFrame(); + static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat ); UInt getChromaLength() const;