FreeCalypso > hg > gsm-codec-lib
comparison libgsmefr/pitch_ol.c @ 199:b4531e7227ca
libgsmefr/pitch_ol.c: perf opt
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Jan 2023 04:23:07 +0000 |
parents | 509ba99f5136 |
children |
comparison
equal
deleted
inserted
replaced
198:d714168fb6dc | 199:b4531e7227ca |
---|---|
74 /*--------------------------------------------------------* | 74 /*--------------------------------------------------------* |
75 * Verification for risk of overflow. * | 75 * Verification for risk of overflow. * |
76 *--------------------------------------------------------*/ | 76 *--------------------------------------------------------*/ |
77 | 77 |
78 test (); test (); | 78 test (); test (); |
79 if (L_sub (t0, MAX_32) == 0L) /* Test for overflow */ | 79 if (t0 == MAX_32) /* Test for overflow */ |
80 { | 80 { |
81 for (i = -pit_max; i < L_frame; i++) | 81 for (i = -pit_max; i < L_frame; i++) |
82 { | 82 { |
83 scal_sig[i] = shr (signal[i], 3); move16 (); | 83 scal_sig[i] = shr (signal[i], 3); move16 (); |
84 } | 84 } |
85 scal_fac = 3; move16 (); | 85 scal_fac = 3; move16 (); |
86 } | 86 } |
87 else if (L_sub (t0, (Word32) 1048576L) < (Word32) 0) | 87 else if (t0 < (Word32) 1048576L) |
88 /* if (t0 < 2^20) */ | 88 /* if (t0 < 2^20) */ |
89 { | 89 { |
90 for (i = -pit_max; i < L_frame; i++) | 90 for (i = -pit_max; i < L_frame; i++) |
91 { | 91 { |
92 scal_sig[i] = shl (signal[i], 3); move16 (); | 92 scal_sig[i] = shl (signal[i], 3); move16 (); |
126 /*--------------------------------------------------------------------* | 126 /*--------------------------------------------------------------------* |
127 * Compare the 3 sections maximum, and favor small lag. * | 127 * Compare the 3 sections maximum, and favor small lag. * |
128 *-------------------------------------------------------------------*/ | 128 *-------------------------------------------------------------------*/ |
129 | 129 |
130 test (); | 130 test (); |
131 if (sub (mult (max1, THRESHOLD), max2) < 0) | 131 if (mult (max1, THRESHOLD) < max2) |
132 { | 132 { |
133 max1 = max2; move16 (); | 133 max1 = max2; move16 (); |
134 p_max1 = p_max2; move16 (); | 134 p_max1 = p_max2; move16 (); |
135 } | 135 } |
136 test (); | 136 test (); |
137 if (sub (mult (max1, THRESHOLD), max3) < 0) | 137 if (mult (max1, THRESHOLD) < max3) |
138 { | 138 { |
139 p_max1 = p_max3; move16 (); | 139 p_max1 = p_max3; move16 (); |
140 } | 140 } |
141 return (p_max1); | 141 return (p_max1); |
142 } | 142 } |
181 for (j = 0; j < L_frame; j++, p++, p1++) | 181 for (j = 0; j < L_frame; j++, p++, p1++) |
182 { | 182 { |
183 t0 = L_mac (t0, *p, *p1); | 183 t0 = L_mac (t0, *p, *p1); |
184 } | 184 } |
185 test (); | 185 test (); |
186 if (L_sub (t0, max) >= 0) | 186 if (t0 >= max) |
187 { | 187 { |
188 max = t0; move32 (); | 188 max = t0; move32 (); |
189 p_max = i; move16 (); | 189 p_max = i; move16 (); |
190 } | 190 } |
191 } | 191 } |