[FFmpeg-cvslog] Move sine windows to a separate file

Mans Rullgard git at videolan.org
Mon Mar 21 04:12:47 CET 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Mar 19 23:44:00 2011 +0000| [4538729afed44a0ee0a762d3ef69aa4bbb7f10b3] | committer: Mans Rullgard

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 at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4538729afed44a0ee0a762d3ef69aa4bbb7f10b3
---

 configure                                          |   27 +++++----
 libavcodec/Makefile                                |    5 +-
 libavcodec/aacdec.c                                |    1 +
 libavcodec/aacenc.c                                |    1 +
 libavcodec/atrac1.c                                |    1 +
 libavcodec/cook.c                                  |    1 +
 libavcodec/fft.h                                   |   26 +--------
 libavcodec/imc.c                                   |    1 +
 libavcodec/mdct.c                                  |    2 -
 libavcodec/nellymoserdec.c                         |    1 +
 libavcodec/nellymoserenc.c                         |    1 +
 libavcodec/sinewin.c                               |   20 +++++++
 libavcodec/sinewin.h                               |   59 ++++++++++++++++++++
 libavcodec/{mdct_tablegen.c => sinewin_tablegen.c} |    4 +-
 libavcodec/{mdct_tablegen.h => sinewin_tablegen.h} |    4 +-
 libavcodec/twinvq.c                                |    1 +
 libavcodec/wma.c                                   |    1 +
 libavcodec/wmaprodec.c                             |    1 +
 libavcodec/wmavoice.c                              |    1 +
 19 files changed, 112 insertions(+), 46 deletions(-)

diff --git a/configure b/configure
index 9282d1e..99c67c3 100755
--- a/configure
+++ b/configure
@@ -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 b21921b..04e35a1 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 0a1ac93..05bd7ed 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 9b53001..d4b6112 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 0241238..d6c7053 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 8e50daa..7717c4b 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 88fd325..f10ef89 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 ae2cc9d..e48a709 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 f2f34f9..9edb577 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 32cf56c..5ad49ab 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 cf73ea4..586443d 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 0000000..be38dbc
--- /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 0000000..2ed386a
--- /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
similarity index 94%
rename from libavcodec/mdct_tablegen.c
rename to libavcodec/sinewin_tablegen.c
index 7750cf5..2f4d1aa 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 at 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
similarity index 95%
rename from libavcodec/mdct_tablegen.h
rename to libavcodec/sinewin_tablegen.h
index 4ea1556..91c26c1 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 at 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 275bf0a..e1a8dc4 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 1dae1a5..bed47ec 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 343ac84..c9048a9 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 0b0a288..c1aa975 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




More information about the ffmpeg-cvslog mailing list