From 1b84cbb18a6e1850ef8af78085d0af2c7073413b Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 24 Jan 2015 04:30:51 +0000 Subject: [PATCH] Remove Qt dependencies inside PlaYUVerFrame: one step closer to define PlaYUVerLib --- app/ConfigureFormatDialog.cpp | 5 ++++- app/QualityHandle.cpp | 5 ++--- app/QualityMeasurementSidebar.cpp | 7 +++++-- app/VideoHandle.cpp | 3 ++- app/ViewArea.cpp | 2 ++ lib/PlaYUVerFrame.cpp | 8 ++++---- lib/PlaYUVerFrame.h | 17 +++++++---------- lib/PlaYUVerFrameStats.cpp | 7 +++---- lib/PlaYUVerStream.cpp | 8 ++++---- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index ca73973..1195d5b 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -150,7 +150,10 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : m_comboBoxPixelFormat->setSizePolicy( sizePolicyPixelFormat ); m_comboBoxPixelFormat->setAcceptDrops( true ); m_comboBoxPixelFormat->clear(); - m_comboBoxPixelFormat->insertItems( 0, PlaYUVerFrame::supportedPixelFormatListNames() ); + for( UInt i=0; iinsertItem( i, PlaYUVerFrame::supportedPixelFormatListNames()[i].data() ); + } m_comboBoxPixelFormat->setCurrentIndex( 1 ); MainLayout->addItem( new QSpacerItem( 10, 20, QSizePolicy::Minimum ) ); diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp index 38aa6dc..9e5b18d 100644 --- a/app/QualityHandle.cpp +++ b/app/QualityHandle.cpp @@ -51,11 +51,10 @@ Void QualityHandle::createActions() m_mapperQualityMetric = new QSignalMapper( this ); - QStringList qualityMetrics = PlaYUVerFrame::supportedQualityMetricsList(); QAction* currAction; - for( Int i = 0; i < qualityMetrics.size(); i++ ) + for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ ) { - currAction = new QAction( qualityMetrics.at( i ), this ); + currAction = new QAction( PlaYUVerFrame::supportedQualityMetricsList()[i].data(), this ); currAction->setCheckable( true ); m_actionGroupQualityMetric->addAction( currAction ); connect( currAction, SIGNAL( triggered() ), m_mapperQualityMetric, SLOT( map() ) ); diff --git a/app/QualityMeasurementSidebar.cpp b/app/QualityMeasurementSidebar.cpp index f7d16ee..ba4fcfb 100644 --- a/app/QualityMeasurementSidebar.cpp +++ b/app/QualityMeasurementSidebar.cpp @@ -49,7 +49,10 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, PlaYUVerS RecLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); m_comboBoxMetric = new QComboBox; - m_comboBoxMetric->insertItems( 0, PlaYUVerFrame::supportedQualityMetricsList() ); + for( UInt i=0; iinsertItem( i, PlaYUVerFrame::supportedQualityMetricsList()[i].data() ); + } m_comboBoxMetric->setSizeAdjustPolicy( QComboBox::AdjustToContents ); m_comboBoxMetric->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); @@ -204,7 +207,7 @@ Void QualityMeasurementSidebar::updateSidebarData() Void QualityMeasurementSidebar::updateQualityMetric( Int idx ) { m_comboBoxMetric->setCurrentIndex( idx ); - QString labelQuality = PlaYUVerFrame::supportedQualityMetricsList().at( idx ); + QString labelQuality( PlaYUVerFrame::supportedQualityMetricsList()[idx].data() ); m_ppcLabelQualityLabel[LUMA]->setText( labelQuality + " Y" ); m_ppcLabelQualityLabel[CHROMA_U]->setText( labelQuality + " U" ); m_ppcLabelQualityLabel[CHROMA_V]->setText( labelQuality + " V" ); diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index a8da2e5..80b508e 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -218,7 +218,8 @@ Void VideoHandle::update() QString resolution; if( pcFrame ) { - m_pcColorSpace->setText( PlaYUVerFrame::supportedPixelFormatListNames().at( pcFrame->getPelFormat() ) ); + QString pelFmt( PlaYUVerFrame::supportedPixelFormatListNames()[pcFrame->getPelFormat()].data() ); + m_pcColorSpace->setText( pelFmt ); resolution.append( QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) ); } diff --git a/app/ViewArea.cpp b/app/ViewArea.cpp index 8eb145c..0bbdb91 100644 --- a/app/ViewArea.cpp +++ b/app/ViewArea.cpp @@ -25,6 +25,8 @@ #include +#include +#include #include #include #include diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index f579da0..8afca64 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -40,15 +40,15 @@ namespace plaYUVer { -QStringList PlaYUVerFrame::supportedPixelFormatListNames() +std::vector PlaYUVerFrame::supportedPixelFormatListNames() { - QStringList formats; + std::vector formatsList; Int numberFormats = PLAYUVER_NUMBER_FORMATS; for( Int i = 0; i < numberFormats; i++ ) { - formats << g_PlaYUVerFramePelFormatsList[i].name; + formatsList.push_back( g_PlaYUVerFramePelFormatsList[i].name ); } - return formats; + return formatsList; } PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format ) diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 6ae97d9..a3824b1 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "PlaYUVerDefs.h" #include "PlaYUVerFrameStats.h" @@ -91,7 +91,7 @@ public: NUMBER_FORMATS }; - static QStringList supportedPixelFormatListNames(); + static std::vector supportedPixelFormatListNames(); PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 ); PlaYUVerFrame( PlaYUVerFrame * ); @@ -185,14 +185,12 @@ public: NUMBER_METRICS, }; - static QStringList supportedQualityMetricsList() + static std::vector supportedQualityMetricsList() { - QStringList metrics; - metrics << "PSNR" - << "MSE" - << "SSIM" // SSIM - ; - assert( metrics.size() == NUMBER_METRICS ); + std::vector metrics; + metrics.push_back( "PSNR" ); + metrics.push_back( "MSE" ); + metrics.push_back( "SSIM" ); return metrics; } @@ -215,7 +213,6 @@ private: Pel*** m_pppcInputPel; UChar* m_pcRGB32; - Void adjustSelectedAreaDims( QRect &area, Int pel_format ); Void init( UInt width, UInt height, Int pel_format ); Void openPixfc(); Void closePixfc(); diff --git a/lib/PlaYUVerFrameStats.cpp b/lib/PlaYUVerFrameStats.cpp index 1fd30a8..1e57951 100644 --- a/lib/PlaYUVerFrameStats.cpp +++ b/lib/PlaYUVerFrameStats.cpp @@ -80,10 +80,9 @@ Void PlaYUVerFrameStats::calcHistogram() if( !m_pdHistogram ) { - qWarning( ) << "PlaYUVerFrameStats::calcHistogramValuess: " - "Unable to allocate memory!" - << endl; - +// qWarning( ) << "PlaYUVerFrameStats::calcHistogramValuess: " +// "Unable to allocate memory!" +// << endl; return; } diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index 72663ba..6b9e3e1 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -209,8 +209,8 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ return m_bInit; } - m_cStreamInformationString = "[" + m_cFormatName + " / " + m_cCodedName + " / " + PlaYUVerFrame::supportedPixelFormatListNames().at( m_iPixelFormat ) + "] " - + QFileInfo( m_cFilename ).fileName(); + QString pelFmtName( PlaYUVerFrame::supportedPixelFormatListNames()[m_iPixelFormat].data() ); + m_cStreamInformationString = "[" + m_cFormatName + " / " + m_cCodedName + " / " + pelFmtName + "] " + QFileInfo( m_cFilename ).fileName(); m_iCurrFrameNum = -1; @@ -304,10 +304,10 @@ Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, { bGuessed = false; // Guess pixel format - QStringList formats_list = PlaYUVerFrame::supportedPixelFormatListNames(); + QVector formats_list = QVector::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() ); for( Int i = 0; i < formats_list.size(); i++ ) { - if( FilenameShort.contains( formats_list.at( i ), Qt::CaseInsensitive ) ) + if( FilenameShort.contains( formats_list.at( i ).data(), Qt::CaseInsensitive ) ) { rInputFormat = i; break;