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
@@ -66,7 +66,7 @@ SubWindowHandle* ModulesHandle::processModuleHandlingOpt()
|
|||||||
if( m_iOptionSelected >= 0 )
|
if( m_iOptionSelected >= 0 )
|
||||||
{
|
{
|
||||||
PlaYUVerModuleIf* pcCurrModuleIf = m_pcPlaYUVerModules.at( m_iOptionSelected );
|
PlaYUVerModuleIf* pcCurrModuleIf = m_pcPlaYUVerModules.at( m_iOptionSelected );
|
||||||
|
m_iOptionSelected = INVALID_OPT;
|
||||||
if( pcCurrModuleIf->m_pcAction->isChecked() )
|
if( pcCurrModuleIf->m_pcAction->isChecked() )
|
||||||
{
|
{
|
||||||
return enableModuleIf( pcCurrModuleIf );
|
return enableModuleIf( pcCurrModuleIf );
|
||||||
|
|||||||
@@ -491,22 +491,25 @@ Void FramePropertiesSideBar::setSelection( const QRect &selectionArea )
|
|||||||
// This is necessary to stop computation because image.bits() is
|
// This is necessary to stop computation because image.bits() is
|
||||||
// currently used by threaded histogram algorithm.
|
// currently used by threaded histogram algorithm.
|
||||||
|
|
||||||
m_cSelectionArea = selectionArea;
|
if( m_pcFrame )
|
||||||
|
{
|
||||||
|
m_cSelectionArea = selectionArea;
|
||||||
|
|
||||||
if( selectionArea.isValid() )
|
if( selectionArea.isValid() )
|
||||||
{
|
{
|
||||||
histogramWidget->stopHistogramComputation();
|
histogramWidget->stopHistogramComputation();
|
||||||
histogramWidget->updateSelectionData( new PlaYUVerFrame(m_pcFrame, selectionArea));
|
histogramWidget->updateSelectionData( new PlaYUVerFrame(m_pcFrame, selectionArea));
|
||||||
fullImageButton->show();
|
fullImageButton->show();
|
||||||
selectionImageButton->show();
|
selectionImageButton->show();
|
||||||
selectionImageButton->click();
|
selectionImageButton->click();
|
||||||
slotRenderingChanged( HistogramWidget::ImageSelectionHistogram );
|
slotRenderingChanged( HistogramWidget::ImageSelectionHistogram );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fullImageButton->hide();
|
fullImageButton->hide();
|
||||||
selectionImageButton->hide();
|
selectionImageButton->hide();
|
||||||
slotRenderingChanged( HistogramWidget::FullImageHistogram );
|
slotRenderingChanged( HistogramWidget::FullImageHistogram );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
|
|||||||
m_cViewArea = new ViewArea( m_cScrollArea );
|
m_cViewArea = new ViewArea( m_cScrollArea );
|
||||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( adjustScrollBarByZoom(double, QPoint) ) );
|
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( adjustScrollBarByZoom(double, QPoint) ) );
|
||||||
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset(QPoint) ) );
|
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset(QPoint) ) );
|
||||||
|
connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
|
||||||
connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||||
connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||||
|
|
||||||
@@ -145,6 +146,11 @@ Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Void SubWindowHandle::updateSelectedArea( QRect area )
|
||||||
|
{
|
||||||
|
m_cSelectedArea = area;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions to enable a module in the
|
* Functions to enable a module in the
|
||||||
* current SubWindow
|
* current SubWindow
|
||||||
@@ -230,31 +236,17 @@ Bool SubWindowHandle::save( QString filename )
|
|||||||
{
|
{
|
||||||
Bool iRet = false;
|
Bool iRet = false;
|
||||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
if( !m_pCurrStream )
|
|
||||||
|
PlaYUVerFrame* saveFrame = m_pcCurrFrame;
|
||||||
|
if( m_cSelectedArea.isValid() )
|
||||||
{
|
{
|
||||||
if( !m_pcCurrFrame )
|
saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea );
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Int iFileFormat = PlaYUVerStream::INVALID_INPUT;
|
|
||||||
QStringList formatsExt = PlaYUVerStream::supportedReadFormatsExt();
|
|
||||||
QString currExt = QFileInfo( filename ).suffix();
|
|
||||||
if( formatsExt.contains( currExt ) )
|
|
||||||
{
|
|
||||||
iFileFormat = formatsExt.indexOf( currExt );
|
|
||||||
}
|
|
||||||
if( iFileFormat == PlaYUVerStream::YUVINPUT )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_pcCurrFrame->FrametoRGB8();
|
|
||||||
QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 );
|
|
||||||
iRet = qimg.save( filename );
|
|
||||||
}
|
}
|
||||||
else
|
if( !saveFrame )
|
||||||
{
|
{
|
||||||
iRet = m_pCurrStream->saveFrame( filename );
|
return false;
|
||||||
}
|
}
|
||||||
|
iRet = PlaYUVerStream::saveFrame( filename, saveFrame );
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ private:
|
|||||||
|
|
||||||
PlaYUVerStream* m_pCurrStream;
|
PlaYUVerStream* m_pCurrStream;
|
||||||
PlaYUVerFrame* m_pcCurrFrame;
|
PlaYUVerFrame* m_pcCurrFrame;
|
||||||
|
QRect m_cSelectedArea;
|
||||||
|
|
||||||
QString m_cFilename;
|
QString m_cFilename;
|
||||||
PlaYUVerModuleIf* m_pcCurrentModule;
|
PlaYUVerModuleIf* m_pcCurrentModule;
|
||||||
@@ -214,6 +215,7 @@ protected:
|
|||||||
void closeEvent( QCloseEvent *event );
|
void closeEvent( QCloseEvent *event );
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
void updateSelectedArea( QRect area );
|
||||||
void adjustScrollBarByZoom( double factor, QPoint center );
|
void adjustScrollBarByZoom( double factor, QPoint center );
|
||||||
void adjustScrollBarByOffset( QPoint Offset );
|
void adjustScrollBarByOffset( QPoint Offset );
|
||||||
void updateLastScrollValue();
|
void updateLastScrollValue();
|
||||||
|
|||||||
+10
-9
@@ -436,7 +436,7 @@ void ViewArea::paintEvent( QPaintEvent *event )
|
|||||||
QRect imgr = viewToWindow( QRect( 0, 0, m_pixmap.width(), m_pixmap.height() ) );
|
QRect imgr = viewToWindow( QRect( 0, 0, m_pixmap.width(), m_pixmap.height() ) );
|
||||||
|
|
||||||
myPath.addRect( imgr );
|
myPath.addRect( imgr );
|
||||||
myPath.addRect( sr/*m_selectedArea*/);
|
myPath.addRect( sr); //m_selectedArea
|
||||||
painter.drawPath( myPath );
|
painter.drawPath( myPath );
|
||||||
|
|
||||||
// 2) Draw the selection rectangle
|
// 2) Draw the selection rectangle
|
||||||
@@ -641,7 +641,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event )
|
|||||||
{
|
{
|
||||||
// If the selection is only vertical or horizontal then we have one
|
// If the selection is only vertical or horizontal then we have one
|
||||||
// of the dimentions null.
|
// of the dimentions null.
|
||||||
if( actualPos.x() == m_lastPos.x() || actualPos.y() == m_lastPos.y() )
|
if( actualPos.x() == m_lastPos.x() && actualPos.y() == m_lastPos.y() )
|
||||||
{
|
{
|
||||||
m_selectedArea = QRect();
|
m_selectedArea = QRect();
|
||||||
}
|
}
|
||||||
@@ -651,14 +651,14 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event )
|
|||||||
// From left to right
|
// From left to right
|
||||||
if( m_lastPos.x() < actualPos.x() )
|
if( m_lastPos.x() < actualPos.x() )
|
||||||
{
|
{
|
||||||
QPoint bottomR = actualPos - QPoint( 1, 1 );
|
QPoint bottomR = actualPos;// - QPoint( 1, 1 );
|
||||||
m_selectedArea = QRect( m_lastPos, bottomR );
|
m_selectedArea = QRect( m_lastPos, bottomR );
|
||||||
}
|
}
|
||||||
// From right to left
|
// From right to left
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QPoint topL( actualPos.x(), m_lastPos.y() );
|
QPoint topL( actualPos.x(), m_lastPos.y() );
|
||||||
QPoint bottomR( m_lastPos.x() - 1, actualPos.y() - 1 );
|
QPoint bottomR( m_lastPos.x(), actualPos.y() );
|
||||||
|
|
||||||
m_selectedArea = QRect( topL, bottomR );
|
m_selectedArea = QRect( topL, bottomR );
|
||||||
}
|
}
|
||||||
@@ -670,13 +670,13 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event )
|
|||||||
if( m_lastPos.x() < actualPos.x() )
|
if( m_lastPos.x() < actualPos.x() )
|
||||||
{
|
{
|
||||||
QPoint topL( m_lastPos.x(), actualPos.y() );
|
QPoint topL( m_lastPos.x(), actualPos.y() );
|
||||||
QPoint bottomR( actualPos.x() - 1, m_lastPos.y() - 1 );
|
QPoint bottomR( actualPos.x(), m_lastPos.y() );
|
||||||
m_selectedArea = QRect( topL, bottomR );
|
m_selectedArea = QRect( topL, bottomR );
|
||||||
}
|
}
|
||||||
// From right to left
|
// From right to left
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QPoint bottomR = m_lastPos - QPoint( 1, 1 );
|
QPoint bottomR = m_lastPos;// - QPoint( 1, 1 );
|
||||||
m_selectedArea = QRect( actualPos, bottomR );
|
m_selectedArea = QRect( actualPos, bottomR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -702,15 +702,16 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event )
|
|||||||
m_selectedArea &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
m_selectedArea &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
||||||
|
|
||||||
// Update only the united area
|
// Update only the united area
|
||||||
updateRect = updateRect.united( viewToWindow( m_selectedArea ) );
|
// updateRect = updateRect.united( viewToWindow( m_selectedArea ) );
|
||||||
|
|
||||||
// "When rendering with a one pixel wide pen the QRect's
|
// "When rendering with a one pixel wide pen the QRect's
|
||||||
// boundary line will be rendered to the right and below the
|
// boundary line will be rendered to the right and below the
|
||||||
// mathematical rectangle's boundary line.", in QT4 doc.
|
// mathematical rectangle's boundary line.", in QT4 doc.
|
||||||
// Our selection pen width is 1, let's adjust the rendering area.
|
// Our selection pen width is 1, let's adjust the rendering area.
|
||||||
updateRect.adjust( 0, 0, 1, 1 );
|
// updateRect.adjust( 0, 0, 1, 1 );
|
||||||
|
|
||||||
update( updateRect.normalized() );
|
// update( updateRect.normalized() );
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,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() );
|
||||||
}
|
}
|
||||||
@@ -95,6 +96,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;
|
||||||
@@ -476,42 +525,41 @@ Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame, UInt xPos, UInt yPos )
|
|||||||
case YUV420p:
|
case YUV420p:
|
||||||
for( UInt i = 0; i < m_uiHeight / 2; i++ )
|
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][(i<<1)], &( 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[LUMA][(i<<1) + 1], &( 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_U][i], &( 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[CHROMA_V][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos / 2 + i][xPos / 2] ), m_uiWidth / 2 * sizeof(Pel) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YUV444p:
|
case YUV444p:
|
||||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
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) );
|
||||||
memcpy( m_pppcInputPel[CHROMA_U][0], &( input_frame->getPelBufferYUV()[CHROMA_U][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][0], &( input_frame->getPelBufferYUV()[CHROMA_V][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;
|
break;
|
||||||
case YUV422p:
|
case YUV422p:
|
||||||
case YUYV422:
|
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][i], &( input_frame->getPelBufferYUV()[LUMA][yPos + i][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][i], &( input_frame->getPelBufferYUV()[CHROMA_U][yPos + i][xPos / 2] ), m_uiWidth / 2 * 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][i], &( input_frame->getPelBufferYUV()[CHROMA_V][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) );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRAY:
|
case GRAY:
|
||||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
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;
|
break;
|
||||||
case RGB8:
|
case RGB8:
|
||||||
for( UInt i = 0; i < m_uiHeight; i++ )
|
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_R][i], &( 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_G][i], &( 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_B][i], &( input_frame->getPelBufferYUV()[CHROMA_V][yPos + i][xPos] ), m_uiWidth * sizeof(Pel) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -201,6 +201,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();
|
||||||
|
|||||||
@@ -581,30 +581,35 @@ Void PlaYUVerStream::writeFrame( PlaYUVerFrame *pcFrame )
|
|||||||
|
|
||||||
Bool PlaYUVerStream::saveFrame( const QString& filename )
|
Bool PlaYUVerStream::saveFrame( const QString& filename )
|
||||||
{
|
{
|
||||||
Int iFileFormat = INVALID_INPUT;
|
return saveFrame( filename, m_pcCurrFrame );
|
||||||
|
}
|
||||||
|
|
||||||
QStringList formatsExt = PlaYUVerStream::supportedReadFormatsExt();
|
Bool PlaYUVerStream::saveFrame( const QString& filename, PlaYUVerFrame *saveFrame )
|
||||||
|
{
|
||||||
|
Int iFileFormat = INVALID_OUTPUT;
|
||||||
|
|
||||||
|
QStringList formatsExt = PlaYUVerStream::supportedSaveFormatsExt();
|
||||||
QString currExt = QFileInfo( filename ).suffix();
|
QString currExt = QFileInfo( filename ).suffix();
|
||||||
if( formatsExt.contains( currExt ) )
|
if( formatsExt.contains( currExt ) )
|
||||||
{
|
{
|
||||||
iFileFormat = formatsExt.indexOf( currExt );
|
iFileFormat = formatsExt.indexOf( currExt );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iFileFormat == YUVINPUT )
|
if( iFileFormat < TOTAL_OUTPUT_FORMATS )
|
||||||
{
|
{
|
||||||
PlaYUVerStream auxFrameStream;
|
PlaYUVerStream auxFrameStream;
|
||||||
if( !auxFrameStream.open( filename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate, false ) )
|
if( !auxFrameStream.open( filename, saveFrame->getWidth(), saveFrame->getHeight(), saveFrame->getPelFormat(), 1, false ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxFrameStream.writeFrame( m_pcCurrFrame );
|
auxFrameStream.writeFrame( saveFrame );
|
||||||
auxFrameStream.close();
|
auxFrameStream.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pcCurrFrame->FrametoRGB8();
|
saveFrame->FrametoRGB8();
|
||||||
QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 );
|
QImage qimg = QImage( saveFrame->getQImageBuffer(), saveFrame->getWidth(), saveFrame->getHeight(), QImage::Format_RGB888 );
|
||||||
return qimg.save( filename );
|
return qimg.save( filename );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -174,21 +174,23 @@ public:
|
|||||||
static QStringList supportedSaveFormatsExt()
|
static QStringList supportedSaveFormatsExt()
|
||||||
{
|
{
|
||||||
QStringList formatsExt;
|
QStringList formatsExt;
|
||||||
formatsExt << "yuv"
|
formatsExt << supportedWriteFormatsExt()
|
||||||
<< "bmp"
|
<< "bmp"
|
||||||
<< "jpeg"
|
<< "jpeg"
|
||||||
<< "png" // portable network graphics
|
<< "png" // portable network graphics
|
||||||
;
|
;
|
||||||
|
formatsExt.removeDuplicates();
|
||||||
return formatsExt;
|
return formatsExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList supportedSaveFormatsName()
|
static QStringList supportedSaveFormatsName()
|
||||||
{
|
{
|
||||||
QStringList formatsName;
|
QStringList formatsName;
|
||||||
formatsName << "Raw Video"
|
formatsName << supportedWriteFormatsName()
|
||||||
<< "Windows Bitmap"
|
<< "Windows Bitmap"
|
||||||
<< "Joint Photographic Experts Group"
|
<< "Joint Photographic Experts Group"
|
||||||
<< "Portable Network Graphics";
|
<< "Portable Network Graphics";
|
||||||
|
formatsName.removeDuplicates();
|
||||||
return formatsName;
|
return formatsName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +250,7 @@ public:
|
|||||||
Void writeFrame( PlaYUVerFrame *pcFrame );
|
Void writeFrame( PlaYUVerFrame *pcFrame );
|
||||||
|
|
||||||
Bool saveFrame( const QString& filename );
|
Bool saveFrame( const QString& filename );
|
||||||
|
static Bool saveFrame( const QString& filename, PlaYUVerFrame *saveFrame );
|
||||||
|
|
||||||
Void setNextFrame();
|
Void setNextFrame();
|
||||||
PlaYUVerFrame* getCurrFrame();
|
PlaYUVerFrame* getCurrFrame();
|
||||||
|
|||||||
Reference in new issue
Block a user