Mercurial > libavcodec.hg
comparison error_resilience.c @ 4001:34fdffe98bd0 libavcodec
Rename ABS macro to FFABS.
author | diego |
---|---|
date | Wed, 11 Oct 2006 23:17:58 +0000 |
parents | c8c591fe26f8 |
children | 23da44e8fd05 |
comparison
equal
deleted
inserted
replaced
4000:eeab02251056 | 4001:34fdffe98bd0 |
---|---|
215 int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))]; | 215 int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))]; |
216 | 216 |
217 if(!(left_damage||right_damage)) continue; // both undamaged | 217 if(!(left_damage||right_damage)) continue; // both undamaged |
218 | 218 |
219 if( (!left_intra) && (!right_intra) | 219 if( (!left_intra) && (!right_intra) |
220 && ABS(left_mv[0]-right_mv[0]) + ABS(left_mv[1]+right_mv[1]) < 2) continue; | 220 && FFABS(left_mv[0]-right_mv[0]) + FFABS(left_mv[1]+right_mv[1]) < 2) continue; |
221 | 221 |
222 for(y=0; y<8; y++){ | 222 for(y=0; y<8; y++){ |
223 int a,b,c,d; | 223 int a,b,c,d; |
224 | 224 |
225 a= dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride]; | 225 a= dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride]; |
226 b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride]; | 226 b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride]; |
227 c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride]; | 227 c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride]; |
228 | 228 |
229 d= ABS(b) - ((ABS(a) + ABS(c) + 1)>>1); | 229 d= FFABS(b) - ((FFABS(a) + FFABS(c) + 1)>>1); |
230 d= FFMAX(d, 0); | 230 d= FFMAX(d, 0); |
231 if(b<0) d= -d; | 231 if(b<0) d= -d; |
232 | 232 |
233 if(d==0) continue; | 233 if(d==0) continue; |
234 | 234 |
275 int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))]; | 275 int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))]; |
276 | 276 |
277 if(!(top_damage||bottom_damage)) continue; // both undamaged | 277 if(!(top_damage||bottom_damage)) continue; // both undamaged |
278 | 278 |
279 if( (!top_intra) && (!bottom_intra) | 279 if( (!top_intra) && (!bottom_intra) |
280 && ABS(top_mv[0]-bottom_mv[0]) + ABS(top_mv[1]+bottom_mv[1]) < 2) continue; | 280 && FFABS(top_mv[0]-bottom_mv[0]) + FFABS(top_mv[1]+bottom_mv[1]) < 2) continue; |
281 | 281 |
282 for(x=0; x<8; x++){ | 282 for(x=0; x<8; x++){ |
283 int a,b,c,d; | 283 int a,b,c,d; |
284 | 284 |
285 a= dst[offset + x + 7*stride] - dst[offset + x + 6*stride]; | 285 a= dst[offset + x + 7*stride] - dst[offset + x + 6*stride]; |
286 b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride]; | 286 b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride]; |
287 c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride]; | 287 c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride]; |
288 | 288 |
289 d= ABS(b) - ((ABS(a) + ABS(c)+1)>>1); | 289 d= FFABS(b) - ((FFABS(a) + FFABS(c)+1)>>1); |
290 d= FFMAX(d, 0); | 290 d= FFMAX(d, 0); |
291 if(b<0) d= -d; | 291 if(b<0) d= -d; |
292 | 292 |
293 if(d==0) continue; | 293 if(d==0) continue; |
294 | 294 |
493 decode_mb(s); | 493 decode_mb(s); |
494 | 494 |
495 if(mb_x>0 && fixed[mb_xy-1]){ | 495 if(mb_x>0 && fixed[mb_xy-1]){ |
496 int k; | 496 int k; |
497 for(k=0; k<16; k++) | 497 for(k=0; k<16; k++) |
498 score += ABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); | 498 score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); |
499 } | 499 } |
500 if(mb_x+1<mb_width && fixed[mb_xy+1]){ | 500 if(mb_x+1<mb_width && fixed[mb_xy+1]){ |
501 int k; | 501 int k; |
502 for(k=0; k<16; k++) | 502 for(k=0; k<16; k++) |
503 score += ABS(src[k*s->linesize+15]-src[k*s->linesize+16]); | 503 score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]); |
504 } | 504 } |
505 if(mb_y>0 && fixed[mb_xy-mb_stride]){ | 505 if(mb_y>0 && fixed[mb_xy-mb_stride]){ |
506 int k; | 506 int k; |
507 for(k=0; k<16; k++) | 507 for(k=0; k<16; k++) |
508 score += ABS(src[k-s->linesize ]-src[k ]); | 508 score += FFABS(src[k-s->linesize ]-src[k ]); |
509 } | 509 } |
510 if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ | 510 if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ |
511 int k; | 511 int k; |
512 for(k=0; k<16; k++) | 512 for(k=0; k<16; k++) |
513 score += ABS(src[k+s->linesize*15]-src[k+s->linesize*16]); | 513 score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]); |
514 } | 514 } |
515 | 515 |
516 if(score <= best_score){ // <= will favor the last MV | 516 if(score <= best_score){ // <= will favor the last MV |
517 best_score= score; | 517 best_score= score; |
518 best_pred= j; | 518 best_pred= j; |