134 |
return 1; |
return 1; |
135 |
} |
} |
136 |
|
|
137 |
static int getSample(sample_t* src, int pos) { |
inline static int getSample(sample_t* src, int pos) { |
138 |
if (BITDEPTH24) { |
if (BITDEPTH24) { |
139 |
pos *= 3; |
pos *= 3; |
140 |
|
#if WORDS_BIGENDIAN |
141 |
unsigned char* p = (unsigned char*)src; |
unsigned char* p = (unsigned char*)src; |
142 |
return p[pos] << 8 | p[pos + 1] << 16 | p[pos + 2] << 24; |
return p[pos] << 8 | p[pos + 1] << 16 | p[pos + 2] << 24; |
143 |
|
#else |
144 |
|
// 24bit read optimization: |
145 |
|
// a misaligned 32bit read and subquent 8 bit shift is faster (on x86) than reading 3 single bytes and shifting them |
146 |
|
return (*((int *)(&((char *)(src))[pos])))<<8; |
147 |
|
#endif |
148 |
} else { |
} else { |
149 |
return src[pos]; |
return src[pos]; |
150 |
} |
} |