OLD | NEW |
(Empty) | |
| 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/mem.h" |
| 20 #include "avfft.h" |
| 21 #include "fft.h" |
| 22 |
| 23 /* FFT */ |
| 24 |
| 25 FFTContext *av_fft_init(int nbits, int inverse) |
| 26 { |
| 27 FFTContext *s = av_malloc(sizeof(*s)); |
| 28 |
| 29 if (s) |
| 30 ff_fft_init(s, nbits, inverse); |
| 31 |
| 32 return s; |
| 33 } |
| 34 |
| 35 void av_fft_permute(FFTContext *s, FFTComplex *z) |
| 36 { |
| 37 s->fft_permute(s, z); |
| 38 } |
| 39 |
| 40 void av_fft_calc(FFTContext *s, FFTComplex *z) |
| 41 { |
| 42 s->fft_calc(s, z); |
| 43 } |
| 44 |
| 45 void av_fft_end(FFTContext *s) |
| 46 { |
| 47 if (s) { |
| 48 ff_fft_end(s); |
| 49 av_free(s); |
| 50 } |
| 51 } |
| 52 |
| 53 #if CONFIG_MDCT |
| 54 |
| 55 FFTContext *av_mdct_init(int nbits, int inverse, double scale) |
| 56 { |
| 57 FFTContext *s = av_malloc(sizeof(*s)); |
| 58 |
| 59 if (s) |
| 60 ff_mdct_init(s, nbits, inverse, scale); |
| 61 |
| 62 return s; |
| 63 } |
| 64 |
| 65 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) |
| 66 { |
| 67 s->imdct_calc(s, output, input); |
| 68 } |
| 69 |
| 70 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input) |
| 71 { |
| 72 s->imdct_half(s, output, input); |
| 73 } |
| 74 |
| 75 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) |
| 76 { |
| 77 s->mdct_calc(s, output, input); |
| 78 } |
| 79 |
| 80 void av_mdct_end(FFTContext *s) |
| 81 { |
| 82 if (s) { |
| 83 ff_mdct_end(s); |
| 84 av_free(s); |
| 85 } |
| 86 } |
| 87 |
| 88 #endif /* CONFIG_MDCT */ |
| 89 |
| 90 #if CONFIG_RDFT |
| 91 |
| 92 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) |
| 93 { |
| 94 RDFTContext *s = av_malloc(sizeof(*s)); |
| 95 |
| 96 if (s) |
| 97 ff_rdft_init(s, nbits, trans); |
| 98 |
| 99 return s; |
| 100 } |
| 101 |
| 102 void av_rdft_calc(RDFTContext *s, FFTSample *data) |
| 103 { |
| 104 ff_rdft_calc(s, data); |
| 105 } |
| 106 |
| 107 void av_rdft_end(RDFTContext *s) |
| 108 { |
| 109 if (s) { |
| 110 ff_rdft_end(s); |
| 111 av_free(s); |
| 112 } |
| 113 } |
| 114 |
| 115 #endif /* CONFIG_RDFT */ |
| 116 |
| 117 #if CONFIG_DCT |
| 118 |
| 119 DCTContext *av_dct_init(int nbits, int inverse) |
| 120 { |
| 121 DCTContext *s = av_malloc(sizeof(*s)); |
| 122 |
| 123 if (s) |
| 124 ff_dct_init(s, nbits, inverse); |
| 125 |
| 126 return s; |
| 127 } |
| 128 |
| 129 void av_dct_calc(DCTContext *s, FFTSample *data) |
| 130 { |
| 131 ff_dct_calc(s, data); |
| 132 } |
| 133 |
| 134 void av_dct_end(DCTContext *s) |
| 135 { |
| 136 if (s) { |
| 137 ff_dct_end(s); |
| 138 av_free(s); |
| 139 } |
| 140 } |
| 141 |
| 142 #endif /* CONFIG_DCT */ |
OLD | NEW |