• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/avfft.c

Go to the documentation of this file.
00001 /*
00002  * This file is part of Libav.
00003  *
00004  * Libav 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  * Libav 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 Libav; 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 #include "rdft.h"
00023 #include "dct.h"
00024 
00025 /* FFT */
00026 
00027 FFTContext *av_fft_init(int nbits, int inverse)
00028 {
00029     FFTContext *s = av_malloc(sizeof(*s));
00030 
00031     if (s && ff_fft_init(s, nbits, inverse))
00032         av_freep(&s);
00033 
00034     return s;
00035 }
00036 
00037 void av_fft_permute(FFTContext *s, FFTComplex *z)
00038 {
00039     s->fft_permute(s, z);
00040 }
00041 
00042 void av_fft_calc(FFTContext *s, FFTComplex *z)
00043 {
00044     s->fft_calc(s, z);
00045 }
00046 
00047 void av_fft_end(FFTContext *s)
00048 {
00049     if (s) {
00050         ff_fft_end(s);
00051         av_free(s);
00052     }
00053 }
00054 
00055 #if CONFIG_MDCT
00056 
00057 FFTContext *av_mdct_init(int nbits, int inverse, double scale)
00058 {
00059     FFTContext *s = av_malloc(sizeof(*s));
00060 
00061     if (s && ff_mdct_init(s, nbits, inverse, scale))
00062         av_freep(&s);
00063 
00064     return s;
00065 }
00066 
00067 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
00068 {
00069     s->imdct_calc(s, output, input);
00070 }
00071 
00072 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
00073 {
00074     s->imdct_half(s, output, input);
00075 }
00076 
00077 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
00078 {
00079     s->mdct_calc(s, output, input);
00080 }
00081 
00082 void av_mdct_end(FFTContext *s)
00083 {
00084     if (s) {
00085         ff_mdct_end(s);
00086         av_free(s);
00087     }
00088 }
00089 
00090 #endif /* CONFIG_MDCT */
00091 
00092 #if CONFIG_RDFT
00093 
00094 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
00095 {
00096     RDFTContext *s = av_malloc(sizeof(*s));
00097 
00098     if (s && ff_rdft_init(s, nbits, trans))
00099         av_freep(&s);
00100 
00101     return s;
00102 }
00103 
00104 void av_rdft_calc(RDFTContext *s, FFTSample *data)
00105 {
00106     s->rdft_calc(s, data);
00107 }
00108 
00109 void av_rdft_end(RDFTContext *s)
00110 {
00111     if (s) {
00112         ff_rdft_end(s);
00113         av_free(s);
00114     }
00115 }
00116 
00117 #endif /* CONFIG_RDFT */
00118 
00119 #if CONFIG_DCT
00120 
00121 DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
00122 {
00123     DCTContext *s = av_malloc(sizeof(*s));
00124 
00125     if (s && ff_dct_init(s, nbits, inverse))
00126         av_freep(&s);
00127 
00128     return s;
00129 }
00130 
00131 void av_dct_calc(DCTContext *s, FFTSample *data)
00132 {
00133     s->dct_calc(s, data);
00134 }
00135 
00136 void av_dct_end(DCTContext *s)
00137 {
00138     if (s) {
00139         ff_dct_end(s);
00140         av_free(s);
00141     }
00142 }
00143 
00144 #endif /* CONFIG_DCT */
Generated on Thu Jul 11 2013 15:38:18 for Libav by doxygen 1.7.1