zenilib: zenilib/jni/external/libvorbis/lib/vorbisenc.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Functions | Variables
vorbisenc.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`
`#include "vorbis/codec.h"`
`#include "vorbis/vorbisenc.h"`
`#include "codec_internal.h"`
`#include "os.h"`
`#include "misc.h"`
`#include "modes/setup_44.h"`
`#include "modes/setup_44u.h"`
`#include "modes/setup_44p51.h"`
`#include "modes/setup_32.h"`
`#include "modes/setup_8.h"`
`#include "modes/setup_11.h"`
`#include "modes/setup_16.h"`
`#include "modes/setup_22.h"`
`#include "modes/setup_X.h"`

Go to the source code of this file.

## Typedefs

typedef struct vp_adjblock | vp_adjblock

## Functions

static int | book_dup_or_new (codec_setup_info *ci, const static_codebook *book)
static const void * | get_setup_template (long ch, long srate, double req, int q_or_bitrate, double *base_setting)
static double | setting_to_approx_bitrate (vorbis_info *vi)
static void | vorbis_encode_ath_setup (vorbis_info *vi, int block)
static void | vorbis_encode_blocksize_setup (vorbis_info *vi, double s, const int *shortb, const int *longb)
static void | vorbis_encode_compand_setup (vorbis_info *vi, double s, int block, const compandblock *in, const double *x)
int | vorbis_encode_ctl (vorbis_info *vi, int number, void *arg)
static void | vorbis_encode_floor_setup (vorbis_info *vi, int s, const static_codebook *const *const *const books, const vorbis_info_floor1 *in, const int *x)
static void | vorbis_encode_global_psych_setup (vorbis_info *vi, double s, const vorbis_info_psy_global *in, const double *x)
static void | vorbis_encode_global_stereo (vorbis_info *vi, const highlevel_encode_setup *const hi, const adj_stereo *p)
int | vorbis_encode_init (vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate)
int | vorbis_encode_init_vbr (vorbis_info *vi, long channels, long rate, float base_quality)
static void | vorbis_encode_map_n_res_setup (vorbis_info *vi, double s, const vorbis_mapping_template *maps)
static void | vorbis_encode_noisebias_setup (vorbis_info *vi, double s, int block, const int *suppress, const noise3 *in, const noiseguard *guard, double userbias)
static void | vorbis_encode_peak_setup (vorbis_info *vi, double s, int block, const int *suppress)
static void | vorbis_encode_psyset_setup (vorbis_info *vi, double s, const int *nn_start, const int *nn_partition, const double *nn_thresh, int block)
static void | vorbis_encode_residue_setup (vorbis_info *vi, int number, int block, const vorbis_residue_template *res)
int | vorbis_encode_setup_init (vorbis_info *vi)
int | vorbis_encode_setup_managed (vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate)
static void | vorbis_encode_setup_setting (vorbis_info *vi, long channels, long rate)
int | vorbis_encode_setup_vbr (vorbis_info *vi, long channels, long rate, float quality)
static void | vorbis_encode_tonemask_setup (vorbis_info *vi, double s, int block, const att3 *att, const int *max, const vp_adjblock *in)

## Variables

static const vorbis_info_mapping0 | _map_nominal [2]
static const vorbis_info_mode | _mode_template [2]
static const ve_setup_data_template *const | setup_list []

## Typedef Documentation

typedef struct vp_adjblock vp_adjblock

## Function Documentation

static int book_dup_or_new | ( | codec_setup_info * | ci,
|  | const static_codebook * | book
| ) |  |

static

Definition at line 435 of file vorbisenc.c.

References codec_setup_info::book_param, codec_setup_info::books, and i.

Referenced by vorbis_encode_residue_setup().

static const void* get_setup_template | ( | long | ch,
|  | long | srate,
|  | double | req,
|  | int | q_or_bitrate,
|  | double * | base_setting
| ) |  |

static

Definition at line 633 of file vorbisenc.c.

References i, j, low, map, NULL, and setup_list.

Referenced by vorbis_encode_ctl(), vorbis_encode_setup_managed(), and vorbis_encode_setup_vbr().

