mirror of https://git.ffmpeg.org/ffmpeg.git
dct: build dct32 as separate object files
This builds the float and fixed-point versions of dct32 separately instead of #including the file in dct.c and mpegaudiodec.c. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
1362a291c9
commit
6f2309ed2e
|
@ -27,7 +27,7 @@ OBJS = allcodecs.o \
|
||||||
OBJS-$(CONFIG_AANDCT) += aandcttab.o
|
OBJS-$(CONFIG_AANDCT) += aandcttab.o
|
||||||
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
|
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
|
||||||
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
|
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
|
||||||
OBJS-$(CONFIG_DCT) += dct.o
|
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||||
OBJS-$(CONFIG_DWT) += dwt.o
|
OBJS-$(CONFIG_DWT) += dwt.o
|
||||||
OBJS-$(CONFIG_DXVA2) += dxva2.o
|
OBJS-$(CONFIG_DXVA2) += dxva2.o
|
||||||
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o
|
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "dct.h"
|
#include "dct.h"
|
||||||
|
#include "dct32.h"
|
||||||
#define DCT32_FLOAT
|
|
||||||
#include "dct32.c"
|
|
||||||
|
|
||||||
/* sin((M_PI * x / (2*n)) */
|
/* sin((M_PI * x / (2*n)) */
|
||||||
#define SIN(s,n,x) (s->costab[(n) - (x)])
|
#define SIN(s,n,x) (s->costab[(n) - (x)])
|
||||||
|
@ -210,7 +208,7 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s->dct32 = dct32;
|
s->dct32 = ff_dct32_float;
|
||||||
if (HAVE_MMX) ff_dct_init_mmx(s);
|
if (HAVE_MMX) ff_dct_init_mmx(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -19,10 +19,19 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DCT32_FLOAT
|
#include "dct32.h"
|
||||||
|
#include "mathops.h"
|
||||||
|
|
||||||
|
#if DCT32_FLOAT
|
||||||
|
# define dct32 ff_dct32_float
|
||||||
# define FIXHR(x) ((float)(x))
|
# define FIXHR(x) ((float)(x))
|
||||||
# define MULH3(x, y, s) ((s)*(y)*(x))
|
# define MULH3(x, y, s) ((s)*(y)*(x))
|
||||||
# define INTFLOAT float
|
# define INTFLOAT float
|
||||||
|
#else
|
||||||
|
# define dct32 ff_dct32_fixed
|
||||||
|
# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
|
||||||
|
# define MULH3(x, y, s) MULH((s)*(x), y)
|
||||||
|
# define INTFLOAT int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +112,7 @@
|
||||||
#define ADD(a, b) val##a += val##b
|
#define ADD(a, b) val##a += val##b
|
||||||
|
|
||||||
/* DCT32 without 1/sqrt(2) coef zero scaling. */
|
/* DCT32 without 1/sqrt(2) coef zero scaling. */
|
||||||
static void dct32(INTFLOAT *out, const INTFLOAT *tab)
|
void dct32(INTFLOAT *out, const INTFLOAT *tab)
|
||||||
{
|
{
|
||||||
INTFLOAT tmp0, tmp1;
|
INTFLOAT tmp0, tmp1;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* 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_DCT32_H
|
||||||
|
#define AVCODEC_DCT32_H
|
||||||
|
|
||||||
|
void ff_dct32_float(float *dst, const float *src);
|
||||||
|
void ff_dct32_fixed(int *dst, const int *src);
|
||||||
|
|
||||||
|
#endif
|
|
@ -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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DCT32_FLOAT 0
|
||||||
|
#include "dct32.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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DCT32_FLOAT 1
|
||||||
|
#include "dct32.c"
|
|
@ -29,6 +29,7 @@
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
|
#include "dct32.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
|
@ -68,12 +69,6 @@
|
||||||
#include "mpegaudiodata.h"
|
#include "mpegaudiodata.h"
|
||||||
#include "mpegaudiodectab.h"
|
#include "mpegaudiodectab.h"
|
||||||
|
|
||||||
#if CONFIG_FLOAT
|
|
||||||
# include "fft.h"
|
|
||||||
#else
|
|
||||||
# include "dct32.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void compute_antialias(MPADecodeContext *s, GranuleDef *g);
|
static void compute_antialias(MPADecodeContext *s, GranuleDef *g);
|
||||||
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,
|
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,
|
||||||
int *dither_state, OUT_INT *samples, int incr);
|
int *dither_state, OUT_INT *samples, int incr);
|
||||||
|
@ -637,7 +632,7 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
|
||||||
offset = *synth_buf_offset;
|
offset = *synth_buf_offset;
|
||||||
synth_buf = synth_buf_ptr + offset;
|
synth_buf = synth_buf_ptr + offset;
|
||||||
|
|
||||||
dct32(synth_buf, sb_samples);
|
ff_dct32_fixed(synth_buf, sb_samples);
|
||||||
apply_window_mp3_c(synth_buf, window, dither_state, samples, incr);
|
apply_window_mp3_c(synth_buf, window, dither_state, samples, incr);
|
||||||
|
|
||||||
offset = (offset - 32) & 511;
|
offset = (offset - 32) & 511;
|
||||||
|
|
Loading…
Reference in New Issue