Initial changes the init function to use the new pel formats API
This commit is contained in:
1 parent
eb0fef09b5
commit
b547d2bda4
2 files changed
+131
-40
No files matched your search
+113
-22
@@ -36,6 +36,93 @@
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Void yuv420_init( UInt Width, UInt Height )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PlaYUVerFramePelFormat yuv420p =
|
||||
{
|
||||
"YUV420p",
|
||||
PlaYUVerFrame::COLOR_YUV,
|
||||
2,
|
||||
2,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
PlaYUVerFramePelFormat yuv444p =
|
||||
{
|
||||
"YUV444p",
|
||||
PlaYUVerFrame::COLOR_YUV,
|
||||
1,
|
||||
1,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
PlaYUVerFramePelFormat yuv422p =
|
||||
{
|
||||
"YUV422p",
|
||||
PlaYUVerFrame::COLOR_YUV,
|
||||
2,
|
||||
1,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
PlaYUVerFramePelFormat yuv422 =
|
||||
{
|
||||
"YUV422",
|
||||
PlaYUVerFrame::COLOR_YUV,
|
||||
2,
|
||||
1,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
|
||||
PlaYUVerFramePelFormat gray =
|
||||
{
|
||||
"GRAY",
|
||||
PlaYUVerFrame::COLOR_YUV,
|
||||
4,
|
||||
4,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
PlaYUVerFramePelFormat rgb8 =
|
||||
{
|
||||
"RGB8",
|
||||
PlaYUVerFrame::COLOR_RGB,
|
||||
1,
|
||||
1,
|
||||
yuv420_init,
|
||||
};
|
||||
|
||||
PlaYUVerFramePelFormat PlaYUVerFramePelFormatsList[] =
|
||||
{
|
||||
yuv420p, yuv444p, yuv422p, yuv422, gray, rgb8,
|
||||
};
|
||||
|
||||
QStringList PlaYUVerFrame::supportedPixelFormatList()
|
||||
{
|
||||
QStringList formats;
|
||||
Int numberFormats = sizeof(PlaYUVerFramePelFormatsList)/sizeof(PlaYUVerFramePelFormat);
|
||||
for(Int i=0; i<numberFormats;i++)
|
||||
{
|
||||
formats << PlaYUVerFramePelFormatsList[i].name;
|
||||
}
|
||||
// formats << "YUV420p"
|
||||
// << "YUV444p"
|
||||
// << "YUV422p"
|
||||
// << "YUYV422"
|
||||
// << "GRAY"
|
||||
// << "RGB8" // RGB 3*8 bits per pixel
|
||||
// ;
|
||||
assert( formats.size() == NUMBER_FORMATS );
|
||||
return formats;
|
||||
}
|
||||
|
||||
PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format )
|
||||
{
|
||||
init( width, height, pel_format );
|
||||
@@ -80,30 +167,34 @@ Void PlaYUVerFrame::init( UInt width, UInt height, Int pel_format )
|
||||
return;
|
||||
}
|
||||
|
||||
m_pcPelFormat = &(PlaYUVerFramePelFormatsList[pel_format]);
|
||||
|
||||
m_bHasRGBPel = false;
|
||||
|
||||
switch( m_iPixelFormat )
|
||||
{
|
||||
case YUV420p:
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 2, 2 );
|
||||
break;
|
||||
case YUV444p:
|
||||
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 GRAY:
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 4, 4 );
|
||||
break;
|
||||
case RGB8:
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 );
|
||||
break;
|
||||
default:
|
||||
m_pppcInputPel = NULL;
|
||||
break;
|
||||
}
|
||||
getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, m_pcPelFormat->ratioChromaHeight, m_pcPelFormat->ratioChromaWidth );
|
||||
|
||||
// switch( m_iPixelFormat )
|
||||
// {
|
||||
// case YUV420p:
|
||||
// getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 2, 2 );
|
||||
// break;
|
||||
// case YUV444p:
|
||||
// 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 GRAY:
|
||||
// getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 4, 4 );
|
||||
// break;
|
||||
// case RGB8:
|
||||
// getMem3ImageComponents<Pel>( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 );
|
||||
// break;
|
||||
// default:
|
||||
// m_pppcInputPel = NULL;
|
||||
// break;
|
||||
// }
|
||||
getMem1D<Pel>( &m_pcRGBPelInterlaced, m_uiHeight * m_uiWidth * 3 );
|
||||
openPixfc();
|
||||
}
|
||||
|
||||
+18
-18
@@ -43,14 +43,18 @@ class PixFcSSE;
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const Char* name;
|
||||
Int colorSpace;
|
||||
Int ratioChromaWidth;
|
||||
Int ratioChromaHeight;
|
||||
Void (*init)( UInt Width, UInt Height );
|
||||
} PlaYUVerFramePelFormat;
|
||||
|
||||
class PlaYUVerFrame
|
||||
{
|
||||
public:
|
||||
PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 );
|
||||
PlaYUVerFrame( PlaYUVerFrame *other );
|
||||
PlaYUVerFrame( PlaYUVerFrame *other, QRect area );
|
||||
~PlaYUVerFrame();
|
||||
|
||||
enum ColorSpace
|
||||
{
|
||||
COLOR_INVALID = -1,
|
||||
@@ -92,19 +96,12 @@ public:
|
||||
return COLOR_INVALID;
|
||||
}
|
||||
|
||||
static QStringList supportedPixelFormatList()
|
||||
{
|
||||
QStringList formats;
|
||||
formats << "YUV420p"
|
||||
<< "YUV444p"
|
||||
<< "YUV422p"
|
||||
<< "YUYV422"
|
||||
<< "GRAY"
|
||||
<< "RGB8" // RGB 3*8 bits per pixel
|
||||
;
|
||||
assert( formats.size() == NUMBER_FORMATS );
|
||||
return formats;
|
||||
}
|
||||
static QStringList supportedPixelFormatList();
|
||||
|
||||
PlaYUVerFrame( UInt width = 0, UInt height = 0, Int pel_format = 0 );
|
||||
PlaYUVerFrame( PlaYUVerFrame *other );
|
||||
PlaYUVerFrame( PlaYUVerFrame *other, QRect area );
|
||||
~PlaYUVerFrame();
|
||||
|
||||
Void FrametoRGB8();
|
||||
|
||||
@@ -201,6 +198,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
PlaYUVerFramePelFormat* m_pcPelFormat;
|
||||
|
||||
UInt m_uiWidth;
|
||||
UInt m_uiHeight;
|
||||
Int m_iPixelFormat;
|
||||
|
||||
Reference in new issue
Block a user