Merge branch 'master' into devel
This commit is contained in:
commit
73ed048752
85 files changed
+8071
-4408
No files matched your search
+10
-5
@@ -82,10 +82,14 @@ typedef UChar Byte;
|
||||
// Limits definition
|
||||
// ====================================================================================================================
|
||||
|
||||
// #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
|
||||
// #define MAX_INT 2147483647 ///< max. value of signed 32-bit integer
|
||||
// #define MAX_INT64 0x7FFFFFFFFFFFFFFFLL ///< max. value of signed 64-bit integer
|
||||
// #define MAX_DOUBLE 1.7e+308 ///< max. value of double-type value
|
||||
// #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned
|
||||
// 32-bit integer
|
||||
// #define MAX_INT 2147483647 ///< max. value of signed
|
||||
// 32-bit integer
|
||||
// #define MAX_INT64 0x7FFFFFFFFFFFFFFFLL ///< max. value of
|
||||
// signed 64-bit integer
|
||||
// #define MAX_DOUBLE 1.7e+308 ///< max. value of
|
||||
// double-type value
|
||||
|
||||
// ====================================================================================================================
|
||||
// PlaYUVer definitions
|
||||
@@ -139,7 +143,8 @@ struct PlaYUVerFailure : public std::exception
|
||||
String m_class_name;
|
||||
String m_error_msg;
|
||||
PlaYUVerFailure( String error_msg ) throw() : m_error_msg( error_msg ) {}
|
||||
PlaYUVerFailure( String class_name, String error_msg ) throw() : m_class_name( class_name ), m_error_msg( error_msg )
|
||||
PlaYUVerFailure( String class_name, String error_msg ) throw()
|
||||
: m_class_name( class_name ), m_error_msg( error_msg )
|
||||
{
|
||||
}
|
||||
~PlaYUVerFailure() throw() {}
|
||||
|
||||
+61
-28
@@ -22,8 +22,8 @@
|
||||
* \brief Video Frame handling
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <cmath>
|
||||
#ifdef USE_OPENCV
|
||||
@@ -75,12 +75,18 @@ Int PlaYUVerFrame::findPixelFormat( const String& name )
|
||||
return -1;
|
||||
}
|
||||
|
||||
static Int getImgMemory( Pel**** array3D, Int dim1, Int dim2, Int log2ChromaHeight, Int log2ChromaWidth )
|
||||
static Int getImgMemory( Pel**** array3D,
|
||||
Int dim1,
|
||||
Int dim2,
|
||||
Int log2ChromaHeight,
|
||||
Int log2ChromaWidth )
|
||||
{
|
||||
Int dim0 = 3;
|
||||
Int i;
|
||||
UInt64 total_mem_size = 0;
|
||||
UInt64 mem_size = ( dim1 * dim2 + CHROMASHIFT( dim1, log2ChromaHeight ) * CHROMASHIFT( dim2, log2ChromaWidth ) * 2 );
|
||||
UInt64 mem_size =
|
||||
( dim1 * dim2 +
|
||||
CHROMASHIFT( dim1, log2ChromaHeight ) * CHROMASHIFT( dim2, log2ChromaWidth ) * 2 );
|
||||
|
||||
total_mem_size += getMem2D<Pel*>( array3D, dim0, dim1 );
|
||||
|
||||
@@ -130,7 +136,8 @@ struct PlaYUVerFramePrivate
|
||||
|
||||
UInt m_uiWidth; //!< Width of the frame
|
||||
UInt m_uiHeight; //!< Height of the frame
|
||||
Int m_iPixelFormat; //!< Pixel format number (it follows the list of supported pixel formats)
|
||||
Int m_iPixelFormat; //!< Pixel format number (it follows the list of supported
|
||||
//! pixel formats)
|
||||
Int m_iNumberChannels; //!< Number of channels
|
||||
UInt m_uiBitsPel; //!< Bits per pixel/channel
|
||||
// Int m_iEndianness; //!< Endiannes of bytes
|
||||
@@ -215,7 +222,8 @@ struct PlaYUVerFramePrivate
|
||||
* \brief Constructors
|
||||
*/
|
||||
|
||||
PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pelFormat, Int bitsPixel ) : d( new PlaYUVerFramePrivate )
|
||||
PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pelFormat, Int bitsPixel )
|
||||
: d( new PlaYUVerFramePrivate )
|
||||
{
|
||||
d->init( width, height, pelFormat, bitsPixel );
|
||||
}
|
||||
@@ -238,7 +246,8 @@ PlaYUVerFrame::PlaYUVerFrame( const PlaYUVerFrame* other ) : d( new PlaYUVerFram
|
||||
PlaYUVerFrame::PlaYUVerFrame( const PlaYUVerFrame& other, UInt x, UInt y, UInt width, UInt height )
|
||||
: d( new PlaYUVerFramePrivate )
|
||||
{
|
||||
const PlaYUVerPixFmtDescriptor* pcPelFormat = &( g_PlaYUVerPixFmtDescriptorsList[other.getPelFormat()] );
|
||||
const PlaYUVerPixFmtDescriptor* pcPelFormat =
|
||||
&( g_PlaYUVerPixFmtDescriptorsList[other.getPelFormat()] );
|
||||
if( pcPelFormat->log2ChromaWidth )
|
||||
{
|
||||
if( x % ( 1 << pcPelFormat->log2ChromaWidth ) )
|
||||
@@ -260,13 +269,18 @@ PlaYUVerFrame::PlaYUVerFrame( const PlaYUVerFrame& other, UInt x, UInt y, UInt w
|
||||
copyFrom( other, x, y );
|
||||
}
|
||||
|
||||
PlaYUVerFrame::PlaYUVerFrame( const PlaYUVerFrame* other, UInt posX, UInt posY, UInt areaWidth, UInt areaHeight )
|
||||
PlaYUVerFrame::PlaYUVerFrame( const PlaYUVerFrame* other,
|
||||
UInt posX,
|
||||
UInt posY,
|
||||
UInt areaWidth,
|
||||
UInt areaHeight )
|
||||
: d( new PlaYUVerFramePrivate )
|
||||
{
|
||||
if( !other )
|
||||
return;
|
||||
|
||||
const PlaYUVerPixFmtDescriptor* pcPelFormat = &( g_PlaYUVerPixFmtDescriptorsList[other->getPelFormat()] );
|
||||
const PlaYUVerPixFmtDescriptor* pcPelFormat =
|
||||
&( g_PlaYUVerPixFmtDescriptorsList[other->getPelFormat()] );
|
||||
if( pcPelFormat->log2ChromaWidth )
|
||||
{
|
||||
if( posX % ( 1 << pcPelFormat->log2ChromaWidth ) )
|
||||
@@ -320,7 +334,8 @@ Bool PlaYUVerFrame::haveSameFmt( const PlaYUVerFrame& other, UInt match ) const
|
||||
if( match & MATCH_BITS )
|
||||
bRet &= ( getBitsPel() == other.getBitsPel() );
|
||||
if( match & MATCH_COLOR_SPACE_IGNORE_GRAY )
|
||||
bRet &= ( getColorSpace() == PlaYUVerPixel::COLOR_GRAY || getColorSpace() == other.getColorSpace() );
|
||||
bRet &= ( getColorSpace() == PlaYUVerPixel::COLOR_GRAY ||
|
||||
getColorSpace() == other.getColorSpace() );
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -407,15 +422,18 @@ UInt64 PlaYUVerFrame::getBytesPerFrame()
|
||||
return getBytesPerFrame( d->m_uiWidth, d->m_uiHeight, d->m_iPixelFormat, d->m_uiBitsPel );
|
||||
}
|
||||
|
||||
UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel )
|
||||
UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth,
|
||||
UInt uiHeight,
|
||||
Int iPixelFormat,
|
||||
UInt bitsPixel )
|
||||
{
|
||||
const PlaYUVerPixFmtDescriptor* pcPelFormat = &( g_PlaYUVerPixFmtDescriptorsList[iPixelFormat] );
|
||||
UInt bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1;
|
||||
UInt64 numberBytes = uiWidth * uiHeight;
|
||||
if( pcPelFormat->numberChannels > 1 )
|
||||
{
|
||||
UInt64 numberBytesChroma =
|
||||
CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight );
|
||||
UInt64 numberBytesChroma = CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) *
|
||||
CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight );
|
||||
numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma;
|
||||
}
|
||||
return numberBytes * bytesPerPixel;
|
||||
@@ -432,7 +450,8 @@ Void PlaYUVerFrame::clear()
|
||||
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||
pPel = d->m_pppcInputPel[ch][0];
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW );
|
||||
i++ )
|
||||
{
|
||||
*pPel++ = uiValue;
|
||||
}
|
||||
@@ -480,7 +499,9 @@ PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos )
|
||||
return PixelValue;
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos, PlaYUVerPixel::ColorSpace eColorSpace )
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos,
|
||||
Int yPos,
|
||||
PlaYUVerPixel::ColorSpace eColorSpace )
|
||||
{
|
||||
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace );
|
||||
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
@@ -511,7 +532,8 @@ Void PlaYUVerFrame::copyFrom( const PlaYUVerFrame& other )
|
||||
return;
|
||||
d->m_bHasRGBPel = false;
|
||||
d->m_bHasHistogram = false;
|
||||
memcpy( *d->m_pppcInputPel[LUMA], other.getPelBufferYUV()[LUMA][0], getBytesPerFrame() * sizeof( Pel ) );
|
||||
memcpy( *d->m_pppcInputPel[LUMA], other.getPelBufferYUV()[LUMA][0],
|
||||
getBytesPerFrame() * sizeof( Pel ) );
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::copyFrom( const PlaYUVerFrame* other )
|
||||
@@ -579,7 +601,9 @@ Void PlaYUVerFrame::frameFromBuffer( Byte* Buff, Int iEndianness )
|
||||
{
|
||||
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||
ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
||||
ppBuff[i] =
|
||||
ppBuff[i - 1] +
|
||||
CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
||||
}
|
||||
|
||||
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
@@ -589,16 +613,19 @@ Void PlaYUVerFrame::frameFromBuffer( Byte* Buff, Int iEndianness )
|
||||
step = d->m_pcPelFormat->comp[ch].step_minus1;
|
||||
|
||||
pPel = d->m_pppcInputPel[ch][0];
|
||||
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 );
|
||||
pTmpBuff =
|
||||
ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 );
|
||||
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW );
|
||||
i++ )
|
||||
{
|
||||
*pPel = 0;
|
||||
for( b = startByte; b != endByte; b += incByte )
|
||||
{
|
||||
*pPel += *pTmpBuff << ( b * 8 );
|
||||
pTmpBuff++;
|
||||
// Check max value and bound it to "maxval" to prevent segfault when calculating histogram
|
||||
// Check max value and bound it to "maxval" to prevent segfault when
|
||||
// calculating histogram
|
||||
if( *pPel > maxval )
|
||||
*pPel = 0;
|
||||
// -----
|
||||
@@ -636,7 +663,9 @@ Void PlaYUVerFrame::frameToBuffer( Byte* output_buffer, Int iEndianness )
|
||||
{
|
||||
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||
ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
||||
ppBuff[i] =
|
||||
ppBuff[i - 1] +
|
||||
CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
||||
}
|
||||
|
||||
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
@@ -648,7 +677,8 @@ Void PlaYUVerFrame::frameToBuffer( Byte* output_buffer, Int iEndianness )
|
||||
pTmpPel = d->m_pppcInputPel[ch][0];
|
||||
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane];
|
||||
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
|
||||
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW );
|
||||
i++ )
|
||||
{
|
||||
for( b = startByte; b != endByte; b += incByte )
|
||||
{
|
||||
@@ -810,7 +840,8 @@ Void PlaYUVerFrame::calcHistogram()
|
||||
}
|
||||
if( ( colorSpace == PlaYUVerPixel::COLOR_RGB || colorSpace == PlaYUVerPixel::COLOR_ARGB ) )
|
||||
{
|
||||
PlaYUVerPixel currPixel( colorSpace, *( data[COLOR_R] ), *( data[COLOR_G] ), *( data[COLOR_B] ) );
|
||||
PlaYUVerPixel currPixel( colorSpace, *( data[COLOR_R] ), *( data[COLOR_G] ),
|
||||
*( data[COLOR_B] ) );
|
||||
luma = currPixel.ConvertPixel( PlaYUVerPixel::COLOR_YUV ).Y();
|
||||
d->m_puiHistogram[luma + j * d->m_uiHistoSegments]++;
|
||||
}
|
||||
@@ -858,7 +889,8 @@ Int getRealHistoChannel( Int colorSpace, Int channel )
|
||||
}
|
||||
break;
|
||||
case PlaYUVerPixel::COLOR_ARGB:
|
||||
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A && channel != LUMA )
|
||||
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A &&
|
||||
channel != LUMA )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -1392,7 +1424,8 @@ float compute_ssim( Pel** refImg,
|
||||
|
||||
cur_distortion /= (float)win_cnt;
|
||||
|
||||
if( cur_distortion >= 1.0 && cur_distortion < 1.01 ) // avoid float accuracy problem at very low QP(e.g.2)
|
||||
if( cur_distortion >= 1.0 &&
|
||||
cur_distortion < 1.01 ) // avoid float accuracy problem at very low QP(e.g.2)
|
||||
cur_distortion = 1.0;
|
||||
|
||||
return cur_distortion;
|
||||
@@ -1403,13 +1436,13 @@ Double PlaYUVerFrame::getSSIM( PlaYUVerFrame* Org, Int component )
|
||||
Double dSSIM = 1;
|
||||
if( component == LUMA )
|
||||
{
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component], d->m_uiWidth, d->m_uiHeight,
|
||||
8, 8, 255, 8 );
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component],
|
||||
d->m_uiWidth, d->m_uiHeight, 8, 8, 255, 8 );
|
||||
}
|
||||
else
|
||||
{
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component], getChromaWidth(),
|
||||
getChromaHeight(), 4, 4, 255, 8 );
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component],
|
||||
getChromaWidth(), getChromaHeight(), 4, 4, 255, 8 );
|
||||
}
|
||||
return dSSIM;
|
||||
}
|
||||
+111
-111
@@ -22,13 +22,13 @@
|
||||
* \brief Handling the pixel formats definition
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "PlaYUVerFramePixelFormats.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_SSE
|
||||
#include <emmintrin.h>
|
||||
#include <smmintrin.h>
|
||||
#include <limits.h>
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
#include "LibMemory.h"
|
||||
@@ -199,112 +199,112 @@ Void fillARGB32bufferYUV420p( Pel*** in, UChar* out, UInt width, UInt height, UI
|
||||
}
|
||||
#endif
|
||||
|
||||
const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NUMBER_PEL_FORMATS] = {
|
||||
{
|
||||
"YUV420p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUV422p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUV444p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUYV422",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ),
|
||||
{
|
||||
{0, 1, 1}, /* Y */
|
||||
{0, 3, 2}, /* U */
|
||||
{0, 3, 4}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"GRAY",
|
||||
PlaYUVerPixel::COLOR_GRAY,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ),
|
||||
{{0, 0, 1}}, /* Y */
|
||||
},
|
||||
{
|
||||
"RGBp",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
|
||||
{
|
||||
{0, 0, 1}, /* R */
|
||||
{1, 0, 1}, /* G */
|
||||
{2, 0, 1}, /* B */
|
||||
},
|
||||
},
|
||||
{
|
||||
"RGB",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
|
||||
{
|
||||
{0, 2, 1}, /* R */
|
||||
{0, 2, 2}, /* G */
|
||||
{0, 2, 3}, /* B */
|
||||
},
|
||||
},
|
||||
{
|
||||
"BGR",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
|
||||
{
|
||||
{0, 2, 3}, /* B */
|
||||
{0, 2, 2}, /* R */
|
||||
{0, 2, 1}, /* G */
|
||||
},
|
||||
}};
|
||||
const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NUMBER_PEL_FORMATS] =
|
||||
{{
|
||||
"YUV420p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUV422p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUV444p",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ),
|
||||
{
|
||||
{0, 0, 1}, /* Y */
|
||||
{1, 0, 1}, /* U */
|
||||
{2, 0, 1}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"YUYV422",
|
||||
PlaYUVerPixel::COLOR_YUV,
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ),
|
||||
{
|
||||
{0, 1, 1}, /* Y */
|
||||
{0, 3, 2}, /* U */
|
||||
{0, 3, 4}, /* V */
|
||||
},
|
||||
},
|
||||
{
|
||||
"GRAY",
|
||||
PlaYUVerPixel::COLOR_GRAY,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ),
|
||||
{{0, 0, 1}}, /* Y */
|
||||
},
|
||||
{
|
||||
"RGBp",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
|
||||
{
|
||||
{0, 0, 1}, /* R */
|
||||
{1, 0, 1}, /* G */
|
||||
{2, 0, 1}, /* B */
|
||||
},
|
||||
},
|
||||
{
|
||||
"RGB",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
|
||||
{
|
||||
{0, 2, 1}, /* R */
|
||||
{0, 2, 2}, /* G */
|
||||
{0, 2, 3}, /* B */
|
||||
},
|
||||
},
|
||||
{
|
||||
"BGR",
|
||||
PlaYUVerPixel::COLOR_RGB,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
|
||||
{
|
||||
{0, 2, 3}, /* B */
|
||||
{0, 2, 2}, /* R */
|
||||
{0, 2, 1}, /* G */
|
||||
},
|
||||
}};
|
||||
@@ -26,14 +26,15 @@
|
||||
#define __PLAYUVERFRAMEPIXELFORMATS_H__
|
||||
|
||||
#include "PlaYUVerDefs.h"
|
||||
#include "PlaYUVerPixel.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerPixel.h"
|
||||
|
||||
#define CHROMA_RESAMPLING( X ) ( ( ( X + 1 ) >> 1 ) << 1 )
|
||||
|
||||
#define CHROMARATIO( SIZE, RATIO ) ( RATIO > 1 ? ( ( SIZE + 1 ) / RATIO ) : SIZE )
|
||||
|
||||
#define PEL_RGB( r, g, b ) ( 0xffu << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
|
||||
#define PEL_RGB( r, g, b ) \
|
||||
( 0xffu << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
|
||||
|
||||
typedef struct PlaYUVerComponentDescriptor
|
||||
{
|
||||
|
||||
+32
-14
@@ -36,11 +36,11 @@
|
||||
* \brief Options handler
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "PlaYUVerOptions.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
#include "lib/PlaYUVerModuleIf.h"
|
||||
#include "modules/PlaYUVerModuleFactory.h"
|
||||
@@ -60,7 +60,10 @@ struct ParseFailure : public std::exception
|
||||
class BoolOption : public OptionBase
|
||||
{
|
||||
public:
|
||||
BoolOption( const String& name, const String& desc ) : OptionBase( name, desc ) { is_binary = true; }
|
||||
BoolOption( const String& name, const String& desc ) : OptionBase( name, desc )
|
||||
{
|
||||
is_binary = true;
|
||||
}
|
||||
void parse( const String& arg ) { arg_count++; }
|
||||
};
|
||||
|
||||
@@ -101,7 +104,7 @@ inline void StandardOption<T>::parse( const String& arg )
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void StandardOption<std::vector<UInt> >::parse( const String& arg )
|
||||
inline void StandardOption<std::vector<UInt>>::parse( const String& arg )
|
||||
{
|
||||
UInt aux_opt_storage;
|
||||
std::istringstream arg_ss( arg, std::istringstream::in );
|
||||
@@ -119,7 +122,7 @@ inline void StandardOption<std::vector<UInt> >::parse( const String& arg )
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void StandardOption<std::vector<Int> >::parse( const String& arg )
|
||||
inline void StandardOption<std::vector<Int>>::parse( const String& arg )
|
||||
{
|
||||
Int aux_opt_storage;
|
||||
std::istringstream arg_ss( arg, std::istringstream::in );
|
||||
@@ -146,7 +149,7 @@ inline void StandardOption<String>::parse( const String& arg )
|
||||
|
||||
/* string vector parsing is specialized */
|
||||
template <>
|
||||
inline void StandardOption<std::vector<String> >::parse( const String& arg )
|
||||
inline void StandardOption<std::vector<String>>::parse( const String& arg )
|
||||
{
|
||||
opt_storage.push_back( arg );
|
||||
arg_count++;
|
||||
@@ -201,11 +204,21 @@ PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, T& storage, co
|
||||
return *this;
|
||||
}
|
||||
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, Bool& storage, const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, UInt& storage, const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, Int& storage, const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, Int64& storage, const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, String& storage, const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
Bool& storage,
|
||||
const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
UInt& storage,
|
||||
const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
Int& storage,
|
||||
const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
Int64& storage,
|
||||
const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
String& storage,
|
||||
const String& desc );
|
||||
template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
std::vector<UInt>& storage,
|
||||
const String& desc );
|
||||
@@ -223,7 +236,8 @@ template PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
* FunctionOption::Func is called. It is upto this function to correctly
|
||||
* handle evaluating the option's value.
|
||||
*/
|
||||
// PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name, FunctionOption::Func *func, const String& desc )
|
||||
// PlaYUVerOptions& PlaYUVerOptions::operator()( const String& name,
|
||||
// FunctionOption::Func *func, const String& desc )
|
||||
// {
|
||||
// addOption( new FunctionOption( name, parent, func, desc ) );
|
||||
// return *this;
|
||||
@@ -335,7 +349,10 @@ static void setOptions( PlaYUVerOptions::OptionsList& opt_list, const string& va
|
||||
}
|
||||
}
|
||||
|
||||
Bool PlaYUVerOptions::storePair( Bool allow_long, Bool allow_short, const string& name, const string& value )
|
||||
Bool PlaYUVerOptions::storePair( Bool allow_long,
|
||||
Bool allow_short,
|
||||
const string& name,
|
||||
const string& value )
|
||||
{
|
||||
bool found = false;
|
||||
PlaYUVerOptions::OptionMap::iterator opt_it;
|
||||
@@ -646,7 +663,8 @@ Void PlaYUVerOptions::doHelp( ostream& out, UInt columns )
|
||||
line << opt_desc.substr( cur_pos );
|
||||
break;
|
||||
}
|
||||
/* find a suitable point to split text (avoid spliting in middle of word) */
|
||||
/* find a suitable point to split text (avoid spliting in middle of word)
|
||||
*/
|
||||
size_t split_pos = opt_desc.find_last_of( ' ', cur_pos + desc_width );
|
||||
if( split_pos != string::npos )
|
||||
{
|
||||
|
||||
@@ -51,7 +51,10 @@
|
||||
class OptionBase
|
||||
{
|
||||
public:
|
||||
OptionBase( const String& name, const String& desc ) : arg_count( 0 ), opt_string( name ), opt_desc( desc ) {}
|
||||
OptionBase( const String& name, const String& desc )
|
||||
: arg_count( 0 ), opt_string( name ), opt_desc( desc )
|
||||
{
|
||||
}
|
||||
virtual ~OptionBase() {}
|
||||
/* parse argument arg, to obtain a value for the option */
|
||||
virtual void parse( const String& arg ) = 0;
|
||||
@@ -125,7 +128,8 @@ class PlaYUVerOptions
|
||||
* handle evaluating the option's value.
|
||||
*/
|
||||
// PlaYUVerOptions&
|
||||
// operator()( const String& name, OptionFunc::Func *func, const String& desc );
|
||||
// operator()( const String& name, OptionFunc::Func *func, const String&
|
||||
// desc );
|
||||
|
||||
Bool checkListingOpts();
|
||||
Void listModules();
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* \brief Pixel handling
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerPixel.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
PlaYUVerPixel::PlaYUVerPixel() : m_iColorSpace( COLOR_INVALID )
|
||||
{
|
||||
|
||||
+16
-6
@@ -25,13 +25,18 @@
|
||||
#ifndef __PLAYUVERPIXEL_H__
|
||||
#define __PLAYUVERPIXEL_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include "PlaYUVerDefs.h"
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
static inline Void YuvToRgb( const Int& iY, const Int& iU, const Int& iV, Int& iR, Int& iG, Int& iB )
|
||||
static inline Void YuvToRgb( const Int& iY,
|
||||
const Int& iU,
|
||||
const Int& iV,
|
||||
Int& iR,
|
||||
Int& iG,
|
||||
Int& iB )
|
||||
{
|
||||
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 );
|
||||
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 );
|
||||
@@ -41,7 +46,12 @@ static inline Void YuvToRgb( const Int& iY, const Int& iU, const Int& iV, Int& i
|
||||
iB = iB < 0 ? 0 : iB > 255 ? 255 : iB;
|
||||
}
|
||||
|
||||
static inline Void rgbToYuv( const Int& iR, const Int& iG, const Int& iB, Int& iY, Int& iU, Int& iV )
|
||||
static inline Void rgbToYuv( const Int& iR,
|
||||
const Int& iG,
|
||||
const Int& iB,
|
||||
Int& iY,
|
||||
Int& iU,
|
||||
Int& iV )
|
||||
{
|
||||
iY = ( 299 * iR + 587 * iG + 114 * iB + 500 ) / 1000;
|
||||
iU = ( 1000 * ( iB - iY ) + 226816 ) / 1772;
|
||||
|
||||
+20
-13
@@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
// Self
|
||||
#include "config.h"
|
||||
#include "PlaYUVerStream.h"
|
||||
#include "config.h"
|
||||
|
||||
// System
|
||||
#include <cstdio>
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "LibMemory.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerStreamHandlerIf.h"
|
||||
#include "StreamHandlerRaw.h"
|
||||
#include "StreamHandlerPortableMap.h"
|
||||
#include "StreamHandlerRaw.h"
|
||||
#ifdef USE_FFMPEG
|
||||
#include "StreamHandlerLibav.h"
|
||||
#endif
|
||||
@@ -120,7 +120,8 @@ CreateStreamHandlerFn PlaYUVerStream::findStreamHandler( String strFilename, boo
|
||||
{
|
||||
return supportedFmts[i].formatFct;
|
||||
}
|
||||
// else if( strFilename.find( supportedFmts[i].formatExt ) != String::npos )
|
||||
// else if( strFilename.find( supportedFmts[i].formatExt ) !=
|
||||
// String::npos )
|
||||
// {
|
||||
// return supportedFmts[i].formatFct;
|
||||
// }
|
||||
@@ -182,7 +183,8 @@ Bool PlaYUVerStream::open( String filename,
|
||||
}
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
{
|
||||
if( lowercase( PlaYUVerFrame::supportedPixelFormatListNames()[i] ) == lowercase( input_format_name ) )
|
||||
if( lowercase( PlaYUVerFrame::supportedPixelFormatListNames()[i] ) ==
|
||||
lowercase( input_format_name ) )
|
||||
{
|
||||
input_format = i;
|
||||
break;
|
||||
@@ -237,7 +239,8 @@ Bool PlaYUVerStream::open( String filename,
|
||||
return m_bInit;
|
||||
}
|
||||
|
||||
if( m_pcHandler->m_uiWidth <= 0 || m_pcHandler->m_uiHeight <= 0 || m_pcHandler->m_iPixelFormat < 0 )
|
||||
if( m_pcHandler->m_uiWidth <= 0 || m_pcHandler->m_uiHeight <= 0 ||
|
||||
m_pcHandler->m_iPixelFormat < 0 )
|
||||
{
|
||||
close();
|
||||
throw PlaYUVerFailure( "PlaYUVerStream", "Incorrect configuration" );
|
||||
@@ -251,8 +254,9 @@ Bool PlaYUVerStream::open( String filename,
|
||||
{
|
||||
try
|
||||
{
|
||||
m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_pcHandler->m_uiWidth, m_pcHandler->m_uiHeight,
|
||||
m_pcHandler->m_iPixelFormat, m_pcHandler->m_uiBitsPerPixel );
|
||||
m_ppcFrameBuffer[i] =
|
||||
new PlaYUVerFrame( m_pcHandler->m_uiWidth, m_pcHandler->m_uiHeight,
|
||||
m_pcHandler->m_iPixelFormat, m_pcHandler->m_uiBitsPerPixel );
|
||||
}
|
||||
catch( PlaYUVerFailure& e )
|
||||
{
|
||||
@@ -304,8 +308,9 @@ Bool PlaYUVerStream::reload()
|
||||
m_pcHandler->setBytesPerFrame( m_pcCurrFrame->getBytesPerFrame() );
|
||||
m_uiTotalFrameNum = m_pcHandler->calculateFrameNumber();
|
||||
|
||||
if( m_pcHandler->m_uiWidth <= 0 || m_pcHandler->m_uiHeight <= 0 || m_pcHandler->m_iPixelFormat < 0 ||
|
||||
m_pcHandler->m_uiBitsPerPixel == 0 || m_uiTotalFrameNum < 1 )
|
||||
if( m_pcHandler->m_uiWidth <= 0 || m_pcHandler->m_uiHeight <= 0 ||
|
||||
m_pcHandler->m_iPixelFormat < 0 || m_pcHandler->m_uiBitsPerPixel == 0 ||
|
||||
m_uiTotalFrameNum < 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -421,8 +426,9 @@ Void PlaYUVerStream::loadAll()
|
||||
getMem1D<PlaYUVerFrame*>( &m_ppcFrameBuffer, m_uiFrameBufferSize );
|
||||
for( UInt i = 0; i < m_uiFrameBufferSize; i++ )
|
||||
{
|
||||
m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_pcHandler->m_uiWidth, m_pcHandler->m_uiHeight,
|
||||
m_pcHandler->m_iPixelFormat, m_pcHandler->m_uiBitsPerPixel );
|
||||
m_ppcFrameBuffer[i] =
|
||||
new PlaYUVerFrame( m_pcHandler->m_uiWidth, m_pcHandler->m_uiHeight,
|
||||
m_pcHandler->m_iPixelFormat, m_pcHandler->m_uiBitsPerPixel );
|
||||
if( !m_ppcFrameBuffer[i] )
|
||||
{
|
||||
close();
|
||||
@@ -518,8 +524,9 @@ Bool PlaYUVerStream::saveFrame( const String& filename )
|
||||
Bool PlaYUVerStream::saveFrame( const String& filename, PlaYUVerFrame* saveFrame )
|
||||
{
|
||||
PlaYUVerStream auxSaveStream;
|
||||
if( !auxSaveStream.open( filename, saveFrame->getWidth(), saveFrame->getHeight(), saveFrame->getPelFormat(),
|
||||
saveFrame->getBitsPel(), PLAYUVER_LITTLE_ENDIAN, 1, false ) )
|
||||
if( !auxSaveStream.open( filename, saveFrame->getWidth(), saveFrame->getHeight(),
|
||||
saveFrame->getPelFormat(), saveFrame->getBitsPel(),
|
||||
PLAYUVER_LITTLE_ENDIAN, 1, false ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,17 +22,18 @@
|
||||
* \brief Interface with libav libs
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include "StreamHandlerLibav.h"
|
||||
#include "LibMemory.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerFramePixelFormats.h"
|
||||
#include "LibMemory.h"
|
||||
#include <cstdio>
|
||||
|
||||
std::vector<PlaYUVerSupportedFormat> StreamHandlerLibav::supportedReadFormats()
|
||||
{
|
||||
INI_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Portable Network Graphics", "png" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Joint Photographic Experts Group", "jpg" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Joint Photographic Experts Group",
|
||||
"jpg" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Windows Bitmap", "bmp" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Tagged Image File Format", "tiff" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Audio video interleaved", "avi" );
|
||||
@@ -77,10 +78,12 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
|
||||
// av_dict_set( &format_opts, "video_size", aux_string, 0 );
|
||||
// }
|
||||
|
||||
// Int ffmpeg_pel_format = g_PlaYUVerPixFmtDescriptorsList[pixel_format].ffmpegPelFormat;
|
||||
// Int ffmpeg_pel_format =
|
||||
// g_PlaYUVerPixFmtDescriptorsList[pixel_format].ffmpegPelFormat;
|
||||
// if( ffmpeg_pel_format >= 0 )
|
||||
// {
|
||||
// av_dict_set( &format_opts, "pixel_format", av_get_pix_fmt_name( AVPixelFormat( ffmpeg_pel_format ) ), 0 );
|
||||
// av_dict_set( &format_opts, "pixel_format", av_get_pix_fmt_name(
|
||||
// AVPixelFormat( ffmpeg_pel_format ) ), 0 );
|
||||
// }
|
||||
|
||||
/* open input file, and allocate format context */
|
||||
@@ -200,7 +203,8 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
|
||||
av_dump_format( m_cFmtCtx, 0, filename, 0 );
|
||||
if( !m_cStream )
|
||||
{
|
||||
// qDebug( ) << " Could not find audio or video stream in the input, aborting !!!" << endl;
|
||||
// qDebug( ) << " Could not find audio or video stream in the input,
|
||||
// aborting !!!" << endl;
|
||||
closeHandler();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#define __LIBAVCONTEXTHANDLE_H__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef __PRI64_PREFIX
|
||||
#define __PRI64_PREFIX "l"
|
||||
@@ -38,10 +38,10 @@
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libavutil/samplefmt.h>
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#include "PlaYUVerDefs.h"
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
// Own
|
||||
#include "LibMemory.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerFramePixelFormats.h"
|
||||
#include "LibMemory.h"
|
||||
|
||||
using cv::Mat;
|
||||
using cv::VideoCapture;
|
||||
@@ -40,7 +40,8 @@ using cv::VideoCapture;
|
||||
std::vector<PlaYUVerSupportedFormat> StreamHandlerOpenCV::supportedReadFormats()
|
||||
{
|
||||
INI_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Device", "/dev/" );
|
||||
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Device",
|
||||
// "/dev/" );
|
||||
END_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
}
|
||||
|
||||
@@ -49,7 +50,8 @@ std::vector<PlaYUVerSupportedFormat> StreamHandlerOpenCV::supportedWriteFormats(
|
||||
INI_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable PixMap ", "ppm" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable Network Graphics", "png" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Joint Photographic Experts Group", "jpg" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Joint Photographic Experts Group",
|
||||
"jpg" );
|
||||
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap", "bmp" );
|
||||
END_REGIST_PLAYUVER_SUPPORTED_FMT;
|
||||
}
|
||||
@@ -78,7 +80,8 @@ Bool StreamHandlerOpenCV::openHandler( String strFilename, Bool bInput )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_strCodecName = m_strFormatName = uppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) );
|
||||
m_strCodecName = m_strFormatName =
|
||||
uppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) );
|
||||
Mat cvMat = cv::imread( m_cFilename );
|
||||
m_uiWidth = cvMat.cols;
|
||||
m_uiHeight = cvMat.rows;
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
* \brief Handling portable pixmap formats
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include "StreamHandlerPortableMap.h"
|
||||
#include "LibMemory.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerFramePixelFormats.h"
|
||||
#include "LibMemory.h"
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
Bool StreamHandlerPortableMap::openHandler( String strFilename, Bool bInput )
|
||||
{
|
||||
@@ -62,7 +62,8 @@ Bool StreamHandlerPortableMap::openHandler( String strFilename, Bool bInput )
|
||||
;
|
||||
sscanf( line, "%d", &m_iMaxValue );
|
||||
m_uiBitsPerPixel = log( m_iMaxValue + 1 ) / log( 2 );
|
||||
m_iPixelFormat = m_iMagicNumber == 2 || m_iMagicNumber == 5 ? PlaYUVerFrame::GRAY : PlaYUVerFrame::RGB24;
|
||||
m_iPixelFormat =
|
||||
m_iMagicNumber == 2 || m_iMagicNumber == 5 ? PlaYUVerFrame::GRAY : PlaYUVerFrame::RGB24;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user