diff options
author | Mans Rullgard <mans@mansr.com> | 2011-03-19 23:44:00 +0000 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-03-20 13:25:19 +0000 |
commit | 4538729afed44a0ee0a762d3ef69aa4bbb7f10b3 (patch) | |
tree | 746f6f85406a0100bff5684c1055c8922761d020 | |
parent | a45fbda994df54600101e845e29f0af60e456e95 (diff) | |
download | ffmpeg-4538729afed44a0ee0a762d3ef69aa4bbb7f10b3.tar.gz |
Move sine windows to a separate file
These windows do not really belong in fft/mdct files and were
easily confused with the similarly named tables used by rdft.
Signed-off-by: Mans Rullgard <mans@mansr.com>
-rwxr-xr-x | configure | 27 | ||||
-rw-r--r-- | libavcodec/Makefile | 5 | ||||
-rw-r--r-- | libavcodec/aacdec.c | 1 | ||||
-rw-r--r-- | libavcodec/aacenc.c | 1 | ||||
-rw-r--r-- | libavcodec/atrac1.c | 1 | ||||
-rw-r--r-- | libavcodec/cook.c | 1 | ||||
-rw-r--r-- | libavcodec/fft.h | 26 | ||||
-rw-r--r-- | libavcodec/imc.c | 1 | ||||
-rw-r--r-- | libavcodec/mdct.c | 2 | ||||
-rw-r--r-- | libavcodec/nellymoserdec.c | 1 | ||||
-rw-r--r-- | libavcodec/nellymoserenc.c | 1 | ||||
-rw-r--r-- | libavcodec/sinewin.c | 20 | ||||
-rw-r--r-- | libavcodec/sinewin.h | 59 | ||||
-rw-r--r-- | libavcodec/sinewin_tablegen.c (renamed from libavcodec/mdct_tablegen.c) | 4 | ||||
-rw-r--r-- | libavcodec/sinewin_tablegen.h (renamed from libavcodec/mdct_tablegen.h) | 4 | ||||
-rw-r--r-- | libavcodec/twinvq.c | 1 | ||||
-rw-r--r-- | libavcodec/wma.c | 1 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 1 | ||||
-rw-r--r-- | libavcodec/wmavoice.c | 1 |
19 files changed, 112 insertions, 46 deletions
@@ -957,6 +957,7 @@ CONFIG_LIST=" rtpdec runtime_cpudetect shared + sinewin small sram static @@ -1234,8 +1235,8 @@ mdct_select="fft" rdft_select="fft" # decoders / encoders / hardware accelerators -aac_decoder_select="mdct rdft" -aac_encoder_select="mdct" +aac_decoder_select="mdct rdft sinewin" +aac_encoder_select="mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" ac3_decoder_select="mdct ac3_parser" ac3_encoder_select="mdct ac3dsp" @@ -1243,12 +1244,12 @@ ac3_fixed_encoder_select="ac3dsp" alac_encoder_select="lpc" amrnb_decoder_select="lsp" amrwb_decoder_select="lsp" -atrac1_decoder_select="mdct" +atrac1_decoder_select="mdct sinewin" atrac3_decoder_select="mdct" binkaudio_dct_decoder_select="mdct rdft dct" binkaudio_rdft_decoder_select="mdct rdft" cavs_decoder_select="golomb" -cook_decoder_select="mdct" +cook_decoder_select="mdct sinewin" cscd_decoder_suggest="zlib" dca_decoder_select="mdct" dnxhd_encoder_select="aandct" @@ -1307,8 +1308,8 @@ msmpeg4v2_decoder_select="h263_decoder" msmpeg4v2_encoder_select="h263_encoder" msmpeg4v3_decoder_select="h263_decoder" msmpeg4v3_encoder_select="h263_encoder" -nellymoser_decoder_select="mdct" -nellymoser_encoder_select="mdct" +nellymoser_decoder_select="mdct sinewin" +nellymoser_encoder_select="mdct sinewin" png_decoder_select="zlib" png_encoder_select="zlib" qcelp_decoder_select="lsp" @@ -1332,7 +1333,7 @@ tiff_decoder_suggest="zlib" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_decoder" tscc_decoder_select="zlib" -twinvq_decoder_select="mdct lsp" +twinvq_decoder_select="mdct lsp sinewin" vc1_decoder_select="h263_decoder" vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex" vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" @@ -1344,12 +1345,12 @@ vp6_decoder_select="huffman" vp6a_decoder_select="vp6_decoder" vp6f_decoder_select="vp6_decoder" vp8_decoder_select="h264pred" -wmapro_decoder_select="mdct" -wmav1_decoder_select="mdct" -wmav1_encoder_select="mdct" -wmav2_decoder_select="mdct" -wmav2_encoder_select="mdct" -wmavoice_decoder_select="lsp rdft dct mdct" +wmapro_decoder_select="mdct sinewin" +wmav1_decoder_select="mdct sinewin" +wmav1_encoder_select="mdct sinewin" +wmav2_decoder_select="mdct sinewin" +wmav2_encoder_select="mdct sinewin" +wmavoice_decoder_select="lsp rdft dct mdct sinewin" wmv1_decoder_select="h263_decoder" wmv1_encoder_select="h263_encoder" wmv2_decoder_select="h263_decoder" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index b21921b74c..04e35a180c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -42,6 +42,7 @@ OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_MDCT) += mdct.o RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) +OBJS-$(CONFIG_SINEWIN) += sinewin.o OBJS-$(CONFIG_VAAPI) += vaapi.o OBJS-$(CONFIG_VDPAU) += vdpau.o @@ -690,7 +691,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)%_tablegen.h $( $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(filter %.c,$^) $(HOSTLIBS) GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h \ - mdct_tables.h mpegaudio_tables.h motionpixels_tables.h \ + sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \ pcm_tables.h qdm2_tables.h GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS)) @@ -702,7 +703,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h $(SUBDIR)dv.o: $(SUBDIR)dv_tables.h -$(SUBDIR)mdct.o: $(SUBDIR)mdct_tables.h +$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h $(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h $(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h $(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 0a1ac93bae..05bd7ed3d3 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -88,6 +88,7 @@ #include "fmtconvert.h" #include "lpc.h" #include "kbdwin.h" +#include "sinewin.h" #include "aac.h" #include "aactab.h" diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 9b53001dfe..d4b61126bd 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -35,6 +35,7 @@ #include "dsputil.h" #include "mpeg4audio.h" #include "kbdwin.h" +#include "sinewin.h" #include "aac.h" #include "aactab.h" diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 0241238db6..d6c7053d7b 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -36,6 +36,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "sinewin.h" #include "atrac.h" #include "atrac1data.h" diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 8e50daa24f..7717c4bbc6 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -54,6 +54,7 @@ #include "bytestream.h" #include "fft.h" #include "libavutil/audioconvert.h" +#include "sinewin.h" #include "cookdata.h" diff --git a/libavcodec/fft.h b/libavcodec/fft.h index 88fd325dfa..f10ef89621 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -62,19 +62,16 @@ struct FFTContext { #if CONFIG_HARDCODED_TABLES #define COSTABLE_CONST const #define SINTABLE_CONST const -#define SINETABLE_CONST const #else #define COSTABLE_CONST #define SINTABLE_CONST -#define SINETABLE_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] -#define SINETABLE(size) \ - SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size] + extern COSTABLE(16); extern COSTABLE(32); extern COSTABLE(64); @@ -124,27 +121,6 @@ void ff_dct_init_mmx(DCTContext *s); void ff_fft_end(FFTContext *s); -/** - * Generate a sine window. - * @param window pointer to half window - * @param n size of half window - */ -void ff_sine_window_init(float *window, int n); - -/** - * initialize the specified entry of ff_sine_windows - */ -void ff_init_ff_sine_windows(int index); -extern SINETABLE( 32); -extern SINETABLE( 64); -extern SINETABLE( 128); -extern SINETABLE( 256); -extern SINETABLE( 512); -extern SINETABLE(1024); -extern SINETABLE(2048); -extern SINETABLE(4096); -extern SINETABLE_CONST float * const ff_sine_windows[13]; - int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale); void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input); diff --git a/libavcodec/imc.c b/libavcodec/imc.c index ae2cc9d17a..e48a7094ba 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -41,6 +41,7 @@ #include "dsputil.h" #include "fft.h" #include "libavutil/audioconvert.h" +#include "sinewin.h" #include "imcdata.h" diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c index f2f34f9eda..9edb57760e 100644 --- a/libavcodec/mdct.c +++ b/libavcodec/mdct.c @@ -30,8 +30,6 @@ * MDCT/IMDCT transforms. */ -#include "mdct_tablegen.h" - /** * init MDCT or IMDCT computation. */ diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 32cf56c9ff..5ad49abceb 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -39,6 +39,7 @@ #include "dsputil.h" #include "fft.h" #include "fmtconvert.h" +#include "sinewin.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index cf73ea4a22..586443dd15 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -39,6 +39,7 @@ #include "avcodec.h" #include "dsputil.h" #include "fft.h" +#include "sinewin.h" #define BITSTREAM_WRITER_LE #include "put_bits.h" diff --git a/libavcodec/sinewin.c b/libavcodec/sinewin.c new file mode 100644 index 0000000000..be38dbc713 --- /dev/null +++ b/libavcodec/sinewin.c @@ -0,0 +1,20 @@ +/* + * 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 + */ + +#include "sinewin.h" +#include "sinewin_tablegen.h" diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h new file mode 100644 index 0000000000..2ed386a32d --- /dev/null +++ b/libavcodec/sinewin.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008 Robert Swain + * + * 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_SINEWIN_H +#define AVCODEC_SINEWIN_H + +#include "config.h" +#include "libavutil/mem.h" + +#if CONFIG_HARDCODED_TABLES +# define SINETABLE_CONST const +#else +# define SINETABLE_CONST +#endif + +#define SINETABLE(size) \ + SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size] + +/** + * Generate a sine window. + * @param window pointer to half window + * @param n size of half window + */ +void ff_sine_window_init(float *window, int n); + +/** + * initialize the specified entry of ff_sine_windows + */ +void ff_init_ff_sine_windows(int index); + +extern SINETABLE( 32); +extern SINETABLE( 64); +extern SINETABLE( 128); +extern SINETABLE( 256); +extern SINETABLE( 512); +extern SINETABLE(1024); +extern SINETABLE(2048); +extern SINETABLE(4096); + +extern SINETABLE_CONST float * const ff_sine_windows[13]; + +#endif diff --git a/libavcodec/mdct_tablegen.c b/libavcodec/sinewin_tablegen.c index 7750cf5ae5..2f4d1aa2ae 100644 --- a/libavcodec/mdct_tablegen.c +++ b/libavcodec/sinewin_tablegen.c @@ -1,5 +1,5 @@ /* - * Generate a header file for hardcoded MDCT tables + * Generate a header file for hardcoded sine windows * * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> * @@ -29,7 +29,7 @@ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif -#include "mdct_tablegen.h" +#include "sinewin_tablegen.h" #include "tableprint.h" int main(void) diff --git a/libavcodec/mdct_tablegen.h b/libavcodec/sinewin_tablegen.h index 4ea1556c9b..91c26c1551 100644 --- a/libavcodec/mdct_tablegen.h +++ b/libavcodec/sinewin_tablegen.h @@ -1,5 +1,5 @@ /* - * Header file for hardcoded MDCT tables + * Header file for hardcoded sine windows * * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> * @@ -36,7 +36,7 @@ SINETABLE(1024); SINETABLE(2048); SINETABLE(4096); #else -#include "libavcodec/mdct_tables.h" +#include "libavcodec/sinewin_tables.h" #endif SINETABLE_CONST float * const ff_sine_windows[] = { diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 275bf0aa66..e1a8dc455b 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -24,6 +24,7 @@ #include "dsputil.h" #include "fft.h" #include "lsp.h" +#include "sinewin.h" #include <math.h> #include <stdint.h> diff --git a/libavcodec/wma.c b/libavcodec/wma.c index 1dae1a5a6a..bed47ec35b 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "sinewin.h" #include "wma.h" #include "wmadata.h" diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 343ac84d9b..c9048a91d7 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -92,6 +92,7 @@ #include "put_bits.h" #include "wmaprodata.h" #include "dsputil.h" +#include "sinewin.h" #include "wma.h" /** current decoder limitations */ diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 0b0a2885cf..c1aa9757c5 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -38,6 +38,7 @@ #include "libavutil/lzo.h" #include "avfft.h" #include "fft.h" +#include "sinewin.h" #define MAX_BLOCKS 8 ///< maximum number of blocks per frame #define MAX_LSPS 16 ///< maximum filter order |