uint32_t s1 = src[0];
uint32_t s2 = src[1];
uint32_t s3 = src[2];
- uint32_t s = s1 | (s1 << 8) | (s2 << 16) | (s3 << 24);
- *dst = int(s) * (1.0f / 2147483648.0f);
+ uint32_t s = (s1 << 8) | (s2 << 16) | (s3 << 24); // Note: The bottom eight bits are zero; s3 includes the sign bit.
+ *dst = int(s) * (1.0f / (256.0f * 8388608.0f)); // 256 for signed down-shift by 8, then 2^23 for the actual conversion.
src += 3 * in_num_channels;
dst += out_num_channels;