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