From 91024272cb397568517545387ee3e506e2631fe8 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Thu, 12 Apr 2007 10:59:52 +0000 Subject: [PATCH] Replace hackish support for amr-nb and amr-wb. Instead of including the source of the reference implementation it is possible to use proper libraries now. patch by Stanislav Brabec, sbrabec suse cz, changes and bug fixes by me Originally committed as revision 8717 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 14 +++----------- libavcodec/Makefile | 26 +------------------------- libavcodec/amr.c | 11 +++++------ 3 files changed, 9 insertions(+), 42 deletions(-) diff --git a/configure b/configure index 096ba3b28b..2c6eeead58 100755 --- a/configure +++ b/configure @@ -102,7 +102,6 @@ show_help(){ echo " --enable-amr-nb enable amr-nb floating point audio codec" echo " --enable-amr-nb-fixed enable amr-nb fixed-point codec" echo " --enable-amr-wb enable amr-wb floating point audio codec" - echo " --enable-amr-if2 enable amr-wb IF2 audio codec" echo "" echo "Advanced options (experts only):" echo " --source-path=PATH path to source code [$source_path]" @@ -640,7 +639,6 @@ CMDLINE_SELECT=" $CONFIG_LIST $TARGET_LIST $THREADS_LIST - amr_if2 debug extra_warnings shared @@ -765,7 +763,6 @@ v4l2="yes" v4l="yes" # libraries -amr_if2="no" amr_nb="no" amr_nb_fixed="no" amr_wb="no" @@ -1587,11 +1584,13 @@ for thread in $THREADS_LIST; do fi done -enabled_any amr_nb amr_nb_fixed amr_wb amr_if2 && enable amr +enabled_any amr_nb amr_nb_fixed amr_wb && enable amr enabled_all amr_nb amr_nb_fixed && die "Only one of amr_nb and amr_nb_fixed may be enabled." # these are off by default, so fail if requested and not available +enabled amr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm +enabled amr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm enabled liba52 && require liba52 a52dec/a52.h a52_init -la52 enabled libdts && require libdts dts.h dts_init -ldts -lm enabled libgsm && require libgsm gsm.h gsm_create -lgsm @@ -1868,7 +1867,6 @@ echo "zlib enabled $zlib" echo "AMR-NB float support $amr_nb" echo "AMR-NB fixed support $amr_nb_fixed" echo "AMR-WB float support $amr_wb" -echo "AMR-WB IF2 support $amr_if2" if disabled gpl; then echo "License: LGPL" else @@ -2006,10 +2004,6 @@ echo "SRC_PATH=\"$source_path\"" >> config.mak echo "SRC_PATH_BARE=$source_path" >> config.mak echo "BUILD_ROOT=\"$PWD\"" >> config.mak -if enabled amr_if2; then - echo "AMR_CFLAGS=-DIF2=1" >> config.mak -fi - # Apparently it's not possible to portably echo a backslash. if enabled asmalign_pot; then printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH @@ -2054,8 +2048,6 @@ if enabled source_path_used; then libavcodec/mlib \ libavcodec/ppc \ libavcodec/amr \ - libavcodec/amr_float \ - libavcodec/amrwb_float \ libpostproc \ libavutil \ libswscale \ diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f1a168557b..9292c85b3f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -4,7 +4,7 @@ # include ../config.mak -CFLAGS+=-I$(SRC_PATH)/libswscale $(AMR_CFLAGS) +CFLAGS+=-I$(SRC_PATH)/libswscale OBJS= bitstream.o \ utils.o \ @@ -270,33 +270,11 @@ OBJS-$(CONFIG_X264) += x264.o OBJS-$(CONFIG_XVID) += xvidff.o xvid_rc.o OBJS-$(CONFIG_AMR) += amr.o -OBJS-$(CONFIG_AMR_NB) += amr_float/sp_dec.o \ - amr_float/sp_enc.o \ - amr_float/interf_dec.o \ - amr_float/interf_enc.o - ifeq ($(CONFIG_AMR_NB_FIXED),yes) EXTRAOBJS += amr/*.o EXTRADEPS=amrlibs endif -OBJS-$(CONFIG_AMR_WB) += amrwb_float/dec_acelp.o \ - amrwb_float/dec_dtx.o \ - amrwb_float/dec_gain.o \ - amrwb_float/dec_if.o \ - amrwb_float/dec_lpc.o \ - amrwb_float/dec_main.o \ - amrwb_float/dec_rom.o \ - amrwb_float/dec_util.o \ - amrwb_float/enc_acelp.o \ - amrwb_float/enc_dtx.o \ - amrwb_float/enc_gain.o \ - amrwb_float/enc_if.o \ - amrwb_float/enc_lpc.o \ - amrwb_float/enc_main.o \ - amrwb_float/enc_rom.o \ - amrwb_float/enc_util.o \ - amrwb_float/if_rom.o OBJS-$(CONFIG_AAC_PARSER) += parser.o OBJS-$(CONFIG_AC3_PARSER) += parser.o ac3.o @@ -433,10 +411,8 @@ clean:: ps2/*.o ps2/*~ \ sh4/*.o sh4/*~ \ sparc/*.o sparc/*~ \ - amr_float/*.o \ apiexample $(TESTS) -$(MAKE) -C amr clean - -$(MAKE) -C amrwb_float -f makefile.gcc clean apiexample: apiexample.o $(LIB) diff --git a/libavcodec/amr.c b/libavcodec/amr.c index 0a462542de..3ded25edd9 100644 --- a/libavcodec/amr.c +++ b/libavcodec/amr.c @@ -82,8 +82,8 @@ #include "amr/e_homing.h" #else -#include "amr_float/interf_dec.h" -#include "amr_float/interf_enc.h" +#include +#include #endif static const char *nb_bitrate_unsupported = @@ -532,8 +532,9 @@ AVCodec amr_nb_encoder = #define typedef_h #endif -#include "amrwb_float/enc_if.h" -#include "amrwb_float/dec_if.h" +#include +#include +#include /* Common code for fixed and float version*/ typedef struct AMRWB_bitrates @@ -652,8 +653,6 @@ static int amr_wb_decode_init(AVCodecContext * avctx) return 0; } -extern const UWord8 block_size[]; - static int amr_wb_decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size)