This commit is contained in:
Luis Lucas committed 2014-03-23 19:31:07 +00:00
commit 0ef73a75bc
9 files changed
+123 -20

No files matched your search

+7 -1
View File
@@ -47,6 +47,9 @@ InputStream::InputStream()
m_iFileFormat = INVALID;
m_cCurrFrame = NULL;
m_pInputBuffer = NULL;
m_cFilename = QString( "" );
m_cStreamInformationString = QString( "" );
}
@@ -199,9 +202,12 @@ Void InputStream::close()
m_cLibAvContext.closeAvFormat();
#endif
if(m_cCurrFrame)
if( m_cCurrFrame )
delete m_cCurrFrame;
if( m_pInputBuffer )
free_mem1Dpel( m_pInputBuffer );
m_iStatus = 0;
}
+8 -2
View File
@@ -29,12 +29,19 @@
namespace plaYUVer
{
ModulesHandle::ModulesHandle( QWidget * parent )
Void ModulesHandle::ModulesList( Bool bCreate )
{
// Register Modules
REGISTER_MODULE( FilterFrame );
}
ModulesHandle::ModulesHandle( QWidget * parent )
{
ModulesList( true );
// configure class
setParent( parent );
m_uiModulesCount = 0;
@@ -43,7 +50,6 @@ ModulesHandle::ModulesHandle( QWidget * parent )
ModulesHandle::~ModulesHandle()
{
}
Void ModulesHandle::appendModule( PlaYUVerModuleIf* pIfModule )
+1 -1
View File
@@ -63,7 +63,7 @@ private:
QVector<QAction*> m_arrayModulesActions;
Void appendModule( PlaYUVerModuleIf* );
Void ModulesList( Bool bCreate );
private Q_SLOTS:
void selectModule( int index );
};
+68 -1
View File
@@ -85,7 +85,9 @@ PlaYUVerFrame::~PlaYUVerFrame()
free_mem3Dpel( m_pppcRGBPel );
}
static inline void yuvToRgb( int iY, int iU, int iV, int &iR, int &iG, int &iB )
template<typename T>
Void yuvToRgb( T iY, T iU, T iV, T &iR, T &iG, T &iB )
{
iR = iY + 1402 * iV / 1000;
iG = iY - ( 101004 * iU + 209599 * iV ) / 293500;
@@ -106,6 +108,14 @@ static inline void yuvToRgb( int iY, int iU, int iV, int &iR, int &iG, int &iB )
iB = 255;
}
template<typename T>
Void rgbToyuv( T iR, T iG, T iB, T &iY, T &iU, T &iV )
{
iY = 0;
iU = 0;
iV = 0;
}
Void PlaYUVerFrame::YUV420toRGB()
{
Int iY, iU, iV, iR, iG, iB;
@@ -253,6 +263,63 @@ UInt64 PlaYUVerFrame::getBytesPerFrame()
return 0;
}
Pixel PlaYUVerFrame::ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace )
{
Pixel sOutputPixel = {COLOR_INVALID,0,0,0};
if( sInputPixel.color_space == eOutputSpace )
return sInputPixel;
if( eOutputSpace == COLOR_RGB )
{
yuvToRgb( sInputPixel.Luma, sInputPixel.ChromaU, sInputPixel.ChromaU,
sOutputPixel.ColorR, sOutputPixel.ColorG, sOutputPixel.ColorB );
}
if( eOutputSpace == COLOR_YUV )
{
rgbToyuv( sInputPixel.ColorR, sInputPixel.ColorG, sInputPixel.ColorB,
sOutputPixel.Luma, sOutputPixel.ChromaU, sOutputPixel.ChromaU );
}
return sOutputPixel;
}
Pixel PlaYUVerFrame::getPixelValue(const QPoint &pos, ColorSpace space)
{
Pixel pixel_value;
switch( m_iPixelFormat )
{
case YUV420:
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()>>1][pos.x()>>1];
pixel_value.ChromaV = m_pppcInputPel[CHROMA_V][pos.y()>>1][pos.x()>>1];
break;
case YUV422:
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 YUV400:
pixel_value.color_space = COLOR_YUV;
pixel_value.Luma = m_pppcInputPel[LUMA][pos.y()][pos.x()];
pixel_value.ChromaU = 0;
pixel_value.ChromaV = 0;
break;
case RGB:
pixel_value.color_space = COLOR_RGB;
pixel_value.ColorR = m_pppcInputPel[COLOR_R][pos.y()][pos.x()];
pixel_value.ColorG = m_pppcInputPel[COLOR_G][pos.y()][pos.x()];
pixel_value.ColorB = m_pppcInputPel[COLOR_B][pos.y()][pos.x()];
break;
default:
break;
}
ConvertPixel( pixel_value, space );
return pixel_value;
}
Pel PlaYUVerFrame::getPixelValueFromYUV(const QPoint &pos, YUVcomponent color)
{
return m_pppcInputPel[color][0][pos.y()*m_uiWidth+pos.x()];
+2
View File
@@ -63,6 +63,8 @@ public:
}
Pel getPixelValueFromYUV(const QPoint &pos, YUVcomponent color);
Pixel ConvertPixel( Pixel sInputPixel, ColorSpace eOutputSpace );
Pixel getPixelValue(const QPoint &pos, ColorSpace color);
QImage getQimage();
+5 -2
View File
@@ -55,8 +55,11 @@ enum __PlaYUVerModuleRequirements
{ \
if( USE_##X ) \
{ \
X *pMod = new X(); \
appendModule( pMod ); \
if( bCreate ) \
{ \
X *pMod = new X(); \
appendModule( pMod ); \
} \
} \
}
+28 -4
View File
@@ -115,6 +115,14 @@ enum InputStreamColorSpace
NO_FMT = -1, YUV420, YUV400, YUV422, RGB,
};
enum ColorSpace
{
COLOR_INVALID = -1,
COLOR_YUV = 0,
COLOR_RGB,
};
enum YUVcomponent
{
LUMA = 0,
@@ -129,10 +137,26 @@ enum RGBcomponent
COLOR_B,
};
typedef struct __pixel_definition
{
ColorSpace color_space;
union
{
Pel Luma;
Pel ColorR;
};
union
{
Pel ChromaU;
Pel ColorG;
};
union
{
Pel ChromaV;
Pel ColorB;
};
}Pixel;
}
} // NAMESPACE
#endif // __TYPEDEF_H__
+1 -4
View File
@@ -39,14 +39,11 @@ PlaYUVerModuleDefinition FilterFrameDef = {
FilterFrame::FilterFrame()
{
m_cModuleDef = FilterFrameDef;
m_pcFilteredFrame = NULL;
}
Void FilterFrame::create( PlaYUVerFrame* InputFrame )
{
if( m_pcFilteredFrame )
delete m_pcFilteredFrame;
m_pcFilteredFrame = NULL;
m_pcFilteredFrame = new PlaYUVerFrame( InputFrame->getWidth(), InputFrame->getHeight(), InputFrame->getPelFormat() );
}
+3 -5
View File
@@ -632,7 +632,7 @@ void plaYUVerApp::setActiveSubWindow( QWidget *window )
void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos, InputStream* stream)
{
Pel luma, chromaU = 0, chromaV = 0;
Pixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strPixel;
@@ -644,10 +644,8 @@ void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos, InputStream* str
if( (posX<iWidth) && (posX>=0) && (posY<iHeight) && (posY>=0) )
{
luma = curFrame->getPixelValueFromYUV(pos, LUMA);
//chromaU = curFrame->getPixelValueFromYUV(pos, CHROMA_U);
//chromaV = curFrame->getPixelValueFromYUV(pos, CHROMA_V);
strPixel = QString("Y: %1 U: %2 V: %3").arg(luma).arg(chromaU).arg(chromaV);
sPixelValue = curFrame->getPixelValue(pos,COLOR_YUV);
strPixel = QString("Y: %1 U: %2 V: %3").arg(sPixelValue.Luma).arg(sPixelValue.ChromaU).arg(sPixelValue.ChromaV);
}
else
{