1 /*
2 * RFC 3389 comfort noise generator
3 * Copyright (c) 2012 Martin Storsjo
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <math.h>
23
29
40
42 {
49 return 0;
50 }
51
53 {
55
59
72 }
73
75
76 return 0;
77 }
78
80 {
82 float *next, *cur;
85 cur = lpc;
86 for (m = 0; m < order; m++) {
88 for (i = 0; i <
m; i++)
89 next[i] = cur[i] + refl[m] * cur[m - i - 1];
91 }
92 if (cur != lpc)
93 memcpy(lpc, cur, sizeof(*lpc) * order);
94 }
95
97 {
100 }
101
103 int *got_frame_ptr,
AVPacket *avpkt)
104 {
107 int buf_size = avpkt->
size;
109 int16_t *buf_out;
110 float e = 1.0;
111 float scaling;
112
114 int dbov = -avpkt->
data[0];
119 }
120 }
121
124 for (i = 0; i < p->
order; i++)
126 } else {
130 }
132
133 for (i = 0; i < p->
order; i++)
135
136 scaling = sqrt(e * p->
energy / 1081109975);
140 }
143
147 buf_out = (int16_t *)frame->
data[0];
152
153 *got_frame_ptr = 1;
154
155 return buf_size;
156 }
157
159 .
name =
"comfortnoise",
171 };