comparison truespeech.c @ 3347:82277c821113 libavcodec

Add const to (mostly) char* and make some functions static, which aren't used outside their declaring source file and which have no corresponding prototype. patch by Stefan Huehner stefan^^@^^huehner^^.^^org
author diego
date Sun, 18 Jun 2006 11:33:14 +0000
parents c892b3b6bfbf
children c8c591fe26f8
comparison
equal deleted inserted replaced
3346:052765f11f1c 3347:82277c821113
186 } 186 }
187 } 187 }
188 188
189 static void truespeech_apply_twopoint_filter(TSContext *dec, int quart) 189 static void truespeech_apply_twopoint_filter(TSContext *dec, int quart)
190 { 190 {
191 int16_t tmp[146 + 60], *ptr0, *ptr1, *filter; 191 int16_t tmp[146 + 60], *ptr0, *ptr1;
192 const int16_t *filter;
192 int i, t, off; 193 int i, t, off;
193 194
194 t = dec->offset2[quart]; 195 t = dec->offset2[quart];
195 if(t == 127){ 196 if(t == 127){
196 memset(dec->newvec, 0, 60 * 2); 197 memset(dec->newvec, 0, 60 * 2);
199 for(i = 0; i < 146; i++) 200 for(i = 0; i < 146; i++)
200 tmp[i] = dec->filtbuf[i]; 201 tmp[i] = dec->filtbuf[i];
201 off = (t / 25) + dec->offset1[quart >> 1] + 18; 202 off = (t / 25) + dec->offset1[quart >> 1] + 18;
202 ptr0 = tmp + 145 - off; 203 ptr0 = tmp + 145 - off;
203 ptr1 = tmp + 146; 204 ptr1 = tmp + 146;
204 filter = (int16_t*)ts_240 + (t % 25) * 2; 205 filter = (const int16_t*)ts_240 + (t % 25) * 2;
205 for(i = 0; i < 60; i++){ 206 for(i = 0; i < 60; i++){
206 t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14; 207 t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14;
207 ptr0++; 208 ptr0++;
208 dec->newvec[i] = t; 209 dec->newvec[i] = t;
209 ptr1[i] = t; 210 ptr1[i] = t;
212 213
213 static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart) 214 static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart)
214 { 215 {
215 int16_t tmp[7]; 216 int16_t tmp[7];
216 int i, j, t; 217 int i, j, t;
217 int16_t *ptr1, *ptr2; 218 const int16_t *ptr1;
219 int16_t *ptr2;
218 int coef; 220 int coef;
219 221
220 memset(out, 0, 60 * 2); 222 memset(out, 0, 60 * 2);
221 for(i = 0; i < 7; i++) { 223 for(i = 0; i < 7; i++) {
222 t = dec->pulseval[quart] & 3; 224 t = dec->pulseval[quart] & 3;
223 dec->pulseval[quart] >>= 2; 225 dec->pulseval[quart] >>= 2;
224 tmp[6 - i] = ts_562[dec->pulseoff[quart] * 4 + t]; 226 tmp[6 - i] = ts_562[dec->pulseoff[quart] * 4 + t];
225 } 227 }
226 228
227 coef = dec->pulsepos[quart] >> 15; 229 coef = dec->pulsepos[quart] >> 15;
228 ptr1 = (int16_t*)ts_140 + 30; 230 ptr1 = (const int16_t*)ts_140 + 30;
229 ptr2 = tmp; 231 ptr2 = tmp;
230 for(i = 0, j = 3; (i < 30) && (j > 0); i++){ 232 for(i = 0, j = 3; (i < 30) && (j > 0); i++){
231 t = *ptr1++; 233 t = *ptr1++;
232 if(coef >= t) 234 if(coef >= t)
233 coef -= t; 235 coef -= t;
236 ptr1 += 30; 238 ptr1 += 30;
237 j--; 239 j--;
238 } 240 }
239 } 241 }
240 coef = dec->pulsepos[quart] & 0x7FFF; 242 coef = dec->pulsepos[quart] & 0x7FFF;
241 ptr1 = (int16_t*)ts_140; 243 ptr1 = (const int16_t*)ts_140;
242 for(i = 30, j = 4; (i < 60) && (j > 0); i++){ 244 for(i = 30, j = 4; (i < 60) && (j > 0); i++){
243 t = *ptr1++; 245 t = *ptr1++;
244 if(coef >= t) 246 if(coef >= t)
245 coef -= t; 247 coef -= t;
246 else{ 248 else{