static double setting_to_approx_bitrate | ( | vorbis_info * | vi | ) |

static

Definition at line 618 of file vorbisenc.c.

References highlevel_encode_setup::base_setting, vorbis_info::channels, vorbis_info::codec_setup, cordic::hi, codec_setup_info::hi, NULL, and highlevel_encode_setup::setup.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_ath_setup | ( | vorbis_info * | vi,
|  | int | block
| ) |  |

static

Definition at line 425 of file vorbisenc.c.

References highlevel_encode_setup::ath_absolute_dB, vorbis_info_psy::ath_adjatt, highlevel_encode_setup::ath_floating_dB, vorbis_info_psy::ath_maxatt, vorbis_info::codec_setup, codec_setup_info::hi, and codec_setup_info::psy_param.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_blocksize_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | const int * | shortb,
|  | const int * | longb
| ) |  |

static

Definition at line 443 of file vorbisenc.c.

References codec_setup_info::blocksizes, and vorbis_info::codec_setup.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_compand_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | int | block,
|  | const compandblock * | in,
|  | const double * | x
| ) |  |

static

Definition at line 359 of file vorbisenc.c.

References vorbis_info::codec_setup, i, int, NOISE_COMPAND_LEVELS, vorbis_info_psy::noisecompand, and codec_setup_info::psy_param.

Referenced by vorbis_encode_setup_init().

int vorbis_encode_ctl | ( | vorbis_info * | vi,
|  | int | number,
|  | void * | arg
| ) |  |

This function implements a generic interface to miscellaneous encoder settings similar to the classic UNIX 'ioctl()' system call. Applications may use vorbis_encode_ctl() to query or set bitrate management or quality mode details by using one of several request arguments detailed below. vorbis_encode_ctl() must be called after one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used to modify settings, vorbis_encode_ctl() must be called before vorbis_encode_setup_init().

Parameters

  vi | Pointer to an initialized vorbis_info struct.
  number | Specifies the desired action; See the listof available requests".
  arg | void * pointing to a data structure matching the request argument.

Return values

  0 | Success. Any further return information (such as the result of a query) is placed into the storage pointed to by *arg.
  OV_EINVAL | Invalid argument, or an attempt to modify a setting after calling vorbis_encode_setup_init().
  OV_EIMPL | Unimplemented or unknown request

Definition at line 1013 of file vorbisenc.c.

References highlevel_encode_setup::base_setting, highlevel_encode_setup::bitrate_av, highlevel_encode_setup::bitrate_av_damp, ovectl_ratemanage_arg::bitrate_av_hi, ovectl_ratemanage_arg::bitrate_av_lo, ovectl_ratemanage_arg::bitrate_av_window, ovectl_ratemanage_arg::bitrate_av_window_center, ovectl_ratemanage2_arg::bitrate_average_damping, ovectl_ratemanage2_arg::bitrate_average_kbps, ovectl_ratemanage_arg::bitrate_hard_max, ovectl_ratemanage_arg::bitrate_hard_min, ovectl_ratemanage_arg::bitrate_hard_window, ovectl_ratemanage2_arg::bitrate_limit_max_kbps, ovectl_ratemanage2_arg::bitrate_limit_min_kbps, ovectl_ratemanage2_arg::bitrate_limit_reservoir_bias, ovectl_ratemanage2_arg::bitrate_limit_reservoir_bits, highlevel_encode_setup::bitrate_max, highlevel_encode_setup::bitrate_min, highlevel_encode_setup::bitrate_reservoir, highlevel_encode_setup::bitrate_reservoir_bias, vorbis_info::channels, vorbis_info::codec_setup, highlevel_encode_setup::coupling_p, get_setup_template(), cordic::hi, codec_setup_info::hi, highlevel_encode_setup::impulse_noisetune, highlevel_encode_setup::lowpass_altered, highlevel_encode_setup::lowpass_kHz, highlevel_encode_setup::managed, ovectl_ratemanage_arg::management_active, ovectl_ratemanage2_arg::management_active, NULL, OV_ECTL_COUPLING_GET, OV_ECTL_COUPLING_SET, OV_ECTL_IBLOCK_GET, OV_ECTL_IBLOCK_SET, OV_ECTL_LOWPASS_GET, OV_ECTL_LOWPASS_SET, OV_ECTL_RATEMANAGE2_GET, OV_ECTL_RATEMANAGE2_SET, OV_ECTL_RATEMANAGE_AVG, OV_ECTL_RATEMANAGE_GET, OV_ECTL_RATEMANAGE_HARD, OV_ECTL_RATEMANAGE_SET, OV_EIMPL, OV_EINVAL, vorbis_info::rate, highlevel_encode_setup::req, highlevel_encode_setup::set_in_stone, highlevel_encode_setup::setup, vorbis_encode_ctl(), and vorbis_encode_setup_setting().

