summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2009-04-15 14:45:41 +0000
committerNanang Izzuddin <nanang@teluu.com>2009-04-15 14:45:41 +0000
commitb20356ecb30f87a4b7aca162dac946c9710e23f3 (patch)
treeee64bc0c440a820e1475ddce5de0e099f0dc6847 /third_party
parentfb257e0aaa5b9b078b57c252acdf69c1ba793513 (diff)
Ticket #774:
- Added build config for GNU autoconf & make. - Fixed some G.722.1 codes for linux & mingw32 targets, e.g: types defs, collision function name 'round'. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2601 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/build/g7221/Makefile63
-rw-r--r--third_party/build/os-auto.mak.in5
-rw-r--r--third_party/build/os-darwinos.mak1
-rw-r--r--third_party/build/os-linux.mak1
-rw-r--r--third_party/build/os-win32.mak1
-rw-r--r--third_party/g7221/common/stl-files/basop32.c2
-rw-r--r--third_party/g7221/common/stl-files/basop32.h2
-rw-r--r--third_party/g7221/common/stl-files/typedef.h19
-rw-r--r--third_party/g7221/decode/coef2sam.c4
-rw-r--r--third_party/g7221/decode/dct4_s.c10
-rw-r--r--third_party/g7221/encode/dct4_a.c10
-rw-r--r--third_party/g7221/encode/sam2coef.c4
12 files changed, 106 insertions, 16 deletions
diff --git a/third_party/build/g7221/Makefile b/third_party/build/g7221/Makefile
new file mode 100644
index 00000000..16758171
--- /dev/null
+++ b/third_party/build/g7221/Makefile
@@ -0,0 +1,63 @@
+include ../../../build.mak
+include ../../../build/common.mak
+
+export LIBDIR := ../../lib
+
+RULES_MAK := $(PJDIR)/build/rules.mak
+
+export G7221_CODEC_LIB := ../../lib/libg7221codec-$(TARGET_NAME)$(LIBEXT)
+
+###############################################################################
+# Gather all flags.
+#
+export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+ $(CFLAGS) $(CC_INC)../.. $(CC_INC)../../g7221/common \
+ $(CC_INC)../../g7221/common/stl-files \
+ $(CC_INC)../../../pjlib/include
+export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
+ $(HOST_CXXFLAGS) $(CXXFLAGS)
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+ $(LDFLAGS)
+
+export G7221_CODEC_SRCDIR = ../../g7221
+export G7221_CODEC_OBJS = common/common.o common/huff_tab.o common/tables.o \
+ common/stl-files/basop32.o common/stl-files/count.o \
+ decode/coef2sam.o decode/dct4_s.o decode/decoder.o \
+ encode/dct4_a.o encode/sam2coef.o encode/encoder.o
+
+export G7221_CODEC_CFLAGS = $(_CFLAGS)
+
+
+export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
+###############################################################################
+# Main entry
+#
+# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
+#
+TARGETS := libg7221codec
+
+all: $(TARGETS)
+
+doc:
+ cd .. && doxygen docs/doxygen.cfg
+
+dep: depend
+distclean: realclean
+
+.PHONY: dep depend libg7221codec clean realclean distclean
+
+libg7221codec:
+ $(MAKE) -f $(RULES_MAK) APP=G7221_CODEC app=libg7221codec $(G7221_CODEC_LIB)
+
+clean print_lib:
+ $(MAKE) -f $(RULES_MAK) APP=G7221_CODEC app=libg7221codec $@
+
+realclean:
+ $(subst @@,$(subst /,$(HOST_PSEP),.ilbc-$(TARGET_NAME).depend),$(HOST_RMR))
+
+ $(MAKE) -f $(RULES_MAK) APP=G7221_CODEC app=libg7221codec $@
+
+depend:
+ $(MAKE) -f $(RULES_MAK) APP=G7221_CODEC app=libg7221codec $@
+
+
diff --git a/third_party/build/os-auto.mak.in b/third_party/build/os-auto.mak.in
index 94db5ac2..cb6499e2 100644
--- a/third_party/build/os-auto.mak.in
+++ b/third_party/build/os-auto.mak.in
@@ -11,6 +11,11 @@ ifneq (@ac_no_speex_codec@,1)
DIRS += speex
endif
+ifneq (@ac_no_g7221_codec@,1)
+DIRS += g7221
+endif
+
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
DIRS += portaudio
endif
+
diff --git a/third_party/build/os-darwinos.mak b/third_party/build/os-darwinos.mak
index 8aaea281..a9c740f7 100644
--- a/third_party/build/os-darwinos.mak
+++ b/third_party/build/os-darwinos.mak
@@ -2,5 +2,6 @@ DIRS += gsm
DIRS += ilbc
DIRS += speex
DIRS += portaudio
+DIRS += g7221
diff --git a/third_party/build/os-linux.mak b/third_party/build/os-linux.mak
index 8aaea281..a9c740f7 100644
--- a/third_party/build/os-linux.mak
+++ b/third_party/build/os-linux.mak
@@ -2,5 +2,6 @@ DIRS += gsm
DIRS += ilbc
DIRS += speex
DIRS += portaudio
+DIRS += g7221
diff --git a/third_party/build/os-win32.mak b/third_party/build/os-win32.mak
index 8aaea281..a9c740f7 100644
--- a/third_party/build/os-win32.mak
+++ b/third_party/build/os-win32.mak
@@ -2,5 +2,6 @@ DIRS += gsm
DIRS += ilbc
DIRS += speex
DIRS += portaudio
+DIRS += g7221
diff --git a/third_party/g7221/common/stl-files/basop32.c b/third_party/g7221/common/stl-files/basop32.c
index 86d97dd6..9eb4f380 100644
--- a/third_party/g7221/common/stl-files/basop32.c
+++ b/third_party/g7221/common/stl-files/basop32.c
@@ -711,7 +711,7 @@ Word16 extract_l (Word32 L_var1)
| range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
|___________________________________________________________________________|
*/
-Word16 round (Word32 L_var1)
+Word16 itu_round (Word32 L_var1)
{
Word16 var_out;
Word32 L_rounded;
diff --git a/third_party/g7221/common/stl-files/basop32.h b/third_party/g7221/common/stl-files/basop32.h
index 7b096454..308f8d32 100644
--- a/third_party/g7221/common/stl-files/basop32.h
+++ b/third_party/g7221/common/stl-files/basop32.h
@@ -54,7 +54,7 @@ Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */
Word16 negate (Word16 var1); /* Short negate, 1 */
Word16 extract_h (Word32 L_var1); /* Extract high, 1 */
Word16 extract_l (Word32 L_var1); /* Extract low, 1 */
-Word16 round (Word32 L_var1); /* Round, 1 */
+Word16 itu_round (Word32 L_var1); /* Round, 1 */
Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */
Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */
Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without
diff --git a/third_party/g7221/common/stl-files/typedef.h b/third_party/g7221/common/stl-files/typedef.h
index 6c06541f..9b0ef44c 100644
--- a/third_party/g7221/common/stl-files/typedef.h
+++ b/third_party/g7221/common/stl-files/typedef.h
@@ -16,6 +16,22 @@
#ifndef TYPEDEF_H
#define TYPEDEF_H "$Id $"
+#if 1
+
+/* Use PJLIB types definitions (for PJLIB sync'd platforms compatibility?
+ * e.g: mingw32 was not supported by the original version).
+ */
+#include <pj/types.h>
+
+typedef pj_int8_t Word8;
+typedef pj_int16_t Word16;
+typedef pj_int32_t Word32;
+typedef pj_uint16_t UWord16;
+typedef pj_uint32_t UWord32;
+typedef int Flag;
+
+#else
+
#include <limits.h>
#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__) || defined(__CYGWIN__)
@@ -52,4 +68,7 @@ typedef unsigned int UWord32;
typedef unsigned long UWord32;
#endif
+#endif /* if 0 */
+
#endif /* TYPEDEF_H */
+
diff --git a/third_party/g7221/decode/coef2sam.c b/third_party/g7221/decode/coef2sam.c
index 18a88acd..a52095d1 100644
--- a/third_party/g7221/decode/coef2sam.c
+++ b/third_party/g7221/decode/coef2sam.c
@@ -147,7 +147,7 @@ void rmlt_coefs_to_samples(Word16 *coefs,
move32();
sum = L_mac(sum,*win_new++, *--new_ptr);
sum = L_mac(sum,*--win_old, *old_ptr++);
- *out_ptr++ = round(L_shl(sum,2));
+ *out_ptr++ = itu_round(L_shl(sum,2));
move16();
}
@@ -160,7 +160,7 @@ void rmlt_coefs_to_samples(Word16 *coefs,
move32();
sum = L_mac(sum,*win_new++, *new_ptr++);
sum = L_mac(sum,negate(*--win_old), *--old_ptr);
- *out_ptr++ = round(L_shl(sum,2));
+ *out_ptr++ = itu_round(L_shl(sum,2));
move16();
}
diff --git a/third_party/g7221/decode/dct4_s.c b/third_party/g7221/decode/dct4_s.c
index 84514824..82405a31 100644
--- a/third_party/g7221/decode/dct4_s.c
+++ b/third_party/g7221/decode/dct4_s.c
@@ -291,7 +291,7 @@ void dct_type_iv_s (Word16 *input,Word16 *output,Word16 dct_length)
{
sum = L_mac(sum, pair_ptr[i],dct_core_s[i][k]);
}
- buffer_swap[k] = round(sum);
+ buffer_swap[k] = itu_round(sum);
}
pair_ptr += CORE_SIZE;
@@ -401,25 +401,25 @@ void dct_type_iv_s (Word16 *input,Word16 *output,Word16 dct_length)
sum = L_mac(sum,cos_even,in_low_even);
sum = L_mac(sum,negate(msin_even),in_high_even);
- out_low_even = round(L_shl(sum,1));
+ out_low_even = itu_round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,msin_even,in_low_even);
sum = L_mac(sum,cos_even,in_high_even);
- out_high_even = round(L_shl(sum,1));
+ out_high_even = itu_round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,cos_odd,in_low_odd);
sum = L_mac(sum,msin_odd,in_high_odd);
- out_low_odd = round(L_shl(sum,1));
+ out_low_odd = itu_round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,msin_odd,in_low_odd);
sum = L_mac(sum,negate(cos_odd),in_high_odd);
- out_high_odd = round(L_shl(sum,1));
+ out_high_odd = itu_round(L_shl(sum,1));
*out_ptr_low++ = out_low_even;
move16();
diff --git a/third_party/g7221/encode/dct4_a.c b/third_party/g7221/encode/dct4_a.c
index 24f4f5e0..4d7c7650 100644
--- a/third_party/g7221/encode/dct4_a.c
+++ b/third_party/g7221/encode/dct4_a.c
@@ -225,7 +225,7 @@ void dct_type_iv_a (Word16 *input,Word16 *output,Word16 dct_length)
{
sum = L_mac(sum, pair_ptr[i],dct_core_a[i][k]);
}
- buffer_swap[k] = round(sum);
+ buffer_swap[k] = itu_round(sum);
}
/* address arithmetic */
pair_ptr += CORE_SIZE;
@@ -312,23 +312,23 @@ void dct_type_iv_a (Word16 *input,Word16 *output,Word16 dct_length)
sum=L_mac(sum,cos_even,in_low_even);
neg_msin_even = negate(msin_even);
sum=L_mac(sum,neg_msin_even,in_high_even);
- out_low_even = round(sum);
+ out_low_even = itu_round(sum);
sum = 0L;
sum=L_mac(sum,msin_even,in_low_even);
sum=L_mac(sum,cos_even,in_high_even);
- out_high_even= round(sum);
+ out_high_even= itu_round(sum);
sum = 0L;
sum=L_mac(sum,cos_odd,in_low_odd);
sum=L_mac(sum,msin_odd,in_high_odd);
- out_low_odd= round(sum);
+ out_low_odd= itu_round(sum);
sum = 0L;
sum=L_mac(sum,msin_odd,in_low_odd);
neg_cos_odd = negate(cos_odd);
sum=L_mac(sum,neg_cos_odd,in_high_odd);
- out_high_odd= round(sum);
+ out_high_odd= itu_round(sum);
*out_ptr_low++ = out_low_even;
*--out_ptr_high = out_high_even;
diff --git a/third_party/g7221/encode/sam2coef.c b/third_party/g7221/encode/sam2coef.c
index 08ee0e11..57c8fce8 100644
--- a/third_party/g7221/encode/sam2coef.c
+++ b/third_party/g7221/encode/sam2coef.c
@@ -120,7 +120,7 @@ Word16 samples_to_rmlt_coefs(Word16 *new_samples,Word16 *old_samples,Word16 *coe
acca = L_mac(acca,*--win_low, *--sam_low);
acca = L_mac(acca,*win_high++, *sam_high++);
- temp = round(acca);
+ temp = itu_round(acca);
*dst_ptr++ = temp;
move16();
@@ -145,7 +145,7 @@ Word16 samples_to_rmlt_coefs(Word16 *new_samples,Word16 *old_samples,Word16 *coe
neg_win_low = negate(*win_low++);
samp_high = *--sam_high;
acca = L_mac(acca, neg_win_low, samp_high);
- temp = round(acca);
+ temp = itu_round(acca);
*dst_ptr++=temp;
move16();