changeset 4001:34fdffe98bd0 libavcodec

Rename ABS macro to FFABS.
author diego
date Wed, 11 Oct 2006 23:17:58 +0000
parents eeab02251056
children ec426fa57dfe
files cabac.h dct-test.c dsputil.c dv.c error_resilience.c ffv1.c flacenc.c h263.c h264.c i386/dsputil_mmx.c jpeg_ls.c motion_est.c motion_est_template.c mpeg12.c mpegvideo.c msmpeg4.c ratecontrol.c resample2.c snow.c vc1.c vorbis.c vp3.c vp6.c wmv2.c
diffstat 24 files changed, 195 insertions(+), 195 deletions(-) [+]
line wrap: on
line diff
--- a/cabac.h	Wed Oct 11 21:34:15 2006 +0000
+++ b/cabac.h	Wed Oct 11 23:17:58 2006 +0000
@@ -219,7 +219,7 @@
     else{
         const int sign= v < 0;
 
-        if(is_signed) v= ABS(v);
+        if(is_signed) v= FFABS(v);
 
         if(v<max){
             for(i=0; i<v; i++){
--- a/dct-test.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/dct-test.c	Wed Oct 11 23:17:58 2006 +0000
@@ -224,7 +224,7 @@
         }
 #endif
     }
-    for(i=0; i<64; i++) sysErrMax= MAX(sysErrMax, ABS(sysErr[i]));
+    for(i=0; i<64; i++) sysErrMax= MAX(sysErrMax, FFABS(sysErr[i]));
 
 #if 1 // dump systematic errors
     for(i=0; i<64; i++){
--- a/dsputil.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/dsputil.c	Wed Oct 11 23:17:58 2006 +0000
@@ -358,7 +358,7 @@
             for(i=0; i<size; i++){
                 for(j=0; j<size; j++){
                     int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori];
-                    s += ABS(v);
+                    s += FFABS(v);
                 }
             }
         }
@@ -2729,7 +2729,7 @@
         src[x-1*stride] = p1;
         src[x+0*stride] = p2;
 
-        ad1= ABS(d1)>>1;
+        ad1= FFABS(d1)>>1;
 
         d2= clip((p0-p3)/4, -ad1, ad1);
 
@@ -2764,7 +2764,7 @@
         src[y*stride-1] = p1;
         src[y*stride+0] = p2;
 
-        ad1= ABS(d1)>>1;
+        ad1= FFABS(d1)>>1;
 
         d2= clip((p0-p3)/4, -ad1, ad1);
 
@@ -2816,18 +2816,18 @@
             const int q1 = pix[1*xstride];
             const int q2 = pix[2*xstride];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
 
                 int tc = tc0[i];
                 int i_delta;
 
-                if( ABS( p2 - p0 ) < beta ) {
+                if( FFABS( p2 - p0 ) < beta ) {
                     pix[-2*xstride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] );
                     tc++;
                 }
-                if( ABS( q2 - q0 ) < beta ) {
+                if( FFABS( q2 - q0 ) < beta ) {
                     pix[   xstride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] );
                     tc++;
                 }
@@ -2864,9 +2864,9 @@
             const int q0 = pix[0];
             const int q1 = pix[1*xstride];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
 
                 int delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
 
@@ -2895,9 +2895,9 @@
         const int q0 = pix[0];
         const int q1 = pix[1*xstride];
 
-        if( ABS( p0 - q0 ) < alpha &&
-            ABS( p1 - p0 ) < beta &&
-            ABS( q1 - q0 ) < beta ) {
+        if( FFABS( p0 - q0 ) < alpha &&
+            FFABS( p1 - p0 ) < beta &&
+            FFABS( q1 - q0 ) < beta ) {
 
             pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
             pix[0]        = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
@@ -3126,9 +3126,9 @@
         }
         if(y+1<h){
             for(x=0; x<15; x++){
-                score2+= ABS(  s1[x  ] - s1[x  +stride]
+                score2+= FFABS(  s1[x  ] - s1[x  +stride]
                              - s1[x+1] + s1[x+1+stride])
-                        -ABS(  s2[x  ] - s2[x  +stride]
+                        -FFABS(  s2[x  ] - s2[x  +stride]
                              - s2[x+1] + s2[x+1+stride]);
             }
         }
@@ -3136,8 +3136,8 @@
         s2+= stride;
     }
 
-    if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + ABS(score2)*8;
+    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+    else  return score1 + FFABS(score2)*8;
 }
 
 static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){
@@ -3152,9 +3152,9 @@
         }
         if(y+1<h){
             for(x=0; x<7; x++){
-                score2+= ABS(  s1[x  ] - s1[x  +stride]
+                score2+= FFABS(  s1[x  ] - s1[x  +stride]
                              - s1[x+1] + s1[x+1+stride])
-                        -ABS(  s2[x  ] - s2[x  +stride]
+                        -FFABS(  s2[x  ] - s2[x  +stride]
                              - s2[x+1] + s2[x+1+stride]);
             }
         }
@@ -3162,8 +3162,8 @@
         s2+= stride;
     }
 
-    if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + ABS(score2)*8;
+    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+    else  return score1 + FFABS(score2)*8;
 }
 
 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
@@ -3353,7 +3353,7 @@
     y= a-b;\
 }
 
-#define BUTTERFLYA(x,y) (ABS((x)+(y)) + ABS((x)-(y)))
+#define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y)))
 
 static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
     int i;
@@ -3450,7 +3450,7 @@
             +BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
     }
 
-    sum -= ABS(temp[8*0] + temp[8*4]); // -mean
+    sum -= FFABS(temp[8*0] + temp[8*4]); // -mean
 
     return sum;
 }
@@ -3467,7 +3467,7 @@
     s->dsp.fdct(temp);
 
     for(i=0; i<64; i++)
