Re: Converting fixed point numbers

Rob Leslie <[email protected]> Sat, 12 Jul 2008 13:07:04 -0700
Newsgroups gmane.comp.audio.mad.devel
Message-ID <[email protected]>
On Jul 12, 2008, at 10:56 AM, Reiner wrote:
> madplay uses the following in audio_linear_round
>
> /* quantize and scale */
> return sample >> (MAD_F_FRACBITS + 1 - bits);
>
> if bits is 16 (unsigned short e,g) we will shift 13 bits, whats  
> about the 3 MSB bits ???
>
> With this I think only the first digit of the whole part is taken,  
> what is with the sign and the other 2 digits from the whole part,  
> are they never used?

The whole part is used to represent samples that are above full scale  
[-1.0, 1.0) but madplay clips these prior to scaling, so at this point  
the whole part just contains copies of the sign bit.

-- 
Rob Leslie
[email protected]