Commit 02cd3c00 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Updated ISAC android recipes

parent b7456184
...@@ -26,7 +26,8 @@ ifneq ($(BUILD_WEBRTC_ISAC),0) ...@@ -26,7 +26,8 @@ ifneq ($(BUILD_WEBRTC_ISAC),0)
LOCAL_C_INCLUDES += \ LOCAL_C_INCLUDES += \
$(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/source \ $(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/source \
$(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/util \ $(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/util \
$(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/interface $(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/interface \
$(WEBRTC_SRC_DIR)/modules/audio_coding/codecs/isac/fix/include/
endif endif
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
############################# #############################
# Build the non-neon library. # Build the non-neon library.
MY_WEBRTC_PATH := $(call my-dir)/../../../../../../ MY_WEBRTC_PATH := $(call my-dir)/../../../../../../../..
LOCAL_PATH := $(MY_WEBRTC_PATH)/../../webrtc/modules/audio_coding/codecs/isac/fix/source LOCAL_PATH := $(MY_WEBRTC_PATH)/webrtc/webrtc/modules/audio_coding/codecs/isac/fix/source
include $(CLEAR_VARS) include $(CLEAR_VARS)
include $(MY_WEBRTC_PATH)/Android.mk include $(MY_WEBRTC_PATH)/build/android/Android.mk
LOCAL_ARM_MODE := arm LOCAL_ARM_MODE := arm
LOCAL_MODULE_CLASS := STATIC_LIBRARIES LOCAL_MODULE_CLASS := STATIC_LIBRARIES
...@@ -40,11 +40,13 @@ LOCAL_SRC_FILES := \ ...@@ -40,11 +40,13 @@ LOCAL_SRC_FILES := \
lpc_masking_model.c \ lpc_masking_model.c \
lpc_tables.c \ lpc_tables.c \
pitch_estimator.c \ pitch_estimator.c \
pitch_estimator_c.c \
pitch_filter.c \ pitch_filter.c \
pitch_gain_tables.c \ pitch_gain_tables.c \
pitch_lag_tables.c \ pitch_lag_tables.c \
spectrum_ar_model_tables.c \ spectrum_ar_model_tables.c \
transform.c transform.c \
transform_tables.c
ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) ifeq ($(ARCH_ARM_HAVE_ARMV7A),true)
# Using .S (instead of .s) extention is to include a C header file in assembly. # Using .S (instead of .s) extention is to include a C header file in assembly.
...@@ -62,9 +64,9 @@ LOCAL_CFLAGS := \ ...@@ -62,9 +64,9 @@ LOCAL_CFLAGS := \
$(MY_WEBRTC_COMMON_DEFS) $(MY_WEBRTC_COMMON_DEFS)
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \ $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../.. \ $(MY_WEBRTC_PATH)/webrtc \
$(MY_WEBRTC_PATH)/../../webrtc/common_audio/signal_processing/include $(MY_WEBRTC_PATH)/webrtc/webrtc/common_audio/signal_processing/include
LOCAL_STATIC_LIBRARIES += libwebrtc_system_wrappers LOCAL_STATIC_LIBRARIES += libwebrtc_system_wrappers
...@@ -90,8 +92,8 @@ LOCAL_MODULE := libwebrtc_isacfix_neon ...@@ -90,8 +92,8 @@ LOCAL_MODULE := libwebrtc_isacfix_neon
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
filters_neon.c \ filters_neon.c \
lattice_neon.S \ lattice_neon.c \
lpc_masking_model_neon.S lpc_masking_model.c
# Flags passed to both C and C++ files. # Flags passed to both C and C++ files.
LOCAL_CFLAGS := \ LOCAL_CFLAGS := \
...@@ -101,9 +103,8 @@ LOCAL_CFLAGS := \ ...@@ -101,9 +103,8 @@ LOCAL_CFLAGS := \
-flax-vector-conversions -flax-vector-conversions
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \ $(MY_WEBRTC_PATH)/webrtc/webrtc/common_audio/signal_processing/include \
$(LOCAL_PATH)/../../../../../.. \ $(MY_WEBRTC_PATH)/webrtc
$(MY_WEBRTC_PATH)/../../webrtc/common_audio/signal_processing/include
ifndef NDK_ROOT ifndef NDK_ROOT
...@@ -127,7 +128,7 @@ LOCAL_CFLAGS := $(MY_WEBRTC_COMMON_DEFS) ...@@ -127,7 +128,7 @@ LOCAL_CFLAGS := $(MY_WEBRTC_COMMON_DEFS)
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \ $(LOCAL_PATH)/../interface \
$(LOCAL_PATH)/../../../../../.. $(LOCAL_PATH)/../../../../../../..
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libwebrtc_isacfix \ libwebrtc_isacfix \
......
...@@ -43,7 +43,7 @@ static void filter_init(MSFilter *f){ ...@@ -43,7 +43,7 @@ static void filter_init(MSFilter *f){
ISACFIX_MainStruct* isac_mainstruct = NULL; ISACFIX_MainStruct* isac_mainstruct = NULL;
isac_decoder_t *obj = NULL; isac_decoder_t *obj = NULL;
int instance_size; int instance_size;
WebRtc_Word16 ret; int16_t ret;
f->data = ms_new0(isac_decoder_t, 1); f->data = ms_new0(isac_decoder_t, 1);
obj = (isac_decoder_t*)f->data; obj = (isac_decoder_t*)f->data;
...@@ -59,10 +59,7 @@ static void filter_init(MSFilter *f){ ...@@ -59,10 +59,7 @@ static void filter_init(MSFilter *f){
ms_error("WebRtcIsacfix_Create failed (%d)", ret); ms_error("WebRtcIsacfix_Create failed (%d)", ret);
} }
ret = WebRtcIsacfix_DecoderInit(obj->isac); WebRtcIsacfix_DecoderInit(obj->isac);
if( ret ) {
ms_error("WebRtcIsacfix_DecoderInit failed (%d)", ret);
}
obj->ptime = 30; // default ptime is 30ms per packet obj->ptime = 30; // default ptime is 30ms per packet
} }
...@@ -75,11 +72,12 @@ static void filter_preprocess(MSFilter *f){ ...@@ -75,11 +72,12 @@ static void filter_preprocess(MSFilter *f){
static void decode(MSFilter *f, mblk_t *im) { static void decode(MSFilter *f, mblk_t *im) {
isac_decoder_t* obj = (isac_decoder_t*)f->data; isac_decoder_t* obj = (isac_decoder_t*)f->data;
WebRtc_Word16 samples_nb, ret; int16_t ret;
WebRtc_Word16 speech_type; // needed but not used.. int16_t speech_type; // needed but not used..
size_t samples_nb;
// im is one packet from the encoder, so it's either 30 or 60 ms of audio // im is one packet from the encoder, so it's either 30 or 60 ms of audio
ret = WebRtcIsacfix_ReadFrameLen( (const WebRtc_Word16*)im->b_rptr, &samples_nb); ret = WebRtcIsacfix_ReadFrameLen( (const uint8_t*)im->b_rptr, msgdsize(im), &samples_nb);
// ms_message("WebRtcIsacfix_ReadFrameLen -> %d", samples_nb); // ms_message("WebRtcIsacfix_ReadFrameLen -> %d", samples_nb);
if( ret == 0 ) { if( ret == 0 ) {
...@@ -90,9 +88,9 @@ static void decode(MSFilter *f, mblk_t *im) { ...@@ -90,9 +88,9 @@ static void decode(MSFilter *f, mblk_t *im) {
// ms_message("DECODED om datap @%p", om->b_datap); // ms_message("DECODED om datap @%p", om->b_datap);
ret = WebRtcIsacfix_Decode(obj->isac, ret = WebRtcIsacfix_Decode(obj->isac,
(const WebRtc_UWord16*)im->b_rptr, (const uint8_t*)im->b_rptr,
(im->b_wptr - im->b_rptr), (im->b_wptr - im->b_rptr),
(WebRtc_Word16*)om->b_wptr, (int16_t*)om->b_wptr,
&speech_type ); &speech_type );
if( ret < 0 ) { if( ret < 0 ) {
ms_error( "WebRtcIsacfix_Decode error: %d", WebRtcIsacfix_GetErrorCode(obj->isac) ); ms_error( "WebRtcIsacfix_Decode error: %d", WebRtcIsacfix_GetErrorCode(obj->isac) );
...@@ -130,14 +128,14 @@ static void filter_process(MSFilter *f){ ...@@ -130,14 +128,14 @@ static void filter_process(MSFilter *f){
if( ms_concealer_context_is_concealement_required(obj->plc_ctx, f->ticker->time) ) { if( ms_concealer_context_is_concealement_required(obj->plc_ctx, f->ticker->time) ) {
WebRtc_Word16 flen = (obj->ptime == 30) ? ISAC_30MS_SAMPLE_COUNT int16_t flen = (obj->ptime == 30) ? ISAC_30MS_SAMPLE_COUNT
: ISAC_60MS_SAMPLE_COUNT; : ISAC_60MS_SAMPLE_COUNT;
mblk_t* plc_blk = allocb(flen*2, 0 ); mblk_t* plc_blk = allocb(flen*2, 0 );
// ms_message("PLC for %d ms", obj->ptime); // ms_message("PLC for %d ms", obj->ptime);
// interpolate 1 frame for 30ms ptime, 2 frames for 60ms // interpolate 1 frame for 30ms ptime, 2 frames for 60ms
WebRtc_Word16 ret = WebRtcIsacfix_DecodePlc(obj->isac, int16_t ret = WebRtcIsacfix_DecodePlc(obj->isac,
(WebRtc_Word16*)plc_blk->b_wptr, (int16_t*)plc_blk->b_wptr,
(obj->ptime == 30) ? 1 : 2); (obj->ptime == 30) ? 1 : 2);
if( ret < 0 ) { if( ret < 0 ) {
......
...@@ -42,7 +42,7 @@ static void filter_init ( MSFilter *f ) { ...@@ -42,7 +42,7 @@ static void filter_init ( MSFilter *f ) {
ISACFIX_MainStruct* isac_mainstruct = NULL; ISACFIX_MainStruct* isac_mainstruct = NULL;
struct _isac_encoder_struct_t *obj = NULL; struct _isac_encoder_struct_t *obj = NULL;
int instance_size; int instance_size;
WebRtc_Word16 ret; int16_t ret;
f->data = ms_new0(isac_encoder_struct_t, 1); f->data = ms_new0(isac_encoder_struct_t, 1);
obj = (isac_encoder_struct_t*)f->data; obj = (isac_encoder_struct_t*)f->data;
...@@ -91,7 +91,7 @@ static void filter_process ( MSFilter *f ) { ...@@ -91,7 +91,7 @@ static void filter_process ( MSFilter *f ) {
#else #else
u_int8_t* input_buf = NULL; u_int8_t* input_buf = NULL;
#endif #endif
WebRtc_Word16 ret; int16_t ret;
static int out_count = 0; static int out_count = 0;
// get the input data and put it into our buffered input // get the input data and put it into our buffered input
...@@ -108,8 +108,8 @@ static void filter_process ( MSFilter *f ) { ...@@ -108,8 +108,8 @@ static void filter_process ( MSFilter *f ) {
ms_bufferizer_read(obj->bufferizer, input_buf, ISAC_SAMPLES_PER_ENCODE*2); ms_bufferizer_read(obj->bufferizer, input_buf, ISAC_SAMPLES_PER_ENCODE*2);
ret = WebRtcIsacfix_Encode(obj->isac, ret = WebRtcIsacfix_Encode(obj->isac,
(const WebRtc_Word16*)input_buf, (const int16_t*)input_buf,
(WebRtc_Word16*)om->b_wptr); (uint8_t*)om->b_wptr);
if( ret < 0) { if( ret < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment