23#if !defined SOCONVERSION_H
29#include <Inventor/STL/vector>
33#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64)
37#if ( __GNUC__ == 3 && __GNUC_MINOR__ == 2 )
43# include <xmmintrin.h>
44# include <emmintrin.h>
73 static void initClass();
77 static void exitClass();
134 const size_t size,
const float dataMin,
const float dataMax );
145 const size_t size,
const float dataMin,
const float dataMax );
211 virtual void mapDataRangeToIndex(
214 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
215 const double undefinedValue = std::numeric_limits<double>::quiet_NaN() );
221 virtual void mapDataToIndex(
224 const int numSigBits );
230 virtual void mapDataRangeToRgba(
233 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
234 SoBufferObject *rgbaBufferObject,
const int numRgba, MappingMethod rgbaMapping );
240 virtual void mapDataToRgba(
243 const int numSigBits,
244 SoBufferObject *rgbaBufferObject,
const int numRgba, MappingMethod mapping );
267 template <
typename DataClassIn>
268 static void cpuMapDataRangeToIndex(
const void *srcData,
void *dstData,
270 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
271 const double undefinedValue = std::numeric_limits<double>::quiet_NaN()
278 template <
typename DataClassIn,
typename DataClassOut>
279 static void cpuMapDataRangeToIndexTempl(
280 const void *src,
void *dst,
const size_t bufferSize,
281 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
282 const double undefinedValue = std::numeric_limits<double>::quiet_NaN()
289 template <
typename DataClassIn,
typename DataClassOut>
290 static void cpuMapDataRangeToIndexTemplSSE(
291 const void *src,
void *dst,
const size_t bufferSize,
292 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap
299 template <
typename DataClassIn>
300 static void cpuMapDataRangeToRgba(
301 const void *src,
void *dst,
const size_t bufferSize,
302 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
303 const unsigned int *rgba,
const int numRgba, MappingMethod mapping
310 template <
typename DataClassIn>
311 static void cpuMapDataToIndex(
const void *srcData,
void *dstData,
320 template <
typename DataClassIn,
typename DataClassOut>
321 static void cpuMapDataToIndexTempl(
322 const void *src,
void *dst,
const size_t bufferSize,
330 template <
typename DataClassIn>
331 static void cpuMapDataToRgba(
332 const void *src,
void *dst,
const size_t bufferSize,
333 const int numSigBits,
334 const unsigned int *rgba,
const int numRgba, MappingMethod mapping
340 template <
typename DataClassIn>
341 static void cpuMapDataRangeToIndex(
const void *srcData,
void *dstData,
343 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
344 const int shift,
const int offset
349 template <
typename DataClassIn,
typename DataClassOut>
350 static void cpuMapDataRangeToIndexTempl(
351 const void *src,
void *dst,
const size_t bufferSize,
352 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
353 const int shift,
const int offset
358 template <
typename DataClassIn,
typename DataClassOut>
359 static void cpuMapDataRangeToIndexTemplSSE(
360 const void *src,
void *dst,
const size_t bufferSize,
361 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
362 const int shift,
const int offset
365 template <
typename DataClassIn>
366 static void SSE_loadRegister( DataClassIn*& ptr, __m128& reg );
368 template <
typename DataClassOut>
369 static void SSE_unloadRegister( __m128& regA, __m128& regB, DataClassOut*& ptr );
373 template <
typename DataClassIn>
374 static void cpuMapDataRangeToRgba(
375 const void *src,
void *dst,
const size_t bufferSize,
376 const double dataRangeMin,
const double dataRangeMax,
const bool dataRangeMap,
377 const int shift,
const int offset,
378 const unsigned int *rgba,
const int numRgba, MappingMethod mapping
383 template <
typename DataClassIn>
384 static void cpuMapDataToIndex(
const void *srcData,
void *dstData,
386 const int numSigBits,
const int shift,
const int offset
391 template <
typename DataClassIn,
typename DataClassOut>
392 static void cpuMapDataToIndexTempl(
393 const void *src,
void *dst,
const size_t bufferSize,
394 const int numSigBits,
const int shift,
const int offset
399 template <
typename DataClassIn>
400 static void cpuMapDataToRgba(
401 const void *src,
void *dst,
const size_t bufferSize,
402 const int numSigBits,
const int shift,
const int offset,
403 const unsigned int *rgba,
const int numRgba, MappingMethod mapping
408 static void convertBitSetToByteSSE(
unsigned char* packedTile,
unsigned char* unpackedTile, uint64_t
size);
410 static void convertBitSetToByteStd(
unsigned char* packedTile,
unsigned char* unpackedTile, uint64_t
size);
413 static bool s_useSSE;
Class encoding a data type.
DataType
Supported Data type.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Type conversion ...
int convertFloatToRGBA(SoCpuBufferObject *sourceBufferObject, SoCpuBufferObject *targetBufferObject, const size_t size, const float dataMin, const float dataMax)
Convert FLOAT data stored in a buffer to RGBA data.
virtual int convertFloatToRGBA(SoBufferObject *sourceBufferObject, SoBufferObject *targetBufferObject, const size_t size, const float dataMin, const float dataMax)
Convert FLOAT data stored in a buffer to (grayscale) RGBA data.
SoConversion()
SoConversion constructor.
virtual int convert(SoBufferObject *sourceBufferObject, const SbDataType src_type, SoBufferObject *targetBufferObject, const SbDataType dst_type, const size_t size)
Convert the data in a buffer object from one data type to another one.
int convert(SoCpuBufferObject *sourceBufferObject, const SbDataType src_type, SoCpuBufferObject *targetBufferObject, const SbDataType dst_type, const size_t size)
Convert the data in a buffer object from one data type to another one.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...