From e124f4e0a4105d4888e5cc208b6257d8b33634d8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 2 Jan 2013 16:13:57 +0100 Subject: [PATCH] Add opus codec. --- .gitmodules | 3 + Makefile | 14 ++- jni/Android.mk | 4 + jni/Application.mk | 4 + submodules/externals/build/opus/Android.mk | 96 ++++++++++++++ submodules/externals/build/opus/config.h | 140 +++++++++++++++++++++ submodules/externals/opus | 1 + 7 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 submodules/externals/build/opus/Android.mk create mode 100644 submodules/externals/build/opus/config.h create mode 160000 submodules/externals/opus diff --git a/.gitmodules b/.gitmodules index dc550ebff..de5da7ef1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,6 @@ [submodule "submodules/externals/axmlrpc"] path = submodules/externals/axmlrpc url = git://git.linphone.org/axmlrpc.git +[submodule "submodules/externals/opus"] + path = submodules/externals/opus + url = git://git.opus-codec.org/opus.git diff --git a/Makefile b/Makefile index be77fd9ee..57cfdbcb8 100644 --- a/Makefile +++ b/Makefile @@ -17,12 +17,14 @@ BUILD_AMRWB=0 BUILD_GPLV3_ZRTP=0 BUILD_SILK=1 BUILD_G729=0 +BUILD_OPUS=1 BUILD_TUNNEL=0 BUILD_WEBRTC_AECM=1 +BUILD_OPUS=1 BUILD_FOR_X86=1 USE_JAVAH=1 -NDK_BUILD_OPTIONS=NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) -j$(NUMCPUS) +NDK_BUILD_OPTIONS=NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_OPUS=$(BUILD_OPUS) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) -j$(NUMCPUS) all: update-project prepare-sources generate-apk @@ -74,6 +76,14 @@ $(LIBMSSILK_BUILD_DIR)/sdk/SILK_SDK_SRC_v1.0.8/SILK_SDK_SRC_ARM_v1.0.8/src/SKP_S prepare-silk: $(LIBMSSILK_BUILD_DIR)/sdk/SILK_SDK_SRC_v1.0.8/SILK_SDK_SRC_ARM_v1.0.8/src/SKP_Silk_resampler.c +#opus +LIBOPUS_INCLUDE_DIR=$(TOPDIR)/submodules/externals/opus/include +$(LIBOPUS_INCLUDE_DIR)/opus/opus.h: + cd $(LIBOPUS_INCLUDE_DIR) && \ + mkdir opus && \ + cp *.h opus/ +prepare-opus: $(LIBOPUS_INCLUDE_DIR)/opus/opus.h + #srtp $(TOPDIR)/submodules/externals/srtp/config.h : $(TOPDIR)/submodules/externals/build/srtp/config.h @cd $(TOPDIR)/submodules/externals/srtp/ && \ @@ -89,7 +99,7 @@ prepare-mediastreamer2: if ! [ -e yuv2rgb.vs.h ]; then echo "yuv2rgb.vs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi && \ if ! [ -e yuv2rgb.fs.h ]; then echo "yuv2rgb.fs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi -prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-srtp prepare-mediastreamer2 +prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-opus prepare-srtp prepare-mediastreamer2 generate-libs: $(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) diff --git a/jni/Android.mk b/jni/Android.mk index 4f6f676c4..5300804ba 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -162,6 +162,10 @@ include $(linphone-root-dir)/submodules/bcg729/Android.mk include $(linphone-root-dir)/submodules/bcg729/msbcg729/Android.mk endif +ifneq ($(BUILD_OPUS), 0) +include $(linphone-root-dir)/submodules/externals/build/opus/Android.mk +endif + ifneq ($(BUILD_WEBRTC_AECM), 0) ifneq ($(TARGET_ARCH), x86) ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) diff --git a/jni/Application.mk b/jni/Application.mk index 7dfa25a22..6e388aae8 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -58,6 +58,10 @@ ifeq ($(BUILD_G729),1) APP_MODULES +=libbcg729 libmsbcg729 endif +ifneq ($(BUILD_OPUS), 0) +APP_MODULES += libopus +endif + ifneq ($(BUILD_WEBRTC_AECM), 0) APP_MODULES += libwebrtc_system_wrappers libwebrtc_spl libwebrtc_apm_utility libwebrtc_aecm APP_MODULES += libwebrtc_spl_neon libwebrtc_aecm_neon diff --git a/submodules/externals/build/opus/Android.mk b/submodules/externals/build/opus/Android.mk new file mode 100644 index 000000000..ab1375be2 --- /dev/null +++ b/submodules/externals/build/opus/Android.mk @@ -0,0 +1,96 @@ +LOCAL_PATH:= $(call my-dir)/../../opus + +BUILD_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := libopus + + +LOCAL_SRC_FILES += \ + celt/bands.c celt/celt.c celt/cwrs.c \ + celt/entcode.c celt/entdec.c celt/entenc.c celt/kiss_fft.c \ + celt/laplace.c celt/mathops.c celt/mdct.c celt/modes.c \ + celt/pitch.c celt/celt_lpc.c celt/quant_bands.c celt/rate.c \ + celt/vq.c silk/CNG.c silk/code_signs.c silk/init_decoder.c \ + silk/decode_core.c silk/decode_frame.c \ + silk/decode_parameters.c silk/decode_indices.c \ + silk/decode_pulses.c silk/decoder_set_fs.c silk/dec_API.c \ + silk/enc_API.c silk/encode_indices.c silk/encode_pulses.c \ + silk/gain_quant.c silk/interpolate.c silk/LP_variable_cutoff.c \ + silk/NLSF_decode.c silk/NSQ.c silk/NSQ_del_dec.c silk/PLC.c \ + silk/shell_coder.c silk/tables_gain.c silk/tables_LTP.c \ + silk/tables_NLSF_CB_NB_MB.c silk/tables_NLSF_CB_WB.c \ + silk/tables_other.c silk/tables_pitch_lag.c \ + silk/tables_pulses_per_block.c silk/VAD.c \ + silk/control_audio_bandwidth.c silk/quant_LTP_gains.c \ + silk/VQ_WMat_EC.c silk/HP_variable_cutoff.c silk/NLSF_encode.c \ + silk/NLSF_VQ.c silk/NLSF_unpack.c silk/NLSF_del_dec_quant.c \ + silk/process_NLSFs.c silk/stereo_LR_to_MS.c \ + silk/stereo_MS_to_LR.c silk/check_control_input.c \ + silk/control_SNR.c silk/init_encoder.c silk/control_codec.c \ + silk/A2NLSF.c silk/ana_filt_bank_1.c silk/biquad_alt.c \ + silk/bwexpander_32.c silk/bwexpander.c silk/debug.c \ + silk/decode_pitch.c silk/inner_prod_aligned.c silk/lin2log.c \ + silk/log2lin.c silk/LPC_analysis_filter.c \ + silk/LPC_inv_pred_gain.c silk/table_LSF_cos.c silk/NLSF2A.c \ + silk/NLSF_stabilize.c silk/NLSF_VQ_weights_laroia.c \ + silk/pitch_est_tables.c silk/resampler.c \ + silk/resampler_down2_3.c silk/resampler_down2.c \ + silk/resampler_private_AR2.c silk/resampler_private_down_FIR.c \ + silk/resampler_private_IIR_FIR.c \ + silk/resampler_private_up2_HQ.c silk/resampler_rom.c \ + silk/sigm_Q15.c silk/sort.c silk/sum_sqr_shift.c \ + silk/stereo_decode_pred.c silk/stereo_encode_pred.c \ + silk/stereo_find_predictor.c silk/stereo_quant_pred.c \ + silk/fixed/LTP_analysis_filter_FIX.c \ + silk/fixed/LTP_scale_ctrl_FIX.c silk/fixed/corrMatrix_FIX.c \ + silk/fixed/encode_frame_FIX.c silk/fixed/find_LPC_FIX.c \ + silk/fixed/find_LTP_FIX.c silk/fixed/find_pitch_lags_FIX.c \ + silk/fixed/find_pred_coefs_FIX.c \ + silk/fixed/noise_shape_analysis_FIX.c \ + silk/fixed/prefilter_FIX.c silk/fixed/process_gains_FIX.c \ + silk/fixed/regularize_correlations_FIX.c \ + silk/fixed/residual_energy16_FIX.c \ + silk/fixed/residual_energy_FIX.c silk/fixed/solve_LS_FIX.c \ + silk/fixed/warped_autocorrelation_FIX.c \ + silk/fixed/apply_sine_window_FIX.c silk/fixed/autocorr_FIX.c \ + silk/fixed/burg_modified_FIX.c silk/fixed/k2a_FIX.c \ + silk/fixed/k2a_Q16_FIX.c silk/fixed/pitch_analysis_core_FIX.c \ + silk/fixed/vector_ops_FIX.c silk/fixed/schur64_FIX.c \ + silk/fixed/schur_FIX.c silk/float/apply_sine_window_FLP.c \ + silk/float/corrMatrix_FLP.c silk/float/encode_frame_FLP.c \ + silk/float/find_LPC_FLP.c silk/float/find_LTP_FLP.c \ + silk/float/find_pitch_lags_FLP.c \ + silk/float/find_pred_coefs_FLP.c \ + silk/float/LPC_analysis_filter_FLP.c \ + silk/float/LTP_analysis_filter_FLP.c \ + silk/float/LTP_scale_ctrl_FLP.c \ + silk/float/noise_shape_analysis_FLP.c \ + silk/float/prefilter_FLP.c silk/float/process_gains_FLP.c \ + silk/float/regularize_correlations_FLP.c \ + silk/float/residual_energy_FLP.c silk/float/solve_LS_FLP.c \ + silk/float/warped_autocorrelation_FLP.c \ + silk/float/wrappers_FLP.c silk/float/autocorrelation_FLP.c \ + silk/float/burg_modified_FLP.c silk/float/bwexpander_FLP.c \ + silk/float/energy_FLP.c silk/float/inner_product_FLP.c \ + silk/float/k2a_FLP.c silk/float/levinsondurbin_FLP.c \ + silk/float/LPC_inv_pred_gain_FLP.c \ + silk/float/pitch_analysis_core_FLP.c \ + silk/float/scale_copy_vector_FLP.c \ + silk/float/scale_vector_FLP.c silk/float/schur_FLP.c \ + silk/float/sort_FLP.c src/opus.c src/opus_decoder.c \ + src/opus_encoder.c src/opus_multistream.c src/repacketizer.c + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/include \ + $(LOCAL_PATH)/celt \ + $(LOCAL_PATH)/silk \ + $(LOCAL_PATH)/silk/float + +LOCAL_CFLAGS += -include ../build/opus/config.h + + +LOCAL_ARM_MODE := arm + +include $(BUILD_STATIC_LIBRARY) diff --git a/submodules/externals/build/opus/config.h b/submodules/externals/build/opus/config.h new file mode 100644 index 000000000..284c31e1e --- /dev/null +++ b/submodules/externals/build/opus/config.h @@ -0,0 +1,140 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Custom modes */ +/* #undef CUSTOM_MODES */ + +/* Assertions */ +/* #undef ENABLE_ASSERTIONS */ + +/* Debug fixed-point implementation */ +/* #undef FIXED_DEBUG */ + +/* Compile as fixed-point (for machines without a fast enough FPU) */ +/* #undef FIXED_POINT */ + +/* Float approximations */ +/* #undef FLOAT_APPROX */ + +/* Fuzzing */ +/* #undef FUZZING */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `lrint' function. */ +#define HAVE_LRINT 1 + +/* Define to 1 if you have the `lrintf' function. */ +#define HAVE_LRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `__malloc_hook' function. */ +#define HAVE___MALLOC_HOOK 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* This is a build of OPUS */ +#define OPUS_BUILD /**/ + +/* Opus library version string */ +#define OPUS_VERSION "1.0.2-2-g48e62c5" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Make use of alloca */ +/* #undef USE_ALLOCA */ + +/* Use C99 variable-size arrays */ +#define VAR_ARRAYS /**/ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#define restrict __restrict +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +# define __restrict__ +#endif diff --git a/submodules/externals/opus b/submodules/externals/opus new file mode 160000 index 000000000..48e62c543 --- /dev/null +++ b/submodules/externals/opus @@ -0,0 +1 @@ +Subproject commit 48e62c5439e5240e500c47799b8addb93e0ed03e