Referenced by vorbis_encode_ctl().

static void vorbis_encode_floor_setup | ( | vorbis_info * | vi,
|  | int | s,
|  | const static_codebook *const *const *const | books,
|  | const vorbis_info_floor1 * | in,
|  | const int * | x
| ) |  |

static

Definition at line 190 of file vorbisenc.c.

References _ogg_calloc, codec_setup_info::book_param, codec_setup_info::books, vorbis_info_floor1::class_book, vorbis_info_floor1::class_subbook, vorbis_info_floor1::class_subs, vorbis_info::codec_setup, codec_setup_info::floor_param, codec_setup_info::floor_type, codec_setup_info::floors, i, k, memcpy, vorbis_info_floor1::partitionclass, and vorbis_info_floor1::partitions.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_global_psych_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | const vorbis_info_psy_global * | in,
|  | const double * | x
| ) |  |

static

Definition at line 228 of file vorbisenc.c.

References highlevel_encode_setup::amplitude_track_dBpersec, vorbis_info_psy_global::ampmax_att_per_sec, vorbis_info::codec_setup, codec_setup_info::hi, i, int, memcpy, vorbis_info_psy_global::postecho_thresh, vorbis_info_psy_global::preecho_thresh, and codec_setup_info::psy_g_param.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_global_stereo | ( | vorbis_info * | vi,
|  | const highlevel_encode_setup *const | hi,
|  | const adj_stereo * | p
| ) |  |

static

Definition at line 255 of file vorbisenc.c.

References codec_setup_info::blocksizes, vorbis_info::codec_setup, vorbis_info_psy_global::coupling_pkHz, vorbis_info_psy_global::coupling_pointlimit, vorbis_info_psy_global::coupling_postpointamp, vorbis_info_psy_global::coupling_prepointamp, i, highlevel_encode_setup::managed, memcpy, PACKETBLOBS, codec_setup_info::psy_g_param, vorbis_info::rate, vorbis_info_psy_global::sliding_lowpass, and highlevel_encode_setup::stereo_point_setting.

Referenced by vorbis_encode_setup_init().

int vorbis_encode_init | ( | vorbis_info * | vi,
|  | long | channels,
|  | long | rate,
|  | long | max_bitrate,
|  | long | nominal_bitrate,
|  | long | min_bitrate
| ) |  |

This is the primary function within libvorbisenc for setting up managed bitrate modes.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear() should be called.

The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set constraints for the encoded file. This function uses these settings to select the appropriate encoding mode and set it up.

Parameters

  vi | Pointer to an initialized vorbis_info struct.
  channels | The number of channels to be encoded.
  rate | The sampling rate of the source audio.
  max_bitrate | Desired maximum bitrate (limit). -1 indicates unset.
  nominal_bitrate | Desired average, or central, bitrate. -1 indicates unset.
  min_bitrate | Desired minimum bitrate. -1 indicates unset.

Returns
  Zero for success, and negative values for failure.

Return values

  0 | Success.
  OV_EFAULT | Internal logic fault; indicates a bug or heap/stack corruption.
  OV_EINVAL | Invalid setup request, eg, out of range argument.
  OV_EIMPL | Unimplemented mode; unable to comply with bitrate request.

Definition at line 990 of file vorbisenc.c.

