Add RGB planar format and try to guess bpp

This commit is contained in:
jfmcarreira committed 2016-11-18 17:41:09 +00:00
1 parent 41159c5bd7
commit ed0b967234
4 files changed
+38 -9

No files matched your search

+17 -3
View File
@@ -317,7 +317,7 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
m_pCurrStream = new PlaYUVerStream;
}
if( guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
if( guessFormat( cFilename, Width, Height, InputFormat, BitsPel ) || bForceDialog )
{
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate )
== QDialog::Rejected )
@@ -428,7 +428,7 @@ Void VideoSubWindow::updateVideoWindowInfo()
}
}
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel )
{
std::vector<PlaYUVerStdResolution> stdResList = PlaYUVerStream::stdResolutionSizes();
Bool bGuessed = true;
@@ -470,8 +470,9 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
rWidth = stdResList[iMatch].uiWidth;
rHeight = stdResList[iMatch].uiHeight;
}
// Guess resolution - match %dx%d
#if( QT_VERSION_PLAYUVER == 5 )
// Guess resolution - match %dx%d
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
if( resolutionMatch.hasMatch() )
{
@@ -487,6 +488,19 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
}
}
}
// Guess bits per pixel - match %dbpp
QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() )
{
QString matchString = BppMatch.captured( 0 );
matchString.remove( "_" );
matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt();
if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) )
{
rBitsPerPixel = -1;
}
}
#endif
}
+1 -1
View File
@@ -103,7 +103,7 @@ private:
Void refreshFrameOperation();
static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate );
static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel );
/**
* Private zoom function to handle
+1
View File
@@ -58,6 +58,7 @@ public:
YUV422p,
YUYV422,
GRAY,
RGBp,
RGB24,
BGR24,
NUMBER_PEL_FORMATS
+19 -5
View File
@@ -268,7 +268,21 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU
{ { 0, 0, 1 } }, /* Y */
},
{
"RGB24",
"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,
@@ -282,7 +296,7 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU
},
},
{
"BGR24",
"BGR",
PlaYUVerPixel::COLOR_RGB,
3,
1,
@@ -290,9 +304,9 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
{
{ 0, 2, 3}, /* R */
{ 0, 2, 2}, /* G */
{ 0, 2, 1}, /* B */
{ 0, 2, 3}, /* B */
{ 0, 2, 2}, /* R */
{ 0, 2, 1}, /* G */
},
}
};