Replace hackish support for amr-nb and amr-wb. Instead of including the source
authorStanislav Brabec <sbrabec@suse.cz>
Thu, 12 Apr 2007 10:59:52 +0000 (10:59 +0000)
committerDiego Biurrun <diego@biurrun.de>
Thu, 12 Apr 2007 10:59:52 +0000 (10:59 +0000)
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
libavcodec/Makefile
libavcodec/amr.c

index 096ba3b28bb29e4cc524602a41929d4a86ceee02..2c6eeead58c3fd701f42628ddb18e3dea21eda79 100755 (executable)
--- 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-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]"
   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
     $CONFIG_LIST
     $TARGET_LIST
     $THREADS_LIST
-    amr_if2
     debug
     extra_warnings
     shared
     debug
     extra_warnings
     shared
@@ -765,7 +763,6 @@ v4l2="yes"
 v4l="yes"
 
 # libraries
 v4l="yes"
 
 # libraries
-amr_if2="no"
 amr_nb="no"
 amr_nb_fixed="no"
 amr_wb="no"
 amr_nb="no"
 amr_nb_fixed="no"
 amr_wb="no"
@@ -1587,11 +1584,13 @@ for thread in $THREADS_LIST; do
     fi
 done
 
     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_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
 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-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
 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
 
 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
 # 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/mlib \
          libavcodec/ppc \
          libavcodec/amr \
-         libavcodec/amr_float \
-         libavcodec/amrwb_float \
          libpostproc \
          libavutil \
          libswscale \
          libpostproc \
          libavutil \
          libswscale \
index f1a168557bdda171243e0f60485c22c054344692..9292c85b3f42ba09e5f93ab2bb16fd3d0ec33ad8 100644 (file)
@@ -4,7 +4,7 @@
 #
 include ../config.mak
 
 #
 include ../config.mak
 
-CFLAGS+=-I$(SRC_PATH)/libswscale $(AMR_CFLAGS)
+CFLAGS+=-I$(SRC_PATH)/libswscale
 
 OBJS= bitstream.o \
       utils.o \
 
 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_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
 
 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
 
 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/*~ \
           ps2/*.o ps2/*~ \
           sh4/*.o sh4/*~ \
           sparc/*.o sparc/*~ \
-          amr_float/*.o \
           apiexample $(TESTS)
        -$(MAKE) -C amr clean
           apiexample $(TESTS)
        -$(MAKE) -C amr clean
-       -$(MAKE) -C amrwb_float -f makefile.gcc clean
 
 apiexample: apiexample.o $(LIB)
 
 
 apiexample: apiexample.o $(LIB)
 
index 0a462542dee37fb300ea7326d2a9be57a42f75fa..3ded25edd916dc96402414656a8a11ebba032510 100644 (file)
@@ -82,8 +82,8 @@
 #include "amr/e_homing.h"
 
 #else
 #include "amr/e_homing.h"
 
 #else
-#include "amr_float/interf_dec.h"
-#include "amr_float/interf_enc.h"
+#include <amrnb/interf_dec.h>
+#include <amrnb/interf_enc.h>
 #endif
 
 static const char *nb_bitrate_unsupported =
 #endif
 
 static const char *nb_bitrate_unsupported =
@@ -532,8 +532,9 @@ AVCodec amr_nb_encoder =
 #define typedef_h
 #endif
 
 #define typedef_h
 #endif
 
-#include "amrwb_float/enc_if.h"
-#include "amrwb_float/dec_if.h"
+#include <amrwb/enc_if.h>
+#include <amrwb/dec_if.h>
+#include <amrwb/if_rom.h>
 
 /* Common code for fixed and float version*/
 typedef struct AMRWB_bitrates
 
 /* 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;
 }
 
     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)
 static int amr_wb_decode_frame(AVCodecContext * avctx,
             void *data, int *data_size,
             uint8_t * buf, int buf_size)