Merge branch 'fixSelectionToolUsage' into featurePelFormatsApi
Conflicts: source/lib/PlaYUVerFrame.cpp
This commit is contained in:
commit
3baa6775e5
9 files changed
+126
-71
No files matched your search
@@ -80,6 +80,7 @@ PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other )
|
||||
|
||||
PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other, QRect area )
|
||||
{
|
||||
adjustSelectedAreaDims( area , other->getPelFormat() );
|
||||
init( area.width(), area.height(), other->getPelFormat() );
|
||||
copyFrom( other, area.x(), area.y() );
|
||||
}
|
||||
@@ -95,6 +96,54 @@ PlaYUVerFrame::~PlaYUVerFrame()
|
||||
closePixfc();
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::adjustSelectedAreaDims( QRect &area, Int pel_format )
|
||||
{
|
||||
Int posX = area.x();
|
||||
Int posY = area.y();
|
||||
Int width = area.width();
|
||||
Int height = area.height();
|
||||
|
||||
switch( pel_format )
|
||||
{
|
||||
case YUV420p:
|
||||
if( posX%2 )
|
||||
area.setX(posX-1);
|
||||
if( posY%2 )
|
||||
area.setY(posY-1);
|
||||
|
||||
if( (posX+width)%2 )
|
||||
area.setWidth((posX+width)-area.x()+1);
|
||||
else
|
||||
area.setWidth((posX+width)-area.x());
|
||||
|
||||
if( (posY+height)%2 )
|
||||
area.setHeight((posY+height)-area.y()+1);
|
||||
else
|
||||
area.setHeight((posY+height)-area.y());
|
||||
|
||||
break;
|
||||
case YUV444p:
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
if( posX%2 )
|
||||
area.setX(posX-1);
|
||||
|
||||
if( (posX+width)%2 )
|
||||
area.setWidth((posX+width)-area.x()+1);
|
||||
else
|
||||
area.setWidth((posX+width)-area.x());
|
||||
|
||||
break;
|
||||
case GRAY:
|
||||
break;
|
||||
case RGB8:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::init( UInt width, UInt height, Int pel_format )
|
||||
{
|
||||
m_pppcInputPel = NULL;
|
||||
@@ -476,42 +525,41 @@ Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame, UInt xPos, UInt yPos )
|
||||
case YUV420p:
|
||||
for( UInt i = 0; i < m_uiHeight / 2; i++ )
|
||||
{
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 )][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 ) + 1][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][0], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos / 2 + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][0], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos / 2 + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][(i<<1)], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 )][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][(i<<1) + 1], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 ) + 1][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][i], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos / 2 + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos / 2 + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
}
|
||||
break;
|
||||
case YUV444p:
|
||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
||||
{
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][0], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][0], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][i], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][i], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
}
|
||||
break;
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
for( UInt i = 0; i < m_uiHeight / 2; i++ )
|
||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
||||
{
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 )][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + ( i << 1 ) + 1][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][0], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][0], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][i], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_U][i], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[CHROMA_V][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||
}
|
||||
break;
|
||||
case GRAY:
|
||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
||||
{
|
||||
memcpy( m_pppcInputPel[LUMA][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[LUMA][i], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
}
|
||||
break;
|
||||
case RGB8:
|
||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
||||
{
|
||||
memcpy( m_pppcInputPel[COLOR_R][0], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[COLOR_G][0], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[COLOR_B][0], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[COLOR_R][i], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[COLOR_G][i], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
memcpy( m_pppcInputPel[COLOR_B][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user