Browse Source

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>
tags/n0.8
Mans Rullgard 14 years ago
parent
commit
4538729afe
19 changed files with 112 additions and 46 deletions
  1. +14
    -13
      configure
  2. +3
    -2
      libavcodec/Makefile
  3. +1
    -0
      libavcodec/aacdec.c
  4. +1
    -0
      libavcodec/aacenc.c
  5. +1
    -0
      libavcodec/atrac1.c
  6. +1
    -0
      libavcodec/cook.c
  7. +1
    -25
      libavcodec/fft.h
  8. +1
    -0
      libavcodec/imc.c
  9. +0
    -2
      libavcodec/mdct.c
  10. +1
    -0
      libavcodec/nellymoserdec.c
  11. +1
    -0
      libavcodec/nellymoserenc.c
  12. +20
    -0
      libavcodec/sinewin.c
  13. +59
    -0
      libavcodec/sinewin.h
  14. +2
    -2
      libavcodec/sinewin_tablegen.c
  15. +2
    -2
      libavcodec/sinewin_tablegen.h
  16. +1
    -0
      libavcodec/twinvq.c
  17. +1
    -0
      libavcodec/wma.c
  18. +1
    -0
      libavcodec/wmaprodec.c
  19. +1
    -0
      libavcodec/wmavoice.c

+ 14
- 13
configure View File

@@ -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"


+ 3
- 2
libavcodec/Makefile View File

@@ -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


+ 1
- 0
libavcodec/aacdec.c View File

@@ -88,6 +88,7 @@
#include "fmtconvert.h"
#include "lpc.h"
#include "kbdwin.h"
#include "sinewin.h"

#include "aac.h"
#include "aactab.h"


+ 1
- 0
libavcodec/aacenc.c View File

@@ -35,6 +35,7 @@
#include "dsputil.h"
#include "mpeg4audio.h"
#include "kbdwin.h"
#include "sinewin.h"

#include "aac.h"
#include "aactab.h"


+ 1
- 0
libavcodec/atrac1.c View File

@@ -36,6 +36,7 @@
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
#include "sinewin.h"

#include "atrac.h"
#include "atrac1data.h"


+ 1
- 0
libavcodec/cook.c View File

@@ -54,6 +54,7 @@
#include "bytestream.h"
#include "fft.h"
#include "libavutil/audioconvert.h"
#include "sinewin.h"

#include "cookdata.h"



+ 1
- 25
libavcodec/fft.h View File

@@ -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);


+ 1
- 0
libavcodec/imc.c View File

@@ -41,6 +41,7 @@
#include "dsputil.h"
#include "fft.h"
#include "libavutil/audioconvert.h"
#include "sinewin.h"

#include "imcdata.h"



+ 0
- 2
libavcodec/mdct.c View File

@@ -30,8 +30,6 @@
* MDCT/IMDCT transforms.
*/

#include "mdct_tablegen.h"

/**
* init MDCT or IMDCT computation.
*/


+ 1
- 0
libavcodec/nellymoserdec.c View File

@@ -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"


+ 1
- 0
libavcodec/nellymoserenc.c View File

@@ -39,6 +39,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
#include "sinewin.h"

#define BITSTREAM_WRITER_LE
#include "put_bits.h"


+ 20
- 0
libavcodec/sinewin.c View File

@@ -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"

+ 59
- 0
libavcodec/sinewin.h View File

@@ -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

libavcodec/mdct_tablegen.c → libavcodec/sinewin_tablegen.c View File

@@ -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)

libavcodec/mdct_tablegen.h → libavcodec/sinewin_tablegen.h View File

@@ -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[] = {

+ 1
- 0
libavcodec/twinvq.c View File

@@ -24,6 +24,7 @@
#include "dsputil.h"
#include "fft.h"
#include "lsp.h"
#include "sinewin.h"

#include <math.h>
#include <stdint.h>


+ 1
- 0
libavcodec/wma.c View File

@@ -20,6 +20,7 @@
*/

#include "avcodec.h"
#include "sinewin.h"
#include "wma.h"
#include "wmadata.h"



+ 1
- 0
libavcodec/wmaprodec.c View File

@@ -92,6 +92,7 @@
#include "put_bits.h"
#include "wmaprodata.h"
#include "dsputil.h"
#include "sinewin.h"
#include "wma.h"

/** current decoder limitations */


+ 1
- 0
libavcodec/wmavoice.c View File

@@ -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


Loading…
Cancel
Save