comparison flacenc.c @ 3384:573fed4bf20f libavcodec

simplify
author michael
date Sun, 02 Jul 2006 09:30:51 +0000
parents 84f29207af3a
children 340e5d35b326
comparison
equal deleted inserted replaced
3383:769d68b12d26 3384:573fed4bf20f
299 299
300 static void calc_sums(int pmax, uint32_t *data, int n, int pred_order, 300 static void calc_sums(int pmax, uint32_t *data, int n, int pred_order,
301 uint32_t sums[][256]) 301 uint32_t sums[][256])
302 { 302 {
303 int i, j; 303 int i, j;
304 int parts, cnt; 304 int parts;
305 uint32_t *res; 305 uint32_t *res, *res_end;
306 306
307 /* sums for highest level */ 307 /* sums for highest level */
308 parts = (1 << pmax); 308 parts = (1 << pmax);
309 res = &data[pred_order]; 309 res = &data[pred_order];
310 cnt = (n >> pmax) - pred_order; 310 res_end = &data[n >> pmax];
311 for(i=0; i<parts; i++) { 311 for(i=0; i<parts; i++) {
312 if(i == 1) cnt = (n >> pmax);
313 if(i > 0) res = &data[i*cnt];
314 sums[pmax][i] = 0; 312 sums[pmax][i] = 0;
315 for(j=0; j<cnt; j++) { 313 while(res < res_end){
316 sums[pmax][i] += res[j]; 314 sums[pmax][i] += *(res++);
317 } 315 }
316 res_end+= n >> pmax;
318 } 317 }
319 /* sums for lower levels */ 318 /* sums for lower levels */
320 for(i=pmax-1; i>=0; i--) { 319 for(i=pmax-1; i>=0; i--) {
321 parts = (1 << i); 320 parts = (1 << i);
322 for(j=0; j<parts; j++) { 321 for(j=0; j<parts; j++) {