FFmpeg
Loading...
Searching...
No Matches
g728_template.c
Go to the documentation of this file.
1/*
2 * G.728 / RealAudio 2.0 (28.8K) decoder
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21static void convolve(float *tgt, const float *src, int len, int n)
22{
23 for (; n >= 0; n--)
24 tgt[n] = ff_scalarproduct_float_c(src, src - n, len);
25
26}
27
28/**
29 * Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
30 *
31 * @param order filter order
32 * @param n input length
33 * @param non_rec number of non-recursive samples
34 * @param out filter output
35 * @param hist pointer to the input history of the filter
36 * @param out pointer to the non-recursive part of the output
37 * @param out2 pointer to the recursive part of the output
38 * @param window pointer to the windowing function table
39 */
40static void do_hybrid_window(void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len),
41 int order, int n, int non_rec, float *out,
42 const float *hist, float *out2, const float *window)
43{
44 int i;
45 float buffer1[MAX_BACKWARD_FILTER_ORDER + 1];
46 float buffer2[MAX_BACKWARD_FILTER_ORDER + 1];
50
51 av_assert2(order>=0);
52
53 vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16));
54
55 convolve(buffer1, work + order , n , order);
56 convolve(buffer2, work + order + n, non_rec, order);
57
58 for (i=0; i <= order; i++) {
59 out2[i] = out2[i] * ATTEN + buffer1[i];
60 out [i] = out2[i] + buffer2[i];
61 }
62
63 /* Multiply by the white noise correcting factor (WNCF). */
64 *out *= 257.0 / 256.0;
65}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition avassert.h:68
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
static SDL_Window * window
Definition ffplay.c:365
float ff_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors of floats.
static void do_hybrid_window(void(*vector_fmul)(float *dst, const float *src0, const float *src1, int len), int order, int n, int non_rec, float *out, const float *hist, float *out2, const float *window)
Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
static void convolve(float *tgt, const float *src, int len, int n)
#define ATTEN
Definition g728dec.c:39
#define MAX_BACKWARD_FILTER_ORDER
Definition g728dec.c:36
#define MAX_BACKWARD_FILTER_NONREC
Definition g728dec.c:38
#define MAX_BACKWARD_FILTER_LEN
Definition g728dec.c:37
#define FFALIGN(x, a)
Definition macros.h:78
#define LOCAL_ALIGNED(a, t, v,...)
#define src1
Definition h264pred.c:141
#define src0
Definition h264pred.c:140
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55
int len