diff --git a/source/app/QualityMeasurementSidebar.cpp b/source/app/QualityMeasurementSidebar.cpp index d0334f7..c1cadd7 100644 --- a/source/app/QualityMeasurementSidebar.cpp +++ b/source/app/QualityMeasurementSidebar.cpp @@ -38,20 +38,30 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea // Side bar area ----------------------------------------------------- + QLabel *MetricLabel = new QLabel( tr( "Metric:" ) ); + MetricLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); + QLabel *RefLabel = new QLabel( tr( "Ref:" ) ); RefLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); QLabel *RecLabel = new QLabel( tr( "Rec:" ) ); RecLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); + m_comboBoxMetric = new QComboBox; + m_comboBoxMetric->insertItems( 0, PlaYUVerFrame::supportedQualityMetricsList()); + m_comboBoxMetric->setSizeAdjustPolicy( QComboBox::AdjustToContents ); + m_comboBoxMetric->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed); + m_comboBoxRef = new QComboBox; m_comboBoxRef->setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLength ); m_comboBoxRef->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed); updateSubWindowList(); QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget( RefLabel, 0, 0, Qt::AlignLeft ); - mainLayout->addWidget( m_comboBoxRef, 0, 1, Qt::AlignLeft ); + mainLayout->addWidget( MetricLabel, 0, 0, Qt::AlignLeft ); + mainLayout->addWidget( m_comboBoxMetric, 0, 1, Qt::AlignLeft ); + mainLayout->addWidget( RefLabel, 1, 0, Qt::AlignLeft ); + mainLayout->addWidget( m_comboBoxRef, 1, 1, Qt::AlignLeft ); m_ppcLabelQualityLabel[LUMA] = new QLabel( "PSNR Y:" ); m_ppcLabelQualityLabel[LUMA]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); @@ -76,7 +86,8 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CHROMA_V], 2, 0 ); qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CHROMA_V], 2, 1 ); - QGroupBox *statisticsGroup = new QGroupBox( tr( "Quality" ) ); + //QGroupBox *statisticsGroup = new QGroupBox( tr( "Quality" ) ); + QGroupBox *statisticsGroup = new QGroupBox; statisticsGroup->setLayout( qualityResultsLayout ); statisticsGroup->setWhatsThis( tr( "

Here you can see the quality results calculated for the " "selected windows." ) ); @@ -87,6 +98,7 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea setLayout( mainLayout ); connect( m_comboBoxRef, SIGNAL( activated(int) ), this, SLOT( slotReferenceChanged(int) ) ); + connect( m_comboBoxMetric, SIGNAL( currentIndexChanged(int) ), this, SLOT( slotQualityMetricChanged() ) ); } @@ -159,7 +171,7 @@ Void QualityMeasurementSidebar::updateSidebarData() for( Int component = 0; component < 3; component++ ) { - quality = currFrame->getPSNR( refFrame, component ); + quality = currFrame->getQuality( m_comboBoxMetric->currentIndex(), refFrame, component ); m_ppcLabelQualityValue[component]->setText( value.setNum( quality, 'f', 2 ) ); } return; @@ -198,5 +210,13 @@ Void QualityMeasurementSidebar::slotReferenceChanged( Int index ) } } +Void QualityMeasurementSidebar::slotQualityMetricChanged() +{ + QString labelQuality = PlaYUVerFrame::supportedQualityMetricsList().at( m_comboBoxMetric->currentIndex() ); + m_ppcLabelQualityLabel[LUMA]->setText( labelQuality + " Y"); + m_ppcLabelQualityLabel[CHROMA_U]->setText( labelQuality + " U"); + m_ppcLabelQualityLabel[CHROMA_V]->setText( labelQuality + " V"); + updateSidebarData(); +} } // NAMESPACE diff --git a/source/app/QualityMeasurementSidebar.h b/source/app/QualityMeasurementSidebar.h index 51bf01e..8e342cf 100644 --- a/source/app/QualityMeasurementSidebar.h +++ b/source/app/QualityMeasurementSidebar.h @@ -63,6 +63,8 @@ private: SubWindowHandle *m_pcCurrentSubWindow; + QComboBox *m_comboBoxMetric; + QComboBox *m_comboBoxRef; QComboBox *m_comboBoxRec; @@ -73,6 +75,7 @@ private: private Q_SLOTS: void slotReferenceChanged( int ); + void slotQualityMetricChanged(); }; diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index f4a97fe..01ddba3 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -746,6 +746,9 @@ Double PlaYUVerFrame::getQuality( Int Metric, PlaYUVerFrame* Org, Int component case PSNR_METRIC: return getPSNR( Org, component ); break; + case MSE_METRIC: + return getMSE( Org, component ); + break; case SSIM_METRIC: return getSSIM( Org, component ); break; diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index b57f323..a52f42d 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -150,6 +150,7 @@ public: { NO_METRIC = -1, PSNR_METRIC = 0, + MSE_METRIC, SSIM_METRIC, NUMBER_METRICS, }; @@ -158,6 +159,7 @@ public: { QStringList metrics; metrics << "PSNR" + << "MSE" << "SSIM" // SSIM ; assert( metrics.size() == NUMBER_METRICS );