From a38f9c32838ab410bb14108ff389ec81217de57a Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 2 Apr 2015 17:44:10 +0100 Subject: [PATCH] Add a variable to control the number of bits per pixel --- app/FramePropertiesSidebar.cpp | 12 +++++++----- lib/PlaYUVerFrameStats.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/FramePropertiesSidebar.cpp b/app/FramePropertiesSidebar.cpp index 205ed42..bdbef5e 100644 --- a/app/FramePropertiesSidebar.cpp +++ b/app/FramePropertiesSidebar.cpp @@ -284,7 +284,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame, Bool isPlaying ) if( m_iLastFrameType != colorSpace ) { m_iLastFrameType = colorSpace; - if ( colorSpace == PlaYUVerFrame::COLOR_RGB || colorSpace == PlaYUVerFrame::COLOR_ARGB ) + if( colorSpace == PlaYUVerFrame::COLOR_RGB || colorSpace == PlaYUVerFrame::COLOR_ARGB ) { channelCB->clear(); channelCB->clear(); @@ -339,8 +339,11 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame, Bool isPlaying ) colorsLabel->hide(); } } + UInt rangePel = ( 1 << pcFrame->getBitsPel() ) - 1; + minInterv->setRange( 0, rangePel ); + maxInterv->setRange( 0, rangePel ); setEnabled( true ); - if( m_pcFrame || !(*pbMainPlaySwitch) ) + if( m_pcFrame || !( *pbMainPlaySwitch ) ) { m_pcFrame = pcFrame; updateDataHistogram(); @@ -360,9 +363,8 @@ Void FramePropertiesSideBar::setSelection( const QRect &selectionArea ) if( selectionArea.isValid() ) { histogramWidget->stopHistogramComputation(); - histogramWidget->updateSelectionData( new PlaYUVerFrame(m_pcFrame, - selectionArea.x(), selectionArea.y(), - selectionArea.width(), selectionArea.height() ) ); + histogramWidget->updateSelectionData( + new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(), selectionArea.height() ) ); fullImageButton->show(); selectionImageButton->show(); selectionImageButton->click(); diff --git a/lib/PlaYUVerFrameStats.cpp b/lib/PlaYUVerFrameStats.cpp index 4b33e22..5fbe55a 100644 --- a/lib/PlaYUVerFrameStats.cpp +++ b/lib/PlaYUVerFrameStats.cpp @@ -56,7 +56,7 @@ Void PlaYUVerFrameStats::xSetupStatistics( const PlaYUVerFrame *pcFrame, UInt op m_uiImageHeight = pcFrame->getHeight(); m_uiChannels = pcFrame->getNumberChannels(); - m_uiHistoSegments = 1 << pcFrame->getBitsPel(); + m_uiHistoSegments = ( 1 << pcFrame->getBitsPel() ) - 1; imageColorSpace = pcFrame->getColorSpace(); imageChromaSize = pcFrame->getChromaLength();