[vlmc-devel] commit: Frames: Using quint32 instead of quint8 ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Fri Aug 20 00:55:05 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Aug 19 12:51:18 2010 +0200| [28017d7d1d1095e8ce87f452b849f194cd8f92d6] | committer: Hugo Beauzée-Luyssen
Frames: Using quint32 instead of quint8
frei0r uses uint32 to describe pixels, instead of uint8 to describe
pixel composants.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=28017d7d1d1095e8ce87f452b849f194cd8f92d6
---
src/EffectsEngine/EffectsEngine.cpp | 12 ++++++------
src/Workflow/Types.cpp | 17 ++++++++++++-----
src/Workflow/Types.h | 17 ++++++++++++-----
3 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/EffectsEngine/EffectsEngine.cpp b/src/EffectsEngine/EffectsEngine.cpp
index b5cb999..849bdda 100644
--- a/src/EffectsEngine/EffectsEngine.cpp
+++ b/src/EffectsEngine/EffectsEngine.cpp
@@ -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;
}
diff --git a/src/Workflow/Types.cpp b/src/Workflow/Types.cpp
index 0e308c1..29849fd 100644
--- a/src/Workflow/Types.cpp
+++ b/src/Workflow/Types.cpp
@@ -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;
diff --git a/src/Workflow/Types.h b/src/Workflow/Types.h
index 87a4943..e2430b8 100644
--- a/src/Workflow/Types.h
+++ b/src/Workflow/Types.h
@@ -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
{
More information about the Vlmc-devel
mailing list