[FFmpeg-cvslog] avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user
Andreas Rheinhardt
git at videolan.org
Sun Feb 7 11:47:10 EET 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Dec 30 01:46:34 2020 +0100| [698a4b22d09daf592c68b1a044ad22d5a7daf884] | committer: Andreas Rheinhardt
avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user
The fixed-point AAC decoder is the only user of the fixed-point sinewin
tables from sinewin; and it only uses a few of them (about 10% when
counting by size). This means that guarding initializing these tables by
an AVOnce (as done in 3719122065863f701026632f610175980d42b05a) is
unnecessary for them. Furthermore the array of pointers to the
individual arrays is also unneeded.
Therefore this commit moves these tables directly into aacdec_fixed.c;
this is done by ridding the original sinewin.h and sinewin_tablegen.h
headers completely of any fixed-point code at the cost of a bit of
duplicated code (the alternative is an ugly ifdef-mess).
This saves about 58KB from the binary when using hardcoded tables (as
these tables are hardcoded in this scenario); when not using hardcoded
tables, most of these savings only affect the .bss segment, but the rest
(< 1KB) contains relocations (i.e. savings in .data.rel.ro).
Reviewed-by: Lynne <dev at lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=698a4b22d09daf592c68b1a044ad22d5a7daf884
---
configure | 2 +-
libavcodec/Makefile | 4 +-
libavcodec/aac_defines.h | 4 +-
libavcodec/aacdec_fixed.c | 6 +--
libavcodec/aacdec_template.c | 31 ++++++++--------
libavcodec/sinewin.c | 1 -
libavcodec/sinewin.h | 13 ++-----
libavcodec/sinewin_fixed.c | 21 -----------
libavcodec/sinewin_fixed_tablegen.c | 22 ++++++++++-
libavcodec/sinewin_fixed_tablegen.h | 67 ++++++++++++++++++++++++++++++++++
libavcodec/sinewin_tablegen.c | 25 ++++++++++++-
libavcodec/sinewin_tablegen.h | 33 ++++++-----------
libavcodec/sinewin_tablegen_template.c | 55 ----------------------------
13 files changed, 149 insertions(+), 135 deletions(-)
diff --git a/configure b/configure
index a092a6b457..a76c2ec4ae 100755
--- a/configure
+++ b/configure
@@ -2652,7 +2652,7 @@ rdft_select="fft"
# decoders / encoders
aac_decoder_select="adts_header mdct15 mdct sinewin"
-aac_fixed_decoder_select="adts_header mdct sinewin"
+aac_fixed_decoder_select="adts_header mdct"
aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2ddf021f04..0c21be57c1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -141,7 +141,7 @@ OBJS-$(CONFIG_RANGECODER) += rangecoder.o
OBJS-$(CONFIG_RDFT) += rdft.o
OBJS-$(CONFIG_RV34DSP) += rv34dsp.o
OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o
-OBJS-$(CONFIG_SINEWIN) += sinewin.o sinewin_fixed.o
+OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_SNAPPY) += snappy.o
OBJS-$(CONFIG_STARTCODE) += startcode.o
OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o
@@ -1281,6 +1281,7 @@ $(GEN_HEADERS): $(SUBDIR)%_tables.h: $(SUBDIR)%_tablegen$(HOSTEXESUF)
ifdef CONFIG_HARDCODED_TABLES
$(SUBDIR)cbrt_data.o: $(SUBDIR)cbrt_tables.h
$(SUBDIR)cbrt_data_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
+$(SUBDIR)aacdec_fixed.o: $(SUBDIR)sinewin_fixed_tables.h
$(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
$(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
$(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
@@ -1292,5 +1293,4 @@ $(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h
$(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h
$(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h
$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
-$(SUBDIR)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h
endif
diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index 74ac011785..e94475ac54 100644
--- a/libavcodec/aac_defines.h
+++ b/libavcodec/aac_defines.h
@@ -34,7 +34,7 @@
#define AAC_RENAME(x) x ## _fixed
#define AAC_RENAME_32(x) x ## _fixed_32
-#define AAC_KBD_RENAME(x) aac_ ## x ## _fixed
+#define AAC_RENAME2(x) x ## _fixed
typedef int INTFLOAT;
typedef unsigned UINTFLOAT; ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations.
typedef int64_t INT64FLOAT;
@@ -84,7 +84,7 @@ typedef int AAC_SIGNE;
#define AAC_RENAME(x) x
#define AAC_RENAME_32(x) x
-#define AAC_KBD_RENAME(x) ff_aac_ ## x
+#define AAC_RENAME2(x) ff_ ## x
typedef float INTFLOAT;
typedef float UINTFLOAT;
typedef float INT64FLOAT;
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 4d82b7b1aa..c5d923a8b4 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -70,7 +70,7 @@
#include "fft.h"
#include "lpc.h"
#include "kbdwin.h"
-#include "sinewin.h"
+#include "sinewin_fixed_tablegen.h"
#include "aac.h"
#include "aactab.h"
@@ -86,8 +86,8 @@
#include <math.h>
#include <string.h>
-DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_long_1024))[1024];
-DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_short_128))[128];
+DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_1024))[1024];
+DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128];
static av_always_inline void reset_predict_state(PredictorState *ps)
{
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index fbe3074071..e5d311141f 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -1235,14 +1235,13 @@ static av_cold void aac_static_table_init(void)
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120);
+ AAC_RENAME(ff_init_ff_sine_windows)(9);
ff_aac_float_common_init();
#else
- AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_long_1024), 4.0, 1024);
- AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_short_128), 6.0, 128);
- AAC_RENAME(ff_init_ff_sine_windows)(10);
- AAC_RENAME(ff_init_ff_sine_windows)( 7);
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
+ init_sine_windows_fixed();
#endif
- AAC_RENAME(ff_init_ff_sine_windows)( 9);
AAC_RENAME(ff_cbrt_tableinit)();
}
@@ -2644,10 +2643,10 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics)
{
- const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
- const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
+ const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
@@ -2704,8 +2703,8 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce)
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *saved = sce->saved;
INTFLOAT *saved_ltp = sce->coeffs;
- const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
int i;
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
@@ -2743,9 +2742,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
INTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
INTFLOAT *saved = sce->saved;
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
- const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
+ const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
INTFLOAT *buf = ac->buf_mdct;
INTFLOAT *temp = ac->temp;
int i;
@@ -2891,10 +2890,10 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
if (ics->use_kb_window[1]) {
// AAC LD uses a low overlap sine window instead of a KBD window
memcpy(out, saved, 192 * sizeof(*out));
- ac->fdsp->vector_fmul_window(out + 192, saved + 192, buf, AAC_RENAME(ff_sine_128), 64);
+ ac->fdsp->vector_fmul_window(out + 192, saved + 192, buf, AAC_RENAME2(sine_128), 64);
memcpy( out + 320, buf + 64, 192 * sizeof(*out));
} else {
- ac->fdsp->vector_fmul_window(out, saved, buf, AAC_RENAME(ff_sine_512), 256);
+ ac->fdsp->vector_fmul_window(out, saved, buf, AAC_RENAME2(sine_512), 256);
}
// buffer update
diff --git a/libavcodec/sinewin.c b/libavcodec/sinewin.c
index 4532dc7354..1fa0e953f0 100644
--- a/libavcodec/sinewin.c
+++ b/libavcodec/sinewin.c
@@ -16,6 +16,5 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define USE_FIXED 0
#include "sinewin.h"
#include "sinewin_tablegen.h"
diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index e6de4dfe7b..fc4e69a58f 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -23,7 +23,6 @@
#include "config.h"
#include "libavutil/mem_internal.h"
-#include "libavcodec/aac_defines.h"
#if CONFIG_HARDCODED_TABLES
# define SINETABLE_CONST const
@@ -31,24 +30,20 @@
# define SINETABLE_CONST
#endif
-#ifndef USE_FIXED
-#define USE_FIXED 0
-#endif
-
#define SINETABLE(size) \
- SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size]
+ SINETABLE_CONST DECLARE_ALIGNED(32, float, ff_sine_##size)[size]
/**
* Generate a sine window.
* @param window pointer to half window
* @param n size of half window
*/
-void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n);
+void ff_sine_window_init(float *window, int n);
/**
* initialize the specified entry of ff_sine_windows
*/
-void AAC_RENAME(ff_init_ff_sine_windows)(int index);
+void ff_init_ff_sine_windows(int index);
extern SINETABLE( 32);
extern SINETABLE( 64);
@@ -60,6 +55,6 @@ extern SINETABLE(2048);
extern SINETABLE(4096);
extern SINETABLE(8192);
-extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[];
+extern SINETABLE_CONST float *const ff_sine_windows[];
#endif /* AVCODEC_SINEWIN_H */
diff --git a/libavcodec/sinewin_fixed.c b/libavcodec/sinewin_fixed.c
deleted file mode 100644
index 27ead29e8e..0000000000
--- a/libavcodec/sinewin_fixed.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define USE_FIXED 1
-#include "sinewin.h"
-#include "sinewin_tablegen.h"
diff --git a/libavcodec/sinewin_fixed_tablegen.c b/libavcodec/sinewin_fixed_tablegen.c
index 977e6f3cbf..61e5274afa 100644
--- a/libavcodec/sinewin_fixed_tablegen.c
+++ b/libavcodec/sinewin_fixed_tablegen.c
@@ -20,5 +20,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define USE_FIXED 1
-#include "sinewin_tablegen_template.c"
+#include "tableprint.h"
+
+#define BUILD_TABLES
+#define CONFIG_HARDCODED_TABLES 0
+#include "sinewin_fixed_tablegen.h"
+
+int main(void)
+{
+ write_fileheader();
+
+ init_sine_windows_fixed();
+#define PRINT_TABLE(size) \
+ printf("SINETABLE("#size") = {\n"); \
+ write_int32_t_array(sine_ ## size ## _fixed, size); \
+ printf("};\n")
+ PRINT_TABLE(128);
+ PRINT_TABLE(512);
+ PRINT_TABLE(1024);
+ return 0;
+}
diff --git a/libavcodec/sinewin_fixed_tablegen.h b/libavcodec/sinewin_fixed_tablegen.h
new file mode 100644
index 0000000000..c52c90bed7
--- /dev/null
+++ b/libavcodec/sinewin_fixed_tablegen.h
@@ -0,0 +1,67 @@
+/*
+ * Header file for hardcoded sine windows
+ *
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_SINEWIN_FIXED_TABLEGEN_H
+#define AVCODEC_SINEWIN_FIXED_TABLEGEN_H
+
+#ifdef BUILD_TABLES
+#undef DECLARE_ALIGNED
+#define DECLARE_ALIGNED(align, type, name) type name
+#else
+#include "libavutil/mem_internal.h"
+#endif
+
+#define SINETABLE(size) \
+ static SINETABLE_CONST DECLARE_ALIGNED(32, int, sine_##size##_fixed)[size]
+
+#if CONFIG_HARDCODED_TABLES
+#define init_sine_windows_fixed()
+#define SINETABLE_CONST const
+#include "libavcodec/sinewin_fixed_tables.h"
+#else
+// do not use libavutil/libm.h since this is compiled both
+// for the host and the target and config.h is only valid for the target
+#include <math.h>
+#include "libavutil/attributes.h"
+
+#define SINETABLE_CONST
+SINETABLE( 128);
+SINETABLE( 512);
+SINETABLE(1024);
+
+#define SIN_FIX(a) (int)floor((a) * 0x80000000 + 0.5)
+
+// Generate a sine window.
+static av_cold void sine_window_init_fixed(int *window, int n)
+{
+ for (int i = 0; i < n; i++)
+ window[i] = SIN_FIX(sinf((i + 0.5) * (M_PI / (2.0 * n))));
+}
+
+static av_cold void init_sine_windows_fixed(void)
+{
+ sine_window_init_fixed(sine_128_fixed, 128);
+ sine_window_init_fixed(sine_512_fixed, 512);
+ sine_window_init_fixed(sine_1024_fixed, 1024);
+}
+#endif /* CONFIG_HARDCODED_TABLES */
+#endif /* AVCODEC_SINEWIN_FIXED_TABLEGEN_H */
diff --git a/libavcodec/sinewin_tablegen.c b/libavcodec/sinewin_tablegen.c
index dd602668ee..438030ea83 100644
--- a/libavcodec/sinewin_tablegen.c
+++ b/libavcodec/sinewin_tablegen.c
@@ -20,5 +20,26 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define USE_FIXED 0
-#include "sinewin_tablegen_template.c"
+#define CONFIG_HARDCODED_TABLES 0
+#define BUILD_TABLES
+
+#define SINETABLE_CONST
+#define SINETABLE(size) \
+ float ff_sine_##size[size]
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+#include "sinewin_tablegen.h"
+#include "tableprint.h"
+
+int main(void)
+{
+ write_fileheader();
+
+ for (int i = 5; i <= 13; i++) {
+ ff_init_ff_sine_windows(i);
+ printf("SINETABLE(%4i) = {\n", 1 << i);
+ write_float_array(ff_sine_windows[i], 1 << i);
+ printf("};\n");
+ }
+
+ return 0;
+}
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index ced3b7874c..6887d59cfe 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -27,7 +27,6 @@
// do not use libavutil/libm.h since this is compiled both
// for the host and the target and config.h is only valid for the target
#include <math.h>
-#include "libavcodec/aac_defines.h"
#include "libavutil/attributes.h"
#include "libavutil/common.h"
@@ -46,38 +45,29 @@ SINETABLE(2048);
SINETABLE(4096);
SINETABLE(8192);
#else
-#if USE_FIXED
-#include "libavcodec/sinewin_fixed_tables.h"
-#else
#include "libavcodec/sinewin_tables.h"
#endif
-#endif
-
-#if USE_FIXED
-#define SIN_FIX(a) (int)floor((a) * 0x80000000 + 0.5)
-#else
-#define SIN_FIX(a) a
-#endif
-SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
+SINETABLE_CONST float *const ff_sine_windows[] = {
NULL, NULL, NULL, NULL, NULL, // unused
- AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128),
- AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024),
- AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), AAC_RENAME(ff_sine_8192),
+ ff_sine_32, ff_sine_64, ff_sine_128,
+ ff_sine_256, ff_sine_512, ff_sine_1024,
+ ff_sine_2048, ff_sine_4096, ff_sine_8192,
};
// Generate a sine window.
-av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) {
+av_cold void ff_sine_window_init(float *window, int n)
+{
int i;
for(i = 0; i < n; i++)
- window[i] = SIN_FIX(sinf((i + 0.5) * (M_PI / (2.0 * n))));
+ window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
}
#if !CONFIG_HARDCODED_TABLES && !defined(BUILD_TABLES)
#define INIT_FF_SINE_WINDOW_INIT_FUNC(index) \
static void init_ff_sine_window_ ## index(void) \
{ \
- AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_windows)[index], 1 << index);\
+ ff_sine_window_init(ff_sine_windows[index], 1 << index);\
}
INIT_FF_SINE_WINDOW_INIT_FUNC(5)
@@ -108,11 +98,12 @@ static AVOnce init_sine_window_once[9] = {
};
#endif
-av_cold void AAC_RENAME(ff_init_ff_sine_windows)(int index) {
- assert(index >= 5 && index < FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
+av_cold void ff_init_ff_sine_windows(int index)
+{
+ assert(index >= 5 && index < FF_ARRAY_ELEMS(ff_sine_windows));
#if !CONFIG_HARDCODED_TABLES
#ifdef BUILD_TABLES
- AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_windows)[index], 1 << index);
+ ff_sine_window_init(ff_sine_windows[index], 1 << index);
#else
ff_thread_once(&init_sine_window_once[index - 5], sine_window_init_func_array[index - 5]);
#endif
diff --git a/libavcodec/sinewin_tablegen_template.c b/libavcodec/sinewin_tablegen_template.c
deleted file mode 100644
index 7c3c1d8af2..0000000000
--- a/libavcodec/sinewin_tablegen_template.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generate a header file for hardcoded sine windows
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include "libavcodec/aac_defines.h"
-#define CONFIG_HARDCODED_TABLES 0
-#define BUILD_TABLES
-
-#if USE_FIXED
-#define WRITE_FUNC write_int32_t_array
-#else
-#define WRITE_FUNC write_float_array
-#endif
-
-#define SINETABLE_CONST
-#define SINETABLE(size) \
- INTFLOAT AAC_RENAME(ff_sine_##size)[size]
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#include "sinewin_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
- int i;
-
- write_fileheader();
-
- for (i = 5; i <= 13; i++) {
- AAC_RENAME(ff_init_ff_sine_windows)(i);
- printf("SINETABLE(%4i) = {\n", 1 << i);
- WRITE_FUNC(AAC_RENAME(ff_sine_windows)[i], 1 << i);
- printf("};\n");
- }
-
- return 0;
-}
More information about the ffmpeg-cvslog
mailing list