Commit 840f5f12 authored by Monty's avatar Monty
Browse files

Update oggenc and manpage to deal with new rate management.

svn path=/trunk/vorbis-tools/; revision=5729
parent 314ad64d
......@@ -46,46 +46,41 @@ int oe_write_page(ogg_page *page, FILE *fp);
static void set_advanced_encoder_options(adv_opt *opts, int count,
vorbis_info *vi)
int hard = 0;
int avg = 0;
struct ovectl_ratemanage_arg ai;
int manage = 0;
struct ovectl_ratemanage2_arg ai;
int i;
double dval;
long lval;
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_GET, &ai);
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_GET, &ai);
for(i=0; i < count; i++) {
fprintf(stderr, _("Setting advanced encoder option \"%s\" to %s\n"),
opts[i].arg, opts[i].val);
if(!strcmp(opts[i].arg, "bitrate_average_window")) {
avg = 1;
if(!strcmp(opts[i].arg, "bitrate_average_damping")) {
manage = 1;
else if(!strcmp(opts[i].arg, "bitrate_average_window_center")) {
avg = 1;
else if(!strcmp(opts[i].arg, "bitrate_average")) {
manage = 1;
else if(!strcmp(opts[i].arg, "bitrate_average_low")) {
avg = 1;
else if(!strcmp(opts[i].arg, "bit_reservoir_bias")) {
manage = 1;
else if(!strcmp(opts[i].arg, "bitrate_average_high")) {
avg = 1;
else if(!strcmp(opts[i].arg, "bit_reservoir_bits")) {
manage = 1;
else if(!strcmp(opts[i].arg, "bitrate_hard_min")) {
hard = 1;
manage = 1;
else if(!strcmp(opts[i].arg, "bitrate_hard_max")) {
hard = 1;
else if(!strcmp(opts[i].arg, "bitrate_hard_window")) {
hard = 1;
manage = 1;
else if(!strcmp(opts[i].arg, "impulse_noisetune")) {
double val;
......@@ -105,10 +100,8 @@ static void set_advanced_encoder_options(adv_opt *opts, int count,
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_HARD, &ai);
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, &ai);
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, &ai);
int oe_encode(oe_enc_opt *opt)
......@@ -163,14 +156,14 @@ int oe_encode(oe_enc_opt *opt)
/* do we have optional hard quality restrictions? */
if(opt->max_bitrate > 0 || opt->min_bitrate > 0){
struct ovectl_ratemanage_arg ai;
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_GET, &ai);
struct ovectl_ratemanage2_arg ai;
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai);
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, &ai);
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai);
......@@ -188,12 +181,15 @@ int oe_encode(oe_enc_opt *opt)
if(opt->managed && opt->bitrate < 0)
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_AVG, NULL);
struct ovectl_ratemanage2_arg ai;
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai);
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai);
else if(!opt->managed)
/* Turn off management entirely (if it was turned on). */
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, NULL);
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, NULL);
set_advanced_encoder_options(opt->advopt, opt->advopt_count, &vi);
.\" Process this file with
.\" groff -man -Tascii oggenc.1
.TH oggenc 1 "2003 September 1" " Foundation" "Vorbis Tools"
.TH oggenc 1 "2003 December 30" " Foundation" "Vorbis Tools"
oggenc \- encode audio into the Ogg Vorbis format
......@@ -203,13 +203,73 @@ option. These are intended for very advanced users only, and should be
approached with caution. They may significantly degrade audio quality
if misused. Not all these options are currently documented.
.IP "bitrate_average_window=NN"
Set the managed bitrate window to NN seconds. The bitrate will be forced
to the specified average over a floating window of this length. May be
fractional (e.g. 3.5)
.IP "lowpass_frequency=NN"
Set the lowpass frequency to NN kHz.
.IP "lowpass_frequency=N"
Set the lowpass frequency to N kHz.
.IP "impulse_noisetune=N"
Set a noise floor bias N (range from -15. to 0.) for impulse blocks.
A negative bias instructs the encoder to pay special attention to the
crispness of transients in the encoded audio. The tradeoff for better
transient response is a higher bitrate.
.IP "bitrate_hard_max=N"
Set the allowed bitrate maximum for the encoded file to N bits per
second. This bitrate may be exceeded only when there is spare bits
in the bit reservoir; if the bit reservoir is exhausted, frames will
be held under this value. This setting must be used with --managed
to have any effect.
.IP "bitrate_hard_min=N"
Set the allowed bitrate minimum for the encoded file to N bits per
second. This bitrate may be underrun only when the bit reservoir is
not full; if the bit reservoir is full, frames will be held over this
value; if it impossible to add bits constructively, the frame will be
padded with zeroes. This setting must be used with --managed to have
any effect.
.IP "bit_reservoir_bits=N"
Set the total size of the bit reservoir to N bits; the default size of
the reservoir is equal to the nominal number of bits coded in one
second (eg, a nominal 128kbps file will have a bit reservoir of 128000
bits by default). This option must be used with --managed to have any
effect and affects only minimum and maximum bitrate management.
Average bitrate encoding with no hard bitrate boundaries does not use
a bit reservoir.
.IP "bit_reservoir_bias=N"
Set the behavior bias of the bit reservoir (range: 0. to 1.). When
set closer to 0, the bitrate manager attempts to hoard bits for future
use in sudden bitrate increases (biasing toward better transient
reproduction). When set closer to 1, the bitrate manager neglects
transients in favor using bits for homogenous passages. In the
middle, the manager uses a balanced approach. The default setting is \.2,
thus biasing slightly toward transient reproduction.
.IP "bitrate_average=N"
Set the average bitrate for the file to N bits per second. When used
without hard minimum or maximum limits, this option select
reservoirless Average Bit Rate encoding, where the encoder atempts to
perfectly track a desired bitrate, but imposes no stict momentary
fluctuation limits. When used along with a minimum or maximum limit,
the average bitrate still sets the average overall bitrate of the
file, but will work within the bounds set by the bit reservoir. When
the min, max and average bitrates are identical, oggenc produces
Constant Bit Rate vorbis data.
.IP "bitrate_average_damping=N"
Set the reaction time for the average bitrate tracker to N seconds.
This number represents the fastest reaction the bitrate tracker is
allowed to make to hold the bitrate to the selected average. The
faster the reaction time, the less momentary fluctuation in the
bitrate but (generally) the lower quality the audio output. The
slower the reaction time, the larger the ABR fluctuations, but
(generally) the better the audio. When used along with min or max
bitrate limits, this option directly affects how deep and how quickly
the encoder will dip into its bit reservoir; the higher the number,
the more demand on the bit reservoir.
The setting must be greater than zero and the useful range is
approximately \.05 to 10. The default is \.75 seconds.
......@@ -79,7 +79,7 @@ int main(int argc, char **argv)
oe_options opt = {NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL,
0, NULL, 0, NULL, 0, NULL, 0, 1, 0, 0,16,44100,2, 0, NULL,
NULL, 0, -1,-1,-1,.3,-1,0, 0,0.f, 0};
NULL, 0, -1,-1,-1,-.3,-1,0, 0,0.f, 0};
int i;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment