Improve the interface for the different pixel formats

Unify the get pixel function
Complete the interface
Change some defines from PlaYUVerDefs.h
Add a class to represent a pixel
Improve LibAvContextHandle
This commit is contained in:
jfmcarreira committed 2014-11-10 22:55:09 +00:00
1 parent 82631f22f9
commit 3dfc1de042
11 files changed
+211 -177

No files matched your search

+2 -7
View File
@@ -343,13 +343,8 @@ void PlaYUVerFrameStatistics::calcHistogramValues()
}
if( d->calcLuma && ( d->imageColorSpace == PlaYUVerFrame::COLOR_RGB || d->imageColorSpace == PlaYUVerFrame::COLOR_ARGB ) )
{
Pixel pixel_value =
{
d->imageColorSpace,
*( data[COLOR_R] ),
*( data[COLOR_G] ),
*( data[COLOR_B] ) };
luma = PlaYUVerFrame::ConvertPixel( pixel_value, PlaYUVerFrame::COLOR_YUV ).Luma;
PlaYUVerFrame::Pixel currPixel( d->imageColorSpace, *( data[COLOR_R] ), *( data[COLOR_G] ), *( data[COLOR_B] ) );
luma = PlaYUVerFrame::ConvertPixel( currPixel, PlaYUVerFrame::COLOR_YUV ).Y();
d->histogram[luma + j * d->histoSegments]++;
}
for( j = 0; j < d->imageChannels; j++ )
+9 -9
View File
@@ -355,7 +355,7 @@ void ViewArea::paintEvent( QPaintEvent *event )
{
Int imageWidth = m_pixmap.width();
Int imageHeight = m_pixmap.height();
Pixel sPixelValue;
PlaYUVerFrame::Pixel sPixelValue;
QFont font( "Helvetica" );
font.setPixelSize( 12 );
@@ -378,39 +378,39 @@ void ViewArea::paintEvent( QPaintEvent *event )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y(), PlaYUVerFrame::COLOR_YUV );
if( sPixelValue.Luma < 128 )
if( sPixelValue.Y() < 128 )
painter.setPen( QColor( Qt::white ) );
else
painter.setPen( QColor( Qt::black ) );
painter.drawText( pixelRect, Qt::AlignCenter,
"Y: " + QString::number( sPixelValue.Luma ) + "\n" + "U: " + QString::number( sPixelValue.ChromaU ) + "\n" + "V: "
+ QString::number( sPixelValue.ChromaV ) );
"Y: " + QString::number( sPixelValue.Y() ) + "\n" + "U: " + QString::number( sPixelValue.Cb() ) + "\n" + "V: "
+ QString::number( sPixelValue.Cr() ) );
}
if( frFormat == PlaYUVerFrame::COLOR_GRAY )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y(), PlaYUVerFrame::COLOR_YUV );
if( sPixelValue.Luma < 128 )
if( sPixelValue.Y() < 128 )
painter.setPen( QColor( Qt::white ) );
else
painter.setPen( QColor( Qt::black ) );
painter.drawText( pixelRect, Qt::AlignCenter, "Y: " + QString::number( sPixelValue.Luma ) );
painter.drawText( pixelRect, Qt::AlignCenter, "Y: " + QString::number( sPixelValue.Y() ) );
}
if( ( frFormat == PlaYUVerFrame::COLOR_RGB ) )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y(), PlaYUVerFrame::COLOR_RGB );
if( ( sPixelValue.ColorR + sPixelValue.ColorG + sPixelValue.ColorB ) < 128 * 3 )
if( ( sPixelValue.R() + sPixelValue.G() + sPixelValue.B() ) < 128 * 3 )
painter.setPen( QColor( Qt::white ) );
else
painter.setPen( QColor( Qt::black ) );
painter.drawText( pixelRect, Qt::AlignCenter,
"R: " + QString::number( sPixelValue.ColorR ) + "\n" + "G: " + QString::number( sPixelValue.ColorG ) + "\n" + "B: "
+ QString::number( sPixelValue.ColorB ) );
"R: " + QString::number( sPixelValue.R() ) + "\n" + "G: " + QString::number( sPixelValue.G() ) + "\n" + "B: "
+ QString::number( sPixelValue.B() ) );
}
}
}
+2 -2
View File
@@ -914,7 +914,7 @@ Void plaYUVerApp::chageSubWindowSelection()
Void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame )
{
Pixel sPixelValue;
PlaYUVerFrame::Pixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strPixel;
@@ -927,7 +927,7 @@ Void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame*
if( ( posX < iWidth ) && ( posX >= 0 ) && ( posY < iHeight ) && ( posY >= 0 ) )
{
sPixelValue = curFrame->getPixelValue( pos.x(), pos.y(), PlaYUVerFrame::COLOR_YUV );
strPixel = QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Luma ).arg( sPixelValue.ChromaU ).arg( sPixelValue.ChromaV );
strPixel = QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() );
strStatus.append( strPixel );
statusBar()->showMessage( strStatus, 3000 );
}