From b20356ecb30f87a4b7aca162dac946c9710e23f3 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Wed, 15 Apr 2009 14:45:41 +0000 Subject: 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 --- third_party/g7221/common/stl-files/basop32.c | 2 +- third_party/g7221/common/stl-files/basop32.h | 2 +- third_party/g7221/common/stl-files/typedef.h | 19 +++++++++++++++++++ third_party/g7221/decode/coef2sam.c | 4 ++-- third_party/g7221/decode/dct4_s.c | 10 +++++----- third_party/g7221/encode/dct4_a.c | 10 +++++----- third_party/g7221/encode/sam2coef.c | 4 ++-- 7 files changed, 35 insertions(+), 16 deletions(-) (limited to 'third_party/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 + +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 #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(); -- cgit v1.2.3