10 const uint8_t * s =
reinterpret_cast<const uint8_t*
>(sourcePtr);
23 const uint8_t * s =
reinterpret_cast<const uint8_t*
>(sourcePtr);
32 const unsigned fractionBits = 10;
33 const unsigned widthBits = 16;
34 typedef uint16_t source_t;
43 typedef uint32_t out_t;
typedef float retval_t;
47 outExponentShift = (1 << (outExponent-1))-1
50 const unsigned exponentBits = widthBits - fractionBits - 1;
52 source_t fraction = source & (((source_t)1 << fractionBits)-1);
53 source >>= fractionBits;
54 int exponent = (int)( source & (((source_t)1 << exponentBits)-1) ) - (
int)((1 << (exponentBits-1))-1);
55 source >>= exponentBits;
57 if (outExponent + outExponentShift <= 0)
return 0;
59 out_t
output = (out_t)( source&1 );
60 output <<= outExponent;
61 output |= (unsigned) (exponent + outExponentShift) & ( (1<<outExponent) - 1 );
62 output <<= outFraction;
63 int shift = (int) outFraction - (
int) fractionBits;
64 if (shift < 0) output |= (out_t) (fraction >> -shift);
65 else output |= (out_t) (fraction << shift);
static const bool byte_order_is_little_endian
static audio_sample decodeFloat24ptr(const void *sourcePtr)
static const audio_sample float16scale
static audio_sample decodeFloat24ptrbs(const void *sourcePtr)
static audio_sample decodeFloat16(uint16_t source)