Libav
|
00001 /* 00002 * This file is part of FFmpeg. 00003 * 00004 * FFmpeg is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * FFmpeg is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with FFmpeg; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 #include "libavutil/mem.h" 00020 #include "avfft.h" 00021 #include "fft.h" 00022 00023 /* FFT */ 00024 00025 FFTContext *av_fft_init(int nbits, int inverse) 00026 { 00027 FFTContext *s = av_malloc(sizeof(*s)); 00028 00029 if (s) 00030 ff_fft_init(s, nbits, inverse); 00031 00032 return s; 00033 } 00034 00035 void av_fft_permute(FFTContext *s, FFTComplex *z) 00036 { 00037 s->fft_permute(s, z); 00038 } 00039 00040 void av_fft_calc(FFTContext *s, FFTComplex *z) 00041 { 00042 s->fft_calc(s, z); 00043 } 00044 00045 void av_fft_end(FFTContext *s) 00046 { 00047 if (s) { 00048 ff_fft_end(s); 00049 av_free(s); 00050 } 00051 } 00052 00053 #if CONFIG_MDCT 00054 00055 FFTContext *av_mdct_init(int nbits, int inverse, double scale) 00056 { 00057 FFTContext *s = av_malloc(sizeof(*s)); 00058 00059 if (s) 00060 ff_mdct_init(s, nbits, inverse, scale); 00061 00062 return s; 00063 } 00064 00065 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) 00066 { 00067 s->imdct_calc(s, output, input); 00068 } 00069 00070 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input) 00071 { 00072 s->imdct_half(s, output, input); 00073 } 00074 00075 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) 00076 { 00077 s->mdct_calc(s, output, input); 00078 } 00079 00080 void av_mdct_end(FFTContext *s) 00081 { 00082 if (s) { 00083 ff_mdct_end(s); 00084 av_free(s); 00085 } 00086 } 00087 00088 #endif /* CONFIG_MDCT */ 00089 00090 #if CONFIG_RDFT 00091 00092 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) 00093 { 00094 RDFTContext *s = av_malloc(sizeof(*s)); 00095 00096 if (s) 00097 ff_rdft_init(s, nbits, trans); 00098 00099 return s; 00100 } 00101 00102 void av_rdft_calc(RDFTContext *s, FFTSample *data) 00103 { 00104 ff_rdft_calc(s, data); 00105 } 00106 00107 void av_rdft_end(RDFTContext *s) 00108 { 00109 if (s) { 00110 ff_rdft_end(s); 00111 av_free(s); 00112 } 00113 } 00114 00115 #endif /* CONFIG_RDFT */ 00116 00117 #if CONFIG_DCT 00118 00119 DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse) 00120 { 00121 DCTContext *s = av_malloc(sizeof(*s)); 00122 00123 if (s) 00124 ff_dct_init(s, nbits, inverse); 00125 00126 return s; 00127 } 00128 00129 void av_dct_calc(DCTContext *s, FFTSample *data) 00130 { 00131 ff_dct_calc(s, data); 00132 } 00133 00134 void av_dct_end(DCTContext *s) 00135 { 00136 if (s) { 00137 ff_dct_end(s); 00138 av_free(s); 00139 } 00140 } 00141 00142 #endif /* CONFIG_DCT */