Major changes in ColorSpace Definition

Now color space is defined in PlaYUVerFrame
New function to check if a pixel format is RGB or YUV or Gray or ARGB
implemented
This commit is contained in:
jfmcarreira committed 2014-04-05 06:24:54 +01:00
1 parent 3754caa865
commit 518d68483a
5 files changed
+37 -16

No files matched your search

+3 -3
View File
@@ -430,7 +430,7 @@ UInt64 PlaYUVerFrame::getBytesPerFrame()
return 0;
}
Pixel PlaYUVerFrame::ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace )
Pixel PlaYUVerFrame::ConvertPixel( Pixel sInputPixel, Int eOutputSpace )
{
Pixel sOutputPixel =
{
@@ -453,7 +453,7 @@ Pixel PlaYUVerFrame::ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace )
return sOutputPixel;
}
Pixel PlaYUVerFrame::getPixelValue( const QPoint &pos, ColorSpace space )
Pixel PlaYUVerFrame::getPixelValue( const QPoint &pos, Int color_space )
{
Pixel pixel_value;
switch( m_iPixelFormat )
@@ -491,7 +491,7 @@ Pixel PlaYUVerFrame::getPixelValue( const QPoint &pos, ColorSpace space )
default:
break;
}
ConvertPixel( pixel_value, space );
ConvertPixel( pixel_value, color_space );
return pixel_value;
}
+31 -2
View File
@@ -56,6 +56,15 @@ public:
PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 );
~PlaYUVerFrame();
enum ColorSpace
{
COLOR_INVALID = -1,
COLOR_YUV = 0,
COLOR_RGB,
COLOR_ARGB,
COLOR_GRAY,
};
enum PixelFormats
{
NO_FMT = -1,
@@ -68,6 +77,26 @@ public:
NUMBER_FORMATS
};
static Int isRGBorYUVorGray( Int pixel_format )
{
switch( pixel_format )
{
case GRAY:
return COLOR_GRAY;
break;
case YUV420p:
case YUV444p:
case YUV422p:
case YUYV422:
return COLOR_YUV;
break;
case RGB8:
return COLOR_RGB;
break;
}
return COLOR_INVALID;
}
static QStringList supportedPixelFormatList()
{
QStringList formats;
@@ -94,8 +123,8 @@ public:
return m_pppcInputPel;
}
static Pixel ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace );
Pixel getPixelValue( const QPoint &pos, ColorSpace color );
static Pixel ConvertPixel( Pixel sInputPixel, Int eOutputSpace );
Pixel getPixelValue( const QPoint &pos, Int color );
UChar* getQImageBuffer() const
{