diff --git a/app/HistogramWidget.cpp b/app/HistogramWidget.cpp index 8bde041..6ec8b83 100644 --- a/app/HistogramWidget.cpp +++ b/app/HistogramWidget.cpp @@ -338,10 +338,9 @@ Void HistogramWidget::stopHistogramComputation() // Update Data Methods //////////////////////////////////////////////////////////////////////////////// -Void HistogramWidget::updateData( Pel ***imageData, UInt imageWidth, UInt imageHeight, Int bitsPerChannel, Int pixel_format, UInt chroma_size, Pel ***selData, +Void HistogramWidget::updateData( Pel ***imageData, UInt imageWidth, UInt imageHeight, Int bitsPerChannel, Int colorSpace, UInt chroma_size, Pel ***selData, UInt selWidth, UInt selHeight ) { - Int colorSpace = PlaYUVerFrame::isRGBorYUVorGray( pixel_format ); d->sixteenBits = ( bool )( bitsPerChannel == 16 ); d->imageColorSpace = colorSpace; @@ -378,10 +377,10 @@ Void HistogramWidget::updateData( Pel ***imageData, UInt imageWidth, UInt imageH delete m_selectionHistogram; // Calc new histogram data - m_imageHistogram = new PlaYUVerFrameStatistics( imageData, imageWidth, imageHeight, bitsPerChannel, pixel_format, chroma_size, this ); + m_imageHistogram = new PlaYUVerFrameStatistics( imageData, imageWidth, imageHeight, bitsPerChannel, colorSpace, chroma_size, this ); if( selData && selWidth && selHeight ) - m_selectionHistogram = new PlaYUVerFrameStatistics( selData, selWidth, selHeight, bitsPerChannel, pixel_format, chroma_size, this ); + m_selectionHistogram = new PlaYUVerFrameStatistics( selData, selWidth, selHeight, bitsPerChannel, colorSpace, chroma_size, this ); else m_selectionHistogram = 0L; } @@ -390,7 +389,7 @@ Void HistogramWidget::updateData( const PlaYUVerFrame *playuver_frame, const Pla { d->sixteenBits = false; //d->imageColorSpace = image.getPelFormat(); - d->imageColorSpace = PlaYUVerFrame::isRGBorYUVorGray( playuver_frame->getPelFormat() ); + d->imageColorSpace = playuver_frame->getColorSpace(); d->imageChannels = playuver_frame->getNumberChannels(); // We are deleting the histogram data, @@ -420,7 +419,7 @@ Void HistogramWidget::updateData( const PlaYUVerFrame *playuver_frame, const Pla } -Void HistogramWidget::updateSelectionData( Pel ***selData, UInt selWidth, UInt selHeight, Int bitsPerChannel, Int pixel_format, UInt chroma_size ) +Void HistogramWidget::updateSelectionData( Pel ***selData, UInt selWidth, UInt selHeight, Int bitsPerChannel, Int colorSpace, UInt chroma_size ) { // Remove old histogram data from memory. @@ -428,7 +427,7 @@ Void HistogramWidget::updateSelectionData( Pel ***selData, UInt selWidth, UInt s delete m_selectionHistogram; // Calc new histogram data - m_selectionHistogram = new PlaYUVerFrameStatistics( selData, selWidth, selHeight, bitsPerChannel, pixel_format, chroma_size, this ); + m_selectionHistogram = new PlaYUVerFrameStatistics( selData, selWidth, selHeight, bitsPerChannel, colorSpace, chroma_size, this ); } Void HistogramWidget::updateSelectionData( const PlaYUVerFrame *selection ) diff --git a/app/HistogramWidget.h b/app/HistogramWidget.h index 2be2377..a9c437c 100644 --- a/app/HistogramWidget.h +++ b/app/HistogramWidget.h @@ -120,7 +120,7 @@ public : /** Update full image histogram data methods.*/ Void updateData( Pel ***imageData, UInt imageWidth, UInt imageHeight, - Int bitsPerChannel, Int pixel_format, UInt chroma_size, + Int bitsPerChannel, Int colorSpace, UInt chroma_size, Pel ***selData = 0, UInt selWidth = 0, UInt selHeight = 0); /** Update full image histogram data from SImage.*/ @@ -128,7 +128,7 @@ public : /** Update image selection histogram data methods.*/ Void updateSelectionData( Pel ***selData, uint selWidth, uint selHeight, - Int bitsPerChannel, Int pixel_format, UInt chroma_size ); + Int bitsPerChannel, Int colorSpace, UInt chroma_size ); /** Update image selection histogram data from SImage.*/ Void updateSelectionData( const PlaYUVerFrame *imageSelection ); diff --git a/app/PlaYUVerFrameStatistics.cpp b/app/PlaYUVerFrameStatistics.cpp index 5b91466..c199fcc 100644 --- a/app/PlaYUVerFrameStatistics.cpp +++ b/app/PlaYUVerFrameStatistics.cpp @@ -99,14 +99,14 @@ PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( const PlaYUVerFrame *playuver_ QThread() { setup( playuver_frame->getPelBufferYUV(), playuver_frame->getWidth(), playuver_frame->getHeight(), playuver_frame->getBitsChannel(), - playuver_frame->getPelFormat(), playuver_frame->getChromaLength(), parent, options ); + playuver_frame->getColorSpace(), playuver_frame->getChromaLength(), parent, options ); } -PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int pixel_format, UInt chroma_size, QObject *parent, +PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int colorSpace, UInt chroma_size, QObject *parent, Options options ) : QThread() { - setup( data, width, height, bitsPerChannel, pixel_format, chroma_size, parent, options ); + setup( data, width, height, bitsPerChannel, colorSpace, chroma_size, parent, options ); } PlaYUVerFrameStatistics::~PlaYUVerFrameStatistics() @@ -122,7 +122,7 @@ PlaYUVerFrameStatistics::~PlaYUVerFrameStatistics() //////////////////////////////////////////////////////////////////////////////// // Setup Function //////////////////////////////////////////////////////////////////////////////// -void PlaYUVerFrameStatistics::setup( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int pixel_format, UInt chroma_size, QObject *parent, +void PlaYUVerFrameStatistics::setup( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int colorSpace, UInt chroma_size, QObject *parent, Options options ) { d = new PlaYUVerFrameStatisticsPrivate; @@ -131,7 +131,7 @@ void PlaYUVerFrameStatistics::setup( Pel ***data, UInt width, UInt height, Int b d->imageHeight = height; d->parent = parent; d->histoSegments = ( bitsPerChannel == 16 ) ? 65536 : 256; - d->imageColorSpace = PlaYUVerFrame::isRGBorYUVorGray( pixel_format ); + d->imageColorSpace = colorSpace; d->imageChromaSize = chroma_size; if( options == CalcLumaWhenRGB ) diff --git a/app/PlaYUVerFrameStatistics.h b/app/PlaYUVerFrameStatistics.h index c38443f..1b93eb7 100644 --- a/app/PlaYUVerFrameStatistics.h +++ b/app/PlaYUVerFrameStatistics.h @@ -93,7 +93,7 @@ public: ~PlaYUVerFrameStatistics(); - void setup( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int pixel_format, UInt chroma_size, QObject *parent = 0, Options options = CalcLumaWhenRGB ); + void setup( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int colorSpace, UInt chroma_size, QObject *parent = 0, Options options = CalcLumaWhenRGB ); /** Method to stop threaded computations.*/ void stopCalcHistogramValues( void ); diff --git a/app/PropertiesSidebar.cpp b/app/PropertiesSidebar.cpp index 50b0479..b7a41f5 100644 --- a/app/PropertiesSidebar.cpp +++ b/app/PropertiesSidebar.cpp @@ -419,11 +419,11 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) } else { - Int pel_fmt = pcFrame->getPelFormat(); - if( m_iLastFrameType != pel_fmt ) + Int colorSpace = pcFrame->getColorSpace(); + if( m_iLastFrameType != colorSpace ) { - m_iLastFrameType = pel_fmt; - if( ( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_RGB || PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_ARGB ) ) + m_iLastFrameType = colorSpace; + if ( colorSpace == PlaYUVerFrame::COLOR_RGB || colorSpace == PlaYUVerFrame::COLOR_ARGB ) { channelCB->clear(); channelCB->clear(); @@ -431,7 +431,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-red.png" ), "Red" ); channelCB->insertItem( SecondChannel, QIcon( ":/images/channel-green.png" ), "Green" ); channelCB->insertItem( ThirdChannel, QIcon( ":/images/channel-blue.png" ), "Blue" ); - if( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_ARGB ) + if( colorSpace == PlaYUVerFrame::COLOR_ARGB ) { channelCB->insertItem( AlphaChannel, QIcon( ":/images/channel-alpha.png" ), "Alpha" ); } @@ -449,7 +449,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) colorsCB->show(); colorsLabel->show(); } - else if( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_YUV ) + else if( colorSpace == PlaYUVerFrame::COLOR_YUV ) { channelCB->clear(); channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" ); @@ -620,9 +620,9 @@ Void FramePropertiesSideBar::slotHistogramComputationFailed() Void FramePropertiesSideBar::slotChannelChanged( Int channel ) { - if( PlaYUVerFrame::isRGBorYUVorGray( m_pcFrame->getPelFormat() ) == PlaYUVerFrame::COLOR_YUV ) + if( m_pcFrame->getColorSpace() == PlaYUVerFrame::COLOR_YUV ) channel += 1; - if( channel == AlphaChannel && PlaYUVerFrame::isRGBorYUVorGray( m_pcFrame->getPelFormat() ) != PlaYUVerFrame::COLOR_ARGB ) + if( channel == AlphaChannel && m_pcFrame->getColorSpace() != PlaYUVerFrame::COLOR_ARGB ) channel = ColorChannels; switch( channel ) diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 8825fa0..63a144e 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -40,26 +40,6 @@ namespace plaYUVer { -Int PlaYUVerFrame::isRGBorYUVorGray( Int pixel_format ) -{ - switch( pixel_format ) - { - case GRAY: - return COLOR_GRAY; - break; - case YUV420p: - case YUV444p: - case YUV422p: - case YUYV422: - return COLOR_YUV; - break; - case RGB8: - return COLOR_RGB; - break; - } - return COLOR_INVALID; -} - QStringList PlaYUVerFrame::supportedPixelFormatListNames() { QStringList formats; diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 48fdb8b..2a5fb87 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -90,7 +90,6 @@ public: NUMBER_FORMATS }; - static Int isRGBorYUVorGray( Int pixel_format ); static QStringList supportedPixelFormatListNames(); PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 );