Store HaldCLUT as flat RGBx array

Instead of using an `Image16`, which is organized in planes, store the
HaldCLUT in an `AlignedBuffer<std::uint16_t>` with sequential RGBx
values. This gives a speedup of roughly 23% here.
This commit is contained in:
Flössie
2016-04-23 22:46:21 +02:00
parent f639cd6b82
commit b1a9e96836
4 changed files with 131 additions and 89 deletions

View File

@@ -18,9 +18,10 @@
*/
#ifndef _ALIGNEDBUFFER_
#define _ALIGNEDBUFFER_
#include <stdint.h>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <utility>
#include <glibmm.h>
#include "../rtgui/threadutils.h"
@@ -58,7 +59,7 @@ public:
/** @brief Return true if there's no memory allocated
*/
bool isEmpty()
bool isEmpty() const
{
return allocatedSize == 0;
}
@@ -120,28 +121,14 @@ public:
void swap(AlignedBuffer<T> &other)
{
void *tmpReal = other.real;
other.real = real;
real = tmpReal;
char tmpAlignt = other.alignment;
other.alignment = alignment;
alignment = tmpAlignt;
size_t tmpAllocSize = other.allocatedSize;
other.allocatedSize = allocatedSize;
allocatedSize = tmpAllocSize;
T* tmpData = other.data;
other.data = data;
data = tmpData;
bool tmpInUse = other.inUse;
other.inUse = inUse;
inUse = tmpInUse;
std::swap(real, other.real);
std::swap(alignment, other.alignment);
std::swap(allocatedSize, other.allocatedSize);
std::swap(data, other.data);
std::swap(inUse, other.inUse);
}
unsigned int getSize()
unsigned int getSize() const
{
return unitSize ? allocatedSize / unitSize : 0;
}