Enable iLBC test for android

Review URL: http://webrtc-codereview.appspot.com/68006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@213 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
leozwang@google.com 2011-07-15 16:06:18 +00:00
parent 238a022fc9
commit e85b34f585
2 changed files with 203 additions and 138 deletions

View File

@ -0,0 +1,69 @@
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
LOCAL_PATH:= $(call my-dir)
# iLBC test app
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES:= \
iLBC_test.c
# Flags passed to both C and C++ files.
LOCAL_CFLAGS := \
'-DWEBRTC_TARGET_PC' \
'-DWEBRTC_LINUX' \
'-DWEBRTC_THREAD_RR'
LOCAL_CPPFLAGS :=
LOCAL_LDFLAGS :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \
$(LOCAL_PATH)/../../../../../..
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES := \
libutils \
libwebrtc
LOCAL_MODULE:= webrtc_iLBC_test
include $(BUILD_EXECUTABLE)
# iLBC_testLib test app
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES:= \
iLBC_testLib.c
# Flags passed to both C and C++ files.
LOCAL_CFLAGS := \
'-DWEBRTC_TARGET_PC' \
'-DWEBRTC_LINUX' \
'-DWEBRTC_THREAD_RR'
LOCAL_CPPFLAGS :=
LOCAL_LDFLAGS :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \
$(LOCAL_PATH)/../../../../../..
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES := \
libutils \
libwebrtc
LOCAL_MODULE:= webrtc_iLBC_testLib
include $(BUILD_EXECUTABLE)

View File

@ -25,7 +25,7 @@ iLBC_test.c
//#define JUNK_DATA
#ifdef JUNK_DATA
#define SEED_FILE "randseed.txt"
#define SEED_FILE "randseed.txt"
#endif
@ -46,7 +46,6 @@ int main(int argc, char* argv[])
iLBC_encinst_t *Enc_Inst;
iLBC_decinst_t *Dec_Inst;
#ifdef JUNK_DATA
int i;
FILE *seedfile;
@ -82,10 +81,9 @@ int main(int argc, char* argv[])
argv[4]); exit(3);}
if ( (chfileid=fopen(argv[5],"rb")) == NULL) {
fprintf(stderr,"Cannot open channel file file %s\n", argv[5]);
exit(2);}
exit(2);
}
/* print info */
fprintf(stderr, "\n");
fprintf(stderr,
"*---------------------------------------------------*\n");
@ -109,7 +107,6 @@ int main(int argc, char* argv[])
fprintf(stderr,"Output file : %s\n\n", argv[4]);
fprintf(stderr,"Channel file : %s\n\n", argv[5]);
#ifdef JUNK_DATA
srand(random_seed);
@ -123,20 +120,18 @@ int main(int argc, char* argv[])
#endif
/* Initialization */
WebRtcIlbcfix_EncoderInit(Enc_Inst, mode);
WebRtcIlbcfix_DecoderInit(Dec_Inst, mode);
/* loop over input blocks */
#ifdef SPLIT_10MS
while(fread(data, sizeof(short), 80, ifileid) == 80){
while(fread(data, sizeof(short), 80, ifileid) == 80) {
#else
while( (short)fread(data,sizeof(short),(mode<<3),ifileid)==(mode<<3)){
while((short)fread(data,sizeof(short),(mode<<3),ifileid)==(mode<<3)) {
#endif
blockcount++;
/* encoding */
fprintf(stderr, "--- Encoding block %i --- ",blockcount);
#ifdef SPLIT_10MS
len=WebRtcIlbcfix_Encode(Enc_Inst, data, 80, encoded_data);
@ -176,7 +171,6 @@ int main(int argc, char* argv[])
}
/* decoding */
fprintf(stderr, "--- Decoding block %i --- ",blockcount);
if (pli==1) {
len=WebRtcIlbcfix_Decode(Dec_Inst, encoded_data, len, data, &speechType);
@ -186,7 +180,6 @@ int main(int argc, char* argv[])
fprintf(stderr, "\r");
/* write output file */
fwrite(data,sizeof(short),len,ofileid);
}
}
@ -206,6 +199,9 @@ int main(int argc, char* argv[])
WebRtcIlbcfix_DecoderFree(Dec_Inst);
/* close files */
fclose(ifileid);
fclose(efileid);
fclose(ofileid);
fclose(ifileid); fclose(efileid); fclose(ofileid);
return 0;
}