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>
This commit is contained in:
parent
4538729afe
commit
0aded9484d
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavcodec/fft.h"
|
#include "libavcodec/fft.h"
|
||||||
|
#include "libavcodec/rdft.h"
|
||||||
#include "libavcodec/synth_filter.h"
|
#include "libavcodec/synth_filter.h"
|
||||||
|
|
||||||
void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
|
void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "avfft.h"
|
#include "avfft.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
#include "rdft.h"
|
||||||
|
#include "dct.h"
|
||||||
|
|
||||||
/* FFT */
|
/* FFT */
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
#define ALT_BITSTREAM_READER_LE
|
#define ALT_BITSTREAM_READER_LE
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
#include "fft.h"
|
#include "dct.h"
|
||||||
|
#include "rdft.h"
|
||||||
#include "fmtconvert.h"
|
#include "fmtconvert.h"
|
||||||
#include "libavutil/intfloat_readwrite.h"
|
#include "libavutil/intfloat_readwrite.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
double (*func)(double) = do_sin ? sin : cos;
|
double (*func)(double) = do_sin ? sin : cos;
|
||||||
|
|
||||||
printf("/* This file was generated by libavcodec/costablegen */\n");
|
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++) {
|
for (i = 4; i <= BITS; i++) {
|
||||||
int m = 1 << i;
|
int m = 1 << i;
|
||||||
double freq = 2*M_PI/m;
|
double freq = 2*M_PI/m;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "fft.h"
|
#include "dct.h"
|
||||||
#include "x86/fft.h"
|
#include "x86/fft.h"
|
||||||
|
|
||||||
#define DCT32_FLOAT
|
#define DCT32_FLOAT
|
||||||
|
50
libavcodec/dct.h
Normal file
50
libavcodec/dct.h
Normal file
@ -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
|
@ -27,6 +27,8 @@
|
|||||||
#include "libavutil/lfg.h"
|
#include "libavutil/lfg.h"
|
||||||
#include "libavutil/log.h"
|
#include "libavutil/log.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
#include "dct.h"
|
||||||
|
#include "rdft.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -61,16 +61,12 @@ struct FFTContext {
|
|||||||
|
|
||||||
#if CONFIG_HARDCODED_TABLES
|
#if CONFIG_HARDCODED_TABLES
|
||||||
#define COSTABLE_CONST const
|
#define COSTABLE_CONST const
|
||||||
#define SINTABLE_CONST const
|
|
||||||
#else
|
#else
|
||||||
#define COSTABLE_CONST
|
#define COSTABLE_CONST
|
||||||
#define SINTABLE_CONST
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define COSTABLE(size) \
|
#define COSTABLE(size) \
|
||||||
COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2]
|
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(16);
|
||||||
extern COSTABLE(32);
|
extern COSTABLE(32);
|
||||||
@ -93,20 +89,6 @@ extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
|
|||||||
*/
|
*/
|
||||||
void ff_init_ff_cos_tabs(int index);
|
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.
|
* Set up a complex FFT.
|
||||||
* @param nbits log2 of the length of the input array
|
* @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_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||||
void ff_mdct_end(FFTContext *s);
|
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 */
|
#endif /* AVCODEC_FFT_H */
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
#include "fft.h"
|
#include "dct.h"
|
||||||
|
|
||||||
#define CONFIG_AUDIO_NONSHORT 0
|
#define CONFIG_AUDIO_NONSHORT 0
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "fft.h"
|
#include "rdft.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
|
74
libavcodec/rdft.h
Normal file
74
libavcodec/rdft.h
Normal file
@ -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
|
@ -36,8 +36,8 @@
|
|||||||
#include "acelp_filters.h"
|
#include "acelp_filters.h"
|
||||||
#include "lsp.h"
|
#include "lsp.h"
|
||||||
#include "libavutil/lzo.h"
|
#include "libavutil/lzo.h"
|
||||||
#include "avfft.h"
|
#include "dct.h"
|
||||||
#include "fft.h"
|
#include "rdft.h"
|
||||||
#include "sinewin.h"
|
#include "sinewin.h"
|
||||||
|
|
||||||
#define MAX_BLOCKS 8 ///< maximum number of blocks per frame
|
#define MAX_BLOCKS 8 ///< maximum number of blocks per frame
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "libavutil/cpu.h"
|
#include "libavutil/cpu.h"
|
||||||
#include "libavcodec/dsputil.h"
|
#include "libavcodec/dsputil.h"
|
||||||
|
#include "libavcodec/dct.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
|
||||||
av_cold void ff_fft_init_mmx(FFTContext *s)
|
av_cold void ff_fft_init_mmx(FFTContext *s)
|
||||||
|
Loading…
Reference in New Issue
Block a user