[vorbis-dev] lib/block.c question

Erik Kruus kruus at duck.com
Thu Aug 24 21:23:07 PDT 2000



I'm starting in on documenting bits of vorbis (I'ld like to work on
low bit rates someday). 
1. Can others doing documentation tell me what they're working on?
  Please e-mail me directly. I'ld rather my efforts were coordinated
  with yours!
2. In lib/block.c, I do not understand the rationale for the choice of
largebound in the case of vd.W being a short window (vd.W==0). The question
is at the end, as well as my thinking as to what it ought to be.

(alpha-version uncorrected bkgd info for now...)
'largebound' is used in the envelope search, which does:
1.3.4 lib/envelope.c line 178: long _ve_envelope_search(&vd, long largebound)

1. Reallocate storage for the IIR-filtered versions of the raw data
  channels, if necessary.

2. Play catch-up on the IIR-filtered versions. Extend 'em as far as
  we have data.

3. Search forwards in the filtered data from the minimal starting point
  j for a short block until the searchpoint argument:

  (a) Does the power in a [small] envelope at j change from the preceding
    envelope-sized block to the envelope-sized block at j by more
    than vd.vi->preecho_thresh? If so, impose a short block (well
    I suppose it could be the largest block with approx. a 3/4 mark
    at that point, but vorbis only has two blocksizes max, so the
    choice is easy. Return 0 if the power variation in some channel
    is too big.

  (b) increment j by half the smallest blocksize (vd.vi->blocksizes[0]/2)

  (c) if j gets past largebound, assign a large window and return 1.

  (d) repeat unless we've run out of filtered data, in which case return -1.

Returning to vorbis_analysis_blockout in lib/block.c, we see what how
the largebound parameter is chosen:

For the large block W [using the 3/4-pt to 1/4-pt overlap rule that seems
to be implied by the code],

``stop searching when j gets to the midpoint of a short block following
a long block.''
        largebound = centerW + B/4 (to get to 3/4-pt of W)
                             + B/2 (to get to 3/4-pt of a big nW)
                             + S/4 (to get to mid-pt of a small nnW)

This make sense and is in the code. BUT the formula for the small W case
seems incorrect (and much too big)

I would rather say: (S=small blocksize, B=big blocksize, W is S, nW
is B, nnW is S)

        largebound = centerW + S/4 (to get to 3/4-pt of W)
                             + B/2 (to get to 3/4-pt of overlapped nW)
                             + S/4 (to get to the max of a small nnW).
Instead, block.c uses centerW + B*3/4 + S*3/4.
Ouch.  Do we really hate to switch to large windows -that- much?
Or is there some rationale that I'm missing here.

Thanks, Erik.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list