diff options
author | Mans Rullgard <mans@mansr.com> | 2011-03-20 02:14:25 +0000 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-03-20 17:15:33 +0000 |
commit | 0aded9484da7da6fe23254e23382767635f8360a (patch) | |
tree | 0985f60e2b35fb272782726c00e2ccb78cae3519 /libavcodec | |
parent | 4538729afed44a0ee0a762d3ef69aa4bbb7f10b3 (diff) | |
download | ffmpeg-0aded9484da7da6fe23254e23382767635f8360a.tar.gz |
Move dct and rdft definitions to separate files
This leaves fft.h with only the core FFT and MDCT definitions
thus making it more managable.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/arm/fft_init_arm.c | 1 | ||||
-rw-r--r-- | libavcodec/avfft.c | 2 | ||||
-rw-r--r-- | libavcodec/binkaudio.c | 3 | ||||
-rw-r--r-- | libavcodec/costablegen.c | 2 | ||||
-rw-r--r-- | libavcodec/dct.c | 2 | ||||
-rw-r--r-- | libavcodec/dct.h | 50 | ||||
-rw-r--r-- | libavcodec/fft-test.c | 2 | ||||
-rw-r--r-- | libavcodec/fft.h | 65 | ||||
-rw-r--r-- | libavcodec/mpegaudio.h | 2 | ||||
-rw-r--r-- | libavcodec/rdft.c | 2 | ||||
-rw-r--r-- | libavcodec/rdft.h | 74 | ||||
-rw-r--r-- | libavcodec/wmavoice.c | 4 | ||||
-rw-r--r-- | libavcodec/x86/fft.c | 1 |
13 files changed, 138 insertions, 72 deletions
diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c index f898e1ab42..4ee4909682 100644 --- a/libavcodec/arm/fft_init_arm.c +++ b/libavcodec/arm/fft_init_arm.c @@ -19,6 +19,7 @@ */ #include "libavcodec/fft.h" +#include "libavcodec/rdft.h" #include "libavcodec/synth_filter.h" void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c index 1e52fe67b1..9ed06fbeb5 100644 --- a/libavcodec/avfft.c +++ b/libavcodec/avfft.c @@ -19,6 +19,8 @@ #include "libavutil/mem.h" #include "avfft.h" #include "fft.h" +#include "rdft.h" +#include "dct.h" /* FFT */ diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index ec1d0233c6..77ce6b9d3a 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -32,7 +32,8 @@ #define ALT_BITSTREAM_READER_LE #include "get_bits.h" #include "dsputil.h" -#include "fft.h" +#include "dct.h" +#include "rdft.h" #include "fmtconvert.h" #include "libavutil/intfloat_readwrite.h" diff --git a/libavcodec/costablegen.c b/libavcodec/costablegen.c index 20321ef661..33afd8de2d 100644 --- a/libavcodec/costablegen.c +++ b/libavcodec/costablegen.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) double (*func)(double) = do_sin ? sin : cos; printf("/* This file was generated by libavcodec/costablegen */\n"); - printf("#include \"libavcodec/fft.h\"\n"); + printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h"); for (i = 4; i <= BITS; i++) { int m = 1 << i; double freq = 2*M_PI/m; diff --git a/libavcodec/dct.c b/libavcodec/dct.c index 6bafdc1136..ef9673e227 100644 --- a/libavcodec/dct.c +++ b/libavcodec/dct.c @@ -29,7 +29,7 @@ #include <math.h> #include "libavutil/mathematics.h" -#include "fft.h" +#include "dct.h" #include "x86/fft.h" #define DCT32_FLOAT diff --git a/libavcodec/dct.h b/libavcodec/dct.h new file mode 100644 index 0000000000..141518d250 --- /dev/null +++ b/libavcodec/dct.h @@ -0,0 +1,50 @@ +/* + * (I)DCT Transforms + * Copyright (c) 2009 Peter Ross <pross@xvid.org> + * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> + * Copyright (c) 2010 Vitor Sessak + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DCT_H +#define AVCODEC_DCT_H + +#include "rdft.h" + +struct DCTContext { + int nbits; + int inverse; + RDFTContext rdft; + const float *costab; + FFTSample *csc2; + void (*dct_calc)(struct DCTContext *s, FFTSample *data); + void (*dct32)(FFTSample *out, const FFTSample *in); +}; + +/** + * Set up DCT. + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * + * @note the first element of the input of DST-I is ignored + */ +int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type); +void ff_dct_end (DCTContext *s); + +#endif diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c index bd95e2cd08..acfc5631ce 100644 --- a/libavcodec/fft-test.c +++ b/libavcodec/fft-test.c @@ -27,6 +27,8 @@ #include "libavutil/lfg.h" #include "libavutil/log.h" #include "fft.h" +#include "dct.h" +#include "rdft.h" #include <math.h> #include <unistd.h> #include <sys/time.h> diff --git a/libavcodec/fft.h b/libavcodec/fft.h index f10ef89621..a7ba00fe1a 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -61,16 +61,12 @@ struct FFTContext { #if CONFIG_HARDCODED_TABLES #define COSTABLE_CONST const -#define SINTABLE_CONST const #else #define COSTABLE_CONST -#define SINTABLE_CONST #endif #define COSTABLE(size) \ COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2] -#define SINTABLE(size) \ - SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2] extern COSTABLE(16); extern COSTABLE(32); @@ -93,20 +89,6 @@ extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17]; */ void ff_init_ff_cos_tabs(int index); -extern SINTABLE(16); -extern SINTABLE(32); -extern SINTABLE(64); -extern SINTABLE(128); -extern SINTABLE(256); -extern SINTABLE(512); -extern SINTABLE(1024); -extern SINTABLE(2048); -extern SINTABLE(4096); -extern SINTABLE(8192); -extern SINTABLE(16384); -extern SINTABLE(32768); -extern SINTABLE(65536); - /** * Set up a complex FFT. * @param nbits log2 of the length of the input array @@ -127,51 +109,4 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input); void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); void ff_mdct_end(FFTContext *s); -/* Real Discrete Fourier Transform */ - -struct RDFTContext { - int nbits; - int inverse; - int sign_convention; - - /* pre/post rotation tables */ - const FFTSample *tcos; - SINTABLE_CONST FFTSample *tsin; - FFTContext fft; - void (*rdft_calc)(struct RDFTContext *s, FFTSample *z); -}; - -/** - * Set up a real FFT. - * @param nbits log2 of the length of the input array - * @param trans the type of transform - */ -int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans); -void ff_rdft_end(RDFTContext *s); - -void ff_rdft_init_arm(RDFTContext *s); - -/* Discrete Cosine Transform */ - -struct DCTContext { - int nbits; - int inverse; - RDFTContext rdft; - const float *costab; - FFTSample *csc2; - void (*dct_calc)(struct DCTContext *s, FFTSample *data); - void (*dct32)(FFTSample *out, const FFTSample *in); -}; - -/** - * Set up DCT. - * @param nbits size of the input array: - * (1 << nbits) for DCT-II, DCT-III and DST-I - * (1 << nbits) + 1 for DCT-I - * - * @note the first element of the input of DST-I is ignored - */ -int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type); -void ff_dct_end (DCTContext *s); - #endif /* AVCODEC_FFT_H */ diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h index 6b623fc909..fbfddcc5d2 100644 --- a/libavcodec/mpegaudio.h +++ b/libavcodec/mpegaudio.h @@ -33,7 +33,7 @@ #include "avcodec.h" #include "get_bits.h" #include "dsputil.h" -#include "fft.h" +#include "dct.h" #define CONFIG_AUDIO_NONSHORT 0 diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c index 23ce524dcd..116cfa4366 100644 --- a/libavcodec/rdft.c +++ b/libavcodec/rdft.c @@ -21,7 +21,7 @@ #include <stdlib.h> #include <math.h> #include "libavutil/mathematics.h" -#include "fft.h" +#include "rdft.h" /** * @file diff --git a/libavcodec/rdft.h b/libavcodec/rdft.h new file mode 100644 index 0000000000..7572c6c76d --- /dev/null +++ b/libavcodec/rdft.h @@ -0,0 +1,74 @@ +/* + * (I)RDFT transforms + * Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_RDFT_H +#define AVCODEC_RDFT_H + +#include "config.h" +#include "fft.h" + +#if CONFIG_HARDCODED_TABLES +# define SINTABLE_CONST const +#else +# define SINTABLE_CONST +#endif + +#define SINTABLE(size) \ + SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2] + +extern SINTABLE(16); +extern SINTABLE(32); +extern SINTABLE(64); +extern SINTABLE(128); +extern SINTABLE(256); +extern SINTABLE(512); +extern SINTABLE(1024); +extern SINTABLE(2048); +extern SINTABLE(4096); +extern SINTABLE(8192); +extern SINTABLE(16384); +extern SINTABLE(32768); +extern SINTABLE(65536); + +struct RDFTContext { + int nbits; + int inverse; + int sign_convention; + + /* pre/post rotation tables */ + const FFTSample *tcos; + SINTABLE_CONST FFTSample *tsin; + FFTContext fft; + void (*rdft_calc)(struct RDFTContext *s, FFTSample *z); +}; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans); +void ff_rdft_end(RDFTContext *s); + +void ff_rdft_init_arm(RDFTContext *s); + + +#endif diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index c1aa9757c5..ea8260c482 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -36,8 +36,8 @@ #include "acelp_filters.h" #include "lsp.h" #include "libavutil/lzo.h" -#include "avfft.h" -#include "fft.h" +#include "dct.h" +#include "rdft.h" #include "sinewin.h" #define MAX_BLOCKS 8 ///< maximum number of blocks per frame diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c index 2a6e9f909f..2426a3df0f 100644 --- a/libavcodec/x86/fft.c +++ b/libavcodec/x86/fft.c @@ -18,6 +18,7 @@ #include "libavutil/cpu.h" #include "libavcodec/dsputil.h" +#include "libavcodec/dct.h" #include "fft.h" av_cold void ff_fft_init_mmx(FFTContext *s) |