References ret, vorbis_encode_setup_init(), vorbis_encode_setup_managed(), and vorbis_info_clear().

int vorbis_encode_init_vbr | ( | vorbis_info * | vi,
|  | long | channels,
|  | long | rate,
|  | float | base_quality
| ) |  |

This is the primary function within libvorbisenc for setting up variable bitrate ("quality" based) modes.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear() should be called.

Parameters

  vi | Pointer to an initialized vorbis_info struct.
  channels | The number of channels to be encoded.
  rate | The sampling rate of the source audio.
  base_quality | Desired quality level, currently from -0.1 to 1.0 (lo to hi).

Returns
  Zero for success, or a negative number for failure.

Return values

  0 | Success
  OV_EFAULT | Internal logic fault; indicates a bug or heap/stack corruption.
  OV_EINVAL | Invalid setup request, eg, out of range argument.
  OV_EIMPL | Unimplemented mode; unable to comply with quality level request.

Definition at line 923 of file vorbisenc.c.

References ret, vorbis_encode_setup_init(), vorbis_encode_setup_vbr(), and vorbis_info_clear().

static void vorbis_encode_map_n_res_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | const vorbis_mapping_template * | maps
| ) |  |

static

Definition at line 589 of file vorbisenc.c.

References _mode_template, _ogg_calloc, codec_setup_info::blocksizes, vorbis_info::codec_setup, i, j, map, codec_setup_info::map_param, codec_setup_info::map_type, codec_setup_info::maps, memcpy, codec_setup_info::mode_param, codec_setup_info::modes, vorbis_info_mapping0::submaps, and vorbis_encode_residue_setup().

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_noisebias_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | int | block,
|  | const int * | suppress,
|  | const noise3 * | in,
|  | const noiseguard * | guard,
|  | double | userbias
| ) |  |

static

Definition at line 393 of file vorbisenc.c.

References vorbis_info::codec_setup, i, j, min, vorbis_info_psy::noisemaxsupp, vorbis_info_psy::noiseoff, vorbis_info_psy::noisewindowfixed, vorbis_info_psy::noisewindowhimin, vorbis_info_psy::noisewindowlomin, P_BANDS, P_NOISECURVES, and codec_setup_info::psy_param.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_peak_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | int | block,
|  | const int * | suppress
| ) |  |

static

Definition at line 381 of file vorbisenc.c.

References vorbis_info::codec_setup, codec_setup_info::psy_param, and vorbis_info_psy::tone_abs_limit.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_psyset_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | const int * | nn_start,
|  | const int * | nn_partition,
|  | const double * | nn_thresh,
|  | int | block
| ) |  |

static

Definition at line 304 of file vorbisenc.c.

References _ogg_calloc, _psy_info_template, vorbis_info_psy::blockflag, vorbis_info::codec_setup, cordic::hi, codec_setup_info::hi, memcpy, highlevel_encode_setup::noise_normalize_p, vorbis_info_psy::normal_p, vorbis_info_psy::normal_partition, vorbis_info_psy::normal_start, vorbis_info_psy::normal_thresh, codec_setup_info::psy_param, and codec_setup_info::psys.

Referenced by vorbis_encode_setup_init().

static void vorbis_encode_residue_setup | ( | vorbis_info * | vi,
|  | int | number,
|  | int | block,
|  | const vorbis_residue_template * | res
| ) |  |

static

Definition at line 456 of file vorbisenc.c.

References _ogg_malloc, codec_setup_info::blocksizes, book_dup_or_new(), codec_setup_info::book_param, vorbis_info_residue0::booklist, codec_setup_info::books, vorbis_info::channels, vorbis_info_mapping0::chmuxlist, vorbis_info::codec_setup, vorbis_info_psy_global::coupling_pkHz, vorbis_info_residue0::end, codec_setup_info::floor_param, vorbis_info_residue0::groupbook, vorbis_info_residue0::grouping, codec_setup_info::hi, i, int, j, k, highlevel_encode_setup::lowpass_kHz, highlevel_encode_setup::managed, codec_setup_info::map_param, codec_setup_info::maps, memcpy, vorbis_info_floor1::n, PACKETBLOBS, vorbis_info_residue0::partitions, codec_setup_info::psy_g_param, vorbis_info::rate, codec_setup_info::residue_param, codec_setup_info::residue_type, codec_setup_info::residues, vorbis_info_mapping0::residuesubmap, and vorbis_info_residue0::secondstages.

