[FFmpeg-devel] [PATCH 2/2] lavc/dsd_tablegen: always generate tables at runtime

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Dec 30 17:44:00 CET 2015


On Tue, Dec 29, 2015 at 8:56 AM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> Previous commit has sped up dsd_tablegen, and now table generation takes
> ~ 40k cycles. Thus, these tables can always be generated at runtime.
>
> Tested with/without --enable-hardcoded-tables.
>
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavcodec/Makefile       |  4 +---
>  libavcodec/dsd_tablegen.c | 38 --------------------------------------
>  libavcodec/dsd_tablegen.h |  5 -----
>  3 files changed, 1 insertion(+), 46 deletions(-)
>  delete mode 100644 libavcodec/dsd_tablegen.c
>
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 1c7568b..0717d0a 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -975,7 +975,6 @@ HOSTPROGS = aacps_tablegen                                              \
>              cbrt_tablegen                                               \
>              cbrt_fixed_tablegen                                         \
>              cos_tablegen                                                \
> -            dsd_tablegen                                                \
>              dv_tablegen                                                 \
>              motionpixels_tablegen                                       \
>              mpegaudio_tablegen                                          \
> @@ -1002,7 +1001,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 \
> -              dsd_tables.h dv_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))
> @@ -1016,7 +1015,6 @@ $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_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
> -$(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h
>  $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h
>  $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
>  $(SUBDIR)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h
> diff --git a/libavcodec/dsd_tablegen.c b/libavcodec/dsd_tablegen.c
> deleted file mode 100644
> index dbeb9fe..0000000
> --- a/libavcodec/dsd_tablegen.c
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/*
> - * Generate a header file for hardcoded DSD tables
> - *
> - * 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 "dsd_tablegen.h"
> -#include "tableprint.h"
> -#include <inttypes.h>
> -
> -int main(void)
> -{
> -    dsd_ctables_tableinit();
> -
> -    write_fileheader();
> -
> -    printf("static const double ctables[CTABLES][256] = {\n");
> -    write_float_2d_array(ctables, CTABLES, 256);
> -    printf("};\n");
> -
> -    return 0;
> -}
> diff --git a/libavcodec/dsd_tablegen.h b/libavcodec/dsd_tablegen.h
> index d4ef302..990d57a 100644
> --- a/libavcodec/dsd_tablegen.h
> +++ b/libavcodec/dsd_tablegen.h
> @@ -29,10 +29,6 @@
>  #define HTAPS   48                /** number of FIR constants */
>  #define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */
>
> -#if CONFIG_HARDCODED_TABLES
> -#define dsd_ctables_tableinit()
> -#include "libavcodec/dsd_tables.h"
> -#else
>  #include "libavutil/common.h"
>
>  /*
> @@ -91,6 +87,5 @@ static av_cold void dsd_ctables_tableinit(void)
>              ctables[CTABLES - 1 - t][e] = acc[t];
>      }
>  }
> -#endif /* CONFIG_HARDCODED_TABLES */
>
>  #endif /* AVCODEC_DSD_TABLEGEN_H */
> --
> 2.6.4
>

going in tonight in the absence of comments


More information about the ffmpeg-devel mailing list