[FFmpeg-devel] [PATCH] avcodec/aac_tablegen: get rid of hardcoded tables entirely

Ganesh Ajjanagadde gajjanagadde at gmail.com
Fri Nov 27 23:07:34 CET 2015


Commit 96786a12f6df26990bbe7c0ca4592b3731724469 makes runtime
initialization cheap.

Tested with FATE, with/without --enable-hardcoded-tables.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavcodec/Makefile            |  6 ++----
 libavcodec/aac_tablegen.c      | 39 ---------------------------------------
 libavcodec/aac_tablegen.h      |  4 ----
 libavcodec/aac_tablegen_decl.h |  6 ------
 4 files changed, 2 insertions(+), 53 deletions(-)
 delete mode 100644 libavcodec/aac_tablegen.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 68a573f..e4a6a38 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -964,8 +964,7 @@ TESTOBJS = dctref.o
 
 TOOLS = fourcc2pixfmt
 
-HOSTPROGS = aac_tablegen                                                \
-            aacps_tablegen                                              \
+HOSTPROGS = aacps_tablegen                                              \
             aacps_fixed_tablegen                                        \
             aacsbr_tablegen                                             \
             aacsbr_fixed_tablegen                                       \
@@ -999,7 +998,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
 GEN_HEADERS = cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h aacps_fixed_tables.h aacsbr_tables.h \
-              aacsbr_fixed_tables.h aac_tables.h dsd_tables.h dv_tables.h     \
+              aacsbr_fixed_tables.h dsd_tables.h dv_tables.h     \
               sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h motionpixels_tables.h \
               pcm_tables.h qdm2_tables.h
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
@@ -1014,7 +1013,6 @@ $(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
 $(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
 $(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
-$(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
 $(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
 $(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h
 $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h
diff --git a/libavcodec/aac_tablegen.c b/libavcodec/aac_tablegen.c
deleted file mode 100644
index 2d13211..0000000
--- a/libavcodec/aac_tablegen.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Generate a header file for hardcoded AAC tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * 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>
-#define CONFIG_HARDCODED_TABLES 0
-#include "aac_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    ff_aac_tableinit();
-
-    write_fileheader();
-
-    WRITE_ARRAY("const", float, ff_aac_pow2sf_tab);
-
-    WRITE_ARRAY("const", float, ff_aac_pow34sf_tab);
-
-    return 0;
-}
diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h
index e7d96d5..2032650 100644
--- a/libavcodec/aac_tablegen.h
+++ b/libavcodec/aac_tablegen.h
@@ -25,9 +25,6 @@
 
 #include "aac_tablegen_decl.h"
 
-#if CONFIG_HARDCODED_TABLES
-#include "libavcodec/aac_tables.h"
-#else
 #include "libavutil/mathematics.h"
 float ff_aac_pow2sf_tab[428];
 float ff_aac_pow34sf_tab[428];
@@ -77,6 +74,5 @@ av_cold void ff_aac_tableinit(void)
         t2_inc_prev = t2_inc_cur;
     }
 }
-#endif /* CONFIG_HARDCODED_TABLES */
 
 #endif /* AVCODEC_AAC_TABLEGEN_H */
diff --git a/libavcodec/aac_tablegen_decl.h b/libavcodec/aac_tablegen_decl.h
index ef86f85..5916971 100644
--- a/libavcodec/aac_tablegen_decl.h
+++ b/libavcodec/aac_tablegen_decl.h
@@ -25,14 +25,8 @@
 
 #define POW_SF2_ZERO    200    ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
 
-#if CONFIG_HARDCODED_TABLES
-#define ff_aac_tableinit()
-extern const float ff_aac_pow2sf_tab[428];
-extern const float ff_aac_pow34sf_tab[428];
-#else
 void ff_aac_tableinit(void);
 extern       float ff_aac_pow2sf_tab[428];
 extern       float ff_aac_pow34sf_tab[428];
-#endif /* CONFIG_HARDCODED_TABLES */
 
 #endif /* AVCODEC_AAC_TABLEGEN_DECL_H */
-- 
2.6.2



More information about the ffmpeg-devel mailing list