4 Commits
29 changed files with 199 additions and 166 deletions

No files matched your search

+1 -1
View File
@@ -226,7 +226,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops -ftree-vectorizer-verbose")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops")
ADD_DEFINITIONS(
-DQT_NO_CAST_TO_ASCII
+8
View File
@@ -60,6 +60,14 @@ void CalypAppModuleIf::update( bool isPlaying )
}
}
void CalypAppModuleIf::setPlaying( bool isPlaying )
{
if( m_pcDisplaySubWindow )
{
m_pcDisplaySubWindow->setPlaying( isPlaying );
}
}
bool CalypAppModuleIf::isRunning()
{
#ifdef CALYP_THREADED_MODULES
+1
View File
@@ -108,6 +108,7 @@ public:
ClpString moduleInfo() { return m_pcModule->moduleInfo(); }
void update( bool isPlaying );
bool apply( bool isPlaying = false, bool disableThreads = false );
void setPlaying( bool isPlaying );
bool isRunning();
void show();
void destroy();
+1 -1
View File
@@ -579,7 +579,7 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
{
pcCurrModuleIf->apply( false, true );
QCoreApplication::processEvents();
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
pcCurrModuleIf->m_pcModuleStream->writeFrame( *pcCurrModuleIf->m_pcProcessedFrame );
for( unsigned int i = 0; i < numberOfWindows; i++ )
{
pcCurrModuleIf->m_pcSubWindow[i]->play();
+15 -8
View File
@@ -800,7 +800,7 @@ bool VideoSubWindow::save( QString filename )
{
return false;
}
iRet = CalypStream::saveFrame( filename.toStdString(), saveFrame );
iRet = CalypStream::saveFrame( filename.toStdString(), *saveFrame );
QApplication::restoreOverrideCursor();
return iRet;
}
@@ -815,6 +815,15 @@ bool VideoSubWindow::saveStream( QString filename )
return iRet;
}
void VideoSubWindow::setPlaying( bool isPlaying )
{
m_bIsPlaying = isPlaying;
for( auto module : m_apcCurrentModule )
{
module->setPlaying( isPlaying );
}
}
bool VideoSubWindow::isPlaying()
{
if( getCategory() & SubWindowCategory::MODULE_SUBWINDOW )
@@ -831,14 +840,12 @@ bool VideoSubWindow::isPlaying()
bool VideoSubWindow::play()
{
bool isPlaying = false;
if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 )
{
m_bIsPlaying = true;
}
else
{
m_bIsPlaying = false;
isPlaying = true;
}
setPlaying( isPlaying );
return m_bIsPlaying;
}
@@ -854,7 +861,7 @@ bool VideoSubWindow::playEvent()
void VideoSubWindow::pause()
{
m_bIsPlaying = false;
setPlaying( false );
refreshFrame();
}
@@ -891,7 +898,7 @@ void VideoSubWindow::stop()
m_cRefreshResult.waitForFinished();
m_cReadResult.waitForFinished();
#endif
m_bIsPlaying = false;
setPlaying( false );
seekAbsoluteEvent( 0 );
return;
}
+1
View File
@@ -127,6 +127,7 @@ public:
bool playEvent();
void stop();
void setPlaying( bool isPlaying );
bool isPlaying();
void seekAbsoluteEvent( unsigned int new_frame_num );
void seekRelativeEvent( bool bIsFoward );
+12 -6
View File
@@ -365,7 +365,7 @@ void FramePropertiesDock::setFrame( CalypFrame* pcFrame, bool isPlaying )
if( pcFrame )
{
m_bHasFrame = true;
m_cFrame = CalypFrame( pcFrame );
m_pcFrame = std::make_shared<CalypFrame>( *pcFrame );
}
else
{
@@ -389,8 +389,10 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
*/
if( bSelectionChanged )
{
m_cSelectedFrame = CalypFrame( m_cFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
selectionArea.height() );
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame, selectionArea.x(),
selectionArea.y(),
selectionArea.width(),
selectionArea.height() );
}
updateDataHistogram();
selectionImageButton->click();
@@ -413,7 +415,11 @@ void FramePropertiesDock::updateDataHistogram()
{
if( m_cSelectionArea.isValid() )
{
m_cSelectedFrame = CalypFrame( m_cFrame, m_cSelectionArea.x(), m_cSelectionArea.y(), m_cSelectionArea.width(), m_cSelectionArea.height() );
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame,
m_cSelectionArea.x(),
m_cSelectionArea.y(),
m_cSelectionArea.width(),
m_cSelectionArea.height() );
fullImageButton->show();
selectionImageButton->show();
}
@@ -422,7 +428,7 @@ void FramePropertiesDock::updateDataHistogram()
fullImageButton->hide();
selectionImageButton->hide();
}
histogramWidget->updateData( &m_cFrame, m_cSelectionArea.isValid() ? &m_cSelectedFrame : nullptr );
histogramWidget->updateData( m_pcFrame, m_cSelectionArea.isValid() ? m_pcSelectedFrame : nullptr );
}
else
{
@@ -448,7 +454,7 @@ void FramePropertiesDock::updateStatistiques()
if( channel == CalypFrame::HIST_ALL_CHANNELS )
channel = colorsCB->itemData( colorsCB->currentIndex() ).toInt();
CalypFrame* frame;
std::shared_ptr<CalypFrame> frame;
if( histogramWidget->m_renderingType == HistogramWidget::FullImageHistogram )
frame = histogramWidget->m_fullImage;
+2 -2
View File
@@ -49,8 +49,8 @@ public:
void stopHistogram();
private:
CalypFrame m_cFrame;
CalypFrame m_cSelectedFrame;
std::shared_ptr<CalypFrame> m_pcFrame;
std::shared_ptr<CalypFrame> m_pcSelectedFrame;
int m_iLastFrameType;
bool m_bIsPlaying;
bool m_bHasFrame;
+8 -9
View File
@@ -41,24 +41,23 @@ class HistogramWorker : public QThread
{
private:
QObject* m_parent;
CalypFrame* m_pcFrame;
std::shared_ptr<CalypFrame> m_pcFrame;
public:
HistogramWorker( QObject* parent )
{
m_pcFrame = NULL;
m_parent = parent;
}
void setup( CalypFrame* frame )
void setup( std::shared_ptr<CalypFrame> frame )
{
m_pcFrame = frame;
//run();
start();
run();
//start();
}
void run()
{
if( m_pcFrame && m_parent )
if( m_pcFrame != nullptr && m_parent != nullptr )
{
EventData* eventData = new EventData();
eventData->starting = true;
@@ -86,7 +85,7 @@ public:
bool starting;
bool success;
CalypFrame* frame;
std::shared_ptr<CalypFrame> frame;
};
};
@@ -371,7 +370,7 @@ void HistogramWidget::stopHistogramComputation()
// Update Data Methods
////////////////////////////////////////////////////////////////////////////////
void HistogramWidget::updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection )
void HistogramWidget::updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection )
{
d->imageBits = pcFrame->getBitsPel();
switch( pcFrame->getColorSpace() )
@@ -489,7 +488,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
int wWidth = width() - 1;
int wHeight = height() - 1;
double max;
CalypFrame* frame;
std::shared_ptr<CalypFrame> frame;
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
frame = m_selectionImage;
+3 -5
View File
@@ -90,7 +90,7 @@ public:
void stopHistogramComputation();
/** Update full image histogram data. */
void updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection );
void updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection );
/** @see @p HistogramOption */
void setOptions( HistogramOptions options = AllOptions );
@@ -113,12 +113,10 @@ public:
/** Full image */
HistogramWorker* m_imageWorker;
// CalypFrameStats* m_imageHistogram;
CalypFrame* m_fullImage;
std::shared_ptr<CalypFrame> m_fullImage;
/** Histogram area selection */
HistogramWorker* m_selectionWorker;
// CalypFrameStats* m_selectionHistogram;
CalypFrame* m_selectionImage;
std::shared_ptr<CalypFrame> m_selectionImage;
Q_SIGNALS:
void signalintervalChanged( int min, int max );
+13 -19
View File
@@ -258,12 +258,6 @@ public:
/*!
* \brief Constructors
*/
CalypFrame::CalypFrame()
: d{ std::make_unique<CalypFramePrivate>() }
{
}
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
: d{ std::make_unique<CalypFramePrivate>() }
{
@@ -300,15 +294,15 @@ CalypFrame::CalypFrame( const CalypFrame& other )
copyFrom( &other );
}
CalypFrame::CalypFrame( const CalypFrame* other )
: d{ std::make_unique<CalypFramePrivate>() }
{
if( other )
{
d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel(), other->getHasNegativeValues() );
copyFrom( other );
}
}
// CalypFrame::CalypFrame( const CalypFrame* other )
// : d{ std::make_unique<CalypFramePrivate>() }
// {
// if( other )
// {
// d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel(), other->getHasNegativeValues() );
// copyFrom( other );
// }
// }
CalypFrame& CalypFrame::operator=( const CalypFrame& other )
{
@@ -621,7 +615,7 @@ void CalypFrame::copyFrom( const CalypFrame* other, unsigned x, unsigned y )
copyFrom( *other, x, y );
}
void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y )
void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y ) const
{
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_PEL_FMT | MATCH_BITS ) )
return;
@@ -642,7 +636,7 @@ void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y )
d->m_bHasHistogram = false;
}
void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y )
void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y ) const
{
if( other )
copyTo( *other, x, y );
@@ -709,7 +703,7 @@ void CalypFrame::frameFromBuffer( const std::vector<ClpByte>& Buff, int iEndiann
d->m_bHasHistogram = false;
}
void CalypFrame::frameToBuffer( std::vector<ClpByte>& output_buffer, int iEndianness )
void CalypFrame::frameToBuffer( std::vector<ClpByte>& output_buffer, int iEndianness ) const
{
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
ClpByte* ppBuff[MAX_NUMBER_PLANES];
@@ -1230,7 +1224,7 @@ double CalypFrame::getEntropy( unsigned channel, unsigned int start, unsigned in
**************************************************************
*/
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel )
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel ) const
{
bool bRet = false;
#ifdef USE_OPENCV
+5 -10
View File
@@ -27,6 +27,7 @@
#define __CALYPFRAME_H__
#include <span>
#include <vector>
#include "CalypDefs.h"
@@ -105,11 +106,6 @@ public:
static int findPixelFormat( const ClpString& name );
static int pelformatColorSpace( const int idx );
/**
* Default constructor. Frame is not valid
*/
CalypFrame();
/**
* Creates a new frame using the following configuration
*
@@ -152,7 +148,6 @@ public:
* @param other existing frame to copy from
*/
CalypFrame( const CalypFrame& other );
CalypFrame( const CalypFrame* other );
/**
* Copy-assignement contructor
@@ -369,12 +364,12 @@ public:
* @param x x position on the current frame
* @param y y position on the current frame
*/
void copyTo( const CalypFrame& other, unsigned x, unsigned y );
void copyTo( const CalypFrame* other, unsigned x, unsigned y );
void copyTo( const CalypFrame& other, unsigned x, unsigned y ) const;
void copyTo( const CalypFrame* other, unsigned x, unsigned y ) const;
void frameFromBuffer( const std::vector<ClpByte>&, int, unsigned long );
void frameFromBuffer( const std::vector<ClpByte>&, int );
void frameToBuffer( std::vector<ClpByte>&, int );
void frameToBuffer( std::vector<ClpByte>&, int ) const;
void fillRGBBuffer();
@@ -415,7 +410,7 @@ public:
/**
* interface with OpenCV lib
*/
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 );
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 ) const;
bool fromMat( cv::Mat& cvMat, int iChannel = -1 );
/**
+1
View File
@@ -42,6 +42,7 @@
#include <list>
#include <map>
#include <vector>
#include "CalypDefs.h"
+53 -45
View File
@@ -99,40 +99,38 @@ std::vector<CalypStandardResolution> CalypStream::stdResolutionSizes()
class CalypStreamBufferPrivate
{
private:
std::vector<CalypFrame*> m_apcFrameBuffer;
std::vector<CalypFrame> m_apcFrameBuffer;
unsigned int m_uiIndex;
public:
CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, int bitsPixel, bool hasNegative )
CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, unsigned int bitsPixel, bool hasNegative )
{
for( unsigned int i = 0; i < size; i++ )
{
m_apcFrameBuffer.push_back( new CalypFrame( width, height, pelFormat, bitsPixel, hasNegative ) );
m_apcFrameBuffer.push_back( CalypFrame{ width, height, pelFormat, bitsPixel, hasNegative } );
}
m_uiIndex = 0;
}
~CalypStreamBufferPrivate()
{
while( !m_apcFrameBuffer.empty() )
{
delete m_apcFrameBuffer.back();
m_apcFrameBuffer.pop_back();
}
}
~CalypStreamBufferPrivate() = default;
void increase( unsigned int newSize )
{
for( unsigned int i = m_apcFrameBuffer.size(); i < newSize; i++ )
{
m_apcFrameBuffer.push_back( new CalypFrame( m_apcFrameBuffer.at( 0 ) ) );
m_apcFrameBuffer.push_back( CalypFrame{ m_apcFrameBuffer[0].getWidth(),
m_apcFrameBuffer[0].getHeight(),
m_apcFrameBuffer[0].getPelFormat(),
m_apcFrameBuffer[0].getBitsPel(),
m_apcFrameBuffer[0].getHasNegativeValues() } );
}
}
unsigned int size() { return m_apcFrameBuffer.size(); }
void setIndex( unsigned int i ) { m_uiIndex = i; }
CalypFrame* frame( int i ) { return m_apcFrameBuffer.at( i ); }
CalypFrame& frame( int i ) { return m_apcFrameBuffer.at( i ); }
CalypFrame* current() { return m_apcFrameBuffer.at( m_uiIndex ); }
CalypFrame* next() { return m_apcFrameBuffer.at( nextIndex() ); }
CalypFrame& current() { return m_apcFrameBuffer.at( m_uiIndex ); }
CalypFrame& next() { return m_apcFrameBuffer.at( nextIndex() ); }
void setNextFrame() { m_uiIndex = nextIndex(); }
private:
@@ -140,8 +138,9 @@ private:
inline int prevIndex() { return m_uiIndex - 1 < 0 ? m_apcFrameBuffer.size() - 1 : m_uiIndex - 1; }
};
struct CalypStreamPrivate
class CalypStream::CalypStreamPrivate
{
public:
bool isInit;
bool isInput;
@@ -165,6 +164,26 @@ struct CalypStreamPrivate
iCurrFrameNum = -1;
cFilename = "";
}
~CalypStreamPrivate()
{
close();
}
void close()
{
if( !isInit )
return;
if( handler )
{
handler->closeHandler();
handler->Delete();
}
if( frameBuffer )
delete frameBuffer;
bLoadAll = false;
isInit = false;
}
};
std::vector<ClpString> CalypStreamFormat::getExts()
@@ -219,15 +238,11 @@ CreateStreamHandlerFn CalypStream::findStreamHandler( ClpString strFilename, boo
}
CalypStream::CalypStream()
: d( new CalypStreamPrivate )
: d{ std::make_unique<CalypStreamPrivate>() }
{
}
CalypStream::~CalypStream()
{
close();
delete d;
}
CalypStream::~CalypStream() = default;
ClpString CalypStream::getFormatName() const
{
@@ -329,7 +344,7 @@ bool CalypStream::open( ClpString filename, unsigned int width, unsigned int hei
return d->isInit;
}
d->handler->m_uiNBytesPerFrame = d->frameBuffer->current()->getBytesPerFrame();
d->handler->m_uiNBytesPerFrame = d->frameBuffer->current().getBytesPerFrame();
// Some handlers need to know how long is a frame to get frame number
d->handler->calculateFrameNumber();
@@ -365,7 +380,7 @@ bool CalypStream::reload()
throw CalypFailure( "CalypStream", "Cannot open stream " + d->cFilename + " with the " +
ClpString( d->handler->m_pchHandlerName ) + " handler" );
}
d->handler->m_uiNBytesPerFrame = d->frameBuffer->current()->getBytesPerFrame();
d->handler->m_uiNBytesPerFrame = d->frameBuffer->current().getBytesPerFrame();
d->handler->calculateFrameNumber();
d->handler->configureBuffer( d->frameBuffer->current() );
@@ -386,19 +401,7 @@ bool CalypStream::reload()
void CalypStream::close()
{
if( !d->isInit )
return;
if( d->handler )
{
d->handler->closeHandler();
d->handler->Delete();
}
if( d->frameBuffer )
delete d->frameBuffer;
d->bLoadAll = false;
d->isInit = false;
d->close();
}
ClpString CalypStream::getFileName() const
@@ -488,7 +491,7 @@ void CalypStream::loadAll()
d->iCurrFrameNum = 0;
}
bool CalypStream::readFrame( CalypFrame* frame )
bool CalypStream::readFrame( CalypFrame& frame )
{
if( !d->isInit || !d->isInput || d->handler->m_uiCurrFrameFileIdx >= d->handler->m_uiTotalNumberFrames )
return false;
@@ -509,7 +512,7 @@ void CalypStream::writeFrame()
writeFrame( d->frameBuffer->current() );
}
void CalypStream::writeFrame( CalypFrame* pcFrame )
void CalypStream::writeFrame( const CalypFrame& pcFrame )
{
if( !d->handler->write( pcFrame ) )
{
@@ -523,11 +526,11 @@ bool CalypStream::saveFrame( const ClpString& filename )
return saveFrame( filename, d->frameBuffer->current() );
}
bool CalypStream::saveFrame( const ClpString& filename, CalypFrame* saveFrame )
bool CalypStream::saveFrame( const ClpString& filename, const CalypFrame& saveFrame )
{
CalypStream auxSaveStream;
if( !auxSaveStream.open( filename, saveFrame->getWidth(), saveFrame->getHeight(), saveFrame->getPelFormat(),
saveFrame->getBitsPel(), CLP_LITTLE_ENDIAN, 1, false ) )
if( !auxSaveStream.open( filename, saveFrame.getWidth(), saveFrame.getHeight(), saveFrame.getPelFormat(),
saveFrame.getBitsPel(), CLP_LITTLE_ENDIAN, 1, false ) )
{
return false;
}
@@ -560,11 +563,11 @@ void CalypStream::readNextFrame()
void CalypStream::readNextFrameFillRGBBuffer()
{
readNextFrame();
d->frameBuffer->next()->fillRGBBuffer();
d->frameBuffer->next().fillRGBBuffer();
return;
}
CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) const
CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image )
{
if( pyuv_image == NULL )
pyuv_image = new CalypFrame( d->frameBuffer->current() );
@@ -573,7 +576,12 @@ CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) const
return pyuv_image;
}
CalypFrame* CalypStream::getCurrFrame() const
CalypFrame* CalypStream::getCurrFrame()
{
return &d->frameBuffer->current();
}
const CalypFrame& CalypStream::getCurrFrameConst() const
{
return d->frameBuffer->current();
}
+14 -12
View File
@@ -26,6 +26,8 @@
#ifndef __CALYPSTREAM_H__
#define __CALYPSTREAM_H__
#include <vector>
#include "CalypDefs.h"
class CalypFrame;
@@ -33,21 +35,21 @@ class CalypStreamHandlerIf;
typedef CalypStreamHandlerIf* ( *CreateStreamHandlerFn )( void );
typedef struct
struct CalypStreamFormat
{
ClpString formatName;
ClpString formatExt;
std::vector<ClpString> getExts();
ClpString formatPattern;
CreateStreamHandlerFn formatFct;
} CalypStreamFormat;
};
typedef struct
struct CalypStandardResolution
{
ClpString shortName;
unsigned int uiWidth;
unsigned int uiHeight;
} CalypStandardResolution;
};
/**
* \class CalypStream
@@ -68,9 +70,7 @@ public:
~CalypStream();
ClpString getFormatName() const;
;
ClpString getCodecName() const;
;
bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate,
bool bInput );
@@ -97,27 +97,29 @@ public:
void loadAll();
void writeFrame();
void writeFrame( CalypFrame* pcFrame );
void writeFrame( const CalypFrame& pcFrame );
bool saveFrame( const ClpString& filename );
static bool saveFrame( const ClpString& filename, CalypFrame* saveFrame );
static bool saveFrame( const ClpString& filename, const CalypFrame& saveFrame );
CalypFrame* getCurrFrame( CalypFrame* ) const;
CalypFrame* getCurrFrame( CalypFrame* );
// continuous read control
bool setNextFrame();
void readNextFrame();
void readNextFrameFillRGBBuffer();
CalypFrame* getCurrFrame() const;
CalypFrame* getCurrFrame();
const CalypFrame& getCurrFrameConst() const;
bool seekInputRelative( bool bIsFoward );
bool seekInput( unsigned long new_frame_num );
private:
bool readFrame( CalypFrame* frame );
bool readFrame( CalypFrame& frame );
private:
struct CalypStreamPrivate* d;
class CalypStreamPrivate;
std::unique_ptr<CalypStreamPrivate> d;
};
#endif // __CALYPSTREAM_H__
+3 -3
View File
@@ -89,10 +89,10 @@ public:
virtual bool openHandler( ClpString strFilename, bool bInput ) = 0;
virtual void closeHandler() = 0;
virtual bool configureBuffer( CalypFrame* pcFrame ) = 0;
virtual bool configureBuffer( const CalypFrame& pcFrame ) = 0;
virtual bool seek( ClpULong iFrameNum ) = 0;
virtual bool read( CalypFrame* pcFrame ) = 0;
virtual bool write( CalypFrame* pcFrame ) = 0;
virtual bool read( CalypFrame& pcFrame ) = 0;
virtual bool write( const CalypFrame& pcFrame ) = 0;
virtual void calculateFrameNumber(){};
+5 -5
View File
@@ -325,9 +325,9 @@ void StreamHandlerLibav::closeHandler()
m_bHasStream = false;
}
bool StreamHandlerLibav::configureBuffer( CalypFrame* pcFrame )
bool StreamHandlerLibav::configureBuffer( const CalypFrame& pcFrame )
{
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame.getBytesPerFrame() );
return true;
}
@@ -354,7 +354,7 @@ void StreamHandlerLibav::calculateFrameNumber()
m_uiTotalNumberFrames = num_frames;
}
bool StreamHandlerLibav::read( CalypFrame* pcFrame )
bool StreamHandlerLibav::read( CalypFrame& pcFrame )
{
int bGotFrame = 0;
bool bErrors = false;
@@ -428,14 +428,14 @@ bool StreamHandlerLibav::read( CalypFrame* pcFrame )
av_image_copy_to_buffer( m_pStreamBuffer.data(), m_uiFrameBufferSize, decFrame->data,
decFrame->linesize, AVPixelFormat( m_ffPixFmt ), m_uiWidth, m_uiHeight, 1 );
pcFrame->frameFromBuffer( m_pStreamBuffer, m_iEndianness );
pcFrame.frameFromBuffer( m_pStreamBuffer, m_iEndianness );
m_uiCurrFrameFileIdx++;
return true;
}
return false;
}
bool StreamHandlerLibav::write( CalypFrame* pcFrame )
bool StreamHandlerLibav::write( const CalypFrame& pcFrame )
{
return false;
}
+3 -3
View File
@@ -65,11 +65,11 @@ public:
~StreamHandlerLibav() {}
bool openHandler( ClpString strFilename, bool bInput );
void closeHandler();
bool configureBuffer( CalypFrame* pcFrame );
bool configureBuffer( const CalypFrame& pcFrame );
void calculateFrameNumber();
bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame );
bool read( CalypFrame& pcFrame );
bool write( const CalypFrame& pcFrame );
unsigned int getStreamDuration() { return m_uiSecs; }
unsigned char* m_pchFrameBuffer;
+6 -6
View File
@@ -126,7 +126,7 @@ void StreamHandlerOpenCV::closeHandler()
}
}
bool StreamHandlerOpenCV::configureBuffer( CalypFrame* pcFrame )
bool StreamHandlerOpenCV::configureBuffer( const CalypFrame& pcFrame )
{
return true;
}
@@ -137,7 +137,7 @@ bool StreamHandlerOpenCV::seek( ClpULong iFrameNum )
return true;
}
bool StreamHandlerOpenCV::read( CalypFrame* pcFrame )
bool StreamHandlerOpenCV::read( CalypFrame& pcFrame )
{
bool bRet = false;
if( pcVideoCapture )
@@ -145,23 +145,23 @@ bool StreamHandlerOpenCV::read( CalypFrame* pcFrame )
Mat cvMat;
bRet = pcVideoCapture->read( cvMat );
if( bRet )
bRet = pcFrame->fromMat( cvMat );
bRet = pcFrame.fromMat( cvMat );
}
else
{
Mat cvMat = cv::imread( m_cFilename );
bRet = pcFrame->fromMat( cvMat );
bRet = pcFrame.fromMat( cvMat );
}
if( bRet )
m_uiCurrFrameFileIdx++;
return bRet;
}
bool StreamHandlerOpenCV::write( CalypFrame* pcFrame )
bool StreamHandlerOpenCV::write( const CalypFrame& pcFrame )
{
bool bRet = false;
Mat cvFrame;
bRet = pcFrame->toMat( cvFrame, false, true );
bRet = pcFrame.toMat( cvFrame, false, true );
if( !bRet )
return bRet;
bRet = cv::imwrite( m_cFilename, cvFrame );
+3 -3
View File
@@ -42,10 +42,10 @@ public:
~StreamHandlerOpenCV() {}
bool openHandler( ClpString strFilename, bool bInput );
void closeHandler();
bool configureBuffer( CalypFrame* pcFrame );
bool configureBuffer( const CalypFrame& pcFrame );
bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame );
bool read( CalypFrame& pcFrame );
bool write( const CalypFrame& pcFrame );
private:
cv::VideoCapture* pcVideoCapture;
+7 -7
View File
@@ -126,9 +126,9 @@ void StreamHandlerPortableMap::closeHandler()
fclose( m_pFile );
}
bool StreamHandlerPortableMap::configureBuffer( CalypFrame* pcFrame )
bool StreamHandlerPortableMap::configureBuffer( const CalypFrame& pcFrame )
{
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame.getBytesPerFrame() );
return true;
}
@@ -138,20 +138,20 @@ bool StreamHandlerPortableMap::seek( ClpULong iFrameNum )
return true;
}
bool StreamHandlerPortableMap::read( CalypFrame* pcFrame )
bool StreamHandlerPortableMap::read( CalypFrame& pcFrame )
{
unsigned long long int processed_bytes = fread( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
pcFrame->frameFromBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN );
pcFrame.frameFromBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN );
m_uiCurrFrameFileIdx++;
return true;
}
bool StreamHandlerPortableMap::write( CalypFrame* pcFrame )
bool StreamHandlerPortableMap::write( const CalypFrame& pcFrame )
{
CalypFrame pcRGBFrame( pcFrame->getWidth(), pcFrame->getHeight(),
m_iPixelFormat, pcFrame->getBitsPel() );
CalypFrame pcRGBFrame( pcFrame.getWidth(), pcFrame.getHeight(),
m_iPixelFormat, pcFrame.getBitsPel() );
pcRGBFrame.copyFrom( pcFrame );
fseek( m_pFile, 0, SEEK_SET );
fprintf( m_pFile, "P%d\n%d %d\n", m_iMagicNumber, m_uiWidth, m_uiHeight );
+3 -3
View File
@@ -37,10 +37,10 @@ public:
~StreamHandlerPortableMap() {}
bool openHandler( ClpString strFilename, bool bInput );
void closeHandler();
bool configureBuffer( CalypFrame* pcFrame );
bool configureBuffer( const CalypFrame& pcFrame );
bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame );
bool read( CalypFrame& pcFrame );
bool write( const CalypFrame& pcFrame );
private:
FILE* m_pFile; /**< The input file pointer >*/
+6 -6
View File
@@ -66,9 +66,9 @@ void StreamHandlerRaw::closeHandler()
fclose( m_pFile );
}
bool StreamHandlerRaw::configureBuffer( CalypFrame* pcFrame )
bool StreamHandlerRaw::configureBuffer( const CalypFrame& pcFrame )
{
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame.getBytesPerFrame() );
return true;
}
@@ -94,7 +94,7 @@ bool StreamHandlerRaw::seek( ClpULong iFrameNum )
return false;
}
bool StreamHandlerRaw::read( CalypFrame* pcFrame )
bool StreamHandlerRaw::read( CalypFrame& pcFrame )
{
if( !m_pFile || m_pStreamBuffer.empty() || m_uiNBytesPerFrame == 0 )
return false;
@@ -102,13 +102,13 @@ bool StreamHandlerRaw::read( CalypFrame* pcFrame )
if( processed_bytes != m_uiNBytesPerFrame )
return false;
m_uiCurrFrameFileIdx++;
pcFrame->frameFromBuffer( m_pStreamBuffer, m_iEndianness );
pcFrame.frameFromBuffer( m_pStreamBuffer, m_iEndianness );
return true;
}
bool StreamHandlerRaw::write( CalypFrame* pcFrame )
bool StreamHandlerRaw::write( const CalypFrame& pcFrame )
{
pcFrame->frameToBuffer( m_pStreamBuffer, m_iEndianness );
pcFrame.frameToBuffer( m_pStreamBuffer, m_iEndianness );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
+3 -3
View File
@@ -44,11 +44,11 @@ public:
~StreamHandlerRaw() {}
bool openHandler( ClpString strFilename, bool bInput );
void closeHandler();
bool configureBuffer( CalypFrame* pcFrame );
bool configureBuffer( const CalypFrame& pcFrame );
void calculateFrameNumber();
bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame );
bool read( CalypFrame& pcFrame );
bool write( const CalypFrame& pcFrame );
};
#endif // __STREAMHANDLERRAW_H__
+2 -2
View File
@@ -82,8 +82,8 @@ bool FrameDifference::create( std::vector<CalypFrame*> apcFrameList )
CalypFrame* FrameDifference::process( std::vector<CalypFrame*> apcFrameList )
{
const CalypFrame& frame1 = apcFrameList[0];
const CalypFrame& frame2 = apcFrameList[1];
const CalypFrame& frame1 = *apcFrameList[0];
const CalypFrame& frame2 = *apcFrameList[1];
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
short aux_pel_1, aux_pel_2;
short diff = 0;
+7 -1
View File
@@ -24,6 +24,8 @@
#include "FrameShift.h"
#include <memory>
FrameShift::FrameShift()
{
/* Module Definition */
@@ -48,7 +50,11 @@ FrameShift::FrameShift()
bool FrameShift::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcProcessedFrame = new CalypFrame( apcFrameList[0] );
m_pcProcessedFrame = new CalypFrame{ apcFrameList[0]->getWidth(),
apcFrameList[0]->getHeight(),
apcFrameList[0]->getPelFormat(),
apcFrameList[0]->getBitsPel(),
apcFrameList[0]->getHasNegativeValues() };
return true;
}
+5 -1
View File
@@ -53,7 +53,11 @@ bool OptimiseDisplay::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcOptimisedFrame = new CalypFrame( apcFrameList[0] );
m_pcOptimisedFrame = new CalypFrame{ apcFrameList[0]->getWidth(),
apcFrameList[0]->getHeight(),
apcFrameList[0]->getPelFormat(),
apcFrameList[0]->getBitsPel(),
apcFrameList[0]->getHasNegativeValues() };
m_pcOptimisedFrame->reset();
return true;
+5 -2
View File
@@ -595,8 +595,11 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
m_pcOutputFrame = new CalypFrame( m_cvReshapePoints[0]->cols, m_cvReshapePoints[0]->rows, pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
break;
case 2:
m_pcOutputFrame = new CalypFrame( pcInputFrame );
m_pcOutputFrame->reset();
m_pcOutputFrame = new CalypFrame{ pcInputFrame->getWidth(),
pcInputFrame->getHeight(),
pcInputFrame->getPelFormat(),
pcInputFrame->getBitsPel(),
pcInputFrame->getHasNegativeValues() };
break;
}
return true;
+3 -3
View File
@@ -479,7 +479,7 @@ int CalypTools::RateReductionOperation()
if( ( frame % m_iRateReductionFactor ) == 0 )
{
log( CLP_LOG_INFO, "Writing", frame );
m_apcOutputStreams[0]->writeFrame( m_apcInputStreams[0]->getCurrFrame() );
m_apcOutputStreams[0]->writeFrame( m_apcInputStreams[0]->getCurrFrameConst() );
}
abEOF = m_apcInputStreams[0]->setNextFrame();
if( !abEOF )
@@ -640,7 +640,7 @@ int CalypTools::ModuleOperation()
if( pcProcessedFrame )
{
m_apcOutputStreams[0]->writeFrame( pcProcessedFrame );
m_apcOutputStreams[0]->writeFrame( *pcProcessedFrame );
}
}
else if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
@@ -675,7 +675,7 @@ int CalypTools::ModuleOperation()
pcProcessedFrame = m_pcCurrModuleIf->process( apcFrameList );
if( !pcProcessedFrame )
break;
m_apcOutputStreams[0]->writeFrame( pcProcessedFrame );
m_apcOutputStreams[0]->writeFrame( *pcProcessedFrame );
}
}
}