../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
62 / 124
50.0%
Branches:
20 / 40
50.0%
Functions:
8 / 16
50.0%

libavcodec/flacdsp_template.c
Line Branch Exec Source
1 /*
2 * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
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 <stdint.h>
22 #include "libavutil/macros.h"
23
24 #undef FUNC
25 #undef FSUF
26 #undef sample
27 #undef sample_type
28 #undef OUT
29 #undef S
30
31 #if SAMPLE_SIZE == 32
32 # define sample_type int32_t
33 #else
34 # define sample_type int16_t
35 #endif
36
37 #if PLANAR
38 # define FSUF AV_JOIN(SAMPLE_SIZE, p)
39 # define sample sample_type *
40 # define OUT(n) n
41 # define S(s, c, i) (s[c][i])
42 #else
43 # define FSUF SAMPLE_SIZE
44 # define sample sample_type
45 # define OUT(n) n[0]
46 # define S(s, c, i) (*s++)
47 #endif
48
49 #define FUNC(n) AV_JOIN(n ## _, FSUF)
50
51 2074 static void FUNC(flac_decorrelate_indep_c)(uint8_t **out, int32_t **in,
52 int channels, int len, int shift)
53 {
54 2074 sample *samples = (sample *) OUT(out);
55 int i, j;
56
57
4/8
flac_decorrelate_indep_c_16:
✓ Branch 7 → 3 taken 7630690 times.
✓ Branch 7 → 8 taken 1886 times.
flac_decorrelate_indep_c_16p:
✗ Branch 7 → 3 not taken.
✗ Branch 7 → 8 not taken.
flac_decorrelate_indep_c_32:
✓ Branch 7 → 3 taken 1957033 times.
✓ Branch 7 → 8 taken 188 times.
flac_decorrelate_indep_c_32p:
✗ Branch 7 → 3 not taken.
✗ Branch 7 → 8 not taken.
9589797 for (j = 0; j < len; j++)
58
4/8
flac_decorrelate_indep_c_16:
✓ Branch 5 → 4 taken 20209844 times.
✓ Branch 5 → 6 taken 7630690 times.
flac_decorrelate_indep_c_16p:
✗ Branch 5 → 4 not taken.
✗ Branch 5 → 6 not taken.
flac_decorrelate_indep_c_32:
✓ Branch 5 → 4 taken 3909902 times.
✓ Branch 5 → 6 taken 1957033 times.
flac_decorrelate_indep_c_32p:
✗ Branch 5 → 4 not taken.
✗ Branch 5 → 6 not taken.
33707469 for (i = 0; i < channels; i++)
59 24119746 S(samples, i, j) = (int)((unsigned)in[i][j] << shift);
60 2074 }
61
62 606 static void FUNC(flac_decorrelate_ls_c)(uint8_t **out, int32_t **in,
63 int channels, int len, int shift)
64 {
65 606 sample *samples = (sample *) OUT(out);
66 int i;
67
68
4/8
flac_decorrelate_ls_c_16:
✓ Branch 4 → 3 taken 2223062 times.
✓ Branch 4 → 5 taken 549 times.
flac_decorrelate_ls_c_16p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
flac_decorrelate_ls_c_32:
✓ Branch 4 → 3 taken 244480 times.
✓ Branch 4 → 5 taken 57 times.
flac_decorrelate_ls_c_32p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
2468148 for (i = 0; i < len; i++) {
69 2467542 unsigned a = in[0][i];
70 2467542 unsigned b = in[1][i];
71 2467542 S(samples, 0, i) = a << shift;
72 2467542 S(samples, 1, i) = (a - b) << shift;
73 }
74 606 }
75
76 531 static void FUNC(flac_decorrelate_rs_c)(uint8_t **out, int32_t **in,
77 int channels, int len, int shift)
78 {
79 531 sample *samples = (sample *) OUT(out);
80 int i;
81
82
4/8
flac_decorrelate_rs_c_16:
✓ Branch 4 → 3 taken 1791366 times.
✓ Branch 4 → 5 taken 442 times.
flac_decorrelate_rs_c_16p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
flac_decorrelate_rs_c_32:
✓ Branch 4 → 3 taken 391936 times.
✓ Branch 4 → 5 taken 89 times.
flac_decorrelate_rs_c_32p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
2183833 for (i = 0; i < len; i++) {
83 2183302 unsigned a = in[0][i];
84 2183302 unsigned b = in[1][i];
85 2183302 S(samples, 0, i) = (a + b) << shift;
86 2183302 S(samples, 1, i) = b << shift;
87 }
88 531 }
89
90 743 static void FUNC(flac_decorrelate_ms_c)(uint8_t **out, int32_t **in,
91 int channels, int len, int shift)
92 {
93 743 sample *samples = (sample *) OUT(out);
94 int i;
95
96
4/8
flac_decorrelate_ms_c_16:
✓ Branch 4 → 3 taken 2293441 times.
✓ Branch 4 → 5 taken 568 times.
flac_decorrelate_ms_c_16p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
flac_decorrelate_ms_c_32:
✓ Branch 4 → 3 taken 843586 times.
✓ Branch 4 → 5 taken 175 times.
flac_decorrelate_ms_c_32p:
✗ Branch 4 → 3 not taken.
✗ Branch 4 → 5 not taken.
3137770 for (i = 0; i < len; i++) {
97 3137027 unsigned a = in[0][i];
98 3137027 int b = in[1][i];
99 3137027 a -= b >> 1;
100 3137027 S(samples, 0, i) = (a + b) << shift;
101 3137027 S(samples, 1, i) = a << shift;
102 }
103 743 }
104