diff --git a/source/lib/PlaYUVerFrame.cpp b/source/lib/PlaYUVerFrame.cpp index 402cde0..5feccea 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/source/lib/PlaYUVerFrame.cpp @@ -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( &m_pppcInputPel, m_uiHeight, m_uiWidth, 2, 2 ); - break; - case YUV444p: - getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 ); - break; - case YUV422p: - case YUYV422: - getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 2 ); - break; - case GRAY: - getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 4, 4 ); - break; - case RGB8: - getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 ); - break; - default: - m_pppcInputPel = NULL; - break; - } + getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, m_pcPelFormat->ratioChromaHeight, m_pcPelFormat->ratioChromaWidth ); + +// switch( m_iPixelFormat ) +// { +// case YUV420p: +// getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 2, 2 ); +// break; +// case YUV444p: +// getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 ); +// break; +// case YUV422p: +// case YUYV422: +// getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 2 ); +// break; +// case GRAY: +// getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 4, 4 ); +// break; +// case RGB8: +// getMem3ImageComponents( &m_pppcInputPel, m_uiHeight, m_uiWidth, 1, 1 ); +// break; +// default: +// m_pppcInputPel = NULL; +// break; +// } getMem1D( &m_pcRGBPelInterlaced, m_uiHeight * m_uiWidth * 3 ); openPixfc(); } diff --git a/source/lib/PlaYUVerFrame.h b/source/lib/PlaYUVerFrame.h index a52f42d..22c8e3f 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/source/lib/PlaYUVerFrame.h @@ -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;