[Vorbis] Block sizes

Tuomo Latto djv at mbnet.fi
Sat Sep 3 17:41:26 PDT 2005


Tony O'Bryan (by way of Tony O'Bryan <stormreaver at direcway.com>) wrote:
>>What you're doing works out to 2^x.  To do x^2, it'd say "(read 4 bits as
>>unsigned integer) exponent 2".
> 
> English and American are notoriously imprecise languages, so no assumptions
> can be safely made when there is any room for ambiguity.  Putting "exponent
> 2" before or after the parentheses may or may not be intended to alter any
> given author's intent.  The author may merely just be speaking an odd dialect
> as far as any arbitrary reader is concerned.  On a personal note, I cannot
> recall having ever heard a shift operation expressed like that.
> 
> A clearer statement would be something like, "(read 4 bits as unsigned
> integer); shift 1 left this number of bits."

This is not much of an improvement.
It concerns itself with implementation details by talking about bit shifts.

How about this?
"Read 4 bits as unsigned integer x. Then calculate 2^x, where ^ denotes the
calculation of power (eg. 2^3 = 8)."
Of course if the all the markings are explained in some specific place,
then you can forget everything after that comma.

I admit I know nothing about contents otherwise, so save your flame, but
maybe the purpose of this choice/operation should be explained a bit more.
Has this maybe something to do with saving bits and and FFT/DCT/MDCT, which
AFAICR are operations that pretty much require sizes to be 1<<n (, so that
using more bits is waste of space)?


>>Note that 1 << x is probably much faster than 2^x in hardware.
> 
> Without question.  However, there is nothing guaranteeing the reader that the
> specs are driven by raw speed at this point.  All a new reader can do is to
> interpret the specs as written since he is not privy to the designer's
> private thoughts and intents, or to the benefit of retrospect.

Specs should never be written for speed. All optimizations for the
source code should be noted separately as suggestions or recommendations
in the specs. And these should be shown after the more readable pseudocode
showing the maths or logic behind it all.
For example, if describing quicksort, a readable pseudocode written at
suitable level of abstraction is infinitely more useful than fully optimised
code for it. (Well, at least for someone not familiar with subject, that is.)
That is not to say that the latter shouldn't be presented as an example, though.


-- 
Tuomo

... Want a stupid answer? Ask me anything!



More information about the Vorbis mailing list