/src/ffmpeg/libavcodec/g722dsp.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2015 Peter Meerwald <pmeerw@pmeerw.net> |
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 | | |
21 | | #include "g722dsp.h" |
22 | | #include "mathops.h" |
23 | | |
24 | | /* |
25 | | * quadrature mirror filter (QMF) coefficients (ITU-T G.722 Table 11) inlined |
26 | | * in code below: 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11 |
27 | | */ |
28 | | |
29 | | static void g722_apply_qmf(const int16_t *prev_samples, int xout[2]) |
30 | 13.4M | { |
31 | 13.4M | xout[1] = MUL16(*prev_samples++, 3); |
32 | 13.4M | xout[0] = MUL16(*prev_samples++, -11); |
33 | | |
34 | 13.4M | MAC16(xout[1], *prev_samples++, -11); |
35 | 13.4M | MAC16(xout[0], *prev_samples++, 53); |
36 | | |
37 | 13.4M | MAC16(xout[1], *prev_samples++, 12); |
38 | 13.4M | MAC16(xout[0], *prev_samples++, -156); |
39 | | |
40 | 13.4M | MAC16(xout[1], *prev_samples++, 32); |
41 | 13.4M | MAC16(xout[0], *prev_samples++, 362); |
42 | | |
43 | 13.4M | MAC16(xout[1], *prev_samples++, -210); |
44 | 13.4M | MAC16(xout[0], *prev_samples++, -805); |
45 | | |
46 | 13.4M | MAC16(xout[1], *prev_samples++, 951); |
47 | 13.4M | MAC16(xout[0], *prev_samples++, 3876); |
48 | | |
49 | 13.4M | MAC16(xout[1], *prev_samples++, 3876); |
50 | 13.4M | MAC16(xout[0], *prev_samples++, 951); |
51 | | |
52 | 13.4M | MAC16(xout[1], *prev_samples++, -805); |
53 | 13.4M | MAC16(xout[0], *prev_samples++, -210); |
54 | | |
55 | 13.4M | MAC16(xout[1], *prev_samples++, 362); |
56 | 13.4M | MAC16(xout[0], *prev_samples++, 32); |
57 | | |
58 | 13.4M | MAC16(xout[1], *prev_samples++, -156); |
59 | 13.4M | MAC16(xout[0], *prev_samples++, 12); |
60 | | |
61 | 13.4M | MAC16(xout[1], *prev_samples++, 53); |
62 | 13.4M | MAC16(xout[0], *prev_samples++, -11); |
63 | | |
64 | 13.4M | MAC16(xout[1], *prev_samples++, -11); |
65 | 13.4M | MAC16(xout[0], *prev_samples++, 3); |
66 | 13.4M | } |
67 | | |
68 | | av_cold void ff_g722dsp_init(G722DSPContext *c) |
69 | 1.29k | { |
70 | 1.29k | c->apply_qmf = g722_apply_qmf; |
71 | | |
72 | | #if ARCH_ARM |
73 | | ff_g722dsp_init_arm(c); |
74 | | #elif ARCH_RISCV |
75 | | ff_g722dsp_init_riscv(c); |
76 | | #elif ARCH_X86 && HAVE_X86ASM |
77 | | ff_g722dsp_init_x86(c); |
78 | | #endif |
79 | 1.29k | } |