From 9141ad80972b89ab8deb1981cd0ee3cd6a8821e5 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 23 Mar 2014 22:31:14 +0000 Subject: [PATCH] Add a variable to define whenever the RGB pel are set in PlaYUVerFrame --- source/PlaYUVerFrame.cpp | 9 ++++++++- source/PlaYUVerFrame.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/PlaYUVerFrame.cpp b/source/PlaYUVerFrame.cpp index d2e3996..e73382a 100755 --- a/source/PlaYUVerFrame.cpp +++ b/source/PlaYUVerFrame.cpp @@ -54,6 +54,8 @@ PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format ) m_uiHeight = height; m_iPixelFormat = pel_format; + m_bHasRGBPel = false; + switch( m_iPixelFormat ) { case YUV420p: @@ -135,8 +137,10 @@ Void rgbToyuv( T iR, T iG, T iB, T &iY, T &iU, T &iV ) Void PlaYUVerFrame::FrametoRGB8() { - Int iY, iU, iV, iR, iG, iB; + if( m_bHasRGBPel ) + return; + Int iY, iU, iV, iR, iG, iB; Pel** ppInputPelY = m_pppcInputPel[0]; Pel* pInputPelY = &(m_pppcInputPel[0][0][0]); Pel* pInputPelU = &(m_pppcInputPel[1][0][0]); @@ -205,6 +209,7 @@ Void PlaYUVerFrame::FrametoRGB8() // No action. break; } + m_bHasRGBPel = true; } Void PlaYUVerFrame::FrameFromBuffer( Pel *input_buffer, Int pel_format ) @@ -233,6 +238,7 @@ Void PlaYUVerFrame::FrameFromBuffer( Pel *input_buffer, Int pel_format ) case RGB8: break; } + m_bHasRGBPel = false; } Void PlaYUVerFrame::CopyFrom( PlaYUVerFrame* input_frame ) @@ -261,6 +267,7 @@ Void PlaYUVerFrame::CopyFrom( PlaYUVerFrame* input_frame ) case RGB8: break; } + m_bHasRGBPel = false; } QImage PlaYUVerFrame::getQimage() diff --git a/source/PlaYUVerFrame.h b/source/PlaYUVerFrame.h index 5e663b8..82594a3 100755 --- a/source/PlaYUVerFrame.h +++ b/source/PlaYUVerFrame.h @@ -85,6 +85,7 @@ private: UInt m_uiHeight; Int m_iPixelFormat; + Bool m_bHasRGBPel; Pel** m_pppcInputPel[3]; Pel*** m_pppcRGBPel; };