FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/g728_template.c
Date: 2025-06-23 20:06:14
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 2 2 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
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
21 39184 static void convolve(float *tgt, const float *src, int len, int n)
22 {
23
2/2
✓ Branch 0 taken 940416 times.
✓ Branch 1 taken 39184 times.
979600 for (; n >= 0; n--)
24 940416 tgt[n] = ff_scalarproduct_float_c(src, src - n, len);
25
26 39184 }
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 */
40 19592 static 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];
47 19592 LOCAL_ALIGNED(32, float, work, [FFALIGN(MAX_BACKWARD_FILTER_ORDER +
48 MAX_BACKWARD_FILTER_LEN +
49 MAX_BACKWARD_FILTER_NONREC, 16)]);
50
51 av_assert2(order>=0);
52
53 19592 vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16));
54
55 19592 convolve(buffer1, work + order , n , order);
56 19592 convolve(buffer2, work + order + n, non_rec, order);
57
58
2/2
✓ Branch 0 taken 470208 times.
✓ Branch 1 taken 19592 times.
489800 for (i=0; i <= order; i++) {
59 470208 out2[i] = out2[i] * ATTEN + buffer1[i];
60 470208 out [i] = out2[i] + buffer2[i];
61 }
62
63 /* Multiply by the white noise correcting factor (WNCF). */
64 19592 *out *= 257.0 / 256.0;
65 19592 }
66