[vorbis] vbr / cbr / abr API calls

Michael Smith msmith at labyrinth.net.au
Sat Aug 3 04:41:13 PDT 2002



At 01:16 PM 8/3/02 +0200, you wrote:
>Hi,
>
>Maybe this is documented somewhere, if so, please send me a link to the 
>documentation.
>
>My question is: how to set up different (VBR, CBR, ABR) modes when 
>calling the Ogg Vorbis API?
>
>Currently I do:
>
>CBR:
>
>     ret = vorbis_encode_setup_managed( &vorbisInfo,
>                                        getInChannel(),
>                                        getOutSampleRate(),
>                                        -1,
>                                        getOutBitrate() * 1000,
>                                        -1)
>        || vorbis_encode_ctl( &vorbisInfo, OV_ECTL_RATEMANAGE_AVG, NULL)
>        || vorbis_encode_setup_init( &vorbisInfo);

This is a fully VBR mode (as for the VBR mode below, but selected by
bitrate). True CBR is more or less completely useless (most other
codecs don't even offer it - even mp3 just fakes it using the bit
reservoir), but can be configured if you want by setting min/max/nom
to the same value. Expect poor performance if you do.

>
>
>ABR:
>
>     ret = vorbis_encode_init( &vorbisInfo,
>                               getInChannel(),
>                               getOutSampleRate(),
>                               -1,
>                               getOutBitrate() * 1000,
>                               -1 );
>
>VBR:
>
>     ret = vorbis_encode_init_vbr( &vorbisInfo,
>                                   getInChannel(),
>                                   getOutSampleRate(),
>                                   getOutQuality() );
>
>
>Are these calls correct?

The latter two are correct.

You can also set hard min (not very useful) and hard max (potentially
very usefu) bitrates for quality-based modes using 
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, ai) (where ai is a
struct ovectl_ratemanage_arg *) with the struct members set 
appropriately (pretty obvious - just look at the struct definition in
vorbisenc.h)

<p><p>>
>What effect do the max_bitrate, min_bitrate parameters have in the CBR 
>and ABR modes?

In managed modes (ABR/CBR are subsets of that), min and max bitrate do
the obvious thing - they set a minimum and maximum bitrate for the
encoder to use.

>
>When measuring performance, it seems that the ABR mode takes a lot more 
>(about twice) processing power than VBR of even CBR. why is that?
>

Managed modes are much slower. The encoder has to do a lot more
work to figure out an encoding whilst also meeting the bitrate
constraints. The reason 'CBR' seemed faster to you was that you weren't
using a CBR mode at all. It's a choice the user has to make - if they
need the hard constraints (which is possible, though rare, for streaming
purposes, and maybe for some other purposes too), then it's worth 
using > twice the cpu.

Michael

<p><p>--- >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-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 mailing list