From cdc5e39b586e5099c4a3ea0c7e564933f3ba945b Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 17 Apr 2014 02:05:27 +0100 Subject: [PATCH] Different changes Minor changes in the properties side bar Improvements in the modules interface and filter frame module --- source/app/HistogramWidget.cpp | 10 +++++----- source/app/HistogramWidget.h | 4 ++-- source/app/PlaYUVerModuleIf.h | 3 ++- source/app/PropertiesSidebar.cpp | 4 ++-- source/app/plaYUVerApp.cpp | 9 ++++++++- source/lib/PlaYUVerFrame.h | 1 + source/lib/PlaYUVerFrameStatistics.cpp | 6 +++--- source/lib/PlaYUVerFrameStatistics.h | 2 +- source/modules/FilterFrame.cpp | 19 +++++-------------- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/source/app/HistogramWidget.cpp b/source/app/HistogramWidget.cpp index cbec0c4..3972185 100755 --- a/source/app/HistogramWidget.cpp +++ b/source/app/HistogramWidget.cpp @@ -362,12 +362,12 @@ void HistogramWidget::updateData( Pel ***imageData, UInt imageWidth, UInt imageH m_selectionHistogram = 0L; } -void HistogramWidget::updateData( const PlaYUVerFrame &playuver_frame, const PlaYUVerFrame &playuver_selection ) +void HistogramWidget::updateData( const PlaYUVerFrame *playuver_frame, const PlaYUVerFrame *playuver_selection ) { d->sixteenBits = false; //d->imageColorSpace = image.getPelFormat(); - d->imageColorSpace = PlaYUVerFrame::isRGBorYUVorGray( playuver_frame.getPelFormat() ); - d->imageChannels = playuver_frame.getNumberChannels(); + d->imageColorSpace = PlaYUVerFrame::isRGBorYUVorGray( playuver_frame->getPelFormat() ); + d->imageChannels = playuver_frame->getNumberChannels(); // We are deleting the histogram data, // so we must not use it to draw any more. @@ -389,7 +389,7 @@ void HistogramWidget::updateData( const PlaYUVerFrame &playuver_frame, const Pla // Calc new histogram data m_imageHistogram = new PlaYUVerFrameStatistics( playuver_frame, this ); - if( playuver_selection.isValid() ) + if( playuver_selection->isValid() ) m_selectionHistogram = new PlaYUVerFrameStatistics( playuver_selection, this ); else m_selectionHistogram = NULL; @@ -407,7 +407,7 @@ void HistogramWidget::updateSelectionData( Pel ***selData, UInt selWidth, UInt s m_selectionHistogram = new PlaYUVerFrameStatistics( selData, selWidth, selHeight, bitsPerChannel, pixel_format, chroma_size, this ); } -void HistogramWidget::updateSelectionData( const PlaYUVerFrame &selection ) +void HistogramWidget::updateSelectionData( const PlaYUVerFrame *selection ) { // Remove old histogram data from memory. diff --git a/source/app/HistogramWidget.h b/source/app/HistogramWidget.h index d34ca36..07ea788 100755 --- a/source/app/HistogramWidget.h +++ b/source/app/HistogramWidget.h @@ -124,14 +124,14 @@ public : Pel ***selData = 0, UInt selWidth = 0, UInt selHeight = 0); /** Update full image histogram data from SImage.*/ - void updateData( const PlaYUVerFrame &playuver_frame, const PlaYUVerFrame &playuver_selection ); + void updateData( const PlaYUVerFrame *playuver_frame, const PlaYUVerFrame *playuver_selection ); /** Update image selection histogram data methods.*/ void updateSelectionData( Pel ***selData, uint selWidth, uint selHeight, Int bitsPerChannel, Int pixel_format, UInt chroma_size ); /** Update image selection histogram data from SImage.*/ - void updateSelectionData( const PlaYUVerFrame &imageSelection ); + void updateSelectionData( const PlaYUVerFrame *imageSelection ); /** @see @p HistogramOption */ void setOptions( HistogramOptions options = AllOptions ); diff --git a/source/app/PlaYUVerModuleIf.h b/source/app/PlaYUVerModuleIf.h index 595f4ac..d52d777 100644 --- a/source/app/PlaYUVerModuleIf.h +++ b/source/app/PlaYUVerModuleIf.h @@ -66,10 +66,11 @@ enum __PlaYUVerModuleRequirements typedef struct __PlaYUVerModuleDefinition { - int m_pchModuleType; + int m_iModuleType; const char* m_pchModuleCategory; const char* m_pchModuleName; const char* m_pchModuleTooltip; + bool m_bRequiresNewWindow; }PlaYUVerModuleDefinition; diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index 43fffd7..4a2f2c9 100755 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -393,7 +393,7 @@ void FramePropertiesSideBar::slotUpdateHistogram() // If a selection area is done in Image Editor and if the current // image is the same in Image Viewer, then compute too the histogram // for this selection. - histogramWidget->updateData( *m_pcFrame, PlaYUVerFrame() ); + histogramWidget->updateData( m_pcFrame, new PlaYUVerFrame ); fullImageButton->hide(); selectionImageButton->hide(); updateInformations(); @@ -510,7 +510,7 @@ Void FramePropertiesSideBar::setSelection( const QRect &selectionArea ) // imageSelection.height(), // imageSelection.bitsPerChannel(), // imageSelection.colorSpace() ); - histogramWidget->updateSelectionData( *m_pcFrameSelection ); + histogramWidget->updateSelectionData( m_pcFrameSelection ); fullImageButton->show(); selectionImageButton->show(); selectionImageButton->click(); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 6eb1a0c..eadd956 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -227,7 +227,14 @@ void plaYUVerApp::selectModule( QAction *curr_action ) PlaYUVerModuleIf* pcCurrMod = m_pcModulesHandle->getSelectedModuleIf(); if( pcCurrMod ) { - m_pcCurrentSubWindow->enableModule( pcCurrMod ); + if( pcCurrMod->m_cModuleDef.m_bRequiresNewWindow ) + { + + } + else + { + m_pcCurrentSubWindow->enableModule( pcCurrMod ); + } } } return; diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index eee11cc..2a73e8d 100755 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -122,6 +122,7 @@ public: Pel*** getPelBufferYUV() const { + //m_bHasRGBPel = false; return m_pppcInputPel; } diff --git a/source/lib/PlaYUVerFrameStatistics.cpp b/source/lib/PlaYUVerFrameStatistics.cpp index a04e09a..20f3027 100755 --- a/source/lib/PlaYUVerFrameStatistics.cpp +++ b/source/lib/PlaYUVerFrameStatistics.cpp @@ -95,11 +95,11 @@ public: // Constructors and Destructor //////////////////////////////////////////////////////////////////////////////// -PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( const PlaYUVerFrame& playuver_frame, QObject *parent, Options options ) : +PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( const PlaYUVerFrame *playuver_frame, QObject *parent, Options options ) : QThread() { - setup( playuver_frame.getPelBufferYUV(), playuver_frame.getWidth(), playuver_frame.getHeight(), playuver_frame.getBitsChannel(), - playuver_frame.getPelFormat(), playuver_frame.getChromaLength(), parent, options ); + setup( playuver_frame->getPelBufferYUV(), playuver_frame->getWidth(), playuver_frame->getHeight(), playuver_frame->getBitsChannel(), + playuver_frame->getPelFormat(), playuver_frame->getChromaLength(), parent, options ); } PlaYUVerFrameStatistics::PlaYUVerFrameStatistics( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int pixel_format, UInt chroma_size, QObject *parent, diff --git a/source/lib/PlaYUVerFrameStatistics.h b/source/lib/PlaYUVerFrameStatistics.h index fe405be..ec4d507 100755 --- a/source/lib/PlaYUVerFrameStatistics.h +++ b/source/lib/PlaYUVerFrameStatistics.h @@ -88,7 +88,7 @@ public: PlaYUVerFrameStatistics( Pel ***data, UInt width, UInt height, Int bitsPerChannel, Int pixel_format, UInt chroma_size, QObject *parent = 0, Options options = CalcLumaWhenRGB ); - PlaYUVerFrameStatistics( const PlaYUVerFrame& playuver_frame, QObject *parent = 0, Options options = CalcLumaWhenRGB ); + PlaYUVerFrameStatistics( const PlaYUVerFrame *playuver_frame, QObject *parent = 0, Options options = CalcLumaWhenRGB ); ~PlaYUVerFrameStatistics(); diff --git a/source/modules/FilterFrame.cpp b/source/modules/FilterFrame.cpp index 6272eea..e863bdc 100644 --- a/source/modules/FilterFrame.cpp +++ b/source/modules/FilterFrame.cpp @@ -35,6 +35,7 @@ PlaYUVerModuleDefinition FilterFrameDef = { "Filters", "Y_Filter", "Filter Y matrix of YUV frame", + false, }; FilterFrame::FilterFrame() @@ -45,24 +46,14 @@ FilterFrame::FilterFrame() Void FilterFrame::create( PlaYUVerFrame* InputFrame ) { m_pcFilteredFrame = NULL; - m_pcFilteredFrame = new PlaYUVerFrame( InputFrame->getWidth(), InputFrame->getHeight(), InputFrame->getPelFormat() ); + m_pcFilteredFrame = new PlaYUVerFrame( InputFrame->getWidth(), InputFrame->getHeight(), PlaYUVerFrame::GRAY ); } PlaYUVerFrame* FilterFrame::process( PlaYUVerFrame* InputFrame ) { - Pel*** pppPelYUV = m_pcFilteredFrame->getPelBufferYUV(); - - m_pcFilteredFrame->CopyFrom( InputFrame ); - - for( UInt y = 0; y < m_pcFilteredFrame->getHeight() / 2; y++ ) - { - for( UInt x = 0; x < m_pcFilteredFrame->getWidth() / 2; x++ ) - { - pppPelYUV[1][y][x] = 128; - pppPelYUV[2][y][x] = 128; - } - } - //m_pcFilteredFrame->YUV420toRGB(); + Pel*** pppOutputPelYUV = m_pcFilteredFrame->getPelBufferYUV(); + Pel*** pppInputPelYUV = InputFrame->getPelBufferYUV(); + memcpy( pppOutputPelYUV[LUMA][0], pppInputPelYUV[LUMA][0], m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof(Pel) ); return m_pcFilteredFrame; }