octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 24-bit wav files and other observations


From: Daniel J Sebald
Subject: Re: 24-bit wav files and other observations
Date: Fri, 22 Feb 2008 01:40:52 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020


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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]