Bugfix in HistogramWidget and PlaYUVerFrameStatistics
Conditions were not proper checking if frame exists Change on some variables name Still incomplete the code and some variable must be renamed to include code style
This commit is contained in:
1 parent
d06f333a6e
commit
e0695f9cdc
5 files changed
+32
-26
No files matched your search
@@ -362,11 +362,12 @@ void HistogramWidget::updateData( uchar *imageData, uint imageWidth, uint imageH
|
||||
m_selectionHistogram = 0L;
|
||||
}
|
||||
|
||||
void HistogramWidget::updateData( const PlaYUVerFrame &image, const PlaYUVerFrame &selection )
|
||||
void HistogramWidget::updateData( const PlaYUVerFrame &playuver_frame, const PlaYUVerFrame &playuver_selection )
|
||||
{
|
||||
d->sixteenBits = false;
|
||||
d->imageColorSpace = image.getPelFormat();
|
||||
d->imageChannels = image.getNumberChannels();
|
||||
//d->imageColorSpace = image.getPelFormat();
|
||||
d->imageColorSpace = PlaYUVerFrame::RGB8;
|
||||
d->imageChannels = playuver_frame.getNumberChannels();
|
||||
|
||||
// We are deleting the histogram data,
|
||||
// so we must not use it to draw any more.
|
||||
@@ -386,12 +387,12 @@ void HistogramWidget::updateData( const PlaYUVerFrame &image, const PlaYUVerFram
|
||||
delete m_selectionHistogram;
|
||||
|
||||
// Calc new histogram data
|
||||
m_imageHistogram = new PlaYUVerFrameStatistics( image, this );
|
||||
m_imageHistogram = new PlaYUVerFrameStatistics( playuver_frame, this );
|
||||
|
||||
if( !selection.isValid() )
|
||||
m_selectionHistogram = new PlaYUVerFrameStatistics( selection, this );
|
||||
if( playuver_selection.isValid() )
|
||||
m_selectionHistogram = new PlaYUVerFrameStatistics( playuver_selection, this );
|
||||
else
|
||||
m_selectionHistogram = 0L;
|
||||
m_selectionHistogram = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public :
|
||||
uchar *selData = 0, uint selWidth = 0, uint selHeight = 0);
|
||||
|
||||
/** Update full image histogram data from SImage.*/
|
||||
void updateData( const PlaYUVerFrame &image, const PlaYUVerFrame &selection );
|
||||
void updateData( const PlaYUVerFrame &playuver_frame, const PlaYUVerFrame &playuver_selection );
|
||||
|
||||
/** Update image selection histogram data methods.*/
|
||||
void updateSelectionData( uchar *selData, uint selWidth, uint selHeight,
|
||||
|
||||
@@ -120,6 +120,9 @@ Void StreamPropertiesSideBar::setData( InputStream* pcStream )
|
||||
{
|
||||
// Clear information.
|
||||
labelFormatValue->clear();
|
||||
labelCodecValue->clear();
|
||||
labelDurationValueTime->clear();
|
||||
labelDurationValueFrames->clear();
|
||||
labelSizeValue->clear();
|
||||
labelColorSpaceValue->clear();
|
||||
|
||||
@@ -409,8 +412,10 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( PlaYUVerFrame::isRGBorYUVorGray( pcFrame->getPelFormat() ) == PlaYUVerFrame::COLOR_RGB
|
||||
|| PlaYUVerFrame::isRGBorYUVorGray( pcFrame->getPelFormat() ) == PlaYUVerFrame::COLOR_ARGB ) && ( channelCB->count() == 1 ) )
|
||||
Int pel_fmt = pcFrame->getPelFormat();
|
||||
pel_fmt = PlaYUVerFrame::RGB8;
|
||||
if( ( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_RGB
|
||||
|| PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_ARGB ) && ( channelCB->count() == 1 ) )
|
||||
{
|
||||
channelCB->addItem( tr( "Red" ) );
|
||||
channelCB->setItemIcon( 1, QIcon( ":/images/channel-red.png" ) );
|
||||
@@ -419,7 +424,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
|
||||
channelCB->addItem( tr( "Blue" ) );
|
||||
channelCB->setItemIcon( 3, QIcon( ":/images/channel-blue.png" ) );
|
||||
|
||||
if( PlaYUVerFrame::isRGBorYUVorGray( pcFrame->getPelFormat() ) == PlaYUVerFrame::COLOR_ARGB )
|
||||
if( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_ARGB )
|
||||
{
|
||||
channelCB->addItem( tr( "Alpha" ) );
|
||||
channelCB->setItemIcon( 4, QIcon( ":/images/channel-alpha.png" ) );
|
||||
@@ -442,7 +447,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
|
||||
|
||||
m_pcFrame = pcFrame;
|
||||
|
||||
if( !m_pcFrame->isValid() )
|
||||
if( m_pcFrame->isValid() )
|
||||
{
|
||||
// If a selection area is done in Image Editor and if the current
|
||||
// image is the same in Image Viewer, then compute too the histogram
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <QtGui>
|
||||
#include "PlaYUVerFrameStatistics.h"
|
||||
#include "LibMemory.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
@@ -64,7 +65,7 @@ public:
|
||||
}
|
||||
|
||||
/** The histogram data.*/
|
||||
double *histogram;
|
||||
Double *histogram;
|
||||
|
||||
/** If true, calc the luminosity channel histogram when the image is RGB */
|
||||
bool calcLuma;
|
||||
@@ -93,16 +94,18 @@ public:
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( const PlaYUVerFrame& image, QObject *parent, Options options ) :
|
||||
PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( const PlaYUVerFrame& playuver_frame, QObject *parent, Options options ) :
|
||||
QThread()
|
||||
{
|
||||
setup( image.getQImageBuffer(), image.getWidth(), image.getHeight(), image.getBitsChannel(), image.getPelFormat(), parent, options );
|
||||
// TODO: check the correct pel_format
|
||||
setup( playuver_frame.getQImageBuffer(), playuver_frame.getWidth(), playuver_frame.getHeight(), playuver_frame.getBitsChannel(), PlaYUVerFrame::RGB8, parent, options );
|
||||
}
|
||||
|
||||
PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( uchar *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent, Options options ) :
|
||||
PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( Pel *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent, Options options ) :
|
||||
QThread()
|
||||
{
|
||||
setup( data, width, height, bitsPerChannel, pixel_format, parent, options );
|
||||
// TODO: check the correct pel_format
|
||||
setup( data, width, height, bitsPerChannel, PlaYUVerFrame::RGB8, parent, options );
|
||||
}
|
||||
|
||||
PlaYUVerFrameStatistics::~PlaYUVerFrameStatistics()
|
||||
@@ -118,7 +121,7 @@ PlaYUVerFrameStatistics::~PlaYUVerFrameStatistics()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Setup Function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void PlaYUVerFrameStatistics::setup( uchar *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent, Options options )
|
||||
void PlaYUVerFrameStatistics::setup( Pel *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent, Options options )
|
||||
{
|
||||
d = new PlaYUVerFrameStatisticsPrivate;
|
||||
d->imageData = data;
|
||||
@@ -287,10 +290,7 @@ void PlaYUVerFrameStatistics::calcHistogramValues()
|
||||
if( d->parent )
|
||||
postProgress( true, false );
|
||||
|
||||
d->histogram = new double[d->histoSegments * d->histoChannels];
|
||||
|
||||
// Initialize the histogram
|
||||
memset( d->histogram, 0, d->histoSegments * d->histoChannels * sizeof(double) );
|
||||
getMem1D<Double>( &(d->histogram ), d->histoSegments * d->histoChannels);
|
||||
|
||||
if( !d->histogram )
|
||||
{
|
||||
@@ -335,8 +335,8 @@ void PlaYUVerFrameStatistics::calcHistogramValues()
|
||||
// 8 bits images.
|
||||
else
|
||||
{
|
||||
uchar *data = d->imageData;
|
||||
uchar luma;
|
||||
Pel *data = d->imageData;
|
||||
Pel luma;
|
||||
for( i = 0; ( i < d->imageHeight * d->imageWidth ) && d->runningFlag; i++ )
|
||||
{
|
||||
for( j = 0; j < d->imageChannels; j++ )
|
||||
|
||||
@@ -87,11 +87,11 @@ public:
|
||||
|
||||
PlaYUVerFrameStatistics( uchar *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent = 0, Options options = CalcLumaWhenRGB );
|
||||
|
||||
PlaYUVerFrameStatistics( const PlaYUVerFrame& image, QObject *parent = 0, Options options = CalcLumaWhenRGB );
|
||||
PlaYUVerFrameStatistics( const PlaYUVerFrame& playuver_frame, QObject *parent = 0, Options options = CalcLumaWhenRGB );
|
||||
|
||||
~PlaYUVerFrameStatistics();
|
||||
|
||||
void setup( uchar *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent = 0, Options options = CalcLumaWhenRGB );
|
||||
void setup( Pel *data, uint width, uint height, int bitsPerChannel, Int pixel_format, QObject *parent = 0, Options options = CalcLumaWhenRGB );
|
||||
|
||||
/** Method to stop threaded computations.*/
|
||||
void stopCalcHistogramValues( void );
|
||||
|
||||
Reference in new issue
Block a user