summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore26
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.am215
-rw-r--r--configure.ac24
-rw-r--r--fdk-aac.pc.in10
-rw-r--r--fdk-aac.sym18
-rw-r--r--libAACenc/src/aacenc_lib.cpp5
-rw-r--r--libAACenc/src/aacenc_tns.cpp4
-rw-r--r--libAACenc/src/band_nrg.cpp2
-rw-r--r--libAACenc/src/grp_data.cpp8
-rw-r--r--libFDK/include/clz.h12
-rw-r--r--libSBRenc/src/env_est.cpp4
-rw-r--r--libSBRenc/src/sbr_ram_enc.cpp (renamed from libSBRenc/src/sbr_ram.cpp)0
-rw-r--r--libSBRenc/src/sbr_rom_enc.cpp (renamed from libSBRenc/src/sbr_rom.cpp)0
-rw-r--r--m4/.gitkeep0
15 files changed, 323 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..90c8b90
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,26 @@
+*.o
+*.lo
+*.la
+.deps
+.libs
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+configure
+fdk-aac.pc
+config.guess
+config.log
+config.status
+config.sub
+depcomp
+install-sh
+libtool
+ltmain.sh
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
+missing
+stamp-h1
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e844fc6
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,4 @@
+0.1.0
+ - Initial release of fdk-aac
+ - autotools based build system
+ - Enable setting VBR bitrate modes
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..9743bfa
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,215 @@
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/libAACdec/include \
+ -I$(top_srcdir)/libAACenc/include \
+ -I$(top_srcdir)/libSBRdec/include \
+ -I$(top_srcdir)/libSBRenc/include \
+ -I$(top_srcdir)/libMpegTPDec/include \
+ -I$(top_srcdir)/libMpegTPEnc/include \
+ -I$(top_srcdir)/libSYS/include \
+ -I$(top_srcdir)/libFDK/include \
+ -I$(top_srcdir)/libPCMutils/include
+
+AM_CXXFLAGS = -fno-exceptions -fno-rtti
+libfdk_aac_la_LINK = $(LINK) $(libfdk_aac_la_LDFLAGS)
+# Mention a dummy pure C file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libfdk_aac_la_SOURCES = dummy.c
+
+fdk_aacincludedir = $(includedir)/fdk-aac
+fdk_aacinclude_HEADERS = \
+ $(top_srcdir)/libSYS/include/machine_type.h \
+ $(top_srcdir)/libSYS/include/genericStds.h \
+ $(top_srcdir)/libSYS/include/FDK_audio.h \
+ $(top_srcdir)/libAACenc/include/aacenc_lib.h \
+ $(top_srcdir)/libAACdec/include/aacdecoder_lib.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = fdk-aac.pc
+
+lib_LTLIBRARIES = libfdk-aac.la
+
+libfdk_aac_la_LDFLAGS = -version-info @FDK_AAC_VERSION@ -no-undefined \
+ -export-symbols $(top_srcdir)/fdk-aac.sym
+
+AACDEC_DIR = $(top_srcdir)/libAACdec/src
+AACDEC_SRC = \
+ $(AACDEC_DIR)/aacdec_drc.cpp \
+ $(AACDEC_DIR)/aacdec_hcr.cpp \
+ $(AACDEC_DIR)/aacdecoder.cpp \
+ $(AACDEC_DIR)/aacdec_pns.cpp \
+ $(AACDEC_DIR)/aac_ram.cpp \
+ $(AACDEC_DIR)/block.cpp \
+ $(AACDEC_DIR)/channelinfo.cpp \
+ $(AACDEC_DIR)/ldfiltbank.cpp \
+ $(AACDEC_DIR)/rvlcbit.cpp \
+ $(AACDEC_DIR)/rvlc.cpp \
+ $(AACDEC_DIR)/aacdec_hcr_bit.cpp \
+ $(AACDEC_DIR)/aacdec_hcrs.cpp \
+ $(AACDEC_DIR)/aacdecoder_lib.cpp \
+ $(AACDEC_DIR)/aacdec_tns.cpp \
+ $(AACDEC_DIR)/aac_rom.cpp \
+ $(AACDEC_DIR)/channel.cpp \
+ $(AACDEC_DIR)/conceal.cpp \
+ $(AACDEC_DIR)/pulsedata.cpp \
+ $(AACDEC_DIR)/rvlcconceal.cpp \
+ $(AACDEC_DIR)/stereo.cpp
+
+AACENC_DIR = $(top_srcdir)/libAACenc/src
+AACENC_SRC = \
+ $(AACENC_DIR)/aacenc.cpp \
+ $(AACENC_DIR)/aacEnc_ram.cpp \
+ $(AACENC_DIR)/band_nrg.cpp \
+ $(AACENC_DIR)/block_switch.cpp \
+ $(AACENC_DIR)/grp_data.cpp \
+ $(AACENC_DIR)/metadata_main.cpp \
+ $(AACENC_DIR)/pre_echo_control.cpp \
+ $(AACENC_DIR)/quantize.cpp \
+ $(AACENC_DIR)/tonality.cpp \
+ $(AACENC_DIR)/aacenc_hcr.cpp \
+ $(AACENC_DIR)/aacEnc_rom.cpp \
+ $(AACENC_DIR)/bandwidth.cpp \
+ $(AACENC_DIR)/channel_map.cpp \
+ $(AACENC_DIR)/intensity.cpp \
+ $(AACENC_DIR)/ms_stereo.cpp \
+ $(AACENC_DIR)/psy_configuration.cpp \
+ $(AACENC_DIR)/sf_estim.cpp \
+ $(AACENC_DIR)/transform.cpp \
+ $(AACENC_DIR)/aacenc_lib.cpp \
+ $(AACENC_DIR)/aacenc_tns.cpp \
+ $(AACENC_DIR)/bit_cnt.cpp \
+ $(AACENC_DIR)/chaosmeasure.cpp \
+ $(AACENC_DIR)/line_pe.cpp \
+ $(AACENC_DIR)/noisedet.cpp \
+ $(AACENC_DIR)/psy_main.cpp \
+ $(AACENC_DIR)/spreading.cpp \
+ $(AACENC_DIR)/aacenc_pns.cpp \
+ $(AACENC_DIR)/adj_thr.cpp \
+ $(AACENC_DIR)/bitenc.cpp \
+ $(AACENC_DIR)/dyn_bits.cpp \
+ $(AACENC_DIR)/metadata_compressor.cpp \
+ $(AACENC_DIR)/pnsparam.cpp \
+ $(AACENC_DIR)/qc_main.cpp \
+ $(AACENC_DIR)/tns_param.cpp
+
+FDK_DIR = $(top_srcdir)/libFDK/src
+FDK_SRC = \
+ $(FDK_DIR)/autocorr2nd.cpp \
+ $(FDK_DIR)/dct.cpp \
+ $(FDK_DIR)/FDK_bitbuffer.cpp \
+ $(FDK_DIR)/FDK_core.cpp \
+ $(FDK_DIR)/FDK_crc.cpp \
+ $(FDK_DIR)/FDK_hybrid.cpp \
+ $(FDK_DIR)/FDK_tools_rom.cpp \
+ $(FDK_DIR)/FDK_trigFcts.cpp \
+ $(FDK_DIR)/fft.cpp \
+ $(FDK_DIR)/fft_rad2.cpp \
+ $(FDK_DIR)/fixpoint_math.cpp \
+ $(FDK_DIR)/mdct.cpp \
+ $(FDK_DIR)/qmf.cpp \
+ $(FDK_DIR)/scale.cpp
+
+MPEGTPDEC_DIR = $(top_srcdir)/libMpegTPDec/src
+MPEGTPDEC_SRC = \
+ $(MPEGTPDEC_DIR)/tpdec_adif.cpp \
+ $(MPEGTPDEC_DIR)/tpdec_adts.cpp \
+ $(MPEGTPDEC_DIR)/tpdec_asc.cpp \
+ $(MPEGTPDEC_DIR)/tpdec_latm.cpp \
+ $(MPEGTPDEC_DIR)/tpdec_lib.cpp
+
+MPEGTPENC_DIR = $(top_srcdir)/libMpegTPEnc/src
+MPEGTPENC_SRC = \
+ $(MPEGTPENC_DIR)/tpenc_adif.cpp \
+ $(MPEGTPENC_DIR)/tpenc_adts.cpp \
+ $(MPEGTPENC_DIR)/tpenc_asc.cpp \
+ $(MPEGTPENC_DIR)/tpenc_latm.cpp \
+ $(MPEGTPENC_DIR)/tpenc_lib.cpp
+
+PCMUTILS_DIR = $(top_srcdir)/libPCMutils/src
+PCMUTILS_SRC = \
+ $(PCMUTILS_DIR)/pcmutils_lib.cpp
+
+SBRDEC_DIR = $(top_srcdir)/libSBRdec/src
+SBRDEC_SRC = \
+ $(SBRDEC_DIR)/env_calc.cpp \
+ $(SBRDEC_DIR)/env_dec.cpp \
+ $(SBRDEC_DIR)/env_extr.cpp \
+ $(SBRDEC_DIR)/huff_dec.cpp \
+ $(SBRDEC_DIR)/lpp_tran.cpp \
+ $(SBRDEC_DIR)/psbitdec.cpp \
+ $(SBRDEC_DIR)/psdec.cpp \
+ $(SBRDEC_DIR)/psdec_hybrid.cpp \
+ $(SBRDEC_DIR)/sbr_crc.cpp \
+ $(SBRDEC_DIR)/sbr_deb.cpp \
+ $(SBRDEC_DIR)/sbr_dec.cpp \
+ $(SBRDEC_DIR)/sbrdec_drc.cpp \
+ $(SBRDEC_DIR)/sbrdec_freq_sca.cpp \
+ $(SBRDEC_DIR)/sbrdecoder.cpp \
+ $(SBRDEC_DIR)/sbr_ram.cpp \
+ $(SBRDEC_DIR)/sbr_rom.cpp
+
+SBRENC_DIR = $(top_srcdir)/libSBRenc/src
+SBRENC_SRC = \
+ $(SBRENC_DIR)/bit_sbr.cpp \
+ $(SBRENC_DIR)/env_bit.cpp \
+ $(SBRENC_DIR)/fram_gen.cpp \
+ $(SBRENC_DIR)/mh_det.cpp \
+ $(SBRENC_DIR)/ps_bitenc.cpp \
+ $(SBRENC_DIR)/ps_encode.cpp \
+ $(SBRENC_DIR)/resampler.cpp \
+ $(SBRENC_DIR)/sbr_encoder.cpp \
+ $(SBRENC_DIR)/sbr_ram_enc.cpp \
+ $(SBRENC_DIR)/ton_corr.cpp \
+ $(SBRENC_DIR)/code_env.cpp \
+ $(SBRENC_DIR)/env_est.cpp \
+ $(SBRENC_DIR)/invf_est.cpp \
+ $(SBRENC_DIR)/nf_est.cpp \
+ $(SBRENC_DIR)/ps_main.cpp \
+ $(SBRENC_DIR)/sbrenc_freq_sca.cpp \
+ $(SBRENC_DIR)/sbr_misc.cpp \
+ $(SBRENC_DIR)/sbr_rom_enc.cpp \
+ $(SBRENC_DIR)/tran_det.cpp
+
+SYS_DIR = $(top_srcdir)/libSYS/src
+SYS_SRC = \
+ $(SYS_DIR)/cmdl_parser.cpp \
+ $(SYS_DIR)/conv_string.cpp \
+ $(SYS_DIR)/genericStds.cpp \
+ $(SYS_DIR)/wav_file.cpp
+
+libfdk_aac_la_SOURCES = \
+ $(AACDEC_SRC) $(AACENC_SRC) \
+ $(MPEGTPDEC_SRC) $(MPEGTPENC_SRC) \
+ $(SBRDEC_SRC) $(SBRENC_SRC) \
+ $(PCMUTILS_SRC) $(FDK_SRC) $(SYS_SRC)
+
+EXTRA_DIST = \
+ $(top_srcdir)/NOTICE \
+ $(top_srcdir)/Android.mk \
+ $(top_srcdir)/fdk-aac.sym \
+ $(top_srcdir)/documentation/*.pdf \
+ $(top_srcdir)/libAACdec/src/*.h \
+ $(top_srcdir)/libAACdec/src/arm/*.cpp \
+ $(top_srcdir)/libAACenc/src/*.h \
+ $(top_srcdir)/libSBRenc/src/*.h \
+ $(top_srcdir)/libSBRenc/include/*.h \
+ $(top_srcdir)/libSBRdec/src/*.h \
+ $(top_srcdir)/libSBRdec/src/arm/*.cpp \
+ $(top_srcdir)/libSBRdec/include/*.h \
+ $(top_srcdir)/libSYS/include/*.h \
+ $(top_srcdir)/libSYS/src/linux/*.cpp \
+ $(top_srcdir)/libSYS/src/mips/*.cpp \
+ $(top_srcdir)/libPCMutils/include/*.h \
+ $(top_srcdir)/libMpegTPEnc/include/*.h \
+ $(top_srcdir)/libMpegTPEnc/src/*.h \
+ $(top_srcdir)/libMpegTPEnc/src/version \
+ $(top_srcdir)/libMpegTPDec/include/*.h \
+ $(top_srcdir)/libMpegTPDec/src/*.h \
+ $(top_srcdir)/libMpegTPDec/src/version \
+ $(top_srcdir)/libFDK/include/*.h \
+ $(top_srcdir)/libFDK/include/arm/*.h \
+ $(top_srcdir)/libFDK/include/mips/*.h \
+ $(top_srcdir)/libFDK/include/x86/*.h \
+ $(top_srcdir)/libFDK/src/arm/*.cpp \
+ $(top_srcdir)/libFDK/src/mips/*.cpp
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..cfa77ad
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,24 @@
+dnl -*- Autoconf -*-
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([fdk-aac], [0.1.0], [http://sourceforge.net/projects/opencore-amr/])
+AC_CONFIG_AUX_DIR(.)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([tar-ustar foreign])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+dnl Checks for programs.
+AC_PROG_CXX
+LT_INIT
+
+AC_CHECK_LIB([m], [sin])
+
+dnl soname version to use
+dnl goes by ‘current[:revision[:age]]’ with the soname ending up as
+dnl current.age.revision
+FDK_AAC_VERSION=0:1:0
+AC_SUBST(FDK_AAC_VERSION)
+
+AC_CONFIG_FILES([Makefile
+ fdk-aac.pc])
+AC_OUTPUT
diff --git a/fdk-aac.pc.in b/fdk-aac.pc.in
new file mode 100644
index 0000000..50fa1d5
--- /dev/null
+++ b/fdk-aac.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Fraunhofer FDK AAC Codec Library
+Description: AAC codec library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lfdk-aac
+Cflags: -I${includedir}
diff --git a/fdk-aac.sym b/fdk-aac.sym
new file mode 100644
index 0000000..2a06c41
--- /dev/null
+++ b/fdk-aac.sym
@@ -0,0 +1,18 @@
+aacDecoder_AncDataGet
+aacDecoder_AncDataInit
+aacDecoder_Close
+aacDecoder_ConfigRaw
+aacDecoder_DecodeFrame
+aacDecoder_Fill
+aacDecoder_GetFreeBytes
+aacDecoder_GetLibInfo
+aacDecoder_GetStreamInfo
+aacDecoder_Open
+aacDecoder_SetParam
+aacEncClose
+aacEncEncode
+aacEncGetLibInfo
+aacEncInfo
+aacEncOpen
+aacEncoder_GetParam
+aacEncoder_SetParam
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index cbb0e2a..6cd1f80 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -1599,6 +1599,11 @@ AACENC_ERROR aacEncoder_SetParam(
if (settings->userBitrateMode != value) {
switch ( value ) {
case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
case 8:
settings->userBitrateMode = value;
hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
diff --git a/libAACenc/src/aacenc_tns.cpp b/libAACenc/src/aacenc_tns.cpp
index 933e4e7..fbff424 100644
--- a/libAACenc/src/aacenc_tns.cpp
+++ b/libAACenc/src/aacenc_tns.cpp
@@ -1150,8 +1150,8 @@ static INT FDKaacEnc_AutoToParcor(
for(j=numOfCoeff-i-1; j>=0; j--) {
FIXP_DBL accu1 = fMult(tmp, input[j]);
FIXP_DBL accu2 = fMult(tmp, workBuffer[j]);
- workBuffer[j] += accu1;
- input[j] += accu2;
+ workBuffer[j] = fAddSaturate(workBuffer[j], accu1);
+ input[j] = fAddSaturate(input[j], accu2);
}
workBuffer++;
diff --git a/libAACenc/src/band_nrg.cpp b/libAACenc/src/band_nrg.cpp
index 458aa9c..c672c6c 100644
--- a/libAACenc/src/band_nrg.cpp
+++ b/libAACenc/src/band_nrg.cpp
@@ -267,7 +267,7 @@ FDKaacEnc_CalcBandEnergyOptimShort(const FIXP_DBL *RESTRICT mdctSpectrum,
FIXP_DBL spec = mdctSpectrum[j]<<leadingBits;
tmp = fPow2AddDiv2(tmp, spec);
}
- bandEnergy[i] = tmp<<1;
+ bandEnergy[i] = scaleValueSaturate(tmp, 1);
}
for(i=0; i<numBands; i++)
diff --git a/libAACenc/src/grp_data.cpp b/libAACenc/src/grp_data.cpp
index 03d4976..88a01ba 100644
--- a/libAACenc/src/grp_data.cpp
+++ b/libAACenc/src/grp_data.cpp
@@ -177,7 +177,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
FIXP_DBL thresh = sfbThreshold->Short[wnd][sfb];
for (j=1; j<groupLen[grp]; j++)
{
- thresh += sfbThreshold->Short[wnd+j][sfb];
+ thresh = fAddSaturate(thresh, sfbThreshold->Short[wnd+j][sfb]);
}
sfbThreshold->Long[i++] = thresh;
}
@@ -195,7 +195,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
FIXP_DBL energy = sfbEnergy->Short[wnd][sfb];
for (j=1; j<groupLen[grp]; j++)
{
- energy += sfbEnergy->Short[wnd+j][sfb];
+ energy = fAddSaturate(energy, sfbEnergy->Short[wnd+j][sfb]);
}
sfbEnergy->Long[i++] = energy;
}
@@ -213,7 +213,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
FIXP_DBL energy = sfbEnergyMS->Short[wnd][sfb];
for (j=1; j<groupLen[grp]; j++)
{
- energy += sfbEnergyMS->Short[wnd+j][sfb];
+ energy = fAddSaturate(energy, sfbEnergyMS->Short[wnd+j][sfb]);
}
sfbEnergyMS->Long[i++] = energy;
}
@@ -231,7 +231,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
FIXP_DBL energy = sfbSpreadEnergy->Short[wnd][sfb];
for (j=1; j<groupLen[grp]; j++)
{
- energy += sfbSpreadEnergy->Short[wnd+j][sfb];
+ energy = fAddSaturate(energy, sfbSpreadEnergy->Short[wnd+j][sfb]);
}
sfbSpreadEnergy->Long[i++] = energy;
}
diff --git a/libFDK/include/clz.h b/libFDK/include/clz.h
index 90cdb2b..4f7d240 100644
--- a/libFDK/include/clz.h
+++ b/libFDK/include/clz.h
@@ -115,6 +115,11 @@ inline INT fixnormz_S (SHORT a)
{
return fixnormz_D((INT)(a));
}
+#elif defined(__GNUC__)
+inline INT fixnormz_S (SHORT a)
+{
+ return a ? __builtin_clz(a) : 16;
+}
#else
inline INT fixnormz_S (SHORT a)
{
@@ -131,6 +136,12 @@ inline INT fixnormz_S (SHORT a)
#endif
#if !defined(FUNCTION_fixnormz_D)
+#if defined(__GNUC__)
+inline INT fixnormz_D (LONG a)
+{
+ return a ? __builtin_clz(a) : 32;
+}
+#else
inline INT fixnormz_D (LONG a)
{
INT leadingBits = 0;
@@ -143,6 +154,7 @@ inline INT fixnormz_D (LONG a)
return (leadingBits);
}
#endif
+#endif
/*****************************************************************************
diff --git a/libSBRenc/src/env_est.cpp b/libSBRenc/src/env_est.cpp
index 9423f27..312e0ae 100644
--- a/libSBRenc/src/env_est.cpp
+++ b/libSBRenc/src/env_est.cpp
@@ -762,8 +762,8 @@ calculateSbrEnvelope (FIXP_DBL **RESTRICT YBufferLeft, /*! energy buffer left *
/* save energies */
pNrgLeft[j] = nrgLeft;
pNrgRight[j] = nrgRight;
- envNrgLeft += nrgLeft;
- envNrgRight += nrgRight;
+ envNrgLeft = fAddSaturate(envNrgLeft, nrgLeft);
+ envNrgRight = fAddSaturate(envNrgRight, nrgRight);
} /* j */
diff --git a/libSBRenc/src/sbr_ram.cpp b/libSBRenc/src/sbr_ram_enc.cpp
index e304c39..e304c39 100644
--- a/libSBRenc/src/sbr_ram.cpp
+++ b/libSBRenc/src/sbr_ram_enc.cpp
diff --git a/libSBRenc/src/sbr_rom.cpp b/libSBRenc/src/sbr_rom_enc.cpp
index 6fd51a2..6fd51a2 100644
--- a/libSBRenc/src/sbr_rom.cpp
+++ b/libSBRenc/src/sbr_rom_enc.cpp
diff --git a/m4/.gitkeep b/m4/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/m4/.gitkeep