comparison snow.c @ 10815:2b0c54f9f9c2 libavcodec

Snow : re-indent after r21093.
author jai_menon
date Fri, 08 Jan 2010 16:37:32 +0000
parents 2737ebb75e4b
children c76bc0410301
comparison
equal deleted inserted replaced
10814:2737ebb75e4b 10815:2b0c54f9f9c2
1296 static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){ 1296 static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){
1297 const int w= b->width; 1297 const int w= b->width;
1298 const int h= b->height; 1298 const int h= b->height;
1299 int x,y; 1299 int x,y;
1300 1300
1301 int run, runs; 1301 int run, runs;
1302 x_and_coeff *xc= b->x_coeff; 1302 x_and_coeff *xc= b->x_coeff;
1303 x_and_coeff *prev_xc= NULL; 1303 x_and_coeff *prev_xc= NULL;
1304 x_and_coeff *prev2_xc= xc; 1304 x_and_coeff *prev2_xc= xc;
1305 x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL; 1305 x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL;
1306 x_and_coeff *prev_parent_xc= parent_xc; 1306 x_and_coeff *prev_parent_xc= parent_xc;
1307 1307
1308 runs= get_symbol2(&s->c, b->state[30], 0); 1308 runs= get_symbol2(&s->c, b->state[30], 0);
1309 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3); 1309 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
1310 else run= INT_MAX; 1310 else run= INT_MAX;
1311 1311
1312 for(y=0; y<h; y++){ 1312 for(y=0; y<h; y++){
1313 int v=0; 1313 int v=0;
1314 int lt=0, t=0, rt=0; 1314 int lt=0, t=0, rt=0;
1315 1315
1316 if(y && prev_xc->x == 0){ 1316 if(y && prev_xc->x == 0){
1317 rt= prev_xc->coeff; 1317 rt= prev_xc->coeff;
1318 } 1318 }
1319 for(x=0; x<w; x++){ 1319 for(x=0; x<w; x++){
1320 int p=0; 1320 int p=0;
1321 const int l= v; 1321 const int l= v;
1322 1322
1323 lt= t; t= rt; 1323 lt= t; t= rt;
1324 1324
1325 if(y){ 1325 if(y){
1326 if(prev_xc->x <= x) 1326 if(prev_xc->x <= x)
1327 prev_xc++; 1327 prev_xc++;
1328 if(prev_xc->x == x + 1) 1328 if(prev_xc->x == x + 1)
1329 rt= prev_xc->coeff; 1329 rt= prev_xc->coeff;
1330 else 1330 else
1331 rt=0; 1331 rt=0;
1332 }
1333 if(parent_xc){
1334 if(x>>1 > parent_xc->x){
1335 parent_xc++;
1332 } 1336 }
1333 if(parent_xc){ 1337 if(x>>1 == parent_xc->x){
1334 if(x>>1 > parent_xc->x){ 1338 p= parent_xc->coeff;
1335 parent_xc++;
1336 }
1337 if(x>>1 == parent_xc->x){
1338 p= parent_xc->coeff;
1339 }
1340 } 1339 }
1341 if(/*ll|*/l|lt|t|rt|p){ 1340 }
1342 int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); 1341 if(/*ll|*/l|lt|t|rt|p){
1343 1342 int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));
1344 v=get_rac(&s->c, &b->state[0][context]); 1343
1345 if(v){ 1344 v=get_rac(&s->c, &b->state[0][context]);
1346 v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); 1345 if(v){
1347 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]); 1346 v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
1348 1347 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]);
1349 xc->x=x; 1348
1350 (xc++)->coeff= v; 1349 xc->x=x;
1351 } 1350 (xc++)->coeff= v;
1351 }
1352 }else{
1353 if(!run){
1354 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
1355 else run= INT_MAX;
1356 v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
1357 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
1358
1359 xc->x=x;
1360 (xc++)->coeff= v;
1352 }else{ 1361 }else{
1353 if(!run){ 1362 int max_run;
1354 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3); 1363 run--;
1355 else run= INT_MAX; 1364 v=0;
1356 v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1); 1365
1357 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]); 1366 if(y) max_run= FFMIN(run, prev_xc->x - x - 2);
1358 1367 else max_run= FFMIN(run, w-x-1);
1359 xc->x=x; 1368 if(parent_xc)
1360 (xc++)->coeff= v; 1369 max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);
1361 }else{ 1370 x+= max_run;
1362 int max_run; 1371 run-= max_run;
1363 run--;
1364 v=0;
1365
1366 if(y) max_run= FFMIN(run, prev_xc->x - x - 2);
1367 else max_run= FFMIN(run, w-x-1);
1368 if(parent_xc)
1369 max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);
1370 x+= max_run;
1371 run-= max_run;
1372 }
1373 } 1372 }
1374 } 1373 }
1375 (xc++)->x= w+1; //end marker 1374 }
1376 prev_xc= prev2_xc; 1375 (xc++)->x= w+1; //end marker
1377 prev2_xc= xc; 1376 prev_xc= prev2_xc;
1378 1377 prev2_xc= xc;
1379 if(parent_xc){ 1378
1380 if(y&1){ 1379 if(parent_xc){
1381 while(parent_xc->x != parent->width+1) 1380 if(y&1){
1382 parent_xc++; 1381 while(parent_xc->x != parent->width+1)
1383 parent_xc++; 1382 parent_xc++;
1384 prev_parent_xc= parent_xc; 1383 parent_xc++;
1385 }else{ 1384 prev_parent_xc= parent_xc;
1386 parent_xc= prev_parent_xc; 1385 }else{
1387 } 1386 parent_xc= prev_parent_xc;
1388 } 1387 }
1389 } 1388 }
1390 1389 }
1391 (xc++)->x= w+1; //end marker 1390
1391 (xc++)->x= w+1; //end marker
1392 } 1392 }
1393 1393
1394 static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){ 1394 static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){
1395 const int w= b->width; 1395 const int w= b->width;
1396 int y; 1396 int y;