Merge branch 'master' into zoom-devel
This commit is contained in:
commit
ccc4d5585c
9 files changed
+79
-61
No files matched your search
@@ -1,9 +0,0 @@
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
before_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release -DUSE_QT4=OFF -DUSE_FFMPEG=ON ..
|
||||
script: make
|
||||
@@ -32,6 +32,7 @@ Install using cmake
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../
|
||||
cmake -DUSE_FFMPEG=ON .. (for FFmpeg support)
|
||||
make
|
||||
make install
|
||||
```
|
||||
@@ -134,8 +134,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
|
||||
if( QFileInfo( filename ).completeSuffix().compare( QString( "yuv" ) ) )
|
||||
{
|
||||
avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
||||
m_cFormatName = QString::fromUtf8( m_cLibAvContext.getCodecName() );
|
||||
|
||||
m_cFormatName = QFileInfo( filename ).completeSuffix().toUpper();
|
||||
m_cCodedName = QString::fromUtf8( m_cLibAvContext.getCodecName() ).toUpper();
|
||||
m_uiTotalFrameNum = 100;
|
||||
}
|
||||
#endif
|
||||
@@ -173,7 +173,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
|
||||
fseek( m_pFile, 0, SEEK_END );
|
||||
m_uiTotalFrameNum = ftell( m_pFile ) / ( frame_bytes_input );
|
||||
fseek( m_pFile, 0, SEEK_SET );
|
||||
m_cFormatName = QString::fromUtf8( "Raw Video" );
|
||||
m_cFormatName = QString::fromUtf8( "YUV" );
|
||||
m_cCodedName = QString::fromUtf8( "Raw Video" );
|
||||
}
|
||||
if( !getMem1D<Pel>( &m_pInputBuffer, m_pcCurrFrame->getBytesPerFrame() ) )
|
||||
{
|
||||
@@ -184,6 +185,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
|
||||
m_cStreamInformationString = QString( "[" );
|
||||
m_cStreamInformationString.append( m_cFormatName );
|
||||
m_cStreamInformationString.append( QString( " / " ) );
|
||||
m_cStreamInformationString.append( m_cCodedName );
|
||||
m_cStreamInformationString.append( QString( " / " ) );
|
||||
m_cStreamInformationString.append( PlaYUVerFrame::supportedPixelFormatList().at( m_iPixelFormat ) );
|
||||
m_cStreamInformationString.append( "] " );
|
||||
m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() );
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
|
||||
QString m_cFilename;
|
||||
QString m_cFormatName;
|
||||
QString m_cCodedName;
|
||||
QString m_cStreamInformationString;
|
||||
|
||||
QTime m_cTimer;
|
||||
@@ -142,6 +143,10 @@ public:
|
||||
{
|
||||
return m_cFormatName;
|
||||
}
|
||||
QString getCodecName()
|
||||
{
|
||||
return m_cCodedName;
|
||||
}
|
||||
UInt getFrameNum()
|
||||
{
|
||||
return m_uiTotalFrameNum;
|
||||
|
||||
@@ -53,6 +53,11 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) :
|
||||
labelFormatValue = new QLabel;
|
||||
labelFormatValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel *codecLabel = new QLabel( tr( "Codec:" ) );
|
||||
codecLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelCodecValue = new QLabel;
|
||||
labelCodecValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel *sizeLabel = new QLabel( tr( "Size (pixels):" ) );
|
||||
sizeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelSizeValue = new QLabel;
|
||||
@@ -64,12 +69,18 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) :
|
||||
labelColorSpaceValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QGridLayout *propertiesLayout = new QGridLayout;
|
||||
propertiesLayout->addWidget( formatLabel, 0, 0 );
|
||||
propertiesLayout->addWidget( labelFormatValue, 0, 1 );
|
||||
propertiesLayout->addWidget( sizeLabel, 1, 0 );
|
||||
propertiesLayout->addWidget( labelSizeValue, 1, 1 );
|
||||
propertiesLayout->addWidget( colorSpaceLabel, 2, 0 );
|
||||
propertiesLayout->addWidget( labelColorSpaceValue, 2, 1 );
|
||||
Int layout_line = 0;
|
||||
propertiesLayout->addWidget( formatLabel, layout_line, 0 );
|
||||
propertiesLayout->addWidget( labelFormatValue, layout_line, 1 );
|
||||
layout_line++;
|
||||
propertiesLayout->addWidget( codecLabel, layout_line, 0 );
|
||||
propertiesLayout->addWidget( labelCodecValue, layout_line, 1 );
|
||||
layout_line++;
|
||||
propertiesLayout->addWidget( sizeLabel, layout_line, 0 );
|
||||
propertiesLayout->addWidget( labelSizeValue, layout_line, 1 );
|
||||
layout_line++;
|
||||
propertiesLayout->addWidget( colorSpaceLabel, layout_line, 0 );
|
||||
propertiesLayout->addWidget( labelColorSpaceValue, layout_line, 1 );
|
||||
|
||||
QGroupBox *propertiesGroup = new QGroupBox( tr( "Properties" ) );
|
||||
propertiesGroup->setLayout( propertiesLayout );
|
||||
@@ -110,6 +121,7 @@ Void StreamPropertiesSideBar::setData( InputStream* pcStream )
|
||||
|
||||
QString value;
|
||||
labelFormatValue->setText( m_pcStream->getFormatName() );
|
||||
labelCodecValue->setText( m_pcStream->getCodecName() );
|
||||
uint width = m_pcStream->getWidth();
|
||||
uint height = m_pcStream->getHeight();
|
||||
value = QString( tr( "%1 x %2" ) ).arg( width ).arg( height );
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
InputStream* m_pcStream;
|
||||
|
||||
QLabel* labelFormatValue;
|
||||
QLabel* labelCodecValue;
|
||||
QLabel* labelSizeValue;
|
||||
QLabel* labelColorSpaceValue;
|
||||
};
|
||||
|
||||
@@ -48,11 +48,9 @@ PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format )
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 );
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 2 );
|
||||
break;
|
||||
case YUV410p:
|
||||
case YUV411p:
|
||||
break;
|
||||
case GRAY:
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 4, 4 );
|
||||
break;
|
||||
@@ -110,11 +108,9 @@ inline Void PlaYUVerFrame::FrametoRGB8Pixfc()
|
||||
case YUV422p:
|
||||
break;
|
||||
case YUV444p:
|
||||
case YUYV422:
|
||||
m_pcPixfc->convert(m_pcPixfc, m_pppcInputPel, m_pcRGBPelInterlaced);
|
||||
break;
|
||||
case YUV410p:
|
||||
case YUV411p:
|
||||
break;
|
||||
case GRAY:
|
||||
break;
|
||||
case RGB8:
|
||||
@@ -243,6 +239,7 @@ Void PlaYUVerFrame::FrametoRGB8()
|
||||
}
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
for( UInt y = 0; y < m_uiHeight; y += 1 )
|
||||
for( UInt x = 0; x < m_uiWidth; x += 2 )
|
||||
{
|
||||
@@ -275,9 +272,6 @@ Void PlaYUVerFrame::FrametoRGB8()
|
||||
*pcRGBPelInterlaced++ = iB;
|
||||
}
|
||||
break;
|
||||
case YUV410p:
|
||||
case YUV411p:
|
||||
break;
|
||||
case GRAY:
|
||||
for( UInt y = 0; y < m_uiHeight; y++ )
|
||||
for( UInt x = 0; x < m_uiWidth; x++ )
|
||||
@@ -302,11 +296,20 @@ Void PlaYUVerFrame::FrametoRGB8()
|
||||
|
||||
Void PlaYUVerFrame::FrameFromBuffer( Pel *input_buffer, Int pel_format )
|
||||
{
|
||||
Pel* pcRGBPelInterlaced = m_pcRGBPelInterlaced;
|
||||
if( m_iPixelFormat != pel_format )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pel* pcRGBPelInterlaced = m_pcRGBPelInterlaced;
|
||||
Pel* pInputPelY = m_pppcInputPel[LUMA][0];
|
||||
|
||||
Pel *pInputPelU = NULL, *pInputPelV = NULL;
|
||||
if( m_pppcInputPel[CHROMA_U] )
|
||||
{
|
||||
pInputPelU = m_pppcInputPel[CHROMA_U][0];
|
||||
pInputPelV = m_pppcInputPel[CHROMA_V][0];
|
||||
}
|
||||
|
||||
m_bHasRGBPel = false;
|
||||
UInt64 frame_bytes_input = m_uiWidth * m_uiHeight;
|
||||
switch( m_iPixelFormat )
|
||||
@@ -326,21 +329,26 @@ Void PlaYUVerFrame::FrameFromBuffer( Pel *input_buffer, Int pel_format )
|
||||
memcpy( &m_pppcInputPel[CHROMA_U][0][0], input_buffer + frame_bytes_input * 1, frame_bytes_input / 2 * sizeof(Pel) );
|
||||
memcpy( &m_pppcInputPel[CHROMA_V][0][0], input_buffer + frame_bytes_input * 3 / 2, frame_bytes_input / 2 * sizeof(Pel) );
|
||||
break;
|
||||
case YUV410p:
|
||||
case YUV411p:
|
||||
case YUYV422:
|
||||
for( UInt i = 0; i < m_uiHeight * m_uiWidth/2; i++ )
|
||||
{
|
||||
*pInputPelY++ = *input_buffer++;
|
||||
*pInputPelU++ = *input_buffer++;
|
||||
*pInputPelY++ = *input_buffer++;
|
||||
*pInputPelV++ = *input_buffer++;
|
||||
}
|
||||
break;
|
||||
case GRAY:
|
||||
memcpy( &m_pppcInputPel[LUMA][0][0], input_buffer + frame_bytes_input * 0, frame_bytes_input * sizeof(Pel) );
|
||||
break;
|
||||
case RGB8:
|
||||
memcpy( pcRGBPelInterlaced, input_buffer, frame_bytes_input * sizeof(Pel) * 3 );
|
||||
for( UInt y = 0; y < m_uiHeight; y++ )
|
||||
for( UInt x = 0; x < m_uiWidth; x++ )
|
||||
{
|
||||
m_pppcInputPel[COLOR_R][y][x] = *pcRGBPelInterlaced++;
|
||||
m_pppcInputPel[COLOR_G][y][x] = *pcRGBPelInterlaced++;
|
||||
m_pppcInputPel[COLOR_B][y][x] = *pcRGBPelInterlaced++;
|
||||
}
|
||||
for( UInt i = 0; i < m_uiHeight * m_uiWidth; i++ )
|
||||
{
|
||||
*pInputPelY++ = *pcRGBPelInterlaced++;
|
||||
*pInputPelU++ = *pcRGBPelInterlaced++;
|
||||
*pInputPelV++ = *pcRGBPelInterlaced++;
|
||||
}
|
||||
m_bHasRGBPel = true;
|
||||
break;
|
||||
}
|
||||
@@ -367,11 +375,10 @@ Void PlaYUVerFrame::CopyFrom( PlaYUVerFrame* input_frame )
|
||||
memcpy( &m_pppcInputPel[CHROMA_V][0][0], &( input_frame->getPelBufferYUV()[CHROMA_V][0][0] ), num_bytes * sizeof(Pel) );
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
memcpy( &m_pppcInputPel[LUMA][0][0], &( input_frame->getPelBufferYUV()[LUMA][0][0] ), num_bytes * sizeof(Pel) );
|
||||
memcpy( &m_pppcInputPel[CHROMA_U][0][0], &( input_frame->getPelBufferYUV()[CHROMA_U][0][0] ), num_bytes / 2 * sizeof(Pel) );
|
||||
memcpy( &m_pppcInputPel[CHROMA_V][0][0], &( input_frame->getPelBufferYUV()[CHROMA_V][0][0] ), num_bytes / 2 * sizeof(Pel) );
|
||||
case YUV410p:
|
||||
case YUV411p:
|
||||
break;
|
||||
case GRAY:
|
||||
memcpy( &m_pppcInputPel[LUMA][0][0], &( input_frame->getPelBufferYUV()[LUMA][0][0] ), num_bytes * sizeof(Pel) );
|
||||
@@ -396,11 +403,9 @@ UInt64 PlaYUVerFrame::getBytesPerFrame()
|
||||
return m_uiWidth * m_uiHeight * 3;
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
return m_uiWidth * m_uiHeight * 2;
|
||||
break;
|
||||
case YUV410p:
|
||||
return m_uiWidth * m_uiHeight * 1.25;
|
||||
break;
|
||||
case GRAY:
|
||||
return m_uiWidth * m_uiHeight;
|
||||
break;
|
||||
@@ -453,17 +458,12 @@ Pixel PlaYUVerFrame::getPixelValue( const QPoint &pos, ColorSpace space )
|
||||
pixel_value.ChromaV = m_pppcInputPel[CHROMA_V][pos.y()][pos.x()];
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
pixel_value.color_space = COLOR_YUV;
|
||||
pixel_value.Luma = m_pppcInputPel[LUMA][pos.y()][pos.x()];
|
||||
pixel_value.ChromaU = m_pppcInputPel[CHROMA_U][pos.y()][pos.x() >> 1];
|
||||
pixel_value.ChromaV = m_pppcInputPel[CHROMA_V][pos.y()][pos.x() >> 1];
|
||||
break;
|
||||
case YUV410p:
|
||||
pixel_value.color_space = COLOR_YUV;
|
||||
pixel_value.Luma = m_pppcInputPel[LUMA][pos.y()][pos.x()];
|
||||
pixel_value.ChromaU = m_pppcInputPel[CHROMA_U][pos.y() >> 2][pos.x() >> 2];
|
||||
pixel_value.ChromaV = m_pppcInputPel[CHROMA_V][pos.y() >> 2][pos.x() >> 2];
|
||||
break;
|
||||
case GRAY:
|
||||
pixel_value.color_space = COLOR_YUV;
|
||||
pixel_value.Luma = m_pppcInputPel[LUMA][pos.y()][pos.x()];
|
||||
|
||||
@@ -63,8 +63,7 @@ public:
|
||||
YUV420p = 0,
|
||||
YUV444p,
|
||||
YUV422p,
|
||||
YUV411p,
|
||||
YUV410p,
|
||||
YUYV422,
|
||||
GRAY,
|
||||
RGB8,
|
||||
NUMBER_FORMATS
|
||||
@@ -75,9 +74,8 @@ public:
|
||||
QStringList formats;
|
||||
formats << "YUV420p"
|
||||
<< "YUV444p"
|
||||
<< "YUV411p"
|
||||
<< "YUV411p"
|
||||
<< "YUV410p"
|
||||
<< "YUV422p"
|
||||
<< "YUYV422"
|
||||
<< "GRAY"
|
||||
<< "RGB8" // RGB 3*8 bits per pixel
|
||||
;
|
||||
|
||||
@@ -178,9 +178,18 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
pixel_format = PlaYUVerFrame::YUV420p;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P:
|
||||
pixel_format = PlaYUVerFrame::YUV422p;
|
||||
break;
|
||||
case AV_PIX_FMT_YUYV422:
|
||||
pixel_format = PlaYUVerFrame::YUYV422;
|
||||
break;
|
||||
case AV_PIX_FMT_GRAY8:
|
||||
pixel_format = PlaYUVerFrame::GRAY;
|
||||
break;
|
||||
case AV_PIX_FMT_RGB24:
|
||||
pixel_format = PlaYUVerFrame::RGB8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -220,10 +229,8 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
|
||||
Bool LibAvContextHandle::decodeAvFormat()
|
||||
{
|
||||
Int got_frame;
|
||||
Bool bRet = false;
|
||||
/* read frames from the file */
|
||||
|
||||
while( av_read_frame( fmt_ctx, &pkt ) >= 0 && !bRet )
|
||||
while( av_read_frame( fmt_ctx, &pkt ) >= 0 )
|
||||
{
|
||||
if( pkt.stream_index == video_stream_idx )
|
||||
{
|
||||
@@ -232,7 +239,7 @@ Bool LibAvContextHandle::decodeAvFormat()
|
||||
if( ret < 0 )
|
||||
{
|
||||
fprintf( stderr, "Error decoding video frame\n" );
|
||||
return bRet;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( got_frame )
|
||||
@@ -241,13 +248,13 @@ Bool LibAvContextHandle::decodeAvFormat()
|
||||
* this is required since rawvideo expects non aligned data */
|
||||
av_image_copy( video_dst_data, video_dst_linesize, ( const uint8_t ** )( frame->data ), frame->linesize, video_dec_ctx->pix_fmt, video_dec_ctx->width,
|
||||
video_dec_ctx->height );
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
av_free_packet( &pkt );
|
||||
if( got_frame )
|
||||
return true;
|
||||
}
|
||||
return bRet;
|
||||
return false;
|
||||
// /* flush cached frames */
|
||||
// pkt.data = NULL;
|
||||
// pkt.size = 0;
|
||||
|
||||
Reference in new issue
Block a user