24-bit wav files and other observations

Daniel J Sebald daniel.sebald at ieee.org
Fri Feb 22 01:40:52 CST 2008


> When the types are "double" then bit-wise ops behave in the range 
> [0..bitmax].  But when the types are "int8" then bit-wise ops behave the 
> way I would expect.  I suppose there is some logic to that, as "floating 
> point" has a more arcane definition to it, i.e., mantisa, exponent.

I implemented a bit-shift version of the 24-bit wav file, i.e.,

  data = data(1:3:end) + data(2:3:end) * 2^8 + cast(typecast(cast(data(3:3:end), 'uint8'), 'int8'), 'double') * 2^16;

  data = bitor(bitor(cast(data(1:3:end), 'int32'), bitshift(cast(data(2:3:end), 'int32'), 8)),  bitshift(cast(typecast(cast(data(3:3:end), 'uint8'), 'int8'), 'int32'), 16));

produce similar results.  The bit-shift/bit-or version, not only being rather ugly, is slower than the multiply/add version by a factor of two.

Therefore, the patch I sent last time still stands... unless Dave can think of anything faster.

Dan


More information about the Octave-maintainers mailing list