Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: include/opus_custom.h

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/opus.h ('k') | include/opus_defines.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2007-2008 CSIRO 1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation 2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Copyright (c) 2008-2012 Gregory Maxwell 3 Copyright (c) 2008-2012 Gregory Maxwell
4 Written by Jean-Marc Valin and Gregory Maxwell */ 4 Written by Jean-Marc Valin and Gregory Maxwell */
5 /* 5 /*
6 Redistribution and use in source and binary forms, with or without 6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions 7 modification, are permitted provided that the following conditions
8 are met: 8 are met:
9 9
10 - Redistributions of source code must retain the above copyright 10 - Redistributions of source code must retain the above copyright
(...skipping 24 matching lines...) Expand all
35 #ifndef OPUS_CUSTOM_H 35 #ifndef OPUS_CUSTOM_H
36 #define OPUS_CUSTOM_H 36 #define OPUS_CUSTOM_H
37 37
38 #include "opus_defines.h" 38 #include "opus_defines.h"
39 39
40 #ifdef __cplusplus 40 #ifdef __cplusplus
41 extern "C" { 41 extern "C" {
42 #endif 42 #endif
43 43
44 #ifdef CUSTOM_MODES 44 #ifdef CUSTOM_MODES
45 #define OPUS_CUSTOM_EXPORT OPUS_EXPORT 45 # define OPUS_CUSTOM_EXPORT OPUS_EXPORT
46 #define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT 46 # define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
47 #else 47 #else
48 #define OPUS_CUSTOM_EXPORT 48 # define OPUS_CUSTOM_EXPORT
49 #ifdef CELT_C 49 # ifdef OPUS_BUILD
50 #define OPUS_CUSTOM_EXPORT_STATIC static inline 50 # define OPUS_CUSTOM_EXPORT_STATIC static inline
51 #else 51 # else
52 #define OPUS_CUSTOM_EXPORT_STATIC 52 # define OPUS_CUSTOM_EXPORT_STATIC
53 #endif 53 # endif
54 #endif 54 #endif
55 55
56 /** @defgroup opus_custom Opus Custom 56 /** @defgroup opus_custom Opus Custom
57 * @{ 57 * @{
58 * Opus Custom is an optional part of the Opus specification and 58 * Opus Custom is an optional part of the Opus specification and
59 * reference implementation which uses a distinct API from the regular 59 * reference implementation which uses a distinct API from the regular
60 * API and supports frame sizes that are not normally supported.\ Use 60 * API and supports frame sizes that are not normally supported.\ Use
61 * of Opus Custom is discouraged for all but very special applications 61 * of Opus Custom is discouraged for all but very special applications
62 * for which a frame size different from 2.5, 5, 10, or 20 ms is needed 62 * for which a frame size different from 2.5, 5, 10, or 20 ms is needed
63 * (for either complexity or latency reasons) and where interoperability 63 * (for either complexity or latency reasons) and where interoperability
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * @return A newly created mode 119 * @return A newly created mode
120 */ 120 */
121 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_crea te(opus_int32 Fs, int frame_size, int *error); 121 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_crea te(opus_int32 Fs, int frame_size, int *error);
122 122
123 /** Destroys a mode struct. Only call this after all encoders and 123 /** Destroys a mode struct. Only call this after all encoders and
124 * decoders using this mode are destroyed as well. 124 * decoders using this mode are destroyed as well.
125 * @param [in] mode <tt>OpusCustomMode*</tt>: Mode to be freed. 125 * @param [in] mode <tt>OpusCustomMode*</tt>: Mode to be freed.
126 */ 126 */
127 OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode); 127 OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode);
128 128
129
130 #if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C)
131
129 /* Encoder */ 132 /* Encoder */
130 /** Gets the size of an OpusCustomEncoder structure. 133 /** Gets the size of an OpusCustomEncoder structure.
131 * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration 134 * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration
132 * @param [in] channels <tt>int</tt>: Number of channels 135 * @param [in] channels <tt>int</tt>: Number of channels
133 * @returns size 136 * @returns size
134 */ 137 */
135 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si ze( 138 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si ze(
136 const OpusCustomMode *mode, 139 const OpusCustomMode *mode,
137 int channels 140 int channels
138 ) OPUS_ARG_NONNULL(1); 141 ) OPUS_ARG_NONNULL(1);
139 142
140 /** Creates a new encoder state. Each stream needs its own encoder
141 * state (can't be shared across simultaneous streams).
142 * @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information abou t the characteristics of
143 * the stream (must be the same characteristics as used for the
144 * decoder)
145 * @param [in] channels <tt>int</tt>: Number of channels
146 * @param [out] error <tt>int*</tt>: Returns an error code
147 * @return Newly created encoder state.
148 */
149 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encode r_create(
150 const OpusCustomMode *mode,
151 int channels,
152 int *error
153 ) OPUS_ARG_NONNULL(1);
154
155 /** Initializes a previously allocated encoder state 143 /** Initializes a previously allocated encoder state
156 * The memory pointed to by st must be the size returned by opus_custom_encoder _get_size. 144 * The memory pointed to by st must be the size returned by opus_custom_encoder _get_size.
157 * This is intended for applications which use their own allocator instead of m alloc. 145 * This is intended for applications which use their own allocator instead of m alloc.
158 * @see opus_custom_encoder_create(),opus_custom_encoder_get_size() 146 * @see opus_custom_encoder_create(),opus_custom_encoder_get_size()
159 * To reset a previously initialized state use the OPUS_RESET_STATE CTL. 147 * To reset a previously initialized state use the OPUS_RESET_STATE CTL.
160 * @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state 148 * @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state
161 * @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information abo ut the characteristics of 149 * @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information abo ut the characteristics of
162 * the stream (must be the same characteristics as used for the 150 * the stream (must be the same characteristics as used for the
163 * decoder) 151 * decoder)
164 * @param [in] channels <tt>int</tt>: Number of channels 152 * @param [in] channels <tt>int</tt>: Number of channels
165 * @return OPUS_OK Success or @ref opus_errorcodes 153 * @return OPUS_OK Success or @ref opus_errorcodes
166 */ 154 */
167 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init( 155 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init(
168 OpusCustomEncoder *st, 156 OpusCustomEncoder *st,
169 const OpusCustomMode *mode, 157 const OpusCustomMode *mode,
170 int channels 158 int channels
171 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); 159 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
172 160
161 #endif
162
163
164 /** Creates a new encoder state. Each stream needs its own encoder
165 * state (can't be shared across simultaneous streams).
166 * @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information abou t the characteristics of
167 * the stream (must be the same characteristics as used for the
168 * decoder)
169 * @param [in] channels <tt>int</tt>: Number of channels
170 * @param [out] error <tt>int*</tt>: Returns an error code
171 * @return Newly created encoder state.
172 */
173 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encode r_create(
174 const OpusCustomMode *mode,
175 int channels,
176 int *error
177 ) OPUS_ARG_NONNULL(1);
178
179
173 /** Destroys a an encoder state. 180 /** Destroys a an encoder state.
174 * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed. 181 * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed.
175 */ 182 */
176 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st); 183 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
177 184
178 /** Encodes a frame of audio. 185 /** Encodes a frame of audio.
179 * @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state 186 * @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state
180 * @param [in] pcm <tt>float*</tt>: PCM audio in float format, with a normal ra nge of +/-1.0. 187 * @param [in] pcm <tt>float*</tt>: PCM audio in float format, with a normal ra nge of +/-1.0.
181 * Samples with a range beyond +/-1.0 are supported but will 188 * Samples with a range beyond +/-1.0 are supported but will
182 * be clipped by decoders using the integer API and should 189 * be clipped by decoders using the integer API and should
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); 229 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
223 230
224 /** Perform a CTL function on an Opus custom encoder. 231 /** Perform a CTL function on an Opus custom encoder.
225 * 232 *
226 * Generally the request and subsequent arguments are generated 233 * Generally the request and subsequent arguments are generated
227 * by a convenience macro. 234 * by a convenience macro.
228 * @see opus_encoderctls 235 * @see opus_encoderctls
229 */ 236 */
230 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1); 237 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
231 238
239
240 #if !defined(OPUS_BUILD) || defined(CELT_DECODER_C)
232 /* Decoder */ 241 /* Decoder */
233 242
234 /** Gets the size of an OpusCustomDecoder structure. 243 /** Gets the size of an OpusCustomDecoder structure.
235 * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration 244 * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration
236 * @param [in] channels <tt>int</tt>: Number of channels 245 * @param [in] channels <tt>int</tt>: Number of channels
237 * @returns size 246 * @returns size
238 */ 247 */
239 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_si ze( 248 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_si ze(
240 const OpusCustomMode *mode, 249 const OpusCustomMode *mode,
241 int channels 250 int channels
242 ) OPUS_ARG_NONNULL(1); 251 ) OPUS_ARG_NONNULL(1);
243 252
244 /** Creates a new decoder state. Each stream needs its own decoder state (can't
245 * be shared across simultaneous streams).
246 * @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the
247 * stream (must be the same characteristics as used for the encoder)
248 * @param [in] channels <tt>int</tt>: Number of channels
249 * @param [out] error <tt>int*</tt>: Returns an error code
250 * @return Newly created decoder state.
251 */
252 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decode r_create(
253 const OpusCustomMode *mode,
254 int channels,
255 int *error
256 ) OPUS_ARG_NONNULL(1);
257
258 /** Initializes a previously allocated decoder state 253 /** Initializes a previously allocated decoder state
259 * The memory pointed to by st must be the size returned by opus_custom_decoder _get_size. 254 * The memory pointed to by st must be the size returned by opus_custom_decoder _get_size.
260 * This is intended for applications which use their own allocator instead of m alloc. 255 * This is intended for applications which use their own allocator instead of m alloc.
261 * @see opus_custom_decoder_create(),opus_custom_decoder_get_size() 256 * @see opus_custom_decoder_create(),opus_custom_decoder_get_size()
262 * To reset a previously initialized state use the OPUS_RESET_STATE CTL. 257 * To reset a previously initialized state use the OPUS_RESET_STATE CTL.
263 * @param [in] st <tt>OpusCustomDecoder*</tt>: Decoder state 258 * @param [in] st <tt>OpusCustomDecoder*</tt>: Decoder state
264 * @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information abo ut the characteristics of 259 * @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information abo ut the characteristics of
265 * the stream (must be the same characteristics as used for the 260 * the stream (must be the same characteristics as used for the
266 * encoder) 261 * encoder)
267 * @param [in] channels <tt>int</tt>: Number of channels 262 * @param [in] channels <tt>int</tt>: Number of channels
268 * @return OPUS_OK Success or @ref opus_errorcodes 263 * @return OPUS_OK Success or @ref opus_errorcodes
269 */ 264 */
270 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init( 265 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(
271 OpusCustomDecoder *st, 266 OpusCustomDecoder *st,
272 const OpusCustomMode *mode, 267 const OpusCustomMode *mode,
273 int channels 268 int channels
274 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); 269 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
275 270
271 #endif
272
273
274 /** Creates a new decoder state. Each stream needs its own decoder state (can't
275 * be shared across simultaneous streams).
276 * @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the
277 * stream (must be the same characteristics as used for the encoder)
278 * @param [in] channels <tt>int</tt>: Number of channels
279 * @param [out] error <tt>int*</tt>: Returns an error code
280 * @return Newly created decoder state.
281 */
282 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decode r_create(
283 const OpusCustomMode *mode,
284 int channels,
285 int *error
286 ) OPUS_ARG_NONNULL(1);
287
276 /** Destroys a an decoder state. 288 /** Destroys a an decoder state.
277 * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed. 289 * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed.
278 */ 290 */
279 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st); 291 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);
280 292
281 /** Decode an opus custom frame with floating point output 293 /** Decode an opus custom frame with floating point output
282 * @param [in] st <tt>OpusCustomDecoder*</tt>: Decoder state 294 * @param [in] st <tt>OpusCustomDecoder*</tt>: Decoder state
283 * @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indica te packet loss 295 * @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indica te packet loss
284 * @param [in] len <tt>int</tt>: Number of bytes in payload 296 * @param [in] len <tt>int</tt>: Number of bytes in payload
285 * @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length 297 * @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 */ 332 */
321 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1); 333 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
322 334
323 /**@}*/ 335 /**@}*/
324 336
325 #ifdef __cplusplus 337 #ifdef __cplusplus
326 } 338 }
327 #endif 339 #endif
328 340
329 #endif /* OPUS_CUSTOM_H */ 341 #endif /* OPUS_CUSTOM_H */
OLDNEW
« no previous file with comments | « include/opus.h ('k') | include/opus_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698