GCC Code Coverage Report
Directory: ../../../ffmpeg/ Exec Total Coverage
File: src/libavcodec/avfft.c Lines: 54 60 90.0 %
Date: 2019-11-20 04:07:19 Branches: 14 24 58.3 %

Line Branch Exec Source
1
/*
2
 * This file is part of FFmpeg.
3
 *
4
 * FFmpeg is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * FFmpeg is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with FFmpeg; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
 */
18
19
#include "libavutil/attributes.h"
20
#include "libavutil/mem.h"
21
#include "avfft.h"
22
#include "fft.h"
23
#include "rdft.h"
24
#include "dct.h"
25
26
/* FFT */
27
28
20
FFTContext *av_fft_init(int nbits, int inverse)
29
{
30
20
    FFTContext *s = av_mallocz(sizeof(*s));
31
32

20
    if (s && ff_fft_init(s, nbits, inverse))
33
        av_freep(&s);
34
35
20
    return s;
36
}
37
38
1064
void av_fft_permute(FFTContext *s, FFTComplex *z)
39
{
40
1064
    s->fft_permute(s, z);
41
1064
}
42
43
1064
void av_fft_calc(FFTContext *s, FFTComplex *z)
44
{
45
1064
    s->fft_calc(s, z);
46
1064
}
47
48
28
av_cold void av_fft_end(FFTContext *s)
49
{
50
28
    if (s) {
51
20
        ff_fft_end(s);
52
20
        av_free(s);
53
    }
54
28
}
55
56
#if CONFIG_MDCT
57
58
18
FFTContext *av_mdct_init(int nbits, int inverse, double scale)
59
{
60
18
    FFTContext *s = av_malloc(sizeof(*s));
61
62

18
    if (s && ff_mdct_init(s, nbits, inverse, scale))
63
        av_freep(&s);
64
65
18
    return s;
66
}
67
68
9
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
69
{
70
9
    s->imdct_calc(s, output, input);
71
9
}
72
73
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
74
{
75
    s->imdct_half(s, output, input);
76
}
77
78
9
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
79
{
80
9
    s->mdct_calc(s, output, input);
81
9
}
82
83
18
av_cold void av_mdct_end(FFTContext *s)
84
{
85
18
    if (s) {
86
18
        ff_mdct_end(s);
87
18
        av_free(s);
88
    }
89
18
}
90
91
#endif /* CONFIG_MDCT */
92
93
#if CONFIG_RDFT
94
95
33
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
96
{
97
33
    RDFTContext *s = av_malloc(sizeof(*s));
98
99

33
    if (s && ff_rdft_init(s, nbits, trans))
100
        av_freep(&s);
101
102
33
    return s;
103
}
104
105
1552
void av_rdft_calc(RDFTContext *s, FFTSample *data)
106
{
107
1552
    s->rdft_calc(s, data);
108
1552
}
109
110
78
av_cold void av_rdft_end(RDFTContext *s)
111
{
112
78
    if (s) {
113
33
        ff_rdft_end(s);
114
33
        av_free(s);
115
    }
116
78
}
117
118
#endif /* CONFIG_RDFT */
119
120
#if CONFIG_DCT
121
122
18
DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
123
{
124
18
    DCTContext *s = av_malloc(sizeof(*s));
125
126

18
    if (s && ff_dct_init(s, nbits, inverse))
127
        av_freep(&s);
128
129
18
    return s;
130
}
131
132
18
void av_dct_calc(DCTContext *s, FFTSample *data)
133
{
134
18
    s->dct_calc(s, data);
135
18
}
136
137
18
av_cold void av_dct_end(DCTContext *s)
138
{
139
18
    if (s) {
140
18
        ff_dct_end(s);
141
18
        av_free(s);
142
    }
143
18
}
144
145
#endif /* CONFIG_DCT */