Complete PSNR measurement side bar
This commit is contained in:
1 parent
8ba23b3598
commit
987a95f73b
5 files changed
+68
-36
No files matched your search
@@ -46,27 +46,23 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea
|
||||
|
||||
m_comboBoxRef = new QComboBox;
|
||||
|
||||
m_comboBoxRec = new QComboBox;
|
||||
|
||||
updateSubWindowList();
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget( RefLabel, 0, 0, Qt::AlignLeft );
|
||||
mainLayout->addWidget( m_comboBoxRef, 0, 1, Qt::AlignLeft );
|
||||
//mainLayout->addWidget( RecLabel, 1, 0, Qt::AlignLeft );
|
||||
//mainLayout->addWidget( m_comboBoxRec, 1, 1, Qt::AlignLeft );
|
||||
|
||||
m_ppcLabelQualityLabel[LUMA] = new QLabel( tr( "PSNR Y:" ) );
|
||||
m_ppcLabelQualityLabel[LUMA] = new QLabel( "PSNR Y:" );
|
||||
m_ppcLabelQualityLabel[LUMA]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[LUMA] = new QLabel;
|
||||
m_ppcLabelQualityValue[LUMA]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CHROMA_U] = new QLabel( tr( "PSNR U:" ) );
|
||||
m_ppcLabelQualityLabel[CHROMA_U] = new QLabel( "PSNR U:" );
|
||||
m_ppcLabelQualityLabel[CHROMA_U]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_U] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_U]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CHROMA_V] = new QLabel( tr( "PSNR V:" ) );
|
||||
m_ppcLabelQualityLabel[CHROMA_V] = new QLabel( "PSNR V:" );
|
||||
m_ppcLabelQualityLabel[CHROMA_V]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_V] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_V]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
@@ -86,7 +82,7 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea
|
||||
|
||||
mainLayout->addWidget( statisticsGroup, 4, 0, 3, 3 );
|
||||
|
||||
mainLayout->setRowStretch( 8, 10 );
|
||||
//mainLayout->setRowStretch( 8, 10 );
|
||||
setLayout( mainLayout );
|
||||
|
||||
connect( m_comboBoxRef, SIGNAL( activated(int) ), this, SLOT( slotReferenceChanged(int) ) );
|
||||
@@ -134,27 +130,27 @@ Void QualityMeasurementSidebar::updateCurrentWindow( SubWindowHandle *subWindow
|
||||
Void QualityMeasurementSidebar::updateSidebarData()
|
||||
{
|
||||
QString value( "0.00" );
|
||||
SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow();
|
||||
|
||||
if( refSubWindow )
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
PlaYUVerFrame* currFrame = m_pcCurrentSubWindow->getCurrFrame();
|
||||
PlaYUVerFrame* refFrame = refSubWindow->getCurrFrame();
|
||||
Double quality;
|
||||
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
if( SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow() )
|
||||
{
|
||||
quality = currFrame->getPSNR( refFrame, component );
|
||||
m_ppcLabelQualityLabel[component]->setText( value.setNum( quality, 'f', 2 ) );
|
||||
PlaYUVerFrame* currFrame = m_pcCurrentSubWindow->getCurrFrame();
|
||||
PlaYUVerFrame* refFrame = refSubWindow->getCurrFrame();
|
||||
Double quality;
|
||||
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
quality = currFrame->getPSNR( refFrame, component );
|
||||
m_ppcLabelQualityValue[component]->setText( value.setNum( quality, 'f', 2 ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
m_ppcLabelQualityLabel[component]->setText( value );
|
||||
}
|
||||
m_ppcLabelQualityValue[component]->setText( value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Void QualityMeasurementSidebar::slotReferenceChanged( Int index )
|
||||
@@ -164,9 +160,16 @@ Void QualityMeasurementSidebar::slotReferenceChanged( Int index )
|
||||
{
|
||||
subWindow = qobject_cast<SubWindowHandle *>( m_pcMainWindowMdiArea->subWindowList().at( index ) );
|
||||
if( subWindow )
|
||||
m_pcCurrentSubWindow->setRefSubWindow( subWindow );
|
||||
{
|
||||
if( m_pcCurrentSubWindow->getCurrFrame()->haveSameFmt( subWindow->getCurrFrame() ) )
|
||||
{
|
||||
m_pcCurrentSubWindow->setRefSubWindow( subWindow );
|
||||
updateSidebarData();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// updateSidebarData();
|
||||
m_comboBoxRef->setCurrentIndex( -1 );
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -155,14 +155,14 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
||||
|
||||
Void plaYUVerApp::loadFile( QString fileName )
|
||||
{
|
||||
QMdiSubWindow *existing = findSubWindow( fileName );
|
||||
if( existing )
|
||||
SubWindowHandle *interfaceChild = plaYUVerApp::findSubWindow( mdiArea, fileName );
|
||||
if( interfaceChild )
|
||||
{
|
||||
mdiArea->setActiveSubWindow( existing );
|
||||
mdiArea->setActiveSubWindow( interfaceChild );
|
||||
return;
|
||||
}
|
||||
|
||||
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
|
||||
interfaceChild = new SubWindowHandle( this ); //createSubWindow();
|
||||
if( interfaceChild->loadFile( fileName ) )
|
||||
{
|
||||
statusBar()->showMessage( tr( "Loading file..." ) );
|
||||
@@ -559,9 +559,6 @@ Void plaYUVerApp::playEvent()
|
||||
if( !m_arrayActions[VIDEO_LOOP_ACT]->isChecked() )
|
||||
{
|
||||
stop();
|
||||
updateCurrFrameNum();
|
||||
updateFrameProperties();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -584,6 +581,7 @@ Void plaYUVerApp::playEvent()
|
||||
}
|
||||
updateCurrFrameNum();
|
||||
updateFrameProperties();
|
||||
m_pcQualityMeasurement->updateSidebarData();
|
||||
m_uiAveragePlayInterval = ( m_uiAveragePlayInterval + time ) / 2;
|
||||
}
|
||||
|
||||
@@ -799,6 +797,10 @@ Void plaYUVerApp::chageSubWindowSelection()
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
m_pcCurrentSubWindow = new_window;
|
||||
if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentSubWindow->getRefSubWindow() ) )
|
||||
{
|
||||
m_pcCurrentSubWindow->setRefSubWindow( NULL );
|
||||
}
|
||||
updateCurrFrameNum();
|
||||
updateTotalFrameNum();
|
||||
updateStreamProperties();
|
||||
@@ -871,18 +873,28 @@ SubWindowHandle *plaYUVerApp::activeSubWindow()
|
||||
return 0;
|
||||
}
|
||||
|
||||
QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName )
|
||||
SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const QString& fileName )
|
||||
{
|
||||
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
|
||||
|
||||
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
|
||||
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
|
||||
if( mdiChild->currentFile() == canonicalFilePath )
|
||||
return window;
|
||||
return mdiChild;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow )
|
||||
{
|
||||
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
|
||||
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
|
||||
if( mdiChild == subWindow )
|
||||
return mdiChild;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Void plaYUVerApp::setNavigationTool()
|
||||
{
|
||||
m_appTool = NavigationTool;
|
||||
|
||||
@@ -148,7 +148,10 @@ private:
|
||||
Void writeSettings();
|
||||
|
||||
SubWindowHandle *activeSubWindow();
|
||||
QMdiSubWindow *findSubWindow( const QString &fileName );
|
||||
|
||||
static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const QString& fileName );
|
||||
static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow );
|
||||
|
||||
|
||||
QVector<SubWindowHandle*> m_acPlayingSubWindows;
|
||||
QSlider *m_pcFrameSlider;
|
||||
|
||||
@@ -489,7 +489,17 @@ Double PlaYUVerFrame::getMSE( PlaYUVerFrame* Org, Int component )
|
||||
Int diff = 0;
|
||||
Double ssd = 0;
|
||||
|
||||
for( UInt i = 0; i < Org->getHeight() * Org->getWidth(); i++ )
|
||||
Int numberOfPixels = 0;
|
||||
if( component == LUMA )
|
||||
{
|
||||
numberOfPixels = Org->getHeight() * Org->getWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
numberOfPixels = getChromaLength();
|
||||
}
|
||||
|
||||
for( UInt i = 0; i < numberOfPixels; i++ )
|
||||
{
|
||||
aux_pel_1 = *pPelYUV++;
|
||||
aux_pel_2 = *pOrgPelYUV++;
|
||||
|
||||
@@ -170,6 +170,10 @@ public:
|
||||
{
|
||||
return ( m_uiWidth > 0 ) && ( m_uiHeight > 0 ) && ( m_iPixelFormat >= 0 );
|
||||
}
|
||||
Bool haveSameFmt( PlaYUVerFrame* other ) const
|
||||
{
|
||||
return ( m_uiWidth == other->getWidth() ) && ( m_uiHeight == other->getHeight() ) && ( m_iPixelFormat == other->getPelFormat() );
|
||||
}
|
||||
|
||||
private:
|
||||
UInt m_uiWidth;
|
||||
|
||||
Reference in new issue
Block a user