porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h
Go to the documentation of this file.
1 /* Copyright (C) 2007 Jean-Marc Valin
2 
3  File: speex_resampler.h
4  Resampling code
5 
6  The design goals of this code are:
7  - Very fast algorithm
8  - Low memory requirement
9  - Good *perceptual* quality (and not best SNR)
10 
11  Redistribution and use in source and binary forms, with or without
12  modification, are permitted provided that the following conditions are
13  met:
14 
15  1. Redistributions of source code must retain the above copyright notice,
16  this list of conditions and the following disclaimer.
17 
18  2. Redistributions in binary form must reproduce the above copyright
19  notice, this list of conditions and the following disclaimer in the
20  documentation and/or other materials provided with the distribution.
21 
22  3. The name of the author may not be used to endorse or promote products
23  derived from this software without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
29  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  POSSIBILITY OF SUCH DAMAGE.
36 */
37 
38 
39 #ifndef SPEEX_RESAMPLER_H
40 #define SPEEX_RESAMPLER_H
41 
42 #ifdef OUTSIDE_SPEEX
43 
44 /********* WARNING: MENTAL SANITY ENDS HERE *************/
45 
46 /* If the resampler is defined outside of Speex, we change the symbol names so that
47  there won't be any clash if linking with Speex later on. */
48 
49 /* #define RANDOM_PREFIX your software name here */
50 #ifndef RANDOM_PREFIX
51 #error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
52 #endif
53 
54 #define CAT_PREFIX2(a,b) a ## b
55 #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
56 
57 #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
58 #define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
59 #define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
60 #define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
61 #define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
62 #define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
63 #define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
64 #define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
65 #define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
66 #define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
67 #define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
68 #define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
69 #define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
70 #define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
71 #define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
72 #define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
73 #define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
74 #define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
75 #define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
76 #define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
77 #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
78 #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
79 
80 #define spx_int16_t short
81 #define spx_int32_t int
82 #define spx_uint16_t unsigned short
83 #define spx_uint32_t unsigned int
84 
85 #define speex_assert(cond)
86 
87 #else /* OUTSIDE_SPEEX */
88 
89 #include "speexdsp_types.h"
90 
91 #endif /* OUTSIDE_SPEEX */
92 
93 #ifdef __cplusplus
94 extern "C" {
95 #endif
96 
97 #define SPEEX_RESAMPLER_QUALITY_MAX 10
98 #define SPEEX_RESAMPLER_QUALITY_MIN 0
99 #define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
100 #define SPEEX_RESAMPLER_QUALITY_VOIP 3
101 #define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
102 
103 enum {
110 
112 };
113 
114 struct SpeexResamplerState_;
116 
127  spx_uint32_t in_rate,
128  spx_uint32_t out_rate,
129  int quality,
130  int *err);
131 
146  spx_uint32_t ratio_num,
147  spx_uint32_t ratio_den,
148  spx_uint32_t in_rate,
149  spx_uint32_t out_rate,
150  int quality,
151  int *err);
152 
157 
169  spx_uint32_t channel_index,
170  const float *in,
171  spx_uint32_t *in_len,
172  float *out,
173  spx_uint32_t *out_len);
174 
186  spx_uint32_t channel_index,
187  const spx_int16_t *in,
188  spx_uint32_t *in_len,
189  spx_int16_t *out,
190  spx_uint32_t *out_len);
191 
202  const float *in,
203  spx_uint32_t *in_len,
204  float *out,
205  spx_uint32_t *out_len);
206 
217  const spx_int16_t *in,
218  spx_uint32_t *in_len,
219  spx_int16_t *out,
220  spx_uint32_t *out_len);
221 
228  spx_uint32_t in_rate,
229  spx_uint32_t out_rate);
230 
237  spx_uint32_t *in_rate,
238  spx_uint32_t *out_rate);
239 
249  spx_uint32_t ratio_num,
250  spx_uint32_t ratio_den,
251  spx_uint32_t in_rate,
252  spx_uint32_t out_rate);
253 
261  spx_uint32_t *ratio_num,
262  spx_uint32_t *ratio_den);
263 
270  int quality);
271 
278  int *quality);
279 
285  spx_uint32_t stride);
286 
292  spx_uint32_t *stride);
293 
299  spx_uint32_t stride);
300 
306  spx_uint32_t *stride);
307 
312 
317 
327 
332 
337 const char *speex_resampler_strerror(int err);
338 
339 #ifdef __cplusplus
340 }
341 #endif
342 
343 #endif
speex_resampler_init_frac
SpeexResamplerState * speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:799
RESAMPLER_ERR_MAX_ERROR
@ RESAMPLER_ERR_MAX_ERROR
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:111
speex_resampler_get_rate
void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1089
speex_resampler_init
SpeexResamplerState * speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:794
SpeexResamplerState_::out_rate
spx_uint32_t out_rate
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:118
RESAMPLER_ERR_ALLOC_FAILED
@ RESAMPLER_ERR_ALLOC_FAILED
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:105
speex_resampler_get_quality
void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1165
speex_resampler_reset_mem
int speex_resampler_reset_mem(SpeexResamplerState *st)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1208
speex_resampler_set_input_stride
void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1170
speex_resampler_set_rate_frac
int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1107
speex_resampler_get_input_stride
void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1175
SpeexResamplerState_::in_rate
spx_uint32_t in_rate
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:117
speex_resampler_set_rate
int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1084
speex_resampler_get_ratio
void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1147
SpeexResamplerState_::nb_channels
spx_uint32_t nb_channels
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:123
SpeexResamplerState_::quality
int quality
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:122
RESAMPLER_ERR_PTR_OVERLAP
@ RESAMPLER_ERR_PTR_OVERLAP
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:108
SpeexResamplerState_
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:116
speex_resampler_skip_zeros
int speex_resampler_skip_zeros(SpeexResamplerState *st)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1200
speex_resampler_process_float
int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:927
speex_resampler_get_output_stride
void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1185
speex_resampler_set_quality
int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1153
speex_resampler_process_interleaved_int
int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1061
speex_resampler_get_input_latency
int speex_resampler_get_input_latency(SpeexResamplerState *st)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1190
RESAMPLER_ERR_OVERFLOW
@ RESAMPLER_ERR_OVERFLOW
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:109
RESAMPLER_ERR_BAD_STATE
@ RESAMPLER_ERR_BAD_STATE
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:106
RESAMPLER_ERR_SUCCESS
@ RESAMPLER_ERR_SUCCESS
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:104
RESAMPLER_ERR_INVALID_ARG
@ RESAMPLER_ERR_INVALID_ARG
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/speex_resampler.h:107
speex_resampler_strerror
const char * speex_resampler_strerror(int err)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1222
speex_resampler_process_int
int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:968
speex_resampler_process_interleaved_float
int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1038
speex_resampler_destroy
void speex_resampler_destroy(SpeexResamplerState *st)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:868
speex_resampler_get_output_latency
int speex_resampler_get_output_latency(SpeexResamplerState *st)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1195
speex_resampler_set_output_stride
void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:1180


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:51