Add function to properly adjust dimensions of selected area in order to be saved to file.
This commit is contained in:
1 parent
b625bd1a7a
commit
1599fd9b37
2 files changed
+50
No files matched your search
@@ -49,6 +49,7 @@ PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other )
|
|||||||
|
|
||||||
PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other, QRect area )
|
PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other, QRect area )
|
||||||
{
|
{
|
||||||
|
adjustSelectedAreaDims( area , other->getPelFormat() );
|
||||||
init( area.width(), area.height(), other->getPelFormat() );
|
init( area.width(), area.height(), other->getPelFormat() );
|
||||||
copyFrom( other, area.x(), area.y() );
|
copyFrom( other, area.x(), area.y() );
|
||||||
}
|
}
|
||||||
@@ -64,6 +65,54 @@ PlaYUVerFrame::~PlaYUVerFrame()
|
|||||||
closePixfc();
|
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 )
|
Void PlaYUVerFrame::init( UInt width, UInt height, Int pel_format )
|
||||||
{
|
{
|
||||||
m_pppcInputPel = NULL;
|
m_pppcInputPel = NULL;
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ private:
|
|||||||
Pel*** m_pppcInputPel;
|
Pel*** m_pppcInputPel;
|
||||||
UChar* m_pcRGBPelInterlaced;
|
UChar* m_pcRGBPelInterlaced;
|
||||||
|
|
||||||
|
Void adjustSelectedAreaDims( QRect &area, Int pel_format );
|
||||||
Void init( UInt width, UInt height, Int pel_format );
|
Void init( UInt width, UInt height, Int pel_format );
|
||||||
Void openPixfc();
|
Void openPixfc();
|
||||||
Void closePixfc();
|
Void closePixfc();
|
||||||
|
|||||||
Reference in new issue
Block a user