diff options
author | Nils Wallménius <nils@rockbox.org> | 2013-12-11 22:59:14 +0100 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2013-12-16 21:13:23 +0100 |
commit | e3c2ed7a71f65dc721c7210f120259ecd4ff65cb (patch) | |
tree | de593c1e927dcc036f1b6656f1f881995491b3b9 | |
parent | d0918b98fa0cfba21208a4fb5ed153687b8f02c3 (diff) | |
download | rockbox-e3c2ed7a71f65dc721c7210f120259ecd4ff65cb.tar.gz rockbox-e3c2ed7a71f65dc721c7210f120259ecd4ff65cb.zip |
Sync libopus to upstream release 1.1
Change-Id: I9fea7460fc33f60faff961b3389dd97b5191463c
97 files changed, 977 insertions, 578 deletions
diff --git a/lib/rbcodec/codecs/libopus/SOURCES b/lib/rbcodec/codecs/libopus/SOURCES index 81d49f3ff1..417cf01d88 100644 --- a/lib/rbcodec/codecs/libopus/SOURCES +++ b/lib/rbcodec/codecs/libopus/SOURCES | |||
@@ -63,6 +63,7 @@ silk/tables_pitch_lag.c | |||
63 | silk/tables_pulses_per_block.c | 63 | silk/tables_pulses_per_block.c |
64 | 64 | ||
65 | /* OPUS sources */ | 65 | /* OPUS sources */ |
66 | opus.c | ||
66 | opus_decoder.c | 67 | opus_decoder.c |
67 | opus_header.c | 68 | opus_header.c |
68 | 69 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/_kiss_fft_guts.h b/lib/rbcodec/codecs/libopus/celt/_kiss_fft_guts.h index 866a6520ca..cc52f37c36 100644 --- a/lib/rbcodec/codecs/libopus/celt/_kiss_fft_guts.h +++ b/lib/rbcodec/codecs/libopus/celt/_kiss_fft_guts.h | |||
@@ -94,15 +94,15 @@ | |||
94 | do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \ | 94 | do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \ |
95 | }while(0) | 95 | }while(0) |
96 | 96 | ||
97 | #if defined(ARMv4_ASM) | 97 | #if defined(OPUS_ARM_INLINE_ASM) |
98 | #include "arm/kiss_fft_armv4.h" | 98 | #include "arm/kiss_fft_armv4.h" |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | #if defined(ARMv5E_ASM) | 101 | #if defined(OPUS_ARM_INLINE_EDSP) |
102 | #include "arm/kiss_fft_armv5e.h" | 102 | #include "arm/kiss_fft_armv5e.h" |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | #if defined(CF_ASM) | 105 | #if defined(OPUS_CF_INLINE_ASM) |
106 | #include "cf/kiss_fft_cf.h" | 106 | #include "cf/kiss_fft_cf.h" |
107 | #endif | 107 | #endif |
108 | 108 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/arch.h b/lib/rbcodec/codecs/libopus/celt/arch.h index c0f9413d00..b2d26c4ee4 100644 --- a/lib/rbcodec/codecs/libopus/celt/arch.h +++ b/lib/rbcodec/codecs/libopus/celt/arch.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define ARCH_H | 35 | #define ARCH_H |
36 | 36 | ||
37 | #include "opus_types.h" | 37 | #include "opus_types.h" |
38 | #include "opus_defines.h" | ||
38 | 39 | ||
39 | # if !defined(__GNUC_PREREQ) | 40 | # if !defined(__GNUC_PREREQ) |
40 | # if defined(__GNUC__)&&defined(__GNUC_MINOR__) | 41 | # if defined(__GNUC__)&&defined(__GNUC_MINOR__) |
@@ -54,7 +55,7 @@ | |||
54 | #ifdef __GNUC__ | 55 | #ifdef __GNUC__ |
55 | __attribute__((noreturn)) | 56 | __attribute__((noreturn)) |
56 | #endif | 57 | #endif |
57 | static inline void _celt_fatal(const char *str, const char *file, int line) | 58 | static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line) |
58 | { | 59 | { |
59 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); | 60 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); |
60 | abort(); | 61 | abort(); |
@@ -113,9 +114,9 @@ typedef opus_val32 celt_ener; | |||
113 | 114 | ||
114 | #include "fixed_generic.h" | 115 | #include "fixed_generic.h" |
115 | 116 | ||
116 | #ifdef ARMv5E_ASM | 117 | #ifdef OPUS_ARM_INLINE_EDSP |
117 | #include "arm/fixed_armv5e.h" | 118 | #include "arm/fixed_armv5e.h" |
118 | #elif defined (ARMv4_ASM) | 119 | #elif defined (OPUS_ARM_INLINE_ASM) |
119 | #include "arm/fixed_armv4.h" | 120 | #include "arm/fixed_armv4.h" |
120 | #elif defined (BFIN_ASM) | 121 | #elif defined (BFIN_ASM) |
121 | #include "fixed_bfin.h" | 122 | #include "fixed_bfin.h" |
@@ -123,7 +124,7 @@ typedef opus_val32 celt_ener; | |||
123 | #include "fixed_c5x.h" | 124 | #include "fixed_c5x.h" |
124 | #elif defined (TI_C6X_ASM) | 125 | #elif defined (TI_C6X_ASM) |
125 | #include "fixed_c6x.h" | 126 | #include "fixed_c6x.h" |
126 | #elif defined (CF_ASM) | 127 | #elif defined (OPUS_CF_INLINE_ASM) |
127 | #include "cf/fixed_cf.h" | 128 | #include "cf/fixed_cf.h" |
128 | #endif | 129 | #endif |
129 | 130 | ||
@@ -187,6 +188,7 @@ typedef float celt_ener; | |||
187 | #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) | 188 | #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) |
188 | 189 | ||
189 | #define MULT16_16_Q11_32(a,b) ((a)*(b)) | 190 | #define MULT16_16_Q11_32(a,b) ((a)*(b)) |
191 | #define MULT16_16_Q11(a,b) ((a)*(b)) | ||
190 | #define MULT16_16_Q13(a,b) ((a)*(b)) | 192 | #define MULT16_16_Q13(a,b) ((a)*(b)) |
191 | #define MULT16_16_Q14(a,b) ((a)*(b)) | 193 | #define MULT16_16_Q14(a,b) ((a)*(b)) |
192 | #define MULT16_16_Q15(a,b) ((a)*(b)) | 194 | #define MULT16_16_Q15(a,b) ((a)*(b)) |
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h index bcacc343e8..b690bc8cea 100644 --- a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h +++ b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ | 30 | /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ |
31 | #undef MULT16_32_Q16 | 31 | #undef MULT16_32_Q16 |
32 | static inline opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b) | 32 | static OPUS_INLINE opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b) |
33 | { | 33 | { |
34 | unsigned rd_lo; | 34 | unsigned rd_lo; |
35 | int rd_hi; | 35 | int rd_hi; |
@@ -46,7 +46,7 @@ static inline opus_val32 MULT16_32_Q16_armv4(opus_val16 a, opus_val32 b) | |||
46 | 46 | ||
47 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ | 47 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ |
48 | #undef MULT16_32_Q15 | 48 | #undef MULT16_32_Q15 |
49 | static inline opus_val32 MULT16_32_Q15_armv4(opus_val16 a, opus_val32 b) | 49 | static OPUS_INLINE opus_val32 MULT16_32_Q15_armv4(opus_val16 a, opus_val32 b) |
50 | { | 50 | { |
51 | unsigned rd_lo; | 51 | unsigned rd_lo; |
52 | int rd_hi; | 52 | int rd_hi; |
diff --git a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h index 80632c4a94..1194a7d3ec 100644 --- a/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h +++ b/lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ | 35 | /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */ |
36 | #undef MULT16_32_Q16 | 36 | #undef MULT16_32_Q16 |
37 | static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) | 37 | static OPUS_INLINE opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) |
38 | { | 38 | { |
39 | int res; | 39 | int res; |
40 | __asm__( | 40 | __asm__( |
@@ -50,7 +50,7 @@ static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) | |||
50 | 50 | ||
51 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ | 51 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ |
52 | #undef MULT16_32_Q15 | 52 | #undef MULT16_32_Q15 |
53 | static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) | 53 | static OPUS_INLINE opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) |
54 | { | 54 | { |
55 | int res; | 55 | int res; |
56 | __asm__( | 56 | __asm__( |
@@ -68,7 +68,7 @@ static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) | |||
68 | b must fit in 31 bits. | 68 | b must fit in 31 bits. |
69 | Result fits in 32 bits. */ | 69 | Result fits in 32 bits. */ |
70 | #undef MAC16_32_Q15 | 70 | #undef MAC16_32_Q15 |
71 | static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, | 71 | static OPUS_INLINE opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, |
72 | opus_val32 b) | 72 | opus_val32 b) |
73 | { | 73 | { |
74 | int res; | 74 | int res; |
@@ -84,7 +84,7 @@ static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, | |||
84 | 84 | ||
85 | /** 16x16 multiply-add where the result fits in 32 bits */ | 85 | /** 16x16 multiply-add where the result fits in 32 bits */ |
86 | #undef MAC16_16 | 86 | #undef MAC16_16 |
87 | static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, | 87 | static OPUS_INLINE opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, |
88 | opus_val16 b) | 88 | opus_val16 b) |
89 | { | 89 | { |
90 | int res; | 90 | int res; |
@@ -100,7 +100,7 @@ static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, | |||
100 | 100 | ||
101 | /** 16x16 multiplication where the result fits in 32 bits */ | 101 | /** 16x16 multiplication where the result fits in 32 bits */ |
102 | #undef MULT16_16 | 102 | #undef MULT16_16 |
103 | static inline opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) | 103 | static OPUS_INLINE opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) |
104 | { | 104 | { |
105 | int res; | 105 | int res; |
106 | __asm__( | 106 | __asm__( |
diff --git a/lib/rbcodec/codecs/libopus/celt/bands.c b/lib/rbcodec/codecs/libopus/celt/bands.c index 5c715aff53..1ad786d795 100644 --- a/lib/rbcodec/codecs/libopus/celt/bands.c +++ b/lib/rbcodec/codecs/libopus/celt/bands.c | |||
@@ -216,7 +216,9 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, | |||
216 | j=M*eBands[i]; | 216 | j=M*eBands[i]; |
217 | band_end = M*eBands[i+1]; | 217 | band_end = M*eBands[i+1]; |
218 | lg = ADD16(bandLogE[i+c*m->nbEBands], SHL16((opus_val16)eMeans[i],6)); | 218 | lg = ADD16(bandLogE[i+c*m->nbEBands], SHL16((opus_val16)eMeans[i],6)); |
219 | #ifdef FIXED_POINT | 219 | #ifndef FIXED_POINT |
220 | g = celt_exp2(lg); | ||
221 | #else | ||
220 | /* Handle the integer part of the log energy */ | 222 | /* Handle the integer part of the log energy */ |
221 | shift = 16-(lg>>DB_SHIFT); | 223 | shift = 16-(lg>>DB_SHIFT); |
222 | if (shift>31) | 224 | if (shift>31) |
@@ -227,9 +229,23 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, | |||
227 | /* Handle the fractional part. */ | 229 | /* Handle the fractional part. */ |
228 | g = celt_exp2_frac(lg&((1<<DB_SHIFT)-1)); | 230 | g = celt_exp2_frac(lg&((1<<DB_SHIFT)-1)); |
229 | } | 231 | } |
230 | #else | 232 | /* Handle extreme gains with negative shift. */ |
231 | g = celt_exp2(lg); | 233 | if (shift<0) |
234 | { | ||
235 | /* For shift < -2 we'd be likely to overflow, so we're capping | ||
236 | the gain here. This shouldn't happen unless the bitstream is | ||
237 | already corrupted. */ | ||
238 | if (shift < -2) | ||
239 | { | ||
240 | g = 32767; | ||
241 | shift = -2; | ||
242 | } | ||
243 | do { | ||
244 | *f++ = SHL32(MULT16_16(*x++, g), -shift); | ||
245 | } while (++j<band_end); | ||
246 | } else | ||
232 | #endif | 247 | #endif |
248 | /* Be careful of the fixed-point "else" just above when changing this code */ | ||
233 | do { | 249 | do { |
234 | *f++ = SHR32(MULT16_16(*x++, g), shift); | 250 | *f++ = SHR32(MULT16_16(*x++, g), shift); |
235 | } while (++j<band_end); | 251 | } while (++j<band_end); |
@@ -495,7 +511,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average, | |||
495 | *tapset_decision=0; | 511 | *tapset_decision=0; |
496 | } | 512 | } |
497 | /*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/ | 513 | /*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/ |
498 | celt_assert(nbBands>0); /*M*(eBands[end]-eBands[end-1]) <= 8 assures this*/ | 514 | celt_assert(nbBands>0); /* end has to be non-zero */ |
499 | sum /= nbBands; | 515 | sum /= nbBands; |
500 | /* Recursive averaging */ | 516 | /* Recursive averaging */ |
501 | sum = (sum+*average)>>1; | 517 | sum = (sum+*average)>>1; |
@@ -873,7 +889,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X, | |||
873 | int q; | 889 | int q; |
874 | int curr_bits; | 890 | int curr_bits; |
875 | int imid=0, iside=0; | 891 | int imid=0, iside=0; |
876 | int N_B=N; | ||
877 | int B0=B; | 892 | int B0=B; |
878 | opus_val16 mid=0, side=0; | 893 | opus_val16 mid=0, side=0; |
879 | unsigned cm=0; | 894 | unsigned cm=0; |
@@ -895,8 +910,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X, | |||
895 | spread = ctx->spread; | 910 | spread = ctx->spread; |
896 | ec = ctx->ec; | 911 | ec = ctx->ec; |
897 | 912 | ||
898 | N_B /= B; | ||
899 | |||
900 | /* If we need 1.5 more bit than we can produce, split the band in two. */ | 913 | /* If we need 1.5 more bit than we can produce, split the band in two. */ |
901 | cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i]; | 914 | cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i]; |
902 | if (LM != -1 && b > cache[cache[0]]+12 && N>2) | 915 | if (LM != -1 && b > cache[cache[0]]+12 && N>2) |
@@ -1076,7 +1089,6 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X, | |||
1076 | longBlocks = B0==1; | 1089 | longBlocks = B0==1; |
1077 | 1090 | ||
1078 | N_B /= B; | 1091 | N_B /= B; |
1079 | N_B0 = N_B; | ||
1080 | 1092 | ||
1081 | /* Special case for one sample */ | 1093 | /* Special case for one sample */ |
1082 | if (N==1) | 1094 | if (N==1) |
diff --git a/lib/rbcodec/codecs/libopus/celt/celt.h b/lib/rbcodec/codecs/libopus/celt/celt.h index 0911c72f72..5deea1f0aa 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt.h +++ b/lib/rbcodec/codecs/libopus/celt/celt.h | |||
@@ -52,11 +52,11 @@ extern "C" { | |||
52 | 52 | ||
53 | typedef struct { | 53 | typedef struct { |
54 | int valid; | 54 | int valid; |
55 | opus_val16 tonality; | 55 | float tonality; |
56 | opus_val16 tonality_slope; | 56 | float tonality_slope; |
57 | opus_val16 noisiness; | 57 | float noisiness; |
58 | opus_val16 activity; | 58 | float activity; |
59 | opus_val16 music_prob; | 59 | float music_prob; |
60 | int bandwidth; | 60 | int bandwidth; |
61 | }AnalysisInfo; | 61 | }AnalysisInfo; |
62 | 62 | ||
@@ -66,6 +66,10 @@ typedef struct { | |||
66 | 66 | ||
67 | /* Encoder/decoder Requests */ | 67 | /* Encoder/decoder Requests */ |
68 | 68 | ||
69 | /* Expose this option again when variable framesize actually works */ | ||
70 | #define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */ | ||
71 | |||
72 | |||
69 | #define CELT_SET_PREDICTION_REQUEST 10002 | 73 | #define CELT_SET_PREDICTION_REQUEST 10002 |
70 | /** Controls the use of interframe prediction. | 74 | /** Controls the use of interframe prediction. |
71 | 0=Independent frames | 75 | 0=Independent frames |
@@ -109,10 +113,7 @@ typedef struct { | |||
109 | #define OPUS_SET_LFE_REQUEST 10024 | 113 | #define OPUS_SET_LFE_REQUEST 10024 |
110 | #define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x) | 114 | #define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x) |
111 | 115 | ||
112 | #define OPUS_SET_ENERGY_SAVE_REQUEST 10026 | 116 | #define OPUS_SET_ENERGY_MASK_REQUEST 10026 |
113 | #define OPUS_SET_ENERGY_SAVE(x) OPUS_SET_ENERGY_SAVE_REQUEST, __opus_check_val16_ptr(x) | ||
114 | |||
115 | #define OPUS_SET_ENERGY_MASK_REQUEST 10028 | ||
116 | #define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16_ptr(x) | 117 | #define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16_ptr(x) |
117 | 118 | ||
118 | /* Encoder stuff */ | 119 | /* Encoder stuff */ |
@@ -121,7 +122,8 @@ int celt_encoder_get_size(int channels); | |||
121 | 122 | ||
122 | int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc); | 123 | int celt_encode_with_ec(OpusCustomEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc); |
123 | 124 | ||
124 | int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels); | 125 | int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels, |
126 | int arch); | ||
125 | 127 | ||
126 | 128 | ||
127 | 129 | ||
@@ -141,7 +143,7 @@ int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned cha | |||
141 | #ifdef CUSTOM_MODES | 143 | #ifdef CUSTOM_MODES |
142 | #define OPUS_CUSTOM_NOSTATIC | 144 | #define OPUS_CUSTOM_NOSTATIC |
143 | #else | 145 | #else |
144 | #define OPUS_CUSTOM_NOSTATIC static inline | 146 | #define OPUS_CUSTOM_NOSTATIC static OPUS_INLINE |
145 | #endif | 147 | #endif |
146 | 148 | ||
147 | static const unsigned char trim_icdf[11] = {126, 124, 119, 109, 87, 41, 19, 9, 4, 2, 0}; | 149 | static const unsigned char trim_icdf[11] = {126, 124, 119, 109, 87, 41, 19, 9, 4, 2, 0}; |
@@ -166,7 +168,7 @@ static const unsigned char fromOpusTable[16] = { | |||
166 | 0x00, 0x08, 0x10, 0x18 | 168 | 0x00, 0x08, 0x10, 0x18 |
167 | }; | 169 | }; |
168 | 170 | ||
169 | static inline int toOpus(unsigned char c) | 171 | static OPUS_INLINE int toOpus(unsigned char c) |
170 | { | 172 | { |
171 | int ret=0; | 173 | int ret=0; |
172 | if (c<0xA0) | 174 | if (c<0xA0) |
@@ -177,7 +179,7 @@ static inline int toOpus(unsigned char c) | |||
177 | return ret|(c&0x7); | 179 | return ret|(c&0x7); |
178 | } | 180 | } |
179 | 181 | ||
180 | static inline int fromOpus(unsigned char c) | 182 | static OPUS_INLINE int fromOpus(unsigned char c) |
181 | { | 183 | { |
182 | if (c<0x80) | 184 | if (c<0x80) |
183 | return -1; | 185 | return -1; |
@@ -193,6 +195,9 @@ extern const signed char tf_select_table[4][8]; | |||
193 | 195 | ||
194 | int resampling_factor(opus_int32 rate); | 196 | int resampling_factor(opus_int32 rate); |
195 | 197 | ||
198 | void celt_preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_RESTRICT inp, | ||
199 | int N, int CC, int upsample, const opus_val16 *coef, celt_sig *mem, int clip); | ||
200 | |||
196 | void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, | 201 | void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, |
197 | opus_val16 g0, opus_val16 g1, int tapset0, int tapset1, | 202 | opus_val16 g0, opus_val16 g1, int tapset0, int tapset1, |
198 | const opus_val16 *window, int overlap); | 203 | const opus_val16 *window, int overlap); |
diff --git a/lib/rbcodec/codecs/libopus/celt/celt_decoder.c b/lib/rbcodec/codecs/libopus/celt/celt_decoder.c index 3d8211b9b0..77fa2d01f7 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt_decoder.c +++ b/lib/rbcodec/codecs/libopus/celt/celt_decoder.c | |||
@@ -175,7 +175,7 @@ void opus_custom_decoder_destroy(CELTDecoder *st) | |||
175 | } | 175 | } |
176 | #endif /* CUSTOM_MODES */ | 176 | #endif /* CUSTOM_MODES */ |
177 | 177 | ||
178 | static inline opus_val16 SIG2WORD16(celt_sig x) | 178 | static OPUS_INLINE opus_val16 SIG2WORD16(celt_sig x) |
179 | { | 179 | { |
180 | #ifdef FIXED_POINT | 180 | #ifdef FIXED_POINT |
181 | x = PSHR32(x, SIG_SHIFT); | 181 | x = PSHR32(x, SIG_SHIFT); |
@@ -213,7 +213,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c | |||
213 | opus_val16 coef3 = coef[3]; | 213 | opus_val16 coef3 = coef[3]; |
214 | for (j=0;j<N;j++) | 214 | for (j=0;j<N;j++) |
215 | { | 215 | { |
216 | celt_sig tmp = x[j] + m; | 216 | celt_sig tmp = x[j] + m + VERY_SMALL; |
217 | m = MULT16_32_Q15(coef0, tmp) | 217 | m = MULT16_32_Q15(coef0, tmp) |
218 | - MULT16_32_Q15(coef1, x[j]); | 218 | - MULT16_32_Q15(coef1, x[j]); |
219 | tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); | 219 | tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); |
@@ -227,7 +227,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c | |||
227 | /* Shortcut for the standard (non-custom modes) case */ | 227 | /* Shortcut for the standard (non-custom modes) case */ |
228 | for (j=0;j<N;j++) | 228 | for (j=0;j<N;j++) |
229 | { | 229 | { |
230 | celt_sig tmp = x[j] + m; | 230 | celt_sig tmp = x[j] + m + VERY_SMALL; |
231 | m = MULT16_32_Q15(coef0, tmp); | 231 | m = MULT16_32_Q15(coef0, tmp); |
232 | scratch[j] = tmp; | 232 | scratch[j] = tmp; |
233 | } | 233 | } |
@@ -447,10 +447,11 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R | |||
447 | { | 447 | { |
448 | VARDECL( opus_val16, lp_pitch_buf ); | 448 | VARDECL( opus_val16, lp_pitch_buf ); |
449 | ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 ); | 449 | ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 ); |
450 | pitch_downsample(decode_mem, lp_pitch_buf, DECODE_BUFFER_SIZE, C); | 450 | pitch_downsample(decode_mem, lp_pitch_buf, |
451 | DECODE_BUFFER_SIZE, C, st->arch); | ||
451 | pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf, | 452 | pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf, |
452 | DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX, | 453 | DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX, |
453 | PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index); | 454 | PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index, st->arch); |
454 | pitch_index = PLC_PITCH_LAG_MAX-pitch_index; | 455 | pitch_index = PLC_PITCH_LAG_MAX-pitch_index; |
455 | st->last_pitch_index = pitch_index; | 456 | st->last_pitch_index = pitch_index; |
456 | } else { | 457 | } else { |
@@ -481,7 +482,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R | |||
481 | opus_val32 ac[LPC_ORDER+1]; | 482 | opus_val32 ac[LPC_ORDER+1]; |
482 | /* Compute LPC coefficients for the last MAX_PERIOD samples before | 483 | /* Compute LPC coefficients for the last MAX_PERIOD samples before |
483 | the first loss so we can work in the excitation-filter domain. */ | 484 | the first loss so we can work in the excitation-filter domain. */ |
484 | _celt_autocorr(exc, ac, window, overlap, LPC_ORDER, MAX_PERIOD); | 485 | _celt_autocorr(exc, ac, window, overlap, |
486 | LPC_ORDER, MAX_PERIOD, st->arch); | ||
485 | /* Add a noise floor of -40 dB. */ | 487 | /* Add a noise floor of -40 dB. */ |
486 | #ifdef FIXED_POINT | 488 | #ifdef FIXED_POINT |
487 | ac[0] += SHR32(ac[0],13); | 489 | ac[0] += SHR32(ac[0],13); |
@@ -668,7 +670,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat | |||
668 | VARDECL(int, fine_priority); | 670 | VARDECL(int, fine_priority); |
669 | VARDECL(int, tf_res); | 671 | VARDECL(int, tf_res); |
670 | VARDECL(unsigned char, collapse_masks); | 672 | VARDECL(unsigned char, collapse_masks); |
671 | celt_sig *out_mem[2] = {NULL, NULL}; | ||
672 | celt_sig *decode_mem[2]; | 673 | celt_sig *decode_mem[2]; |
673 | celt_sig *out_syn[2]; | 674 | celt_sig *out_syn[2]; |
674 | opus_val16 *lpc; | 675 | opus_val16 *lpc; |
@@ -709,7 +710,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat | |||
709 | 710 | ||
710 | c=0; do { | 711 | c=0; do { |
711 | decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap); | 712 | decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap); |
712 | out_mem[c] = decode_mem[c]+DECODE_BUFFER_SIZE-MAX_PERIOD; | ||
713 | } while (++c<CC); | 713 | } while (++c<CC); |
714 | lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC); | 714 | lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC); |
715 | oldBandE = lpc+CC*LPC_ORDER; | 715 | oldBandE = lpc+CC*LPC_ORDER; |
@@ -934,7 +934,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat | |||
934 | /* Synthesis */ | 934 | /* Synthesis */ |
935 | denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M); | 935 | denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M); |
936 | } | 936 | } |
937 | |||
938 | c=0; do { | 937 | c=0; do { |
939 | OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2); | 938 | OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2); |
940 | } while (++c<CC); | 939 | } while (++c<CC); |
@@ -948,7 +947,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat | |||
948 | } while (++c<C); | 947 | } while (++c<C); |
949 | 948 | ||
950 | c=0; do { | 949 | c=0; do { |
951 | out_syn[c] = out_mem[c]+MAX_PERIOD-N; | 950 | out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N; |
952 | } while (++c<CC); | 951 | } while (++c<CC); |
953 | 952 | ||
954 | if (CC==2&&C==1) | 953 | if (CC==2&&C==1) |
diff --git a/lib/rbcodec/codecs/libopus/celt/celt_lpc.c b/lib/rbcodec/codecs/libopus/celt/celt_lpc.c index 7ffe90a357..fa29d626ea 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt_lpc.c +++ b/lib/rbcodec/codecs/libopus/celt/celt_lpc.c | |||
@@ -226,7 +226,8 @@ int _celt_autocorr( | |||
226 | const opus_val16 *window, | 226 | const opus_val16 *window, |
227 | int overlap, | 227 | int overlap, |
228 | int lag, | 228 | int lag, |
229 | int n | 229 | int n, |
230 | int arch | ||
230 | ) | 231 | ) |
231 | { | 232 | { |
232 | opus_val32 d; | 233 | opus_val32 d; |
@@ -275,7 +276,7 @@ int _celt_autocorr( | |||
275 | shift = 0; | 276 | shift = 0; |
276 | } | 277 | } |
277 | #endif | 278 | #endif |
278 | celt_pitch_xcorr(xptr, xptr, ac, fastN, lag+1); | 279 | celt_pitch_xcorr(xptr, xptr, ac, fastN, lag+1, arch); |
279 | for (k=0;k<=lag;k++) | 280 | for (k=0;k<=lag;k++) |
280 | { | 281 | { |
281 | for (i = k+fastN, d = 0; i < n; i++) | 282 | for (i = k+fastN, d = 0; i < n; i++) |
diff --git a/lib/rbcodec/codecs/libopus/celt/celt_lpc.h b/lib/rbcodec/codecs/libopus/celt/celt_lpc.h index 19279a0ed6..dc2a0a3d26 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt_lpc.h +++ b/lib/rbcodec/codecs/libopus/celt/celt_lpc.h | |||
@@ -48,6 +48,7 @@ void celt_iir(const opus_val32 *x, | |||
48 | int ord, | 48 | int ord, |
49 | opus_val16 *mem); | 49 | opus_val16 *mem); |
50 | 50 | ||
51 | int _celt_autocorr(const opus_val16 *x, opus_val32 *ac, const opus_val16 *window, int overlap, int lag, int n); | 51 | int _celt_autocorr(const opus_val16 *x, opus_val32 *ac, |
52 | const opus_val16 *window, int overlap, int lag, int n, int arch); | ||
52 | 53 | ||
53 | #endif /* PLC_H */ | 54 | #endif /* PLC_H */ |
diff --git a/lib/rbcodec/codecs/libopus/celt/cpu_support.h b/lib/rbcodec/codecs/libopus/celt/cpu_support.h index 41481feb9c..d68dbe62c5 100644 --- a/lib/rbcodec/codecs/libopus/celt/cpu_support.h +++ b/lib/rbcodec/codecs/libopus/celt/cpu_support.h | |||
@@ -28,7 +28,10 @@ | |||
28 | #ifndef CPU_SUPPORT_H | 28 | #ifndef CPU_SUPPORT_H |
29 | #define CPU_SUPPORT_H | 29 | #define CPU_SUPPORT_H |
30 | 30 | ||
31 | #if defined(OPUS_HAVE_RTCD) && defined(ARMv4_ASM) | 31 | #include "opus_types.h" |
32 | #include "opus_defines.h" | ||
33 | |||
34 | #if defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_ASM) | ||
32 | #include "arm/armcpu.h" | 35 | #include "arm/armcpu.h" |
33 | 36 | ||
34 | /* We currently support 4 ARM variants: | 37 | /* We currently support 4 ARM variants: |
@@ -42,7 +45,7 @@ | |||
42 | #else | 45 | #else |
43 | #define OPUS_ARCHMASK 0 | 46 | #define OPUS_ARCHMASK 0 |
44 | 47 | ||
45 | static inline int opus_select_arch(void) | 48 | static OPUS_INLINE int opus_select_arch(void) |
46 | { | 49 | { |
47 | return 0; | 50 | return 0; |
48 | } | 51 | } |
diff --git a/lib/rbcodec/codecs/libopus/celt/cwrs.c b/lib/rbcodec/codecs/libopus/celt/cwrs.c index eb8fa1c807..03b86985d2 100644 --- a/lib/rbcodec/codecs/libopus/celt/cwrs.c +++ b/lib/rbcodec/codecs/libopus/celt/cwrs.c | |||
@@ -410,7 +410,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272] ICONST_ATTR ={ | |||
410 | }; | 410 | }; |
411 | 411 | ||
412 | #if defined(CUSTOM_MODES) | 412 | #if defined(CUSTOM_MODES) |
413 | const opus_uint32 *const CELT_PVQ_U_ROW[15]={ | 413 | static const opus_uint32 *const CELT_PVQ_U_ROW[15]={ |
414 | CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 208,CELT_PVQ_U_DATA+ 415, | 414 | CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 208,CELT_PVQ_U_DATA+ 415, |
415 | CELT_PVQ_U_DATA+ 621,CELT_PVQ_U_DATA+ 826,CELT_PVQ_U_DATA+1030, | 415 | CELT_PVQ_U_DATA+ 621,CELT_PVQ_U_DATA+ 826,CELT_PVQ_U_DATA+1030, |
416 | CELT_PVQ_U_DATA+1233,CELT_PVQ_U_DATA+1336,CELT_PVQ_U_DATA+1389, | 416 | CELT_PVQ_U_DATA+1233,CELT_PVQ_U_DATA+1336,CELT_PVQ_U_DATA+1389, |
@@ -418,7 +418,7 @@ const opus_uint32 *const CELT_PVQ_U_ROW[15]={ | |||
418 | CELT_PVQ_U_DATA+1464,CELT_PVQ_U_DATA+1470,CELT_PVQ_U_DATA+1473 | 418 | CELT_PVQ_U_DATA+1464,CELT_PVQ_U_DATA+1470,CELT_PVQ_U_DATA+1473 |
419 | }; | 419 | }; |
420 | #else | 420 | #else |
421 | const opus_uint32 *const CELT_PVQ_U_ROW[15]={ | 421 | static const opus_uint32 *const CELT_PVQ_U_ROW[15]={ |
422 | CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 176,CELT_PVQ_U_DATA+ 351, | 422 | CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 176,CELT_PVQ_U_DATA+ 351, |
423 | CELT_PVQ_U_DATA+ 525,CELT_PVQ_U_DATA+ 698,CELT_PVQ_U_DATA+ 870, | 423 | CELT_PVQ_U_DATA+ 525,CELT_PVQ_U_DATA+ 698,CELT_PVQ_U_DATA+ 870, |
424 | CELT_PVQ_U_DATA+1041,CELT_PVQ_U_DATA+1131,CELT_PVQ_U_DATA+1178, | 424 | CELT_PVQ_U_DATA+1041,CELT_PVQ_U_DATA+1131,CELT_PVQ_U_DATA+1178, |
@@ -534,7 +534,7 @@ void decode_pulses(int *_y,int _n,int _k,ec_dec *_dec){ | |||
534 | /*Computes the next row/column of any recurrence that obeys the relation | 534 | /*Computes the next row/column of any recurrence that obeys the relation |
535 | u[i][j]=u[i-1][j]+u[i][j-1]+u[i-1][j-1]. | 535 | u[i][j]=u[i-1][j]+u[i][j-1]+u[i-1][j-1]. |
536 | _ui0 is the base case for the new row/column.*/ | 536 | _ui0 is the base case for the new row/column.*/ |
537 | static inline void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){ | 537 | static OPUS_INLINE void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){ |
538 | opus_uint32 ui1; | 538 | opus_uint32 ui1; |
539 | unsigned j; | 539 | unsigned j; |
540 | /*This do-while will overrun the array if we don't have storage for at least | 540 | /*This do-while will overrun the array if we don't have storage for at least |
@@ -550,7 +550,7 @@ static inline void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){ | |||
550 | /*Computes the previous row/column of any recurrence that obeys the relation | 550 | /*Computes the previous row/column of any recurrence that obeys the relation |
551 | u[i-1][j]=u[i][j]-u[i][j-1]-u[i-1][j-1]. | 551 | u[i-1][j]=u[i][j]-u[i][j-1]-u[i-1][j-1]. |
552 | _ui0 is the base case for the new row/column.*/ | 552 | _ui0 is the base case for the new row/column.*/ |
553 | static inline void uprev(opus_uint32 *_ui,unsigned _n,opus_uint32 _ui0){ | 553 | static OPUS_INLINE void uprev(opus_uint32 *_ui,unsigned _n,opus_uint32 _ui0){ |
554 | opus_uint32 ui1; | 554 | opus_uint32 ui1; |
555 | unsigned j; | 555 | unsigned j; |
556 | /*This do-while will overrun the array if we don't have storage for at least | 556 | /*This do-while will overrun the array if we don't have storage for at least |
@@ -617,7 +617,7 @@ static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y,opus_uint32 *_u){ | |||
617 | of size 1 with associated sign bits. | 617 | of size 1 with associated sign bits. |
618 | _y: The vector of pulses, whose sum of absolute values is K. | 618 | _y: The vector of pulses, whose sum of absolute values is K. |
619 | _k: Returns K.*/ | 619 | _k: Returns K.*/ |
620 | static inline opus_uint32 icwrs1(const int *_y,int *_k){ | 620 | static OPUS_INLINE opus_uint32 icwrs1(const int *_y,int *_k){ |
621 | *_k=abs(_y[0]); | 621 | *_k=abs(_y[0]); |
622 | return _y[0]<0; | 622 | return _y[0]<0; |
623 | } | 623 | } |
@@ -626,7 +626,7 @@ static inline opus_uint32 icwrs1(const int *_y,int *_k){ | |||
626 | of size _n with associated sign bits. | 626 | of size _n with associated sign bits. |
627 | _y: The vector of pulses, whose sum of absolute values must be _k. | 627 | _y: The vector of pulses, whose sum of absolute values must be _k. |
628 | _nc: Returns V(_n,_k).*/ | 628 | _nc: Returns V(_n,_k).*/ |
629 | static inline opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y, | 629 | static OPUS_INLINE opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y, |
630 | opus_uint32 *_u){ | 630 | opus_uint32 *_u){ |
631 | opus_uint32 i; | 631 | opus_uint32 i; |
632 | int j; | 632 | int j; |
diff --git a/lib/rbcodec/codecs/libopus/celt/ecintrin.h b/lib/rbcodec/codecs/libopus/celt/ecintrin.h index be57dd40de..2263cff6bd 100644 --- a/lib/rbcodec/codecs/libopus/celt/ecintrin.h +++ b/lib/rbcodec/codecs/libopus/celt/ecintrin.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #if !defined(_ecintrin_H) | 33 | #if !defined(_ecintrin_H) |
34 | # define _ecintrin_H (1) | 34 | # define _ecintrin_H (1) |
35 | 35 | ||
36 | /*Some specific platforms may have optimized intrinsic or inline assembly | 36 | /*Some specific platforms may have optimized intrinsic or OPUS_INLINE assembly |
37 | versions of these functions which can substantially improve performance. | 37 | versions of these functions which can substantially improve performance. |
38 | We define macros for them to allow easy incorporation of these non-ANSI | 38 | We define macros for them to allow easy incorporation of these non-ANSI |
39 | features.*/ | 39 | features.*/ |
diff --git a/lib/rbcodec/codecs/libopus/celt/entcode.h b/lib/rbcodec/codecs/libopus/celt/entcode.h index aebecc0647..dd13e49e50 100644 --- a/lib/rbcodec/codecs/libopus/celt/entcode.h +++ b/lib/rbcodec/codecs/libopus/celt/entcode.h | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "opus_types.h" | 28 | #include "opus_types.h" |
29 | #include "opus_defines.h" | ||
29 | 30 | ||
30 | #if !defined(_entcode_H) | 31 | #if !defined(_entcode_H) |
31 | # define _entcode_H (1) | 32 | # define _entcode_H (1) |
@@ -83,15 +84,15 @@ struct ec_ctx{ | |||
83 | int error; | 84 | int error; |
84 | }; | 85 | }; |
85 | 86 | ||
86 | static inline opus_uint32 ec_range_bytes(ec_ctx *_this){ | 87 | static OPUS_INLINE opus_uint32 ec_range_bytes(ec_ctx *_this){ |
87 | return _this->offs; | 88 | return _this->offs; |
88 | } | 89 | } |
89 | 90 | ||
90 | static inline unsigned char *ec_get_buffer(ec_ctx *_this){ | 91 | static OPUS_INLINE unsigned char *ec_get_buffer(ec_ctx *_this){ |
91 | return _this->buf; | 92 | return _this->buf; |
92 | } | 93 | } |
93 | 94 | ||
94 | static inline int ec_get_error(ec_ctx *_this){ | 95 | static OPUS_INLINE int ec_get_error(ec_ctx *_this){ |
95 | return _this->error; | 96 | return _this->error; |
96 | } | 97 | } |
97 | 98 | ||
@@ -101,7 +102,7 @@ static inline int ec_get_error(ec_ctx *_this){ | |||
101 | Return: The number of bits. | 102 | Return: The number of bits. |
102 | This will always be slightly larger than the exact value (e.g., all | 103 | This will always be slightly larger than the exact value (e.g., all |
103 | rounding error is in the positive direction).*/ | 104 | rounding error is in the positive direction).*/ |
104 | static inline int ec_tell(ec_ctx *_this){ | 105 | static OPUS_INLINE int ec_tell(ec_ctx *_this){ |
105 | return _this->nbits_total-EC_ILOG(_this->rng); | 106 | return _this->nbits_total-EC_ILOG(_this->rng); |
106 | } | 107 | } |
107 | 108 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/fixed_generic.h b/lib/rbcodec/codecs/libopus/celt/fixed_generic.h index 0e77976e83..ecf018a244 100644 --- a/lib/rbcodec/codecs/libopus/celt/fixed_generic.h +++ b/lib/rbcodec/codecs/libopus/celt/fixed_generic.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16)) | 40 | #define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16)) |
41 | 41 | ||
42 | /** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). Results fits in 32 bits */ | 42 | /** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). Results fits in 32 bits */ |
43 | #define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16((a),((b)&0x0000ffff)),16)) | 43 | #define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16SU((a),((b)&0x0000ffff)),16)) |
44 | 44 | ||
45 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ | 45 | /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */ |
46 | #define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),((b)&0x0000ffff)),15)) | 46 | #define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),((b)&0x0000ffff)),15)) |
@@ -116,6 +116,7 @@ | |||
116 | #define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) | 116 | #define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) |
117 | 117 | ||
118 | #define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11)) | 118 | #define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11)) |
119 | #define MULT16_16_Q11(a,b) (SHR(MULT16_16((a),(b)),11)) | ||
119 | #define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13)) | 120 | #define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13)) |
120 | #define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14)) | 121 | #define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14)) |
121 | #define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15)) | 122 | #define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15)) |
diff --git a/lib/rbcodec/codecs/libopus/celt/float_cast.h b/lib/rbcodec/codecs/libopus/celt/float_cast.h index 5ded291599..ede6574860 100644 --- a/lib/rbcodec/codecs/libopus/celt/float_cast.h +++ b/lib/rbcodec/codecs/libopus/celt/float_cast.h | |||
@@ -101,7 +101,7 @@ | |||
101 | #include <math.h> | 101 | #include <math.h> |
102 | 102 | ||
103 | /* Win32 doesn't seem to have these functions. | 103 | /* Win32 doesn't seem to have these functions. |
104 | ** Therefore implement inline versions of these functions here. | 104 | ** Therefore implement OPUS_INLINE versions of these functions here. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | __inline long int | 107 | __inline long int |
@@ -128,7 +128,7 @@ | |||
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | #ifndef DISABLE_FLOAT_API | 130 | #ifndef DISABLE_FLOAT_API |
131 | static inline opus_int16 FLOAT2INT16(float x) | 131 | static OPUS_INLINE opus_int16 FLOAT2INT16(float x) |
132 | { | 132 | { |
133 | x = x*CELT_SIG_SCALE; | 133 | x = x*CELT_SIG_SCALE; |
134 | x = MAX32(x, -32768); | 134 | x = MAX32(x, -32768); |
diff --git a/lib/rbcodec/codecs/libopus/celt/mathops.c b/lib/rbcodec/codecs/libopus/celt/mathops.c index 21fd942960..3f8c5dcc0e 100644 --- a/lib/rbcodec/codecs/libopus/celt/mathops.c +++ b/lib/rbcodec/codecs/libopus/celt/mathops.c | |||
@@ -139,7 +139,7 @@ opus_val32 celt_sqrt(opus_val32 x) | |||
139 | #define L3 8277 | 139 | #define L3 8277 |
140 | #define L4 -626 | 140 | #define L4 -626 |
141 | 141 | ||
142 | static inline opus_val16 _celt_cos_pi_2(opus_val16 x) | 142 | static OPUS_INLINE opus_val16 _celt_cos_pi_2(opus_val16 x) |
143 | { | 143 | { |
144 | opus_val16 x2; | 144 | opus_val16 x2; |
145 | 145 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/mathops.h b/lib/rbcodec/codecs/libopus/celt/mathops.h index 44fa97c697..a0525a9610 100644 --- a/lib/rbcodec/codecs/libopus/celt/mathops.h +++ b/lib/rbcodec/codecs/libopus/celt/mathops.h | |||
@@ -44,7 +44,7 @@ | |||
44 | unsigned isqrt32(opus_uint32 _val); | 44 | unsigned isqrt32(opus_uint32 _val); |
45 | 45 | ||
46 | #ifndef OVERRIDE_CELT_MAXABS16 | 46 | #ifndef OVERRIDE_CELT_MAXABS16 |
47 | static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) | 47 | static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len) |
48 | { | 48 | { |
49 | int i; | 49 | int i; |
50 | opus_val16 maxval = 0; | 50 | opus_val16 maxval = 0; |
@@ -60,7 +60,7 @@ static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) | |||
60 | 60 | ||
61 | #ifndef OVERRIDE_CELT_MAXABS32 | 61 | #ifndef OVERRIDE_CELT_MAXABS32 |
62 | #ifdef FIXED_POINT | 62 | #ifdef FIXED_POINT |
63 | static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) | 63 | static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len) |
64 | { | 64 | { |
65 | int i; | 65 | int i; |
66 | opus_val32 maxval = 0; | 66 | opus_val32 maxval = 0; |
@@ -95,7 +95,7 @@ static inline opus_val32 celt_maxabs32(const opus_val32 *x, int len) | |||
95 | denorm, +/- inf and NaN are *not* handled */ | 95 | denorm, +/- inf and NaN are *not* handled */ |
96 | 96 | ||
97 | /** Base-2 log approximation (log2(x)). */ | 97 | /** Base-2 log approximation (log2(x)). */ |
98 | static inline float celt_log2(float x) | 98 | static OPUS_INLINE float celt_log2(float x) |
99 | { | 99 | { |
100 | int integer; | 100 | int integer; |
101 | float frac; | 101 | float frac; |
@@ -113,7 +113,7 @@ static inline float celt_log2(float x) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /** Base-2 exponential approximation (2^x). */ | 115 | /** Base-2 exponential approximation (2^x). */ |
116 | static inline float celt_exp2(float x) | 116 | static OPUS_INLINE float celt_exp2(float x) |
117 | { | 117 | { |
118 | int integer; | 118 | int integer; |
119 | float frac; | 119 | float frac; |
@@ -145,7 +145,7 @@ static inline float celt_exp2(float x) | |||
145 | 145 | ||
146 | #ifndef OVERRIDE_CELT_ILOG2 | 146 | #ifndef OVERRIDE_CELT_ILOG2 |
147 | /** Integer log in base2. Undefined for zero and negative numbers */ | 147 | /** Integer log in base2. Undefined for zero and negative numbers */ |
148 | static inline opus_int16 celt_ilog2(opus_int32 x) | 148 | static OPUS_INLINE opus_int16 celt_ilog2(opus_int32 x) |
149 | { | 149 | { |
150 | celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); | 150 | celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); |
151 | return EC_ILOG(x)-1; | 151 | return EC_ILOG(x)-1; |
@@ -154,7 +154,7 @@ static inline opus_int16 celt_ilog2(opus_int32 x) | |||
154 | 154 | ||
155 | 155 | ||
156 | /** Integer log in base2. Defined for zero, but not for negative numbers */ | 156 | /** Integer log in base2. Defined for zero, but not for negative numbers */ |
157 | static inline opus_int16 celt_zlog2(opus_val32 x) | 157 | static OPUS_INLINE opus_int16 celt_zlog2(opus_val32 x) |
158 | { | 158 | { |
159 | return x <= 0 ? 0 : celt_ilog2(x); | 159 | return x <= 0 ? 0 : celt_ilog2(x); |
160 | } | 160 | } |
@@ -165,7 +165,8 @@ opus_val32 celt_sqrt(opus_val32 x); | |||
165 | 165 | ||
166 | opus_val16 celt_cos_norm(opus_val32 x); | 166 | opus_val16 celt_cos_norm(opus_val32 x); |
167 | 167 | ||
168 | static inline opus_val16 celt_log2(opus_val32 x) | 168 | /** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */ |
169 | static OPUS_INLINE opus_val16 celt_log2(opus_val32 x) | ||
169 | { | 170 | { |
170 | int i; | 171 | int i; |
171 | opus_val16 n, frac; | 172 | opus_val16 n, frac; |
@@ -191,14 +192,14 @@ static inline opus_val16 celt_log2(opus_val32 x) | |||
191 | #define D2 14819 | 192 | #define D2 14819 |
192 | #define D3 10204 | 193 | #define D3 10204 |
193 | 194 | ||
194 | static inline opus_val32 celt_exp2_frac(opus_val16 x) | 195 | static OPUS_INLINE opus_val32 celt_exp2_frac(opus_val16 x) |
195 | { | 196 | { |
196 | opus_val16 frac; | 197 | opus_val16 frac; |
197 | frac = SHL16(x, 4); | 198 | frac = SHL16(x, 4); |
198 | return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); | 199 | return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); |
199 | } | 200 | } |
200 | /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ | 201 | /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ |
201 | static inline opus_val32 celt_exp2(opus_val16 x) | 202 | static OPUS_INLINE opus_val32 celt_exp2(opus_val16 x) |
202 | { | 203 | { |
203 | int integer; | 204 | int integer; |
204 | opus_val16 frac; | 205 | opus_val16 frac; |
@@ -224,7 +225,7 @@ opus_val32 frac_div32(opus_val32 a, opus_val32 b); | |||
224 | 225 | ||
225 | /* Atan approximation using a 4th order polynomial. Input is in Q15 format | 226 | /* Atan approximation using a 4th order polynomial. Input is in Q15 format |
226 | and normalized by pi/4. Output is in Q15 format */ | 227 | and normalized by pi/4. Output is in Q15 format */ |
227 | static inline opus_val16 celt_atan01(opus_val16 x) | 228 | static OPUS_INLINE opus_val16 celt_atan01(opus_val16 x) |
228 | { | 229 | { |
229 | return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); | 230 | return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); |
230 | } | 231 | } |
@@ -235,7 +236,7 @@ static inline opus_val16 celt_atan01(opus_val16 x) | |||
235 | #undef M4 | 236 | #undef M4 |
236 | 237 | ||
237 | /* atan2() approximation valid for positive input values */ | 238 | /* atan2() approximation valid for positive input values */ |
238 | static inline opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) | 239 | static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x) |
239 | { | 240 | { |
240 | if (y < x) | 241 | if (y < x) |
241 | { | 242 | { |
diff --git a/lib/rbcodec/codecs/libopus/celt/os_support.h b/lib/rbcodec/codecs/libopus/celt/os_support.h index 2484f0b2f7..5e47e3cff9 100644 --- a/lib/rbcodec/codecs/libopus/celt/os_support.h +++ b/lib/rbcodec/codecs/libopus/celt/os_support.h | |||
@@ -35,13 +35,16 @@ | |||
35 | # include "custom_support.h" | 35 | # include "custom_support.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include "opus_types.h" | ||
39 | #include "opus_defines.h" | ||
40 | |||
38 | #include <string.h> | 41 | #include <string.h> |
39 | #include <stdio.h> | 42 | #include <stdio.h> |
40 | #include <stdlib.h> | 43 | #include <stdlib.h> |
41 | 44 | ||
42 | /** Opus wrapper for malloc(). To do your own dynamic allocation, all you need to do is replace this function and opus_free */ | 45 | /** Opus wrapper for malloc(). To do your own dynamic allocation, all you need to do is replace this function and opus_free */ |
43 | #ifndef OVERRIDE_OPUS_ALLOC | 46 | #ifndef OVERRIDE_OPUS_ALLOC |
44 | static inline void *opus_alloc (size_t size) | 47 | static OPUS_INLINE void *opus_alloc (size_t size) |
45 | { | 48 | { |
46 | return malloc(size); | 49 | return malloc(size); |
47 | } | 50 | } |
@@ -49,7 +52,7 @@ static inline void *opus_alloc (size_t size) | |||
49 | 52 | ||
50 | /** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */ | 53 | /** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */ |
51 | #ifndef OVERRIDE_OPUS_ALLOC_SCRATCH | 54 | #ifndef OVERRIDE_OPUS_ALLOC_SCRATCH |
52 | static inline void *opus_alloc_scratch (size_t size) | 55 | static OPUS_INLINE void *opus_alloc_scratch (size_t size) |
53 | { | 56 | { |
54 | /* Scratch space doesn't need to be cleared */ | 57 | /* Scratch space doesn't need to be cleared */ |
55 | return opus_alloc(size); | 58 | return opus_alloc(size); |
@@ -58,7 +61,7 @@ static inline void *opus_alloc_scratch (size_t size) | |||
58 | 61 | ||
59 | /** Opus wrapper for free(). To do your own dynamic allocation, all you need to do is replace this function and opus_alloc */ | 62 | /** Opus wrapper for free(). To do your own dynamic allocation, all you need to do is replace this function and opus_alloc */ |
60 | #ifndef OVERRIDE_OPUS_FREE | 63 | #ifndef OVERRIDE_OPUS_FREE |
61 | static inline void opus_free (void *ptr) | 64 | static OPUS_INLINE void opus_free (void *ptr) |
62 | { | 65 | { |
63 | free(ptr); | 66 | free(ptr); |
64 | } | 67 | } |
diff --git a/lib/rbcodec/codecs/libopus/celt/pitch.c b/lib/rbcodec/codecs/libopus/celt/pitch.c index 0d8be13025..c28857297a 100644 --- a/lib/rbcodec/codecs/libopus/celt/pitch.c +++ b/lib/rbcodec/codecs/libopus/celt/pitch.c | |||
@@ -145,7 +145,7 @@ static void celt_fir5(const opus_val16 *x, | |||
145 | 145 | ||
146 | 146 | ||
147 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, | 147 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, |
148 | int len, int C) | 148 | int len, int C, int arch) |
149 | { | 149 | { |
150 | int i; | 150 | int i; |
151 | opus_val32 ac[5]; | 151 | opus_val32 ac[5]; |
@@ -180,7 +180,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x | |||
180 | } | 180 | } |
181 | 181 | ||
182 | _celt_autocorr(x_lp, ac, NULL, 0, | 182 | _celt_autocorr(x_lp, ac, NULL, 0, |
183 | 4, len>>1); | 183 | 4, len>>1, arch); |
184 | 184 | ||
185 | /* Noise floor -40 dB */ | 185 | /* Noise floor -40 dB */ |
186 | #ifdef FIXED_POINT | 186 | #ifdef FIXED_POINT |
@@ -250,9 +250,14 @@ opus_val32 | |||
250 | #else | 250 | #else |
251 | void | 251 | void |
252 | #endif | 252 | #endif |
253 | celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch) | 253 | celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch) |
254 | { | 254 | { |
255 | int i,j; | 255 | int i,j; |
256 | /*The EDSP version requires that max_pitch is at least 1, and that _x is | ||
257 | 32-bit aligned. | ||
258 | Since it's hard to put asserts in assembly, put them here.*/ | ||
259 | celt_assert(max_pitch>0); | ||
260 | celt_assert((((unsigned char *)_x-(unsigned char *)NULL)&3)==0); | ||
256 | #ifdef FIXED_POINT | 261 | #ifdef FIXED_POINT |
257 | opus_val32 maxcorr=1; | 262 | opus_val32 maxcorr=1; |
258 | #endif | 263 | #endif |
@@ -289,7 +294,7 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, | |||
289 | 294 | ||
290 | #endif | 295 | #endif |
291 | void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y, | 296 | void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y, |
292 | int len, int max_pitch, int *pitch) | 297 | int len, int max_pitch, int *pitch, int arch) |
293 | { | 298 | { |
294 | int i, j; | 299 | int i, j; |
295 | int lag; | 300 | int lag; |
@@ -342,7 +347,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR | |||
342 | #ifdef FIXED_POINT | 347 | #ifdef FIXED_POINT |
343 | maxcorr = | 348 | maxcorr = |
344 | #endif | 349 | #endif |
345 | celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2); | 350 | celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2, arch); |
346 | 351 | ||
347 | find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch | 352 | find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch |
348 | #ifdef FIXED_POINT | 353 | #ifdef FIXED_POINT |
diff --git a/lib/rbcodec/codecs/libopus/celt/pitch.h b/lib/rbcodec/codecs/libopus/celt/pitch.h index caffd24bc4..df317ecc1d 100644 --- a/lib/rbcodec/codecs/libopus/celt/pitch.h +++ b/lib/rbcodec/codecs/libopus/celt/pitch.h | |||
@@ -35,16 +35,21 @@ | |||
35 | #define PITCH_H | 35 | #define PITCH_H |
36 | 36 | ||
37 | #include "modes.h" | 37 | #include "modes.h" |
38 | #include "cpu_support.h" | ||
38 | 39 | ||
39 | #if defined(__SSE__) && !defined(FIXED_POINT) | 40 | #if defined(__SSE__) && !defined(FIXED_POINT) |
40 | #include "x86/pitch_sse.h" | 41 | #include "x86/pitch_sse.h" |
41 | #endif | 42 | #endif |
42 | 43 | ||
44 | #if defined(OPUS_ARM_ASM) && defined(FIXED_POINT) | ||
45 | # include "arm/pitch_arm.h" | ||
46 | #endif | ||
47 | |||
43 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, | 48 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, |
44 | int len, int C); | 49 | int len, int C, int arch); |
45 | 50 | ||
46 | void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y, | 51 | void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y, |
47 | int len, int max_pitch, int *pitch); | 52 | int len, int max_pitch, int *pitch, int arch); |
48 | 53 | ||
49 | opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, | 54 | opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, |
50 | int N, int *T0, int prev_period, opus_val16 prev_gain); | 55 | int N, int *T0, int prev_period, opus_val16 prev_gain); |
@@ -52,10 +57,11 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, | |||
52 | /* OPT: This is the kernel you really want to optimize. It gets used a lot | 57 | /* OPT: This is the kernel you really want to optimize. It gets used a lot |
53 | by the prefilter and by the PLC. */ | 58 | by the prefilter and by the PLC. */ |
54 | #ifndef OVERRIDE_XCORR_KERNEL | 59 | #ifndef OVERRIDE_XCORR_KERNEL |
55 | static inline void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) | 60 | static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) |
56 | { | 61 | { |
57 | int j; | 62 | int j; |
58 | opus_val16 y_0, y_1, y_2, y_3; | 63 | opus_val16 y_0, y_1, y_2, y_3; |
64 | celt_assert(len>=3); | ||
59 | y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */ | 65 | y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */ |
60 | y_0=*y++; | 66 | y_0=*y++; |
61 | y_1=*y++; | 67 | y_1=*y++; |
@@ -119,7 +125,7 @@ static inline void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus | |||
119 | #endif /* OVERRIDE_XCORR_KERNEL */ | 125 | #endif /* OVERRIDE_XCORR_KERNEL */ |
120 | 126 | ||
121 | #ifndef OVERRIDE_DUAL_INNER_PROD | 127 | #ifndef OVERRIDE_DUAL_INNER_PROD |
122 | static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, | 128 | static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, |
123 | int N, opus_val32 *xy1, opus_val32 *xy2) | 129 | int N, opus_val32 *xy1, opus_val32 *xy2) |
124 | { | 130 | { |
125 | int i; | 131 | int i; |
@@ -140,6 +146,28 @@ opus_val32 | |||
140 | #else | 146 | #else |
141 | void | 147 | void |
142 | #endif | 148 | #endif |
143 | celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch); | 149 | celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, |
150 | opus_val32 *xcorr, int len, int max_pitch); | ||
151 | |||
152 | #if !defined(OVERRIDE_PITCH_XCORR) | ||
153 | /*Is run-time CPU detection enabled on this platform?*/ | ||
154 | # if defined(OPUS_HAVE_RTCD) | ||
155 | extern | ||
156 | # if defined(FIXED_POINT) | ||
157 | opus_val32 | ||
158 | # else | ||
159 | void | ||
160 | # endif | ||
161 | (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, | ||
162 | const opus_val16 *, opus_val32 *, int, int); | ||
163 | |||
164 | # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ | ||
165 | ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \ | ||
166 | xcorr, len, max_pitch)) | ||
167 | # else | ||
168 | # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ | ||
169 | ((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch)) | ||
170 | # endif | ||
171 | #endif | ||
144 | 172 | ||
145 | #endif | 173 | #endif |
diff --git a/lib/rbcodec/codecs/libopus/celt/quant_bands.c b/lib/rbcodec/codecs/libopus/celt/quant_bands.c index 79685e17cb..ac6952c266 100644 --- a/lib/rbcodec/codecs/libopus/celt/quant_bands.c +++ b/lib/rbcodec/codecs/libopus/celt/quant_bands.c | |||
@@ -312,6 +312,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, | |||
312 | opus_int32 tell_intra; | 312 | opus_int32 tell_intra; |
313 | opus_uint32 nstart_bytes; | 313 | opus_uint32 nstart_bytes; |
314 | opus_uint32 nintra_bytes; | 314 | opus_uint32 nintra_bytes; |
315 | opus_uint32 save_bytes; | ||
315 | int badness2; | 316 | int badness2; |
316 | VARDECL(unsigned char, intra_bits); | 317 | VARDECL(unsigned char, intra_bits); |
317 | 318 | ||
@@ -322,7 +323,10 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, | |||
322 | nstart_bytes = ec_range_bytes(&enc_start_state); | 323 | nstart_bytes = ec_range_bytes(&enc_start_state); |
323 | nintra_bytes = ec_range_bytes(&enc_intra_state); | 324 | nintra_bytes = ec_range_bytes(&enc_intra_state); |
324 | intra_buf = ec_get_buffer(&enc_intra_state) + nstart_bytes; | 325 | intra_buf = ec_get_buffer(&enc_intra_state) + nstart_bytes; |
325 | ALLOC(intra_bits, nintra_bytes-nstart_bytes, unsigned char); | 326 | save_bytes = nintra_bytes-nstart_bytes; |
327 | if (save_bytes == 0) | ||
328 | save_bytes = ALLOC_NONE; | ||
329 | ALLOC(intra_bits, save_bytes, unsigned char); | ||
326 | /* Copy bits from intra bit-stream */ | 330 | /* Copy bits from intra bit-stream */ |
327 | OPUS_COPY(intra_bits, intra_buf, nintra_bytes - nstart_bytes); | 331 | OPUS_COPY(intra_bits, intra_buf, nintra_bytes - nstart_bytes); |
328 | 332 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/rate.c b/lib/rbcodec/codecs/libopus/celt/rate.c index e474cf5004..e13d839d63 100644 --- a/lib/rbcodec/codecs/libopus/celt/rate.c +++ b/lib/rbcodec/codecs/libopus/celt/rate.c | |||
@@ -245,7 +245,7 @@ void compute_pulse_cache(CELTMode *m, int LM) | |||
245 | 245 | ||
246 | #define ALLOC_STEPS 6 | 246 | #define ALLOC_STEPS 6 |
247 | 247 | ||
248 | static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, | 248 | static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, |
249 | const int *bits1, const int *bits2, const int *thresh, const int *cap, opus_int32 total, opus_int32 *_balance, | 249 | const int *bits1, const int *bits2, const int *thresh, const int *cap, opus_int32 total, opus_int32 *_balance, |
250 | int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits, | 250 | int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits, |
251 | int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth) | 251 | int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth) |
diff --git a/lib/rbcodec/codecs/libopus/celt/rate.h b/lib/rbcodec/codecs/libopus/celt/rate.h index 263fde9820..f1e0661129 100644 --- a/lib/rbcodec/codecs/libopus/celt/rate.h +++ b/lib/rbcodec/codecs/libopus/celt/rate.h | |||
@@ -45,12 +45,12 @@ | |||
45 | 45 | ||
46 | void compute_pulse_cache(CELTMode *m, int LM); | 46 | void compute_pulse_cache(CELTMode *m, int LM); |
47 | 47 | ||
48 | static inline int get_pulses(int i) | 48 | static OPUS_INLINE int get_pulses(int i) |
49 | { | 49 | { |
50 | return i<8 ? i : (8 + (i&7)) << ((i>>3)-1); | 50 | return i<8 ? i : (8 + (i&7)) << ((i>>3)-1); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline int bits2pulses(const CELTMode *m, int band, int LM, int bits) | 53 | static OPUS_INLINE int bits2pulses(const CELTMode *m, int band, int LM, int bits) |
54 | { | 54 | { |
55 | int i; | 55 | int i; |
56 | int lo, hi; | 56 | int lo, hi; |
@@ -77,7 +77,7 @@ static inline int bits2pulses(const CELTMode *m, int band, int LM, int bits) | |||
77 | return hi; | 77 | return hi; |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses) | 80 | static OPUS_INLINE int pulses2bits(const CELTMode *m, int band, int LM, int pulses) |
81 | { | 81 | { |
82 | const unsigned char *cache; | 82 | const unsigned char *cache; |
83 | 83 | ||
diff --git a/lib/rbcodec/codecs/libopus/celt/stack_alloc.h b/lib/rbcodec/codecs/libopus/celt/stack_alloc.h index 1c093a8cdc..316a6ce12c 100644 --- a/lib/rbcodec/codecs/libopus/celt/stack_alloc.h +++ b/lib/rbcodec/codecs/libopus/celt/stack_alloc.h | |||
@@ -32,6 +32,9 @@ | |||
32 | #ifndef STACK_ALLOC_H | 32 | #ifndef STACK_ALLOC_H |
33 | #define STACK_ALLOC_H | 33 | #define STACK_ALLOC_H |
34 | 34 | ||
35 | #include "opus_types.h" | ||
36 | #include "opus_defines.h" | ||
37 | |||
35 | #if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK)) | 38 | #if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK)) |
36 | #error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode." | 39 | #error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode." |
37 | #endif | 40 | #endif |
@@ -92,6 +95,8 @@ | |||
92 | #define SAVE_STACK | 95 | #define SAVE_STACK |
93 | #define RESTORE_STACK | 96 | #define RESTORE_STACK |
94 | #define ALLOC_STACK | 97 | #define ALLOC_STACK |
98 | /* C99 does not allow VLAs of size zero */ | ||
99 | #define ALLOC_NONE 1 | ||
95 | 100 | ||
96 | #elif defined(USE_ALLOCA) | 101 | #elif defined(USE_ALLOCA) |
97 | 102 | ||
@@ -106,6 +111,7 @@ | |||
106 | #define SAVE_STACK | 111 | #define SAVE_STACK |
107 | #define RESTORE_STACK | 112 | #define RESTORE_STACK |
108 | #define ALLOC_STACK | 113 | #define ALLOC_STACK |
114 | #define ALLOC_NONE 0 | ||
109 | 115 | ||
110 | #else | 116 | #else |
111 | 117 | ||
@@ -143,6 +149,7 @@ extern char *global_stack_top; | |||
143 | #define VARDECL(type, var) type *var | 149 | #define VARDECL(type, var) type *var |
144 | #define ALLOC(var, size, type) var = PUSH(global_stack, size, type) | 150 | #define ALLOC(var, size, type) var = PUSH(global_stack, size, type) |
145 | #define SAVE_STACK char *_saved_stack = global_stack; | 151 | #define SAVE_STACK char *_saved_stack = global_stack; |
152 | #define ALLOC_NONE 0 | ||
146 | 153 | ||
147 | #endif /* VAR_ARRAYS */ | 154 | #endif /* VAR_ARRAYS */ |
148 | 155 | ||
@@ -159,7 +166,7 @@ extern char *global_stack_top; | |||
159 | 166 | ||
160 | #else | 167 | #else |
161 | 168 | ||
162 | static inline int _opus_false(void) {return 0;} | 169 | static OPUS_INLINE int _opus_false(void) {return 0;} |
163 | #define OPUS_CHECK_ARRAY(ptr, len) _opus_false() | 170 | #define OPUS_CHECK_ARRAY(ptr, len) _opus_false() |
164 | #define OPUS_CHECK_VALUE(value) _opus_false() | 171 | #define OPUS_CHECK_VALUE(value) _opus_false() |
165 | #define OPUS_PRINT_INT(value) do{}while(0) | 172 | #define OPUS_PRINT_INT(value) do{}while(0) |
diff --git a/lib/rbcodec/codecs/libopus/config.h b/lib/rbcodec/codecs/libopus/config.h index e2d9b1e9aa..1ce75ff590 100644 --- a/lib/rbcodec/codecs/libopus/config.h +++ b/lib/rbcodec/codecs/libopus/config.h | |||
@@ -41,14 +41,14 @@ | |||
41 | 41 | ||
42 | #if defined(CPU_ARM) | 42 | #if defined(CPU_ARM) |
43 | #if ARM_ARCH == 4 | 43 | #if ARM_ARCH == 4 |
44 | #define ARMv4_ASM | 44 | #define OPUS_ARM_INLINE_ASM |
45 | #elif ARM_ARCH > 4 | 45 | #elif ARM_ARCH > 4 |
46 | #define ARMv5E_ASM | 46 | #define OPUS_ARM_INLINE_EDSP |
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #if defined(CPU_COLDFIRE) | 50 | #if defined(CPU_COLDFIRE) |
51 | #define CF_ASM | 51 | #define OPUS_CF_INLINE_ASM |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #endif /* CONFIG_H */ | 54 | #endif /* CONFIG_H */ |
diff --git a/lib/rbcodec/codecs/libopus/opus.c b/lib/rbcodec/codecs/libopus/opus.c new file mode 100644 index 0000000000..989c6537cb --- /dev/null +++ b/lib/rbcodec/codecs/libopus/opus.c | |||
@@ -0,0 +1,333 @@ | |||
1 | /* Copyright (c) 2011 Xiph.Org Foundation, Skype Limited | ||
2 | Written by Jean-Marc Valin and Koen Vos */ | ||
3 | /* | ||
4 | Redistribution and use in source and binary forms, with or without | ||
5 | modification, are permitted provided that the following conditions | ||
6 | are met: | ||
7 | |||
8 | - Redistributions of source code must retain the above copyright | ||
9 | notice, this list of conditions and the following disclaimer. | ||
10 | |||
11 | - Redistributions in binary form must reproduce the above copyright | ||
12 | notice, this list of conditions and the following disclaimer in the | ||
13 | documentation and/or other materials provided with the distribution. | ||
14 | |||
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | ||
19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | #ifdef HAVE_CONFIG_H | ||
29 | #include "config.h" | ||
30 | #endif | ||
31 | |||
32 | #include "opus.h" | ||
33 | #include "opus_private.h" | ||
34 | |||
35 | #ifndef DISABLE_FLOAT_API | ||
36 | OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem) | ||
37 | { | ||
38 | int c; | ||
39 | int i; | ||
40 | float *x; | ||
41 | |||
42 | if (C<1 || N<1 || !_x || !declip_mem) return; | ||
43 | |||
44 | /* First thing: saturate everything to +/- 2 which is the highest level our | ||
45 | non-linearity can handle. At the point where the signal reaches +/-2, | ||
46 | the derivative will be zero anyway, so this doesn't introduce any | ||
47 | discontinuity in the derivative. */ | ||
48 | for (i=0;i<N*C;i++) | ||
49 | _x[i] = MAX16(-2.f, MIN16(2.f, _x[i])); | ||
50 | for (c=0;c<C;c++) | ||
51 | { | ||
52 | float a; | ||
53 | float x0; | ||
54 | int curr; | ||
55 | |||
56 | x = _x+c; | ||
57 | a = declip_mem[c]; | ||
58 | /* Continue applying the non-linearity from the previous frame to avoid | ||
59 | any discontinuity. */ | ||
60 | for (i=0;i<N;i++) | ||
61 | { | ||
62 | if (x[i*C]*a>=0) | ||
63 | break; | ||
64 | x[i*C] = x[i*C]+a*x[i*C]*x[i*C]; | ||
65 | } | ||
66 | |||
67 | curr=0; | ||
68 | x0 = x[0]; | ||
69 | while(1) | ||
70 | { | ||
71 | int start, end; | ||
72 | float maxval; | ||
73 | int special=0; | ||
74 | int peak_pos; | ||
75 | for (i=curr;i<N;i++) | ||
76 | { | ||
77 | if (x[i*C]>1 || x[i*C]<-1) | ||
78 | break; | ||
79 | } | ||
80 | if (i==N) | ||
81 | { | ||
82 | a=0; | ||
83 | break; | ||
84 | } | ||
85 | peak_pos = i; | ||
86 | start=end=i; | ||
87 | maxval=ABS16(x[i*C]); | ||
88 | /* Look for first zero crossing before clipping */ | ||
89 | while (start>0 && x[i*C]*x[(start-1)*C]>=0) | ||
90 | start--; | ||
91 | /* Look for first zero crossing after clipping */ | ||
92 | while (end<N && x[i*C]*x[end*C]>=0) | ||
93 | { | ||
94 | /* Look for other peaks until the next zero-crossing. */ | ||
95 | if (ABS16(x[end*C])>maxval) | ||
96 | { | ||
97 | maxval = ABS16(x[end*C]); | ||
98 | peak_pos = end; | ||
99 | } | ||
100 | end++; | ||
101 | } | ||
102 | /* Detect the special case where we clip before the first zero crossing */ | ||
103 | special = (start==0 && x[i*C]*x[0]>=0); | ||
104 | |||
105 | /* Compute a such that maxval + a*maxval^2 = 1 */ | ||
106 | a=(maxval-1)/(maxval*maxval); | ||
107 | if (x[i*C]>0) | ||
108 | a = -a; | ||
109 | /* Apply soft clipping */ | ||
110 | for (i=start;i<end;i++) | ||
111 | x[i*C] = x[i*C]+a*x[i*C]*x[i*C]; | ||
112 | |||
113 | if (special && peak_pos>=2) | ||
114 | { | ||
115 | /* Add a linear ramp from the first sample to the signal peak. | ||
116 | This avoids a discontinuity at the beginning of the frame. */ | ||
117 | float delta; | ||
118 | float offset = x0-x[0]; | ||
119 | delta = offset / peak_pos; | ||
120 | for (i=curr;i<peak_pos;i++) | ||
121 | { | ||
122 | offset -= delta; | ||
123 | x[i*C] += offset; | ||
124 | x[i*C] = MAX16(-1.f, MIN16(1.f, x[i*C])); | ||
125 | } | ||
126 | } | ||
127 | curr = end; | ||
128 | if (curr==N) | ||
129 | break; | ||
130 | } | ||
131 | declip_mem[c] = a; | ||
132 | } | ||
133 | } | ||
134 | #endif | ||
135 | |||
136 | #if 0 | ||
137 | int encode_size(int size, unsigned char *data) | ||
138 | { | ||
139 | if (size < 252) | ||
140 | { | ||
141 | data[0] = size; | ||
142 | return 1; | ||
143 | } else { | ||
144 | data[0] = 252+(size&0x3); | ||
145 | data[1] = (size-(int)data[0])>>2; | ||
146 | return 2; | ||
147 | } | ||
148 | } | ||
149 | #endif | ||
150 | |||
151 | static int parse_size(const unsigned char *data, opus_int32 len, opus_int16 *size) | ||
152 | { | ||
153 | if (len<1) | ||
154 | { | ||
155 | *size = -1; | ||
156 | return -1; | ||
157 | } else if (data[0]<252) | ||
158 | { | ||
159 | *size = data[0]; | ||
160 | return 1; | ||
161 | } else if (len<2) | ||
162 | { | ||
163 | *size = -1; | ||
164 | return -1; | ||
165 | } else { | ||
166 | *size = 4*data[1] + data[0]; | ||
167 | return 2; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, | ||
172 | int self_delimited, unsigned char *out_toc, | ||
173 | const unsigned char *frames[48], opus_int16 size[48], | ||
174 | int *payload_offset, opus_int32 *packet_offset) | ||
175 | { | ||
176 | int i, bytes; | ||
177 | int count; | ||
178 | int cbr; | ||
179 | unsigned char ch, toc; | ||
180 | int framesize; | ||
181 | opus_int32 last_size; | ||
182 | opus_int32 pad = 0; | ||
183 | const unsigned char *data0 = data; | ||
184 | |||
185 | if (size==NULL) | ||
186 | return OPUS_BAD_ARG; | ||
187 | |||
188 | framesize = opus_packet_get_samples_per_frame(data, 48000); | ||
189 | |||
190 | cbr = 0; | ||
191 | toc = *data++; | ||
192 | len--; | ||
193 | last_size = len; | ||
194 | switch (toc&0x3) | ||
195 | { | ||
196 | /* One frame */ | ||
197 | case 0: | ||
198 | count=1; | ||
199 | break; | ||
200 | /* Two CBR frames */ | ||
201 | case 1: | ||
202 | count=2; | ||
203 | cbr = 1; | ||
204 | if (!self_delimited) | ||
205 | { | ||
206 | if (len&0x1) | ||
207 | return OPUS_INVALID_PACKET; | ||
208 | last_size = len/2; | ||
209 | /* If last_size doesn't fit in size[0], we'll catch it later */ | ||
210 | size[0] = (opus_int16)last_size; | ||
211 | } | ||
212 | break; | ||
213 | /* Two VBR frames */ | ||
214 | case 2: | ||
215 | count = 2; | ||
216 | bytes = parse_size(data, len, size); | ||
217 | len -= bytes; | ||
218 | if (size[0]<0 || size[0] > len) | ||
219 | return OPUS_INVALID_PACKET; | ||
220 | data += bytes; | ||
221 | last_size = len-size[0]; | ||
222 | break; | ||
223 | /* Multiple CBR/VBR frames (from 0 to 120 ms) */ | ||
224 | default: /*case 3:*/ | ||
225 | if (len<1) | ||
226 | return OPUS_INVALID_PACKET; | ||
227 | /* Number of frames encoded in bits 0 to 5 */ | ||
228 | ch = *data++; | ||
229 | count = ch&0x3F; | ||
230 | if (count <= 0 || framesize*count > 5760) | ||
231 | return OPUS_INVALID_PACKET; | ||
232 | len--; | ||
233 | /* Padding flag is bit 6 */ | ||
234 | if (ch&0x40) | ||
235 | { | ||
236 | int p; | ||
237 | do { | ||
238 | int tmp; | ||
239 | if (len<=0) | ||
240 | return OPUS_INVALID_PACKET; | ||
241 | p = *data++; | ||
242 | len--; | ||
243 | tmp = p==255 ? 254: p; | ||
244 | len -= tmp; | ||
245 | pad += tmp; | ||
246 | } while (p==255); | ||
247 | } | ||
248 | if (len<0) | ||
249 | return OPUS_INVALID_PACKET; | ||
250 | /* VBR flag is bit 7 */ | ||
251 | cbr = !(ch&0x80); | ||
252 | if (!cbr) | ||
253 | { | ||
254 | /* VBR case */ | ||
255 | last_size = len; | ||
256 | for (i=0;i<count-1;i++) | ||
257 | { | ||
258 | bytes = parse_size(data, len, size+i); | ||
259 | len -= bytes; | ||
260 | if (size[i]<0 || size[i] > len) | ||
261 | return OPUS_INVALID_PACKET; | ||
262 | data += bytes; | ||
263 | last_size -= bytes+size[i]; | ||
264 | } | ||
265 | if (last_size<0) | ||
266 | return OPUS_INVALID_PACKET; | ||
267 | } else if (!self_delimited) | ||
268 | { | ||
269 | /* CBR case */ | ||
270 | last_size = len/count; | ||
271 | if (last_size*count!=len) | ||
272 | return OPUS_INVALID_PACKET; | ||
273 | for (i=0;i<count-1;i++) | ||
274 | size[i] = (opus_int16)last_size; | ||
275 | } | ||
276 | break; | ||
277 | } | ||
278 | /* Self-delimited framing has an extra size for the last frame. */ | ||
279 | if (self_delimited) | ||
280 | { | ||
281 | bytes = parse_size(data, len, size+count-1); | ||
282 | len -= bytes; | ||
283 | if (size[count-1]<0 || size[count-1] > len) | ||
284 | return OPUS_INVALID_PACKET; | ||
285 | data += bytes; | ||
286 | /* For CBR packets, apply the size to all the frames. */ | ||
287 | if (cbr) | ||
288 | { | ||
289 | if (size[count-1]*count > len) | ||
290 | return OPUS_INVALID_PACKET; | ||
291 | for (i=0;i<count-1;i++) | ||
292 | size[i] = size[count-1]; | ||
293 | } else if (bytes+size[count-1] > last_size) | ||
294 | return OPUS_INVALID_PACKET; | ||
295 | } else | ||
296 | { | ||
297 | /* Because it's not encoded explicitly, it's possible the size of the | ||
298 | last packet (or all the packets, for the CBR case) is larger than | ||
299 | 1275. Reject them here.*/ | ||
300 | if (last_size > 1275) | ||
301 | return OPUS_INVALID_PACKET; | ||
302 | size[count-1] = (opus_int16)last_size; | ||
303 | } | ||
304 | |||
305 | if (payload_offset) | ||
306 | *payload_offset = (int)(data-data0); | ||
307 | |||
308 | for (i=0;i<count;i++) | ||
309 | { | ||
310 | if (frames) | ||
311 | frames[i] = data; | ||
312 | data += size[i]; | ||
313 | } | ||
314 | |||
315 | if (packet_offset) | ||
316 | *packet_offset = pad+(opus_int32)(data-data0); | ||
317 | |||
318 | if (out_toc) | ||
319 | *out_toc = toc; | ||
320 | |||
321 | return count; | ||
322 | } | ||
323 | |||
324 | #if 0 | ||
325 | int opus_packet_parse(const unsigned char *data, opus_int32 len, | ||
326 | unsigned char *out_toc, const unsigned char *frames[48], | ||
327 | opus_int16 size[48], int *payload_offset) | ||
328 | { | ||
329 | return opus_packet_parse_impl(data, len, 0, out_toc, | ||
330 | frames, size, payload_offset, NULL); | ||
331 | } | ||
332 | #endif | ||
333 | |||
diff --git a/lib/rbcodec/codecs/libopus/opus.h b/lib/rbcodec/codecs/libopus/opus.h index 38817b405a..93a53a2ffc 100644 --- a/lib/rbcodec/codecs/libopus/opus.h +++ b/lib/rbcodec/codecs/libopus/opus.h | |||
@@ -911,6 +911,64 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepa | |||
911 | */ | 911 | */ |
912 | OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1); | 912 | OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1); |
913 | 913 | ||
914 | /** Pads a given Opus packet to a larger size (possibly changing the TOC sequence). | ||
915 | * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the | ||
916 | * packet to pad. | ||
917 | * @param len <tt>opus_int32</tt>: The size of the packet. | ||
918 | * This must be at least 1. | ||
919 | * @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding. | ||
920 | * This must be at least as large as len. | ||
921 | * @returns an error code | ||
922 | * @retval #OPUS_OK \a on success. | ||
923 | * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len. | ||
924 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. | ||
925 | */ | ||
926 | OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len); | ||
927 | |||
928 | /** Remove all padding from a given Opus packet and rewrite the TOC sequence to | ||
929 | * minimize space usage. | ||
930 | * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the | ||
931 | * packet to strip. | ||
932 | * @param len <tt>opus_int32</tt>: The size of the packet. | ||
933 | * This must be at least 1. | ||
934 | * @returns The new size of the output packet on success, or an error code | ||
935 | * on failure. | ||
936 | * @retval #OPUS_BAD_ARG \a len was less than 1. | ||
937 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. | ||
938 | */ | ||
939 | OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len); | ||
940 | |||
941 | /** Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence). | ||
942 | * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the | ||
943 | * packet to pad. | ||
944 | * @param len <tt>opus_int32</tt>: The size of the packet. | ||
945 | * This must be at least 1. | ||
946 | * @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding. | ||
947 | * This must be at least 1. | ||
948 | * @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet. | ||
949 | * This must be at least as large as len. | ||
950 | * @returns an error code | ||
951 | * @retval #OPUS_OK \a on success. | ||
952 | * @retval #OPUS_BAD_ARG \a len was less than 1. | ||
953 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. | ||
954 | */ | ||
955 | OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams); | ||
956 | |||
957 | /** Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to | ||
958 | * minimize space usage. | ||
959 | * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the | ||
960 | * packet to strip. | ||
961 | * @param len <tt>opus_int32</tt>: The size of the packet. | ||
962 | * This must be at least 1. | ||
963 | * @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet. | ||
964 | * This must be at least 1. | ||
965 | * @returns The new size of the output packet on success, or an error code | ||
966 | * on failure. | ||
967 | * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len. | ||
968 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. | ||
969 | */ | ||
970 | OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, int nb_streams); | ||
971 | |||
914 | /**@}*/ | 972 | /**@}*/ |
915 | 973 | ||
916 | #ifdef __cplusplus | 974 | #ifdef __cplusplus |
diff --git a/lib/rbcodec/codecs/libopus/opus_custom.h b/lib/rbcodec/codecs/libopus/opus_custom.h index 6cf3963076..41f36bf2fb 100644 --- a/lib/rbcodec/codecs/libopus/opus_custom.h +++ b/lib/rbcodec/codecs/libopus/opus_custom.h | |||
@@ -47,7 +47,7 @@ extern "C" { | |||
47 | #else | 47 | #else |
48 | # define OPUS_CUSTOM_EXPORT | 48 | # define OPUS_CUSTOM_EXPORT |
49 | # ifdef OPUS_BUILD | 49 | # ifdef OPUS_BUILD |
50 | # define OPUS_CUSTOM_EXPORT_STATIC static inline | 50 | # define OPUS_CUSTOM_EXPORT_STATIC static OPUS_INLINE |
51 | # else | 51 | # else |
52 | # define OPUS_CUSTOM_EXPORT_STATIC | 52 | # define OPUS_CUSTOM_EXPORT_STATIC |
53 | # endif | 53 | # endif |
@@ -140,6 +140,7 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si | |||
140 | int channels | 140 | int channels |
141 | ) OPUS_ARG_NONNULL(1); | 141 | ) OPUS_ARG_NONNULL(1); |
142 | 142 | ||
143 | # ifdef CUSTOM_MODES | ||
143 | /** Initializes a previously allocated encoder state | 144 | /** Initializes a previously allocated encoder state |
144 | * The memory pointed to by st must be the size returned by opus_custom_encoder_get_size. | 145 | * The memory pointed to by st must be the size returned by opus_custom_encoder_get_size. |
145 | * This is intended for applications which use their own allocator instead of malloc. | 146 | * This is intended for applications which use their own allocator instead of malloc. |
@@ -152,12 +153,12 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si | |||
152 | * @param [in] channels <tt>int</tt>: Number of channels | 153 | * @param [in] channels <tt>int</tt>: Number of channels |
153 | * @return OPUS_OK Success or @ref opus_errorcodes | 154 | * @return OPUS_OK Success or @ref opus_errorcodes |
154 | */ | 155 | */ |
155 | OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init( | 156 | OPUS_CUSTOM_EXPORT int opus_custom_encoder_init( |
156 | OpusCustomEncoder *st, | 157 | OpusCustomEncoder *st, |
157 | const OpusCustomMode *mode, | 158 | const OpusCustomMode *mode, |
158 | int channels | 159 | int channels |
159 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); | 160 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); |
160 | 161 | # endif | |
161 | #endif | 162 | #endif |
162 | 163 | ||
163 | 164 | ||
diff --git a/lib/rbcodec/codecs/libopus/opus_decoder.c b/lib/rbcodec/codecs/libopus/opus_decoder.c index b430a4df07..198d168898 100644 --- a/lib/rbcodec/codecs/libopus/opus_decoder.c +++ b/lib/rbcodec/codecs/libopus/opus_decoder.c | |||
@@ -26,11 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifdef HAVE_CONFIG_H | 28 | #ifdef HAVE_CONFIG_H |
29 | #include "config.h" | 29 | # include "config.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifndef OPUS_BUILD | 32 | #ifndef OPUS_BUILD |
33 | #error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details." | 33 | # error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details." |
34 | #endif | ||
35 | |||
36 | #if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__OPTIMIZE__) | ||
37 | # pragma message "You appear to be compiling without optimization, if so opus will be very slow." | ||
34 | #endif | 38 | #endif |
35 | 39 | ||
36 | #include <stdarg.h> | 40 | #include <stdarg.h> |
@@ -71,11 +75,10 @@ struct OpusDecoder { | |||
71 | #endif | 75 | #endif |
72 | 76 | ||
73 | opus_uint32 rangeFinal; | 77 | opus_uint32 rangeFinal; |
74 | int arch; | ||
75 | }; | 78 | }; |
76 | 79 | ||
77 | #ifdef FIXED_POINT | 80 | #ifdef FIXED_POINT |
78 | static inline opus_int16 SAT16(opus_int32 x) { | 81 | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { |
79 | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 82 | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; |
80 | } | 83 | } |
81 | #endif | 84 | #endif |
@@ -121,7 +124,6 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels) | |||
121 | st->Fs = Fs; | 124 | st->Fs = Fs; |
122 | st->DecControl.API_sampleRate = st->Fs; | 125 | st->DecControl.API_sampleRate = st->Fs; |
123 | st->DecControl.nChannelsAPI = st->channels; | 126 | st->DecControl.nChannelsAPI = st->channels; |
124 | st->arch = opus_select_arch(); | ||
125 | 127 | ||
126 | /* Reset decoder */ | 128 | /* Reset decoder */ |
127 | ret = silk_InitDecoder( silk_dec ); | 129 | ret = silk_InitDecoder( silk_dec ); |
@@ -152,7 +154,6 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error) | |||
152 | *error = OPUS_BAD_ARG; | 154 | *error = OPUS_BAD_ARG; |
153 | return NULL; | 155 | return NULL; |
154 | } | 156 | } |
155 | |||
156 | if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels)) | 157 | if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels)) |
157 | st = (OpusDecoder *)s_dec; | 158 | st = (OpusDecoder *)s_dec; |
158 | else | 159 | else |
@@ -265,26 +266,44 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
265 | ec_dec_init(&dec,(unsigned char*)data,len); | 266 | ec_dec_init(&dec,(unsigned char*)data,len); |
266 | } else { | 267 | } else { |
267 | audiosize = frame_size; | 268 | audiosize = frame_size; |
269 | mode = st->prev_mode; | ||
268 | 270 | ||
269 | if (st->prev_mode == 0) | 271 | if (mode == 0) |
270 | { | 272 | { |
271 | /* If we haven't got any packet yet, all we can do is return zeros */ | 273 | /* If we haven't got any packet yet, all we can do is return zeros */ |
272 | for (i=0;i<audiosize*st->channels;i++) | 274 | for (i=0;i<audiosize*st->channels;i++) |
273 | pcm[i] = 0; | 275 | pcm[i] = 0; |
274 | RESTORE_STACK; | 276 | RESTORE_STACK; |
275 | return audiosize; | 277 | return audiosize; |
276 | } else { | ||
277 | mode = st->prev_mode; | ||
278 | } | 278 | } |
279 | } | ||
280 | 279 | ||
281 | /* For CELT/hybrid PLC of more than 20 ms, opus_decode_native() will do | 280 | /* Avoids trying to run the PLC on sizes other than 2.5 (CELT), 5 (CELT), |
282 | multiple calls */ | 281 | 10, or 20 (e.g. 12.5 or 30 ms). */ |
283 | if (data==NULL && mode != MODE_SILK_ONLY) | 282 | if (audiosize > F20) |
284 | frame_size = IMIN(frame_size, F20); | 283 | { |
284 | do { | ||
285 | int ret = opus_decode_frame(st, NULL, 0, pcm, IMIN(audiosize, F20), 0); | ||
286 | if (ret<0) | ||
287 | { | ||
288 | RESTORE_STACK; | ||
289 | return ret; | ||
290 | } | ||
291 | pcm += ret*st->channels; | ||
292 | audiosize -= ret; | ||
293 | } while (audiosize > 0); | ||
294 | RESTORE_STACK; | ||
295 | return frame_size; | ||
296 | } else if (audiosize < F20) | ||
297 | { | ||
298 | if (audiosize > F10) | ||
299 | audiosize = F10; | ||
300 | else if (mode != MODE_SILK_ONLY && audiosize > F5 && audiosize < F10) | ||
301 | audiosize = F5; | ||
302 | } | ||
303 | } | ||
285 | 304 | ||
286 | pcm_transition_silk_size = 0; | 305 | pcm_transition_silk_size = ALLOC_NONE; |
287 | pcm_transition_celt_size = 0; | 306 | pcm_transition_celt_size = ALLOC_NONE; |
288 | if (data!=NULL && st->prev_mode > 0 && ( | 307 | if (data!=NULL && st->prev_mode > 0 && ( |
289 | (mode == MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY && !st->prev_redundancy) | 308 | (mode == MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY && !st->prev_redundancy) |
290 | || (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) ) | 309 | || (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) ) |
@@ -313,7 +332,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
313 | } | 332 | } |
314 | 333 | ||
315 | /* Don't allocate any memory when in CELT-only mode */ | 334 | /* Don't allocate any memory when in CELT-only mode */ |
316 | pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : 0; | 335 | pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : ALLOC_NONE; |
317 | ALLOC(pcm_silk, pcm_silk_size, opus_int16); | 336 | ALLOC(pcm_silk, pcm_silk_size, opus_int16); |
318 | 337 | ||
319 | /* SILK processing */ | 338 | /* SILK processing */ |
@@ -363,7 +382,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
363 | pcm_ptr[i] = 0; | 382 | pcm_ptr[i] = 0; |
364 | } else { | 383 | } else { |
365 | RESTORE_STACK; | 384 | RESTORE_STACK; |
366 | return OPUS_INVALID_PACKET; | 385 | return OPUS_INTERNAL_ERROR; |
367 | } | 386 | } |
368 | } | 387 | } |
369 | pcm_ptr += silk_frame_size * st->channels; | 388 | pcm_ptr += silk_frame_size * st->channels; |
@@ -430,7 +449,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
430 | if (redundancy) | 449 | if (redundancy) |
431 | { | 450 | { |
432 | transition = 0; | 451 | transition = 0; |
433 | pcm_transition_silk_size=0; | 452 | pcm_transition_silk_size=ALLOC_NONE; |
434 | } | 453 | } |
435 | 454 | ||
436 | ALLOC(pcm_transition_silk, pcm_transition_silk_size, opus_val16); | 455 | ALLOC(pcm_transition_silk, pcm_transition_silk_size, opus_val16); |
@@ -442,7 +461,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
442 | } | 461 | } |
443 | 462 | ||
444 | /* Only allocation memory for redundancy if/when needed */ | 463 | /* Only allocation memory for redundancy if/when needed */ |
445 | redundant_audio_size = redundancy ? F5*st->channels : 0; | 464 | redundant_audio_size = redundancy ? F5*st->channels : ALLOC_NONE; |
446 | ALLOC(redundant_audio, redundant_audio_size, opus_val16); | 465 | ALLOC(redundant_audio, redundant_audio_size, opus_val16); |
447 | 466 | ||
448 | /* 5 ms redundant frame for CELT->SILK*/ | 467 | /* 5 ms redundant frame for CELT->SILK*/ |
@@ -569,189 +588,13 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, | |||
569 | 588 | ||
570 | } | 589 | } |
571 | 590 | ||
572 | static int parse_size(const unsigned char *data, opus_int32 len, opus_int16 *size) | ||
573 | { | ||
574 | if (len<1) | ||
575 | { | ||
576 | *size = -1; | ||
577 | return -1; | ||
578 | } else if (data[0]<252) | ||
579 | { | ||
580 | *size = data[0]; | ||
581 | return 1; | ||
582 | } else if (len<2) | ||
583 | { | ||
584 | *size = -1; | ||
585 | return -1; | ||
586 | } else { | ||
587 | *size = 4*data[1] + data[0]; | ||
588 | return 2; | ||
589 | } | ||
590 | } | ||
591 | |||
592 | static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, | ||
593 | int self_delimited, unsigned char *out_toc, | ||
594 | const unsigned char *frames[48], opus_int16 size[48], int *payload_offset) | ||
595 | { | ||
596 | int i, bytes; | ||
597 | int count; | ||
598 | int cbr; | ||
599 | unsigned char ch, toc; | ||
600 | int framesize; | ||
601 | opus_int32 last_size; | ||
602 | const unsigned char *data0 = data; | ||
603 | |||
604 | if (size==NULL) | ||
605 | return OPUS_BAD_ARG; | ||
606 | |||
607 | framesize = opus_packet_get_samples_per_frame(data, 48000); | ||
608 | |||
609 | cbr = 0; | ||
610 | toc = *data++; | ||
611 | len--; | ||
612 | last_size = len; | ||
613 | switch (toc&0x3) | ||
614 | { | ||
615 | /* One frame */ | ||
616 | case 0: | ||
617 | count=1; | ||
618 | break; | ||
619 | /* Two CBR frames */ | ||
620 | case 1: | ||
621 | count=2; | ||
622 | cbr = 1; | ||
623 | if (!self_delimited) | ||
624 | { | ||
625 | if (len&0x1) | ||
626 | return OPUS_INVALID_PACKET; | ||
627 | last_size = len/2; | ||
628 | /* If last_size doesn't fit in size[0], we'll catch it later */ | ||
629 | size[0] = (opus_int16)last_size; | ||
630 | } | ||
631 | break; | ||
632 | /* Two VBR frames */ | ||
633 | case 2: | ||
634 | count = 2; | ||
635 | bytes = parse_size(data, len, size); | ||
636 | len -= bytes; | ||
637 | if (size[0]<0 || size[0] > len) | ||
638 | return OPUS_INVALID_PACKET; | ||
639 | data += bytes; | ||
640 | last_size = len-size[0]; | ||
641 | break; | ||
642 | /* Multiple CBR/VBR frames (from 0 to 120 ms) */ | ||
643 | default: /*case 3:*/ | ||
644 | if (len<1) | ||
645 | return OPUS_INVALID_PACKET; | ||
646 | /* Number of frames encoded in bits 0 to 5 */ | ||
647 | ch = *data++; | ||
648 | count = ch&0x3F; | ||
649 | if (count <= 0 || framesize*count > 5760) | ||
650 | return OPUS_INVALID_PACKET; | ||
651 | len--; | ||
652 | /* Padding flag is bit 6 */ | ||
653 | if (ch&0x40) | ||
654 | { | ||
655 | int p; | ||
656 | do { | ||
657 | if (len<=0) | ||
658 | return OPUS_INVALID_PACKET; | ||
659 | p = *data++; | ||
660 | len--; | ||
661 | len -= p==255 ? 254: p; | ||
662 | } while (p==255); | ||
663 | } | ||
664 | if (len<0) | ||
665 | return OPUS_INVALID_PACKET; | ||
666 | /* VBR flag is bit 7 */ | ||
667 | cbr = !(ch&0x80); | ||
668 | if (!cbr) | ||
669 | { | ||
670 | /* VBR case */ | ||
671 | last_size = len; | ||
672 | for (i=0;i<count-1;i++) | ||
673 | { | ||
674 | bytes = parse_size(data, len, size+i); | ||
675 | len -= bytes; | ||
676 | if (size[i]<0 || size[i] > len) | ||
677 | return OPUS_INVALID_PACKET; | ||
678 | data += bytes; | ||
679 | last_size -= bytes+size[i]; | ||
680 | } | ||
681 | if (last_size<0) | ||
682 | return OPUS_INVALID_PACKET; | ||
683 | } else if (!self_delimited) | ||
684 | { | ||
685 | /* CBR case */ | ||
686 | last_size = len/count; | ||
687 | if (last_size*count!=len) | ||
688 | return OPUS_INVALID_PACKET; | ||
689 | for (i=0;i<count-1;i++) | ||
690 | size[i] = (opus_int16)last_size; | ||
691 | } | ||
692 | break; | ||
693 | } | ||
694 | /* Self-delimited framing has an extra size for the last frame. */ | ||
695 | if (self_delimited) | ||
696 | { | ||
697 | bytes = parse_size(data, len, size+count-1); | ||
698 | len -= bytes; | ||
699 | if (size[count-1]<0 || size[count-1] > len) | ||
700 | return OPUS_INVALID_PACKET; | ||
701 | data += bytes; | ||
702 | /* For CBR packets, apply the size to all the frames. */ | ||
703 | if (cbr) | ||
704 | { | ||
705 | if (size[count-1]*count > len) | ||
706 | return OPUS_INVALID_PACKET; | ||
707 | for (i=0;i<count-1;i++) | ||
708 | size[i] = size[count-1]; | ||
709 | } else if(size[count-1] > last_size) | ||
710 | return OPUS_INVALID_PACKET; | ||
711 | } else | ||
712 | { | ||
713 | /* Because it's not encoded explicitly, it's possible the size of the | ||
714 | last packet (or all the packets, for the CBR case) is larger than | ||
715 | 1275. Reject them here.*/ | ||
716 | if (last_size > 1275) | ||
717 | return OPUS_INVALID_PACKET; | ||
718 | size[count-1] = (opus_int16)last_size; | ||
719 | } | ||
720 | |||
721 | if (frames) | ||
722 | { | ||
723 | for (i=0;i<count;i++) | ||
724 | { | ||
725 | frames[i] = data; | ||
726 | data += size[i]; | ||
727 | } | ||
728 | } | ||
729 | |||
730 | if (out_toc) | ||
731 | *out_toc = toc; | ||
732 | |||
733 | if (payload_offset) | ||
734 | *payload_offset = (int)(data-data0); | ||
735 | |||
736 | return count; | ||
737 | } | ||
738 | |||
739 | int opus_packet_parse(const unsigned char *data, opus_int32 len, | ||
740 | unsigned char *out_toc, const unsigned char *frames[48], | ||
741 | opus_int16 size[48], int *payload_offset) | ||
742 | { | ||
743 | return opus_packet_parse_impl(data, len, 0, out_toc, | ||
744 | frames, size, payload_offset); | ||
745 | } | ||
746 | |||
747 | int opus_decode_native(OpusDecoder *st, const unsigned char *data, | 591 | int opus_decode_native(OpusDecoder *st, const unsigned char *data, |
748 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec, | 592 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec, |
749 | int self_delimited, int *packet_offset, int soft_clip) | 593 | int self_delimited, opus_int32 *packet_offset, int soft_clip) |
750 | { | 594 | { |
751 | int i, nb_samples; | 595 | int i, nb_samples; |
752 | int count, offset; | 596 | int count, offset; |
753 | unsigned char toc; | 597 | unsigned char toc; |
754 | int tot_offset; | ||
755 | int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels; | 598 | int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels; |
756 | /* 48 x 2.5 ms = 120 ms */ | 599 | /* 48 x 2.5 ms = 120 ms */ |
757 | opus_int16 size[48]; | 600 | opus_int16 size[48]; |
@@ -783,7 +626,10 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, | |||
783 | packet_frame_size = opus_packet_get_samples_per_frame(data, st->Fs); | 626 | packet_frame_size = opus_packet_get_samples_per_frame(data, st->Fs); |
784 | packet_stream_channels = opus_packet_get_nb_channels(data); | 627 | packet_stream_channels = opus_packet_get_nb_channels(data); |
785 | 628 | ||
786 | count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL, size, &offset); | 629 | count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL, |
630 | size, &offset, packet_offset); | ||
631 | if (count<0) | ||
632 | return count; | ||
787 | 633 | ||
788 | data += offset; | 634 | data += offset; |
789 | 635 | ||
@@ -822,11 +668,6 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, | |||
822 | return frame_size; | 668 | return frame_size; |
823 | } | 669 | } |
824 | } | 670 | } |
825 | tot_offset = 0; | ||
826 | if (count < 0) | ||
827 | return count; | ||
828 | |||
829 | tot_offset += offset; | ||
830 | 671 | ||
831 | if (count*packet_frame_size > frame_size) | 672 | if (count*packet_frame_size > frame_size) |
832 | return OPUS_BUFFER_TOO_SMALL; | 673 | return OPUS_BUFFER_TOO_SMALL; |
@@ -846,11 +687,8 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, | |||
846 | return ret; | 687 | return ret; |
847 | celt_assert(ret==packet_frame_size); | 688 | celt_assert(ret==packet_frame_size); |
848 | data += size[i]; | 689 | data += size[i]; |
849 | tot_offset += size[i]; | ||
850 | nb_samples += ret; | 690 | nb_samples += ret; |
851 | } | 691 | } |
852 | if (packet_offset != NULL) | ||
853 | *packet_offset = tot_offset; | ||
854 | st->last_packet_duration = nb_samples; | 692 | st->last_packet_duration = nb_samples; |
855 | if (OPUS_CHECK_ARRAY(pcm, nb_samples*st->channels)) | 693 | if (OPUS_CHECK_ARRAY(pcm, nb_samples*st->channels)) |
856 | OPUS_PRINT_INT(nb_samples); | 694 | OPUS_PRINT_INT(nb_samples); |
@@ -868,6 +706,8 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, | |||
868 | int opus_decode(OpusDecoder *st, const unsigned char *data, | 706 | int opus_decode(OpusDecoder *st, const unsigned char *data, |
869 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec) | 707 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec) |
870 | { | 708 | { |
709 | if(frame_size<=0) | ||
710 | return OPUS_BAD_ARG; | ||
871 | return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); | 711 | return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); |
872 | } | 712 | } |
873 | 713 | ||
@@ -879,6 +719,11 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data, | |||
879 | int ret, i; | 719 | int ret, i; |
880 | ALLOC_STACK; | 720 | ALLOC_STACK; |
881 | 721 | ||
722 | if(frame_size<=0) | ||
723 | { | ||
724 | RESTORE_STACK; | ||
725 | return OPUS_BAD_ARG; | ||
726 | } | ||
882 | ALLOC(out, frame_size*st->channels, opus_int16); | 727 | ALLOC(out, frame_size*st->channels, opus_int16); |
883 | 728 | ||
884 | ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0); | 729 | ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0); |
@@ -901,7 +746,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, | |||
901 | int ret, i; | 746 | int ret, i; |
902 | ALLOC_STACK; | 747 | ALLOC_STACK; |
903 | 748 | ||
904 | if(frame_size<0) | 749 | if(frame_size<=0) |
905 | { | 750 | { |
906 | RESTORE_STACK; | 751 | RESTORE_STACK; |
907 | return OPUS_BAD_ARG; | 752 | return OPUS_BAD_ARG; |
@@ -922,6 +767,8 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, | |||
922 | int opus_decode_float(OpusDecoder *st, const unsigned char *data, | 767 | int opus_decode_float(OpusDecoder *st, const unsigned char *data, |
923 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec) | 768 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec) |
924 | { | 769 | { |
770 | if(frame_size<=0) | ||
771 | return OPUS_BAD_ARG; | ||
925 | return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); | 772 | return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); |
926 | } | 773 | } |
927 | 774 | ||
diff --git a/lib/rbcodec/codecs/libopus/opus_defines.h b/lib/rbcodec/codecs/libopus/opus_defines.h index 3474e84c43..265089f65e 100644 --- a/lib/rbcodec/codecs/libopus/opus_defines.h +++ b/lib/rbcodec/codecs/libopus/opus_defines.h | |||
@@ -98,6 +98,18 @@ extern "C" { | |||
98 | # define OPUS_RESTRICT restrict | 98 | # define OPUS_RESTRICT restrict |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) | ||
102 | # if OPUS_GNUC_PREREQ(2,7) | ||
103 | # define OPUS_INLINE __inline__ | ||
104 | # elif (defined(_MSC_VER)) | ||
105 | # define OPUS_INLINE __inline | ||
106 | # else | ||
107 | # define OPUS_INLINE | ||
108 | # endif | ||
109 | #else | ||
110 | # define OPUS_INLINE inline | ||
111 | #endif | ||
112 | |||
101 | /**Warning attributes for opus functions | 113 | /**Warning attributes for opus functions |
102 | * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out | 114 | * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out |
103 | * some paranoid null checks. */ | 115 | * some paranoid null checks. */ |
@@ -151,6 +163,8 @@ extern "C" { | |||
151 | #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 | 163 | #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 |
152 | #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040 | 164 | #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040 |
153 | #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041 | 165 | #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041 |
166 | #define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042 | ||
167 | #define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043 | ||
154 | 168 | ||
155 | /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ | 169 | /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ |
156 | 170 | ||
@@ -194,7 +208,6 @@ extern "C" { | |||
194 | #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */ | 208 | #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */ |
195 | #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */ | 209 | #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */ |
196 | #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */ | 210 | #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */ |
197 | #define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */ | ||
198 | 211 | ||
199 | /**@}*/ | 212 | /**@}*/ |
200 | 213 | ||
@@ -575,6 +588,14 @@ extern "C" { | |||
575 | * @hideinitializer */ | 588 | * @hideinitializer */ |
576 | #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x) | 589 | #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x) |
577 | 590 | ||
591 | /** If set to 1, disables almost all use of prediction, making frames almost | ||
592 | completely independent. This reduces quality. (default : 0) | ||
593 | * @hideinitializer */ | ||
594 | #define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, __opus_check_int(x) | ||
595 | /** Gets the encoder's configured prediction status. | ||
596 | * @hideinitializer */ | ||
597 | #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x) | ||
598 | |||
578 | /**@}*/ | 599 | /**@}*/ |
579 | 600 | ||
580 | /** @defgroup opus_genericctls Generic CTLs | 601 | /** @defgroup opus_genericctls Generic CTLs |
diff --git a/lib/rbcodec/codecs/libopus/opus_private.h b/lib/rbcodec/codecs/libopus/opus_private.h index 9d8210b5f0..83225f2b6c 100644 --- a/lib/rbcodec/codecs/libopus/opus_private.h +++ b/lib/rbcodec/codecs/libopus/opus_private.h | |||
@@ -82,35 +82,48 @@ int get_mono_channel(const ChannelLayout *layout, int stream_id, int prev); | |||
82 | #define OPUS_SET_FORCE_MODE_REQUEST 11002 | 82 | #define OPUS_SET_FORCE_MODE_REQUEST 11002 |
83 | #define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x) | 83 | #define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x) |
84 | 84 | ||
85 | typedef void (*downmix_func)(const void *, float *, int, int, int); | 85 | typedef void (*downmix_func)(const void *, opus_val32 *, int, int, int, int, int); |
86 | void downmix_float(const void *_x, float *sub, int subframe, int offset, int C); | 86 | void downmix_float(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C); |
87 | void downmix_int(const void *_x, float *sub, int subframe, int offset, int C); | 87 | void downmix_int(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C); |
88 | 88 | ||
89 | int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs, | 89 | int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs, |
90 | int bitrate, opus_val16 tonality, opus_val32 *mem, int buffering, | 90 | int bitrate, opus_val16 tonality, float *mem, int buffering, |
91 | downmix_func downmix); | 91 | downmix_func downmix); |
92 | 92 | ||
93 | int encode_size(int size, unsigned char *data); | 93 | int encode_size(int size, unsigned char *data); |
94 | 94 | ||
95 | opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs); | 95 | opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs); |
96 | 96 | ||
97 | opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size, | 97 | opus_int32 compute_frame_size(const void *analysis_pcm, int frame_size, |
98 | unsigned char *data, opus_int32 out_data_bytes, int lsb_depth | 98 | int variable_duration, int C, opus_int32 Fs, int bitrate_bps, |
99 | #ifndef FIXED_POINT | 99 | int delay_compensation, downmix_func downmix |
100 | , AnalysisInfo *analysis_info | 100 | #ifndef DISABLE_FLOAT_API |
101 | , float *subframe_mem | ||
101 | #endif | 102 | #endif |
102 | ); | 103 | ); |
103 | 104 | ||
105 | opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size, | ||
106 | unsigned char *data, opus_int32 out_data_bytes, int lsb_depth, | ||
107 | const void *analysis_pcm, opus_int32 analysis_size, int c1, int c2, int analysis_channels, downmix_func downmix); | ||
108 | |||
104 | int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len, | 109 | int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len, |
105 | opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, | 110 | opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, |
106 | int *packet_offset, int soft_clip); | 111 | opus_int32 *packet_offset, int soft_clip); |
107 | 112 | ||
108 | /* Make sure everything's aligned to sizeof(void *) bytes */ | 113 | /* Make sure everything's aligned to sizeof(void *) bytes */ |
109 | static inline int align(int i) | 114 | static OPUS_INLINE int align(int i) |
110 | { | 115 | { |
111 | return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *); | 116 | return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *); |
112 | } | 117 | } |
113 | 118 | ||
114 | opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited); | 119 | int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, |
120 | int self_delimited, unsigned char *out_toc, | ||
121 | const unsigned char *frames[48], opus_int16 size[48], | ||
122 | int *payload_offset, opus_int32 *packet_offset); | ||
123 | |||
124 | opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, | ||
125 | unsigned char *data, opus_int32 maxlen, int self_delimited, int pad); | ||
126 | |||
127 | int pad_frame(unsigned char *data, opus_int32 len, opus_int32 new_len); | ||
115 | 128 | ||
116 | #endif /* OPUS_PRIVATE_H */ | 129 | #endif /* OPUS_PRIVATE_H */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/API.h b/lib/rbcodec/codecs/libopus/silk/API.h index c477cb4729..f0601bcf6b 100644 --- a/lib/rbcodec/codecs/libopus/silk/API.h +++ b/lib/rbcodec/codecs/libopus/silk/API.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -64,6 +64,7 @@ opus_int silk_Get_Encoder_Size( /* O Returns error co | |||
64 | /*************************/ | 64 | /*************************/ |
65 | opus_int silk_InitEncoder( /* O Returns error code */ | 65 | opus_int silk_InitEncoder( /* O Returns error code */ |
66 | void *encState, /* I/O State */ | 66 | void *encState, /* I/O State */ |
67 | int arch, /* I Run-time architecture */ | ||
67 | silk_EncControlStruct *encStatus /* O Encoder Status */ | 68 | silk_EncControlStruct *encStatus /* O Encoder Status */ |
68 | ); | 69 | ); |
69 | 70 | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/CNG.c b/lib/rbcodec/codecs/libopus/silk/CNG.c index 19c2e2230c..8481d95dbe 100644 --- a/lib/rbcodec/codecs/libopus/silk/CNG.c +++ b/lib/rbcodec/codecs/libopus/silk/CNG.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
33 | #include "stack_alloc.h" | 33 | #include "stack_alloc.h" |
34 | 34 | ||
35 | /* Generates excitation for CNG LPC synthesis */ | 35 | /* Generates excitation for CNG LPC synthesis */ |
36 | static inline void silk_CNG_exc( | 36 | static OPUS_INLINE void silk_CNG_exc( |
37 | opus_int32 residual_Q10[], /* O CNG residual signal Q10 */ | 37 | opus_int32 residual_Q10[], /* O CNG residual signal Q10 */ |
38 | opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */ | 38 | opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */ |
39 | opus_int32 Gain_Q16, /* I Gain to apply */ | 39 | opus_int32 Gain_Q16, /* I Gain to apply */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/Inlines.h b/lib/rbcodec/codecs/libopus/silk/Inlines.h index bec35eb7dc..ec986cdfdd 100644 --- a/lib/rbcodec/codecs/libopus/silk/Inlines.h +++ b/lib/rbcodec/codecs/libopus/silk/Inlines.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -26,7 +26,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
26 | ***********************************************************************/ | 26 | ***********************************************************************/ |
27 | 27 | ||
28 | /*! \file silk_Inlines.h | 28 | /*! \file silk_Inlines.h |
29 | * \brief silk_Inlines.h defines inline signal processing functions. | 29 | * \brief silk_Inlines.h defines OPUS_INLINE signal processing functions. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef SILK_FIX_INLINES_H | 32 | #ifndef SILK_FIX_INLINES_H |
@@ -38,7 +38,7 @@ extern "C" | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | /* count leading zeros of opus_int64 */ | 40 | /* count leading zeros of opus_int64 */ |
41 | static inline opus_int32 silk_CLZ64( opus_int64 in ) | 41 | static OPUS_INLINE opus_int32 silk_CLZ64( opus_int64 in ) |
42 | { | 42 | { |
43 | opus_int32 in_upper; | 43 | opus_int32 in_upper; |
44 | 44 | ||
@@ -53,7 +53,7 @@ static inline opus_int32 silk_CLZ64( opus_int64 in ) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /* get number of leading zeros and fractional part (the bits right after the leading one */ | 55 | /* get number of leading zeros and fractional part (the bits right after the leading one */ |
56 | static inline void silk_CLZ_FRAC( | 56 | static OPUS_INLINE void silk_CLZ_FRAC( |
57 | opus_int32 in, /* I input */ | 57 | opus_int32 in, /* I input */ |
58 | opus_int32 *lz, /* O number of leading zeros */ | 58 | opus_int32 *lz, /* O number of leading zeros */ |
59 | opus_int32 *frac_Q7 /* O the 7 bits right after the leading one */ | 59 | opus_int32 *frac_Q7 /* O the 7 bits right after the leading one */ |
@@ -68,7 +68,7 @@ static inline void silk_CLZ_FRAC( | |||
68 | /* Approximation of square root */ | 68 | /* Approximation of square root */ |
69 | /* Accuracy: < +/- 10% for output values > 15 */ | 69 | /* Accuracy: < +/- 10% for output values > 15 */ |
70 | /* < +/- 2.5% for output values > 120 */ | 70 | /* < +/- 2.5% for output values > 120 */ |
71 | static inline opus_int32 silk_SQRT_APPROX( opus_int32 x ) | 71 | static OPUS_INLINE opus_int32 silk_SQRT_APPROX( opus_int32 x ) |
72 | { | 72 | { |
73 | opus_int32 y, lz, frac_Q7; | 73 | opus_int32 y, lz, frac_Q7; |
74 | 74 | ||
@@ -94,7 +94,7 @@ static inline opus_int32 silk_SQRT_APPROX( opus_int32 x ) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | /* Divide two int32 values and return result as int32 in a given Q-domain */ | 96 | /* Divide two int32 values and return result as int32 in a given Q-domain */ |
97 | static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */ | 97 | static OPUS_INLINE opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */ |
98 | const opus_int32 a32, /* I numerator (Q0) */ | 98 | const opus_int32 a32, /* I numerator (Q0) */ |
99 | const opus_int32 b32, /* I denominator (Q0) */ | 99 | const opus_int32 b32, /* I denominator (Q0) */ |
100 | const opus_int Qres /* I Q-domain of result (>= 0) */ | 100 | const opus_int Qres /* I Q-domain of result (>= 0) */ |
@@ -140,7 +140,7 @@ static inline opus_int32 silk_DIV32_varQ( /* O returns a good approximation | |||
140 | } | 140 | } |
141 | 141 | ||
142 | /* Invert int32 value and return result as int32 in a given Q-domain */ | 142 | /* Invert int32 value and return result as int32 in a given Q-domain */ |
143 | static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */ | 143 | static OPUS_INLINE opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */ |
144 | const opus_int32 b32, /* I denominator (Q0) */ | 144 | const opus_int32 b32, /* I denominator (Q0) */ |
145 | const opus_int Qres /* I Q-domain of result (> 0) */ | 145 | const opus_int Qres /* I Q-domain of result (> 0) */ |
146 | ) | 146 | ) |
diff --git a/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c b/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c index 9bfeba0f5f..9d1f16cb7d 100644 --- a/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c +++ b/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/LPC_inv_pred_gain.c b/lib/rbcodec/codecs/libopus/silk/LPC_inv_pred_gain.c index fec5732616..dd14d4bca6 100644 --- a/lib/rbcodec/codecs/libopus/silk/LPC_inv_pred_gain.c +++ b/lib/rbcodec/codecs/libopus/silk/LPC_inv_pred_gain.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/MacroCount.h b/lib/rbcodec/codecs/libopus/silk/MacroCount.h index 6395d250b2..834817d058 100644 --- a/lib/rbcodec/codecs/libopus/silk/MacroCount.h +++ b/lib/rbcodec/codecs/libopus/silk/MacroCount.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -34,11 +34,11 @@ POSSIBILITY OF SUCH DAMAGE. | |||
34 | 34 | ||
35 | extern opus_int64 ops_count; | 35 | extern opus_int64 ops_count; |
36 | 36 | ||
37 | static inline opus_int64 silk_SaveCount(){ | 37 | static OPUS_INLINE opus_int64 silk_SaveCount(){ |
38 | return(ops_count); | 38 | return(ops_count); |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline opus_int64 silk_SaveResetCount(){ | 41 | static OPUS_INLINE opus_int64 silk_SaveResetCount(){ |
42 | opus_int64 ret; | 42 | opus_int64 ret; |
43 | 43 | ||
44 | ret = ops_count; | 44 | ret = ops_count; |
@@ -46,12 +46,12 @@ static inline opus_int64 silk_SaveResetCount(){ | |||
46 | return(ret); | 46 | return(ret); |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline silk_PrintCount(){ | 49 | static OPUS_INLINE silk_PrintCount(){ |
50 | printf("ops_count = %d \n ", (opus_int32)ops_count); | 50 | printf("ops_count = %d \n ", (opus_int32)ops_count); |
51 | } | 51 | } |
52 | 52 | ||
53 | #undef silk_MUL | 53 | #undef silk_MUL |
54 | static inline opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){ | 54 | static OPUS_INLINE opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){ |
55 | opus_int32 ret; | 55 | opus_int32 ret; |
56 | ops_count += 4; | 56 | ops_count += 4; |
57 | ret = a32 * b32; | 57 | ret = a32 * b32; |
@@ -59,14 +59,14 @@ static inline opus_int32 silk_MUL(opus_int32 a32, opus_int32 b32){ | |||
59 | } | 59 | } |
60 | 60 | ||
61 | #undef silk_MUL_uint | 61 | #undef silk_MUL_uint |
62 | static inline opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){ | 62 | static OPUS_INLINE opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){ |
63 | opus_uint32 ret; | 63 | opus_uint32 ret; |
64 | ops_count += 4; | 64 | ops_count += 4; |
65 | ret = a32 * b32; | 65 | ret = a32 * b32; |
66 | return ret; | 66 | return ret; |
67 | } | 67 | } |
68 | #undef silk_MLA | 68 | #undef silk_MLA |
69 | static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 69 | static OPUS_INLINE opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
70 | opus_int32 ret; | 70 | opus_int32 ret; |
71 | ops_count += 4; | 71 | ops_count += 4; |
72 | ret = a32 + b32 * c32; | 72 | ret = a32 + b32 * c32; |
@@ -74,7 +74,7 @@ static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32 | |||
74 | } | 74 | } |
75 | 75 | ||
76 | #undef silk_MLA_uint | 76 | #undef silk_MLA_uint |
77 | static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){ | 77 | static OPUS_INLINE opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){ |
78 | opus_uint32 ret; | 78 | opus_uint32 ret; |
79 | ops_count += 4; | 79 | ops_count += 4; |
80 | ret = a32 + b32 * c32; | 80 | ret = a32 + b32 * c32; |
@@ -82,14 +82,14 @@ static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_ui | |||
82 | } | 82 | } |
83 | 83 | ||
84 | #undef silk_SMULWB | 84 | #undef silk_SMULWB |
85 | static inline opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){ | 85 | static OPUS_INLINE opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){ |
86 | opus_int32 ret; | 86 | opus_int32 ret; |
87 | ops_count += 5; | 87 | ops_count += 5; |
88 | ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); | 88 | ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); |
89 | return ret; | 89 | return ret; |
90 | } | 90 | } |
91 | #undef silk_SMLAWB | 91 | #undef silk_SMLAWB |
92 | static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 92 | static OPUS_INLINE opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
93 | opus_int32 ret; | 93 | opus_int32 ret; |
94 | ops_count += 5; | 94 | ops_count += 5; |
95 | ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))); | 95 | ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))); |
@@ -97,14 +97,14 @@ static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 | |||
97 | } | 97 | } |
98 | 98 | ||
99 | #undef silk_SMULWT | 99 | #undef silk_SMULWT |
100 | static inline opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){ | 100 | static OPUS_INLINE opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){ |
101 | opus_int32 ret; | 101 | opus_int32 ret; |
102 | ops_count += 4; | 102 | ops_count += 4; |
103 | ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); | 103 | ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); |
104 | return ret; | 104 | return ret; |
105 | } | 105 | } |
106 | #undef silk_SMLAWT | 106 | #undef silk_SMLAWT |
107 | static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 107 | static OPUS_INLINE opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
108 | opus_int32 ret; | 108 | opus_int32 ret; |
109 | ops_count += 4; | 109 | ops_count += 4; |
110 | ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); | 110 | ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); |
@@ -112,14 +112,14 @@ static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 | |||
112 | } | 112 | } |
113 | 113 | ||
114 | #undef silk_SMULBB | 114 | #undef silk_SMULBB |
115 | static inline opus_int32 silk_SMULBB(opus_int32 a32, opus_int32 b32){ | 115 | static OPUS_INLINE opus_int32 silk_SMULBB(opus_int32 a32, opus_int32 b32){ |
116 | opus_int32 ret; | 116 | opus_int32 ret; |
117 | ops_count += 1; | 117 | ops_count += 1; |
118 | ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32); | 118 | ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32); |
119 | return ret; | 119 | return ret; |
120 | } | 120 | } |
121 | #undef silk_SMLABB | 121 | #undef silk_SMLABB |
122 | static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 122 | static OPUS_INLINE opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
123 | opus_int32 ret; | 123 | opus_int32 ret; |
124 | ops_count += 1; | 124 | ops_count += 1; |
125 | ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); | 125 | ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); |
@@ -127,7 +127,7 @@ static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 | |||
127 | } | 127 | } |
128 | 128 | ||
129 | #undef silk_SMULBT | 129 | #undef silk_SMULBT |
130 | static inline opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){ | 130 | static OPUS_INLINE opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){ |
131 | opus_int32 ret; | 131 | opus_int32 ret; |
132 | ops_count += 4; | 132 | ops_count += 4; |
133 | ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16); | 133 | ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16); |
@@ -135,7 +135,7 @@ static inline opus_int32 silk_SMULBT(opus_int32 a32, opus_int32 b32 ){ | |||
135 | } | 135 | } |
136 | 136 | ||
137 | #undef silk_SMLABT | 137 | #undef silk_SMLABT |
138 | static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 138 | static OPUS_INLINE opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
139 | opus_int32 ret; | 139 | opus_int32 ret; |
140 | ops_count += 1; | 140 | ops_count += 1; |
141 | ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); | 141 | ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); |
@@ -143,7 +143,7 @@ static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 | |||
143 | } | 143 | } |
144 | 144 | ||
145 | #undef silk_SMULTT | 145 | #undef silk_SMULTT |
146 | static inline opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){ | 146 | static OPUS_INLINE opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){ |
147 | opus_int32 ret; | 147 | opus_int32 ret; |
148 | ops_count += 1; | 148 | ops_count += 1; |
149 | ret = (a32 >> 16) * (b32 >> 16); | 149 | ret = (a32 >> 16) * (b32 >> 16); |
@@ -151,7 +151,7 @@ static inline opus_int32 silk_SMULTT(opus_int32 a32, opus_int32 b32){ | |||
151 | } | 151 | } |
152 | 152 | ||
153 | #undef silk_SMLATT | 153 | #undef silk_SMLATT |
154 | static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 154 | static OPUS_INLINE opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
155 | opus_int32 ret; | 155 | opus_int32 ret; |
156 | ops_count += 1; | 156 | ops_count += 1; |
157 | ret = a32 + (b32 >> 16) * (c32 >> 16); | 157 | ret = a32 + (b32 >> 16) * (c32 >> 16); |
@@ -179,7 +179,7 @@ static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 | |||
179 | #define silk_SMLAWT_ovflw silk_SMLAWT | 179 | #define silk_SMLAWT_ovflw silk_SMLAWT |
180 | 180 | ||
181 | #undef silk_SMULL | 181 | #undef silk_SMULL |
182 | static inline opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){ | 182 | static OPUS_INLINE opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){ |
183 | opus_int64 ret; | 183 | opus_int64 ret; |
184 | ops_count += 8; | 184 | ops_count += 8; |
185 | ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32)); | 185 | ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32)); |
@@ -187,14 +187,14 @@ static inline opus_int64 silk_SMULL(opus_int32 a32, opus_int32 b32){ | |||
187 | } | 187 | } |
188 | 188 | ||
189 | #undef silk_SMLAL | 189 | #undef silk_SMLAL |
190 | static inline opus_int64 silk_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){ | 190 | static OPUS_INLINE opus_int64 silk_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){ |
191 | opus_int64 ret; | 191 | opus_int64 ret; |
192 | ops_count += 8; | 192 | ops_count += 8; |
193 | ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32)); | 193 | ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32)); |
194 | return ret; | 194 | return ret; |
195 | } | 195 | } |
196 | #undef silk_SMLALBB | 196 | #undef silk_SMLALBB |
197 | static inline opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){ | 197 | static OPUS_INLINE opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){ |
198 | opus_int64 ret; | 198 | opus_int64 ret; |
199 | ops_count += 4; | 199 | ops_count += 4; |
200 | ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16)); | 200 | ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16)); |
@@ -202,7 +202,7 @@ static inline opus_int64 silk_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 | |||
202 | } | 202 | } |
203 | 203 | ||
204 | #undef SigProcFIX_CLZ16 | 204 | #undef SigProcFIX_CLZ16 |
205 | static inline opus_int32 SigProcFIX_CLZ16(opus_int16 in16) | 205 | static OPUS_INLINE opus_int32 SigProcFIX_CLZ16(opus_int16 in16) |
206 | { | 206 | { |
207 | opus_int32 out32 = 0; | 207 | opus_int32 out32 = 0; |
208 | ops_count += 10; | 208 | ops_count += 10; |
@@ -240,7 +240,7 @@ static inline opus_int32 SigProcFIX_CLZ16(opus_int16 in16) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | #undef SigProcFIX_CLZ32 | 242 | #undef SigProcFIX_CLZ32 |
243 | static inline opus_int32 SigProcFIX_CLZ32(opus_int32 in32) | 243 | static OPUS_INLINE opus_int32 SigProcFIX_CLZ32(opus_int32 in32) |
244 | { | 244 | { |
245 | /* test highest 16 bits and convert to opus_int16 */ | 245 | /* test highest 16 bits and convert to opus_int16 */ |
246 | ops_count += 2; | 246 | ops_count += 2; |
@@ -252,19 +252,19 @@ static inline opus_int32 SigProcFIX_CLZ32(opus_int32 in32) | |||
252 | } | 252 | } |
253 | 253 | ||
254 | #undef silk_DIV32 | 254 | #undef silk_DIV32 |
255 | static inline opus_int32 silk_DIV32(opus_int32 a32, opus_int32 b32){ | 255 | static OPUS_INLINE opus_int32 silk_DIV32(opus_int32 a32, opus_int32 b32){ |
256 | ops_count += 64; | 256 | ops_count += 64; |
257 | return a32 / b32; | 257 | return a32 / b32; |
258 | } | 258 | } |
259 | 259 | ||
260 | #undef silk_DIV32_16 | 260 | #undef silk_DIV32_16 |
261 | static inline opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){ | 261 | static OPUS_INLINE opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){ |
262 | ops_count += 32; | 262 | ops_count += 32; |
263 | return a32 / b32; | 263 | return a32 / b32; |
264 | } | 264 | } |
265 | 265 | ||
266 | #undef silk_SAT8 | 266 | #undef silk_SAT8 |
267 | static inline opus_int8 silk_SAT8(opus_int64 a){ | 267 | static OPUS_INLINE opus_int8 silk_SAT8(opus_int64 a){ |
268 | opus_int8 tmp; | 268 | opus_int8 tmp; |
269 | ops_count += 1; | 269 | ops_count += 1; |
270 | tmp = (opus_int8)((a) > silk_int8_MAX ? silk_int8_MAX : \ | 270 | tmp = (opus_int8)((a) > silk_int8_MAX ? silk_int8_MAX : \ |
@@ -273,7 +273,7 @@ static inline opus_int8 silk_SAT8(opus_int64 a){ | |||
273 | } | 273 | } |
274 | 274 | ||
275 | #undef silk_SAT16 | 275 | #undef silk_SAT16 |
276 | static inline opus_int16 silk_SAT16(opus_int64 a){ | 276 | static OPUS_INLINE opus_int16 silk_SAT16(opus_int64 a){ |
277 | opus_int16 tmp; | 277 | opus_int16 tmp; |
278 | ops_count += 1; | 278 | ops_count += 1; |
279 | tmp = (opus_int16)((a) > silk_int16_MAX ? silk_int16_MAX : \ | 279 | tmp = (opus_int16)((a) > silk_int16_MAX ? silk_int16_MAX : \ |
@@ -281,7 +281,7 @@ static inline opus_int16 silk_SAT16(opus_int64 a){ | |||
281 | return(tmp); | 281 | return(tmp); |
282 | } | 282 | } |
283 | #undef silk_SAT32 | 283 | #undef silk_SAT32 |
284 | static inline opus_int32 silk_SAT32(opus_int64 a){ | 284 | static OPUS_INLINE opus_int32 silk_SAT32(opus_int64 a){ |
285 | opus_int32 tmp; | 285 | opus_int32 tmp; |
286 | ops_count += 1; | 286 | ops_count += 1; |
287 | tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : \ | 287 | tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : \ |
@@ -289,7 +289,7 @@ static inline opus_int32 silk_SAT32(opus_int64 a){ | |||
289 | return(tmp); | 289 | return(tmp); |
290 | } | 290 | } |
291 | #undef silk_POS_SAT32 | 291 | #undef silk_POS_SAT32 |
292 | static inline opus_int32 silk_POS_SAT32(opus_int64 a){ | 292 | static OPUS_INLINE opus_int32 silk_POS_SAT32(opus_int64 a){ |
293 | opus_int32 tmp; | 293 | opus_int32 tmp; |
294 | ops_count += 1; | 294 | ops_count += 1; |
295 | tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : (a)); | 295 | tmp = (opus_int32)((a) > silk_int32_MAX ? silk_int32_MAX : (a)); |
@@ -297,14 +297,14 @@ static inline opus_int32 silk_POS_SAT32(opus_int64 a){ | |||
297 | } | 297 | } |
298 | 298 | ||
299 | #undef silk_ADD_POS_SAT8 | 299 | #undef silk_ADD_POS_SAT8 |
300 | static inline opus_int8 silk_ADD_POS_SAT8(opus_int64 a, opus_int64 b){ | 300 | static OPUS_INLINE opus_int8 silk_ADD_POS_SAT8(opus_int64 a, opus_int64 b){ |
301 | opus_int8 tmp; | 301 | opus_int8 tmp; |
302 | ops_count += 1; | 302 | ops_count += 1; |
303 | tmp = (opus_int8)((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b))); | 303 | tmp = (opus_int8)((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b))); |
304 | return(tmp); | 304 | return(tmp); |
305 | } | 305 | } |
306 | #undef silk_ADD_POS_SAT16 | 306 | #undef silk_ADD_POS_SAT16 |
307 | static inline opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){ | 307 | static OPUS_INLINE opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){ |
308 | opus_int16 tmp; | 308 | opus_int16 tmp; |
309 | ops_count += 1; | 309 | ops_count += 1; |
310 | tmp = (opus_int16)((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b))); | 310 | tmp = (opus_int16)((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b))); |
@@ -312,7 +312,7 @@ static inline opus_int16 silk_ADD_POS_SAT16(opus_int64 a, opus_int64 b){ | |||
312 | } | 312 | } |
313 | 313 | ||
314 | #undef silk_ADD_POS_SAT32 | 314 | #undef silk_ADD_POS_SAT32 |
315 | static inline opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ | 315 | static OPUS_INLINE opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ |
316 | opus_int32 tmp; | 316 | opus_int32 tmp; |
317 | ops_count += 1; | 317 | ops_count += 1; |
318 | tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))); | 318 | tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))); |
@@ -320,7 +320,7 @@ static inline opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ | |||
320 | } | 320 | } |
321 | 321 | ||
322 | #undef silk_ADD_POS_SAT64 | 322 | #undef silk_ADD_POS_SAT64 |
323 | static inline opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ | 323 | static OPUS_INLINE opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ |
324 | opus_int64 tmp; | 324 | opus_int64 tmp; |
325 | ops_count += 1; | 325 | ops_count += 1; |
326 | tmp = ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))); | 326 | tmp = ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))); |
@@ -328,40 +328,40 @@ static inline opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ | |||
328 | } | 328 | } |
329 | 329 | ||
330 | #undef silk_LSHIFT8 | 330 | #undef silk_LSHIFT8 |
331 | static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ | 331 | static OPUS_INLINE opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ |
332 | opus_int8 ret; | 332 | opus_int8 ret; |
333 | ops_count += 1; | 333 | ops_count += 1; |
334 | ret = a << shift; | 334 | ret = a << shift; |
335 | return ret; | 335 | return ret; |
336 | } | 336 | } |
337 | #undef silk_LSHIFT16 | 337 | #undef silk_LSHIFT16 |
338 | static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){ | 338 | static OPUS_INLINE opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){ |
339 | opus_int16 ret; | 339 | opus_int16 ret; |
340 | ops_count += 1; | 340 | ops_count += 1; |
341 | ret = a << shift; | 341 | ret = a << shift; |
342 | return ret; | 342 | return ret; |
343 | } | 343 | } |
344 | #undef silk_LSHIFT32 | 344 | #undef silk_LSHIFT32 |
345 | static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){ | 345 | static OPUS_INLINE opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){ |
346 | opus_int32 ret; | 346 | opus_int32 ret; |
347 | ops_count += 1; | 347 | ops_count += 1; |
348 | ret = a << shift; | 348 | ret = a << shift; |
349 | return ret; | 349 | return ret; |
350 | } | 350 | } |
351 | #undef silk_LSHIFT64 | 351 | #undef silk_LSHIFT64 |
352 | static inline opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){ | 352 | static OPUS_INLINE opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){ |
353 | ops_count += 1; | 353 | ops_count += 1; |
354 | return a << shift; | 354 | return a << shift; |
355 | } | 355 | } |
356 | 356 | ||
357 | #undef silk_LSHIFT_ovflw | 357 | #undef silk_LSHIFT_ovflw |
358 | static inline opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ | 358 | static OPUS_INLINE opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ |
359 | ops_count += 1; | 359 | ops_count += 1; |
360 | return a << shift; | 360 | return a << shift; |
361 | } | 361 | } |
362 | 362 | ||
363 | #undef silk_LSHIFT_uint | 363 | #undef silk_LSHIFT_uint |
364 | static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ | 364 | static OPUS_INLINE opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ |
365 | opus_uint32 ret; | 365 | opus_uint32 ret; |
366 | ops_count += 1; | 366 | ops_count += 1; |
367 | ret = a << shift; | 367 | ret = a << shift; |
@@ -369,83 +369,83 @@ static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ | |||
369 | } | 369 | } |
370 | 370 | ||
371 | #undef silk_RSHIFT8 | 371 | #undef silk_RSHIFT8 |
372 | static inline opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){ | 372 | static OPUS_INLINE opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){ |
373 | ops_count += 1; | 373 | ops_count += 1; |
374 | return a >> shift; | 374 | return a >> shift; |
375 | } | 375 | } |
376 | #undef silk_RSHIFT16 | 376 | #undef silk_RSHIFT16 |
377 | static inline opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){ | 377 | static OPUS_INLINE opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){ |
378 | ops_count += 1; | 378 | ops_count += 1; |
379 | return a >> shift; | 379 | return a >> shift; |
380 | } | 380 | } |
381 | #undef silk_RSHIFT32 | 381 | #undef silk_RSHIFT32 |
382 | static inline opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){ | 382 | static OPUS_INLINE opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){ |
383 | ops_count += 1; | 383 | ops_count += 1; |
384 | return a >> shift; | 384 | return a >> shift; |
385 | } | 385 | } |
386 | #undef silk_RSHIFT64 | 386 | #undef silk_RSHIFT64 |
387 | static inline opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){ | 387 | static OPUS_INLINE opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){ |
388 | ops_count += 1; | 388 | ops_count += 1; |
389 | return a >> shift; | 389 | return a >> shift; |
390 | } | 390 | } |
391 | 391 | ||
392 | #undef silk_RSHIFT_uint | 392 | #undef silk_RSHIFT_uint |
393 | static inline opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ | 393 | static OPUS_INLINE opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ |
394 | ops_count += 1; | 394 | ops_count += 1; |
395 | return a >> shift; | 395 | return a >> shift; |
396 | } | 396 | } |
397 | 397 | ||
398 | #undef silk_ADD_LSHIFT | 398 | #undef silk_ADD_LSHIFT |
399 | static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ | 399 | static OPUS_INLINE opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ |
400 | opus_int32 ret; | 400 | opus_int32 ret; |
401 | ops_count += 1; | 401 | ops_count += 1; |
402 | ret = a + (b << shift); | 402 | ret = a + (b << shift); |
403 | return ret; /* shift >= 0*/ | 403 | return ret; /* shift >= 0*/ |
404 | } | 404 | } |
405 | #undef silk_ADD_LSHIFT32 | 405 | #undef silk_ADD_LSHIFT32 |
406 | static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ | 406 | static OPUS_INLINE opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ |
407 | opus_int32 ret; | 407 | opus_int32 ret; |
408 | ops_count += 1; | 408 | ops_count += 1; |
409 | ret = a + (b << shift); | 409 | ret = a + (b << shift); |
410 | return ret; /* shift >= 0*/ | 410 | return ret; /* shift >= 0*/ |
411 | } | 411 | } |
412 | #undef silk_ADD_LSHIFT_uint | 412 | #undef silk_ADD_LSHIFT_uint |
413 | static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ | 413 | static OPUS_INLINE opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ |
414 | opus_uint32 ret; | 414 | opus_uint32 ret; |
415 | ops_count += 1; | 415 | ops_count += 1; |
416 | ret = a + (b << shift); | 416 | ret = a + (b << shift); |
417 | return ret; /* shift >= 0*/ | 417 | return ret; /* shift >= 0*/ |
418 | } | 418 | } |
419 | #undef silk_ADD_RSHIFT | 419 | #undef silk_ADD_RSHIFT |
420 | static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ | 420 | static OPUS_INLINE opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ |
421 | opus_int32 ret; | 421 | opus_int32 ret; |
422 | ops_count += 1; | 422 | ops_count += 1; |
423 | ret = a + (b >> shift); | 423 | ret = a + (b >> shift); |
424 | return ret; /* shift > 0*/ | 424 | return ret; /* shift > 0*/ |
425 | } | 425 | } |
426 | #undef silk_ADD_RSHIFT32 | 426 | #undef silk_ADD_RSHIFT32 |
427 | static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ | 427 | static OPUS_INLINE opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ |
428 | opus_int32 ret; | 428 | opus_int32 ret; |
429 | ops_count += 1; | 429 | ops_count += 1; |
430 | ret = a + (b >> shift); | 430 | ret = a + (b >> shift); |
431 | return ret; /* shift > 0*/ | 431 | return ret; /* shift > 0*/ |
432 | } | 432 | } |
433 | #undef silk_ADD_RSHIFT_uint | 433 | #undef silk_ADD_RSHIFT_uint |
434 | static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ | 434 | static OPUS_INLINE opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ |
435 | opus_uint32 ret; | 435 | opus_uint32 ret; |
436 | ops_count += 1; | 436 | ops_count += 1; |
437 | ret = a + (b >> shift); | 437 | ret = a + (b >> shift); |
438 | return ret; /* shift > 0*/ | 438 | return ret; /* shift > 0*/ |
439 | } | 439 | } |
440 | #undef silk_SUB_LSHIFT32 | 440 | #undef silk_SUB_LSHIFT32 |
441 | static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ | 441 | static OPUS_INLINE opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ |
442 | opus_int32 ret; | 442 | opus_int32 ret; |
443 | ops_count += 1; | 443 | ops_count += 1; |
444 | ret = a - (b << shift); | 444 | ret = a - (b << shift); |
445 | return ret; /* shift >= 0*/ | 445 | return ret; /* shift >= 0*/ |
446 | } | 446 | } |
447 | #undef silk_SUB_RSHIFT32 | 447 | #undef silk_SUB_RSHIFT32 |
448 | static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ | 448 | static OPUS_INLINE opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ |
449 | opus_int32 ret; | 449 | opus_int32 ret; |
450 | ops_count += 1; | 450 | ops_count += 1; |
451 | ret = a - (b >> shift); | 451 | ret = a - (b >> shift); |
@@ -453,7 +453,7 @@ static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3 | |||
453 | } | 453 | } |
454 | 454 | ||
455 | #undef silk_RSHIFT_ROUND | 455 | #undef silk_RSHIFT_ROUND |
456 | static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ | 456 | static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ |
457 | opus_int32 ret; | 457 | opus_int32 ret; |
458 | ops_count += 3; | 458 | ops_count += 3; |
459 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; | 459 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; |
@@ -461,7 +461,7 @@ static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ | |||
461 | } | 461 | } |
462 | 462 | ||
463 | #undef silk_RSHIFT_ROUND64 | 463 | #undef silk_RSHIFT_ROUND64 |
464 | static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ | 464 | static OPUS_INLINE opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ |
465 | opus_int64 ret; | 465 | opus_int64 ret; |
466 | ops_count += 6; | 466 | ops_count += 6; |
467 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; | 467 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; |
@@ -469,13 +469,13 @@ static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ | |||
469 | } | 469 | } |
470 | 470 | ||
471 | #undef silk_abs_int64 | 471 | #undef silk_abs_int64 |
472 | static inline opus_int64 silk_abs_int64(opus_int64 a){ | 472 | static OPUS_INLINE opus_int64 silk_abs_int64(opus_int64 a){ |
473 | ops_count += 1; | 473 | ops_count += 1; |
474 | return (((a) > 0) ? (a) : -(a)); /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN*/ | 474 | return (((a) > 0) ? (a) : -(a)); /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN*/ |
475 | } | 475 | } |
476 | 476 | ||
477 | #undef silk_abs_int32 | 477 | #undef silk_abs_int32 |
478 | static inline opus_int32 silk_abs_int32(opus_int32 a){ | 478 | static OPUS_INLINE opus_int32 silk_abs_int32(opus_int32 a){ |
479 | ops_count += 1; | 479 | ops_count += 1; |
480 | return silk_abs(a); | 480 | return silk_abs(a); |
481 | } | 481 | } |
@@ -498,7 +498,7 @@ static silk_sign(a){ | |||
498 | } | 498 | } |
499 | 499 | ||
500 | #undef silk_ADD16 | 500 | #undef silk_ADD16 |
501 | static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ | 501 | static OPUS_INLINE opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ |
502 | opus_int16 ret; | 502 | opus_int16 ret; |
503 | ops_count += 1; | 503 | ops_count += 1; |
504 | ret = a + b; | 504 | ret = a + b; |
@@ -506,7 +506,7 @@ static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ | |||
506 | } | 506 | } |
507 | 507 | ||
508 | #undef silk_ADD32 | 508 | #undef silk_ADD32 |
509 | static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ | 509 | static OPUS_INLINE opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ |
510 | opus_int32 ret; | 510 | opus_int32 ret; |
511 | ops_count += 1; | 511 | ops_count += 1; |
512 | ret = a + b; | 512 | ret = a + b; |
@@ -514,7 +514,7 @@ static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ | |||
514 | } | 514 | } |
515 | 515 | ||
516 | #undef silk_ADD64 | 516 | #undef silk_ADD64 |
517 | static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ | 517 | static OPUS_INLINE opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ |
518 | opus_int64 ret; | 518 | opus_int64 ret; |
519 | ops_count += 2; | 519 | ops_count += 2; |
520 | ret = a + b; | 520 | ret = a + b; |
@@ -522,7 +522,7 @@ static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ | |||
522 | } | 522 | } |
523 | 523 | ||
524 | #undef silk_SUB16 | 524 | #undef silk_SUB16 |
525 | static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ | 525 | static OPUS_INLINE opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ |
526 | opus_int16 ret; | 526 | opus_int16 ret; |
527 | ops_count += 1; | 527 | ops_count += 1; |
528 | ret = a - b; | 528 | ret = a - b; |
@@ -530,7 +530,7 @@ static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ | |||
530 | } | 530 | } |
531 | 531 | ||
532 | #undef silk_SUB32 | 532 | #undef silk_SUB32 |
533 | static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ | 533 | static OPUS_INLINE opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ |
534 | opus_int32 ret; | 534 | opus_int32 ret; |
535 | ops_count += 1; | 535 | ops_count += 1; |
536 | ret = a - b; | 536 | ret = a - b; |
@@ -538,7 +538,7 @@ static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ | |||
538 | } | 538 | } |
539 | 539 | ||
540 | #undef silk_SUB64 | 540 | #undef silk_SUB64 |
541 | static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){ | 541 | static OPUS_INLINE opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){ |
542 | opus_int64 ret; | 542 | opus_int64 ret; |
543 | ops_count += 2; | 543 | ops_count += 2; |
544 | ret = a - b; | 544 | ret = a - b; |
@@ -546,7 +546,7 @@ static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){ | |||
546 | } | 546 | } |
547 | 547 | ||
548 | #undef silk_ADD_SAT16 | 548 | #undef silk_ADD_SAT16 |
549 | static inline opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { | 549 | static OPUS_INLINE opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { |
550 | opus_int16 res; | 550 | opus_int16 res; |
551 | /* Nb will be counted in AKP_add32 and silk_SAT16*/ | 551 | /* Nb will be counted in AKP_add32 and silk_SAT16*/ |
552 | res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); | 552 | res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); |
@@ -554,7 +554,7 @@ static inline opus_int16 silk_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { | |||
554 | } | 554 | } |
555 | 555 | ||
556 | #undef silk_ADD_SAT32 | 556 | #undef silk_ADD_SAT32 |
557 | static inline opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){ | 557 | static OPUS_INLINE opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){ |
558 | opus_int32 res; | 558 | opus_int32 res; |
559 | ops_count += 1; | 559 | ops_count += 1; |
560 | res = ((((a32) + (b32)) & 0x80000000) == 0 ? \ | 560 | res = ((((a32) + (b32)) & 0x80000000) == 0 ? \ |
@@ -564,7 +564,7 @@ static inline opus_int32 silk_ADD_SAT32(opus_int32 a32, opus_int32 b32){ | |||
564 | } | 564 | } |
565 | 565 | ||
566 | #undef silk_ADD_SAT64 | 566 | #undef silk_ADD_SAT64 |
567 | static inline opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { | 567 | static OPUS_INLINE opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { |
568 | opus_int64 res; | 568 | opus_int64 res; |
569 | ops_count += 1; | 569 | ops_count += 1; |
570 | res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ | 570 | res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ |
@@ -574,7 +574,7 @@ static inline opus_int64 silk_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { | |||
574 | } | 574 | } |
575 | 575 | ||
576 | #undef silk_SUB_SAT16 | 576 | #undef silk_SUB_SAT16 |
577 | static inline opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { | 577 | static OPUS_INLINE opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { |
578 | opus_int16 res; | 578 | opus_int16 res; |
579 | silk_assert(0); | 579 | silk_assert(0); |
580 | /* Nb will be counted in sub-macros*/ | 580 | /* Nb will be counted in sub-macros*/ |
@@ -583,7 +583,7 @@ static inline opus_int16 silk_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { | |||
583 | } | 583 | } |
584 | 584 | ||
585 | #undef silk_SUB_SAT32 | 585 | #undef silk_SUB_SAT32 |
586 | static inline opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { | 586 | static OPUS_INLINE opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { |
587 | opus_int32 res; | 587 | opus_int32 res; |
588 | ops_count += 1; | 588 | ops_count += 1; |
589 | res = ((((a32)-(b32)) & 0x80000000) == 0 ? \ | 589 | res = ((((a32)-(b32)) & 0x80000000) == 0 ? \ |
@@ -593,7 +593,7 @@ static inline opus_int32 silk_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { | |||
593 | } | 593 | } |
594 | 594 | ||
595 | #undef silk_SUB_SAT64 | 595 | #undef silk_SUB_SAT64 |
596 | static inline opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { | 596 | static OPUS_INLINE opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { |
597 | opus_int64 res; | 597 | opus_int64 res; |
598 | ops_count += 1; | 598 | ops_count += 1; |
599 | res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ | 599 | res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ |
@@ -604,7 +604,7 @@ static inline opus_int64 silk_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { | |||
604 | } | 604 | } |
605 | 605 | ||
606 | #undef silk_SMULWW | 606 | #undef silk_SMULWW |
607 | static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ | 607 | static OPUS_INLINE opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ |
608 | opus_int32 ret; | 608 | opus_int32 ret; |
609 | /* Nb will be counted in sub-macros*/ | 609 | /* Nb will be counted in sub-macros*/ |
610 | ret = silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)); | 610 | ret = silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)); |
@@ -612,7 +612,7 @@ static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ | |||
612 | } | 612 | } |
613 | 613 | ||
614 | #undef silk_SMLAWW | 614 | #undef silk_SMLAWW |
615 | static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ | 615 | static OPUS_INLINE opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ |
616 | opus_int32 ret; | 616 | opus_int32 ret; |
617 | /* Nb will be counted in sub-macros*/ | 617 | /* Nb will be counted in sub-macros*/ |
618 | ret = silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16)); | 618 | ret = silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16)); |
@@ -620,26 +620,26 @@ static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 | |||
620 | } | 620 | } |
621 | 621 | ||
622 | #undef silk_min_int | 622 | #undef silk_min_int |
623 | static inline opus_int silk_min_int(opus_int a, opus_int b) | 623 | static OPUS_INLINE opus_int silk_min_int(opus_int a, opus_int b) |
624 | { | 624 | { |
625 | ops_count += 1; | 625 | ops_count += 1; |
626 | return (((a) < (b)) ? (a) : (b)); | 626 | return (((a) < (b)) ? (a) : (b)); |
627 | } | 627 | } |
628 | 628 | ||
629 | #undef silk_min_16 | 629 | #undef silk_min_16 |
630 | static inline opus_int16 silk_min_16(opus_int16 a, opus_int16 b) | 630 | static OPUS_INLINE opus_int16 silk_min_16(opus_int16 a, opus_int16 b) |
631 | { | 631 | { |
632 | ops_count += 1; | 632 | ops_count += 1; |
633 | return (((a) < (b)) ? (a) : (b)); | 633 | return (((a) < (b)) ? (a) : (b)); |
634 | } | 634 | } |
635 | #undef silk_min_32 | 635 | #undef silk_min_32 |
636 | static inline opus_int32 silk_min_32(opus_int32 a, opus_int32 b) | 636 | static OPUS_INLINE opus_int32 silk_min_32(opus_int32 a, opus_int32 b) |
637 | { | 637 | { |
638 | ops_count += 1; | 638 | ops_count += 1; |
639 | return (((a) < (b)) ? (a) : (b)); | 639 | return (((a) < (b)) ? (a) : (b)); |
640 | } | 640 | } |
641 | #undef silk_min_64 | 641 | #undef silk_min_64 |
642 | static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) | 642 | static OPUS_INLINE opus_int64 silk_min_64(opus_int64 a, opus_int64 b) |
643 | { | 643 | { |
644 | ops_count += 1; | 644 | ops_count += 1; |
645 | return (((a) < (b)) ? (a) : (b)); | 645 | return (((a) < (b)) ? (a) : (b)); |
@@ -647,26 +647,26 @@ static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) | |||
647 | 647 | ||
648 | /* silk_min() versions with typecast in the function call */ | 648 | /* silk_min() versions with typecast in the function call */ |
649 | #undef silk_max_int | 649 | #undef silk_max_int |
650 | static inline opus_int silk_max_int(opus_int a, opus_int b) | 650 | static OPUS_INLINE opus_int silk_max_int(opus_int a, opus_int b) |
651 | { | 651 | { |
652 | ops_count += 1; | 652 | ops_count += 1; |
653 | return (((a) > (b)) ? (a) : (b)); | 653 | return (((a) > (b)) ? (a) : (b)); |
654 | } | 654 | } |
655 | #undef silk_max_16 | 655 | #undef silk_max_16 |
656 | static inline opus_int16 silk_max_16(opus_int16 a, opus_int16 b) | 656 | static OPUS_INLINE opus_int16 silk_max_16(opus_int16 a, opus_int16 b) |
657 | { | 657 | { |
658 | ops_count += 1; | 658 | ops_count += 1; |
659 | return (((a) > (b)) ? (a) : (b)); | 659 | return (((a) > (b)) ? (a) : (b)); |
660 | } | 660 | } |
661 | #undef silk_max_32 | 661 | #undef silk_max_32 |
662 | static inline opus_int32 silk_max_32(opus_int32 a, opus_int32 b) | 662 | static OPUS_INLINE opus_int32 silk_max_32(opus_int32 a, opus_int32 b) |
663 | { | 663 | { |
664 | ops_count += 1; | 664 | ops_count += 1; |
665 | return (((a) > (b)) ? (a) : (b)); | 665 | return (((a) > (b)) ? (a) : (b)); |
666 | } | 666 | } |
667 | 667 | ||
668 | #undef silk_max_64 | 668 | #undef silk_max_64 |
669 | static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) | 669 | static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b) |
670 | { | 670 | { |
671 | ops_count += 1; | 671 | ops_count += 1; |
672 | return (((a) > (b)) ? (a) : (b)); | 672 | return (((a) > (b)) ? (a) : (b)); |
@@ -674,7 +674,7 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) | |||
674 | 674 | ||
675 | 675 | ||
676 | #undef silk_LIMIT_int | 676 | #undef silk_LIMIT_int |
677 | static inline opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limit2) | 677 | static OPUS_INLINE opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limit2) |
678 | { | 678 | { |
679 | opus_int ret; | 679 | opus_int ret; |
680 | ops_count += 6; | 680 | ops_count += 6; |
@@ -686,7 +686,7 @@ static inline opus_int silk_LIMIT_int(opus_int a, opus_int limit1, opus_int limi | |||
686 | } | 686 | } |
687 | 687 | ||
688 | #undef silk_LIMIT_16 | 688 | #undef silk_LIMIT_16 |
689 | static inline opus_int16 silk_LIMIT_16(opus_int16 a, opus_int16 limit1, opus_int16 limit2) | 689 | static OPUS_INLINE opus_int16 silk_LIMIT_16(opus_int16 a, opus_int16 limit1, opus_int16 limit2) |
690 | { | 690 | { |
691 | opus_int16 ret; | 691 | opus_int16 ret; |
692 | ops_count += 6; | 692 | ops_count += 6; |
@@ -699,7 +699,7 @@ return(ret); | |||
699 | 699 | ||
700 | 700 | ||
701 | #undef silk_LIMIT_32 | 701 | #undef silk_LIMIT_32 |
702 | static inline opus_int silk_LIMIT_32(opus_int32 a, opus_int32 limit1, opus_int32 limit2) | 702 | static OPUS_INLINE opus_int silk_LIMIT_32(opus_int32 a, opus_int32 limit1, opus_int32 limit2) |
703 | { | 703 | { |
704 | opus_int32 ret; | 704 | opus_int32 ret; |
705 | ops_count += 6; | 705 | ops_count += 6; |
diff --git a/lib/rbcodec/codecs/libopus/silk/MacroDebug.h b/lib/rbcodec/codecs/libopus/silk/MacroDebug.h index d3d84b6caa..35aedc5c5f 100644 --- a/lib/rbcodec/codecs/libopus/silk/MacroDebug.h +++ b/lib/rbcodec/codecs/libopus/silk/MacroDebug.h | |||
@@ -9,7 +9,7 @@ this list of conditions and the following disclaimer. | |||
9 | - Redistributions in binary form must reproduce the above copyright | 9 | - Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the | 10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. | 11 | documentation and/or other materials provided with the distribution. |
12 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 12 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
13 | names of specific contributors, may be used to endorse or promote | 13 | names of specific contributors, may be used to endorse or promote |
14 | products derived from this software without specific prior written | 14 | products derived from this software without specific prior written |
15 | permission. | 15 | permission. |
@@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
36 | 36 | ||
37 | #undef silk_ADD16 | 37 | #undef silk_ADD16 |
38 | #define silk_ADD16(a,b) silk_ADD16_((a), (b), __FILE__, __LINE__) | 38 | #define silk_ADD16(a,b) silk_ADD16_((a), (b), __FILE__, __LINE__) |
39 | static inline opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int line){ | 39 | static OPUS_INLINE opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int line){ |
40 | opus_int16 ret; | 40 | opus_int16 ret; |
41 | 41 | ||
42 | ret = a + b; | 42 | ret = a + b; |
@@ -52,7 +52,7 @@ static inline opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file, int | |||
52 | 52 | ||
53 | #undef silk_ADD32 | 53 | #undef silk_ADD32 |
54 | #define silk_ADD32(a,b) silk_ADD32_((a), (b), __FILE__, __LINE__) | 54 | #define silk_ADD32(a,b) silk_ADD32_((a), (b), __FILE__, __LINE__) |
55 | static inline opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int line){ | 55 | static OPUS_INLINE opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int line){ |
56 | opus_int32 ret; | 56 | opus_int32 ret; |
57 | 57 | ||
58 | ret = a + b; | 58 | ret = a + b; |
@@ -68,7 +68,7 @@ static inline opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int | |||
68 | 68 | ||
69 | #undef silk_ADD64 | 69 | #undef silk_ADD64 |
70 | #define silk_ADD64(a,b) silk_ADD64_((a), (b), __FILE__, __LINE__) | 70 | #define silk_ADD64(a,b) silk_ADD64_((a), (b), __FILE__, __LINE__) |
71 | static inline opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int line){ | 71 | static OPUS_INLINE opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int line){ |
72 | opus_int64 ret; | 72 | opus_int64 ret; |
73 | 73 | ||
74 | ret = a + b; | 74 | ret = a + b; |
@@ -84,7 +84,7 @@ static inline opus_int64 silk_ADD64_(opus_int64 a, opus_int64 b, char *file, int | |||
84 | 84 | ||
85 | #undef silk_SUB16 | 85 | #undef silk_SUB16 |
86 | #define silk_SUB16(a,b) silk_SUB16_((a), (b), __FILE__, __LINE__) | 86 | #define silk_SUB16(a,b) silk_SUB16_((a), (b), __FILE__, __LINE__) |
87 | static inline opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int line){ | 87 | static OPUS_INLINE opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int line){ |
88 | opus_int16 ret; | 88 | opus_int16 ret; |
89 | 89 | ||
90 | ret = a - b; | 90 | ret = a - b; |
@@ -100,7 +100,7 @@ static inline opus_int16 silk_SUB16_(opus_int16 a, opus_int16 b, char *file, int | |||
100 | 100 | ||
101 | #undef silk_SUB32 | 101 | #undef silk_SUB32 |
102 | #define silk_SUB32(a,b) silk_SUB32_((a), (b), __FILE__, __LINE__) | 102 | #define silk_SUB32(a,b) silk_SUB32_((a), (b), __FILE__, __LINE__) |
103 | static inline opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int line){ | 103 | static OPUS_INLINE opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int line){ |
104 | opus_int32 ret; | 104 | opus_int32 ret; |
105 | 105 | ||
106 | ret = a - b; | 106 | ret = a - b; |
@@ -116,7 +116,7 @@ static inline opus_int32 silk_SUB32_(opus_int32 a, opus_int32 b, char *file, int | |||
116 | 116 | ||
117 | #undef silk_SUB64 | 117 | #undef silk_SUB64 |
118 | #define silk_SUB64(a,b) silk_SUB64_((a), (b), __FILE__, __LINE__) | 118 | #define silk_SUB64(a,b) silk_SUB64_((a), (b), __FILE__, __LINE__) |
119 | static inline opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int line){ | 119 | static OPUS_INLINE opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int line){ |
120 | opus_int64 ret; | 120 | opus_int64 ret; |
121 | 121 | ||
122 | ret = a - b; | 122 | ret = a - b; |
@@ -132,7 +132,7 @@ static inline opus_int64 silk_SUB64_(opus_int64 a, opus_int64 b, char *file, int | |||
132 | 132 | ||
133 | #undef silk_ADD_SAT16 | 133 | #undef silk_ADD_SAT16 |
134 | #define silk_ADD_SAT16(a,b) silk_ADD_SAT16_((a), (b), __FILE__, __LINE__) | 134 | #define silk_ADD_SAT16(a,b) silk_ADD_SAT16_((a), (b), __FILE__, __LINE__) |
135 | static inline opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line) { | 135 | static OPUS_INLINE opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line) { |
136 | opus_int16 res; | 136 | opus_int16 res; |
137 | res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); | 137 | res = (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a16), (b16) ) ); |
138 | if ( res != silk_SAT16( (opus_int32)a16 + (opus_int32)b16 ) ) | 138 | if ( res != silk_SAT16( (opus_int32)a16 + (opus_int32)b16 ) ) |
@@ -147,7 +147,7 @@ static inline opus_int16 silk_ADD_SAT16_( opus_int16 a16, opus_int16 b16, char * | |||
147 | 147 | ||
148 | #undef silk_ADD_SAT32 | 148 | #undef silk_ADD_SAT32 |
149 | #define silk_ADD_SAT32(a,b) silk_ADD_SAT32_((a), (b), __FILE__, __LINE__) | 149 | #define silk_ADD_SAT32(a,b) silk_ADD_SAT32_((a), (b), __FILE__, __LINE__) |
150 | static inline opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 150 | static OPUS_INLINE opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
151 | opus_int32 res; | 151 | opus_int32 res; |
152 | res = ((((opus_uint32)(a32) + (opus_uint32)(b32)) & 0x80000000) == 0 ? \ | 152 | res = ((((opus_uint32)(a32) + (opus_uint32)(b32)) & 0x80000000) == 0 ? \ |
153 | ((((a32) & (b32)) & 0x80000000) != 0 ? silk_int32_MIN : (a32)+(b32)) : \ | 153 | ((((a32) & (b32)) & 0x80000000) != 0 ? silk_int32_MIN : (a32)+(b32)) : \ |
@@ -164,7 +164,7 @@ static inline opus_int32 silk_ADD_SAT32_(opus_int32 a32, opus_int32 b32, char *f | |||
164 | 164 | ||
165 | #undef silk_ADD_SAT64 | 165 | #undef silk_ADD_SAT64 |
166 | #define silk_ADD_SAT64(a,b) silk_ADD_SAT64_((a), (b), __FILE__, __LINE__) | 166 | #define silk_ADD_SAT64(a,b) silk_ADD_SAT64_((a), (b), __FILE__, __LINE__) |
167 | static inline opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line) { | 167 | static OPUS_INLINE opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line) { |
168 | opus_int64 res; | 168 | opus_int64 res; |
169 | int fail = 0; | 169 | int fail = 0; |
170 | res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ | 170 | res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ |
@@ -193,7 +193,7 @@ static inline opus_int64 silk_ADD_SAT64_( opus_int64 a64, opus_int64 b64, char * | |||
193 | 193 | ||
194 | #undef silk_SUB_SAT16 | 194 | #undef silk_SUB_SAT16 |
195 | #define silk_SUB_SAT16(a,b) silk_SUB_SAT16_((a), (b), __FILE__, __LINE__) | 195 | #define silk_SUB_SAT16(a,b) silk_SUB_SAT16_((a), (b), __FILE__, __LINE__) |
196 | static inline opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line ) { | 196 | static OPUS_INLINE opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char *file, int line ) { |
197 | opus_int16 res; | 197 | opus_int16 res; |
198 | res = (opus_int16)silk_SAT16( silk_SUB32( (opus_int32)(a16), (b16) ) ); | 198 | res = (opus_int16)silk_SAT16( silk_SUB32( (opus_int32)(a16), (b16) ) ); |
199 | if ( res != silk_SAT16( (opus_int32)a16 - (opus_int32)b16 ) ) | 199 | if ( res != silk_SAT16( (opus_int32)a16 - (opus_int32)b16 ) ) |
@@ -208,7 +208,7 @@ static inline opus_int16 silk_SUB_SAT16_( opus_int16 a16, opus_int16 b16, char * | |||
208 | 208 | ||
209 | #undef silk_SUB_SAT32 | 209 | #undef silk_SUB_SAT32 |
210 | #define silk_SUB_SAT32(a,b) silk_SUB_SAT32_((a), (b), __FILE__, __LINE__) | 210 | #define silk_SUB_SAT32(a,b) silk_SUB_SAT32_((a), (b), __FILE__, __LINE__) |
211 | static inline opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char *file, int line ) { | 211 | static OPUS_INLINE opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char *file, int line ) { |
212 | opus_int32 res; | 212 | opus_int32 res; |
213 | res = ((((opus_uint32)(a32)-(opus_uint32)(b32)) & 0x80000000) == 0 ? \ | 213 | res = ((((opus_uint32)(a32)-(opus_uint32)(b32)) & 0x80000000) == 0 ? \ |
214 | (( (a32) & ((b32)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a32)-(b32)) : \ | 214 | (( (a32) & ((b32)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a32)-(b32)) : \ |
@@ -225,7 +225,7 @@ static inline opus_int32 silk_SUB_SAT32_( opus_int32 a32, opus_int32 b32, char * | |||
225 | 225 | ||
226 | #undef silk_SUB_SAT64 | 226 | #undef silk_SUB_SAT64 |
227 | #define silk_SUB_SAT64(a,b) silk_SUB_SAT64_((a), (b), __FILE__, __LINE__) | 227 | #define silk_SUB_SAT64(a,b) silk_SUB_SAT64_((a), (b), __FILE__, __LINE__) |
228 | static inline opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line ) { | 228 | static OPUS_INLINE opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char *file, int line ) { |
229 | opus_int64 res; | 229 | opus_int64 res; |
230 | int fail = 0; | 230 | int fail = 0; |
231 | res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ | 231 | res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ |
@@ -254,7 +254,7 @@ static inline opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, char * | |||
254 | 254 | ||
255 | #undef silk_MUL | 255 | #undef silk_MUL |
256 | #define silk_MUL(a,b) silk_MUL_((a), (b), __FILE__, __LINE__) | 256 | #define silk_MUL(a,b) silk_MUL_((a), (b), __FILE__, __LINE__) |
257 | static inline opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 257 | static OPUS_INLINE opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
258 | opus_int32 ret; | 258 | opus_int32 ret; |
259 | opus_int64 ret64; | 259 | opus_int64 ret64; |
260 | ret = a32 * b32; | 260 | ret = a32 * b32; |
@@ -271,7 +271,7 @@ static inline opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, i | |||
271 | 271 | ||
272 | #undef silk_MUL_uint | 272 | #undef silk_MUL_uint |
273 | #define silk_MUL_uint(a,b) silk_MUL_uint_((a), (b), __FILE__, __LINE__) | 273 | #define silk_MUL_uint(a,b) silk_MUL_uint_((a), (b), __FILE__, __LINE__) |
274 | static inline opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char *file, int line){ | 274 | static OPUS_INLINE opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char *file, int line){ |
275 | opus_uint32 ret; | 275 | opus_uint32 ret; |
276 | ret = a32 * b32; | 276 | ret = a32 * b32; |
277 | if ( (opus_uint64)ret != (opus_uint64)a32 * (opus_uint64)b32 ) | 277 | if ( (opus_uint64)ret != (opus_uint64)a32 * (opus_uint64)b32 ) |
@@ -286,7 +286,7 @@ static inline opus_uint32 silk_MUL_uint_(opus_uint32 a32, opus_uint32 b32, char | |||
286 | 286 | ||
287 | #undef silk_MLA | 287 | #undef silk_MLA |
288 | #define silk_MLA(a,b,c) silk_MLA_((a), (b), (c), __FILE__, __LINE__) | 288 | #define silk_MLA(a,b,c) silk_MLA_((a), (b), (c), __FILE__, __LINE__) |
289 | static inline opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 289 | static OPUS_INLINE opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
290 | opus_int32 ret; | 290 | opus_int32 ret; |
291 | ret = a32 + b32 * c32; | 291 | ret = a32 + b32 * c32; |
292 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) | 292 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) |
@@ -301,7 +301,7 @@ static inline opus_int32 silk_MLA_(opus_int32 a32, opus_int32 b32, opus_int32 c3 | |||
301 | 301 | ||
302 | #undef silk_MLA_uint | 302 | #undef silk_MLA_uint |
303 | #define silk_MLA_uint(a,b,c) silk_MLA_uint_((a), (b), (c), __FILE__, __LINE__) | 303 | #define silk_MLA_uint(a,b,c) silk_MLA_uint_((a), (b), (c), __FILE__, __LINE__) |
304 | static inline opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32, char *file, int line){ | 304 | static OPUS_INLINE opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32, char *file, int line){ |
305 | opus_uint32 ret; | 305 | opus_uint32 ret; |
306 | ret = a32 + b32 * c32; | 306 | ret = a32 + b32 * c32; |
307 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) | 307 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32 ) |
@@ -316,7 +316,7 @@ static inline opus_int32 silk_MLA_uint_(opus_uint32 a32, opus_uint32 b32, opus_u | |||
316 | 316 | ||
317 | #undef silk_SMULWB | 317 | #undef silk_SMULWB |
318 | #define silk_SMULWB(a,b) silk_SMULWB_((a), (b), __FILE__, __LINE__) | 318 | #define silk_SMULWB(a,b) silk_SMULWB_((a), (b), __FILE__, __LINE__) |
319 | static inline opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 319 | static OPUS_INLINE opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
320 | opus_int32 ret; | 320 | opus_int32 ret; |
321 | ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); | 321 | ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); |
322 | if ( (opus_int64)ret != ((opus_int64)a32 * (opus_int16)b32) >> 16 ) | 322 | if ( (opus_int64)ret != ((opus_int64)a32 * (opus_int16)b32) >> 16 ) |
@@ -331,7 +331,7 @@ static inline opus_int32 silk_SMULWB_(opus_int32 a32, opus_int32 b32, char *file | |||
331 | 331 | ||
332 | #undef silk_SMLAWB | 332 | #undef silk_SMLAWB |
333 | #define silk_SMLAWB(a,b,c) silk_SMLAWB_((a), (b), (c), __FILE__, __LINE__) | 333 | #define silk_SMLAWB(a,b,c) silk_SMLAWB_((a), (b), (c), __FILE__, __LINE__) |
334 | static inline opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 334 | static OPUS_INLINE opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
335 | opus_int32 ret; | 335 | opus_int32 ret; |
336 | ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) ); | 336 | ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) ); |
337 | if ( silk_ADD32( a32, silk_SMULWB( b32, c32 ) ) != silk_ADD_SAT32( a32, silk_SMULWB( b32, c32 ) ) ) | 337 | if ( silk_ADD32( a32, silk_SMULWB( b32, c32 ) ) != silk_ADD_SAT32( a32, silk_SMULWB( b32, c32 ) ) ) |
@@ -346,7 +346,7 @@ static inline opus_int32 silk_SMLAWB_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
346 | 346 | ||
347 | #undef silk_SMULWT | 347 | #undef silk_SMULWT |
348 | #define silk_SMULWT(a,b) silk_SMULWT_((a), (b), __FILE__, __LINE__) | 348 | #define silk_SMULWT(a,b) silk_SMULWT_((a), (b), __FILE__, __LINE__) |
349 | static inline opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 349 | static OPUS_INLINE opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
350 | opus_int32 ret; | 350 | opus_int32 ret; |
351 | ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); | 351 | ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); |
352 | if ( (opus_int64)ret != ((opus_int64)a32 * (b32 >> 16)) >> 16 ) | 352 | if ( (opus_int64)ret != ((opus_int64)a32 * (b32 >> 16)) >> 16 ) |
@@ -361,7 +361,7 @@ static inline opus_int32 silk_SMULWT_(opus_int32 a32, opus_int32 b32, char *file | |||
361 | 361 | ||
362 | #undef silk_SMLAWT | 362 | #undef silk_SMLAWT |
363 | #define silk_SMLAWT(a,b,c) silk_SMLAWT_((a), (b), (c), __FILE__, __LINE__) | 363 | #define silk_SMLAWT(a,b,c) silk_SMLAWT_((a), (b), (c), __FILE__, __LINE__) |
364 | static inline opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 364 | static OPUS_INLINE opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
365 | opus_int32 ret; | 365 | opus_int32 ret; |
366 | ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); | 366 | ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); |
367 | if ( (opus_int64)ret != (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16) ) | 367 | if ( (opus_int64)ret != (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16) ) |
@@ -376,7 +376,7 @@ static inline opus_int32 silk_SMLAWT_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
376 | 376 | ||
377 | #undef silk_SMULL | 377 | #undef silk_SMULL |
378 | #define silk_SMULL(a,b) silk_SMULL_((a), (b), __FILE__, __LINE__) | 378 | #define silk_SMULL(a,b) silk_SMULL_((a), (b), __FILE__, __LINE__) |
379 | static inline opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file, int line){ | 379 | static OPUS_INLINE opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file, int line){ |
380 | opus_int64 ret64; | 380 | opus_int64 ret64; |
381 | int fail = 0; | 381 | int fail = 0; |
382 | ret64 = a64 * b64; | 382 | ret64 = a64 * b64; |
@@ -398,7 +398,7 @@ static inline opus_int64 silk_SMULL_(opus_int64 a64, opus_int64 b64, char *file, | |||
398 | /* no checking needed for silk_SMULBB */ | 398 | /* no checking needed for silk_SMULBB */ |
399 | #undef silk_SMLABB | 399 | #undef silk_SMLABB |
400 | #define silk_SMLABB(a,b,c) silk_SMLABB_((a), (b), (c), __FILE__, __LINE__) | 400 | #define silk_SMLABB(a,b,c) silk_SMLABB_((a), (b), (c), __FILE__, __LINE__) |
401 | static inline opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 401 | static OPUS_INLINE opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
402 | opus_int32 ret; | 402 | opus_int32 ret; |
403 | ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); | 403 | ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); |
404 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32 ) | 404 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32 ) |
@@ -414,7 +414,7 @@ static inline opus_int32 silk_SMLABB_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
414 | /* no checking needed for silk_SMULBT */ | 414 | /* no checking needed for silk_SMULBT */ |
415 | #undef silk_SMLABT | 415 | #undef silk_SMLABT |
416 | #define silk_SMLABT(a,b,c) silk_SMLABT_((a), (b), (c), __FILE__, __LINE__) | 416 | #define silk_SMLABT(a,b,c) silk_SMLABT_((a), (b), (c), __FILE__, __LINE__) |
417 | static inline opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 417 | static OPUS_INLINE opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
418 | opus_int32 ret; | 418 | opus_int32 ret; |
419 | ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); | 419 | ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); |
420 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16) ) | 420 | if ( (opus_int64)ret != (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16) ) |
@@ -430,7 +430,7 @@ static inline opus_int32 silk_SMLABT_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
430 | /* no checking needed for silk_SMULTT */ | 430 | /* no checking needed for silk_SMULTT */ |
431 | #undef silk_SMLATT | 431 | #undef silk_SMLATT |
432 | #define silk_SMLATT(a,b,c) silk_SMLATT_((a), (b), (c), __FILE__, __LINE__) | 432 | #define silk_SMLATT(a,b,c) silk_SMLATT_((a), (b), (c), __FILE__, __LINE__) |
433 | static inline opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 433 | static OPUS_INLINE opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
434 | opus_int32 ret; | 434 | opus_int32 ret; |
435 | ret = a32 + (b32 >> 16) * (c32 >> 16); | 435 | ret = a32 + (b32 >> 16) * (c32 >> 16); |
436 | if ( (opus_int64)ret != (opus_int64)a32 + (b32 >> 16) * (c32 >> 16) ) | 436 | if ( (opus_int64)ret != (opus_int64)a32 + (b32 >> 16) * (c32 >> 16) ) |
@@ -445,7 +445,7 @@ static inline opus_int32 silk_SMLATT_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
445 | 445 | ||
446 | #undef silk_SMULWW | 446 | #undef silk_SMULWW |
447 | #define silk_SMULWW(a,b) silk_SMULWW_((a), (b), __FILE__, __LINE__) | 447 | #define silk_SMULWW(a,b) silk_SMULWW_((a), (b), __FILE__, __LINE__) |
448 | static inline opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 448 | static OPUS_INLINE opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
449 | opus_int32 ret, tmp1, tmp2; | 449 | opus_int32 ret, tmp1, tmp2; |
450 | opus_int64 ret64; | 450 | opus_int64 ret64; |
451 | int fail = 0; | 451 | int fail = 0; |
@@ -476,7 +476,7 @@ static inline opus_int32 silk_SMULWW_(opus_int32 a32, opus_int32 b32, char *file | |||
476 | 476 | ||
477 | #undef silk_SMLAWW | 477 | #undef silk_SMLAWW |
478 | #define silk_SMLAWW(a,b,c) silk_SMLAWW_((a), (b), (c), __FILE__, __LINE__) | 478 | #define silk_SMLAWW(a,b,c) silk_SMLAWW_((a), (b), (c), __FILE__, __LINE__) |
479 | static inline opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ | 479 | static OPUS_INLINE opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32 c32, char *file, int line){ |
480 | opus_int32 ret, tmp; | 480 | opus_int32 ret, tmp; |
481 | 481 | ||
482 | tmp = silk_SMULWW( b32, c32 ); | 482 | tmp = silk_SMULWW( b32, c32 ); |
@@ -505,7 +505,7 @@ static inline opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_int32 | |||
505 | 505 | ||
506 | #undef silk_DIV32 | 506 | #undef silk_DIV32 |
507 | #define silk_DIV32(a,b) silk_DIV32_((a), (b), __FILE__, __LINE__) | 507 | #define silk_DIV32(a,b) silk_DIV32_((a), (b), __FILE__, __LINE__) |
508 | static inline opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 508 | static OPUS_INLINE opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
509 | if ( b32 == 0 ) | 509 | if ( b32 == 0 ) |
510 | { | 510 | { |
511 | fprintf (stderr, "silk_DIV32(%d, %d) in %s: line %d\n", a32, b32, file, line); | 511 | fprintf (stderr, "silk_DIV32(%d, %d) in %s: line %d\n", a32, b32, file, line); |
@@ -518,7 +518,7 @@ static inline opus_int32 silk_DIV32_(opus_int32 a32, opus_int32 b32, char *file, | |||
518 | 518 | ||
519 | #undef silk_DIV32_16 | 519 | #undef silk_DIV32_16 |
520 | #define silk_DIV32_16(a,b) silk_DIV32_16_((a), (b), __FILE__, __LINE__) | 520 | #define silk_DIV32_16(a,b) silk_DIV32_16_((a), (b), __FILE__, __LINE__) |
521 | static inline opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *file, int line){ | 521 | static OPUS_INLINE opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *file, int line){ |
522 | int fail = 0; | 522 | int fail = 0; |
523 | fail |= b32 == 0; | 523 | fail |= b32 == 0; |
524 | fail |= b32 > silk_int16_MAX; | 524 | fail |= b32 > silk_int16_MAX; |
@@ -544,7 +544,7 @@ static inline opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, char *fi | |||
544 | 544 | ||
545 | #undef silk_LSHIFT8 | 545 | #undef silk_LSHIFT8 |
546 | #define silk_LSHIFT8(a,b) silk_LSHIFT8_((a), (b), __FILE__, __LINE__) | 546 | #define silk_LSHIFT8(a,b) silk_LSHIFT8_((a), (b), __FILE__, __LINE__) |
547 | static inline opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ | 547 | static OPUS_INLINE opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ |
548 | opus_int8 ret; | 548 | opus_int8 ret; |
549 | int fail = 0; | 549 | int fail = 0; |
550 | ret = a << shift; | 550 | ret = a << shift; |
@@ -563,7 +563,7 @@ static inline opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, | |||
563 | 563 | ||
564 | #undef silk_LSHIFT16 | 564 | #undef silk_LSHIFT16 |
565 | #define silk_LSHIFT16(a,b) silk_LSHIFT16_((a), (b), __FILE__, __LINE__) | 565 | #define silk_LSHIFT16(a,b) silk_LSHIFT16_((a), (b), __FILE__, __LINE__) |
566 | static inline opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ | 566 | static OPUS_INLINE opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ |
567 | opus_int16 ret; | 567 | opus_int16 ret; |
568 | int fail = 0; | 568 | int fail = 0; |
569 | ret = a << shift; | 569 | ret = a << shift; |
@@ -582,7 +582,7 @@ static inline opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *fi | |||
582 | 582 | ||
583 | #undef silk_LSHIFT32 | 583 | #undef silk_LSHIFT32 |
584 | #define silk_LSHIFT32(a,b) silk_LSHIFT32_((a), (b), __FILE__, __LINE__) | 584 | #define silk_LSHIFT32(a,b) silk_LSHIFT32_((a), (b), __FILE__, __LINE__) |
585 | static inline opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ | 585 | static OPUS_INLINE opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ |
586 | opus_int32 ret; | 586 | opus_int32 ret; |
587 | int fail = 0; | 587 | int fail = 0; |
588 | ret = a << shift; | 588 | ret = a << shift; |
@@ -601,7 +601,7 @@ static inline opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *fi | |||
601 | 601 | ||
602 | #undef silk_LSHIFT64 | 602 | #undef silk_LSHIFT64 |
603 | #define silk_LSHIFT64(a,b) silk_LSHIFT64_((a), (b), __FILE__, __LINE__) | 603 | #define silk_LSHIFT64(a,b) silk_LSHIFT64_((a), (b), __FILE__, __LINE__) |
604 | static inline opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file, int line){ | 604 | static OPUS_INLINE opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file, int line){ |
605 | opus_int64 ret; | 605 | opus_int64 ret; |
606 | int fail = 0; | 606 | int fail = 0; |
607 | ret = a << shift; | 607 | ret = a << shift; |
@@ -620,7 +620,7 @@ static inline opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file | |||
620 | 620 | ||
621 | #undef silk_LSHIFT_ovflw | 621 | #undef silk_LSHIFT_ovflw |
622 | #define silk_LSHIFT_ovflw(a,b) silk_LSHIFT_ovflw_((a), (b), __FILE__, __LINE__) | 622 | #define silk_LSHIFT_ovflw(a,b) silk_LSHIFT_ovflw_((a), (b), __FILE__, __LINE__) |
623 | static inline opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char *file, int line){ | 623 | static OPUS_INLINE opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char *file, int line){ |
624 | if ( (shift < 0) || (shift >= 32) ) /* no check for overflow */ | 624 | if ( (shift < 0) || (shift >= 32) ) /* no check for overflow */ |
625 | { | 625 | { |
626 | fprintf (stderr, "silk_LSHIFT_ovflw(%d, %d) in %s: line %d\n", a, shift, file, line); | 626 | fprintf (stderr, "silk_LSHIFT_ovflw(%d, %d) in %s: line %d\n", a, shift, file, line); |
@@ -633,7 +633,7 @@ static inline opus_int32 silk_LSHIFT_ovflw_(opus_int32 a, opus_int32 shift, char | |||
633 | 633 | ||
634 | #undef silk_LSHIFT_uint | 634 | #undef silk_LSHIFT_uint |
635 | #define silk_LSHIFT_uint(a,b) silk_LSHIFT_uint_((a), (b), __FILE__, __LINE__) | 635 | #define silk_LSHIFT_uint(a,b) silk_LSHIFT_uint_((a), (b), __FILE__, __LINE__) |
636 | static inline opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ | 636 | static OPUS_INLINE opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ |
637 | opus_uint32 ret; | 637 | opus_uint32 ret; |
638 | ret = a << shift; | 638 | ret = a << shift; |
639 | if ( (shift < 0) || ((opus_int64)ret != ((opus_int64)a) << shift)) | 639 | if ( (shift < 0) || ((opus_int64)ret != ((opus_int64)a) << shift)) |
@@ -648,7 +648,7 @@ static inline opus_uint32 silk_LSHIFT_uint_(opus_uint32 a, opus_int32 shift, cha | |||
648 | 648 | ||
649 | #undef silk_RSHIFT8 | 649 | #undef silk_RSHIFT8 |
650 | #define silk_RSHITF8(a,b) silk_RSHIFT8_((a), (b), __FILE__, __LINE__) | 650 | #define silk_RSHITF8(a,b) silk_RSHIFT8_((a), (b), __FILE__, __LINE__) |
651 | static inline opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ | 651 | static OPUS_INLINE opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){ |
652 | if ( (shift < 0) || (shift>=8) ) | 652 | if ( (shift < 0) || (shift>=8) ) |
653 | { | 653 | { |
654 | fprintf (stderr, "silk_RSHITF8(%d, %d) in %s: line %d\n", a, shift, file, line); | 654 | fprintf (stderr, "silk_RSHITF8(%d, %d) in %s: line %d\n", a, shift, file, line); |
@@ -661,7 +661,7 @@ static inline opus_int8 silk_RSHIFT8_(opus_int8 a, opus_int32 shift, char *file, | |||
661 | 661 | ||
662 | #undef silk_RSHIFT16 | 662 | #undef silk_RSHIFT16 |
663 | #define silk_RSHITF16(a,b) silk_RSHIFT16_((a), (b), __FILE__, __LINE__) | 663 | #define silk_RSHITF16(a,b) silk_RSHIFT16_((a), (b), __FILE__, __LINE__) |
664 | static inline opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ | 664 | static OPUS_INLINE opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){ |
665 | if ( (shift < 0) || (shift>=16) ) | 665 | if ( (shift < 0) || (shift>=16) ) |
666 | { | 666 | { |
667 | fprintf (stderr, "silk_RSHITF16(%d, %d) in %s: line %d\n", a, shift, file, line); | 667 | fprintf (stderr, "silk_RSHITF16(%d, %d) in %s: line %d\n", a, shift, file, line); |
@@ -674,7 +674,7 @@ static inline opus_int16 silk_RSHIFT16_(opus_int16 a, opus_int32 shift, char *fi | |||
674 | 674 | ||
675 | #undef silk_RSHIFT32 | 675 | #undef silk_RSHIFT32 |
676 | #define silk_RSHIFT32(a,b) silk_RSHIFT32_((a), (b), __FILE__, __LINE__) | 676 | #define silk_RSHIFT32(a,b) silk_RSHIFT32_((a), (b), __FILE__, __LINE__) |
677 | static inline opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ | 677 | static OPUS_INLINE opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){ |
678 | if ( (shift < 0) || (shift>=32) ) | 678 | if ( (shift < 0) || (shift>=32) ) |
679 | { | 679 | { |
680 | fprintf (stderr, "silk_RSHITF32(%d, %d) in %s: line %d\n", a, shift, file, line); | 680 | fprintf (stderr, "silk_RSHITF32(%d, %d) in %s: line %d\n", a, shift, file, line); |
@@ -687,7 +687,7 @@ static inline opus_int32 silk_RSHIFT32_(opus_int32 a, opus_int32 shift, char *fi | |||
687 | 687 | ||
688 | #undef silk_RSHIFT64 | 688 | #undef silk_RSHIFT64 |
689 | #define silk_RSHIFT64(a,b) silk_RSHIFT64_((a), (b), __FILE__, __LINE__) | 689 | #define silk_RSHIFT64(a,b) silk_RSHIFT64_((a), (b), __FILE__, __LINE__) |
690 | static inline opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *file, int line){ | 690 | static OPUS_INLINE opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *file, int line){ |
691 | if ( (shift < 0) || (shift>=64) ) | 691 | if ( (shift < 0) || (shift>=64) ) |
692 | { | 692 | { |
693 | fprintf (stderr, "silk_RSHITF64(%lld, %lld) in %s: line %d\n", (long long)a, (long long)shift, file, line); | 693 | fprintf (stderr, "silk_RSHITF64(%lld, %lld) in %s: line %d\n", (long long)a, (long long)shift, file, line); |
@@ -700,7 +700,7 @@ static inline opus_int64 silk_RSHIFT64_(opus_int64 a, opus_int64 shift, char *fi | |||
700 | 700 | ||
701 | #undef silk_RSHIFT_uint | 701 | #undef silk_RSHIFT_uint |
702 | #define silk_RSHIFT_uint(a,b) silk_RSHIFT_uint_((a), (b), __FILE__, __LINE__) | 702 | #define silk_RSHIFT_uint(a,b) silk_RSHIFT_uint_((a), (b), __FILE__, __LINE__) |
703 | static inline opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ | 703 | static OPUS_INLINE opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, char *file, int line){ |
704 | if ( (shift < 0) || (shift>32) ) | 704 | if ( (shift < 0) || (shift>32) ) |
705 | { | 705 | { |
706 | fprintf (stderr, "silk_RSHIFT_uint(%u, %d) in %s: line %d\n", a, shift, file, line); | 706 | fprintf (stderr, "silk_RSHIFT_uint(%u, %d) in %s: line %d\n", a, shift, file, line); |
@@ -713,7 +713,7 @@ static inline opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift, cha | |||
713 | 713 | ||
714 | #undef silk_ADD_LSHIFT | 714 | #undef silk_ADD_LSHIFT |
715 | #define silk_ADD_LSHIFT(a,b,c) silk_ADD_LSHIFT_((a), (b), (c), __FILE__, __LINE__) | 715 | #define silk_ADD_LSHIFT(a,b,c) silk_ADD_LSHIFT_((a), (b), (c), __FILE__, __LINE__) |
716 | static inline int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line){ | 716 | static OPUS_INLINE int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line){ |
717 | opus_int16 ret; | 717 | opus_int16 ret; |
718 | ret = a + (b << shift); | 718 | ret = a + (b << shift); |
719 | if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) | 719 | if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) |
@@ -728,7 +728,7 @@ static inline int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line | |||
728 | 728 | ||
729 | #undef silk_ADD_LSHIFT32 | 729 | #undef silk_ADD_LSHIFT32 |
730 | #define silk_ADD_LSHIFT32(a,b,c) silk_ADD_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) | 730 | #define silk_ADD_LSHIFT32(a,b,c) silk_ADD_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) |
731 | static inline opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ | 731 | static OPUS_INLINE opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ |
732 | opus_int32 ret; | 732 | opus_int32 ret; |
733 | ret = a + (b << shift); | 733 | ret = a + (b << shift); |
734 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) | 734 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) |
@@ -743,7 +743,7 @@ static inline opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int | |||
743 | 743 | ||
744 | #undef silk_ADD_LSHIFT_uint | 744 | #undef silk_ADD_LSHIFT_uint |
745 | #define silk_ADD_LSHIFT_uint(a,b,c) silk_ADD_LSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) | 745 | #define silk_ADD_LSHIFT_uint(a,b,c) silk_ADD_LSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) |
746 | static inline opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ | 746 | static OPUS_INLINE opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ |
747 | opus_uint32 ret; | 747 | opus_uint32 ret; |
748 | ret = a + (b << shift); | 748 | ret = a + (b << shift); |
749 | if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) | 749 | if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) ) |
@@ -758,7 +758,7 @@ static inline opus_uint32 silk_ADD_LSHIFT_uint_(opus_uint32 a, opus_uint32 b, op | |||
758 | 758 | ||
759 | #undef silk_ADD_RSHIFT | 759 | #undef silk_ADD_RSHIFT |
760 | #define silk_ADD_RSHIFT(a,b,c) silk_ADD_RSHIFT_((a), (b), (c), __FILE__, __LINE__) | 760 | #define silk_ADD_RSHIFT(a,b,c) silk_ADD_RSHIFT_((a), (b), (c), __FILE__, __LINE__) |
761 | static inline int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line){ | 761 | static OPUS_INLINE int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line){ |
762 | opus_int16 ret; | 762 | opus_int16 ret; |
763 | ret = a + (b >> shift); | 763 | ret = a + (b >> shift); |
764 | if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) | 764 | if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) |
@@ -773,7 +773,7 @@ static inline int silk_ADD_RSHIFT_(int a, int b, int shift, char *file, int line | |||
773 | 773 | ||
774 | #undef silk_ADD_RSHIFT32 | 774 | #undef silk_ADD_RSHIFT32 |
775 | #define silk_ADD_RSHIFT32(a,b,c) silk_ADD_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) | 775 | #define silk_ADD_RSHIFT32(a,b,c) silk_ADD_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) |
776 | static inline opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ | 776 | static OPUS_INLINE opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ |
777 | opus_int32 ret; | 777 | opus_int32 ret; |
778 | ret = a + (b >> shift); | 778 | ret = a + (b >> shift); |
779 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) | 779 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) |
@@ -788,7 +788,7 @@ static inline opus_int32 silk_ADD_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int | |||
788 | 788 | ||
789 | #undef silk_ADD_RSHIFT_uint | 789 | #undef silk_ADD_RSHIFT_uint |
790 | #define silk_ADD_RSHIFT_uint(a,b,c) silk_ADD_RSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) | 790 | #define silk_ADD_RSHIFT_uint(a,b,c) silk_ADD_RSHIFT_uint_((a), (b), (c), __FILE__, __LINE__) |
791 | static inline opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ | 791 | static OPUS_INLINE opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, opus_int32 shift, char *file, int line){ |
792 | opus_uint32 ret; | 792 | opus_uint32 ret; |
793 | ret = a + (b >> shift); | 793 | ret = a + (b >> shift); |
794 | if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) | 794 | if ( (shift < 0) || (shift>32) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) >> shift)) ) |
@@ -803,7 +803,7 @@ static inline opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32 b, op | |||
803 | 803 | ||
804 | #undef silk_SUB_LSHIFT32 | 804 | #undef silk_SUB_LSHIFT32 |
805 | #define silk_SUB_LSHIFT32(a,b,c) silk_SUB_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) | 805 | #define silk_SUB_LSHIFT32(a,b,c) silk_SUB_LSHIFT32_((a), (b), (c), __FILE__, __LINE__) |
806 | static inline opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ | 806 | static OPUS_INLINE opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ |
807 | opus_int32 ret; | 807 | opus_int32 ret; |
808 | ret = a - (b << shift); | 808 | ret = a - (b << shift); |
809 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) << shift)) ) | 809 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) << shift)) ) |
@@ -818,7 +818,7 @@ static inline opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int | |||
818 | 818 | ||
819 | #undef silk_SUB_RSHIFT32 | 819 | #undef silk_SUB_RSHIFT32 |
820 | #define silk_SUB_RSHIFT32(a,b,c) silk_SUB_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) | 820 | #define silk_SUB_RSHIFT32(a,b,c) silk_SUB_RSHIFT32_((a), (b), (c), __FILE__, __LINE__) |
821 | static inline opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ | 821 | static OPUS_INLINE opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){ |
822 | opus_int32 ret; | 822 | opus_int32 ret; |
823 | ret = a - (b >> shift); | 823 | ret = a - (b >> shift); |
824 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) >> shift)) ) | 824 | if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) >> shift)) ) |
@@ -833,7 +833,7 @@ static inline opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opus_int | |||
833 | 833 | ||
834 | #undef silk_RSHIFT_ROUND | 834 | #undef silk_RSHIFT_ROUND |
835 | #define silk_RSHIFT_ROUND(a,b) silk_RSHIFT_ROUND_((a), (b), __FILE__, __LINE__) | 835 | #define silk_RSHIFT_ROUND(a,b) silk_RSHIFT_ROUND_((a), (b), __FILE__, __LINE__) |
836 | static inline opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char *file, int line){ | 836 | static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char *file, int line){ |
837 | opus_int32 ret; | 837 | opus_int32 ret; |
838 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; | 838 | ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; |
839 | /* the marco definition can't handle a shift of zero */ | 839 | /* the marco definition can't handle a shift of zero */ |
@@ -849,7 +849,7 @@ static inline opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char | |||
849 | 849 | ||
850 | #undef silk_RSHIFT_ROUND64 | 850 | #undef silk_RSHIFT_ROUND64 |
851 | #define silk_RSHIFT_ROUND64(a,b) silk_RSHIFT_ROUND64_((a), (b), __FILE__, __LINE__) | 851 | #define silk_RSHIFT_ROUND64(a,b) silk_RSHIFT_ROUND64_((a), (b), __FILE__, __LINE__) |
852 | static inline opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, char *file, int line){ | 852 | static OPUS_INLINE opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, char *file, int line){ |
853 | opus_int64 ret; | 853 | opus_int64 ret; |
854 | /* the marco definition can't handle a shift of zero */ | 854 | /* the marco definition can't handle a shift of zero */ |
855 | if ( (shift <= 0) || (shift>=64) ) | 855 | if ( (shift <= 0) || (shift>=64) ) |
@@ -865,14 +865,14 @@ static inline opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, ch | |||
865 | 865 | ||
866 | /* silk_abs is used on floats also, so doesn't work... */ | 866 | /* silk_abs is used on floats also, so doesn't work... */ |
867 | /*#undef silk_abs | 867 | /*#undef silk_abs |
868 | static inline opus_int32 silk_abs(opus_int32 a){ | 868 | static OPUS_INLINE opus_int32 silk_abs(opus_int32 a){ |
869 | silk_assert(a != 0x80000000); | 869 | silk_assert(a != 0x80000000); |
870 | return (((a) > 0) ? (a) : -(a)); // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN | 870 | return (((a) > 0) ? (a) : -(a)); // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN |
871 | }*/ | 871 | }*/ |
872 | 872 | ||
873 | #undef silk_abs_int64 | 873 | #undef silk_abs_int64 |
874 | #define silk_abs_int64(a) silk_abs_int64_((a), __FILE__, __LINE__) | 874 | #define silk_abs_int64(a) silk_abs_int64_((a), __FILE__, __LINE__) |
875 | static inline opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){ | 875 | static OPUS_INLINE opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){ |
876 | if ( a == silk_int64_MIN ) | 876 | if ( a == silk_int64_MIN ) |
877 | { | 877 | { |
878 | fprintf (stderr, "silk_abs_int64(%lld) in %s: line %d\n", (long long)a, file, line); | 878 | fprintf (stderr, "silk_abs_int64(%lld) in %s: line %d\n", (long long)a, file, line); |
@@ -885,7 +885,7 @@ static inline opus_int64 silk_abs_int64_(opus_int64 a, char *file, int line){ | |||
885 | 885 | ||
886 | #undef silk_abs_int32 | 886 | #undef silk_abs_int32 |
887 | #define silk_abs_int32(a) silk_abs_int32_((a), __FILE__, __LINE__) | 887 | #define silk_abs_int32(a) silk_abs_int32_((a), __FILE__, __LINE__) |
888 | static inline opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){ | 888 | static OPUS_INLINE opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){ |
889 | if ( a == silk_int32_MIN ) | 889 | if ( a == silk_int32_MIN ) |
890 | { | 890 | { |
891 | fprintf (stderr, "silk_abs_int32(%d) in %s: line %d\n", a, file, line); | 891 | fprintf (stderr, "silk_abs_int32(%d) in %s: line %d\n", a, file, line); |
@@ -898,7 +898,7 @@ static inline opus_int32 silk_abs_int32_(opus_int32 a, char *file, int line){ | |||
898 | 898 | ||
899 | #undef silk_CHECK_FIT8 | 899 | #undef silk_CHECK_FIT8 |
900 | #define silk_CHECK_FIT8(a) silk_CHECK_FIT8_((a), __FILE__, __LINE__) | 900 | #define silk_CHECK_FIT8(a) silk_CHECK_FIT8_((a), __FILE__, __LINE__) |
901 | static inline opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){ | 901 | static OPUS_INLINE opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){ |
902 | opus_int8 ret; | 902 | opus_int8 ret; |
903 | ret = (opus_int8)a; | 903 | ret = (opus_int8)a; |
904 | if ( (opus_int64)ret != a ) | 904 | if ( (opus_int64)ret != a ) |
@@ -913,7 +913,7 @@ static inline opus_int8 silk_CHECK_FIT8_( opus_int64 a, char *file, int line ){ | |||
913 | 913 | ||
914 | #undef silk_CHECK_FIT16 | 914 | #undef silk_CHECK_FIT16 |
915 | #define silk_CHECK_FIT16(a) silk_CHECK_FIT16_((a), __FILE__, __LINE__) | 915 | #define silk_CHECK_FIT16(a) silk_CHECK_FIT16_((a), __FILE__, __LINE__) |
916 | static inline opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line ){ | 916 | static OPUS_INLINE opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line ){ |
917 | opus_int16 ret; | 917 | opus_int16 ret; |
918 | ret = (opus_int16)a; | 918 | ret = (opus_int16)a; |
919 | if ( (opus_int64)ret != a ) | 919 | if ( (opus_int64)ret != a ) |
@@ -928,7 +928,7 @@ static inline opus_int16 silk_CHECK_FIT16_( opus_int64 a, char *file, int line ) | |||
928 | 928 | ||
929 | #undef silk_CHECK_FIT32 | 929 | #undef silk_CHECK_FIT32 |
930 | #define silk_CHECK_FIT32(a) silk_CHECK_FIT32_((a), __FILE__, __LINE__) | 930 | #define silk_CHECK_FIT32(a) silk_CHECK_FIT32_((a), __FILE__, __LINE__) |
931 | static inline opus_int32 silk_CHECK_FIT32_( opus_int64 a, char *file, int line ){ | 931 | static OPUS_INLINE opus_int32 silk_CHECK_FIT32_( opus_int64 a, char *file, int line ){ |
932 | opus_int32 ret; | 932 | opus_int32 ret; |
933 | ret = (opus_int32)a; | 933 | ret = (opus_int32)a; |
934 | if ( (opus_int64)ret != a ) | 934 | if ( (opus_int64)ret != a ) |
diff --git a/lib/rbcodec/codecs/libopus/silk/NLSF2A.c b/lib/rbcodec/codecs/libopus/silk/NLSF2A.c index f9a09b0d5f..b1c559ea68 100644 --- a/lib/rbcodec/codecs/libopus/silk/NLSF2A.c +++ b/lib/rbcodec/codecs/libopus/silk/NLSF2A.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
41 | #define QA 16 | 41 | #define QA 16 |
42 | 42 | ||
43 | /* helper function for NLSF2A(..) */ | 43 | /* helper function for NLSF2A(..) */ |
44 | static inline void silk_NLSF2A_find_poly( | 44 | static OPUS_INLINE void silk_NLSF2A_find_poly( |
45 | opus_int32 *out, /* O intermediate polynomial, QA [dd+1] */ | 45 | opus_int32 *out, /* O intermediate polynomial, QA [dd+1] */ |
46 | const opus_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */ | 46 | const opus_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */ |
47 | opus_int dd /* I polynomial order (= 1/2 * filter order) */ | 47 | opus_int dd /* I polynomial order (= 1/2 * filter order) */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/NLSF_VQ_weights_laroia.c b/lib/rbcodec/codecs/libopus/silk/NLSF_VQ_weights_laroia.c index bd5f52d2b3..04894c59ab 100644 --- a/lib/rbcodec/codecs/libopus/silk/NLSF_VQ_weights_laroia.c +++ b/lib/rbcodec/codecs/libopus/silk/NLSF_VQ_weights_laroia.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/NLSF_decode.c b/lib/rbcodec/codecs/libopus/silk/NLSF_decode.c index 5845c37452..9f715060b8 100644 --- a/lib/rbcodec/codecs/libopus/silk/NLSF_decode.c +++ b/lib/rbcodec/codecs/libopus/silk/NLSF_decode.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
32 | #include "main.h" | 32 | #include "main.h" |
33 | 33 | ||
34 | /* Predictive dequantizer for NLSF residuals */ | 34 | /* Predictive dequantizer for NLSF residuals */ |
35 | static inline void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */ | 35 | static OPUS_INLINE void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */ |
36 | opus_int16 x_Q10[], /* O Output [ order ] */ | 36 | opus_int16 x_Q10[], /* O Output [ order ] */ |
37 | const opus_int8 indices[], /* I Quantization indices [ order ] */ | 37 | const opus_int8 indices[], /* I Quantization indices [ order ] */ |
38 | const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ | 38 | const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/NLSF_stabilize.c b/lib/rbcodec/codecs/libopus/silk/NLSF_stabilize.c index e732992282..1fa1ea379b 100644 --- a/lib/rbcodec/codecs/libopus/silk/NLSF_stabilize.c +++ b/lib/rbcodec/codecs/libopus/silk/NLSF_stabilize.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/NLSF_unpack.c b/lib/rbcodec/codecs/libopus/silk/NLSF_unpack.c index d84eb8121d..17bd23f752 100644 --- a/lib/rbcodec/codecs/libopus/silk/NLSF_unpack.c +++ b/lib/rbcodec/codecs/libopus/silk/NLSF_unpack.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/PLC.c b/lib/rbcodec/codecs/libopus/silk/PLC.c index d9fda74555..01f40014c4 100644 --- a/lib/rbcodec/codecs/libopus/silk/PLC.c +++ b/lib/rbcodec/codecs/libopus/silk/PLC.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -38,12 +38,12 @@ static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* | |||
38 | static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ | 38 | static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ |
39 | static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ | 39 | static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ |
40 | 40 | ||
41 | static inline void silk_PLC_update( | 41 | static OPUS_INLINE void silk_PLC_update( |
42 | silk_decoder_state *psDec, /* I/O Decoder state */ | 42 | silk_decoder_state *psDec, /* I/O Decoder state */ |
43 | silk_decoder_control *psDecCtrl /* I/O Decoder control */ | 43 | silk_decoder_control *psDecCtrl /* I/O Decoder control */ |
44 | ); | 44 | ); |
45 | 45 | ||
46 | static inline void silk_PLC_conceal( | 46 | static OPUS_INLINE void silk_PLC_conceal( |
47 | silk_decoder_state *psDec, /* I/O Decoder state */ | 47 | silk_decoder_state *psDec, /* I/O Decoder state */ |
48 | silk_decoder_control *psDecCtrl, /* I/O Decoder control */ | 48 | silk_decoder_control *psDecCtrl, /* I/O Decoder control */ |
49 | opus_int16 frame[] /* O LPC residual signal */ | 49 | opus_int16 frame[] /* O LPC residual signal */ |
@@ -92,7 +92,7 @@ void silk_PLC( | |||
92 | /**************************************************/ | 92 | /**************************************************/ |
93 | /* Update state of PLC */ | 93 | /* Update state of PLC */ |
94 | /**************************************************/ | 94 | /**************************************************/ |
95 | static inline void silk_PLC_update( | 95 | static OPUS_INLINE void silk_PLC_update( |
96 | silk_decoder_state *psDec, /* I/O Decoder state */ | 96 | silk_decoder_state *psDec, /* I/O Decoder state */ |
97 | silk_decoder_control *psDecCtrl /* I/O Decoder control */ | 97 | silk_decoder_control *psDecCtrl /* I/O Decoder control */ |
98 | ) | 98 | ) |
@@ -165,7 +165,7 @@ static inline void silk_PLC_update( | |||
165 | psPLC->nb_subfr = psDec->nb_subfr; | 165 | psPLC->nb_subfr = psDec->nb_subfr; |
166 | } | 166 | } |
167 | 167 | ||
168 | static inline void silk_PLC_conceal( | 168 | static OPUS_INLINE void silk_PLC_conceal( |
169 | silk_decoder_state *psDec, /* I/O Decoder state */ | 169 | silk_decoder_state *psDec, /* I/O Decoder state */ |
170 | silk_decoder_control *psDecCtrl, /* I/O Decoder control */ | 170 | silk_decoder_control *psDecCtrl, /* I/O Decoder control */ |
171 | opus_int16 frame[] /* O LPC residual signal */ | 171 | opus_int16 frame[] /* O LPC residual signal */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/PLC.h b/lib/rbcodec/codecs/libopus/silk/PLC.h index 172c63ae83..f1e2eccc69 100644 --- a/lib/rbcodec/codecs/libopus/silk/PLC.h +++ b/lib/rbcodec/codecs/libopus/silk/PLC.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/SigProc_FIX.h b/lib/rbcodec/codecs/libopus/silk/SigProc_FIX.h index 64c0b0eaec..1b58057910 100644 --- a/lib/rbcodec/codecs/libopus/silk/SigProc_FIX.h +++ b/lib/rbcodec/codecs/libopus/silk/SigProc_FIX.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -227,7 +227,8 @@ void silk_autocorr( | |||
227 | opus_int *scale, /* O Scaling of the correlation vector */ | 227 | opus_int *scale, /* O Scaling of the correlation vector */ |
228 | const opus_int16 *inputData, /* I Input data to correlate */ | 228 | const opus_int16 *inputData, /* I Input data to correlate */ |
229 | const opus_int inputDataSize, /* I Length of input */ | 229 | const opus_int inputDataSize, /* I Length of input */ |
230 | const opus_int correlationCount /* I Number of correlation taps to compute */ | 230 | const opus_int correlationCount, /* I Number of correlation taps to compute */ |
231 | int arch /* I Run-time architecture */ | ||
231 | ); | 232 | ); |
232 | 233 | ||
233 | void silk_decode_pitch( | 234 | void silk_decode_pitch( |
@@ -249,7 +250,8 @@ opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 | |||
249 | const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */ | 250 | const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */ |
250 | const opus_int Fs_kHz, /* I Sample frequency (kHz) */ | 251 | const opus_int Fs_kHz, /* I Sample frequency (kHz) */ |
251 | const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ | 252 | const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ |
252 | const opus_int nb_subfr /* I number of 5 ms subframes */ | 253 | const opus_int nb_subfr, /* I number of 5 ms subframes */ |
254 | int arch /* I Run-time architecture */ | ||
253 | ); | 255 | ); |
254 | 256 | ||
255 | /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */ | 257 | /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */ |
@@ -309,7 +311,8 @@ void silk_burg_modified( | |||
309 | const opus_int32 minInvGain_Q30, /* I Inverse of max prediction gain */ | 311 | const opus_int32 minInvGain_Q30, /* I Inverse of max prediction gain */ |
310 | const opus_int subfr_length, /* I Input signal subframe length (incl. D preceding samples) */ | 312 | const opus_int subfr_length, /* I Input signal subframe length (incl. D preceding samples) */ |
311 | const opus_int nb_subfr, /* I Number of subframes stacked in x */ | 313 | const opus_int nb_subfr, /* I Number of subframes stacked in x */ |
312 | const opus_int D /* I Order */ | 314 | const opus_int D, /* I Order */ |
315 | int arch /* I Run-time architecture */ | ||
313 | ); | 316 | ); |
314 | 317 | ||
315 | /* Copy and multiply a vector by a constant */ | 318 | /* Copy and multiply a vector by a constant */ |
@@ -358,8 +361,8 @@ opus_int64 silk_inner_prod16_aligned_64( | |||
358 | /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating | 361 | /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating |
359 | left. Output is 32bit int. | 362 | left. Output is 32bit int. |
360 | Note: contemporary compilers recognize the C expression below and | 363 | Note: contemporary compilers recognize the C expression below and |
361 | compile it into a 'ror' instruction if available. No need for inline ASM! */ | 364 | compile it into a 'ror' instruction if available. No need for OPUS_INLINE ASM! */ |
362 | static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) | 365 | static OPUS_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) |
363 | { | 366 | { |
364 | opus_uint32 x = (opus_uint32) a32; | 367 | opus_uint32 x = (opus_uint32) a32; |
365 | opus_uint32 r = (opus_uint32) rot; | 368 | opus_uint32 r = (opus_uint32) rot; |
@@ -508,37 +511,37 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) | |||
508 | #define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5)) | 511 | #define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5)) |
509 | 512 | ||
510 | /* silk_min() versions with typecast in the function call */ | 513 | /* silk_min() versions with typecast in the function call */ |
511 | static inline opus_int silk_min_int(opus_int a, opus_int b) | 514 | static OPUS_INLINE opus_int silk_min_int(opus_int a, opus_int b) |
512 | { | 515 | { |
513 | return (((a) < (b)) ? (a) : (b)); | 516 | return (((a) < (b)) ? (a) : (b)); |
514 | } | 517 | } |
515 | static inline opus_int16 silk_min_16(opus_int16 a, opus_int16 b) | 518 | static OPUS_INLINE opus_int16 silk_min_16(opus_int16 a, opus_int16 b) |
516 | { | 519 | { |
517 | return (((a) < (b)) ? (a) : (b)); | 520 | return (((a) < (b)) ? (a) : (b)); |
518 | } | 521 | } |
519 | static inline opus_int32 silk_min_32(opus_int32 a, opus_int32 b) | 522 | static OPUS_INLINE opus_int32 silk_min_32(opus_int32 a, opus_int32 b) |
520 | { | 523 | { |
521 | return (((a) < (b)) ? (a) : (b)); | 524 | return (((a) < (b)) ? (a) : (b)); |
522 | } | 525 | } |
523 | static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) | 526 | static OPUS_INLINE opus_int64 silk_min_64(opus_int64 a, opus_int64 b) |
524 | { | 527 | { |
525 | return (((a) < (b)) ? (a) : (b)); | 528 | return (((a) < (b)) ? (a) : (b)); |
526 | } | 529 | } |
527 | 530 | ||
528 | /* silk_min() versions with typecast in the function call */ | 531 | /* silk_min() versions with typecast in the function call */ |
529 | static inline opus_int silk_max_int(opus_int a, opus_int b) | 532 | static OPUS_INLINE opus_int silk_max_int(opus_int a, opus_int b) |
530 | { | 533 | { |
531 | return (((a) > (b)) ? (a) : (b)); | 534 | return (((a) > (b)) ? (a) : (b)); |
532 | } | 535 | } |
533 | static inline opus_int16 silk_max_16(opus_int16 a, opus_int16 b) | 536 | static OPUS_INLINE opus_int16 silk_max_16(opus_int16 a, opus_int16 b) |
534 | { | 537 | { |
535 | return (((a) > (b)) ? (a) : (b)); | 538 | return (((a) > (b)) ? (a) : (b)); |
536 | } | 539 | } |
537 | static inline opus_int32 silk_max_32(opus_int32 a, opus_int32 b) | 540 | static OPUS_INLINE opus_int32 silk_max_32(opus_int32 a, opus_int32 b) |
538 | { | 541 | { |
539 | return (((a) > (b)) ? (a) : (b)); | 542 | return (((a) > (b)) ? (a) : (b)); |
540 | } | 543 | } |
541 | static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) | 544 | static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b) |
542 | { | 545 | { |
543 | return (((a) > (b)) ? (a) : (b)); | 546 | return (((a) > (b)) ? (a) : (b)); |
544 | } | 547 | } |
@@ -576,11 +579,11 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) | |||
576 | #include "MacroCount.h" | 579 | #include "MacroCount.h" |
577 | #include "MacroDebug.h" | 580 | #include "MacroDebug.h" |
578 | 581 | ||
579 | #ifdef ARMv4_ASM | 582 | #ifdef OPUS_ARM_INLINE_ASM |
580 | #include "arm/SigProc_FIX_armv4.h" | 583 | #include "arm/SigProc_FIX_armv4.h" |
581 | #endif | 584 | #endif |
582 | 585 | ||
583 | #ifdef ARMv5E_ASM | 586 | #ifdef OPUS_ARM_INLINE_EDSP |
584 | #include "arm/SigProc_FIX_armv5e.h" | 587 | #include "arm/SigProc_FIX_armv5e.h" |
585 | #endif | 588 | #endif |
586 | 589 | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv4.h b/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv4.h index d69573e3d4..ff62b1e5d6 100644 --- a/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv4.h +++ b/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv4.h | |||
@@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | #define SILK_SIGPROC_FIX_ARMv4_H | 30 | #define SILK_SIGPROC_FIX_ARMv4_H |
31 | 31 | ||
32 | #undef silk_MLA | 32 | #undef silk_MLA |
33 | static inline opus_int32 silk_MLA_armv4(opus_int32 a, opus_int32 b, | 33 | static OPUS_INLINE opus_int32 silk_MLA_armv4(opus_int32 a, opus_int32 b, |
34 | opus_int32 c) | 34 | opus_int32 c) |
35 | { | 35 | { |
36 | opus_int32 res; | 36 | opus_int32 res; |
diff --git a/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv5e.h b/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv5e.h index 81a6324f65..617a09cab1 100644 --- a/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv5e.h +++ b/lib/rbcodec/codecs/libopus/silk/arm/SigProc_FIX_armv5e.h | |||
@@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | #define SILK_SIGPROC_FIX_ARMv5E_H | 30 | #define SILK_SIGPROC_FIX_ARMv5E_H |
31 | 31 | ||
32 | #undef silk_SMULTT | 32 | #undef silk_SMULTT |
33 | static inline opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b) | 33 | static OPUS_INLINE opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b) |
34 | { | 34 | { |
35 | opus_int32 res; | 35 | opus_int32 res; |
36 | __asm__( | 36 | __asm__( |
@@ -44,7 +44,7 @@ static inline opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b) | |||
44 | #define silk_SMULTT(a, b) (silk_SMULTT_armv5e(a, b)) | 44 | #define silk_SMULTT(a, b) (silk_SMULTT_armv5e(a, b)) |
45 | 45 | ||
46 | #undef silk_SMLATT | 46 | #undef silk_SMLATT |
47 | static inline opus_int32 silk_SMLATT_armv5e(opus_int32 a, opus_int32 b, | 47 | static OPUS_INLINE opus_int32 silk_SMLATT_armv5e(opus_int32 a, opus_int32 b, |
48 | opus_int32 c) | 48 | opus_int32 c) |
49 | { | 49 | { |
50 | opus_int32 res; | 50 | opus_int32 res; |
diff --git a/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h index 58df6c2e2b..3f30e97288 100644 --- a/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h +++ b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h | |||
@@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | 30 | ||
31 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ | 31 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ |
32 | #undef silk_SMULWB | 32 | #undef silk_SMULWB |
33 | static inline opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b) | 33 | static OPUS_INLINE opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b) |
34 | { | 34 | { |
35 | unsigned rd_lo; | 35 | unsigned rd_lo; |
36 | int rd_hi; | 36 | int rd_hi; |
@@ -50,7 +50,7 @@ static inline opus_int32 silk_SMULWB_armv4(opus_int32 a, opus_int16 b) | |||
50 | 50 | ||
51 | /* (a32 * (b32 >> 16)) >> 16 */ | 51 | /* (a32 * (b32 >> 16)) >> 16 */ |
52 | #undef silk_SMULWT | 52 | #undef silk_SMULWT |
53 | static inline opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b) | 53 | static OPUS_INLINE opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b) |
54 | { | 54 | { |
55 | unsigned rd_lo; | 55 | unsigned rd_lo; |
56 | int rd_hi; | 56 | int rd_hi; |
@@ -70,7 +70,7 @@ static inline opus_int32 silk_SMULWT_armv4(opus_int32 a, opus_int32 b) | |||
70 | 70 | ||
71 | /* (a32 * b32) >> 16 */ | 71 | /* (a32 * b32) >> 16 */ |
72 | #undef silk_SMULWW | 72 | #undef silk_SMULWW |
73 | static inline opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b) | 73 | static OPUS_INLINE opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b) |
74 | { | 74 | { |
75 | unsigned rd_lo; | 75 | unsigned rd_lo; |
76 | int rd_hi; | 76 | int rd_hi; |
@@ -85,7 +85,7 @@ static inline opus_int32 silk_SMULWW_armv4(opus_int32 a, opus_int32 b) | |||
85 | #define silk_SMULWW(a, b) (silk_SMULWW_armv4(a, b)) | 85 | #define silk_SMULWW(a, b) (silk_SMULWW_armv4(a, b)) |
86 | 86 | ||
87 | #undef silk_SMLAWW | 87 | #undef silk_SMLAWW |
88 | static inline opus_int32 silk_SMLAWW_armv4(opus_int32 a, opus_int32 b, | 88 | static OPUS_INLINE opus_int32 silk_SMLAWW_armv4(opus_int32 a, opus_int32 b, |
89 | opus_int32 c) | 89 | opus_int32 c) |
90 | { | 90 | { |
91 | unsigned rd_lo; | 91 | unsigned rd_lo; |
diff --git a/lib/rbcodec/codecs/libopus/silk/arm/macros_armv5e.h b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv5e.h index 63b1e30f48..aad4117e46 100644 --- a/lib/rbcodec/codecs/libopus/silk/arm/macros_armv5e.h +++ b/lib/rbcodec/codecs/libopus/silk/arm/macros_armv5e.h | |||
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
31 | 31 | ||
32 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ | 32 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ |
33 | #undef silk_SMULWB | 33 | #undef silk_SMULWB |
34 | static inline opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b) | 34 | static OPUS_INLINE opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b) |
35 | { | 35 | { |
36 | int res; | 36 | int res; |
37 | __asm__( | 37 | __asm__( |
@@ -46,7 +46,7 @@ static inline opus_int32 silk_SMULWB_armv5e(opus_int32 a, opus_int16 b) | |||
46 | 46 | ||
47 | /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */ | 47 | /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */ |
48 | #undef silk_SMLAWB | 48 | #undef silk_SMLAWB |
49 | static inline opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b, | 49 | static OPUS_INLINE opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b, |
50 | opus_int16 c) | 50 | opus_int16 c) |
51 | { | 51 | { |
52 | int res; | 52 | int res; |
@@ -62,7 +62,7 @@ static inline opus_int32 silk_SMLAWB_armv5e(opus_int32 a, opus_int32 b, | |||
62 | 62 | ||
63 | /* (a32 * (b32 >> 16)) >> 16 */ | 63 | /* (a32 * (b32 >> 16)) >> 16 */ |
64 | #undef silk_SMULWT | 64 | #undef silk_SMULWT |
65 | static inline opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b) | 65 | static OPUS_INLINE opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b) |
66 | { | 66 | { |
67 | int res; | 67 | int res; |
68 | __asm__( | 68 | __asm__( |
@@ -77,7 +77,7 @@ static inline opus_int32 silk_SMULWT_armv5e(opus_int32 a, opus_int32 b) | |||
77 | 77 | ||
78 | /* a32 + (b32 * (c32 >> 16)) >> 16 */ | 78 | /* a32 + (b32 * (c32 >> 16)) >> 16 */ |
79 | #undef silk_SMLAWT | 79 | #undef silk_SMLAWT |
80 | static inline opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b, | 80 | static OPUS_INLINE opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b, |
81 | opus_int32 c) | 81 | opus_int32 c) |
82 | { | 82 | { |
83 | int res; | 83 | int res; |
@@ -93,7 +93,7 @@ static inline opus_int32 silk_SMLAWT_armv5e(opus_int32 a, opus_int32 b, | |||
93 | 93 | ||
94 | /* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ | 94 | /* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ |
95 | #undef silk_SMULBB | 95 | #undef silk_SMULBB |
96 | static inline opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b) | 96 | static OPUS_INLINE opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b) |
97 | { | 97 | { |
98 | int res; | 98 | int res; |
99 | __asm__( | 99 | __asm__( |
@@ -108,7 +108,7 @@ static inline opus_int32 silk_SMULBB_armv5e(opus_int32 a, opus_int32 b) | |||
108 | 108 | ||
109 | /* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */ | 109 | /* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */ |
110 | #undef silk_SMLABB | 110 | #undef silk_SMLABB |
111 | static inline opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b, | 111 | static OPUS_INLINE opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b, |
112 | opus_int32 c) | 112 | opus_int32 c) |
113 | { | 113 | { |
114 | int res; | 114 | int res; |
@@ -124,7 +124,7 @@ static inline opus_int32 silk_SMLABB_armv5e(opus_int32 a, opus_int32 b, | |||
124 | 124 | ||
125 | /* (opus_int32)((opus_int16)(a32)) * (b32 >> 16) */ | 125 | /* (opus_int32)((opus_int16)(a32)) * (b32 >> 16) */ |
126 | #undef silk_SMULBT | 126 | #undef silk_SMULBT |
127 | static inline opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b) | 127 | static OPUS_INLINE opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b) |
128 | { | 128 | { |
129 | int res; | 129 | int res; |
130 | __asm__( | 130 | __asm__( |
@@ -139,7 +139,7 @@ static inline opus_int32 silk_SMULBT_armv5e(opus_int32 a, opus_int32 b) | |||
139 | 139 | ||
140 | /* a32 + (opus_int32)((opus_int16)(b32)) * (c32 >> 16) */ | 140 | /* a32 + (opus_int32)((opus_int16)(b32)) * (c32 >> 16) */ |
141 | #undef silk_SMLABT | 141 | #undef silk_SMLABT |
142 | static inline opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b, | 142 | static OPUS_INLINE opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b, |
143 | opus_int32 c) | 143 | opus_int32 c) |
144 | { | 144 | { |
145 | int res; | 145 | int res; |
@@ -155,7 +155,7 @@ static inline opus_int32 silk_SMLABT_armv5e(opus_int32 a, opus_int32 b, | |||
155 | 155 | ||
156 | /* add/subtract with output saturated */ | 156 | /* add/subtract with output saturated */ |
157 | #undef silk_ADD_SAT32 | 157 | #undef silk_ADD_SAT32 |
158 | static inline opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b) | 158 | static OPUS_INLINE opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b) |
159 | { | 159 | { |
160 | int res; | 160 | int res; |
161 | __asm__( | 161 | __asm__( |
@@ -169,7 +169,7 @@ static inline opus_int32 silk_ADD_SAT32_armv5e(opus_int32 a, opus_int32 b) | |||
169 | #define silk_ADD_SAT32(a, b) (silk_ADD_SAT32_armv5e(a, b)) | 169 | #define silk_ADD_SAT32(a, b) (silk_ADD_SAT32_armv5e(a, b)) |
170 | 170 | ||
171 | #undef silk_SUB_SAT32 | 171 | #undef silk_SUB_SAT32 |
172 | static inline opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b) | 172 | static OPUS_INLINE opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b) |
173 | { | 173 | { |
174 | int res; | 174 | int res; |
175 | __asm__( | 175 | __asm__( |
@@ -183,7 +183,7 @@ static inline opus_int32 silk_SUB_SAT32_armv5e(opus_int32 a, opus_int32 b) | |||
183 | #define silk_SUB_SAT32(a, b) (silk_SUB_SAT32_armv5e(a, b)) | 183 | #define silk_SUB_SAT32(a, b) (silk_SUB_SAT32_armv5e(a, b)) |
184 | 184 | ||
185 | #undef silk_CLZ16 | 185 | #undef silk_CLZ16 |
186 | static inline opus_int32 silk_CLZ16_armv5(opus_int16 in16) | 186 | static OPUS_INLINE opus_int32 silk_CLZ16_armv5(opus_int16 in16) |
187 | { | 187 | { |
188 | int res; | 188 | int res; |
189 | __asm__( | 189 | __asm__( |
@@ -197,7 +197,7 @@ static inline opus_int32 silk_CLZ16_armv5(opus_int16 in16) | |||
197 | #define silk_CLZ16(in16) (silk_CLZ16_armv5(in16)) | 197 | #define silk_CLZ16(in16) (silk_CLZ16_armv5(in16)) |
198 | 198 | ||
199 | #undef silk_CLZ32 | 199 | #undef silk_CLZ32 |
200 | static inline opus_int32 silk_CLZ32_armv5(opus_int32 in32) | 200 | static OPUS_INLINE opus_int32 silk_CLZ32_armv5(opus_int32 in32) |
201 | { | 201 | { |
202 | int res; | 202 | int res; |
203 | __asm__( | 203 | __asm__( |
diff --git a/lib/rbcodec/codecs/libopus/silk/bwexpander.c b/lib/rbcodec/codecs/libopus/silk/bwexpander.c index a0157b0606..2eb4456695 100644 --- a/lib/rbcodec/codecs/libopus/silk/bwexpander.c +++ b/lib/rbcodec/codecs/libopus/silk/bwexpander.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/bwexpander_32.c b/lib/rbcodec/codecs/libopus/silk/bwexpander_32.c index 80628cd7a7..d0010f73df 100644 --- a/lib/rbcodec/codecs/libopus/silk/bwexpander_32.c +++ b/lib/rbcodec/codecs/libopus/silk/bwexpander_32.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/code_signs.c b/lib/rbcodec/codecs/libopus/silk/code_signs.c index f9173278ab..561043c739 100644 --- a/lib/rbcodec/codecs/libopus/silk/code_signs.c +++ b/lib/rbcodec/codecs/libopus/silk/code_signs.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/control.h b/lib/rbcodec/codecs/libopus/silk/control.h index 77530f8feb..747e5426a0 100644 --- a/lib/rbcodec/codecs/libopus/silk/control.h +++ b/lib/rbcodec/codecs/libopus/silk/control.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -92,6 +92,9 @@ typedef struct { | |||
92 | /* I: Opus encoder is allowing us to switch bandwidth */ | 92 | /* I: Opus encoder is allowing us to switch bandwidth */ |
93 | opus_int opusCanSwitch; | 93 | opus_int opusCanSwitch; |
94 | 94 | ||
95 | /* I: Make frames as independent as possible (but still use LPC) */ | ||
96 | opus_int reducedDependency; | ||
97 | |||
95 | /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */ | 98 | /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */ |
96 | opus_int32 internalSampleRate; | 99 | opus_int32 internalSampleRate; |
97 | 100 | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/dec_API.c b/lib/rbcodec/codecs/libopus/silk/dec_API.c index 5b6e518130..4cbcf71514 100644 --- a/lib/rbcodec/codecs/libopus/silk/dec_API.c +++ b/lib/rbcodec/codecs/libopus/silk/dec_API.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -305,7 +305,7 @@ opus_int silk_Decode( /* O Returns error co | |||
305 | 305 | ||
306 | /* Set up pointers to temp buffers */ | 306 | /* Set up pointers to temp buffers */ |
307 | ALLOC( samplesOut2_tmp, | 307 | ALLOC( samplesOut2_tmp, |
308 | decControl->nChannelsAPI == 2 ? *nSamplesOut : 0, opus_int16 ); | 308 | decControl->nChannelsAPI == 2 ? *nSamplesOut : ALLOC_NONE, opus_int16 ); |
309 | if( decControl->nChannelsAPI == 2 ) { | 309 | if( decControl->nChannelsAPI == 2 ) { |
310 | resample_out_ptr = samplesOut2_tmp; | 310 | resample_out_ptr = samplesOut2_tmp; |
311 | } else { | 311 | } else { |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_core.c b/lib/rbcodec/codecs/libopus/silk/decode_core.c index b298389f07..87fbd5de9f 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_core.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_core.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_frame.c b/lib/rbcodec/codecs/libopus/silk/decode_frame.c index a9ad7928ef..abc00a3d54 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_frame.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_frame.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_indices.c b/lib/rbcodec/codecs/libopus/silk/decode_indices.c index f5a2665107..7afe5c26c1 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_indices.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_indices.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_parameters.c b/lib/rbcodec/codecs/libopus/silk/decode_parameters.c index fa72395c3b..e345b1dcef 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_parameters.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_parameters.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_pitch.c b/lib/rbcodec/codecs/libopus/silk/decode_pitch.c index f9e3e3bc2b..fedbc6a525 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_pitch.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_pitch.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decode_pulses.c b/lib/rbcodec/codecs/libopus/silk/decode_pulses.c index 2d8f28186f..e8a87c2ab7 100644 --- a/lib/rbcodec/codecs/libopus/silk/decode_pulses.c +++ b/lib/rbcodec/codecs/libopus/silk/decode_pulses.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/decoder_set_fs.c b/lib/rbcodec/codecs/libopus/silk/decoder_set_fs.c index de410797ae..eef0fd25e1 100644 --- a/lib/rbcodec/codecs/libopus/silk/decoder_set_fs.c +++ b/lib/rbcodec/codecs/libopus/silk/decoder_set_fs.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/define.h b/lib/rbcodec/codecs/libopus/silk/define.h index ee3a534b41..c47aca9f58 100644 --- a/lib/rbcodec/codecs/libopus/silk/define.h +++ b/lib/rbcodec/codecs/libopus/silk/define.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/errors.h b/lib/rbcodec/codecs/libopus/silk/errors.h index 00b67163c9..45070800f2 100644 --- a/lib/rbcodec/codecs/libopus/silk/errors.h +++ b/lib/rbcodec/codecs/libopus/silk/errors.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/gain_quant.c b/lib/rbcodec/codecs/libopus/silk/gain_quant.c index 47e747ee4a..ed084073b1 100644 --- a/lib/rbcodec/codecs/libopus/silk/gain_quant.c +++ b/lib/rbcodec/codecs/libopus/silk/gain_quant.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/init_decoder.c b/lib/rbcodec/codecs/libopus/silk/init_decoder.c index 68a20ae6b0..f887c67886 100644 --- a/lib/rbcodec/codecs/libopus/silk/init_decoder.c +++ b/lib/rbcodec/codecs/libopus/silk/init_decoder.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/log2lin.c b/lib/rbcodec/codecs/libopus/silk/log2lin.c index 50be565cb5..a692e009db 100644 --- a/lib/rbcodec/codecs/libopus/silk/log2lin.c +++ b/lib/rbcodec/codecs/libopus/silk/log2lin.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -41,7 +41,9 @@ opus_int32 silk_log2lin( | |||
41 | 41 | ||
42 | if( inLog_Q7 < 0 ) { | 42 | if( inLog_Q7 < 0 ) { |
43 | return 0; | 43 | return 0; |
44 | } | 44 | } else if ( inLog_Q7 >= 3967 ) { |
45 | return silk_int32_MAX; | ||
46 | } | ||
45 | 47 | ||
46 | out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) ); | 48 | out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) ); |
47 | frac_Q7 = inLog_Q7 & 0x7F; | 49 | frac_Q7 = inLog_Q7 & 0x7F; |
diff --git a/lib/rbcodec/codecs/libopus/silk/macros.h b/lib/rbcodec/codecs/libopus/silk/macros.h index 97f03c886a..482dc3c6eb 100644 --- a/lib/rbcodec/codecs/libopus/silk/macros.h +++ b/lib/rbcodec/codecs/libopus/silk/macros.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -32,7 +32,10 @@ POSSIBILITY OF SUCH DAMAGE. | |||
32 | #include "config.h" | 32 | #include "config.h" |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* This is an inline header file for general platform. */ | 35 | #include "opus_types.h" |
36 | #include "opus_defines.h" | ||
37 | |||
38 | /* This is an OPUS_INLINE header file for general platform. */ | ||
36 | 39 | ||
37 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ | 40 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ |
38 | #define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) | 41 | #define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) |
@@ -78,12 +81,12 @@ POSSIBILITY OF SUCH DAMAGE. | |||
78 | 81 | ||
79 | #include "ecintrin.h" | 82 | #include "ecintrin.h" |
80 | 83 | ||
81 | static inline opus_int32 silk_CLZ16(opus_int16 in16) | 84 | static OPUS_INLINE opus_int32 silk_CLZ16(opus_int16 in16) |
82 | { | 85 | { |
83 | return 32 - EC_ILOG(in16<<16|0x8000); | 86 | return 32 - EC_ILOG(in16<<16|0x8000); |
84 | } | 87 | } |
85 | 88 | ||
86 | static inline opus_int32 silk_CLZ32(opus_int32 in32) | 89 | static OPUS_INLINE opus_int32 silk_CLZ32(opus_int32 in32) |
87 | { | 90 | { |
88 | return in32 ? 32 - EC_ILOG(in32) : 32; | 91 | return in32 ? 32 - EC_ILOG(in32) : 32; |
89 | } | 92 | } |
@@ -100,15 +103,15 @@ static inline opus_int32 silk_CLZ32(opus_int32 in32) | |||
100 | (*((Matrix_base_adr) + ((row)+(M)*(column)))) | 103 | (*((Matrix_base_adr) + ((row)+(M)*(column)))) |
101 | #endif | 104 | #endif |
102 | 105 | ||
103 | #ifdef ARMv4_ASM | 106 | #ifdef OPUS_ARM_INLINE_ASM |
104 | #include "arm/macros_armv4.h" | 107 | #include "arm/macros_armv4.h" |
105 | #endif | 108 | #endif |
106 | 109 | ||
107 | #ifdef ARMv5E_ASM | 110 | #ifdef OPUS_ARM_INLINE_EDSP |
108 | #include "arm/macros_armv5e.h" | 111 | #include "arm/macros_armv5e.h" |
109 | #endif | 112 | #endif |
110 | 113 | ||
111 | #ifdef CF_ASM | 114 | #ifdef OPUS_CF_INLINE_ASM |
112 | #include "cf/macros_cf.h" | 115 | #include "cf/macros_cf.h" |
113 | #endif | 116 | #endif |
114 | 117 | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/main.h b/lib/rbcodec/codecs/libopus/silk/main.h index 376c77c8b3..2bdf89784d 100644 --- a/lib/rbcodec/codecs/libopus/silk/main.h +++ b/lib/rbcodec/codecs/libopus/silk/main.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -204,6 +204,7 @@ void silk_quant_LTP_gains( | |||
204 | opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ | 204 | opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ |
205 | opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ | 205 | opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ |
206 | opus_int8 *periodicity_index, /* O Periodicity Index */ | 206 | opus_int8 *periodicity_index, /* O Periodicity Index */ |
207 | opus_int32 *sum_gain_dB_Q7, /* I/O Cumulative max prediction gain */ | ||
207 | const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ | 208 | const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ |
208 | opus_int mu_Q9, /* I Mu value (R/D tradeoff) */ | 209 | opus_int mu_Q9, /* I Mu value (R/D tradeoff) */ |
209 | opus_int lowComplexity, /* I Flag for low complexity */ | 210 | opus_int lowComplexity, /* I Flag for low complexity */ |
@@ -214,11 +215,14 @@ void silk_quant_LTP_gains( | |||
214 | void silk_VQ_WMat_EC( | 215 | void silk_VQ_WMat_EC( |
215 | opus_int8 *ind, /* O index of best codebook vector */ | 216 | opus_int8 *ind, /* O index of best codebook vector */ |
216 | opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */ | 217 | opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */ |
218 | opus_int *gain_Q7, /* O sum of absolute LTP coefficients */ | ||
217 | const opus_int16 *in_Q14, /* I input vector to be quantized */ | 219 | const opus_int16 *in_Q14, /* I input vector to be quantized */ |
218 | const opus_int32 *W_Q18, /* I weighting matrix */ | 220 | const opus_int32 *W_Q18, /* I weighting matrix */ |
219 | const opus_int8 *cb_Q7, /* I codebook */ | 221 | const opus_int8 *cb_Q7, /* I codebook */ |
222 | const opus_uint8 *cb_gain_Q7, /* I codebook effective gain */ | ||
220 | const opus_uint8 *cl_Q5, /* I code length for each codebook vector */ | 223 | const opus_uint8 *cl_Q5, /* I code length for each codebook vector */ |
221 | const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */ | 224 | const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */ |
225 | const opus_int32 max_gain_Q7, /* I maximum sum of absolute LTP coefficients */ | ||
222 | opus_int L /* I number of vectors in codebook */ | 226 | opus_int L /* I number of vectors in codebook */ |
223 | ); | 227 | ); |
224 | 228 | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/pitch_est_defines.h b/lib/rbcodec/codecs/libopus/silk/pitch_est_defines.h index 1e4440121b..e1e4b5d768 100644 --- a/lib/rbcodec/codecs/libopus/silk/pitch_est_defines.h +++ b/lib/rbcodec/codecs/libopus/silk/pitch_est_defines.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/pitch_est_tables.c b/lib/rbcodec/codecs/libopus/silk/pitch_est_tables.c index 38d6df4572..81a8bacaca 100644 --- a/lib/rbcodec/codecs/libopus/silk/pitch_est_tables.c +++ b/lib/rbcodec/codecs/libopus/silk/pitch_est_tables.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler.c b/lib/rbcodec/codecs/libopus/silk/resampler.c index 624cae00ed..374fbb3722 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_private.h b/lib/rbcodec/codecs/libopus/silk/resampler_private.h index 273f93e680..422a7d9d95 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_private.h +++ b/lib/rbcodec/codecs/libopus/silk/resampler_private.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_private_AR2.c b/lib/rbcodec/codecs/libopus/silk/resampler_private_AR2.c index 7377459159..5fff23714f 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_private_AR2.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler_private_AR2.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_private_IIR_FIR.c b/lib/rbcodec/codecs/libopus/silk/resampler_private_IIR_FIR.c index ce9aff0907..c7b4f6ed5e 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_private_IIR_FIR.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler_private_IIR_FIR.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
33 | #include "resampler_private.h" | 33 | #include "resampler_private.h" |
34 | #include "stack_alloc.h" | 34 | #include "stack_alloc.h" |
35 | 35 | ||
36 | static inline opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL( | 36 | static OPUS_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL( |
37 | opus_int16 *out, | 37 | opus_int16 *out, |
38 | opus_int16 *buf, | 38 | opus_int16 *buf, |
39 | opus_int32 max_index_Q16, | 39 | opus_int32 max_index_Q16, |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_private_down_FIR.c b/lib/rbcodec/codecs/libopus/silk/resampler_private_down_FIR.c index 163fedd818..783e42b356 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_private_down_FIR.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler_private_down_FIR.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
33 | #include "resampler_private.h" | 33 | #include "resampler_private.h" |
34 | #include "stack_alloc.h" | 34 | #include "stack_alloc.h" |
35 | 35 | ||
36 | static inline opus_int16 *silk_resampler_private_down_FIR_INTERPOL( | 36 | static OPUS_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL( |
37 | opus_int16 *out, | 37 | opus_int16 *out, |
38 | opus_int32 *buf, | 38 | opus_int32 *buf, |
39 | const opus_int16 *FIR_Coefs, | 39 | const opus_int16 *FIR_Coefs, |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_private_up2_HQ.c b/lib/rbcodec/codecs/libopus/silk/resampler_private_up2_HQ.c index e611d4206d..c7ec8de365 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_private_up2_HQ.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler_private_up2_HQ.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_rom.c b/lib/rbcodec/codecs/libopus/silk/resampler_rom.c index edec0436e4..2d502706f9 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_rom.c +++ b/lib/rbcodec/codecs/libopus/silk/resampler_rom.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_rom.h b/lib/rbcodec/codecs/libopus/silk/resampler_rom.h index ffc7f5dabd..490b3388dc 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_rom.h +++ b/lib/rbcodec/codecs/libopus/silk/resampler_rom.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/resampler_structs.h b/lib/rbcodec/codecs/libopus/silk/resampler_structs.h index cbcac20fe7..9e9457d11c 100644 --- a/lib/rbcodec/codecs/libopus/silk/resampler_structs.h +++ b/lib/rbcodec/codecs/libopus/silk/resampler_structs.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/shell_coder.c b/lib/rbcodec/codecs/libopus/silk/shell_coder.c index f402cc4328..9d6e1bb366 100644 --- a/lib/rbcodec/codecs/libopus/silk/shell_coder.c +++ b/lib/rbcodec/codecs/libopus/silk/shell_coder.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
33 | 33 | ||
34 | /* shell coder; pulse-subframe length is hardcoded */ | 34 | /* shell coder; pulse-subframe length is hardcoded */ |
35 | 35 | ||
36 | static inline void combine_pulses( | 36 | static OPUS_INLINE void combine_pulses( |
37 | opus_int *out, /* O combined pulses vector [len] */ | 37 | opus_int *out, /* O combined pulses vector [len] */ |
38 | const opus_int *in, /* I input vector [2 * len] */ | 38 | const opus_int *in, /* I input vector [2 * len] */ |
39 | const opus_int len /* I number of OUTPUT samples */ | 39 | const opus_int len /* I number of OUTPUT samples */ |
@@ -46,7 +46,7 @@ static inline void combine_pulses( | |||
46 | } | 46 | } |
47 | 47 | ||
48 | #if 0 | 48 | #if 0 |
49 | static inline void encode_split( | 49 | static OPUS_INLINE void encode_split( |
50 | ec_enc *psRangeEnc, /* I/O compressor data structure */ | 50 | ec_enc *psRangeEnc, /* I/O compressor data structure */ |
51 | const opus_int p_child1, /* I pulse amplitude of first child subframe */ | 51 | const opus_int p_child1, /* I pulse amplitude of first child subframe */ |
52 | const opus_int p, /* I pulse amplitude of current subframe */ | 52 | const opus_int p, /* I pulse amplitude of current subframe */ |
@@ -59,7 +59,7 @@ static inline void encode_split( | |||
59 | } | 59 | } |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | static inline void decode_split( | 62 | static OPUS_INLINE void decode_split( |
63 | opus_int *p_child1, /* O pulse amplitude of first child subframe */ | 63 | opus_int *p_child1, /* O pulse amplitude of first child subframe */ |
64 | opus_int *p_child2, /* O pulse amplitude of second child subframe */ | 64 | opus_int *p_child2, /* O pulse amplitude of second child subframe */ |
65 | ec_dec *psRangeDec, /* I/O Compressor data structure */ | 65 | ec_dec *psRangeDec, /* I/O Compressor data structure */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/sort.c b/lib/rbcodec/codecs/libopus/silk/sort.c index b311e24c9f..2f9930d9ce 100644 --- a/lib/rbcodec/codecs/libopus/silk/sort.c +++ b/lib/rbcodec/codecs/libopus/silk/sort.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -83,6 +83,7 @@ void silk_insertion_sort_increasing( | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | #endif | ||
86 | 87 | ||
87 | #ifdef FIXED_POINT | 88 | #ifdef FIXED_POINT |
88 | /* This function is only used by the fixed-point build */ | 89 | /* This function is only used by the fixed-point build */ |
@@ -132,7 +133,6 @@ void silk_insertion_sort_decreasing_int16( | |||
132 | } | 133 | } |
133 | } | 134 | } |
134 | #endif | 135 | #endif |
135 | #endif | ||
136 | 136 | ||
137 | void silk_insertion_sort_increasing_all_values_int16( | 137 | void silk_insertion_sort_increasing_all_values_int16( |
138 | opus_int16 *a, /* I/O Unsorted / Sorted vector */ | 138 | opus_int16 *a, /* I/O Unsorted / Sorted vector */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/stereo_MS_to_LR.c b/lib/rbcodec/codecs/libopus/silk/stereo_MS_to_LR.c index 22d61a5f1d..62521a4f35 100644 --- a/lib/rbcodec/codecs/libopus/silk/stereo_MS_to_LR.c +++ b/lib/rbcodec/codecs/libopus/silk/stereo_MS_to_LR.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/stereo_decode_pred.c b/lib/rbcodec/codecs/libopus/silk/stereo_decode_pred.c index 586b4d81df..56ba3925e8 100644 --- a/lib/rbcodec/codecs/libopus/silk/stereo_decode_pred.c +++ b/lib/rbcodec/codecs/libopus/silk/stereo_decode_pred.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/structs.h b/lib/rbcodec/codecs/libopus/silk/structs.h index 8828f44d03..1826b36a80 100644 --- a/lib/rbcodec/codecs/libopus/silk/structs.h +++ b/lib/rbcodec/codecs/libopus/silk/structs.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -171,6 +171,7 @@ typedef struct { | |||
171 | opus_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */ | 171 | opus_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */ |
172 | opus_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */ | 172 | opus_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */ |
173 | opus_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */ | 173 | opus_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */ |
174 | opus_int32 sum_log_gain_Q7; /* Cumulative max prediction gain */ | ||
174 | opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */ | 175 | opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */ |
175 | opus_int first_frame_after_reset; /* Flag for deactivating NLSF interpolation, pitch prediction */ | 176 | opus_int first_frame_after_reset; /* Flag for deactivating NLSF interpolation, pitch prediction */ |
176 | opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */ | 177 | opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */ |
@@ -191,6 +192,8 @@ typedef struct { | |||
191 | SideInfoIndices indices; | 192 | SideInfoIndices indices; |
192 | opus_int8 pulses[ MAX_FRAME_LENGTH ]; | 193 | opus_int8 pulses[ MAX_FRAME_LENGTH ]; |
193 | 194 | ||
195 | int arch; | ||
196 | |||
194 | /* Input/output buffering */ | 197 | /* Input/output buffering */ |
195 | opus_int16 inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */ | 198 | opus_int16 inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */ |
196 | opus_int inputBufIx; | 199 | opus_int inputBufIx; |
diff --git a/lib/rbcodec/codecs/libopus/silk/sum_sqr_shift.c b/lib/rbcodec/codecs/libopus/silk/sum_sqr_shift.c index 815489a4a6..12514c9917 100644 --- a/lib/rbcodec/codecs/libopus/silk/sum_sqr_shift.c +++ b/lib/rbcodec/codecs/libopus/silk/sum_sqr_shift.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/table_LSF_cos.c b/lib/rbcodec/codecs/libopus/silk/table_LSF_cos.c index 93a7039c15..ec9dc63927 100644 --- a/lib/rbcodec/codecs/libopus/silk/table_LSF_cos.c +++ b/lib/rbcodec/codecs/libopus/silk/table_LSF_cos.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables.h b/lib/rbcodec/codecs/libopus/silk/tables.h index 6e4b670647..a91431e854 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables.h +++ b/lib/rbcodec/codecs/libopus/silk/tables.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -78,6 +78,8 @@ extern const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ]; | |||
78 | extern const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */ | 78 | extern const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */ |
79 | extern const opus_int16 silk_LTP_gain_middle_avg_RD_Q14; | 79 | extern const opus_int16 silk_LTP_gain_middle_avg_RD_Q14; |
80 | extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */ | 80 | extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */ |
81 | extern const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS]; | ||
82 | |||
81 | extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */ | 83 | extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */ |
82 | 84 | ||
83 | extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */ | 85 | extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */ |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_LTP.c b/lib/rbcodec/codecs/libopus/silk/tables_LTP.c index d16a511cc2..ea518652b8 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_LTP.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_LTP.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -51,6 +51,7 @@ static const opus_uint8 silk_LTP_gain_iCDF_2[32] = { | |||
51 | 24, 20, 16, 12, 9, 5, 2, 0 | 51 | 24, 20, 16, 12, 9, 5, 2, 0 |
52 | }; | 52 | }; |
53 | 53 | ||
54 | #if 0 | ||
54 | const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; | 55 | const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; |
55 | 56 | ||
56 | static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { | 57 | static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { |
@@ -68,6 +69,7 @@ static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { | |||
68 | 160, 160, 166, 166, 173, 173, 182, 192, | 69 | 160, 160, 166, 166, 173, 173, 182, 192, |
69 | 182, 192, 192, 192, 205, 192, 205, 224 | 70 | 182, 192, 192, 192, 205, 192, 205, 224 |
70 | }; | 71 | }; |
72 | #endif | ||
71 | 73 | ||
72 | const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { | 74 | const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { |
73 | silk_LTP_gain_iCDF_0, | 75 | silk_LTP_gain_iCDF_0, |
@@ -75,11 +77,13 @@ const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { | |||
75 | silk_LTP_gain_iCDF_2 | 77 | silk_LTP_gain_iCDF_2 |
76 | }; | 78 | }; |
77 | 79 | ||
80 | #if 0 | ||
78 | const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { | 81 | const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { |
79 | silk_LTP_gain_BITS_Q5_0, | 82 | silk_LTP_gain_BITS_Q5_0, |
80 | silk_LTP_gain_BITS_Q5_1, | 83 | silk_LTP_gain_BITS_Q5_1, |
81 | silk_LTP_gain_BITS_Q5_2 | 84 | silk_LTP_gain_BITS_Q5_2 |
82 | }; | 85 | }; |
86 | #endif | ||
83 | 87 | ||
84 | static const opus_int8 silk_LTP_gain_vq_0[8][5] = | 88 | static const opus_int8 silk_LTP_gain_vq_0[8][5] = |
85 | { | 89 | { |
@@ -267,6 +271,32 @@ const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = { | |||
267 | (opus_int8 *)&silk_LTP_gain_vq_2[0][0] | 271 | (opus_int8 *)&silk_LTP_gain_vq_2[0][0] |
268 | }; | 272 | }; |
269 | 273 | ||
274 | #if 0 | ||
275 | /* Maximum frequency-dependent response of the pitch taps above, | ||
276 | computed as max(abs(freqz(taps))) */ | ||
277 | static const opus_uint8 silk_LTP_gain_vq_0_gain[8] = { | ||
278 | 46, 2, 90, 87, 93, 91, 82, 98 | ||
279 | }; | ||
280 | |||
281 | static const opus_uint8 silk_LTP_gain_vq_1_gain[16] = { | ||
282 | 109, 120, 118, 12, 113, 115, 117, 119, | ||
283 | 99, 59, 87, 111, 63, 111, 112, 80 | ||
284 | }; | ||
285 | |||
286 | static const opus_uint8 silk_LTP_gain_vq_2_gain[32] = { | ||
287 | 126, 124, 125, 124, 129, 121, 126, 23, | ||
288 | 132, 127, 127, 127, 126, 127, 122, 133, | ||
289 | 130, 134, 101, 118, 119, 145, 126, 86, | ||
290 | 124, 120, 123, 119, 170, 173, 107, 109 | ||
291 | }; | ||
292 | |||
293 | const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS] = { | ||
294 | &silk_LTP_gain_vq_0_gain[0], | ||
295 | &silk_LTP_gain_vq_1_gain[0], | ||
296 | &silk_LTP_gain_vq_2_gain[0] | ||
297 | }; | ||
298 | |||
270 | const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { | 299 | const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { |
271 | 8, 16, 32 | 300 | 8, 16, 32 |
272 | }; | 301 | }; |
302 | #endif | ||
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_NB_MB.c b/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_NB_MB.c index 492ed61d75..8c59d207aa 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_NB_MB.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_NB_MB.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_WB.c b/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_WB.c index 0806d32f9e..50af87eb2e 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_WB.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_WB.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_gain.c b/lib/rbcodec/codecs/libopus/silk/tables_gain.c index 8cf7d643b2..37e41d890c 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_gain.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_gain.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_other.c b/lib/rbcodec/codecs/libopus/silk/tables_other.c index e4204f9366..398686bf26 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_other.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_other.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_pitch_lag.c b/lib/rbcodec/codecs/libopus/silk/tables_pitch_lag.c index 97869b7331..e80cc59a27 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_pitch_lag.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_pitch_lag.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/tables_pulses_per_block.c b/lib/rbcodec/codecs/libopus/silk/tables_pulses_per_block.c index 91060572d1..c7c01c8893 100644 --- a/lib/rbcodec/codecs/libopus/silk/tables_pulses_per_block.c +++ b/lib/rbcodec/codecs/libopus/silk/tables_pulses_per_block.c | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
diff --git a/lib/rbcodec/codecs/libopus/silk/typedef.h b/lib/rbcodec/codecs/libopus/silk/typedef.h index 073aa28cc7..97b7e709be 100644 --- a/lib/rbcodec/codecs/libopus/silk/typedef.h +++ b/lib/rbcodec/codecs/libopus/silk/typedef.h | |||
@@ -8,7 +8,7 @@ this list of conditions and the following disclaimer. | |||
8 | - Redistributions in binary form must reproduce the above copyright | 8 | - Redistributions in binary form must reproduce the above copyright |
9 | notice, this list of conditions and the following disclaimer in the | 9 | notice, this list of conditions and the following disclaimer in the |
10 | documentation and/or other materials provided with the distribution. | 10 | documentation and/or other materials provided with the distribution. |
11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
29 | #define SILK_TYPEDEF_H | 29 | #define SILK_TYPEDEF_H |
30 | 30 | ||
31 | #include "opus_types.h" | 31 | #include "opus_types.h" |
32 | #include "opus_defines.h" | ||
32 | 33 | ||
33 | #ifndef FIXED_POINT | 34 | #ifndef FIXED_POINT |
34 | # include <float.h> | 35 | # include <float.h> |
@@ -63,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
63 | #ifdef __GNUC__ | 64 | #ifdef __GNUC__ |
64 | __attribute__((noreturn)) | 65 | __attribute__((noreturn)) |
65 | #endif | 66 | #endif |
66 | static inline void _silk_fatal(const char *str, const char *file, int line) | 67 | static OPUS_INLINE void _silk_fatal(const char *str, const char *file, int line) |
67 | { | 68 | { |
68 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); | 69 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); |
69 | abort(); | 70 | abort(); |