Add new API for modules
This commit is contained in:
9 files changed
+248
-38
No files matched your search
@@ -30,6 +30,7 @@ ADD_MODULE( FrameCrop "FrameCrop" )
|
||||
ADD_MODULE( LumaAverage "LumaAverage" )
|
||||
ADD_MODULE( WeightedPSNR "WeightedPSNR" )
|
||||
ADD_MODULE( HEVCIntraPrediction "HEVCIntraPrediction" )
|
||||
ADD_MODULE( ThreeSixtySpatialtoTemporal "ThreeSixtySpatialtoTemporal" )
|
||||
|
||||
ADD_MODULE_USE_OPENCV( MeasureOpticalFlowDualTVL1 "MeasureOpticalFlowDualTVL1" VERSION 2.4.13.0 MODULES video )
|
||||
ADD_MODULE_USE_OPENCV( DisparityStereoBM "DisparityStereoBM" VERSION 2.4.13.0 MODULES calib3d )
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file FrameRotate.cpp
|
||||
* \brief Frame Difference module
|
||||
*/
|
||||
|
||||
#include "ThreeSixtySpatialtoTemporal.h"
|
||||
|
||||
ThreeSixtySpatialtoTemporal::ThreeSixtySpatialtoTemporal()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_3;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleLongName = "Spatial to Temporal";
|
||||
m_pchModuleName = "SpatialtoTemporal";
|
||||
m_pchModuleTooltip = "Convert 360 video from Cube Map Projection to temporal frames";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY;
|
||||
|
||||
m_pcFrameProcessed = NULL;
|
||||
|
||||
uiFacesX = 3;
|
||||
uiFacesY = 2;
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
bool ThreeSixtySpatialtoTemporal::flush()
|
||||
{
|
||||
m_iFrameBufferCount = 0;
|
||||
uiCopyX = 0;
|
||||
uiCopyY = 0;
|
||||
return true;
|
||||
};
|
||||
|
||||
bool ThreeSixtySpatialtoTemporal::needFrame()
|
||||
{
|
||||
if( m_iFrameBufferCount == 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
bool ThreeSixtySpatialtoTemporal::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
|
||||
unsigned int iWidth;
|
||||
unsigned int iHeight;
|
||||
|
||||
iWidth = apcFrameList[0]->getWidth() / uiFacesX;
|
||||
iHeight = apcFrameList[0]->getHeight() / uiFacesY;
|
||||
|
||||
m_pcFrameProcessed = new CalypFrame( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
|
||||
m_pcTmpFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
return true;
|
||||
}
|
||||
|
||||
CalypFrame* ThreeSixtySpatialtoTemporal::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_3_BREAK_CONDITION_
|
||||
|
||||
if( m_iFrameBufferCount == 0 )
|
||||
{
|
||||
m_pcTmpFrame->copyFrom( apcFrameList[0] );
|
||||
uiCopyX = 0;
|
||||
uiCopyY = 0;
|
||||
|
||||
m_iFrameBufferCount = uiFacesX * uiFacesY;
|
||||
}
|
||||
|
||||
m_pcFrameProcessed->copyFrom( m_pcTmpFrame, uiCopyX, uiCopyY );
|
||||
m_iFrameBufferCount--;
|
||||
|
||||
uiCopyX += m_pcFrameProcessed->getWidth();
|
||||
if( uiCopyX >= m_pcTmpFrame->getWidth() )
|
||||
{
|
||||
uiCopyX = 0;
|
||||
uiCopyY += m_pcFrameProcessed->getHeight();
|
||||
}
|
||||
|
||||
return m_pcFrameProcessed;
|
||||
}
|
||||
|
||||
void ThreeSixtySpatialtoTemporal::destroy()
|
||||
{
|
||||
if( m_pcFrameProcessed )
|
||||
delete m_pcFrameProcessed;
|
||||
m_pcFrameProcessed = NULL;
|
||||
if( m_pcTmpFrame )
|
||||
delete m_pcTmpFrame;
|
||||
m_pcTmpFrame = NULL;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file FrameRotate.h
|
||||
* \brief Module to aapply a mask to an image
|
||||
*/
|
||||
|
||||
#ifndef __THREESIXTYSPATIALTOTEMPORAL_H__
|
||||
#define __THREESIXTYSPATIALTOTEMPORAL_H__
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
class ThreeSixtySpatialtoTemporal : public CalypModuleIf
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( ThreeSixtySpatialtoTemporal )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcFrameProcessed;
|
||||
CalypFrame* m_pcTmpFrame;
|
||||
unsigned int uiFacesX;
|
||||
unsigned int uiFacesY;
|
||||
unsigned int uiCopyX;
|
||||
unsigned int uiCopyY;
|
||||
|
||||
public:
|
||||
ThreeSixtySpatialtoTemporal();
|
||||
virtual ~ThreeSixtySpatialtoTemporal() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
bool needFrame();
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
bool flush();
|
||||
void destroy();
|
||||
};
|
||||
|
||||
#endif // __THREESIXTYSPATIALTOTEMPORAL_H__
|
||||
Reference in new issue
Block a user