Defines

Encoder related CTLs

These are convenience macros for use with the opus_encode_ctl interface. More...

Defines

#define OPUS_SET_COMPLEXITY(x)
 Configures the encoder's computational complexity.
#define OPUS_GET_COMPLEXITY(x)
 Gets the encoder's complexity configuration,.
#define OPUS_SET_BITRATE(x)
 Configures the bitrate in the encoder.
#define OPUS_GET_BITRATE(x)
 Gets the encoder's bitrate configuration,.
#define OPUS_SET_VBR(x)
 Configures VBR in the encoder.
#define OPUS_GET_VBR(x)
 Gets the encoder's VBR configuration,.
#define OPUS_SET_VBR_CONSTRAINT(x)
 Configures constrained VBR in the encoder.
#define OPUS_GET_VBR_CONSTRAINT(x)
 Gets the encoder's constrained VBR configuration.
#define OPUS_SET_FORCE_CHANNELS(x)
 Configures mono/stereo forcing in the encoder.
#define OPUS_GET_FORCE_CHANNELS(x)
 Gets the encoder's forced channel configuration,.
#define OPUS_SET_MAX_BANDWIDTH(x)
 Configures the encoder's maximum bandpass allowed,.
#define OPUS_GET_MAX_BANDWIDTH(x)
 Gets the encoder's configured maximum bandpass allowed,.
#define OPUS_SET_BANDWIDTH(x)
 Configures the encoder's bandpass,.
#define OPUS_SET_SIGNAL(x)
 Configures the type of signal being encoded.
#define OPUS_GET_SIGNAL(x)
 Gets the encoder's configured signal type,.
#define OPUS_SET_APPLICATION(x)
 Configures the encoder's intended application.
#define OPUS_GET_APPLICATION(x)
 Gets the encoder's configured application,.
#define OPUS_GET_LOOKAHEAD(x)
 Gets the total samples of delay added by the entire codec.
#define OPUS_SET_INBAND_FEC(x)
 Configures the encoder's use of inband forward error correction.
#define OPUS_GET_INBAND_FEC(x)
 Gets encoder's configured use of inband forward error correction,.
#define OPUS_SET_PACKET_LOSS_PERC(x)
 Configures the encoder's expected packet loss percentage.
#define OPUS_GET_PACKET_LOSS_PERC(x)
 Gets the encoder's configured packet loss percentage,.
#define OPUS_SET_DTX(x)
 Configures the encoder's use of discontinuous transmission.
#define OPUS_GET_DTX(x)
 Gets encoder's configured use of discontinuous transmission,.

Detailed Description

These are convenience macros for use with the opus_encode_ctl interface.

They are used to generate the appropriate series of arguments for that call, passing the correct type, size and so on as expected for each particular request.

Some usage examples:

 int ret;
 ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO));
 if (ret != OPUS_OK) return ret;

 int rate;
 opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate));

 opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
See also:
Generic CTLs, Opus Encoder

Define Documentation

#define OPUS_GET_APPLICATION (   x  ) 

Gets the encoder's configured application,.

See also:
OPUS_SET_APPLICATION
Parameters:
[out] x int*: Application value
#define OPUS_GET_BITRATE (   x  ) 

Gets the encoder's bitrate configuration,.

See also:
OPUS_SET_BITRATE
Parameters:
[out] x opus_int32*: bitrate in bits per second.
#define OPUS_GET_COMPLEXITY (   x  ) 

Gets the encoder's complexity configuration,.

See also:
OPUS_SET_COMPLEXITY
Parameters:
[out] x int*: 0-10, inclusive
#define OPUS_GET_DTX (   x  ) 

Gets encoder's configured use of discontinuous transmission,.

See also:
OPUS_SET_DTX
Parameters:
[out] x int*: DTX flag
#define OPUS_GET_FORCE_CHANNELS (   x  ) 

Gets the encoder's forced channel configuration,.

See also:
OPUS_SET_FORCE_CHANNELS
Parameters:
[out] x int*: OPUS_AUTO; 0; 1
#define OPUS_GET_INBAND_FEC (   x  ) 

Gets encoder's configured use of inband forward error correction,.

See also:
OPUS_SET_INBAND_FEC
Parameters:
[out] x int*: FEC flag
#define OPUS_GET_LOOKAHEAD (   x  ) 

Gets the total samples of delay added by the entire codec.

This can be queried by the encoder and then the provided number of samples can be skipped on from the start of the decoder's output to provide time aligned input and output. From the perspective of a decoding application the real data begins this many samples late.

The decoder contribution to this delay is identical for all decoders, but the encoder portion of the delay may vary from implementation to implementation, version to version, or even depend on the encoder's initial configuration. Applications needing delay compensation should call this CTL rather than hard-coding a value.

Parameters:
[out] x int*: Number of lookahead samples
#define OPUS_GET_MAX_BANDWIDTH (   x  ) 

Gets the encoder's configured maximum bandpass allowed,.

See also:
OPUS_SET_MAX_BANDWIDTH
Parameters:
[out] x int*: Bandwidth value
#define OPUS_GET_PACKET_LOSS_PERC (   x  ) 

Gets the encoder's configured packet loss percentage,.

See also:
OPUS_SET_PACKET_LOSS_PERC
Parameters:
[out] x int*: Loss percentage in the range 0-100, inclusive.
#define OPUS_GET_SIGNAL (   x  ) 

Gets the encoder's configured signal type,.

See also:
OPUS_SET_SIGNAL
Parameters:
[out] x int*: Signal type
#define OPUS_GET_VBR (   x  ) 

Gets the encoder's VBR configuration,.

See also:
OPUS_SET_VBR
Parameters:
[out] x int*: 0; 1
#define OPUS_GET_VBR_CONSTRAINT (   x  ) 

Gets the encoder's constrained VBR configuration.

See also:
OPUS_SET_VBR_CONSTRAINT
Parameters:
[out] x int*: 0; 1
#define OPUS_SET_APPLICATION (   x  ) 

Configures the encoder's intended application.

The initial value is a mandatory argument to the encoder_create function. The supported values are:

  • OPUS_APPLICATION_VOIP Process signal for improved speech intelligibility
  • OPUS_APPLICATION_AUDIO Favor faithfulness to the original input
  • OPUS_APPLICATION_RESTRICTED_LOWDELAY Configure the minimum possible coding delay
Parameters:
[in] x int: Application value
#define OPUS_SET_BANDWIDTH (   x  ) 

Configures the encoder's bandpass,.

See also:
OPUS_GET_BANDWIDTH The supported values are:
Parameters:
[in] x int: Bandwidth value
#define OPUS_SET_BITRATE (   x  ) 

Configures the bitrate in the encoder.

Rates from 500 to 512000 bits per second are meaningful as well as the special values OPUS_BITRATE_AUTO and OPUS_BITRATE_MAX. The value OPUS_BITRATE_MAX can be used to cause the codec to use as much rate as it can, which is useful for controlling the rate by adjusting the output buffer size.

Parameters:
[in] x opus_int32: bitrate in bits per second.
#define OPUS_SET_COMPLEXITY (   x  ) 

Configures the encoder's computational complexity.

The supported range is 0-10 inclusive with 10 representing the highest complexity. The default value is 10.

Parameters:
[in] x int: 0-10, inclusive
#define OPUS_SET_DTX (   x  ) 

Configures the encoder's use of discontinuous transmission.

Note:
This is only applicable to the LPC layer
Parameters:
[in] x int: DTX flag, 0 (disabled) is default
#define OPUS_SET_FORCE_CHANNELS (   x  ) 

Configures mono/stereo forcing in the encoder.

This is useful when the caller knows that the input signal is currently a mono source embedded in a stereo stream.

Parameters:
[in] x int: OPUS_AUTO (default); 1 (forced mono); 2 (forced stereo)
#define OPUS_SET_INBAND_FEC (   x  ) 

Configures the encoder's use of inband forward error correction.

Note:
This is only applicable to the LPC layer
Parameters:
[in] x int: FEC flag, 0 (disabled) is default
#define OPUS_SET_MAX_BANDWIDTH (   x  ) 

Configures the encoder's maximum bandpass allowed,.

See also:
OPUS_GET_MAX_BANDWIDTH The supported values are:
Parameters:
[in] x int: Bandwidth value
#define OPUS_SET_PACKET_LOSS_PERC (   x  ) 

Configures the encoder's expected packet loss percentage.

Higher values with trigger progressively more loss resistant behavior in the encoder at the expense of quality at a given bitrate in the lossless case, but greater quality under loss.

Parameters:
[in] x int: Loss percentage in the range 0-100, inclusive.
#define OPUS_SET_SIGNAL (   x  ) 

Configures the type of signal being encoded.

This is a hint which helps the encoder's mode selection. The supported values are:

  • OPUS_SIGNAL_AUTO (default)
  • OPUS_SIGNAL_VOICE
  • OPUS_SIGNAL_MUSIC
    Parameters:
    [in] x int: Signal type
#define OPUS_SET_VBR (   x  ) 

Configures VBR in the encoder.

The following values are currently supported:

  • 0 CBR
  • 1 VBR (default) The configured bitrate may not be met exactly because frames must be an integer number of bytes in length.
    Warning:
    Only the MDCT mode of Opus can provide hard CBR behavior.
    Parameters:
    [in] x int: 0; 1 (default)
#define OPUS_SET_VBR_CONSTRAINT (   x  ) 

Configures constrained VBR in the encoder.

The following values are currently supported:

  • 0 Unconstrained VBR (default)
  • 1 Maximum one frame buffering delay assuming transport with a serialization speed of the nominal bitrate This setting is irrelevant when the encoder is in CBR mode.
    Warning:
    Only the MDCT mode of Opus currently heeds the constraint. Speech mode ignores it completely, hybrid mode may fail to obey it if the LPC layer uses more bitrate than the constraint would have permitted.
    Parameters:
    [in] x int: 0 (default); 1
 All Files Functions Typedefs Defines