-        sum+= ABS(temp[i]);
+        sum+= FFABS(temp[i]);
 
     return sum;
 }
@@ -3516,7 +3516,7 @@
 #undef DST
 
 #define SRC(x) dct[x][i]
-#define DST(x,v) sum += ABS(v)
+#define DST(x,v) sum += FFABS(v)
     for( i = 0; i < 8; i++ )
         DCT8_1D
 #undef SRC
@@ -3537,7 +3537,7 @@
     s->dsp.fdct(temp);
 
     for(i=0; i<64; i++)
-        sum= FFMAX(sum, ABS(temp[i]));
+        sum= FFMAX(sum, FFABS(temp[i]));
 
     return sum;
 }
@@ -3711,8 +3711,8 @@
 
     for(y=1; y<h; y++){
         for(x=0; x<16; x+=4){
-            score+= ABS(s[x  ] - s[x  +stride]) + ABS(s[x+1] - s[x+1+stride])
-                   +ABS(s[x+2] - s[x+2+stride]) + ABS(s[x+3] - s[x+3+stride]);
+            score+= FFABS(s[x  ] - s[x  +stride]) + FFABS(s[x+1] - s[x+1+stride])
+                   +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]);
         }
         s+= stride;
     }
@@ -3726,7 +3726,7 @@
 
     for(y=1; y<h; y++){
         for(x=0; x<16; x++){
-            score+= ABS(s1[x  ] - s2[x ] - s1[x  +stride] + s2[x +stride]);
+            score+= FFABS(s1[x  ] - s2[x ] - s1[x  +stride] + s2[x +stride]);
         }
         s1+= stride;
         s2+= stride;
--- a/dv.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/dv.c	Wed Oct 11 23:17:58 2006 +0000
@@ -705,7 +705,7 @@
               /* weigh it and and shift down into range, adding for rounding */
               /* the extra division by a factor of 2^4 reverses the 8x expansion of the DCT
                  AND the 2x doubling of the weights */
-              level = (ABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4);
+              level = (FFABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4);
               bi->mb[i] = level;
               if(level>max) max= level;
               bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1, level);
--- a/error_resilience.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/error_resilience.c	Wed Oct 11 23:17:58 2006 +0000
@@ -217,7 +217,7 @@
             if(!(left_damage||right_damage)) continue; // both undamaged
 
             if(   (!left_intra) && (!right_intra)
-               && ABS(left_mv[0]-right_mv[0]) + ABS(left_mv[1]+right_mv[1]) < 2) continue;
+               && FFABS(left_mv[0]-right_mv[0]) + FFABS(left_mv[1]+right_mv[1]) < 2) continue;
 
             for(y=0; y<8; y++){
                 int a,b,c,d;
@@ -226,7 +226,7 @@
                 b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride];
                 c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride];
 
-                d= ABS(b) - ((ABS(a) + ABS(c) + 1)>>1);
+                d= FFABS(b) - ((FFABS(a) + FFABS(c) + 1)>>1);
                 d= FFMAX(d, 0);
                 if(b<0) d= -d;
 
@@ -277,7 +277,7 @@
             if(!(top_damage||bottom_damage)) continue; // both undamaged
 
             if(   (!top_intra) && (!bottom_intra)
-               && ABS(top_mv[0]-bottom_mv[0]) + ABS(top_mv[1]+bottom_mv[1]) < 2) continue;
+               && FFABS(top_mv[0]-bottom_mv[0]) + FFABS(top_mv[1]+bottom_mv[1]) < 2) continue;
 
             for(x=0; x<8; x++){
                 int a,b,c,d;
@@ -286,7 +286,7 @@
                 b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride];
                 c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride];
 
-                d= ABS(b) - ((ABS(a) + ABS(c)+1)>>1);
+                d= FFABS(b) - ((FFABS(a) + FFABS(c)+1)>>1);
                 d= FFMAX(d, 0);
                 if(b<0) d= -d;
 