Referenced by vorbis_encode_map_n_res_setup().

int vorbis_encode_setup_init | ( | vorbis_info * | vi | ) |

This function performs the last stage of three-step encoding setup, as described in the API overview under managed bitrate modes.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API, one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() called to initialize the high-level encoding setup, and vorbis_encode_ctl() called if necessary to make encoding setup changes. vorbis_encode_setup_init() finalizes the highlevel encoding structure into a complete encoding setup after which the application may make no further setup changes.

After encoding, vorbis_info_clear() should be called.

Parameters

  vi | Pointer to an initialized vorbis_info struct.

Returns
  Zero for success, and negative values for failure.

Return values

  0 | Success.
  OV_EFAULT | Internal logic fault; indicates a bug or heap/stack corruption.
  OV_EINVAL | Attempt to use vorbis_encode_setup_init() without first calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to initialize the high-level encoding setup

Definition at line 681 of file vorbisenc.c.

References highlevel_encode_setup::amplitude_track_dBpersec, highlevel_encode_setup::ath_floating_dB, bitrate_manager_info::avg_rate, highlevel_encode_setup::base_setting, codec_setup_info::bi, highlevel_encode_setup::bitrate_av, highlevel_encode_setup::bitrate_av_damp, vorbis_info::bitrate_lower, highlevel_encode_setup::bitrate_max, highlevel_encode_setup::bitrate_min, vorbis_info::bitrate_nominal, highlevel_encode_setup::bitrate_reservoir, highlevel_encode_setup::bitrate_reservoir_bias, vorbis_info::bitrate_upper, vorbis_info::bitrate_window, highlevel_encode_setup::block, codec_setup_info::blocksizes, vorbis_info::codec_setup, cordic::hi, codec_setup_info::hi, i, highlevel_encode_setup::impulse_block_p, highlevel_encode_setup::impulse_noisetune, highlevel_encode_setup::managed, bitrate_manager_info::max_rate, bitrate_manager_info::min_rate, highlevel_byblocktype::noise_bias_setting, highlevel_byblocktype::noise_compand_setting, NULL, OV_EINVAL, bitrate_manager_info::reservoir_bias, bitrate_manager_info::reservoir_bits, highlevel_encode_setup::set_in_stone, setting_to_approx_bitrate(), highlevel_encode_setup::setup, bitrate_manager_info::slew_damp, highlevel_byblocktype::tone_mask_setting, highlevel_byblocktype::tone_peaklimit_setting, highlevel_encode_setup::trigger_setting, vorbis_encode_ath_setup(), vorbis_encode_blocksize_setup(), vorbis_encode_compand_setup(), vorbis_encode_floor_setup(), vorbis_encode_global_psych_setup(), vorbis_encode_global_stereo(), vorbis_encode_map_n_res_setup(), vorbis_encode_noisebias_setup(), vorbis_encode_peak_setup(), vorbis_encode_psyset_setup(), and vorbis_encode_tonemask_setup().

Referenced by vorbis_encode_init(), and vorbis_encode_init_vbr().

int vorbis_encode_setup_managed | ( | vorbis_info * | vi,
|  | long | channels,
|  | long | rate,
|  | long | max_bitrate,
|  | long | nominal_bitrate,
|  | long | min_bitrate
| ) |  |

This function performs step-one of a three-step bitrate-managed encode setup. It functions similarly to the one-step setup performed by vorbis_encode_init but allows an application to make further encode setup tweaks using vorbis_encode_ctl before finally calling vorbis_encode_setup_init to complete the setup process.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear() should be called.

The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set constraints for the encoded file. This function uses these settings to select the appropriate encoding mode and set it up.

