1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* Resampling library
* Copyright (C) <2001> David Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_RESAMPLE_H__
#define __GST_RESAMPLE_H__
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
GST_RESAMPLE_NEAREST = 0,
GST_RESAMPLE_BILINEAR,
GST_RESAMPLE_SINC_SLOW,
GST_RESAMPLE_SINC,
} gst_resample_method;
typedef enum {
GST_RESAMPLE_S16 = 0,
GST_RESAMPLE_FLOAT
} gst_resample_format;
typedef struct gst_resample_s gst_resample_t;
struct gst_resample_s {
/* parameters */
gst_resample_method method;
int channels;
int verbose;
gst_resample_format format;
int filter_length;
double i_rate;
double o_rate;
void *priv;
void *(*get_buffer)(void *priv, unsigned int size);
/* internal parameters */
double halftaps;
/* filter state */
void *buffer;
int buffer_len;
double i_start;
double o_start;
double i_start_buf;
double i_end_buf;
double i_inc;
double o_inc;
double i_end;
double o_end;
int i_samples;
int o_samples;
void *i_buf, *o_buf;
double acc[2];
union {
struct {
double *out_tmp;
int out_tmp_len;
} s;
double padding[8];
} hack_union;
/* methods */
void (*scale)(gst_resample_t *r);
double ack;
};
void gst_resample_init(gst_resample_t *r);
void gst_resample_reinit(gst_resample_t *r);
void gst_resample_close (gst_resample_t * r);
void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size);
G_END_DECLS
#endif /* __GST_RESAMPLE_H__ */
|