annotate win32-msvc/include/opus/opus_defines.h @ 76:f3731af47c4b

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