Parameters

  vi | Pointer to an initialized vorbis_info struct.
  channels | The number of channels to be encoded.
  rate | The sampling rate of the source audio.
  max_bitrate | Desired maximum bitrate (limit). -1 indicates unset.
  nominal_bitrate | Desired average, or central, bitrate. -1 indicates unset.
  min_bitrate | Desired minimum bitrate. -1 indicates unset.

Returns
  Zero for success, and negative for failure.

Return values

  0 | Success
  OV_EFAULT | Internal logic fault; indicates a bug or heap/stack corruption.
  OV_EINVAL | Invalid setup request, eg, out of range argument.
  OV_EIMPL | Unimplemented mode; unable to comply with bitrate request.

Definition at line 943 of file vorbisenc.c.

References highlevel_encode_setup::base_setting, highlevel_encode_setup::bitrate_av, highlevel_encode_setup::bitrate_av_damp, highlevel_encode_setup::bitrate_max, highlevel_encode_setup::bitrate_min, highlevel_encode_setup::bitrate_reservoir, highlevel_encode_setup::bitrate_reservoir_bias, vorbis_info::codec_setup, highlevel_encode_setup::coupling_p, get_setup_template(), cordic::hi, codec_setup_info::hi, highlevel_encode_setup::managed, OV_EIMPL, OV_EINVAL, highlevel_encode_setup::req, highlevel_encode_setup::setup, and vorbis_encode_setup_setting().

Referenced by vorbis_encode_init().

static void vorbis_encode_setup_setting | ( | vorbis_info * | vi,
|  | long | channels,
|  | long | rate
| ) |  |

static

Definition at line 861 of file vorbisenc.c.

References highlevel_encode_setup::amplitude_track_dBpersec, highlevel_encode_setup::ath_absolute_dB, highlevel_encode_setup::ath_floating_dB, highlevel_encode_setup::base_setting, highlevel_encode_setup::block, vorbis_info::channels, vorbis_info::codec_setup, cordic::hi, codec_setup_info::hi, i, highlevel_encode_setup::impulse_block_p, highlevel_encode_setup::lowpass_altered, highlevel_encode_setup::lowpass_kHz, highlevel_byblocktype::noise_bias_setting, highlevel_byblocktype::noise_compand_setting, highlevel_encode_setup::noise_normalize_p, vorbis_info::rate, highlevel_encode_setup::setup, highlevel_encode_setup::stereo_point_setting, highlevel_byblocktype::tone_mask_setting, highlevel_byblocktype::tone_peaklimit_setting, highlevel_encode_setup::trigger_setting, and vorbis_info::version.

Referenced by vorbis_encode_ctl(), vorbis_encode_setup_managed(), and vorbis_encode_setup_vbr().

int vorbis_encode_setup_vbr | ( | vorbis_info * | vi,
|  | long | channels,
|  | long | rate,
|  | float | quality
| ) |  |

This function performs step-one of a three-step variable bitrate (quality-based) encode setup. It functions similarly to the one-step setup performed by vorbis_encode_init_vbr() but allows an application to make further encode setup tweaks using vorbis_encode_ctl() before finally calling vorbis_encode_setup_init to complete the setup process.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear() should be called.

Parameters

  vi | Pointer to an initialized vorbis_info struct.
  channels | The number of channels to be encoded.
  rate | The sampling rate of the source audio.
  quality | Desired quality level, currently from -0.1 to 1.0 (lo to hi).

Returns
  Zero for success, and negative values for failure.

Return values

  0 | Success
  OV_EFAULT | Internal logic fault; indicates a bug or heap/stack corruption.
  OV_EINVAL | Invalid setup request, eg, out of range argument.
  OV_EIMPL | Unimplemented mode; unable to comply with quality level request.

Definition at line 902 of file vorbisenc.c.

References highlevel_encode_setup::base_setting, vorbis_info::codec_setup, highlevel_encode_setup::coupling_p, get_setup_template(), cordic::hi, codec_setup_info::hi, highlevel_encode_setup::managed, OV_EIMPL, highlevel_encode_setup::req, highlevel_encode_setup::setup, and vorbis_encode_setup_setting().

Referenced by vorbis_encode_init_vbr().