@@ -495,22 +495,22 @@
                         if(mb_x>0 && fixed[mb_xy-1]){
                             int k;
                             for(k=0; k<16; k++)
-                                score += ABS(src[k*s->linesize-1 ]-src[k*s->linesize   ]);
+                                score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize   ]);
                         }
                         if(mb_x+1<mb_width && fixed[mb_xy+1]){
                             int k;
                             for(k=0; k<16; k++)
-                                score += ABS(src[k*s->linesize+15]-src[k*s->linesize+16]);
+                                score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]);
                         }
                         if(mb_y>0 && fixed[mb_xy-mb_stride]){
                             int k;
                             for(k=0; k<16; k++)
-                                score += ABS(src[k-s->linesize   ]-src[k               ]);
+                                score += FFABS(src[k-s->linesize   ]-src[k               ]);
                         }
                         if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){
                             int k;
                             for(k=0; k<16; k++)
-                                score += ABS(src[k+s->linesize*15]-src[k+s->linesize*16]);
+                                score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]);
                         }
 
                         if(score <= best_score){ // <= will favor the last MV
--- a/ffv1.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/ffv1.c	Wed Oct 11 23:17:58 2006 +0000
@@ -225,7 +225,7 @@
     int i;
 
     if(v){
-        const int a= ABS(v);
+        const int a= FFABS(v);
         const int e= av_log2(a);
         put_rac(c, state+0, 0);
 
@@ -273,7 +273,7 @@
 static inline void update_vlc_state(VlcState * const state, const int v){
     int drift= state->drift;
     int count= state->count;
-    state->error_sum += ABS(v);
+    state->error_sum += FFABS(v);
     drift += v;
 
     if(count == 128){ //FIXME variable
--- a/flacenc.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/flacenc.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1032,10 +1032,10 @@
     for(i=2; i<n; i++) {
         lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2];
         rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2];
-        sum[2] += ABS((lt + rt) >> 1);
-        sum[3] += ABS(lt - rt);
-        sum[0] += ABS(lt);
-        sum[1] += ABS(rt);
+        sum[2] += FFABS((lt + rt) >> 1);
+        sum[3] += FFABS(lt - rt);
+        sum[0] += FFABS(lt);
+        sum[1] += FFABS(rt);
     }
     /* estimate bit counts */
     for(i=0; i<4; i++) {
--- a/h263.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/h263.c	Wed Oct 11 23:17:58 2006 +0000
@@ -212,7 +212,7 @@
             int div, error;
             div= (s->avctx->time_base.num*1800000LL + 500LL*s->avctx->time_base.den) / ((1000LL+i)*s->avctx->time_base.den);
             div= clip(1, div, 127);
-            error= ABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div);
+            error= FFABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div);
             if(error < best_error){
                 best_error= error;
                 best_divisor= div;
@@ -4933,7 +4933,7 @@
 
 #if 0
                     if(s->error_resilience >= FF_ER_COMPLIANT){
-                        const int abs_level= ABS(level);
+                        const int abs_level= FFABS(level);
                         if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
                             const int run1= run - rl->max_run[last][abs_level] - 1;
                             if(abs_level <= rl->max_level[last][run]){
--- a/h264.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/h264.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1343,7 +1343,7 @@
             h->dist_scale_factor[i] = 256;
         }else{
             int tb = clip(poc - poc0, -128, 127);
-            int tx = (16384 + (ABS(td) >> 1)) / td;
+            int tx = (16384 + (FFABS(td) >> 1)) / td;
             h->dist_scale_factor[i] = clip((tb*tx + 32) >> 6, -1024, 1023);
         }
     }
@@ -1474,8 +1474,8 @@
             fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
             fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
             if(!IS_INTRA(mb_type_col)
-               && (   (l1ref0[0] == 0 && ABS(l1mv0[0][0]) <= 1 && ABS(l1mv0[0][1]) <= 1)
-                   || (l1ref0[0]  < 0 && l1ref1[0] == 0 && ABS(l1mv1[0][0]) <= 1 && ABS(l1mv1[0][1]) <= 1
+               && (   (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
+                   || (l1ref0[0]  < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1
                        && (h->x264_build>33 || !h->x264_build)))){
                 if(ref[0] > 0)
                     fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv[0][0],mv[0][1]), 4);
@@ -1510,7 +1510,7 @@
                     const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1;
                     if(IS_SUB_8X8(sub_mb_type)){
                         const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride];
-                        if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){
+                        if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
                             if(ref[0] == 0)
                                 fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
                             if(ref[1] == 0)
@@ -1519,7 +1519,7 @@
                     }else
                     for(i4=0; i4<4; i4++){
                         const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride];
-                        if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){
+                        if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
                             if(ref[0] == 0)
                                 *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0;
                             if(ref[1] == 0)
@@ -4213,7 +4213,7 @@
             int td = clip(poc1 - poc0, -128, 127);
             if(td){
                 int tb = clip(cur_poc - poc0, -128, 127);
-                int tx = (16384 + (ABS(td) >> 1)) / td;
+                int tx = (16384 + (FFABS(td) >> 1)) / td;
                 int dist_scale_factor = clip((tb*tx + 32) >> 6, -1024, 1023) >> 2;
                 if(dist_scale_factor < -64 || dist_scale_factor > 128)
                     h->implicit_weight[ref0][ref1] = 32;
@@ -6733,12 +6733,12 @@
                 const int q1 = pix[1];
                 const int q2 = pix[2];
 
-                if( ABS( p0 - q0 ) < alpha &&
-                    ABS( p1 - p0 ) < beta &&
-                    ABS( q1 - q0 ) < beta ) {
-
-                    if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
-                        if( ABS( p2 - p0 ) < beta)
+                if( FFABS( p0 - q0 ) < alpha &&
+                    FFABS( p1 - p0 ) < beta &&
+                    FFABS( q1 - q0 ) < beta ) {
+
+                    if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
+                        if( FFABS( p2 - p0 ) < beta)
                         {
                             const int p3 = pix[-4];
                             /* p0', p1', p2' */
@@ -6749,7 +6749,7 @@
                             /* p0' */
                             pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
                         }
-                        if( ABS( q2 - q0 ) < beta)
+                        if( FFABS( q2 - q0 ) < beta)
                         {
                             const int q3 = pix[3];
                             /* q0', q1', q2' */
@@ -6819,17 +6819,17 @@
             const int q1 = pix[1];
             const int q2 = pix[2];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
                 int tc = tc0;
                 int i_delta;
 
-                if( ABS( p2 - p0 ) < beta ) {
+                if( FFABS( p2 - p0 ) < beta ) {
                     pix[-2] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 );
                     tc++;
                 }
-                if( ABS( q2 - q0 ) < beta ) {
+                if( FFABS( q2 - q0 ) < beta ) {
                     pix[1] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 );
                     tc++;
                 }
@@ -6848,12 +6848,12 @@
             const int q1 = pix[1];
             const int q2 = pix[2];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
-
-                if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
-                    if( ABS( p2 - p0 ) < beta)
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
+
+                if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
+                    if( FFABS( p2 - p0 ) < beta)
                     {
                         const int p3 = pix[-4];
                         /* p0', p1', p2' */
@@ -6864,7 +6864,7 @@
                         /* p0' */
                         pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
                     }
-                    if( ABS( q2 - q0 ) < beta)
+                    if( FFABS( q2 - q0 ) < beta)
                     {
                         const int q3 = pix[3];
                         /* q0', q1', q2' */
@@ -6911,9 +6911,9 @@
             const int q0 = pix[0];
             const int q1 = pix[1];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
                 const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
 
                 pix[-1] = clip_uint8( p0 + i_delta );    /* p0' */
@@ -6926,9 +6926,9 @@
             const int q0 = pix[0];
             const int q1 = pix[1];
 
-            if( ABS( p0 - q0 ) < alpha &&
-                ABS( p1 - p0 ) < beta &&
-                ABS( q1 - q0 ) < beta ) {
+            if( FFABS( p0 - q0 ) < alpha &&
+                FFABS( p1 - p0 ) < beta &&
+                FFABS( q1 - q0 ) < beta ) {
 
                 pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
                 pix[0]  = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
@@ -6960,15 +6960,15 @@
                 const int q1 = pix[1*pix_next];
                 const int q2 = pix[2*pix_next];
 
-                if( ABS( p0 - q0 ) < alpha &&
-                    ABS( p1 - p0 ) < beta &&
-                    ABS( q1 - q0 ) < beta ) {
+                if( FFABS( p0 - q0 ) < alpha &&
+                    FFABS( p1 - p0 ) < beta &&
+                    FFABS( q1 - q0 ) < beta ) {
 
                     const int p3 = pix[-4*pix_next];
                     const int q3 = pix[ 3*pix_next];
 
-                    if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
-                        if( ABS( p2 - p0 ) < beta) {
+                    if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
+                        if( FFABS( p2 - p0 ) < beta) {
                             /* p0', p1', p2' */
                             pix[-1*pix_next] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
                             pix[-2*pix_next] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
@@ -6977,7 +6977,7 @@
                             /* p0' */
                             pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
                         }
-                        if( ABS( q2 - q0 ) < beta) {
+                        if( FFABS( q2 - q0 ) < beta) {
                             /* q0', q1', q2' */
                             pix[0*pix_next] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
                             pix[1*pix_next] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
@@ -7313,8 +7313,8 @@
                     int v = 0;
                     for( l = 0; !v && l < 1 + (h->slice_type == B_TYPE); l++ ) {
                         v |= ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] ||
-                             ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
-                             ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit;
+                             FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
+                             FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit;
                     }
                     bS[0] = bS[1] = bS[2] = bS[3] = v;
                     mv_done = 1;
@@ -7337,8 +7337,8 @@
                         bS[i] = 0;
                         for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) {
                             if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] ||
-                                ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
-                                ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) {
+                                FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
+                                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) {
                                 bS[i] = 1;
                                 break;
                             }
@@ -8505,7 +8505,7 @@
         printf("\n");*/
 
         for(j=0; j<16; j++){
-            int diff= ABS(src[j] - ref[j]);
+            int diff= FFABS(src[j] - ref[j]);
 
             error+= diff*diff;
             max_error= FFMAX(max_error, diff);
--- a/i386/dsputil_mmx.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/i386/dsputil_mmx.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1184,8 +1184,8 @@
     else  score1 = sse16_mmx(c, pix1, pix2, line_size, h);
     score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h);
 
-    if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + ABS(score2)*8;
+    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+    else  return score1 + FFABS(score2)*8;
 }
 
 static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
@@ -1193,8 +1193,8 @@
     int score1= sse8_mmx(c, pix1, pix2, line_size, h);
     int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h);
 
-    if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + ABS(score2)*8;
+    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+    else  return score1 + FFABS(score2)*8;
 }
 
 static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
@@ -2580,7 +2580,7 @@
 static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
     long i=0;
 
-    assert(ABS(scale) < 256);
+    assert(FFABS(scale) < 256);
     scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
 
     asm volatile(
@@ -2628,7 +2628,7 @@
 static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){
     long i=0;
 
-    if(ABS(scale) < 256){
+    if(FFABS(scale) < 256){
         scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
         asm volatile(
                 "pcmpeqw %%mm6, %%mm6   \n\t" // -1w
--- a/jpeg_ls.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/jpeg_ls.c	Wed Oct 11 23:17:58 2006 +0000
@@ -213,7 +213,7 @@
     if(!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
         ret = -(ret + 1);
 
-    state->A[Q] += ABS(ret);
+    state->A[Q] += FFABS(ret);
     ret *= state->twonear;
     state->B[Q] += ret;
 
@@ -274,7 +274,7 @@
     }
 
     /* update state */
-    state->A[Q] += ABS(ret) - RItype;
+    state->A[Q] += FFABS(ret) - RItype;
     ret *= state->twonear;
     if(state->N[Q] == state->reset){
         state->A[Q] >>=1;
@@ -306,7 +306,7 @@
         D1 = Rb - Rc;
         D2 = Rc - Ra;
         /* run mode */
-        if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) {
+        if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) {
             int r;
             int RItype;
 
@@ -340,7 +340,7 @@
 
             /* decode run termination value */
             Rb = last[x];
-            RItype = (ABS(Ra - Rb) <= state->near) ? 1 : 0;
+            RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
             err = ls_get_code_runterm(&s->gb, state, RItype, log2_run[state->run_index[comp]]);
             if(state->run_index[comp])
                 state->run_index[comp]--;
@@ -491,13 +491,13 @@
         err += state->range;
     if(err >= ((state->range + 1) >> 1)) {
         err -= state->range;
-        val = 2 * ABS(err) - 1 - map;
+        val = 2 * FFABS(err) - 1 - map;
     } else
         val = 2 * err + map;
 
     set_ur_golomb_jpegls(pb, val, k, state->limit, state->qbpp);
 
-    state->A[Q] += ABS(err);
+    state->A[Q] += FFABS(err);
     state->B[Q] += err * state->twonear;
 
     if(state->N[Q] == state->reset) {
@@ -598,12 +598,12 @@
         D2 = Rc - Ra;
 
         /* run mode */
-        if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) {
+        if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) {
             int RUNval, RItype, run;
 
             run = 0;
             RUNval = Ra;
-            while(x < w && (ABS(cur[x] - RUNval) <= state->near)){
+            while(x < w && (FFABS(cur[x] - RUNval) <= state->near)){
                 run++;
                 cur[x] = Ra;
                 x += stride;
@@ -612,7 +612,7 @@
             if(x >= w)
                 return;
             Rb = last[x];
-            RItype = (ABS(Ra - Rb) <= state->near);
+            RItype = (FFABS(Ra - Rb) <= state->near);
             pred = RItype ? Ra : Rb;
             err = cur[x] - pred;
 
--- a/motion_est.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/motion_est.c	Wed Oct 11 23:17:58 2006 +0000
@@ -296,14 +296,14 @@
     s = 0;
     for (i = 0; i < 16; i++) {
         for (j = 0; j < 16; j += 8) {
-            s += ABS(pix[0]-mean);
-            s += ABS(pix[1]-mean);
-            s += ABS(pix[2]-mean);
-            s += ABS(pix[3]-mean);
-            s += ABS(pix[4]-mean);
-            s += ABS(pix[5]-mean);
-            s += ABS(pix[6]-mean);
-            s += ABS(pix[7]-mean);
+            s += FFABS(pix[0]-mean);
+            s += FFABS(pix[1]-mean);
+            s += FFABS(pix[2]-mean);
+            s += FFABS(pix[3]-mean);
+            s += FFABS(pix[4]-mean);
+            s += FFABS(pix[5]-mean);
+            s += FFABS(pix[6]-mean);
+            s += FFABS(pix[7]-mean);
             pix += 8;
         }
         pix += line_size - 16;
--- a/motion_est_template.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/motion_est_template.c	Wed Oct 11 23:17:58 2006 +0000
@@ -639,8 +639,8 @@
 {
 int dx, dy, i;
 static int stats[8*8];
-dx= ABS(x-best[0]);
-dy= ABS(y-best[1]);
+dx= FFABS(x-best[0]);
+dy= FFABS(y-best[1]);
 if(dy>dx){
     dx^=dy; dy^=dx; dx^=dy;
 }
@@ -695,7 +695,7 @@
     MotionEstContext * const c= &s->me;
     me_cmp_func cmpf, chroma_cmpf;
     Minima minima[MAX_SAB_SIZE];
-    const int minima_count= ABS(c->dia_size);
+    const int minima_count= FFABS(c->dia_size);
     int i, j;
     LOAD_COMMON
     LOAD_COMMON2
@@ -829,8 +829,8 @@
 {
 int dx, dy, i;
 static int stats[8*8];
-dx= ABS(x-best[0]);
-dy= ABS(y-best[1]);
+dx= FFABS(x-best[0]);
+dy= FFABS(y-best[1]);
 stats[dy*8 + dx] ++;
 if(256*256*256*64 % (stats[0]+1)==0){
     for(i=0; i<64; i++){
--- a/mpeg12.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/mpeg12.c	Wed Oct 11 23:17:58 2006 +0000
@@ -159,7 +159,7 @@
         for(run=0; run<64; run++){
             int len, bits, code;
 
-            int alevel= ABS(level);
+            int alevel= FFABS(level);
             int sign= (level>>31)&1;
 
             if (alevel > rl->max_level[0][run])
@@ -206,7 +206,7 @@
         int64_t n1= 1001LL*s->avctx->time_base.den;
         if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break;
 
-        d = ABS(n0 - n1);
+        d = FFABS(n0 - n1);
         if(d < dmin){
             dmin=d;
             s->frame_rate_index= i;
@@ -279,7 +279,7 @@
                 else
                     error-= av_q2d(mpeg2_aspect[i])*s->height/s->width;
 
-                error= ABS(error);
+                error= FFABS(error);
 
                 if(error < best_aspect_error){
                     best_aspect_error= error;
@@ -806,7 +806,7 @@
                 int bits, code;
                 int diff=i;
 
-                adiff = ABS(diff);
+                adiff = FFABS(diff);
                 if(diff<0) diff--;
                 index = av_log2(2*adiff);
 
--- a/mpegvideo.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/mpegvideo.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1703,7 +1703,7 @@
 
     buf[sy*stride + sx]+= color;
 
-    if(ABS(ex - sx) > ABS(ey - sy)){
+    if(FFABS(ex - sx) > FFABS(ey - sy)){
         if(sx > ex){
             SWAP(int, sx, ex);
             SWAP(int, sy, ey);
@@ -2037,7 +2037,7 @@
 
     for(y=0; y<16; y++){
         for(x=0; x<16; x++){
-            acc+= ABS(src[x+y*stride] - ref);
+            acc+= FFABS(src[x+y*stride] - ref);
         }
     }
 
@@ -2186,9 +2186,9 @@
 
                 switch(s->avctx->frame_skip_exp){
                     case 0: score= FFMAX(score, v); break;
-                    case 1: score+= ABS(v);break;
+                    case 1: score+= FFABS(v);break;
                     case 2: score+= v*v;break;
-                    case 3: score64+= ABS(v*v*(int64_t)v);break;
+                    case 3: score64+= FFABS(v*v*(int64_t)v);break;
                     case 4: score64+= v*v*(int64_t)(v*v);break;
                 }
             }
@@ -2219,7 +2219,7 @@
 
 //    emms_c();
     p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality;
-    b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
+    b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
     if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
 
@@ -4146,7 +4146,7 @@
 
     for(i=0; i<=last_index; i++){
         const int j = s->intra_scantable.permutated[i];
-        const int level = ABS(block[j]);
+        const int level = FFABS(block[j]);
         if(level==1){
             if(skip_dc && i==0) continue;
             score+= tab[run];
@@ -5887,13 +5887,13 @@
 
     for(i=start_i; i<=last_non_zero; i++){
         int level_index, j;
-        const int dct_coeff= ABS(block[ scantable[i] ]);
+        const int dct_coeff= FFABS(block[ scantable[i] ]);
         const int zero_distoration= dct_coeff*dct_coeff;
         int best_score=256*256*256*120;
         for(level_index=0; level_index < coeff_count[i]; level_index++){
             int distoration;
             int level= coeff[level_index][i];
-            const int alevel= ABS(level);
+            const int alevel= FFABS(level);
             int unquant_coeff;
 
             assert(level);
@@ -6003,7 +6003,7 @@
 
     s->coded_score[n] = last_score;
 
-    dc= ABS(block[0]);
+    dc= FFABS(block[0]);
     last_non_zero= last_i - 1;
     memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
 
@@ -6016,7 +6016,7 @@
 
         for(i=0; i<coeff_count[0]; i++){
             int level= coeff[i][0];
-            int alevel= ABS(level);
+            int alevel= FFABS(level);
             int unquant_coeff, score, distortion;
 
             if(s->out_format == FMT_H263){
@@ -6158,7 +6158,7 @@
         int qns=4;
         int w;
 
-        w= ABS(weight[i]) + qns*one;
+        w= FFABS(weight[i]) + qns*one;
         w= 15 + (48*qns*one + w/2)/w; // 16 .. 63
 
         weight[i] = w;
@@ -6282,7 +6282,7 @@
                 int score, new_coeff, unquant_change;
 
                 score=0;
-                if(s->avctx->quantizer_noise_shaping < 2 && ABS(new_level) > ABS(level))
+                if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
                    continue;
 
                 if(new_level){
@@ -6302,7 +6302,7 @@
                                          - last_length[UNI_AC_ENC_INDEX(run, level+64)];
                         }
                     }else{
-                        assert(ABS(new_level)==1);
+                        assert(FFABS(new_level)==1);
 
                         if(analyze_gradient){
                             int g= d1[ scantable[i] ];
@@ -6335,7 +6335,7 @@
                     }
                 }else{
                     new_coeff=0;
-                    assert(ABS(level)==1);
+                    assert(FFABS(level)==1);
 
                     if(i < last_non_zero){
                         int next_i= i + run2 + 1;
@@ -6403,7 +6403,7 @@
 #ifdef REFINE_STATS
 if(block[j]){
     if(block[j] - best_change){
-        if(ABS(block[j]) > ABS(block[j] - best_change)){
+        if(FFABS(block[j]) > FFABS(block[j] - best_change)){
             raise++;
         }else{
             lower++;
--- a/msmpeg4.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/msmpeg4.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1716,7 +1716,7 @@
 //printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y);
 #if 0 // waste of time / this will detect very few errors
                     {
-                        const int abs_level= ABS(level);
+                        const int abs_level= FFABS(level);
                         const int run1= run - rl->max_run[last][abs_level] - run_diff;
                         if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
                             if(abs_level <= rl->max_level[last][run]){
--- a/ratecontrol.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/ratecontrol.c	Wed Oct 11 23:17:58 2006 +0000
@@ -372,7 +372,7 @@
     const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
 
     if     (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
-        q= last_p_q    *ABS(a->i_quant_factor) + a->i_quant_offset;
+        q= last_p_q    *FFABS(a->i_quant_factor) + a->i_quant_offset;
     else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
         q= last_non_b_q*    a->b_quant_factor  + a->b_quant_offset;
 
@@ -403,11 +403,11 @@
     assert(qmin <= qmax);
 
     if(pict_type==B_TYPE){
-        qmin= (int)(qmin*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
-        qmax= (int)(qmax*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
+        qmin= (int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
+        qmax= (int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
     }else if(pict_type==I_TYPE){
-        qmin= (int)(qmin*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
-        qmax= (int)(qmax*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
+        qmin= (int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
+        qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
     }
 
     qmin= clip(qmin, 1, FF_LAMBDA_MAX);
--- a/resample2.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/resample2.c	Wed Oct 11 23:17:58 2006 +0000
@@ -215,7 +215,7 @@
 
         if(sample_index < 0){
             for(i=0; i<c->filter_length; i++)
-                val += src[ABS(sample_index + i) % src_size] * filter[i];
+                val += src[FFABS(sample_index + i) % src_size] * filter[i];
         }else if(sample_index + c->filter_length > src_size){
             break;
         }else if(c->linear){
--- a/snow.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/snow.c	Wed Oct 11 23:17:58 2006 +0000
@@ -590,7 +590,7 @@
     int i;
 
     if(v){
-        const int a= ABS(v);
+        const int a= FFABS(v);
         const int e= av_log2(a);
 #if 1
         const int el= FFMIN(e, 10);
@@ -1666,7 +1666,7 @@
                         p= parent[px + py*2*stride];
                 }
                 if(/*ll|*/l|lt|t|rt|p){
-                    int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p));
+                    int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
 
                     put_rac(&s->c, &b->state[0][context], !!v);
                 }else{
@@ -1682,11 +1682,11 @@
                     }
                 }
                 if(v){
-                    int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p));
-                    int l2= 2*ABS(l) + (l<0);
-                    int t2= 2*ABS(t) + (t<0);
-
-                    put_symbol2(&s->c, b->state[context + 2], ABS(v)-1, context-4);
+                    int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
+                    int l2= 2*FFABS(l) + (l<0);
+                    int t2= 2*FFABS(t) + (t<0);
+
+                    put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4);
                     put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0);
                 }
             }
@@ -1749,7 +1749,7 @@
                     }
                 }
                 if(/*ll|*/l|lt|t|rt|p){
-                    int context= av_log2(/*ABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));
+                    int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));
 
                     v=get_rac(&s->c, &b->state[0][context]);
                     if(v){
@@ -2016,8 +2016,8 @@
     const int shift= 1+qpel;
     MotionEstContext *c= &s->m.me;
     int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-    int mx_context= av_log2(2*ABS(left->mx - top->mx));
-    int my_context= av_log2(2*ABS(left->my - top->my));
+    int mx_context= av_log2(2*FFABS(left->mx - top->mx));
+    int my_context= av_log2(2*FFABS(left->my - top->my));
     int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
     int ref, best_ref, ref_score, ref_mx, ref_my;
 
@@ -2229,8 +2229,8 @@
     int pcr= left->color[2];
     int pmx, pmy;
     int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-    int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 16*!!b->ref;
-    int my_context= av_log2(2*ABS(left->my - top->my)) + 16*!!b->ref;
+    int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 16*!!b->ref;
+    int my_context= av_log2(2*FFABS(left->my - top->my)) + 16*!!b->ref;
     int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
 
     if(s->keyframe){
@@ -2293,8 +2293,8 @@
         int my= mid_pred(left->my, top->my, tr->my);
         int ref = 0;
         int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-        int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 0*av_log2(2*ABS(tr->mx - top->mx));
-        int my_context= av_log2(2*ABS(left->my - top->my)) + 0*av_log2(2*ABS(tr->my - top->my));
+        int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
+        int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
 
         type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
 
@@ -2908,8 +2908,8 @@
     BlockNode *tl    = y && x ? &s->block[index-b_stride-1] : left;
     BlockNode *tr    = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl;
     int dmx, dmy;
-//  int mx_context= av_log2(2*ABS(left->mx - top->mx));
-//  int my_context= av_log2(2*ABS(left->my - top->my));
+//  int mx_context= av_log2(2*FFABS(left->mx - top->mx));
+//  int my_context= av_log2(2*FFABS(left->my - top->my));
 
     if(x<0 || x>=b_stride || y>=b_height)
         return 0;
@@ -2923,15 +2923,15 @@
 //FIXME try accurate rate
 //FIXME intra and inter predictors if surrounding blocks arent the same type
     if(b->type & BLOCK_INTRA){
-        return 3+2*( av_log2(2*ABS(left->color[0] - b->color[0]))
-                   + av_log2(2*ABS(left->color[1] - b->color[1]))
-                   + av_log2(2*ABS(left->color[2] - b->color[2])));
+        return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0]))
+                   + av_log2(2*FFABS(left->color[1] - b->color[1]))
+                   + av_log2(2*FFABS(left->color[2] - b->color[2])));
     }else{
         pred_mv(s, &dmx, &dmy, b->ref, left, top, tr);
         dmx-= b->mx;
         dmy-= b->my;
-        return 2*(1 + av_log2(2*ABS(dmx)) //FIXME kill the 2* can be merged in lambda
-                    + av_log2(2*ABS(dmy))
+        return 2*(1 + av_log2(2*FFABS(dmx)) //FIXME kill the 2* can be merged in lambda
+                    + av_log2(2*FFABS(dmy))
                     + av_log2(2*b->ref));
     }
 }
@@ -4563,7 +4563,7 @@
     ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
 
     for(i=0; i<width*height; i++)
-        if(ABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]);
+        if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]);
 
 #if 0
     printf("testing AC coder\n");
@@ -4573,7 +4573,7 @@
 
     for(i=-256; i<256; i++){
 START_TIMER
-        put_symbol(&s.c, s.header_state, i*i*i/3*ABS(i), 1);
+        put_symbol(&s.c, s.header_state, i*i*i/3*FFABS(i), 1);
 STOP_TIMER("put_symbol")
     }
     ff_rac_terminate(&s.c);
@@ -4587,7 +4587,7 @@
 START_TIMER
         j= get_symbol(&s.c, s.header_state, 1);
 STOP_TIMER("get_symbol")
-        if(j!=i*i*i/3*ABS(i)) printf("fsck: %d != %d\n", i, j);
+        if(j!=i*i*i/3*FFABS(i)) printf("fsck: %d != %d\n", i, j);
     }
 #endif
 {
@@ -4616,9 +4616,9 @@
                 for(x=0; x<width; x++){
                     int64_t d= buffer[0][x + y*width];
                     error += d*d;
-                    if(ABS(width/2-x)<9 && ABS(height/2-y)<9 && level==2) printf("%8lld ", d);
+                    if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8lld ", d);
                 }
-                if(ABS(height/2-y)<9 && level==2) printf("\n");
+                if(FFABS(height/2-y)<9 && level==2) printf("\n");
             }
             error= (int)(sqrt(error)+0.5);
             errors[level][orientation]= error;
@@ -4669,9 +4669,9 @@
                 for(x=0; x<width; x++){
                     int64_t d= buffer[0][x + y*width];
                     error += d*d;
-                    if(ABS(width/2-x)<9 && ABS(height/2-y)<9) printf("%8lld ", d);
+                    if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9) printf("%8lld ", d);
                 }
-                if(ABS(height/2-y)<9) printf("\n");
+                if(FFABS(height/2-y)<9) printf("\n");
             }
     }
 
--- a/vc1.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/vc1.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1950,9 +1950,9 @@
     /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
     if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) {
         if(is_intra[xy - wrap])
-            sum = ABS(px) + ABS(py);
+            sum = FFABS(px) + FFABS(py);
         else
-            sum = ABS(px - A[0]) + ABS(py - A[1]);
+            sum = FFABS(px - A[0]) + FFABS(py - A[1]);
         if(sum > 32) {
             if(get_bits1(&s->gb)) {
                 px = A[0];
@@ -1963,9 +1963,9 @@
             }
         } else {
             if(is_intra[xy - 1])
-                sum = ABS(px) + ABS(py);
+                sum = FFABS(px) + FFABS(py);
             else
-                sum = ABS(px - C[0]) + ABS(py - C[1]);
+                sum = FFABS(px - C[0]) + FFABS(py - C[1]);
             if(sum > 32) {
                 if(get_bits1(&s->gb)) {
                     px = A[0];
@@ -2218,9 +2218,9 @@
         /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
         if(0 && !s->first_slice_line && s->mb_x) {
             if(is_intra[xy - wrap])
-                sum = ABS(px) + ABS(py);
+                sum = FFABS(px) + FFABS(py);
             else
-                sum = ABS(px - A[0]) + ABS(py - A[1]);
+                sum = FFABS(px - A[0]) + FFABS(py - A[1]);
             if(sum > 32) {
                 if(get_bits1(&s->gb)) {
                     px = A[0];
@@ -2231,9 +2231,9 @@
                 }
             } else {
                 if(is_intra[xy - 2])
-                    sum = ABS(px) + ABS(py);
+                    sum = FFABS(px) + FFABS(py);
                 else
-                    sum = ABS(px - C[0]) + ABS(py - C[1]);
+                    sum = FFABS(px - C[0]) + FFABS(py - C[1]);
                 if(sum > 32) {
                     if(get_bits1(&s->gb)) {
                         px = A[0];
@@ -2295,9 +2295,9 @@
         /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
         if(0 && !s->first_slice_line && s->mb_x) {
             if(is_intra[xy - wrap])
-                sum = ABS(px) + ABS(py);
+                sum = FFABS(px) + FFABS(py);
             else
-                sum = ABS(px - A[0]) + ABS(py - A[1]);
+                sum = FFABS(px - A[0]) + FFABS(py - A[1]);
             if(sum > 32) {
                 if(get_bits1(&s->gb)) {
                     px = A[0];
@@ -2308,9 +2308,9 @@
                 }
             } else {
                 if(is_intra[xy - 2])
-                    sum = ABS(px) + ABS(py);
+                    sum = FFABS(px) + FFABS(py);
                 else
-                    sum = ABS(px - C[0]) + ABS(py - C[1]);
+                    sum = FFABS(px - C[0]) + FFABS(py - C[1]);
                 if(sum > 32) {
                     if(get_bits1(&s->gb)) {
                         px = A[0];
--- a/vorbis.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/vorbis.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1236,7 +1236,7 @@
 static void render_line(int x0, int y0, int x1, int y1, float * buf, int n) {
     int dy = y1 - y0;
     int adx = x1 - x0;
-    int ady = ABS(dy);
+    int ady = FFABS(dy);
     int base = dy / adx;
     int x = x0;
     int y = y0;
@@ -1244,7 +1244,7 @@
     int sy;
     if (dy < 0) sy = base - 1;
     else        sy = base + 1;
-    ady = ady - ABS(base) * adx;
+    ady = ady - FFABS(base) * adx;
     if (x >= n) return;
     buf[x] = ff_vorbis_floor1_inverse_db_table[y];
     for (x = x0 + 1; x < x1; x++) {
@@ -1354,7 +1354,7 @@
         high_neigh_offs=vf->list[i].high;
         dy=floor1_Y_final[high_neigh_offs]-floor1_Y_final[low_neigh_offs];  // render_point begin
         adx=vf->list[high_neigh_offs].x-vf->list[low_neigh_offs].x;
-        ady= ABS(dy);
+        ady= FFABS(dy);
         err=ady*(vf->list[i].x-vf->list[low_neigh_offs].x);
         off=(int16_t)err/(int16_t)adx;
         if (dy<0) {
--- a/vp3.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/vp3.c	Wed Oct 11 23:17:58 2006 +0000
@@ -1455,11 +1455,11 @@
                     /* check for outranging on the [ul u l] and
                      * [ul u ur l] predictors */
                     if ((transform == 13) || (transform == 15)) {
-                        if (ABS(predicted_dc - vu) > 128)
+                        if (FFABS(predicted_dc - vu) > 128)
                             predicted_dc = vu;
-                        else if (ABS(predicted_dc - vl) > 128)
+                        else if (FFABS(predicted_dc - vl) > 128)
                             predicted_dc = vl;
-                        else if (ABS(predicted_dc - vul) > 128)
+                        else if (FFABS(predicted_dc - vul) > 128)
                             predicted_dc = vul;
                     }
 
@@ -1527,7 +1527,7 @@
         if (!s->flipped_image) stride = -stride;
 
 
-        if(ABS(stride) > 2048)
+        if(FFABS(stride) > 2048)
             return; //various tables are fixed size
 
         /* for each fragment row in the slice (both of them)... */
--- a/vp6.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/vp6.c	Wed Oct 11 23:17:58 2006 +0000
@@ -428,8 +428,8 @@
         filter4 = s->filter_mode;
         if (filter4 == 2) {
             if (s->max_vector_length &&
-                (ABS(mv.x) > s->max_vector_length ||
-                 ABS(mv.y) > s->max_vector_length)) {
+                (FFABS(mv.x) > s->max_vector_length ||
+                 FFABS(mv.y) > s->max_vector_length)) {
                 filter4 = 0;
             } else if (!s->sample_variance_threshold
                        || (vp6_block_variance(src+offset1, stride)
--- a/wmv2.c	Wed Oct 11 21:34:15 2006 +0000
+++ b/wmv2.c	Wed Oct 11 23:17:58 2006 +0000
@@ -513,7 +513,7 @@
     C = s->current_picture.motion_val[0][xy + 2 - wrap];
 
     if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
-        diff= FFMAX(ABS(A[0] - B[0]), ABS(A[1] - B[1]));
+        diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
     else
         diff=0;