[vorbis-dev] Vorbis 1.0 spec notes, part 1

Monty xiphmont at xiph.org
Thu Aug 8 15:47:25 PDT 2002



> * Overview
> -  "int he" -> "in the"

corrected 

> * ilog
> - "returns the *number of* the highest set bit ..."

corrected, and not that the positionm is one-indexed (counted from 1, not zero)

> - (reference vorbis-spec-bitpack.html)
> - "greater than nonzero" -> "greater than zero"

corrected

> - question: ilog defines behavior for signed values. However, it is
> called sometimes with 32-bit unsigned values
> (e.g. codebook_decode). Should I (a) cast all these unsigned values to
> signed, (b) alter ilog to take 32-bit unsigned only, or (c) implement
> ilog as 64-bit?

No, the spec is not concerned with C style typing.  ilog is defined
over binary integers, not a specific integer type.  When called with an
unsigned value, that means it's not possible for the value to be
negative and thus the fact that ilog is defined for negative values is
irrelevant.

<p>> * float32_unpack
> - step 3: "shifted left" -> "shifted right" (right?)

yes, corrected 

> - step 4: "if ( [mantissa] is nonzero )" -> "if ( [sign] is nonzero )"

yes, corrected

> - question: What are the tolerances on this function? Is it acceptable
> for me to cast mantissa to double, multiply it by the double returned
> from pow(2,(dobule)(exponent-788)), and cast the result to float?

yes.

> * lookup1_values
> - given:
>   return_value ^ codebook_dimensions = codebook_entries
> -> is this correct: ? (I'm out of school so my algebra is slacking...)
> -> return_value = log(codebook_entires) / log(codebook_dimensions)
> -> where return_value truncates the double result to int?

It's vital to never ever rely on floating point rounding convention as
you'll get bitten precision problems on specific processors (like
early Pentiums).  The algorithm here must be integer (brute force if
necessary).

The algebra is correct, but the float implementation will bite you.

> vorbis-spec-codebook.html
> * introduce the variable codebook_codeword_lengths earlier

done

> * ordered read, step 4, [n] -> [number]

corrected

> *               step 4, put commas around 'inclusive'

corrected

> * ordered read, step 6, increment *by 1* (nitpick)

Oh, *fine* :0)

Monty
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list