static void vorbis_encode_tonemask_setup | ( | vorbis_info * | vi,
|  | double | s,
|  | int | block,
|  | const att3 * | att,
|  | const int * | max,
|  | const vp_adjblock * | in
| ) |  |

static

Definition at line 334 of file vorbisenc.c.

References vorbis_info::codec_setup, i, vorbis_info_psy::max_curve_dB, P_BANDS, codec_setup_info::psy_param, vorbis_info_psy::tone_centerboost, vorbis_info_psy::tone_decay, vorbis_info_psy::tone_masteratt, and vorbis_info_psy::toneatt.

Referenced by vorbis_encode_setup_init().

## Variable Documentation

const vorbis_info_mapping0 _map_nominal[2]

static

Initial value:
={
{1, {0,0}, {0}, {0}, 1,{0},{1}},
{1, {0,0}, {1}, {1}, 1,{0},{1}}
}

Definition at line 150 of file vorbisenc.c.

const vorbis_info_mode _mode_template[2]

static

Initial value:
={
{0,0,0,0},
{1,0,0,1}
}

Definition at line 145 of file vorbisenc.c.

Referenced by vorbis_encode_map_n_res_setup().

const ve_setup_data_template* const setup_list[]

static

Initial value:
={
&ve_setup_44_stereo,
&ve_setup_44_51,
&ve_setup_44_uncoupled,
&ve_setup_32_stereo,
&ve_setup_32_uncoupled,
&ve_setup_22_stereo,
&ve_setup_22_uncoupled,
&ve_setup_16_stereo,
&ve_setup_16_uncoupled,
&ve_setup_11_stereo,
&ve_setup_11_uncoupled,
&ve_setup_8_stereo,
&ve_setup_8_uncoupled,
&ve_setup_X_stereo,
&ve_setup_X_uncoupled,
&ve_setup_XX_stereo,
&ve_setup_XX_uncoupled,
0
}
ve_setup_XX_stereo
static const ve_setup_data_template ve_setup_XX_stereo
Definition: setup_X.h:125
ve_setup_32_uncoupled
static const ve_setup_data_template ve_setup_32_uncoupled
Definition: setup_32.h:83
ve_setup_44_uncoupled
static const ve_setup_data_template ve_setup_44_uncoupled
Definition: setup_44u.h:25
ve_setup_44_stereo
static const ve_setup_data_template ve_setup_44_stereo
Definition: setup_44.h:68
ve_setup_11_uncoupled
static const ve_setup_data_template ve_setup_11_uncoupled
Definition: setup_11.h:94
ve_setup_XX_uncoupled
static const ve_setup_data_template ve_setup_XX_uncoupled
Definition: setup_X.h:176
ve_setup_44_51
static const ve_setup_data_template ve_setup_44_51
Definition: setup_44p51.h:25
ve_setup_8_stereo
static const ve_setup_data_template ve_setup_8_stereo
Definition: setup_8.h:49
ve_setup_11_stereo
static const ve_setup_data_template ve_setup_11_stereo
Definition: setup_11.h:43
ve_setup_22_stereo
static const ve_setup_data_template ve_setup_22_stereo
Definition: setup_22.h:28
ve_setup_22_uncoupled
static const ve_setup_data_template ve_setup_22_uncoupled
Definition: setup_22.h:79
ve_setup_16_stereo
static const ve_setup_data_template ve_setup_16_stereo
Definition: setup_16.h:53
ve_setup_32_stereo
static const ve_setup_data_template ve_setup_32_stereo
Definition: setup_32.h:32
ve_setup_X_stereo
static const ve_setup_data_template ve_setup_X_stereo
Definition: setup_X.h:23
ve_setup_8_uncoupled
static const ve_setup_data_template ve_setup_8_uncoupled
Definition: setup_8.h:100
ve_setup_16_uncoupled
static const ve_setup_data_template ve_setup_16_uncoupled
Definition: setup_16.h:104
ve_setup_X_uncoupled
static const ve_setup_data_template ve_setup_X_uncoupled
Definition: setup_X.h:74

Definition at line 165 of file vorbisenc.c.

Referenced by get_setup_template().