diff --git a/CMakeLists.txt b/CMakeLists.txt index b755155..ee98942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,8 +125,8 @@ ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HE TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib ${MODULES_LIBS} ${LINKER_LIBS} ) -IF( NOT USE_QT4 ) - QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) +IF( NOT USE_QT4) + QT5_USE_MODULES( ${PROJECT_NAME} ${CURR_QT_MODULES} ) ENDIF() INCLUDE(cmake/Install.cmake) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 5f4fd68..642c0ee 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -9,7 +9,42 @@ INSTALL(FILES ${RSC_DIR}/x-raw.xml DESTINATION share/mime/video ) INSTALL(FILES ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/playuver ) IF( WIN32 ) - + IF( NOT USE_QT4 ) + INSTALL(FILES ${QT_DIR}/bin/QT5Core${QT_DLL_POSTFIX}.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/libGLESv2${QT_DLL_POSTFIX}.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/libEGL${QT_DLL_POSTFIX}.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/icudt52.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/icuin52.dll DESTINATION bin ) + INSTALL(FILES ${QT_DIR}/bin/icuuc52.dll DESTINATION bin ) + + INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal.dll DESTINATION bin/platforms ) + INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen.dll DESTINATION bin/platforms ) + INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows.dll DESTINATION bin/platforms ) + ENDIF() + IF( USE_OPENCV ) + SET(OpenCV_DLL_DIR "${OpenCV_DIR}/bin" CACHE PATH "Where to find OpenCV dlls") + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_core${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_contrib${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_highgui${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_contrib${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_imgproc${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_calib3d${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_features2d${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_flann${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_ml${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_video${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_videostab${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_superres${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_stitching${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_photo${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_objdetect${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_nonfree${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_legacy${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_gpu${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) + ENDIF() + SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls") INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin ) INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin ) diff --git a/cmake/LibFervor.cmake b/cmake/LibFervor.cmake index ac13ba5..b6fb941 100644 --- a/cmake/LibFervor.cmake +++ b/cmake/LibFervor.cmake @@ -13,34 +13,6 @@ IF( USE_FERVOR ) ADD_SUBDIRECTORY( ${FERVOR_DIR} ) INCLUDE_DIRECTORIES( ${FERVOR_DIR} ) LIST(APPEND LINKER_LIBS "Fervor" ) - - FIND_PACKAGE( Qt5Network REQUIRED ) - FIND_PACKAGE( Qt5WebKit REQUIRED ) - FIND_PACKAGE( Qt5WebKitWidgets REQUIRED ) - LIST(APPEND LINKER_LIBS ${FERVOR_DEPENDENCIES} ) - INCLUDE_DIRECTORIES( ${FERVOR_INCLUDE_DIRS} ) - - SET(QT_USE_QTNETWORK true) - SET(QT_USE_QTWEBKIT true) - - IF( WIN32 ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin ) - - ENDIF() - - LIST(APPEND QT_MODULES Network WebKit WebKitWidgets ) - ELSE() MESSAGE( "Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!" ) SET( USE_FERVOR False ) diff --git a/cmake/LibOpenCV.cmake b/cmake/LibOpenCV.cmake index 1437796..39b4be6 100644 --- a/cmake/LibOpenCV.cmake +++ b/cmake/LibOpenCV.cmake @@ -9,26 +9,4 @@ IF( USE_OPENCV ) ELSE() LIST(APPEND LINKER_LIBS ${OpenCV_LIBRARIES} ) ENDIF() - - IF( WIN32 ) - SET(OpenCV_DLL_DIR "${OpenCV_DIR}/bin" CACHE PATH "Where to find OpenCV dlls") - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_core${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_contrib${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_highgui${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_contrib${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_imgproc${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_calib3d${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_features2d${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_flann${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_ml${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_video${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_videostab${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_superres${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_stitching${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_photo${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_objdetect${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_nonfree${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_legacy${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_gpu${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) - ENDIF() ENDIF() \ No newline at end of file diff --git a/cmake/LibQT.cmake b/cmake/LibQT.cmake index 99944ff..223f167 100644 --- a/cmake/LibQT.cmake +++ b/cmake/LibQT.cmake @@ -9,51 +9,32 @@ IF( WIN32 ) ENDIF() IF( USE_QT4 ) - - FIND_PACKAGE( Qt4 REQUIRED QtCore QtGui QtNetwork QtWebKit ) - IF( NOT QT4_FOUND) - SET(USE_QT4 FALSE) - ENDIF() - INCLUDE( ${QT_USE_FILE} ) - ADD_DEFINITIONS( ${QT_DEFINITIONS} ) - - QT4_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) - QT4_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) - LIST(APPEND LINKER_LIBS ${QT_LIBRARIES} ) - + FIND_PACKAGE( Qt4 REQUIRED QtCore QtGui QtNetwork QtWebKit ) + IF( NOT QT4_FOUND) + SET(USE_QT4 FALSE) + ENDIF() + INCLUDE( ${QT_USE_FILE} ) + ADD_DEFINITIONS( ${QT_DEFINITIONS} ) + + QT4_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) + QT4_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) + LIST(APPEND LINKER_LIBS ${QT_LIBRARIES} ) ENDIF() IF( NOT USE_QT4 ) - - FIND_PACKAGE( Qt5Core REQUIRED ) - FIND_PACKAGE( Qt5Gui REQUIRED ) - FIND_PACKAGE( Qt5Widgets REQUIRED ) - - INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ) - # QT5_WRAP_CPP( HEADERS_MOC_FILES ${HEADERS_FILES} ) - QT5_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) - QT5_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) - - # Add compiler flags for building executables (-fPIE) - LIST(APPEND CMAKE_CXX_FLAGS ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} ) - - LIST(APPEND LINKER_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ) - - IF( WIN32 ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/libGLESv2${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/libEGL${QT_DLL_POSTFIX}.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/icudt52.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/icuin52.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/bin/icuuc52.dll DESTINATION bin ) + FIND_PACKAGE( Qt5Core REQUIRED ) + FIND_PACKAGE( Qt5Gui REQUIRED ) + FIND_PACKAGE( Qt5Widgets REQUIRED ) + FIND_PACKAGE( Qt5Network REQUIRED ) - INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal.dll DESTINATION bin/platforms ) - INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen.dll DESTINATION bin/platforms ) - INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows.dll DESTINATION bin/platforms ) - ENDIF() - - LIST(APPEND QT_MODULES Core Gui Widgets ) - + INCLUDE_DIRECTORIES( ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ) + # QT5_WRAP_CPP( HEADERS_MOC_FILES ${HEADERS_FILES} ) + QT5_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) + QT5_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) + + # Add compiler flags for building executables (-fPIE) + LIST(APPEND CMAKE_CXX_FLAGS ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} ) + + LIST(APPEND LINKER_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ) + SET( CURR_QT_MODULES Core Gui Widgets ) ENDIF() diff --git a/cmake/ModuleDefault.cmake b/cmake/ModuleDefault.cmake index c8cba74..cefe152 100644 --- a/cmake/ModuleDefault.cmake +++ b/cmake/ModuleDefault.cmake @@ -4,7 +4,7 @@ ADD_MODULE( FilterFrame "FilterFrame.cpp" ) ADD_MODULE( FrameDifference "FrameDifference.cpp" ) -ADD_MODULE( MeasurePSNR "MeasurePSNR.cpp" ) +#ADD_MODULE( MeasurePSNR "MeasurePSNR.cpp" ) IF( USE_OPENCV ) ADD_MODULE( DisparityStereoVar "DisparityStereoVar.cpp" ) diff --git a/config.h.in b/config.h.in index be6401b..960df62 100644 --- a/config.h.in +++ b/config.h.in @@ -31,7 +31,7 @@ #define PLAYUVER_VERSION_MINOR @PLAYUVER_VERSION_MINOR@ #define PLAYUVER_VERSION_PATCH @PLAYUVER_VERSION_PATCH@ #define PLAYUVER_VERSION @PLAYUVER_VERSION@ -#define PLAYUVER_VERSION_STRING "@PLAYUVER_VERSION@" + /* QT definition */ #cmakedefine USE_QT4 diff --git a/resources/playuver.qrc b/resources/playuver.qrc index 5c16513..7a54937 100755 --- a/resources/playuver.qrc +++ b/resources/playuver.qrc @@ -1,8 +1,6 @@ icons/playuver.png - playuver-background-logo.png - icons/open.png icons/save.png icons/close.png diff --git a/source/app/ConfigureFormatDialog.cpp b/source/app/ConfigureFormatDialog.cpp index 5425404..d2d1105 100644 --- a/source/app/ConfigureFormatDialog.cpp +++ b/source/app/ConfigureFormatDialog.cpp @@ -43,12 +43,10 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : // Config dialog - struct PlaYUVerStream::StandardResolution stdRes = PlaYUVerStream::standardResolutionSizes(); - standardResolutionNames = stdRes.stringListFullName; - standardResolutionSizes = stdRes.sizeResolution; + setStandardResolutionSizes(); setObjectName( QStringLiteral( "ConfigureFormat" ) ); - resize( 392, 370 ); + resize( 392, 350 ); setWindowTitle( "Configure Resolution" ); setWindowIcon( QIcon( ":/images/configureformat.png" ) ); @@ -70,20 +68,6 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : MainLayout->addLayout( headLayout ); - MainLayout->addItem( new QSpacerItem( 10, 20, QSizePolicy::Minimum ) ); - - // Filename layout - QHBoxLayout* filenameLayout = new QHBoxLayout(); - QLabel* filenameLabel = new QLabel(); - filenameLabel->setText( "Name" ); - filenameLabel->setFont( menusFont ); - m_labelFilename = new QLabel(); - m_labelFilename->setText( "Test" ); - filenameLayout->addWidget( filenameLabel ); - filenameLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - filenameLayout->addWidget( m_labelFilename ); - MainLayout->addLayout( filenameLayout ); - // standardResolutionLayout MainLayout->addItem( new QSpacerItem( 10, 20, QSizePolicy::Minimum ) ); QHBoxLayout* standardResolutionLayout = new QHBoxLayout(); @@ -193,18 +177,16 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : } -Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) +Int ConfigureFormatDialog::runConfigureFormatDialog( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) { // Set default values - m_labelFilename->setText( Filename ); - //m_labelFilename->setText( QFileInfo( Filename ).fileName() ); m_spinBoxWidth->setValue( rWidth ); m_spinBoxheight->setValue( rHeight ); m_comboBoxPixelFormat->setCurrentIndex( rInputFormat >= 0 ? rInputFormat : 0 ); m_spinBoxFrameRate->setValue( rFrameRate ); - for( Int i = 0; i < standardResolutionSizes.size(); i++ ) + for( Int i = 0; i < standardResolutionSizesList.size(); i++ ) { - if( standardResolutionSizes.at( i ) == QSize( rWidth, rHeight ) ) + if( standardResolutionSizesList.at( i ) == QSize( rWidth, rHeight ) ) { m_comboBoxStandardResolution->setCurrentIndex( i ); } @@ -226,7 +208,7 @@ void ConfigureFormatDialog::StandardResolutionSelection() if( currIdx == -1 ) return; - QSize currSize = standardResolutionSizes.at( currIdx ); + QSize currSize = standardResolutionSizesList.at( currIdx ); m_spinBoxWidth->setValue( currSize.width() ); m_spinBoxheight->setValue( currSize.height() ); } diff --git a/source/app/ConfigureFormatDialog.h b/source/app/ConfigureFormatDialog.h index c3d564e..09b8536 100644 --- a/source/app/ConfigureFormatDialog.h +++ b/source/app/ConfigureFormatDialog.h @@ -56,22 +56,37 @@ Q_OBJECT public: ConfigureFormatDialog( QWidget *parent = 0 ); - Int runConfigureFormatDialog ( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); + Int runConfigureFormatDialog ( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); private Q_SLOTS: void StandardResolutionSelection(); private: QStringList standardResolutionNames; - QVector standardResolutionSizes; + QList standardResolutionSizesList; - QLabel* m_labelFilename; QComboBox *m_comboBoxStandardResolution; QSpinBox *m_spinBoxWidth; QSpinBox *m_spinBoxheight; QComboBox *m_comboBoxPixelFormat; QSpinBox *m_spinBoxFrameRate; + Void setStandardResolutionSizes() + { + ADD_STANDARD_RESOLUTION( "CIF (352x288)", 352, 288 ); + ADD_STANDARD_RESOLUTION( "VGA (640x480)", 640, 480 ); + ADD_STANDARD_RESOLUTION( "WVGA (832x480)", 832, 480 ); + ADD_STANDARD_RESOLUTION( "XVGA (1024x768)", 1024, 768 ); + ADD_STANDARD_RESOLUTION( "HD (1280x720)", 1280, 720 ); + ADD_STANDARD_RESOLUTION( "SXGA- (1280x900)", 1280, 900 ); + ADD_STANDARD_RESOLUTION( "SXGA (1280x1024)", 1280, 1024 ); + ADD_STANDARD_RESOLUTION( "WSXGA (1440x900)", 1440, 900 ); + ADD_STANDARD_RESOLUTION( "Full HD (1920x1080)", 1920, 1080 ); + ADD_STANDARD_RESOLUTION( "WQXGA (2560x1600)", 2560, 1600 ); + ADD_STANDARD_RESOLUTION( "Ultra HD (3840x2160)", 3840, 2160 ); + ADD_STANDARD_RESOLUTION( "8K", 8192, 4608 ); + } + }; } // NAMESPACE diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index ee857c0..4e7bfdf 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -33,7 +33,7 @@ namespace plaYUVer { -ModulesHandle::ModulesHandle( QMainWindow * parent, QMdiArea *mdiArea ) : +ModulesHandle::ModulesHandle( QWidget * parent, QMdiArea *mdiArea ) : QObject( parent ), m_pcParent( parent ), m_pcMdiArea( mdiArea ), @@ -106,7 +106,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf QString windowName; UInt numberOfFrames = pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames; - if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows + if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) { DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames ); if( dialogWindowsSelection.exec() == QDialog::Accepted ) @@ -133,7 +133,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf } else { - windowName.append( pcSubWindow->getWindowName() ); + windowName.append( pcSubWindow->userFriendlyCurrentFile() ); pcCurrModuleIf->m_pcSubWindow[0] = pcSubWindow; } windowName.append( " <" ); @@ -141,41 +141,18 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf windowName.append( ">" ); pcCurrModuleIf->m_pcDisplaySubWindow = NULL; - if( pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + if( ( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { - if( ( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) - { - interfaceChild = new SubWindowHandle( m_pcParent, true ); - interfaceChild->setWindowName( windowName ); - connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), m_pcParent, - SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); - pcCurrModuleIf->m_pcDisplaySubWindow = interfaceChild; - pcCurrModuleIf->m_pcDisplaySubWindow->setModule( pcCurrModuleIf ); - } - } - else if( pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) - { - if( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR ) - { - pcCurrModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrModuleIf ); - QString titleDockWidget; - titleDockWidget.append( pcCurrModuleIf->m_cModuleDef.m_pchModuleName ); - titleDockWidget.append( " Information" ); - pcCurrModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent ); - pcCurrModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); - pcCurrModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - pcCurrModuleIf->m_pcDockWidget->setWidget( pcCurrModuleIf->m_pcModuleDock ); - //pcCurrModuleIf->m_pcDockWidget->setAttribute( Qt::WA_DeleteOnClose ); - m_pcParent->addDockWidget( Qt::RightDockWidgetArea, pcCurrModuleIf->m_pcDockWidget ); - - //connect( pcCurrModuleIf->m_pcDockWidget, SIGNAL( visibilityChanged(bool) ), pcCurrModuleIf->m_pcModuleDock, SLOT( visibilityChangedSlot(bool) ) ); - } + interfaceChild = new SubWindowHandle( m_pcParent, true ); + interfaceChild->setWindowName( windowName ); + connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), m_pcParent, + SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + pcCurrModuleIf->m_pcDisplaySubWindow = interfaceChild; + pcCurrModuleIf->m_pcDisplaySubWindow->setModule( pcCurrModuleIf ); } - // Create Module pcCurrModuleIf->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() ); - // Associate module with subwindows for( UInt i = 0; i < numberOfFrames; i++ ) { pcCurrModuleIf->m_pcSubWindow[i]->enableModule( pcCurrModuleIf ); @@ -187,16 +164,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) { - if( pcCurrModuleIf->m_pcModuleDock ) - { - pcCurrModuleIf->m_pcModuleDock->close(); - pcCurrModuleIf->m_pcModuleDock = NULL; - } - if( pcCurrModuleIf->m_pcDockWidget ) - { - pcCurrModuleIf->m_pcDockWidget->close(); - pcCurrModuleIf->m_pcDockWidget = NULL; - } + pcCurrModuleIf->m_pcAction->setChecked( false ); if( pcCurrModuleIf->m_pcDisplaySubWindow ) pcCurrModuleIf->m_pcDisplaySubWindow->close(); pcCurrModuleIf->m_pcDisplaySubWindow = NULL; @@ -209,13 +177,6 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcSubWindow[i] = NULL; } } - if( pcCurrModuleIf->m_pcModuleStream ) - { - pcCurrModuleIf->m_pcModuleStream->close(); - delete pcCurrModuleIf->m_pcModuleStream; - pcCurrModuleIf->m_pcModuleStream = NULL; - } - pcCurrModuleIf->m_pcAction->setChecked( false ); pcCurrModuleIf->destroy(); } @@ -239,7 +200,7 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlay #endif pcCurrModuleIf->run(); - if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + if( pcCurrModuleIf->m_pcDisplaySubWindow ) { bRet = true; } @@ -268,14 +229,14 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) QApplication::setOverrideCursor( Qt::WaitCursor ); for( UInt f = 0; f < numberOfFrames; f++ ) { - applyModuleIf( pcCurrModuleIf, false, true ); - //QCoreApplication::processEvents(); - pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame ); for( UInt i = 0; i < numberOfWindows; i++ ) { pcCurrModuleIf->m_pcSubWindow[i]->play(); pcCurrModuleIf->m_pcSubWindow[i]->playEvent(); } + applyModuleIf( pcCurrModuleIf, false, false ); + QCoreApplication::processEvents(); + pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame ); } QApplication::restoreOverrideCursor(); } @@ -290,6 +251,7 @@ Void ModulesHandle::openModuleIfStream( PlaYUVerModuleIf *pcCurrModuleIf ) UInt Width = 0, Height = 0, FrameRate = 30; Int InputFormat = -1; + QString supported = tr( "Supported Files (" ); QStringList formatsList; QStringList formatsExt = PlaYUVerStream::supportedWriteFormatsExt(); @@ -346,13 +308,6 @@ Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFram return bRet; } -Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Double moduleResult ) -{ - Bool bRet = false; - pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue(moduleResult); - return bRet; -} - Void ModulesHandle::swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf ) { if( pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES ) @@ -372,15 +327,7 @@ Void ModulesHandle::customEvent( QEvent *event ) PlaYUVerModuleIf::EventData *eventData = ( PlaYUVerModuleIf::EventData* )event; if( eventData->m_bSuccess ) { - switch( eventData->m_pcModule->m_cModuleDef.m_iModuleType ) - { - case FRAME_PROCESSING_MODULE: - showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_pcProcessedFrame ); - break; - case FRAME_MEASUREMENT_MODULE: - showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_dMeasurementResult ); - break; - } + showModuleIf( eventData->m_pcModule, eventData->m_pcProcessedFrame ); } } diff --git a/source/app/ModulesHandle.h b/source/app/ModulesHandle.h index d65238d..161b800 100644 --- a/source/app/ModulesHandle.h +++ b/source/app/ModulesHandle.h @@ -36,20 +36,19 @@ #elif( QT_VERSION_PLAYUVER == 4 ) #include #endif + #include "PlaYUVerModuleIf.h" -#include "PlaYUVerFrame.h" namespace plaYUVer { -class PlaYUVerModuleIf; class SubWindowHandle; class ModulesHandle: public QObject { Q_OBJECT public: - ModulesHandle( QMainWindow* parent = 0, QMdiArea *mdiArea = 0 ); + ModulesHandle( QWidget * parent = 0, QMdiArea *mdiArea = 0 ); ~ModulesHandle(); QMenu* createMenus( QMenuBar* MainAppMenuBar ); @@ -60,11 +59,11 @@ public: static Bool applyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf, Bool isPlaying, Bool disableThreads = false ); static Void swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf ); static Bool showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ); - static Bool showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Double moduleResult ); + static Void applyAllModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); private: - QMainWindow *m_pcParent; + QWidget *m_pcParent; QMdiArea *m_pcMdiArea; UInt m_uiModulesCount; Int m_iOptionSelected; @@ -102,7 +101,6 @@ private: private Q_SLOTS: void selectModule( int index ); void destroyAllModulesIf(); - }; } // NAMESPACE diff --git a/source/app/PlaYUVerModuleIf.cpp b/source/app/PlaYUVerModuleIf.cpp index 3c3172b..96e531a 100644 --- a/source/app/PlaYUVerModuleIf.cpp +++ b/source/app/PlaYUVerModuleIf.cpp @@ -31,8 +31,6 @@ namespace plaYUVer PlaYUVerModuleIf::PlaYUVerModuleIf() : m_pcAction( NULL ), m_pcDisplaySubWindow( NULL ), - m_pcDockWidget( NULL ), - m_pcModuleDock( NULL ), m_pcModuleStream( NULL ), m_pcProcessedFrame( NULL ) { @@ -44,51 +42,28 @@ PlaYUVerModuleIf::PlaYUVerModuleIf() : void PlaYUVerModuleIf::run() { - m_pcProcessedFrame = NULL; - m_dMeasurementResult = 0; - - if( m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + switch( m_cModuleDef.m_uiNumberOfFrames ) { - switch( m_cModuleDef.m_uiNumberOfFrames ) - { - case MODULE_REQUIRES_ONE_FRAME: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() ); - break; - case MODULE_REQUIRES_TWO_FRAMES: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); - break; - case MODULE_REQUIRES_THREE_FRAMES: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); - break; - } + case MODULE_REQUIRES_ONE_FRAME: + m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() ); + break; + case MODULE_REQUIRES_TWO_FRAMES: + m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); + break; + case MODULE_REQUIRES_THREE_FRAMES: + m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); + break; } - else if( m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) - { - switch( m_cModuleDef.m_uiNumberOfFrames ) - { - case MODULE_REQUIRES_ONE_FRAME: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame() ); - break; - case MODULE_REQUIRES_TWO_FRAMES: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); - break; - case MODULE_REQUIRES_THREE_FRAMES: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); - break; - } - } - else - { - return; - } - postProgress( true ); - return; + postProgress( true, m_pcProcessedFrame ); } -Void PlaYUVerModuleIf::postProgress( Bool success ) +Void PlaYUVerModuleIf::postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame ) { - EventData *eventData = new EventData( success, this ); - if( parent() ) + EventData *eventData = new EventData(); + eventData->m_bSuccess = success; + eventData->m_pcProcessedFrame = pcProcessedFrame; + eventData->m_pcModule = this; + if( parent() && pcProcessedFrame ) QCoreApplication::postEvent( parent(), eventData ); } diff --git a/source/app/PlaYUVerModuleIf.h b/source/app/PlaYUVerModuleIf.h index 12c8656..7c45b42 100644 --- a/source/app/PlaYUVerModuleIf.h +++ b/source/app/PlaYUVerModuleIf.h @@ -31,7 +31,6 @@ #include #include "PlaYUVerFrame.h" #include "PlaYUVerStream.h" -#include "ModuleHandleDock.h" class QAction; @@ -41,6 +40,7 @@ namespace plaYUVer enum // Module type { FRAME_PROCESSING_MODULE, + VIDEO_PROCESSING_MODULE, FRAME_MEASUREMENT_MODULE, }; @@ -96,30 +96,26 @@ class PlaYUVerModuleIf private: QAction* m_pcAction; SubWindowHandle* m_pcSubWindow[MAX_NUMBER_FRAMES]; - SubWindowHandle* m_pcDisplaySubWindow; - - QDockWidget* m_pcDockWidget; - ModuleHandleDock* m_pcModuleDock; - PlaYUVerModuleDefinition m_cModuleDef; PlaYUVerStream* m_pcModuleStream; PlaYUVerFrame* m_pcProcessedFrame; - Double m_dMeasurementResult; - Void postProgress( Bool success ); + Void postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame ); public: class EventData: public QEvent { public: - EventData( bool success = false, PlaYUVerModuleIf* module = NULL ) : + EventData() : QEvent( QEvent::User ) { - m_bSuccess = success; - m_pcModule = module; + m_bSuccess = false; + m_pcProcessedFrame = NULL; + m_pcModule = NULL; } Bool m_bSuccess; + PlaYUVerFrame* m_pcProcessedFrame; PlaYUVerModuleIf* m_pcModule; }; @@ -130,18 +126,14 @@ public: virtual Void create() {} virtual Void create( PlaYUVerFrame* ) {} + virtual Void process() {} virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; } virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } - virtual Double measure( PlaYUVerFrame* ) { return 0; } - virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } - virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } - virtual Void destroy() { } - Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; } - PlaYUVerModuleDefinition getModuleDefinition() { return m_cModuleDef; } + Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; } protected: virtual void run(); diff --git a/source/app/PlaYUVerSettings.cpp b/source/app/PlaYUVerSettings.cpp index f1cab01..13bd8db 100644 --- a/source/app/PlaYUVerSettings.cpp +++ b/source/app/PlaYUVerSettings.cpp @@ -73,18 +73,16 @@ Void PlaYUVerSettings::setSelectedTool( Int tool ) m_settings.setValue( "MainWindow/SelectedTool", tool ); } -Void PlaYUVerSettings::setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement ) +Void PlaYUVerSettings::setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties ) { m_settings.setValue( "Dock/StreamProperties", statusStreamProperties ); m_settings.setValue( "Dock/FrameProperties", statusFrameProperties ); - m_settings.setValue( "Dock/QualityMeasurement", statusQualityMeasurement ); } -Void PlaYUVerSettings::getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement ) +Void PlaYUVerSettings::getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties ) { statusStreamProperties = m_settings.value( "Dock/StreamProperties", true ).toBool(); statusFrameProperties = m_settings.value( "Dock/FrameProperties", true ).toBool(); - statusQualityMeasurement = m_settings.value( "Dock/QualityMeasurement", true ).toBool(); } // - - - - - - - - - - - - PLaying Settings - - - - - - - - - - - - - - - - diff --git a/source/app/PlaYUVerSettings.h b/source/app/PlaYUVerSettings.h index 58fe9b9..889ef5c 100644 --- a/source/app/PlaYUVerSettings.h +++ b/source/app/PlaYUVerSettings.h @@ -56,8 +56,8 @@ public: Bool getVideoLock(); Void setPlayingSettings( Bool repeat, Bool lock ); - Void setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement ); - Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement ); + Void setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties ); + Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties ); // - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - GridManager::Style gridStyle(); diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index 55e8448..c2017a9 100644 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -269,7 +269,7 @@ FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent, Bool *pbIsPlayi // ------------------------------------------------------------- - histogramWidget = new HistogramWidget( 256, 100 ); + histogramWidget = new HistogramWidget( 256, 140 ); histogramWidget->setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel ); histogramWidget->setWhatsThis( tr( "

This is the histogram drawing of " "the selected image channel" ) ); diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 11d7305..1e08a1e 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -31,11 +31,6 @@ namespace plaYUVer SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) : QMdiSubWindow( parent ), - m_pCurrStream( NULL ), - m_pcCurrFrame( NULL ), - m_pcCurrentModule( NULL ), - m_pcReferenceSubWindow( NULL ), - m_bIsPlaying( false ), m_bIsModule( isModule ) { setParent( parent ); @@ -55,11 +50,17 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) : connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) ); connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) ); -// Define the cViewArea as the widget inside the scroll area + // Define the cViewArea as the widget inside the scroll area m_cScrollArea->setWidget( m_cViewArea ); m_cScrollArea->setWidgetResizable( true ); + m_pCurrStream = NULL; + //m_pCurrStream = new PlaYUVerStream; + m_pcCurrFrame = NULL; + m_pcCurrentModule = NULL; + m_cWindowName = QString( " " ); + m_bIsPlaying = false; m_cLastScroll = QPoint(); } @@ -94,7 +95,7 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog ) if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog ) { ConfigureFormatDialog formatDialog( this ); - if( formatDialog.runConfigureFormatDialog( cFilename, Width, Height, InputFormat, FrameRate ) == QDialog::Rejected ) + if( formatDialog.runConfigureFormatDialog( Width, Height, InputFormat, FrameRate ) == QDialog::Rejected ) { return false; } @@ -114,7 +115,6 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog ) m_cCurrFileName = cFilename; m_cWindowName = m_pCurrStream->getStreamInformationString(); - m_cWindowShortName = QFileInfo( cFilename ).fileName(); setWindowTitle( m_cWindowName ); return true; } @@ -130,7 +130,7 @@ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module ) disableModule(); } m_pcCurrentModule = select_module; -// refreshFrame(); + // refreshFrame(); } Void SubWindowHandle::disableModule() @@ -202,33 +202,8 @@ Void SubWindowHandle::refreshFrame() Bool SubWindowHandle::save( QString filename ) { - Bool iRet = false; QApplication::setOverrideCursor( Qt::WaitCursor ); - if( !m_pCurrStream ) - { - if( !m_pcCurrFrame ) - { - return false; - } - Int iFileFormat = PlaYUVerStream::INVALID_INPUT; - QStringList formatsExt = PlaYUVerStream::supportedReadFormatsExt(); - QString currExt = QFileInfo( filename ).suffix(); - if( formatsExt.contains( currExt ) ) - { - iFileFormat = formatsExt.indexOf( currExt ); - } - if( iFileFormat == PlaYUVerStream::YUVINPUT ) - { - return false; - } - m_pcCurrFrame->FrametoRGB8(); - QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 ); - iRet = qimg.save( filename ); - } - else - { - iRet = m_pCurrStream->saveFrame( filename ); - } + Bool iRet = m_pCurrStream->saveFrame( filename ); QApplication::restoreOverrideCursor(); return iRet; } @@ -307,7 +282,7 @@ Void SubWindowHandle::normalSize() Void SubWindowHandle::zoomToFit() { -// Scale to a smaller size that the real to a nicer look + // Scale to a smaller size that the real to a nicer look QSize niceFit( m_cScrollArea->viewport()->size().width() - 5, m_cScrollArea->viewport()->size().height() - 5 ); scaleView( niceFit ); } @@ -334,7 +309,7 @@ Void SubWindowHandle::scaleView( const QSize & size ) QSize newSize = imgViewSize; newSize.scale( size, Qt::KeepAspectRatio ); -// Calc the zoom factor + // Calc the zoom factor Double wfactor = 1; Double hfactor = 1; @@ -415,7 +390,7 @@ void SubWindowHandle::updateLastScrollValue() QSize SubWindowHandle::sizeHint() const { QSize maxSize; // The size of the parent (viewport widget -// of the QMdiArea). + // of the QMdiArea). QWidget *p = parentWidget(); if( p ) @@ -429,8 +404,8 @@ QSize SubWindowHandle::sizeHint() const else if( m_pCurrStream ) isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 ); -// If the SubWindowHandle needs more space that the avaiable, we'll give -// to the subwindow a reasonable size preserving the image aspect ratio. + // If the SubWindowHandle needs more space that the avaiable, we'll give + // to the subwindow a reasonable size preserving the image aspect ratio. if( isize.width() < maxSize.width() && isize.height() < maxSize.height() ) { return isize; diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 41c14ab..6a68ba2 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -38,7 +38,6 @@ namespace plaYUVer { -class SubWindowHandle; class SubWindowHandle: public QMdiSubWindow { @@ -49,15 +48,12 @@ private: QScrollArea* m_cScrollArea; ViewArea* m_cViewArea; + PlaYUVerModuleIf* m_pcCurrentModule; + PlaYUVerStream* m_pCurrStream; PlaYUVerFrame* m_pcCurrFrame; - PlaYUVerModuleIf* m_pcCurrentModule; - - SubWindowHandle* m_pcReferenceSubWindow; - QString m_cWindowName; - QString m_cWindowShortName; QString m_cCurrFileName; Bool m_bIsPlaying; @@ -72,7 +68,7 @@ public: Bool mayClose(); Bool loadFile( QString cFilename, Bool bForceDialog = false ); Void reloadFile(); - Bool save( QString filename ); + Bool save( QString filename ); Bool play(); Void pause(); @@ -121,15 +117,6 @@ public: return m_pcCurrentModule; } - Void setRefSubWindow( SubWindowHandle* subWindow ) - { - m_pcReferenceSubWindow = subWindow; - } - SubWindowHandle* getRefSubWindow() - { - return m_pcReferenceSubWindow; - } - /** * Functions to enable a module in the * current SubWindow @@ -184,11 +171,13 @@ public: { return m_cWindowName; } - QString getWindowShortName() + + QString userFriendlyCurrentFile() { - return m_cWindowShortName; + return m_cWindowName; } - QString getCurrentFileName() + + QString currentFile() { return m_cCurrFileName; } diff --git a/source/app/ViewArea.cpp b/source/app/ViewArea.cpp index dbba02c..1e5851d 100644 --- a/source/app/ViewArea.cpp +++ b/source/app/ViewArea.cpp @@ -109,14 +109,6 @@ void ViewArea::clearMask() // return QSize( w, h ); // } -Void ViewArea::setZoomFactor( Double f ) -{ - m_zoomFactor = f; - - updateSize(); - update(); -} - Void ViewArea::zoomChangeEvent( Double factor, QPoint center ) { Double zoomFactor; @@ -142,6 +134,14 @@ Void ViewArea::zoomChangeEvent( Double factor, QPoint center ) } +void ViewArea::setZoomFactor( double f ) +{ + m_zoomFactor = f; + + updateSize(); + update(); +} + void ViewArea::setMode( ViewMode mode ) { if( m_mode == mode ) @@ -519,15 +519,13 @@ void ViewArea::wheelEvent( QWheelEvent *event ) { Double factor; - if( event->modifiers() & Qt::ControlModifier ) - { - factor = 0.001 * event->delta(); - if(factor>0) - factor=1.25; - else - factor=0.8; - zoomChangeEvent( factor , event->pos() ); - } + factor = 0.001 * event->delta(); + if( factor > 0 ) + factor = 1.25; + else + factor = 0.8; + + zoomChangeEvent( factor, event->pos() ); } void ViewArea::mousePressEvent( QMouseEvent *event ) @@ -536,10 +534,6 @@ void ViewArea::mousePressEvent( QMouseEvent *event ) QPoint vpos = windowToView( event->pos() ); - if( event->button() == Qt::MidButton ) - { - - } if( event->button() == Qt::LeftButton ) { if( tool() == NavigationTool ) diff --git a/source/app/ViewArea.h b/source/app/ViewArea.h index 4604589..de6f103 100644 --- a/source/app/ViewArea.h +++ b/source/app/ViewArea.h @@ -108,7 +108,6 @@ public: PlaYUVerStream* getInputStream(); Void zoomChangeEvent(Double factor, QPoint center); - void setTool( enum eTool tool ); // QSize sizeHint() const; @@ -129,7 +128,7 @@ public Q_SLOTS: void setGridVisible( bool enable ); void setSnapToGrid( bool enable ); void setSelectedArea( QRect &rect ); - void setZoomFactor( double ); + void setZoomFactor( double f ); protected: void paintEvent( QPaintEvent *event ); diff --git a/source/app/main.cpp b/source/app/main.cpp index 8ffc86c..6c9aae0 100644 --- a/source/app/main.cpp +++ b/source/app/main.cpp @@ -23,23 +23,18 @@ */ #include -#include "config.h" #include "plaYUVerApp.h" #ifdef USE_FERVOR #include "fvupdater.h" #endif using namespace plaYUVer; -#if _WIN32 -#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup") -#endif - int main( int argc, char *argv[] ) { QApplication a( argc, argv ); - QApplication::setApplicationName("PlaYUVer"); - QApplication::setApplicationVersion(PLAYUVER_VERSION_STRING); - QApplication::setOrganizationName("pixlra"); + QApplication::setApplicationName("playuver"); + QApplication::setApplicationVersion("0.1"); + QApplication::setOrganizationName("playuver"); QApplication::setOrganizationDomain("playuver.pixlra"); plaYUVerApp w; w.show(); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 1c7ea0c..059a608 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -49,7 +49,7 @@ plaYUVerApp::plaYUVerApp() setWindowModality( Qt::ApplicationModal ); - mdiArea = new PlaYUVerMdiArea; + mdiArea = new QMdiArea; setCentralWidget( mdiArea ); //mdiArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); //mdiArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded ); @@ -70,7 +70,7 @@ plaYUVerApp::plaYUVerApp() readSettings(); - setWindowTitle( QApplication::applicationName() ); + setWindowTitle( tr( "plaYUVer" ) ); setWindowIcon( QIcon( ":/images/playuver.png" ) ); setUnifiedTitleAndToolBarOnMac( true ); @@ -84,7 +84,6 @@ plaYUVerApp::plaYUVerApp() setAcceptDrops( true ); mdiArea->setAcceptDrops( true ); - m_pcAboutDialog = NULL; m_pcCurrentSubWindow = NULL; } @@ -103,16 +102,13 @@ Void plaYUVerApp::parseArgs( Int argc, Char *argv[] ) Void plaYUVerApp::about() { - if (!m_pcAboutDialog) - m_pcAboutDialog = new AboutDialog(this); - m_pcAboutDialog->exec(); -// QString about_message; -// about_message.append( "The plaYUVer is an open-source raw video player! " ); -// about_message.append( "Developed by " ); -// about_message.append( "João Carreira " ); -// about_message.append( "and " ); -// about_message.append( "Luís Lucas" ); -// QMessageBox::about( this, "About plaYUVer", about_message ); + QString about_message; + about_message.append( "The plaYUVer is an open-source raw video player! " ); + about_message.append( "Developed by " ); + about_message.append( "João Carreira " ); + about_message.append( "and " ); + about_message.append( "Luís Lucas" ); + QMessageBox::about( this, "About plaYUVer", about_message ); } Void plaYUVerApp::closeEvent( QCloseEvent *event ) @@ -159,14 +155,14 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event ) Void plaYUVerApp::loadFile( QString fileName ) { - SubWindowHandle *interfaceChild = plaYUVerApp::findSubWindow( mdiArea, fileName ); - if( interfaceChild ) + QMdiSubWindow *existing = findSubWindow( fileName ); + if( existing ) { - mdiArea->setActiveSubWindow( interfaceChild ); + mdiArea->setActiveSubWindow( existing ); return; } - interfaceChild = new SubWindowHandle( this ); //createSubWindow(); + SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow(); if( interfaceChild->loadFile( fileName ) ) { statusBar()->showMessage( tr( "Loading file..." ) ); @@ -215,15 +211,12 @@ Void plaYUVerApp::open() << formatsList << tr( "All Files (*)" ); - QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) ); + QString fileName = QFileDialog::getOpenFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) ); - for( Int i = 0; i < fileNameList.size(); i++ ) + if( !fileName.isEmpty() ) { - if( !fileNameList.at( i ).isEmpty() ) - { - m_cLastOpenPath = QFileInfo( fileNameList.at( i ) ).path(); - loadFile( fileNameList.at( i ) ); - } + m_cLastOpenPath = QFileInfo( fileName ).path(); + loadFile( fileName ); } } @@ -273,7 +266,7 @@ Void plaYUVerApp::format() { if( m_pcCurrentSubWindow ) { - m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->getCurrentFileName(), true ); + m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->currentFile(), true ); m_pcCurrentSubWindow = NULL; chageSubWindowSelection(); } @@ -569,6 +562,9 @@ Void plaYUVerApp::playEvent() if( !m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ) { stop(); + updateCurrFrameNum(); + updateFrameProperties(); + return; } else { @@ -591,7 +587,6 @@ Void plaYUVerApp::playEvent() } updateCurrFrameNum(); updateFrameProperties(); - m_pcQualityMeasurement->updateSidebarData(); m_uiAveragePlayInterval = ( m_uiAveragePlayInterval + time ) / 2; } @@ -634,7 +629,6 @@ Void plaYUVerApp::seekEvent( Int direction ) { m_pcCurrentSubWindow->seekRelativeEvent( direction > 0 ? true : false ); } - m_pcQualityMeasurement->updateSidebarData(); updateFrameProperties(); updateCurrFrameNum(); } @@ -655,7 +649,6 @@ Void plaYUVerApp::seekSliderEvent( Int new_frame_num ) { m_pcCurrentSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num ); } - m_pcQualityMeasurement->updateSidebarData(); updateFrameProperties(); updateCurrFrameNum(); } @@ -668,7 +661,7 @@ Void plaYUVerApp::lockButtonEvent() if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) ) { m_acPlayingSubWindows.clear(); - m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); + m_acPlayingSubWindows.append(m_pcCurrentSubWindow); } else { @@ -765,7 +758,6 @@ Void plaYUVerApp::zoomToFitAll() subWindow = qobject_cast( mdiArea->subWindowList().at( i ) ); subWindow->zoomToFit(); } - updateZoomFactorSBox(); } Void plaYUVerApp::scaleFrame( int ratio ) @@ -810,10 +802,6 @@ Void plaYUVerApp::chageSubWindowSelection() if( activeSubWindow() ) { m_pcCurrentSubWindow = new_window; - if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentSubWindow->getRefSubWindow() ) ) - { - m_pcCurrentSubWindow->setRefSubWindow( NULL ); - } updateCurrFrameNum(); updateTotalFrameNum(); updateStreamProperties(); @@ -824,8 +812,6 @@ Void plaYUVerApp::chageSubWindowSelection() } updateStreamProperties(); updateFrameProperties(); - m_pcQualityMeasurement->updateCurrentWindow( m_pcCurrentSubWindow ); - m_pcQualityMeasurement->updateSubWindowList(); updateMenus(); } @@ -886,28 +872,18 @@ SubWindowHandle *plaYUVerApp::activeSubWindow() return 0; } -SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const QString& fileName ) +QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName ) { QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath(); foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){ SubWindowHandle *mdiChild = qobject_cast( window); - if( mdiChild->getCurrentFileName() == canonicalFilePath ) - return mdiChild; + if( mdiChild->currentFile() == canonicalFilePath ) + return window; } return 0; } -SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow ) -{ - foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){ - SubWindowHandle *mdiChild = qobject_cast( window); - if( mdiChild == subWindow ) - return mdiChild; -} -return 0; -} - Void plaYUVerApp::setNavigationTool() { m_appTool = NavigationTool; @@ -1010,11 +986,11 @@ Void plaYUVerApp::updateWindowMenu() QString text; if( i < 9 ) { - text = tr( "&%1 %2" ).arg( i + 1 ).arg( child->getWindowName() ); + text = tr( "&%1 %2" ).arg( i + 1 ).arg( child->userFriendlyCurrentFile() ); } else { - text = tr( "%1 %2" ).arg( i + 1 ).arg( child->getWindowName() ); + text = tr( "%1 %2" ).arg( i + 1 ).arg( child->userFriendlyCurrentFile() ); } QAction *action = m_arrayMenu[WINDOW_MENU]->addAction( text ); action->setCheckable( true ); @@ -1054,7 +1030,7 @@ Void plaYUVerApp::createActions() m_arrayActions[RELOAD_ALL_ACT] = new QAction( tr( "Reload All" ), this ); //m_arrayActions[RELOAD_ACT]->setIcon( QIcon( ":/images/configuredialog.png" ) ); m_arrayActions[RELOAD_ALL_ACT]->setStatusTip( tr( "Reload all sequences" ) ); - connect( m_arrayActions[RELOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( reloadAll() ) ); + connect( m_arrayActions[RELOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( reload() ) ); m_arrayActions[LOAD_ALL_ACT] = new QAction( tr( "Preload" ), this ); //m_arrayActions[LOAD_ALL_ACT]->setIcon( QIcon( ":/images/configuredialog.png" ) ); @@ -1339,31 +1315,21 @@ Void plaYUVerApp::createToolBars() Void plaYUVerApp::createDockWidgets() { // Properties Dock Window - m_arraySideBars.resize( TOTAL_DOCK ); + m_arraySideBars.resize( TOTAL_SIDEBAR ); m_pcStreamProperties = new StreamPropertiesSideBar( this ); - m_arraySideBars[STREAM_DOCK] = new QDockWidget( tr( "Stream Information" ), this ); - m_arraySideBars[STREAM_DOCK]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - m_arraySideBars[STREAM_DOCK]->setWidget( m_pcStreamProperties ); - addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[STREAM_DOCK] ); - connect( m_arraySideBars[STREAM_DOCK], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateProperties() ) ); + m_arraySideBars[STREAM_SIDEBAR] = new QDockWidget( tr( "Stream Information" ), this ); + m_arraySideBars[STREAM_SIDEBAR]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + m_arraySideBars[STREAM_SIDEBAR]->setWidget( m_pcStreamProperties ); + addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[STREAM_SIDEBAR] ); + connect( m_arraySideBars[STREAM_SIDEBAR], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateProperties() ) ); m_pcFrameProperties = new FramePropertiesSideBar( this, &m_bIsPlaying ); - m_arraySideBars[FRAME_DOCK] = new QDockWidget( tr( "Frame Information" ), this ); - m_arraySideBars[FRAME_DOCK]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - m_arraySideBars[FRAME_DOCK]->setWidget( m_pcFrameProperties ); - addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[FRAME_DOCK] ); - connect( m_arraySideBars[FRAME_DOCK], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateProperties() ) ); - - QMainWindow::tabifyDockWidget( m_arraySideBars[FRAME_DOCK], m_arraySideBars[STREAM_DOCK] ); - //QMainWindow::setTabPosition(Qt::RightDockWidgetArea, QTabWidget::North); - - m_pcQualityMeasurement = new QualityMeasurementSidebar( this, mdiArea ); - m_arraySideBars[QUALITY_DOCK] = new QDockWidget( tr( "Quality Measurement" ), this ); - m_arraySideBars[QUALITY_DOCK]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - m_arraySideBars[QUALITY_DOCK]->setWidget( m_pcQualityMeasurement ); - addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[QUALITY_DOCK] ); - + m_arraySideBars[FRAME_SIDEBAR] = new QDockWidget( tr( "Frame Information" ), this ); + m_arraySideBars[FRAME_SIDEBAR]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + m_arraySideBars[FRAME_SIDEBAR]->setWidget( m_pcFrameProperties ); + addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[FRAME_SIDEBAR] ); + connect( m_arraySideBars[FRAME_SIDEBAR], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateProperties() ) ); } Void plaYUVerApp::createStatusBar() @@ -1383,14 +1349,12 @@ Void plaYUVerApp::readSettings() setAllSubWindowTool(); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() ); m_arrayActions[VIDEO_LOCK_ACT]->setChecked( settings.getVideoLock() ); - Bool visibleStreamProp, visibleFrameProp, visibleQualityMeasure; - settings.getDockVisibility( visibleStreamProp, visibleFrameProp, visibleQualityMeasure ); + Bool visibleStreamProp, visibleFrameProp; + settings.getDockVisibility( visibleStreamProp, visibleFrameProp ); if( !visibleStreamProp ) - m_arraySideBars[STREAM_DOCK]->close(); + m_arraySideBars[STREAM_SIDEBAR]->close(); if( !visibleFrameProp ) - m_arraySideBars[FRAME_DOCK]->close(); - if( !visibleQualityMeasure ) - m_arraySideBars[QUALITY_DOCK]->close(); + m_arraySideBars[FRAME_SIDEBAR]->close(); } @@ -1401,7 +1365,7 @@ Void plaYUVerApp::writeSettings() settings.setMainWindowSize( size() ); settings.setLastOpenPath( m_cLastOpenPath ); settings.setSelectedTool( ( Int )m_appTool ); - settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible(), m_pcQualityMeasurement->isVisible() ); + settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible() ); settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked(), m_arrayActions[VIDEO_LOCK_ACT]->isChecked() ); } diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index 12973df..a347cb9 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -35,8 +35,6 @@ #include #include "ModulesHandle.h" #include "PropertiesSidebar.h" -#include "QualityMeasurementSidebar.h" -#include "AboutDialog.h" namespace plaYUVer { @@ -114,36 +112,7 @@ private Q_SLOTS: void setSelectionTool(); private: - - class PlaYUVerMdiArea: public QMdiArea - { - public: - PlaYUVerMdiArea( QWidget *parent = 0 ) : - QMdiArea( parent ), - m_pixmapLogo( ":/images/playuver-backgroud-logo.png" ) - { - } - protected: - void paintEvent( QPaintEvent *event ) - { - QMdiArea::paintEvent( event ); - QPainter painter( viewport() ); - QSize logoSize = 2 * size() / 3; - - QPixmap pixFinalLogo = m_pixmapLogo.scaled(logoSize,Qt::KeepAspectRatio); - - // Calculate the logo position - the bottom right corner of the mdi area. - int x = width() / 2 - pixFinalLogo.width() / 2; - int y = height() / 2 - pixFinalLogo.height() / 2; - painter.drawPixmap( x, y, pixFinalLogo ); - } - private: - // Store the logo image. - QPixmap m_pixmapLogo; - }; - - //QMdiArea *mdiArea; - PlaYUVerMdiArea *mdiArea; + QMdiArea *mdiArea; SubWindowHandle *m_pcCurrentSubWindow; ModulesHandle *m_pcModulesHandle; @@ -178,9 +147,7 @@ private: Void writeSettings(); SubWindowHandle *activeSubWindow(); - - static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const QString& fileName ); - static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow ); + QMdiSubWindow *findSubWindow( const QString &fileName ); QVector m_acPlayingSubWindows; QSlider *m_pcFrameSlider; @@ -214,16 +181,14 @@ private: enum SIDEBAR_LIST { - STREAM_DOCK = 0, - FRAME_DOCK, - QUALITY_DOCK, - TOTAL_DOCK, + STREAM_SIDEBAR = 0, + FRAME_SIDEBAR, + TOTAL_SIDEBAR, }; QVector m_arraySideBars; StreamPropertiesSideBar* m_pcStreamProperties; FramePropertiesSideBar* m_pcFrameProperties; - QualityMeasurementSidebar* m_pcQualityMeasurement; enum TOOLBAR_LIST { @@ -278,8 +243,6 @@ private: QAction *actionSelectionTool; enum eTool m_appTool; - AboutDialog* m_pcAboutDialog; - }; } // NAMESPACE diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index 79d9c7b..1ce5a1a 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -489,17 +489,7 @@ Double PlaYUVerFrame::getMSE( PlaYUVerFrame* Org, Int component ) Int diff = 0; Double ssd = 0; - UInt numberOfPixels = 0; - if( component == LUMA ) - { - numberOfPixels = Org->getHeight() * Org->getWidth(); - } - else - { - numberOfPixels = getChromaLength(); - } - - for( UInt i = 0; i < numberOfPixels; i++ ) + for( UInt i = 0; i < Org->getHeight() * Org->getWidth(); i++ ) { aux_pel_1 = *pPelYUV++; aux_pel_2 = *pOrgPelYUV++; @@ -524,28 +514,23 @@ Double PlaYUVerFrame::getPSNR( PlaYUVerFrame* Org, Int component ) UInt64 PlaYUVerFrame::getBytesPerFrame() { - return getBytesPerFrame( m_uiWidth, m_uiHeight, m_iPixelFormat ); -} - -UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat ) -{ - switch( iPixelFormat ) + switch( m_iPixelFormat ) { case YUV420p: - return uiWidth * uiHeight * 1.5; + return m_uiWidth * m_uiHeight * 1.5; break; case YUV444p: - return uiWidth * uiHeight * 3; + return m_uiWidth * m_uiHeight * 3; break; case YUV422p: case YUYV422: - return uiWidth * uiHeight * 2; + return m_uiWidth * m_uiHeight * 2; break; case GRAY: - return uiWidth * uiHeight; + return m_uiWidth * m_uiHeight; break; case RGB8: - return uiWidth * uiHeight * 3; + return m_uiWidth * m_uiHeight * 3; break; default: return 0; diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index 1f3deb7..d936d1c 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -118,7 +118,6 @@ public: Double getPSNR( PlaYUVerFrame* Org, Int component ); UInt64 getBytesPerFrame(); - static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat ); UInt getChromaLength() const; @@ -171,10 +170,6 @@ 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; diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index 3f283c5..e1da6ba 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -38,7 +38,6 @@ PlaYUVerStream::PlaYUVerStream() { m_bInit = false; m_bIsInput = true; - m_bIsOpened = false; m_bLoadAll = false; m_iErrorStatus = 0; @@ -83,7 +82,6 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ m_cFilename = filename; m_uiWidth = width; m_uiHeight = height; - m_iPixelFormat = input_format; m_uiFrameRate = frame_rate; if( m_bIsInput ) @@ -103,6 +101,8 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ } m_cFormatName = PlaYUVerStream::supportedReadFormatsExt().at( m_iFileFormat ).toUpper(); + m_iPixelFormat = input_format; + #ifdef USE_FFMPEG if( m_iFileFormat != YUVINPUT ) { @@ -115,7 +115,7 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ { switch( m_iFileFormat ) { - case PGMINPUT: + case PGMINPUT: break; } @@ -131,7 +131,6 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ if( m_uiWidth <= 0 || m_uiHeight <= 0 || m_iPixelFormat < 0 ) { - qDebug( ) << "Incorrect configuration"; close(); return m_bInit; } @@ -142,7 +141,6 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_uiWidth, m_uiHeight, m_iPixelFormat ); if( !m_ppcFrameBuffer[i] ) { - qDebug( ) << "Cannot allocated frame buffer"; close(); return m_bInit; } @@ -152,20 +150,14 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ UInt64 frame_bytes_input = m_pcCurrFrame->getBytesPerFrame(); - if( !avStatus ) - { - if( !openFile() ) - { - close(); - return m_bInit; - } - m_cFormatName = QString::fromUtf8( "YUV" ); - m_cCodedName = QString::fromUtf8( "Raw Video" ); - } - if( !avStatus && m_iFileFormat == YUVINPUT ) { - if( !openFile() ) + m_pFile = NULL; + Char *filename = new char[m_cFilename.length() + 1]; + memcpy( filename, m_cFilename.toUtf8().constData(), m_cFilename.length() + 1 * sizeof(char) ); + m_pFile = fopen( filename, m_bIsInput ? "rb" : "wb" ); + delete[] filename; + if( m_pFile == NULL ) { close(); return m_bInit; @@ -173,26 +165,15 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ if( m_bIsInput ) { fseek( m_pFile, 0, SEEK_END ); - UInt64 fileSize = ftell( m_pFile ); -#if 0 - if( fileSize % frame_bytes_input ) - { - Int remaining = fileSize % frame_bytes_input; - qDebug( ) << "Incorrect configuration: failed ( fileSize % frame_bytes_input = " << remaining << " )" ; - close(); - return m_bInit; - } -#endif - m_uiTotalFrameNum = fileSize / frame_bytes_input; + m_uiTotalFrameNum = ftell( m_pFile ) / ( frame_bytes_input ); fseek( m_pFile, 0, SEEK_SET ); } m_cFormatName = QString::fromUtf8( "YUV" ); m_cCodedName = QString::fromUtf8( "Raw Video" ); } - if( m_bIsInput && m_uiTotalFrameNum <= 0 ) + if( m_uiTotalFrameNum <= 0 ) { - qDebug( ) << "Incorrect configuration: less than one frame"; close(); return m_bInit; } @@ -217,6 +198,7 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ m_bInit = true; seekInput( 0 ); +//loadAll(); m_cTimer.start(); m_uiAveragePlayInterval = 0; @@ -225,34 +207,10 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ return m_bInit; } -Bool PlaYUVerStream::openFile() -{ - m_pFile = NULL; - Char *filename = new char[m_cFilename.length() + 1]; - memcpy( filename, m_cFilename.toUtf8().constData(), m_cFilename.length() + 1 * sizeof(char) ); - m_pFile = fopen( filename, m_bIsInput ? "rb" : "wb" ); - delete[] filename; - if( m_pFile == NULL ) - { - return false; - } - fseek( m_pFile, m_iCurrFrameNum >= 0 ? m_iCurrFrameNum : 0, SEEK_SET ); - return true; -} - -Void PlaYUVerStream::closeFile() -{ - if( !m_bInit && m_pFile ) - return; - fclose( m_pFile ); -} - Void PlaYUVerStream::close() { - if( !m_bInit ) - return; - - closeFile(); + if( m_pFile ) + fclose( m_pFile ); #ifdef USE_FFMPEG m_cLibAvContext->closeAvFormat(); @@ -294,7 +252,7 @@ Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, { rWidth = 0; rHeight = 0; - rInputFormat = PlaYUVerFrame::YUV420p; + rInputFormat = -1; rFrameRate = 30; } } @@ -302,106 +260,40 @@ Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) { Bool bRet = false; - QString FilenameShort = QFileInfo( filename ).fileName(); QString fileExtension = QFileInfo( filename ).suffix(); if( !fileExtension.compare( "yuv" ) ) { bRet = true; - // Guess pixel format +// Guess resolution - match %dx%d +#if( QT_VERSION_PLAYUVER == 5 ) + QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( filename ); + if( resolutionMatch.hasMatch() ) + { + QString resolutionString = resolutionMatch.captured( 0 ); + if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) ) + { + resolutionString.remove( "_" ); + QStringList resolutionArgs = resolutionString.split( "x" ); + qDebug( ) << "Found resolution = " + << resolutionArgs; + if( resolutionArgs.size() == 2 ) + { + rWidth = resolutionArgs.at( 0 ).toUInt(); + rHeight = resolutionArgs.at( 1 ).toUInt(); + } + } + } +#endif +// Guess pixel format QStringList formats_list = PlaYUVerFrame::supportedPixelFormatList(); for( Int i = 0; i < formats_list.size(); i++ ) { - if( FilenameShort.contains( formats_list.at( i ), Qt::CaseInsensitive ) ) + if( filename.contains( formats_list.at( i ), Qt::CaseInsensitive ) ) { rInputFormat = i; break; } } - - if( rWidth == 0 || rHeight == 0 ) - { - // Guess resolution - match resolution name - Int iMatch = -1; - QStringList stdResName = standardResolutionSizes().stringListName; - for( Int i = 0; i < stdResName.size(); i++ ) - { - if( FilenameShort.contains( stdResName.at( i ) ) ) - { - if( iMatch >= 0 ) - { - if( stdResName.at( i ).size() > stdResName.at( iMatch ).size() ) - { - iMatch = i; - } - } - else - { - iMatch = i; - } - } - } - if( iMatch >= 0 ) - { - rWidth = standardResolutionSizes().sizeResolution.at( iMatch ).width(); - rHeight = standardResolutionSizes().sizeResolution.at( iMatch ).height(); - } - // Guess resolution - match %dx%d -#if( QT_VERSION_PLAYUVER == 5 ) - QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort ); - if( resolutionMatch.hasMatch() ) - { - QString resolutionString = resolutionMatch.captured( 0 ); - if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) ) - { - resolutionString.remove( "_" ); - QStringList resolutionArgs = resolutionString.split( "x" ); - qDebug( ) << "Found resolution = " - << resolutionArgs; - if( resolutionArgs.size() == 2 ) - { - rWidth = resolutionArgs.at( 0 ).toUInt(); - rHeight = resolutionArgs.at( 1 ).toUInt(); - } - } - } -#endif - } - - // Guess resolution by file size - if( rWidth == 0 && rHeight == 0 ) - { - - Char *filename_char = new char[filename.length() + 1]; - memcpy( filename_char, filename.toUtf8().constData(), filename.length() + 1 * sizeof(char) ); - FILE* pF = fopen( filename_char, "rb" ); - fseek( pF, 0, SEEK_END ); - UInt64 uiFileSize = ftell( pF ); - fclose( pF ); - delete[] filename_char; - - if( pF != NULL ) - { - Int count = 0, module, frame_bytes, match; - QVector sizeResolution = standardResolutionSizes().sizeResolution; - for( Int i = 0; i < sizeResolution.size(); i++ ) - { - frame_bytes = PlaYUVerFrame::getBytesPerFrame( sizeResolution.at( i ).width(), sizeResolution.at( i ).height(), rInputFormat ); - module = uiFileSize % frame_bytes; - if( module == 0 ) - { - match = i; - count++; - } - } - if( count == 1 ) - { - rWidth = sizeResolution.at( match ).width(); - rHeight = sizeResolution.at( match ).height(); - } - } - - } - if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 ) bRet = false; } @@ -438,8 +330,7 @@ Void PlaYUVerStream::loadAll() m_pcCurrFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex]; m_iCurrFrameNum = -1; seekInput( 0 ); - setNextFrame(); - for( UInt i = m_uiFrameBufferIndex; i < m_uiFrameBufferSize; i++ ) + for( UInt i = 0; i < m_uiFrameBufferSize - 1; i++ ) { readFrame(); setNextFrame(); @@ -542,33 +433,8 @@ Void PlaYUVerStream::writeFrame( PlaYUVerFrame *pcFrame ) Bool PlaYUVerStream::saveFrame( const QString& filename ) { - Int iFileFormat = INVALID_INPUT; - - QStringList formatsExt = PlaYUVerStream::supportedReadFormatsExt(); - QString currExt = QFileInfo( filename ).suffix(); - if( formatsExt.contains( currExt ) ) - { - iFileFormat = formatsExt.indexOf( currExt ); - } - - if( iFileFormat == YUVINPUT ) - { - PlaYUVerStream auxFrameStream; - if( !auxFrameStream.open( filename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate, false ) ) - { - return false; - } - auxFrameStream.writeFrame( m_pcCurrFrame ); - auxFrameStream.close(); - return true; - } - else - { - m_pcCurrFrame->FrametoRGB8(); - QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 ); - return qimg.save( filename ); - } - return false; + QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 ); + return qimg.save( filename ); } Void PlaYUVerStream::setNextFrame() diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index c420779..f8c1dd9 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -42,8 +42,6 @@ private: Bool m_bInit; Bool m_bIsInput; - Bool m_bIsOpened; - Bool m_bLoadAll; Int m_iErrorStatus; @@ -158,8 +156,7 @@ public: static QStringList supportedSaveFormatsExt() { QStringList formatsExt; - formatsExt << "yuv" - << "bmp" + formatsExt << "bmp" << "jpeg" << "png" // portable network graphics ; @@ -169,43 +166,12 @@ public: static QStringList supportedSaveFormatsName() { QStringList formatsName; - formatsName << "Raw Video" - << "Windows Bitmap" + formatsName << "Windows Bitmap" << "Joint Photographic Experts Group" << "Portable Network Graphics"; return formatsName; } -#define REGIST_STANDARD_RESOLUTION( name, width, height) \ - stdRes.stringListName.append( QString( name ) ); \ - stdRes.stringListFullName.append( QString( "%1 (%2x%3)" ).arg( name ).arg( width ).arg( height ) ); \ - stdRes.sizeResolution.append( QSize( width, height ) ) - - struct StandardResolution - { - QStringList stringListName; - QStringList stringListFullName; - QVector sizeResolution; - }; - - static struct StandardResolution standardResolutionSizes() - { - struct StandardResolution stdRes; - REGIST_STANDARD_RESOLUTION( "CIF", 352, 288 ); - REGIST_STANDARD_RESOLUTION( "VGA", 640, 480 ); - REGIST_STANDARD_RESOLUTION( "WVGA", 832, 480 ); - REGIST_STANDARD_RESOLUTION( "XVGA", 1024, 768 ); - REGIST_STANDARD_RESOLUTION( "HD", 1280, 720 ); - REGIST_STANDARD_RESOLUTION( "SXGA-", 1280, 900 ); - REGIST_STANDARD_RESOLUTION( "SXGA", 1280, 1024 ); - REGIST_STANDARD_RESOLUTION( "WSXGA", 1440, 900 ); - REGIST_STANDARD_RESOLUTION( "FullHD", 1920, 1080 ); - REGIST_STANDARD_RESOLUTION( "WQXGA", 2560, 1600 ); - REGIST_STANDARD_RESOLUTION( "UltraHD", 3840, 2160 ); - REGIST_STANDARD_RESOLUTION( "8K", 8192, 4608 ); - return stdRes; - } - enum PlaYUVerStreamErrors { NO_STREAM_ERROR = 0, @@ -218,11 +184,7 @@ public: Bool open( QString filename, UInt width, UInt height, Int input_format, UInt frame_rate, Bool bInput = true ); Void close(); - Bool openFile(); - Void closeFile(); - - static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); - + Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); Void getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); Void loadAll(); diff --git a/source/modules/MeasurePSNR.cpp b/source/modules/MeasurePSNR.cpp index e69d4bf..e20dfd3 100644 --- a/source/modules/MeasurePSNR.cpp +++ b/source/modules/MeasurePSNR.cpp @@ -19,7 +19,7 @@ /** * \file MeasurePSNR.cpp - * \brief Frame Difference module + * \brief Measure PSNR module */ #include @@ -34,59 +34,35 @@ static PlaYUVerModuleDefinition MeasurePSNRDef = { FRAME_MEASUREMENT_MODULE, "Quality", - "PSNR Y", + "PSNR", "Measure the PSNR between two images", MODULE_REQUIRES_TWO_FRAMES, - MODULE_REQUIRES_SIDEBAR, - APPLY_WHILE_PLAYING, }; + MODULE_REQUIRES_NEW_WINDOW, + APPLY_WHILE_PLAYING, +}; MeasurePSNR::MeasurePSNR() { + m_pcFilteredFrame = NULL; setModuleDefinition( MeasurePSNRDef ); } -Void MeasurePSNR::create( PlaYUVerFrame* Org ) +Void MeasurePSNR::create( PlaYUVerFrame* InputFrame ) { + m_pcFilteredFrame = NULL; + m_pcFilteredFrame = new PlaYUVerFrame( InputFrame->getWidth(), InputFrame->getHeight(), PlaYUVerFrame::GRAY ); } -Double MeasurePSNR::getMSE( PlaYUVerFrame* Org, PlaYUVerFrame* Rec, Int component ) +PlaYUVerFrame* MeasurePSNR::process( PlaYUVerFrame* InputFrame ) { - Pel* pInput1PelYUV = Org->getPelBufferYUV()[component][0]; - Pel* pInput2PelYUV = Rec->getPelBufferYUV()[component][0]; - - Int aux_pel_1, aux_pel_2; - Int diff = 0; - Double ssd = 0; - - for( UInt y = 0; y < Org->getHeight(); y++ ) - for( UInt x = 0; x < Org->getWidth(); x++ ) - { - aux_pel_1 = *pInput1PelYUV++; - aux_pel_2 = *pInput2PelYUV++; - diff = aux_pel_1 - aux_pel_2; - ssd += ( Double )( diff * diff ); - } - if( ssd == 0.0 ) - { - return 0.0; - } - return ssd / ( Org->getWidth() * Org->getHeight() ); -} - -Double MeasurePSNR::measure( PlaYUVerFrame* Org, PlaYUVerFrame* Rec ) -{ - Double psnrY = 100; - Double mseY = MeasurePSNR::getMSE( Org, Rec, LUMA ); - - if( mseY != 0 ) - psnrY = 10 * log10( 65025 / mseY ); - - return psnrY; + return m_pcFilteredFrame; } Void MeasurePSNR::destroy() { - + if( m_pcFilteredFrame ) + delete m_pcFilteredFrame; + m_pcFilteredFrame = NULL; } } // NAMESPACE diff --git a/source/modules/MeasurePSNR.h b/source/modules/MeasurePSNR.h index 9224a87..5de073c 100644 --- a/source/modules/MeasurePSNR.h +++ b/source/modules/MeasurePSNR.h @@ -19,16 +19,17 @@ /** * \file MeasurePSNR.h - * \brief Frame Difference module + * \brief Measure PSNR module */ #ifndef __MEASUREPSNR_H__ #define __MEASUREPSNR_H__ #include "config.h" -#include "PlaYUVerDefs.h" + #include #include +#include "TypeDef.h" #include "PlaYUVerFrame.h" #include "PlaYUVerModuleIf.h" @@ -40,16 +41,17 @@ namespace plaYUVer class MeasurePSNR: public PlaYUVerModuleIf { private: + public: MeasurePSNR(); virtual ~MeasurePSNR() { } - Void create( PlaYUVerFrame* ); - Double measure( PlaYUVerFrame*, PlaYUVerFrame* ); - Void destroy(); - static Double getMSE( PlaYUVerFrame* Org, PlaYUVerFrame* Rec, Int component ); + Void create( PlaYUVerFrame* InputFrame ); + + PlaYUVerFrame* process( PlaYUVerFrame* InputFrame ); + Void destroy(); };