Add new option in calypTools to process video with negative values
This commit is contained in:
+11
-5
@@ -103,11 +103,11 @@ private:
|
||||
unsigned int m_uiIndex;
|
||||
|
||||
public:
|
||||
CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, int bitsPixel )
|
||||
CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, int bitsPixel, bool hasNegative )
|
||||
{
|
||||
for( unsigned int i = 0; i < size; i++ )
|
||||
{
|
||||
CalypFrame* pFrame = new CalypFrame( width, height, pelFormat, bitsPixel );
|
||||
CalypFrame* pFrame = new CalypFrame( width, height, pelFormat, bitsPixel, hasNegative );
|
||||
m_apcFrameBuffer.push_back( pFrame );
|
||||
}
|
||||
m_uiIndex = 0;
|
||||
@@ -238,7 +238,7 @@ ClpString CalypStream::getCodecName() const
|
||||
return !d->handler ? "" : d->handler->getCodecName();
|
||||
}
|
||||
|
||||
bool CalypStream::open( ClpString filename, ClpString resolution, ClpString input_format_name, unsigned int bitsPel, int endianness,
|
||||
bool CalypStream::open( ClpString filename, ClpString resolution, ClpString input_format_name, unsigned int bitsPel, int endianness, bool hasNegative,
|
||||
unsigned int frame_rate, bool bInput )
|
||||
{
|
||||
unsigned int width = 0;
|
||||
@@ -261,11 +261,17 @@ bool CalypStream::open( ClpString filename, ClpString resolution, ClpString inpu
|
||||
break;
|
||||
}
|
||||
}
|
||||
return open( filename, width, height, input_format, bitsPel, endianness, frame_rate, bInput );
|
||||
return open( filename, width, height, input_format, bitsPel, endianness, hasNegative, frame_rate, bInput );
|
||||
}
|
||||
|
||||
bool CalypStream::open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness,
|
||||
unsigned int frame_rate, bool bInput )
|
||||
{
|
||||
return open( filename, width, height, input_format, bitsPel, endianness, false, frame_rate, bInput );
|
||||
}
|
||||
|
||||
bool CalypStream::open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative,
|
||||
unsigned int frame_rate, bool bInput )
|
||||
{
|
||||
if( d->isInit )
|
||||
{
|
||||
@@ -314,7 +320,7 @@ bool CalypStream::open( ClpString filename, unsigned int width, unsigned int hei
|
||||
try
|
||||
{
|
||||
d->frameBuffer = new CalypStreamBufferPrivate( d->isInput ? 3 : 1, d->handler->m_uiWidth, d->handler->m_uiHeight,
|
||||
d->handler->m_iPixelFormat, d->handler->m_uiBitsPerPixel );
|
||||
d->handler->m_iPixelFormat, d->handler->m_uiBitsPerPixel, hasNegative );
|
||||
}
|
||||
catch( CalypFailure& e )
|
||||
{
|
||||
|
||||
+4
-1
@@ -72,10 +72,13 @@ public:
|
||||
ClpString getCodecName() const;
|
||||
;
|
||||
|
||||
bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate,
|
||||
bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate,
|
||||
bool bInput );
|
||||
bool open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate,
|
||||
bool bInput );
|
||||
bool open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate,
|
||||
bool bInput );
|
||||
|
||||
bool reload();
|
||||
void close();
|
||||
|
||||
|
||||
+10
-5
@@ -23,12 +23,12 @@
|
||||
*/
|
||||
|
||||
#include "CalypTools.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
#include "lib/CalypStream.h"
|
||||
@@ -79,13 +79,14 @@ int CalypTools::openInputs()
|
||||
ClpString fmtString( "yuv420p" );
|
||||
unsigned int uiBitsPerPixel = 8;
|
||||
unsigned int uiEndianness = 0;
|
||||
bool hasNegativeValues = false;
|
||||
|
||||
CalypStream* pcStream;
|
||||
for( unsigned int i = 0; i < inputFileNames.size() && i < MAX_NUMBER_INPUTS; i++ )
|
||||
{
|
||||
if( Opts().hasOpt( "size" ) )
|
||||
{
|
||||
resolutionString = GET_PARAM( m_strResolution, 0 );
|
||||
resolutionString = GET_PARAM( m_strResolution, i );
|
||||
}
|
||||
if( Opts().hasOpt( "pel_fmt" ) )
|
||||
{
|
||||
@@ -106,10 +107,14 @@ int CalypTools::openInputs()
|
||||
uiEndianness = 1;
|
||||
}
|
||||
}
|
||||
if( Opts().hasOpt( "has_negative" ) )
|
||||
{
|
||||
hasNegativeValues = std::stoi( GET_PARAM( m_strHasNegativeValues, i ).c_str() ) == 0 ? false : true;
|
||||
}
|
||||
pcStream = new CalypStream;
|
||||
try
|
||||
{
|
||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitsPerPixel, uiEndianness, 1, true ) )
|
||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitsPerPixel, uiEndianness, hasNegativeValues, 1, true ) )
|
||||
{
|
||||
log( CLP_LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
|
||||
return -1;
|
||||
@@ -172,11 +177,11 @@ int CalypTools::Open( int argc, char* argv[] )
|
||||
m_uiOutEndianness = 0;
|
||||
if( Opts().hasOpt( "endianness" ) )
|
||||
{
|
||||
if( m_strEndianness[0] == "big" )
|
||||
if( GET_PARAM( m_strEndianness, 9999 ) == "big" )
|
||||
{
|
||||
m_uiOutEndianness = 0;
|
||||
}
|
||||
else if( m_strEndianness[0] == "little" )
|
||||
else if( GET_PARAM( m_strEndianness, 9999 ) == "little" )
|
||||
{
|
||||
m_uiOutEndianness = 1;
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
|
||||
#include "CalypToolsCmdParser.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
#include "lib/CalypStream.h"
|
||||
#include "modules/CalypModulesFactory.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
CalypToolsCmdParser::CalypToolsCmdParser()
|
||||
{
|
||||
m_uiLogLevel = 0;
|
||||
@@ -66,6 +66,7 @@ int CalypToolsCmdParser::parseToolsArgs( int argc, char* argv[] )
|
||||
( "pel_fmt,p", m_strPelFmt, "pixel format" ) /**/
|
||||
( "bits_pel", m_strBitsPerPixel, "bits per pixel" ) /**/
|
||||
( "endianness", m_strEndianness, "File endianness (big, little)" ) /**/
|
||||
( "has_negative", m_strHasNegativeValues, "Flag for files with negatie values" ) /**/
|
||||
( "frames,f", m_iFrames, "number of frames to parse" ) /**/
|
||||
( "quality", m_strQualityMetric, "select a quality metric" ) /**/
|
||||
( "module", m_strModule, "select a module (use internal name)" ) /**/
|
||||
|
||||
@@ -69,6 +69,7 @@ protected:
|
||||
std::vector<ClpString> m_strPelFmt;
|
||||
std::vector<ClpString> m_strBitsPerPixel;
|
||||
std::vector<ClpString> m_strEndianness;
|
||||
std::vector<ClpString> m_strHasNegativeValues;
|
||||
ClpString m_strOutput;
|
||||
long m_iFrames;
|
||||
unsigned m_uiOutEndianness;
|
||||
|
||||
Reference in New Issue
Block a user