[Flac-dev] Rice coding parameter

Dan Stowell danstowell at operamail.com
Tue Oct 21 13:25:07 PDT 2003


Date: Sun, 19 Oct 2003 00:59:22 +0200
> On Sat, Oct 18, 2003 at 07:21:08PM +0000, Dan Stowell wrote:
> > I asked a few questions about the flac format a couple of weeks 
ago.
> > One more (if you don't mind) about the Rice coding. The Rice
> > parameter "k" can't be zero (unless I'm mistaken), yet the FLAC spec
> > says the Rice parameter can range from 0 to 15.
> > 
> > I guessed, and tried adding one before using the parameter (i.e.
> > assuming the range was really 1 to 16), and that didn't fix it.
> > 
> > How should I interpret those four little bits?
> 
> The spec is ok, Rice parameter can be 0 to 14, 15 is escape code. And
> Rice parameter 0 means that only the unary part is used. For example
> 000001000010001001011 is -3 2 -2 1 -1 0.

Thanks again Miroslav. So if I understand your example correctly, I can 
interpret a single number in this unary code using

      return ( (q&1)==1 ? -((q>>1)+1) : (q>>1) );

if 'q' is the number of zeroes found before bumping into a 1. Is this a 
standard component of Rice coding, or is it developed for FLAC? I didn't 
read about it when I read up on Rice coding.

Thanks
Dan

-- 
___________________________________________________
OperaMail free e-mail - http://www.operamail.com
OperaMail Premium - 28MB, POP3, more! US$29.99/year

Powered by Outblaze




More information about the Flac-dev mailing list