Commit 28017d7d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Frames: Using quint32 instead of quint8

frei0r uses uint32 to describe pixels, instead of uint8 to describe
pixel composants.
parent 66759c59
......@@ -108,9 +108,9 @@ EffectsEngine::applyFilters( const FilterList &effects, Workflow::Frame* frame,
FilterList::const_iterator it = effects.constBegin();
FilterList::const_iterator ite = effects.constEnd();
quint8 *buff1 = NULL;
quint8 *buff2 = NULL;
quint8 *input = frame->buffer();
quint32 *buff1 = NULL;
quint32 *buff2 = NULL;
quint32 *input = frame->buffer();
bool firstBuff = true;
while ( it != ite )
......@@ -118,15 +118,15 @@ EffectsEngine::applyFilters( const FilterList &effects, Workflow::Frame* frame,
if ( (*it)->start < currentFrame &&
( (*it)->end < 0 || (*it)->end > currentFrame ) )
{
quint8 **buff;
quint32 **buff;
if ( firstBuff == true )
buff = &buff1;
else
buff = &buff2;
if ( *buff == NULL )
*buff = new quint8[frame->size()];
*buff = new quint32[frame->nbPixels()];
FilterInstance *effect = (*it)->effect;
effect->process( time, (quint32*)input, (quint32*)*buff );
effect->process( time, input, *buff );
input = *buff;
firstBuff = !firstBuff;
}
......
......@@ -31,8 +31,9 @@ Frame::Frame( quint32 width, quint32 height ) :
m_width( width ),
m_height( height )
{
m_size = width * height * Depth;
m_buffer = new quint8[m_size];
m_nbPixels = width * height;
m_size = m_nbPixels * Depth;
m_buffer = new quint32[m_nbPixels];
}
Frame::~Frame()
......@@ -40,13 +41,13 @@ Frame::~Frame()
delete[] m_buffer;
}
quint8*
quint32*
Frame::buffer()
{
return m_buffer;
}
const quint8*
const quint32*
Frame::buffer() const
{
return m_buffer;
......@@ -70,6 +71,12 @@ Frame::size() const
return m_size;
}
quint32
Frame::nbPixels() const
{
return m_nbPixels;
}
Frame*
Frame::clone() const
{
......@@ -79,7 +86,7 @@ Frame::clone() const
}
void
Frame::setBuffer( quint8 *buff )
Frame::setBuffer( quint32 *buff )
{
delete[] m_buffer;
m_buffer = buff;
......
......@@ -36,16 +36,22 @@ namespace Workflow
~Frame();
quint32 width() const;
quint32 height() const;
quint8 *buffer();
const quint8 *buffer() const;
void setBuffer( quint8 *buff );
quint32 *buffer();
const quint32 *buffer() const;
void setBuffer( quint32 *buff );
Frame *clone() const;
/**
* \returns The frame size in pixels
* \returns The frame size in octets
*
* This is equal to width * height * Depth
*/
/**
* \returns The frame size in pixels
*
* This is equal to width * height
*/
quint32 size() const;
quint32 nbPixels() const;
/**
* \warning Terrible hack !
*
......@@ -56,8 +62,9 @@ namespace Workflow
private:
quint32 m_width;
quint32 m_height;
quint8 *m_buffer;
quint32 *m_buffer;
quint32 m_size;
quint32 m_nbPixels;
};
struct AudioSample
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment