annotate osx/include/opus/opus_defines.h @ 69:7aeed7906520

Add Opus sources and macOS builds
author Chris Cannam
date Wed, 23 Jan 2019 13:48:08 +0000
parents
children
rev   line source
Chris@69 1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited
Chris@69 2 Written by Jean-Marc Valin and Koen Vos */
Chris@69 3 /*
Chris@69 4 Redistribution and use in source and binary forms, with or without
Chris@69 5 modification, are permitted provided that the following conditions
Chris@69 6 are met:
Chris@69 7
Chris@69 8 - Redistributions of source code must retain the above copyright
Chris@69 9 notice, this list of conditions and the following disclaimer.
Chris@69 10
Chris@69 11 - Redistributions in binary form must reproduce the above copyright
Chris@69 12 notice, this list of conditions and the following disclaimer in the
Chris@69 13 documentation and/or other materials provided with the distribution.
Chris@69 14
Chris@69 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Chris@69 16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Chris@69 17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Chris@69 18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
Chris@69 19 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Chris@69 20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Chris@69 21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Chris@69 22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Chris@69 23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Chris@69 24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Chris@69 25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Chris@69 26 */
Chris@69 27
Chris@69 28 /**
Chris@69 29 * @file opus_defines.h
Chris@69 30 * @brief Opus reference implementation constants
Chris@69 31 */
Chris@69 32
Chris@69 33 #ifndef OPUS_DEFINES_H
Chris@69 34 #define OPUS_DEFINES_H
Chris@69 35
Chris@69 36 #include "opus_types.h"
Chris@69 37
Chris@69 38 #ifdef __cplusplus
Chris@69 39 extern "C" {
Chris@69 40 #endif
Chris@69 41
Chris@69 42 /** @defgroup opus_errorcodes Error codes
Chris@69 43 * @{
Chris@69 44 */
Chris@69 45 /** No error @hideinitializer*/
Chris@69 46 #define OPUS_OK 0
Chris@69 47 /** One or more invalid/out of range arguments @hideinitializer*/
Chris@69 48 #define OPUS_BAD_ARG -1
Chris@69 49 /** Not enough bytes allocated in the buffer @hideinitializer*/
Chris@69 50 #define OPUS_BUFFER_TOO_SMALL -2
Chris@69 51 /** An internal error was detected @hideinitializer*/
Chris@69 52 #define OPUS_INTERNAL_ERROR -3
Chris@69 53 /** The compressed data passed is corrupted @hideinitializer*/
Chris@69 54 #define OPUS_INVALID_PACKET -4
Chris@69 55 /** Invalid/unsupported request number @hideinitializer*/
Chris@69 56 #define OPUS_UNIMPLEMENTED -5
Chris@69 57 /** An encoder or decoder structure is invalid or already freed @hideinitializer*/
Chris@69 58 #define OPUS_INVALID_STATE -6
Chris@69 59 /** Memory allocation has failed @hideinitializer*/
Chris@69 60 #define OPUS_ALLOC_FAIL -7
Chris@69 61 /**@}*/
Chris@69 62
Chris@69 63 /** @cond OPUS_INTERNAL_DOC */
Chris@69 64 /**Export control for opus functions */
Chris@69 65
Chris@69 66 #ifndef OPUS_EXPORT
Chris@69 67 # if defined(WIN32)
Chris@69 68 # if defined(OPUS_BUILD) && defined(DLL_EXPORT)
Chris@69 69 # define OPUS_EXPORT __declspec(dllexport)
Chris@69 70 # else
Chris@69 71 # define OPUS_EXPORT
Chris@69 72 # endif
Chris@69 73 # elif defined(__GNUC__) && defined(OPUS_BUILD)
Chris@69 74 # define OPUS_EXPORT __attribute__ ((visibility ("default")))
Chris@69 75 # else
Chris@69 76 # define OPUS_EXPORT
Chris@69 77 # endif
Chris@69 78 #endif
Chris@69 79
Chris@69 80 # if !defined(OPUS_GNUC_PREREQ)
Chris@69 81 # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
Chris@69 82 # define OPUS_GNUC_PREREQ(_maj,_min) \
Chris@69 83 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
Chris@69 84 # else
Chris@69 85 # define OPUS_GNUC_PREREQ(_maj,_min) 0
Chris@69 86 # endif
Chris@69 87 # endif
Chris@69 88
Chris@69 89 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
Chris@69 90 # if OPUS_GNUC_PREREQ(3,0)
Chris@69 91 # define OPUS_RESTRICT __restrict__
Chris@69 92 # elif (defined(_MSC_VER) && _MSC_VER >= 1400)
Chris@69 93 # define OPUS_RESTRICT __restrict
Chris@69 94 # else
Chris@69 95 # define OPUS_RESTRICT
Chris@69 96 # endif
Chris@69 97 #else
Chris@69 98 # define OPUS_RESTRICT restrict
Chris@69 99 #endif
Chris@69 100
Chris@69 101 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
Chris@69 102 # if OPUS_GNUC_PREREQ(2,7)
Chris@69 103 # define OPUS_INLINE __inline__
Chris@69 104 # elif (defined(_MSC_VER))
Chris@69 105 # define OPUS_INLINE __inline
Chris@69 106 # else
Chris@69 107 # define OPUS_INLINE
Chris@69 108 # endif
Chris@69 109 #else
Chris@69 110 # define OPUS_INLINE inline
Chris@69 111 #endif
Chris@69 112
Chris@69 113 /**Warning attributes for opus functions
Chris@69 114 * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
Chris@69 115 * some paranoid null checks. */
Chris@69 116 #if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
Chris@69 117 # define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
Chris@69 118 #else
Chris@69 119 # define OPUS_WARN_UNUSED_RESULT
Chris@69 120 #endif
Chris@69 121 #if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
Chris@69 122 # define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x)))
Chris@69 123 #else
Chris@69 124 # define OPUS_ARG_NONNULL(_x)
Chris@69 125 #endif
Chris@69 126
Chris@69 127 /** These are the actual Encoder CTL ID numbers.
Chris@69 128 * They should not be used directly by applications.
Chris@69 129 * In general, SETs should be even and GETs should be odd.*/
Chris@69 130 #define OPUS_SET_APPLICATION_REQUEST 4000
Chris@69 131 #define OPUS_GET_APPLICATION_REQUEST 4001
Chris@69 132 #define OPUS_SET_BITRATE_REQUEST 4002
Chris@69 133 #define OPUS_GET_BITRATE_REQUEST 4003
Chris@69 134 #define OPUS_SET_MAX_BANDWIDTH_REQUEST 4004
Chris@69 135 #define OPUS_GET_MAX_BANDWIDTH_REQUEST 4005
Chris@69 136 #define OPUS_SET_VBR_REQUEST 4006
Chris@69 137 #define OPUS_GET_VBR_REQUEST 4007
Chris@69 138 #define OPUS_SET_BANDWIDTH_REQUEST 4008
Chris@69 139 #define OPUS_GET_BANDWIDTH_REQUEST 4009
Chris@69 140 #define OPUS_SET_COMPLEXITY_REQUEST 4010
Chris@69 141 #define OPUS_GET_COMPLEXITY_REQUEST 4011
Chris@69 142 #define OPUS_SET_INBAND_FEC_REQUEST 4012
Chris@69 143 #define OPUS_GET_INBAND_FEC_REQUEST 4013
Chris@69 144 #define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014
Chris@69 145 #define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015
Chris@69 146 #define OPUS_SET_DTX_REQUEST 4016
Chris@69 147 #define OPUS_GET_DTX_REQUEST 4017
Chris@69 148 #define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
Chris@69 149 #define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
Chris@69 150 #define OPUS_SET_FORCE_CHANNELS_REQUEST 4022
Chris@69 151 #define OPUS_GET_FORCE_CHANNELS_REQUEST 4023
Chris@69 152 #define OPUS_SET_SIGNAL_REQUEST 4024
Chris@69 153 #define OPUS_GET_SIGNAL_REQUEST 4025
Chris@69 154 #define OPUS_GET_LOOKAHEAD_REQUEST 4027
Chris@69 155 /* #define OPUS_RESET_STATE 4028 */
Chris@69 156 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029
Chris@69 157 #define OPUS_GET_FINAL_RANGE_REQUEST 4031
Chris@69 158 #define OPUS_GET_PITCH_REQUEST 4033
Chris@69 159 #define OPUS_SET_GAIN_REQUEST 4034
Chris@69 160 #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
Chris@69 161 #define OPUS_SET_LSB_DEPTH_REQUEST 4036
Chris@69 162 #define OPUS_GET_LSB_DEPTH_REQUEST 4037
Chris@69 163 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
Chris@69 164 #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
Chris@69 165 #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
Chris@69 166 #define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042
Chris@69 167 #define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043
Chris@69 168 /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
Chris@69 169 #define OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 4046
Chris@69 170 #define OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST 4047
Chris@69 171
Chris@69 172 /** Defines for the presence of extended APIs. */
Chris@69 173 #define OPUS_HAVE_OPUS_PROJECTION_H
Chris@69 174
Chris@69 175 /* Macros to trigger compilation errors when the wrong types are provided to a CTL */
Chris@69 176 #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
Chris@69 177 #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
Chris@69 178 #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
Chris@69 179 #define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
Chris@69 180 /** @endcond */
Chris@69 181
Chris@69 182 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface
Chris@69 183 * @see opus_genericctls, opus_encoderctls
Chris@69 184 * @{
Chris@69 185 */
Chris@69 186 /* Values for the various encoder CTLs */
Chris@69 187 #define OPUS_AUTO -1000 /**<Auto/default setting @hideinitializer*/
Chris@69 188 #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hideinitializer*/
Chris@69 189
Chris@69 190 /** Best for most VoIP/videoconference applications where listening quality and intelligibility matter most
Chris@69 191 * @hideinitializer */
Chris@69 192 #define OPUS_APPLICATION_VOIP 2048
Chris@69 193 /** Best for broadcast/high-fidelity application where the decoded audio should be as close as possible to the input
Chris@69 194 * @hideinitializer */
Chris@69 195 #define OPUS_APPLICATION_AUDIO 2049
Chris@69 196 /** Only use when lowest-achievable latency is what matters most. Voice-optimized modes cannot be used.
Chris@69 197 * @hideinitializer */
Chris@69 198 #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051
Chris@69 199
Chris@69 200 #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */
Chris@69 201 #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */
Chris@69 202 #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hideinitializer*/
Chris@69 203 #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hideinitializer*/
Chris@69 204 #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hideinitializer*/
Chris@69 205 #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/
Chris@69 206 #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/
Chris@69 207
Chris@69 208 #define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from the argument (default) */
Chris@69 209 #define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */
Chris@69 210 #define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */
Chris@69 211 #define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */
Chris@69 212 #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
Chris@69 213 #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
Chris@69 214 #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
Chris@69 215 #define OPUS_FRAMESIZE_80_MS 5007 /**< Use 80 ms frames */
Chris@69 216 #define OPUS_FRAMESIZE_100_MS 5008 /**< Use 100 ms frames */
Chris@69 217 #define OPUS_FRAMESIZE_120_MS 5009 /**< Use 120 ms frames */
Chris@69 218
Chris@69 219 /**@}*/
Chris@69 220
Chris@69 221
Chris@69 222 /** @defgroup opus_encoderctls Encoder related CTLs
Chris@69 223 *
Chris@69 224 * These are convenience macros for use with the \c opus_encode_ctl
Chris@69 225 * interface. They are used to generate the appropriate series of
Chris@69 226 * arguments for that call, passing the correct type, size and so
Chris@69 227 * on as expected for each particular request.
Chris@69 228 *
Chris@69 229 * Some usage examples:
Chris@69 230 *
Chris@69 231 * @code
Chris@69 232 * int ret;
Chris@69 233 * ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO));
Chris@69 234 * if (ret != OPUS_OK) return ret;
Chris@69 235 *
Chris@69 236 * opus_int32 rate;
Chris@69 237 * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate));
Chris@69 238 *
Chris@69 239 * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
Chris@69 240 * @endcode
Chris@69 241 *
Chris@69 242 * @see opus_genericctls, opus_encoder
Chris@69 243 * @{
Chris@69 244 */
Chris@69 245
Chris@69 246 /** Configures the encoder's computational complexity.
Chris@69 247 * The supported range is 0-10 inclusive with 10 representing the highest complexity.
Chris@69 248 * @see OPUS_GET_COMPLEXITY
Chris@69 249 * @param[in] x <tt>opus_int32</tt>: Allowed values: 0-10, inclusive.
Chris@69 250 *
Chris@69 251 * @hideinitializer */
Chris@69 252 #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_int(x)
Chris@69 253 /** Gets the encoder's complexity configuration.
Chris@69 254 * @see OPUS_SET_COMPLEXITY
Chris@69 255 * @param[out] x <tt>opus_int32 *</tt>: Returns a value in the range 0-10,
Chris@69 256 * inclusive.
Chris@69 257 * @hideinitializer */
Chris@69 258 #define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, __opus_check_int_ptr(x)
Chris@69 259
Chris@69 260 /** Configures the bitrate in the encoder.
Chris@69 261 * Rates from 500 to 512000 bits per second are meaningful, as well as the
Chris@69 262 * special values #OPUS_AUTO and #OPUS_BITRATE_MAX.
Chris@69 263 * The value #OPUS_BITRATE_MAX can be used to cause the codec to use as much
Chris@69 264 * rate as it can, which is useful for controlling the rate by adjusting the
Chris@69 265 * output buffer size.
Chris@69 266 * @see OPUS_GET_BITRATE
Chris@69 267 * @param[in] x <tt>opus_int32</tt>: Bitrate in bits per second. The default
Chris@69 268 * is determined based on the number of
Chris@69 269 * channels and the input sampling rate.
Chris@69 270 * @hideinitializer */
Chris@69 271 #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __opus_check_int(x)
Chris@69 272 /** Gets the encoder's bitrate configuration.
Chris@69 273 * @see OPUS_SET_BITRATE
Chris@69 274 * @param[out] x <tt>opus_int32 *</tt>: Returns the bitrate in bits per second.
Chris@69 275 * The default is determined based on the
Chris@69 276 * number of channels and the input
Chris@69 277 * sampling rate.
Chris@69 278 * @hideinitializer */
Chris@69 279 #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __opus_check_int_ptr(x)
Chris@69 280
Chris@69 281 /** Enables or disables variable bitrate (VBR) in the encoder.
Chris@69 282 * The configured bitrate may not be met exactly because frames must
Chris@69 283 * be an integer number of bytes in length.
Chris@69 284 * @see OPUS_GET_VBR
Chris@69 285 * @see OPUS_SET_VBR_CONSTRAINT
Chris@69 286 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 287 * <dl>
Chris@69 288 * <dt>0</dt><dd>Hard CBR. For LPC/hybrid modes at very low bit-rate, this can
Chris@69 289 * cause noticeable quality degradation.</dd>
Chris@69 290 * <dt>1</dt><dd>VBR (default). The exact type of VBR is controlled by
Chris@69 291 * #OPUS_SET_VBR_CONSTRAINT.</dd>
Chris@69 292 * </dl>
Chris@69 293 * @hideinitializer */
Chris@69 294 #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __opus_check_int(x)
Chris@69 295 /** Determine if variable bitrate (VBR) is enabled in the encoder.
Chris@69 296 * @see OPUS_SET_VBR
Chris@69 297 * @see OPUS_GET_VBR_CONSTRAINT
Chris@69 298 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 299 * <dl>
Chris@69 300 * <dt>0</dt><dd>Hard CBR.</dd>
Chris@69 301 * <dt>1</dt><dd>VBR (default). The exact type of VBR may be retrieved via
Chris@69 302 * #OPUS_GET_VBR_CONSTRAINT.</dd>
Chris@69 303 * </dl>
Chris@69 304 * @hideinitializer */
Chris@69 305 #define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, __opus_check_int_ptr(x)
Chris@69 306
Chris@69 307 /** Enables or disables constrained VBR in the encoder.
Chris@69 308 * This setting is ignored when the encoder is in CBR mode.
Chris@69 309 * @warning Only the MDCT mode of Opus currently heeds the constraint.
Chris@69 310 * Speech mode ignores it completely, hybrid mode may fail to obey it
Chris@69 311 * if the LPC layer uses more bitrate than the constraint would have
Chris@69 312 * permitted.
Chris@69 313 * @see OPUS_GET_VBR_CONSTRAINT
Chris@69 314 * @see OPUS_SET_VBR
Chris@69 315 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 316 * <dl>
Chris@69 317 * <dt>0</dt><dd>Unconstrained VBR.</dd>
Chris@69 318 * <dt>1</dt><dd>Constrained VBR (default). This creates a maximum of one
Chris@69 319 * frame of buffering delay assuming a transport with a
Chris@69 320 * serialization speed of the nominal bitrate.</dd>
Chris@69 321 * </dl>
Chris@69 322 * @hideinitializer */
Chris@69 323 #define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
Chris@69 324 /** Determine if constrained VBR is enabled in the encoder.
Chris@69 325 * @see OPUS_SET_VBR_CONSTRAINT
Chris@69 326 * @see OPUS_GET_VBR
Chris@69 327 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 328 * <dl>
Chris@69 329 * <dt>0</dt><dd>Unconstrained VBR.</dd>
Chris@69 330 * <dt>1</dt><dd>Constrained VBR (default).</dd>
Chris@69 331 * </dl>
Chris@69 332 * @hideinitializer */
Chris@69 333 #define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, __opus_check_int_ptr(x)
Chris@69 334
Chris@69 335 /** Configures mono/stereo forcing in the encoder.
Chris@69 336 * This can force the encoder to produce packets encoded as either mono or
Chris@69 337 * stereo, regardless of the format of the input audio. This is useful when
Chris@69 338 * the caller knows that the input signal is currently a mono source embedded
Chris@69 339 * in a stereo stream.
Chris@69 340 * @see OPUS_GET_FORCE_CHANNELS
Chris@69 341 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 342 * <dl>
Chris@69 343 * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd>
Chris@69 344 * <dt>1</dt> <dd>Forced mono</dd>
Chris@69 345 * <dt>2</dt> <dd>Forced stereo</dd>
Chris@69 346 * </dl>
Chris@69 347 * @hideinitializer */
Chris@69 348 #define OPUS_SET_FORCE_CHANNELS(x) OPUS_SET_FORCE_CHANNELS_REQUEST, __opus_check_int(x)
Chris@69 349 /** Gets the encoder's forced channel configuration.
Chris@69 350 * @see OPUS_SET_FORCE_CHANNELS
Chris@69 351 * @param[out] x <tt>opus_int32 *</tt>:
Chris@69 352 * <dl>
Chris@69 353 * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd>
Chris@69 354 * <dt>1</dt> <dd>Forced mono</dd>
Chris@69 355 * <dt>2</dt> <dd>Forced stereo</dd>
Chris@69 356 * </dl>
Chris@69 357 * @hideinitializer */
Chris@69 358 #define OPUS_GET_FORCE_CHANNELS(x) OPUS_GET_FORCE_CHANNELS_REQUEST, __opus_check_int_ptr(x)
Chris@69 359
Chris@69 360 /** Configures the maximum bandpass that the encoder will select automatically.
Chris@69 361 * Applications should normally use this instead of #OPUS_SET_BANDWIDTH
Chris@69 362 * (leaving that set to the default, #OPUS_AUTO). This allows the
Chris@69 363 * application to set an upper bound based on the type of input it is
Chris@69 364 * providing, but still gives the encoder the freedom to reduce the bandpass
Chris@69 365 * when the bitrate becomes too low, for better overall quality.
Chris@69 366 * @see OPUS_GET_MAX_BANDWIDTH
Chris@69 367 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 368 * <dl>
Chris@69 369 * <dt>OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
Chris@69 370 * <dt>OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
Chris@69 371 * <dt>OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
Chris@69 372 * <dt>OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
Chris@69 373 * <dt>OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd>
Chris@69 374 * </dl>
Chris@69 375 * @hideinitializer */
Chris@69 376 #define OPUS_SET_MAX_BANDWIDTH(x) OPUS_SET_MAX_BANDWIDTH_REQUEST, __opus_check_int(x)
Chris@69 377
Chris@69 378 /** Gets the encoder's configured maximum allowed bandpass.
Chris@69 379 * @see OPUS_SET_MAX_BANDWIDTH
Chris@69 380 * @param[out] x <tt>opus_int32 *</tt>: Allowed values:
Chris@69 381 * <dl>
Chris@69 382 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
Chris@69 383 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
Chris@69 384 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
Chris@69 385 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
Chris@69 386 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd>
Chris@69 387 * </dl>
Chris@69 388 * @hideinitializer */
Chris@69 389 #define OPUS_GET_MAX_BANDWIDTH(x) OPUS_GET_MAX_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
Chris@69 390
Chris@69 391 /** Sets the encoder's bandpass to a specific value.
Chris@69 392 * This prevents the encoder from automatically selecting the bandpass based
Chris@69 393 * on the available bitrate. If an application knows the bandpass of the input
Chris@69 394 * audio it is providing, it should normally use #OPUS_SET_MAX_BANDWIDTH
Chris@69 395 * instead, which still gives the encoder the freedom to reduce the bandpass
Chris@69 396 * when the bitrate becomes too low, for better overall quality.
Chris@69 397 * @see OPUS_GET_BANDWIDTH
Chris@69 398 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 399 * <dl>
Chris@69 400 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
Chris@69 401 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
Chris@69 402 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
Chris@69 403 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
Chris@69 404 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
Chris@69 405 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd>
Chris@69 406 * </dl>
Chris@69 407 * @hideinitializer */
Chris@69 408 #define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, __opus_check_int(x)
Chris@69 409
Chris@69 410 /** Configures the type of signal being encoded.
Chris@69 411 * This is a hint which helps the encoder's mode selection.
Chris@69 412 * @see OPUS_GET_SIGNAL
Chris@69 413 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 414 * <dl>
Chris@69 415 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
Chris@69 416 * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd>
Chris@69 417 * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd>
Chris@69 418 * </dl>
Chris@69 419 * @hideinitializer */
Chris@69 420 #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __opus_check_int(x)
Chris@69 421 /** Gets the encoder's configured signal type.
Chris@69 422 * @see OPUS_SET_SIGNAL
Chris@69 423 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 424 * <dl>
Chris@69 425 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
Chris@69 426 * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd>
Chris@69 427 * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd>
Chris@69 428 * </dl>
Chris@69 429 * @hideinitializer */
Chris@69 430 #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x)
Chris@69 431
Chris@69 432
Chris@69 433 /** Configures the encoder's intended application.
Chris@69 434 * The initial value is a mandatory argument to the encoder_create function.
Chris@69 435 * @see OPUS_GET_APPLICATION
Chris@69 436 * @param[in] x <tt>opus_int32</tt>: Returns one of the following values:
Chris@69 437 * <dl>
Chris@69 438 * <dt>#OPUS_APPLICATION_VOIP</dt>
Chris@69 439 * <dd>Process signal for improved speech intelligibility.</dd>
Chris@69 440 * <dt>#OPUS_APPLICATION_AUDIO</dt>
Chris@69 441 * <dd>Favor faithfulness to the original input.</dd>
Chris@69 442 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
Chris@69 443 * <dd>Configure the minimum possible coding delay by disabling certain modes
Chris@69 444 * of operation.</dd>
Chris@69 445 * </dl>
Chris@69 446 * @hideinitializer */
Chris@69 447 #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_int(x)
Chris@69 448 /** Gets the encoder's configured application.
Chris@69 449 * @see OPUS_SET_APPLICATION
Chris@69 450 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 451 * <dl>
Chris@69 452 * <dt>#OPUS_APPLICATION_VOIP</dt>
Chris@69 453 * <dd>Process signal for improved speech intelligibility.</dd>
Chris@69 454 * <dt>#OPUS_APPLICATION_AUDIO</dt>
Chris@69 455 * <dd>Favor faithfulness to the original input.</dd>
Chris@69 456 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
Chris@69 457 * <dd>Configure the minimum possible coding delay by disabling certain modes
Chris@69 458 * of operation.</dd>
Chris@69 459 * </dl>
Chris@69 460 * @hideinitializer */
Chris@69 461 #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
Chris@69 462
Chris@69 463 /** Gets the total samples of delay added by the entire codec.
Chris@69 464 * This can be queried by the encoder and then the provided number of samples can be
Chris@69 465 * skipped on from the start of the decoder's output to provide time aligned input
Chris@69 466 * and output. From the perspective of a decoding application the real data begins this many
Chris@69 467 * samples late.
Chris@69 468 *
Chris@69 469 * The decoder contribution to this delay is identical for all decoders, but the
Chris@69 470 * encoder portion of the delay may vary from implementation to implementation,
Chris@69 471 * version to version, or even depend on the encoder's initial configuration.
Chris@69 472 * Applications needing delay compensation should call this CTL rather than
Chris@69 473 * hard-coding a value.
Chris@69 474 * @param[out] x <tt>opus_int32 *</tt>: Number of lookahead samples
Chris@69 475 * @hideinitializer */
Chris@69 476 #define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
Chris@69 477
Chris@69 478 /** Configures the encoder's use of inband forward error correction (FEC).
Chris@69 479 * @note This is only applicable to the LPC layer
Chris@69 480 * @see OPUS_GET_INBAND_FEC
Chris@69 481 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 482 * <dl>
Chris@69 483 * <dt>0</dt><dd>Disable inband FEC (default).</dd>
Chris@69 484 * <dt>1</dt><dd>Enable inband FEC.</dd>
Chris@69 485 * </dl>
Chris@69 486 * @hideinitializer */
Chris@69 487 #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
Chris@69 488 /** Gets encoder's configured use of inband forward error correction.
Chris@69 489 * @see OPUS_SET_INBAND_FEC
Chris@69 490 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 491 * <dl>
Chris@69 492 * <dt>0</dt><dd>Inband FEC disabled (default).</dd>
Chris@69 493 * <dt>1</dt><dd>Inband FEC enabled.</dd>
Chris@69 494 * </dl>
Chris@69 495 * @hideinitializer */
Chris@69 496 #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
Chris@69 497
Chris@69 498 /** Configures the encoder's expected packet loss percentage.
Chris@69 499 * Higher values trigger progressively more loss resistant behavior in the encoder
Chris@69 500 * at the expense of quality at a given bitrate in the absence of packet loss, but
Chris@69 501 * greater quality under loss.
Chris@69 502 * @see OPUS_GET_PACKET_LOSS_PERC
Chris@69 503 * @param[in] x <tt>opus_int32</tt>: Loss percentage in the range 0-100, inclusive (default: 0).
Chris@69 504 * @hideinitializer */
Chris@69 505 #define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, __opus_check_int(x)
Chris@69 506 /** Gets the encoder's configured packet loss percentage.
Chris@69 507 * @see OPUS_SET_PACKET_LOSS_PERC
Chris@69 508 * @param[out] x <tt>opus_int32 *</tt>: Returns the configured loss percentage
Chris@69 509 * in the range 0-100, inclusive (default: 0).
Chris@69 510 * @hideinitializer */
Chris@69 511 #define OPUS_GET_PACKET_LOSS_PERC(x) OPUS_GET_PACKET_LOSS_PERC_REQUEST, __opus_check_int_ptr(x)
Chris@69 512
Chris@69 513 /** Configures the encoder's use of discontinuous transmission (DTX).
Chris@69 514 * @note This is only applicable to the LPC layer
Chris@69 515 * @see OPUS_GET_DTX
Chris@69 516 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 517 * <dl>
Chris@69 518 * <dt>0</dt><dd>Disable DTX (default).</dd>
Chris@69 519 * <dt>1</dt><dd>Enabled DTX.</dd>
Chris@69 520 * </dl>
Chris@69 521 * @hideinitializer */
Chris@69 522 #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x)
Chris@69 523 /** Gets encoder's configured use of discontinuous transmission.
Chris@69 524 * @see OPUS_SET_DTX
Chris@69 525 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 526 * <dl>
Chris@69 527 * <dt>0</dt><dd>DTX disabled (default).</dd>
Chris@69 528 * <dt>1</dt><dd>DTX enabled.</dd>
Chris@69 529 * </dl>
Chris@69 530 * @hideinitializer */
Chris@69 531 #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x)
Chris@69 532 /** Configures the depth of signal being encoded.
Chris@69 533 *
Chris@69 534 * This is a hint which helps the encoder identify silence and near-silence.
Chris@69 535 * It represents the number of significant bits of linear intensity below
Chris@69 536 * which the signal contains ignorable quantization or other noise.
Chris@69 537 *
Chris@69 538 * For example, OPUS_SET_LSB_DEPTH(14) would be an appropriate setting
Chris@69 539 * for G.711 u-law input. OPUS_SET_LSB_DEPTH(16) would be appropriate
Chris@69 540 * for 16-bit linear pcm input with opus_encode_float().
Chris@69 541 *
Chris@69 542 * When using opus_encode() instead of opus_encode_float(), or when libopus
Chris@69 543 * is compiled for fixed-point, the encoder uses the minimum of the value
Chris@69 544 * set here and the value 16.
Chris@69 545 *
Chris@69 546 * @see OPUS_GET_LSB_DEPTH
Chris@69 547 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24
Chris@69 548 * (default: 24).
Chris@69 549 * @hideinitializer */
Chris@69 550 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
Chris@69 551 /** Gets the encoder's configured signal depth.
Chris@69 552 * @see OPUS_SET_LSB_DEPTH
Chris@69 553 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
Chris@69 554 * 24 (default: 24).
Chris@69 555 * @hideinitializer */
Chris@69 556 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
Chris@69 557
Chris@69 558 /** Configures the encoder's use of variable duration frames.
Chris@69 559 * When variable duration is enabled, the encoder is free to use a shorter frame
Chris@69 560 * size than the one requested in the opus_encode*() call.
Chris@69 561 * It is then the user's responsibility
Chris@69 562 * to verify how much audio was encoded by checking the ToC byte of the encoded
Chris@69 563 * packet. The part of the audio that was not encoded needs to be resent to the
Chris@69 564 * encoder for the next call. Do not use this option unless you <b>really</b>
Chris@69 565 * know what you are doing.
Chris@69 566 * @see OPUS_GET_EXPERT_FRAME_DURATION
Chris@69 567 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 568 * <dl>
Chris@69 569 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
Chris@69 570 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
Chris@69 571 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd>
Chris@69 572 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
Chris@69 573 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
Chris@69 574 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
Chris@69 575 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
Chris@69 576 * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
Chris@69 577 * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
Chris@69 578 * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
Chris@69 579 * </dl>
Chris@69 580 * @hideinitializer */
Chris@69 581 #define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
Chris@69 582 /** Gets the encoder's configured use of variable duration frames.
Chris@69 583 * @see OPUS_SET_EXPERT_FRAME_DURATION
Chris@69 584 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 585 * <dl>
Chris@69 586 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
Chris@69 587 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
Chris@69 588 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd>
Chris@69 589 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
Chris@69 590 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
Chris@69 591 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
Chris@69 592 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
Chris@69 593 * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
Chris@69 594 * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
Chris@69 595 * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
Chris@69 596 * </dl>
Chris@69 597 * @hideinitializer */
Chris@69 598 #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
Chris@69 599
Chris@69 600 /** If set to 1, disables almost all use of prediction, making frames almost
Chris@69 601 * completely independent. This reduces quality.
Chris@69 602 * @see OPUS_GET_PREDICTION_DISABLED
Chris@69 603 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 604 * <dl>
Chris@69 605 * <dt>0</dt><dd>Enable prediction (default).</dd>
Chris@69 606 * <dt>1</dt><dd>Disable prediction.</dd>
Chris@69 607 * </dl>
Chris@69 608 * @hideinitializer */
Chris@69 609 #define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, __opus_check_int(x)
Chris@69 610 /** Gets the encoder's configured prediction status.
Chris@69 611 * @see OPUS_SET_PREDICTION_DISABLED
Chris@69 612 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 613 * <dl>
Chris@69 614 * <dt>0</dt><dd>Prediction enabled (default).</dd>
Chris@69 615 * <dt>1</dt><dd>Prediction disabled.</dd>
Chris@69 616 * </dl>
Chris@69 617 * @hideinitializer */
Chris@69 618 #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x)
Chris@69 619
Chris@69 620 /**@}*/
Chris@69 621
Chris@69 622 /** @defgroup opus_genericctls Generic CTLs
Chris@69 623 *
Chris@69 624 * These macros are used with the \c opus_decoder_ctl and
Chris@69 625 * \c opus_encoder_ctl calls to generate a particular
Chris@69 626 * request.
Chris@69 627 *
Chris@69 628 * When called on an \c OpusDecoder they apply to that
Chris@69 629 * particular decoder instance. When called on an
Chris@69 630 * \c OpusEncoder they apply to the corresponding setting
Chris@69 631 * on that encoder instance, if present.
Chris@69 632 *
Chris@69 633 * Some usage examples:
Chris@69 634 *
Chris@69 635 * @code
Chris@69 636 * int ret;
Chris@69 637 * opus_int32 pitch;
Chris@69 638 * ret = opus_decoder_ctl(dec_ctx, OPUS_GET_PITCH(&pitch));
Chris@69 639 * if (ret == OPUS_OK) return ret;
Chris@69 640 *
Chris@69 641 * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
Chris@69 642 * opus_decoder_ctl(dec_ctx, OPUS_RESET_STATE);
Chris@69 643 *
Chris@69 644 * opus_int32 enc_bw, dec_bw;
Chris@69 645 * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&enc_bw));
Chris@69 646 * opus_decoder_ctl(dec_ctx, OPUS_GET_BANDWIDTH(&dec_bw));
Chris@69 647 * if (enc_bw != dec_bw) {
Chris@69 648 * printf("packet bandwidth mismatch!\n");
Chris@69 649 * }
Chris@69 650 * @endcode
Chris@69 651 *
Chris@69 652 * @see opus_encoder, opus_decoder_ctl, opus_encoder_ctl, opus_decoderctls, opus_encoderctls
Chris@69 653 * @{
Chris@69 654 */
Chris@69 655
Chris@69 656 /** Resets the codec state to be equivalent to a freshly initialized state.
Chris@69 657 * This should be called when switching streams in order to prevent
Chris@69 658 * the back to back decoding from giving different results from
Chris@69 659 * one at a time decoding.
Chris@69 660 * @hideinitializer */
Chris@69 661 #define OPUS_RESET_STATE 4028
Chris@69 662
Chris@69 663 /** Gets the final state of the codec's entropy coder.
Chris@69 664 * This is used for testing purposes,
Chris@69 665 * The encoder and decoder state should be identical after coding a payload
Chris@69 666 * (assuming no data corruption or software bugs)
Chris@69 667 *
Chris@69 668 * @param[out] x <tt>opus_uint32 *</tt>: Entropy coder state
Chris@69 669 *
Chris@69 670 * @hideinitializer */
Chris@69 671 #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_ptr(x)
Chris@69 672
Chris@69 673 /** Gets the encoder's configured bandpass or the decoder's last bandpass.
Chris@69 674 * @see OPUS_SET_BANDWIDTH
Chris@69 675 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 676 * <dl>
Chris@69 677 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
Chris@69 678 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
Chris@69 679 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
Chris@69 680 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
Chris@69 681 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
Chris@69 682 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd>
Chris@69 683 * </dl>
Chris@69 684 * @hideinitializer */
Chris@69 685 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
Chris@69 686
Chris@69 687 /** Gets the sampling rate the encoder or decoder was initialized with.
Chris@69 688 * This simply returns the <code>Fs</code> value passed to opus_encoder_init()
Chris@69 689 * or opus_decoder_init().
Chris@69 690 * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder.
Chris@69 691 * @hideinitializer
Chris@69 692 */
Chris@69 693 #define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
Chris@69 694
Chris@69 695 /** If set to 1, disables the use of phase inversion for intensity stereo,
Chris@69 696 * improving the quality of mono downmixes, but slightly reducing normal
Chris@69 697 * stereo quality. Disabling phase inversion in the decoder does not comply
Chris@69 698 * with RFC 6716, although it does not cause any interoperability issue and
Chris@69 699 * is expected to become part of the Opus standard once RFC 6716 is updated
Chris@69 700 * by draft-ietf-codec-opus-update.
Chris@69 701 * @see OPUS_GET_PHASE_INVERSION_DISABLED
Chris@69 702 * @param[in] x <tt>opus_int32</tt>: Allowed values:
Chris@69 703 * <dl>
Chris@69 704 * <dt>0</dt><dd>Enable phase inversion (default).</dd>
Chris@69 705 * <dt>1</dt><dd>Disable phase inversion.</dd>
Chris@69 706 * </dl>
Chris@69 707 * @hideinitializer */
Chris@69 708 #define OPUS_SET_PHASE_INVERSION_DISABLED(x) OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, __opus_check_int(x)
Chris@69 709 /** Gets the encoder's configured phase inversion status.
Chris@69 710 * @see OPUS_SET_PHASE_INVERSION_DISABLED
Chris@69 711 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
Chris@69 712 * <dl>
Chris@69 713 * <dt>0</dt><dd>Stereo phase inversion enabled (default).</dd>
Chris@69 714 * <dt>1</dt><dd>Stereo phase inversion disabled.</dd>
Chris@69 715 * </dl>
Chris@69 716 * @hideinitializer */
Chris@69 717 #define OPUS_GET_PHASE_INVERSION_DISABLED(x) OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, __opus_check_int_ptr(x)
Chris@69 718
Chris@69 719 /**@}*/
Chris@69 720
Chris@69 721 /** @defgroup opus_decoderctls Decoder related CTLs
Chris@69 722 * @see opus_genericctls, opus_encoderctls, opus_decoder
Chris@69 723 * @{
Chris@69 724 */
Chris@69 725
Chris@69 726 /** Configures decoder gain adjustment.
Chris@69 727 * Scales the decoded output by a factor specified in Q8 dB units.
Chris@69 728 * This has a maximum range of -32768 to 32767 inclusive, and returns
Chris@69 729 * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment.
Chris@69 730 * This setting survives decoder reset.
Chris@69 731 *
Chris@69 732 * gain = pow(10, x/(20.0*256))
Chris@69 733 *
Chris@69 734 * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB units.
Chris@69 735 * @hideinitializer */
Chris@69 736 #define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x)
Chris@69 737 /** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN
Chris@69 738 *
Chris@69 739 * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB units.
Chris@69 740 * @hideinitializer */
Chris@69 741 #define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
Chris@69 742
Chris@69 743 /** Gets the duration (in samples) of the last packet successfully decoded or concealed.
Chris@69 744 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate).
Chris@69 745 * @hideinitializer */
Chris@69 746 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
Chris@69 747
Chris@69 748 /** Gets the pitch of the last decoded frame, if available.
Chris@69 749 * This can be used for any post-processing algorithm requiring the use of pitch,
Chris@69 750 * e.g. time stretching/shortening. If the last frame was not voiced, or if the
Chris@69 751 * pitch was not coded in the frame, then zero is returned.
Chris@69 752 *
Chris@69 753 * This CTL is only implemented for decoder instances.
Chris@69 754 *
Chris@69 755 * @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not available)
Chris@69 756 *
Chris@69 757 * @hideinitializer */
Chris@69 758 #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x)
Chris@69 759
Chris@69 760 /**@}*/
Chris@69 761
Chris@69 762 /** @defgroup opus_libinfo Opus library information functions
Chris@69 763 * @{
Chris@69 764 */
Chris@69 765
Chris@69 766 /** Converts an opus error code into a human readable string.
Chris@69 767 *
Chris@69 768 * @param[in] error <tt>int</tt>: Error number
Chris@69 769 * @returns Error string
Chris@69 770 */
Chris@69 771 OPUS_EXPORT const char *opus_strerror(int error);
Chris@69 772
Chris@69 773 /** Gets the libopus version string.
Chris@69 774 *
Chris@69 775 * Applications may look for the substring "-fixed" in the version string to
Chris@69 776 * determine whether they have a fixed-point or floating-point build at
Chris@69 777 * runtime.
Chris@69 778 *
Chris@69 779 * @returns Version string
Chris@69 780 */
Chris@69 781 OPUS_EXPORT const char *opus_get_version_string(void);
Chris@69 782 /**@}*/
Chris@69 783
Chris@69 784 #ifdef __cplusplus
Chris@69 785 }
Chris@69 786 #endif
Chris@69 787
Chris@69 788 #endif /* OPUS_DEFINES_H */