Originally committed as revision 6666 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diego Biurrun authored on 2006/10/12 08:17:58... | ... |
@@ -1924,7 +1924,7 @@ static int av_encode(AVFormatContext **output_files, |
1924 | 1924 |
// fprintf(stderr, "next:%lld dts:%lld off:%lld %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type); |
1925 | 1925 |
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE) { |
1926 | 1926 |
int64_t delta= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q) - ist->next_pts; |
1927 |
- if(ABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE && !copy_ts){ |
|
1927 |
+ if(FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE && !copy_ts){ |
|
1928 | 1928 |
input_files_ts_offset[ist->file_index]-= delta; |
1929 | 1929 |
if (verbose > 2) |
1930 | 1930 |
fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files_ts_offset[ist->file_index]); |
... | ... |
@@ -224,7 +224,7 @@ void dct_error(const char *name, int is_idct, |
224 | 224 |
} |
225 | 225 |
#endif |
226 | 226 |
} |
227 |
- for(i=0; i<64; i++) sysErrMax= MAX(sysErrMax, ABS(sysErr[i])); |
|
227 |
+ for(i=0; i<64; i++) sysErrMax= MAX(sysErrMax, FFABS(sysErr[i])); |
|
228 | 228 |
|
229 | 229 |
#if 1 // dump systematic errors |
230 | 230 |
for(i=0; i<64; i++){ |
... | ... |
@@ -358,7 +358,7 @@ static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in |
358 | 358 |
for(i=0; i<size; i++){ |
359 | 359 |
for(j=0; j<size; j++){ |
360 | 360 |
int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori]; |
361 |
- s += ABS(v); |
|
361 |
+ s += FFABS(v); |
|
362 | 362 |
} |
363 | 363 |
} |
364 | 364 |
} |
... | ... |
@@ -2729,7 +2729,7 @@ static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ |
2729 | 2729 |
src[x-1*stride] = p1; |
2730 | 2730 |
src[x+0*stride] = p2; |
2731 | 2731 |
|
2732 |
- ad1= ABS(d1)>>1; |
|
2732 |
+ ad1= FFABS(d1)>>1; |
|
2733 | 2733 |
|
2734 | 2734 |
d2= clip((p0-p3)/4, -ad1, ad1); |
2735 | 2735 |
|
... | ... |
@@ -2764,7 +2764,7 @@ static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ |
2764 | 2764 |
src[y*stride-1] = p1; |
2765 | 2765 |
src[y*stride+0] = p2; |
2766 | 2766 |
|
2767 |
- ad1= ABS(d1)>>1; |
|
2767 |
+ ad1= FFABS(d1)>>1; |
|
2768 | 2768 |
|
2769 | 2769 |
d2= clip((p0-p3)/4, -ad1, ad1); |
2770 | 2770 |
|
... | ... |
@@ -2816,18 +2816,18 @@ static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystrid |
2816 | 2816 |
const int q1 = pix[1*xstride]; |
2817 | 2817 |
const int q2 = pix[2*xstride]; |
2818 | 2818 |
|
2819 |
- if( ABS( p0 - q0 ) < alpha && |
|
2820 |
- ABS( p1 - p0 ) < beta && |
|
2821 |
- ABS( q1 - q0 ) < beta ) { |
|
2819 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
2820 |
+ FFABS( p1 - p0 ) < beta && |
|
2821 |
+ FFABS( q1 - q0 ) < beta ) { |
|
2822 | 2822 |
|
2823 | 2823 |
int tc = tc0[i]; |
2824 | 2824 |
int i_delta; |
2825 | 2825 |
|
2826 |
- if( ABS( p2 - p0 ) < beta ) { |
|
2826 |
+ if( FFABS( p2 - p0 ) < beta ) { |
|
2827 | 2827 |
pix[-2*xstride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); |
2828 | 2828 |
tc++; |
2829 | 2829 |
} |
2830 |
- if( ABS( q2 - q0 ) < beta ) { |
|
2830 |
+ if( FFABS( q2 - q0 ) < beta ) { |
|
2831 | 2831 |
pix[ xstride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); |
2832 | 2832 |
tc++; |
2833 | 2833 |
} |
... | ... |
@@ -2864,9 +2864,9 @@ static inline void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystr |
2864 | 2864 |
const int q0 = pix[0]; |
2865 | 2865 |
const int q1 = pix[1*xstride]; |
2866 | 2866 |
|
2867 |
- if( ABS( p0 - q0 ) < alpha && |
|
2868 |
- ABS( p1 - p0 ) < beta && |
|
2869 |
- ABS( q1 - q0 ) < beta ) { |
|
2867 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
2868 |
+ FFABS( p1 - p0 ) < beta && |
|
2869 |
+ FFABS( q1 - q0 ) < beta ) { |
|
2870 | 2870 |
|
2871 | 2871 |
int delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); |
2872 | 2872 |
|
... | ... |
@@ -2895,9 +2895,9 @@ static inline void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, in |
2895 | 2895 |
const int q0 = pix[0]; |
2896 | 2896 |
const int q1 = pix[1*xstride]; |
2897 | 2897 |
|
2898 |
- if( ABS( p0 - q0 ) < alpha && |
|
2899 |
- ABS( p1 - p0 ) < beta && |
|
2900 |
- ABS( q1 - q0 ) < beta ) { |
|
2898 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
2899 |
+ FFABS( p1 - p0 ) < beta && |
|
2900 |
+ FFABS( q1 - q0 ) < beta ) { |
|
2901 | 2901 |
|
2902 | 2902 |
pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ |
2903 | 2903 |
pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ |
... | ... |
@@ -3126,9 +3126,9 @@ static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3126 | 3126 |
} |
3127 | 3127 |
if(y+1<h){ |
3128 | 3128 |
for(x=0; x<15; x++){ |
3129 |
- score2+= ABS( s1[x ] - s1[x +stride] |
|
3129 |
+ score2+= FFABS( s1[x ] - s1[x +stride] |
|
3130 | 3130 |
- s1[x+1] + s1[x+1+stride]) |
3131 |
- -ABS( s2[x ] - s2[x +stride] |
|
3131 |
+ -FFABS( s2[x ] - s2[x +stride] |
|
3132 | 3132 |
- s2[x+1] + s2[x+1+stride]); |
3133 | 3133 |
} |
3134 | 3134 |
} |
... | ... |
@@ -3136,8 +3136,8 @@ static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3136 | 3136 |
s2+= stride; |
3137 | 3137 |
} |
3138 | 3138 |
|
3139 |
- if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; |
|
3140 |
- else return score1 + ABS(score2)*8; |
|
3139 |
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
|
3140 |
+ else return score1 + FFABS(score2)*8; |
|
3141 | 3141 |
} |
3142 | 3142 |
|
3143 | 3143 |
static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
... | ... |
@@ -3152,9 +3152,9 @@ static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3152 | 3152 |
} |
3153 | 3153 |
if(y+1<h){ |
3154 | 3154 |
for(x=0; x<7; x++){ |
3155 |
- score2+= ABS( s1[x ] - s1[x +stride] |
|
3155 |
+ score2+= FFABS( s1[x ] - s1[x +stride] |
|
3156 | 3156 |
- s1[x+1] + s1[x+1+stride]) |
3157 |
- -ABS( s2[x ] - s2[x +stride] |
|
3157 |
+ -FFABS( s2[x ] - s2[x +stride] |
|
3158 | 3158 |
- s2[x+1] + s2[x+1+stride]); |
3159 | 3159 |
} |
3160 | 3160 |
} |
... | ... |
@@ -3162,8 +3162,8 @@ static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3162 | 3162 |
s2+= stride; |
3163 | 3163 |
} |
3164 | 3164 |
|
3165 |
- if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; |
|
3166 |
- else return score1 + ABS(score2)*8; |
|
3165 |
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
|
3166 |
+ else return score1 + FFABS(score2)*8; |
|
3167 | 3167 |
} |
3168 | 3168 |
|
3169 | 3169 |
static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ |
... | ... |
@@ -3353,7 +3353,7 @@ o2= (i1)-(i2); |
3353 | 3353 |
y= a-b;\ |
3354 | 3354 |
} |
3355 | 3355 |
|
3356 |
-#define BUTTERFLYA(x,y) (ABS((x)+(y)) + ABS((x)-(y))) |
|
3356 |
+#define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y))) |
|
3357 | 3357 |
|
3358 | 3358 |
static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){ |
3359 | 3359 |
int i; |
... | ... |
@@ -3450,7 +3450,7 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_ |
3450 | 3450 |
+BUTTERFLYA(temp[8*3+i], temp[8*7+i]); |
3451 | 3451 |
} |
3452 | 3452 |
|
3453 |
- sum -= ABS(temp[8*0] + temp[8*4]); // -mean |
|
3453 |
+ sum -= FFABS(temp[8*0] + temp[8*4]); // -mean |
|
3454 | 3454 |
|
3455 | 3455 |
return sum; |
3456 | 3456 |
} |
... | ... |
@@ -3467,7 +3467,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 |
3467 | 3467 |
s->dsp.fdct(temp); |
3468 | 3468 |
|
3469 | 3469 |
for(i=0; i<64; i++) |
3470 |
- sum+= ABS(temp[i]); |
|
3470 |
+ sum+= FFABS(temp[i]); |
|
3471 | 3471 |
|
3472 | 3472 |
return sum; |
3473 | 3473 |
} |
... | ... |
@@ -3516,7 +3516,7 @@ static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s |
3516 | 3516 |
#undef DST |
3517 | 3517 |
|
3518 | 3518 |
#define SRC(x) dct[x][i] |
3519 |
-#define DST(x,v) sum += ABS(v) |
|
3519 |
+#define DST(x,v) sum += FFABS(v) |
|
3520 | 3520 |
for( i = 0; i < 8; i++ ) |
3521 | 3521 |
DCT8_1D |
3522 | 3522 |
#undef SRC |
... | ... |
@@ -3537,7 +3537,7 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 |
3537 | 3537 |
s->dsp.fdct(temp); |
3538 | 3538 |
|
3539 | 3539 |
for(i=0; i<64; i++) |
3540 |
- sum= FFMAX(sum, ABS(temp[i])); |
|
3540 |
+ sum= FFMAX(sum, FFABS(temp[i])); |
|
3541 | 3541 |
|
3542 | 3542 |
return sum; |
3543 | 3543 |
} |
... | ... |
@@ -3711,8 +3711,8 @@ static int vsad_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy |
3711 | 3711 |
|
3712 | 3712 |
for(y=1; y<h; y++){ |
3713 | 3713 |
for(x=0; x<16; x+=4){ |
3714 |
- score+= ABS(s[x ] - s[x +stride]) + ABS(s[x+1] - s[x+1+stride]) |
|
3715 |
- +ABS(s[x+2] - s[x+2+stride]) + ABS(s[x+3] - s[x+3+stride]); |
|
3714 |
+ score+= FFABS(s[x ] - s[x +stride]) + FFABS(s[x+1] - s[x+1+stride]) |
|
3715 |
+ +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]); |
|
3716 | 3716 |
} |
3717 | 3717 |
s+= stride; |
3718 | 3718 |
} |
... | ... |
@@ -3726,7 +3726,7 @@ static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int st |
3726 | 3726 |
|
3727 | 3727 |
for(y=1; y<h; y++){ |
3728 | 3728 |
for(x=0; x<16; x++){ |
3729 |
- score+= ABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); |
|
3729 |
+ score+= FFABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); |
|
3730 | 3730 |
} |
3731 | 3731 |
s1+= stride; |
3732 | 3732 |
s2+= stride; |
... | ... |
@@ -705,7 +705,7 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, |
705 | 705 |
/* weigh it and and shift down into range, adding for rounding */ |
706 | 706 |
/* the extra division by a factor of 2^4 reverses the 8x expansion of the DCT |
707 | 707 |
AND the 2x doubling of the weights */ |
708 |
- level = (ABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4); |
|
708 |
+ level = (FFABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4); |
|
709 | 709 |
bi->mb[i] = level; |
710 | 710 |
if(level>max) max= level; |
711 | 711 |
bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, level); |
... | ... |
@@ -217,7 +217,7 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st |
217 | 217 |
if(!(left_damage||right_damage)) continue; // both undamaged |
218 | 218 |
|
219 | 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 | 222 |
for(y=0; y<8; y++){ |
223 | 223 |
int a,b,c,d; |
... | ... |
@@ -226,7 +226,7 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st |
226 | 226 |
b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride]; |
227 | 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 | 230 |
d= FFMAX(d, 0); |
231 | 231 |
if(b<0) d= -d; |
232 | 232 |
|
... | ... |
@@ -277,7 +277,7 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st |
277 | 277 |
if(!(top_damage||bottom_damage)) continue; // both undamaged |
278 | 278 |
|
279 | 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 | 282 |
for(x=0; x<8; x++){ |
283 | 283 |
int a,b,c,d; |
... | ... |
@@ -286,7 +286,7 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st |
286 | 286 |
b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride]; |
287 | 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 | 290 |
d= FFMAX(d, 0); |
291 | 291 |
if(b<0) d= -d; |
292 | 292 |
|
... | ... |
@@ -495,22 +495,22 @@ int score_sum=0; |
495 | 495 |
if(mb_x>0 && fixed[mb_xy-1]){ |
496 | 496 |
int k; |
497 | 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 | 500 |
if(mb_x+1<mb_width && fixed[mb_xy+1]){ |
501 | 501 |
int k; |
502 | 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 | 505 |
if(mb_y>0 && fixed[mb_xy-mb_stride]){ |
506 | 506 |
int k; |
507 | 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 | 510 |
if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ |
511 | 511 |
int k; |
512 | 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 | 516 |
if(score <= best_score){ // <= will favor the last MV |
... | ... |
@@ -225,7 +225,7 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe |
225 | 225 |
int i; |
226 | 226 |
|
227 | 227 |
if(v){ |
228 |
- const int a= ABS(v); |
|
228 |
+ const int a= FFABS(v); |
|
229 | 229 |
const int e= av_log2(a); |
230 | 230 |
put_rac(c, state+0, 0); |
231 | 231 |
|
... | ... |
@@ -273,7 +273,7 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ |
273 | 273 |
static inline void update_vlc_state(VlcState * const state, const int v){ |
274 | 274 |
int drift= state->drift; |
275 | 275 |
int count= state->count; |
276 |
- state->error_sum += ABS(v); |
|
276 |
+ state->error_sum += FFABS(v); |
|
277 | 277 |
drift += v; |
278 | 278 |
|
279 | 279 |
if(count == 128){ //FIXME variable |
... | ... |
@@ -1032,10 +1032,10 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n) |
1032 | 1032 |
for(i=2; i<n; i++) { |
1033 | 1033 |
lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2]; |
1034 | 1034 |
rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2]; |
1035 |
- sum[2] += ABS((lt + rt) >> 1); |
|
1036 |
- sum[3] += ABS(lt - rt); |
|
1037 |
- sum[0] += ABS(lt); |
|
1038 |
- sum[1] += ABS(rt); |
|
1035 |
+ sum[2] += FFABS((lt + rt) >> 1); |
|
1036 |
+ sum[3] += FFABS(lt - rt); |
|
1037 |
+ sum[0] += FFABS(lt); |
|
1038 |
+ sum[1] += FFABS(rt); |
|
1039 | 1039 |
} |
1040 | 1040 |
/* estimate bit counts */ |
1041 | 1041 |
for(i=0; i<4; i++) { |
... | ... |
@@ -212,7 +212,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) |
212 | 212 |
int div, error; |
213 | 213 |
div= (s->avctx->time_base.num*1800000LL + 500LL*s->avctx->time_base.den) / ((1000LL+i)*s->avctx->time_base.den); |
214 | 214 |
div= clip(1, div, 127); |
215 |
- error= ABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div); |
|
215 |
+ error= FFABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div); |
|
216 | 216 |
if(error < best_error){ |
217 | 217 |
best_error= error; |
218 | 218 |
best_divisor= div; |
... | ... |
@@ -4933,7 +4933,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, |
4933 | 4933 |
|
4934 | 4934 |
#if 0 |
4935 | 4935 |
if(s->error_resilience >= FF_ER_COMPLIANT){ |
4936 |
- const int abs_level= ABS(level); |
|
4936 |
+ const int abs_level= FFABS(level); |
|
4937 | 4937 |
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ |
4938 | 4938 |
const int run1= run - rl->max_run[last][abs_level] - 1; |
4939 | 4939 |
if(abs_level <= rl->max_level[last][run]){ |
... | ... |
@@ -1343,7 +1343,7 @@ static inline void direct_dist_scale_factor(H264Context * const h){ |
1343 | 1343 |
h->dist_scale_factor[i] = 256; |
1344 | 1344 |
}else{ |
1345 | 1345 |
int tb = clip(poc - poc0, -128, 127); |
1346 |
- int tx = (16384 + (ABS(td) >> 1)) / td; |
|
1346 |
+ int tx = (16384 + (FFABS(td) >> 1)) / td; |
|
1347 | 1347 |
h->dist_scale_factor[i] = clip((tb*tx + 32) >> 6, -1024, 1023); |
1348 | 1348 |
} |
1349 | 1349 |
} |
... | ... |
@@ -1474,8 +1474,8 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ |
1474 | 1474 |
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); |
1475 | 1475 |
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); |
1476 | 1476 |
if(!IS_INTRA(mb_type_col) |
1477 |
- && ( (l1ref0[0] == 0 && ABS(l1mv0[0][0]) <= 1 && ABS(l1mv0[0][1]) <= 1) |
|
1478 |
- || (l1ref0[0] < 0 && l1ref1[0] == 0 && ABS(l1mv1[0][0]) <= 1 && ABS(l1mv1[0][1]) <= 1 |
|
1477 |
+ && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) |
|
1478 |
+ || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 |
|
1479 | 1479 |
&& (h->x264_build>33 || !h->x264_build)))){ |
1480 | 1480 |
if(ref[0] > 0) |
1481 | 1481 |
fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv[0][0],mv[0][1]), 4); |
... | ... |
@@ -1510,7 +1510,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ |
1510 | 1510 |
const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; |
1511 | 1511 |
if(IS_SUB_8X8(sub_mb_type)){ |
1512 | 1512 |
const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; |
1513 |
- if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ |
|
1513 |
+ if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ |
|
1514 | 1514 |
if(ref[0] == 0) |
1515 | 1515 |
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); |
1516 | 1516 |
if(ref[1] == 0) |
... | ... |
@@ -1519,7 +1519,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ |
1519 | 1519 |
}else |
1520 | 1520 |
for(i4=0; i4<4; i4++){ |
1521 | 1521 |
const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; |
1522 |
- if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ |
|
1522 |
+ if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ |
|
1523 | 1523 |
if(ref[0] == 0) |
1524 | 1524 |
*(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; |
1525 | 1525 |
if(ref[1] == 0) |
... | ... |
@@ -4213,7 +4213,7 @@ static void implicit_weight_table(H264Context *h){ |
4213 | 4213 |
int td = clip(poc1 - poc0, -128, 127); |
4214 | 4214 |
if(td){ |
4215 | 4215 |
int tb = clip(cur_poc - poc0, -128, 127); |
4216 |
- int tx = (16384 + (ABS(td) >> 1)) / td; |
|
4216 |
+ int tx = (16384 + (FFABS(td) >> 1)) / td; |
|
4217 | 4217 |
int dist_scale_factor = clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; |
4218 | 4218 |
if(dist_scale_factor < -64 || dist_scale_factor > 128) |
4219 | 4219 |
h->implicit_weight[ref0][ref1] = 32; |
... | ... |
@@ -6733,12 +6733,12 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int16_t b |
6733 | 6733 |
const int q1 = pix[1]; |
6734 | 6734 |
const int q2 = pix[2]; |
6735 | 6735 |
|
6736 |
- if( ABS( p0 - q0 ) < alpha && |
|
6737 |
- ABS( p1 - p0 ) < beta && |
|
6738 |
- ABS( q1 - q0 ) < beta ) { |
|
6736 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6737 |
+ FFABS( p1 - p0 ) < beta && |
|
6738 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6739 | 6739 |
|
6740 |
- if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6741 |
- if( ABS( p2 - p0 ) < beta) |
|
6740 |
+ if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6741 |
+ if( FFABS( p2 - p0 ) < beta) |
|
6742 | 6742 |
{ |
6743 | 6743 |
const int p3 = pix[-4]; |
6744 | 6744 |
/* p0', p1', p2' */ |
... | ... |
@@ -6749,7 +6749,7 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int16_t b |
6749 | 6749 |
/* p0' */ |
6750 | 6750 |
pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; |
6751 | 6751 |
} |
6752 |
- if( ABS( q2 - q0 ) < beta) |
|
6752 |
+ if( FFABS( q2 - q0 ) < beta) |
|
6753 | 6753 |
{ |
6754 | 6754 |
const int q3 = pix[3]; |
6755 | 6755 |
/* q0', q1', q2' */ |
... | ... |
@@ -6819,17 +6819,17 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int |
6819 | 6819 |
const int q1 = pix[1]; |
6820 | 6820 |
const int q2 = pix[2]; |
6821 | 6821 |
|
6822 |
- if( ABS( p0 - q0 ) < alpha && |
|
6823 |
- ABS( p1 - p0 ) < beta && |
|
6824 |
- ABS( q1 - q0 ) < beta ) { |
|
6822 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6823 |
+ FFABS( p1 - p0 ) < beta && |
|
6824 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6825 | 6825 |
int tc = tc0; |
6826 | 6826 |
int i_delta; |
6827 | 6827 |
|
6828 |
- if( ABS( p2 - p0 ) < beta ) { |
|
6828 |
+ if( FFABS( p2 - p0 ) < beta ) { |
|
6829 | 6829 |
pix[-2] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); |
6830 | 6830 |
tc++; |
6831 | 6831 |
} |
6832 |
- if( ABS( q2 - q0 ) < beta ) { |
|
6832 |
+ if( FFABS( q2 - q0 ) < beta ) { |
|
6833 | 6833 |
pix[1] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); |
6834 | 6834 |
tc++; |
6835 | 6835 |
} |
... | ... |
@@ -6848,12 +6848,12 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int |
6848 | 6848 |
const int q1 = pix[1]; |
6849 | 6849 |
const int q2 = pix[2]; |
6850 | 6850 |
|
6851 |
- if( ABS( p0 - q0 ) < alpha && |
|
6852 |
- ABS( p1 - p0 ) < beta && |
|
6853 |
- ABS( q1 - q0 ) < beta ) { |
|
6851 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6852 |
+ FFABS( p1 - p0 ) < beta && |
|
6853 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6854 | 6854 |
|
6855 |
- if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6856 |
- if( ABS( p2 - p0 ) < beta) |
|
6855 |
+ if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6856 |
+ if( FFABS( p2 - p0 ) < beta) |
|
6857 | 6857 |
{ |
6858 | 6858 |
const int p3 = pix[-4]; |
6859 | 6859 |
/* p0', p1', p2' */ |
... | ... |
@@ -6864,7 +6864,7 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int |
6864 | 6864 |
/* p0' */ |
6865 | 6865 |
pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; |
6866 | 6866 |
} |
6867 |
- if( ABS( q2 - q0 ) < beta) |
|
6867 |
+ if( FFABS( q2 - q0 ) < beta) |
|
6868 | 6868 |
{ |
6869 | 6869 |
const int q3 = pix[3]; |
6870 | 6870 |
/* q0', q1', q2' */ |
... | ... |
@@ -6911,9 +6911,9 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in |
6911 | 6911 |
const int q0 = pix[0]; |
6912 | 6912 |
const int q1 = pix[1]; |
6913 | 6913 |
|
6914 |
- if( ABS( p0 - q0 ) < alpha && |
|
6915 |
- ABS( p1 - p0 ) < beta && |
|
6916 |
- ABS( q1 - q0 ) < beta ) { |
|
6914 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6915 |
+ FFABS( p1 - p0 ) < beta && |
|
6916 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6917 | 6917 |
const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); |
6918 | 6918 |
|
6919 | 6919 |
pix[-1] = clip_uint8( p0 + i_delta ); /* p0' */ |
... | ... |
@@ -6926,9 +6926,9 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in |
6926 | 6926 |
const int q0 = pix[0]; |
6927 | 6927 |
const int q1 = pix[1]; |
6928 | 6928 |
|
6929 |
- if( ABS( p0 - q0 ) < alpha && |
|
6930 |
- ABS( p1 - p0 ) < beta && |
|
6931 |
- ABS( q1 - q0 ) < beta ) { |
|
6929 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6930 |
+ FFABS( p1 - p0 ) < beta && |
|
6931 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6932 | 6932 |
|
6933 | 6933 |
pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ |
6934 | 6934 |
pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ |
... | ... |
@@ -6960,15 +6960,15 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t b |
6960 | 6960 |
const int q1 = pix[1*pix_next]; |
6961 | 6961 |
const int q2 = pix[2*pix_next]; |
6962 | 6962 |
|
6963 |
- if( ABS( p0 - q0 ) < alpha && |
|
6964 |
- ABS( p1 - p0 ) < beta && |
|
6965 |
- ABS( q1 - q0 ) < beta ) { |
|
6963 |
+ if( FFABS( p0 - q0 ) < alpha && |
|
6964 |
+ FFABS( p1 - p0 ) < beta && |
|
6965 |
+ FFABS( q1 - q0 ) < beta ) { |
|
6966 | 6966 |
|
6967 | 6967 |
const int p3 = pix[-4*pix_next]; |
6968 | 6968 |
const int q3 = pix[ 3*pix_next]; |
6969 | 6969 |
|
6970 |
- if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6971 |
- if( ABS( p2 - p0 ) < beta) { |
|
6970 |
+ if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
|
6971 |
+ if( FFABS( p2 - p0 ) < beta) { |
|
6972 | 6972 |
/* p0', p1', p2' */ |
6973 | 6973 |
pix[-1*pix_next] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; |
6974 | 6974 |
pix[-2*pix_next] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; |
... | ... |
@@ -6977,7 +6977,7 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t b |
6977 | 6977 |
/* p0' */ |
6978 | 6978 |
pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; |
6979 | 6979 |
} |
6980 |
- if( ABS( q2 - q0 ) < beta) { |
|
6980 |
+ if( FFABS( q2 - q0 ) < beta) { |
|
6981 | 6981 |
/* q0', q1', q2' */ |
6982 | 6982 |
pix[0*pix_next] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; |
6983 | 6983 |
pix[1*pix_next] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; |
... | ... |
@@ -7313,8 +7313,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 |
7313 | 7313 |
int v = 0; |
7314 | 7314 |
for( l = 0; !v && l < 1 + (h->slice_type == B_TYPE); l++ ) { |
7315 | 7315 |
v |= ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || |
7316 |
- ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || |
|
7317 |
- ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; |
|
7316 |
+ FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || |
|
7317 |
+ FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; |
|
7318 | 7318 |
} |
7319 | 7319 |
bS[0] = bS[1] = bS[2] = bS[3] = v; |
7320 | 7320 |
mv_done = 1; |
... | ... |
@@ -7337,8 +7337,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 |
7337 | 7337 |
bS[i] = 0; |
7338 | 7338 |
for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) { |
7339 | 7339 |
if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || |
7340 |
- ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || |
|
7341 |
- ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { |
|
7340 |
+ FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || |
|
7341 |
+ FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { |
|
7342 | 7342 |
bS[i] = 1; |
7343 | 7343 |
break; |
7344 | 7344 |
} |
... | ... |
@@ -8505,7 +8505,7 @@ int main(){ |
8505 | 8505 |
printf("\n");*/ |
8506 | 8506 |
|
8507 | 8507 |
for(j=0; j<16; j++){ |
8508 |
- int diff= ABS(src[j] - ref[j]); |
|
8508 |
+ int diff= FFABS(src[j] - ref[j]); |
|
8509 | 8509 |
|
8510 | 8510 |
error+= diff*diff; |
8511 | 8511 |
max_error= FFMAX(max_error, diff); |
... | ... |
@@ -1184,8 +1184,8 @@ static int nsse16_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, in |
1184 | 1184 |
else score1 = sse16_mmx(c, pix1, pix2, line_size, h); |
1185 | 1185 |
score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h); |
1186 | 1186 |
|
1187 |
- if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; |
|
1188 |
- else return score1 + ABS(score2)*8; |
|
1187 |
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
|
1188 |
+ else return score1 + FFABS(score2)*8; |
|
1189 | 1189 |
} |
1190 | 1190 |
|
1191 | 1191 |
static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
... | ... |
@@ -1193,8 +1193,8 @@ static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int |
1193 | 1193 |
int score1= sse8_mmx(c, pix1, pix2, line_size, h); |
1194 | 1194 |
int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h); |
1195 | 1195 |
|
1196 |
- if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; |
|
1197 |
- else return score1 + ABS(score2)*8; |
|
1196 |
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
|
1197 |
+ else return score1 + FFABS(score2)*8; |
|
1198 | 1198 |
} |
1199 | 1199 |
|
1200 | 1200 |
static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { |
... | ... |
@@ -2580,7 +2580,7 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o |
2580 | 2580 |
static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ |
2581 | 2581 |
long i=0; |
2582 | 2582 |
|
2583 |
- assert(ABS(scale) < 256); |
|
2583 |
+ assert(FFABS(scale) < 256); |
|
2584 | 2584 |
scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; |
2585 | 2585 |
|
2586 | 2586 |
asm volatile( |
... | ... |
@@ -2628,7 +2628,7 @@ static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[6 |
2628 | 2628 |
static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){ |
2629 | 2629 |
long i=0; |
2630 | 2630 |
|
2631 |
- if(ABS(scale) < 256){ |
|
2631 |
+ if(FFABS(scale) < 256){ |
|
2632 | 2632 |
scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; |
2633 | 2633 |
asm volatile( |
2634 | 2634 |
"pcmpeqw %%mm6, %%mm6 \n\t" // -1w |
... | ... |
@@ -213,7 +213,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q) |
213 | 213 |
if(!state->near && !k && (2 * state->B[Q] <= -state->N[Q])) |
214 | 214 |
ret = -(ret + 1); |
215 | 215 |
|
216 |
- state->A[Q] += ABS(ret); |
|
216 |
+ state->A[Q] += FFABS(ret); |
|
217 | 217 |
ret *= state->twonear; |
218 | 218 |
state->B[Q] += ret; |
219 | 219 |
|
... | ... |
@@ -274,7 +274,7 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI |
274 | 274 |
} |
275 | 275 |
|
276 | 276 |
/* update state */ |
277 |
- state->A[Q] += ABS(ret) - RItype; |
|
277 |
+ state->A[Q] += FFABS(ret) - RItype; |
|
278 | 278 |
ret *= state->twonear; |
279 | 279 |
if(state->N[Q] == state->reset){ |
280 | 280 |
state->A[Q] >>=1; |
... | ... |
@@ -306,7 +306,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ |
306 | 306 |
D1 = Rb - Rc; |
307 | 307 |
D2 = Rc - Ra; |
308 | 308 |
/* run mode */ |
309 |
- if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) { |
|
309 |
+ if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { |
|
310 | 310 |
int r; |
311 | 311 |
int RItype; |
312 | 312 |
|
... | ... |
@@ -340,7 +340,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ |
340 | 340 |
|
341 | 341 |
/* decode run termination value */ |
342 | 342 |
Rb = last[x]; |
343 |
- RItype = (ABS(Ra - Rb) <= state->near) ? 1 : 0; |
|
343 |
+ RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0; |
|
344 | 344 |
err = ls_get_code_runterm(&s->gb, state, RItype, log2_run[state->run_index[comp]]); |
345 | 345 |
if(state->run_index[comp]) |
346 | 346 |
state->run_index[comp]--; |
... | ... |
@@ -491,13 +491,13 @@ static inline void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q, |
491 | 491 |
err += state->range; |
492 | 492 |
if(err >= ((state->range + 1) >> 1)) { |
493 | 493 |
err -= state->range; |
494 |
- val = 2 * ABS(err) - 1 - map; |
|
494 |
+ val = 2 * FFABS(err) - 1 - map; |
|
495 | 495 |
} else |
496 | 496 |
val = 2 * err + map; |
497 | 497 |
|
498 | 498 |
set_ur_golomb_jpegls(pb, val, k, state->limit, state->qbpp); |
499 | 499 |
|
500 |
- state->A[Q] += ABS(err); |
|
500 |
+ state->A[Q] += FFABS(err); |
|
501 | 501 |
state->B[Q] += err * state->twonear; |
502 | 502 |
|
503 | 503 |
if(state->N[Q] == state->reset) { |
... | ... |
@@ -598,12 +598,12 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l |
598 | 598 |
D2 = Rc - Ra; |
599 | 599 |
|
600 | 600 |
/* run mode */ |
601 |
- if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) { |
|
601 |
+ if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { |
|
602 | 602 |
int RUNval, RItype, run; |
603 | 603 |
|
604 | 604 |
run = 0; |
605 | 605 |
RUNval = Ra; |
606 |
- while(x < w && (ABS(cur[x] - RUNval) <= state->near)){ |
|
606 |
+ while(x < w && (FFABS(cur[x] - RUNval) <= state->near)){ |
|
607 | 607 |
run++; |
608 | 608 |
cur[x] = Ra; |
609 | 609 |
x += stride; |
... | ... |
@@ -612,7 +612,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l |
612 | 612 |
if(x >= w) |
613 | 613 |
return; |
614 | 614 |
Rb = last[x]; |
615 |
- RItype = (ABS(Ra - Rb) <= state->near); |
|
615 |
+ RItype = (FFABS(Ra - Rb) <= state->near); |
|
616 | 616 |
pred = RItype ? Ra : Rb; |
617 | 617 |
err = cur[x] - pred; |
618 | 618 |
|
... | ... |
@@ -296,14 +296,14 @@ static int pix_dev(uint8_t * pix, int line_size, int mean) |
296 | 296 |
s = 0; |
297 | 297 |
for (i = 0; i < 16; i++) { |
298 | 298 |
for (j = 0; j < 16; j += 8) { |
299 |
- s += ABS(pix[0]-mean); |
|
300 |
- s += ABS(pix[1]-mean); |
|
301 |
- s += ABS(pix[2]-mean); |
|
302 |
- s += ABS(pix[3]-mean); |
|
303 |
- s += ABS(pix[4]-mean); |
|
304 |
- s += ABS(pix[5]-mean); |
|
305 |
- s += ABS(pix[6]-mean); |
|
306 |
- s += ABS(pix[7]-mean); |
|
299 |
+ s += FFABS(pix[0]-mean); |
|
300 |
+ s += FFABS(pix[1]-mean); |
|
301 |
+ s += FFABS(pix[2]-mean); |
|
302 |
+ s += FFABS(pix[3]-mean); |
|
303 |
+ s += FFABS(pix[4]-mean); |
|
304 |
+ s += FFABS(pix[5]-mean); |
|
305 |
+ s += FFABS(pix[6]-mean); |
|
306 |
+ s += FFABS(pix[7]-mean); |
|
307 | 307 |
pix += 8; |
308 | 308 |
} |
309 | 309 |
pix += line_size - 16; |
... | ... |
@@ -639,8 +639,8 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, |
639 | 639 |
{ |
640 | 640 |
int dx, dy, i; |
641 | 641 |
static int stats[8*8]; |
642 |
-dx= ABS(x-best[0]); |
|
643 |
-dy= ABS(y-best[1]); |
|
642 |
+dx= FFABS(x-best[0]); |
|
643 |
+dy= FFABS(y-best[1]); |
|
644 | 644 |
if(dy>dx){ |
645 | 645 |
dx^=dy; dy^=dx; dx^=dy; |
646 | 646 |
} |
... | ... |
@@ -695,7 +695,7 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, |
695 | 695 |
MotionEstContext * const c= &s->me; |
696 | 696 |
me_cmp_func cmpf, chroma_cmpf; |
697 | 697 |
Minima minima[MAX_SAB_SIZE]; |
698 |
- const int minima_count= ABS(c->dia_size); |
|
698 |
+ const int minima_count= FFABS(c->dia_size); |
|
699 | 699 |
int i, j; |
700 | 700 |
LOAD_COMMON |
701 | 701 |
LOAD_COMMON2 |
... | ... |
@@ -829,8 +829,8 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin, |
829 | 829 |
{ |
830 | 830 |
int dx, dy, i; |
831 | 831 |
static int stats[8*8]; |
832 |
-dx= ABS(x-best[0]); |
|
833 |
-dy= ABS(y-best[1]); |
|
832 |
+dx= FFABS(x-best[0]); |
|
833 |
+dy= FFABS(y-best[1]); |
|
834 | 834 |
stats[dy*8 + dx] ++; |
835 | 835 |
if(256*256*256*64 % (stats[0]+1)==0){ |
836 | 836 |
for(i=0; i<64; i++){ |
... | ... |
@@ -159,7 +159,7 @@ static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){ |
159 | 159 |
for(run=0; run<64; run++){ |
160 | 160 |
int len, bits, code; |
161 | 161 |
|
162 |
- int alevel= ABS(level); |
|
162 |
+ int alevel= FFABS(level); |
|
163 | 163 |
int sign= (level>>31)&1; |
164 | 164 |
|
165 | 165 |
if (alevel > rl->max_level[0][run]) |
... | ... |
@@ -206,7 +206,7 @@ static int find_frame_rate_index(MpegEncContext *s){ |
206 | 206 |
int64_t n1= 1001LL*s->avctx->time_base.den; |
207 | 207 |
if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break; |
208 | 208 |
|
209 |
- d = ABS(n0 - n1); |
|
209 |
+ d = FFABS(n0 - n1); |
|
210 | 210 |
if(d < dmin){ |
211 | 211 |
dmin=d; |
212 | 212 |
s->frame_rate_index= i; |
... | ... |
@@ -279,7 +279,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) |
279 | 279 |
else |
280 | 280 |
error-= av_q2d(mpeg2_aspect[i])*s->height/s->width; |
281 | 281 |
|
282 |
- error= ABS(error); |
|
282 |
+ error= FFABS(error); |
|
283 | 283 |
|
284 | 284 |
if(error < best_aspect_error){ |
285 | 285 |
best_aspect_error= error; |
... | ... |
@@ -806,7 +806,7 @@ void ff_mpeg1_encode_init(MpegEncContext *s) |
806 | 806 |
int bits, code; |
807 | 807 |
int diff=i; |
808 | 808 |
|
809 |
- adiff = ABS(diff); |
|
809 |
+ adiff = FFABS(diff); |
|
810 | 810 |
if(diff<0) diff--; |
811 | 811 |
index = av_log2(2*adiff); |
812 | 812 |
|
... | ... |
@@ -1703,7 +1703,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h |
1703 | 1703 |
|
1704 | 1704 |
buf[sy*stride + sx]+= color; |
1705 | 1705 |
|
1706 |
- if(ABS(ex - sx) > ABS(ey - sy)){ |
|
1706 |
+ if(FFABS(ex - sx) > FFABS(ey - sy)){ |
|
1707 | 1707 |
if(sx > ex){ |
1708 | 1708 |
SWAP(int, sx, ex); |
1709 | 1709 |
SWAP(int, sy, ey); |
... | ... |
@@ -2037,7 +2037,7 @@ static int get_sae(uint8_t *src, int ref, int stride){ |
2037 | 2037 |
|
2038 | 2038 |
for(y=0; y<16; y++){ |
2039 | 2039 |
for(x=0; x<16; x++){ |
2040 |
- acc+= ABS(src[x+y*stride] - ref); |
|
2040 |
+ acc+= FFABS(src[x+y*stride] - ref); |
|
2041 | 2041 |
} |
2042 | 2042 |
} |
2043 | 2043 |
|
... | ... |
@@ -2186,9 +2186,9 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){ |
2186 | 2186 |
|
2187 | 2187 |
switch(s->avctx->frame_skip_exp){ |
2188 | 2188 |
case 0: score= FFMAX(score, v); break; |
2189 |
- case 1: score+= ABS(v);break; |
|
2189 |
+ case 1: score+= FFABS(v);break; |
|
2190 | 2190 |
case 2: score+= v*v;break; |
2191 |
- case 3: score64+= ABS(v*v*(int64_t)v);break; |
|
2191 |
+ case 3: score64+= FFABS(v*v*(int64_t)v);break; |
|
2192 | 2192 |
case 4: score64+= v*v*(int64_t)(v*v);break; |
2193 | 2193 |
} |
2194 | 2194 |
} |
... | ... |
@@ -2219,7 +2219,7 @@ static int estimate_best_b_count(MpegEncContext *s){ |
2219 | 2219 |
|
2220 | 2220 |
// emms_c(); |
2221 | 2221 |
p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality; |
2222 |
- b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; |
|
2222 |
+ b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; |
|
2223 | 2223 |
if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else |
2224 | 2224 |
lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; |
2225 | 2225 |
|
... | ... |
@@ -4146,7 +4146,7 @@ static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int th |
4146 | 4146 |
|
4147 | 4147 |
for(i=0; i<=last_index; i++){ |
4148 | 4148 |
const int j = s->intra_scantable.permutated[i]; |
4149 |
- const int level = ABS(block[j]); |
|
4149 |
+ const int level = FFABS(block[j]); |
|
4150 | 4150 |
if(level==1){ |
4151 | 4151 |
if(skip_dc && i==0) continue; |
4152 | 4152 |
score+= tab[run]; |
... | ... |
@@ -5887,13 +5887,13 @@ static int dct_quantize_trellis_c(MpegEncContext *s, |
5887 | 5887 |
|
5888 | 5888 |
for(i=start_i; i<=last_non_zero; i++){ |
5889 | 5889 |
int level_index, j; |
5890 |
- const int dct_coeff= ABS(block[ scantable[i] ]); |
|
5890 |
+ const int dct_coeff= FFABS(block[ scantable[i] ]); |
|
5891 | 5891 |
const int zero_distoration= dct_coeff*dct_coeff; |
5892 | 5892 |
int best_score=256*256*256*120; |
5893 | 5893 |
for(level_index=0; level_index < coeff_count[i]; level_index++){ |
5894 | 5894 |
int distoration; |
5895 | 5895 |
int level= coeff[level_index][i]; |
5896 |
- const int alevel= ABS(level); |
|
5896 |
+ const int alevel= FFABS(level); |
|
5897 | 5897 |
int unquant_coeff; |
5898 | 5898 |
|
5899 | 5899 |
assert(level); |
... | ... |
@@ -6003,7 +6003,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, |
6003 | 6003 |
|
6004 | 6004 |
s->coded_score[n] = last_score; |
6005 | 6005 |
|
6006 |
- dc= ABS(block[0]); |
|
6006 |
+ dc= FFABS(block[0]); |
|
6007 | 6007 |
last_non_zero= last_i - 1; |
6008 | 6008 |
memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); |
6009 | 6009 |
|
... | ... |
@@ -6016,7 +6016,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, |
6016 | 6016 |
|
6017 | 6017 |
for(i=0; i<coeff_count[0]; i++){ |
6018 | 6018 |
int level= coeff[i][0]; |
6019 |
- int alevel= ABS(level); |
|
6019 |
+ int alevel= FFABS(level); |
|
6020 | 6020 |
int unquant_coeff, score, distortion; |
6021 | 6021 |
|
6022 | 6022 |
if(s->out_format == FMT_H263){ |
... | ... |
@@ -6158,7 +6158,7 @@ STOP_TIMER("memset rem[]")} |
6158 | 6158 |
int qns=4; |
6159 | 6159 |
int w; |
6160 | 6160 |
|
6161 |
- w= ABS(weight[i]) + qns*one; |
|
6161 |
+ w= FFABS(weight[i]) + qns*one; |
|
6162 | 6162 |
w= 15 + (48*qns*one + w/2)/w; // 16 .. 63 |
6163 | 6163 |
|
6164 | 6164 |
weight[i] = w; |
... | ... |
@@ -6282,7 +6282,7 @@ STOP_TIMER("dct")} |
6282 | 6282 |
int score, new_coeff, unquant_change; |
6283 | 6283 |
|
6284 | 6284 |
score=0; |
6285 |
- if(s->avctx->quantizer_noise_shaping < 2 && ABS(new_level) > ABS(level)) |
|
6285 |
+ if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) |
|
6286 | 6286 |
continue; |
6287 | 6287 |
|
6288 | 6288 |
if(new_level){ |
... | ... |
@@ -6302,7 +6302,7 @@ STOP_TIMER("dct")} |
6302 | 6302 |
- last_length[UNI_AC_ENC_INDEX(run, level+64)]; |
6303 | 6303 |
} |
6304 | 6304 |
}else{ |
6305 |
- assert(ABS(new_level)==1); |
|
6305 |
+ assert(FFABS(new_level)==1); |
|
6306 | 6306 |
|
6307 | 6307 |
if(analyze_gradient){ |
6308 | 6308 |
int g= d1[ scantable[i] ]; |
... | ... |
@@ -6335,7 +6335,7 @@ STOP_TIMER("dct")} |
6335 | 6335 |
} |
6336 | 6336 |
}else{ |
6337 | 6337 |
new_coeff=0; |
6338 |
- assert(ABS(level)==1); |
|
6338 |
+ assert(FFABS(level)==1); |
|
6339 | 6339 |
|
6340 | 6340 |
if(i < last_non_zero){ |
6341 | 6341 |
int next_i= i + run2 + 1; |
... | ... |
@@ -6403,7 +6403,7 @@ after_last++; |
6403 | 6403 |
#ifdef REFINE_STATS |
6404 | 6404 |
if(block[j]){ |
6405 | 6405 |
if(block[j] - best_change){ |
6406 |
- if(ABS(block[j]) > ABS(block[j] - best_change)){ |
|
6406 |
+ if(FFABS(block[j]) > FFABS(block[j] - best_change)){ |
|
6407 | 6407 |
raise++; |
6408 | 6408 |
}else{ |
6409 | 6409 |
lower++; |
... | ... |
@@ -1716,7 +1716,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, |
1716 | 1716 |
//printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y); |
1717 | 1717 |
#if 0 // waste of time / this will detect very few errors |
1718 | 1718 |
{ |
1719 |
- const int abs_level= ABS(level); |
|
1719 |
+ const int abs_level= FFABS(level); |
|
1720 | 1720 |
const int run1= run - rl->max_run[last][abs_level] - run_diff; |
1721 | 1721 |
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ |
1722 | 1722 |
if(abs_level <= rl->max_level[last][run]){ |
... | ... |
@@ -372,7 +372,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl |
372 | 372 |
const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type]; |
373 | 373 |
|
374 | 374 |
if (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE)) |
375 |
- q= last_p_q *ABS(a->i_quant_factor) + a->i_quant_offset; |
|
375 |
+ q= last_p_q *FFABS(a->i_quant_factor) + a->i_quant_offset; |
|
376 | 376 |
else if(pict_type==B_TYPE && a->b_quant_factor>0.0) |
377 | 377 |
q= last_non_b_q* a->b_quant_factor + a->b_quant_offset; |
378 | 378 |
|
... | ... |
@@ -403,11 +403,11 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic |
403 | 403 |
assert(qmin <= qmax); |
404 | 404 |
|
405 | 405 |
if(pict_type==B_TYPE){ |
406 |
- qmin= (int)(qmin*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); |
|
407 |
- qmax= (int)(qmax*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); |
|
406 |
+ qmin= (int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); |
|
407 |
+ qmax= (int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); |
|
408 | 408 |
}else if(pict_type==I_TYPE){ |
409 |
- qmin= (int)(qmin*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); |
|
410 |
- qmax= (int)(qmax*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); |
|
409 |
+ qmin= (int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); |
|
410 |
+ qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); |
|
411 | 411 |
} |
412 | 412 |
|
413 | 413 |
qmin= clip(qmin, 1, FF_LAMBDA_MAX); |
... | ... |
@@ -215,7 +215,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int |
215 | 215 |
|
216 | 216 |
if(sample_index < 0){ |
217 | 217 |
for(i=0; i<c->filter_length; i++) |
218 |
- val += src[ABS(sample_index + i) % src_size] * filter[i]; |
|
218 |
+ val += src[FFABS(sample_index + i) % src_size] * filter[i]; |
|
219 | 219 |
}else if(sample_index + c->filter_length > src_size){ |
220 | 220 |
break; |
221 | 221 |
}else if(c->linear){ |
... | ... |
@@ -590,7 +590,7 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe |
590 | 590 |
int i; |
591 | 591 |
|
592 | 592 |
if(v){ |
593 |
- const int a= ABS(v); |
|
593 |
+ const int a= FFABS(v); |
|
594 | 594 |
const int e= av_log2(a); |
595 | 595 |
#if 1 |
596 | 596 |
const int el= FFMIN(e, 10); |
... | ... |
@@ -1666,7 +1666,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, DWTELEM *src, DWTELE |
1666 | 1666 |
p= parent[px + py*2*stride]; |
1667 | 1667 |
} |
1668 | 1668 |
if(/*ll|*/l|lt|t|rt|p){ |
1669 |
- int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
1669 |
+ int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); |
|
1670 | 1670 |
|
1671 | 1671 |
put_rac(&s->c, &b->state[0][context], !!v); |
1672 | 1672 |
}else{ |
... | ... |
@@ -1682,11 +1682,11 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, DWTELEM *src, DWTELE |
1682 | 1682 |
} |
1683 | 1683 |
} |
1684 | 1684 |
if(v){ |
1685 |
- int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
1686 |
- int l2= 2*ABS(l) + (l<0); |
|
1687 |
- int t2= 2*ABS(t) + (t<0); |
|
1685 |
+ int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); |
|
1686 |
+ int l2= 2*FFABS(l) + (l<0); |
|
1687 |
+ int t2= 2*FFABS(t) + (t<0); |
|
1688 | 1688 |
|
1689 |
- put_symbol2(&s->c, b->state[context + 2], ABS(v)-1, context-4); |
|
1689 |
+ put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4); |
|
1690 | 1690 |
put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0); |
1691 | 1691 |
} |
1692 | 1692 |
} |
... | ... |
@@ -1749,7 +1749,7 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i |
1749 | 1749 |
} |
1750 | 1750 |
} |
1751 | 1751 |
if(/*ll|*/l|lt|t|rt|p){ |
1752 |
- int context= av_log2(/*ABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); |
|
1752 |
+ int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); |
|
1753 | 1753 |
|
1754 | 1754 |
v=get_rac(&s->c, &b->state[0][context]); |
1755 | 1755 |
if(v){ |
... | ... |
@@ -2016,8 +2016,8 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ |
2016 | 2016 |
const int shift= 1+qpel; |
2017 | 2017 |
MotionEstContext *c= &s->m.me; |
2018 | 2018 |
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); |
2019 |
- int mx_context= av_log2(2*ABS(left->mx - top->mx)); |
|
2020 |
- int my_context= av_log2(2*ABS(left->my - top->my)); |
|
2019 |
+ int mx_context= av_log2(2*FFABS(left->mx - top->mx)); |
|
2020 |
+ int my_context= av_log2(2*FFABS(left->my - top->my)); |
|
2021 | 2021 |
int s_context= 2*left->level + 2*top->level + tl->level + tr->level; |
2022 | 2022 |
int ref, best_ref, ref_score, ref_mx, ref_my; |
2023 | 2023 |
|
... | ... |
@@ -2229,8 +2229,8 @@ static void encode_q_branch2(SnowContext *s, int level, int x, int y){ |
2229 | 2229 |
int pcr= left->color[2]; |
2230 | 2230 |
int pmx, pmy; |
2231 | 2231 |
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); |
2232 |
- int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 16*!!b->ref; |
|
2233 |
- int my_context= av_log2(2*ABS(left->my - top->my)) + 16*!!b->ref; |
|
2232 |
+ int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 16*!!b->ref; |
|
2233 |
+ int my_context= av_log2(2*FFABS(left->my - top->my)) + 16*!!b->ref; |
|
2234 | 2234 |
int s_context= 2*left->level + 2*top->level + tl->level + tr->level; |
2235 | 2235 |
|
2236 | 2236 |
if(s->keyframe){ |
... | ... |
@@ -2293,8 +2293,8 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ |
2293 | 2293 |
int my= mid_pred(left->my, top->my, tr->my); |
2294 | 2294 |
int ref = 0; |
2295 | 2295 |
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); |
2296 |
- int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 0*av_log2(2*ABS(tr->mx - top->mx)); |
|
2297 |
- int my_context= av_log2(2*ABS(left->my - top->my)) + 0*av_log2(2*ABS(tr->my - top->my)); |
|
2296 |
+ int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); |
|
2297 |
+ int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my)); |
|
2298 | 2298 |
|
2299 | 2299 |
type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0; |
2300 | 2300 |
|
... | ... |
@@ -2908,8 +2908,8 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){ |
2908 | 2908 |
BlockNode *tl = y && x ? &s->block[index-b_stride-1] : left; |
2909 | 2909 |
BlockNode *tr = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl; |
2910 | 2910 |
int dmx, dmy; |
2911 |
-// int mx_context= av_log2(2*ABS(left->mx - top->mx)); |
|
2912 |
-// int my_context= av_log2(2*ABS(left->my - top->my)); |
|
2911 |
+// int mx_context= av_log2(2*FFABS(left->mx - top->mx)); |
|
2912 |
+// int my_context= av_log2(2*FFABS(left->my - top->my)); |
|
2913 | 2913 |
|
2914 | 2914 |
if(x<0 || x>=b_stride || y>=b_height) |
2915 | 2915 |
return 0; |
... | ... |
@@ -2923,15 +2923,15 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){ |
2923 | 2923 |
//FIXME try accurate rate |
2924 | 2924 |
//FIXME intra and inter predictors if surrounding blocks arent the same type |
2925 | 2925 |
if(b->type & BLOCK_INTRA){ |
2926 |
- return 3+2*( av_log2(2*ABS(left->color[0] - b->color[0])) |
|
2927 |
- + av_log2(2*ABS(left->color[1] - b->color[1])) |
|
2928 |
- + av_log2(2*ABS(left->color[2] - b->color[2]))); |
|
2926 |
+ return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0])) |
|
2927 |
+ + av_log2(2*FFABS(left->color[1] - b->color[1])) |
|
2928 |
+ + av_log2(2*FFABS(left->color[2] - b->color[2]))); |
|
2929 | 2929 |
}else{ |
2930 | 2930 |
pred_mv(s, &dmx, &dmy, b->ref, left, top, tr); |
2931 | 2931 |
dmx-= b->mx; |
2932 | 2932 |
dmy-= b->my; |
2933 |
- return 2*(1 + av_log2(2*ABS(dmx)) //FIXME kill the 2* can be merged in lambda |
|
2934 |
- + av_log2(2*ABS(dmy)) |
|
2933 |
+ return 2*(1 + av_log2(2*FFABS(dmx)) //FIXME kill the 2* can be merged in lambda |
|
2934 |
+ + av_log2(2*FFABS(dmy)) |
|
2935 | 2935 |
+ av_log2(2*b->ref)); |
2936 | 2936 |
} |
2937 | 2937 |
} |
... | ... |
@@ -4563,7 +4563,7 @@ int main(){ |
4563 | 4563 |
ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4564 | 4564 |
|
4565 | 4565 |
for(i=0; i<width*height; i++) |
4566 |
- if(ABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); |
|
4566 |
+ if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); |
|
4567 | 4567 |
|
4568 | 4568 |
#if 0 |
4569 | 4569 |
printf("testing AC coder\n"); |
... | ... |
@@ -4573,7 +4573,7 @@ int main(){ |
4573 | 4573 |
|
4574 | 4574 |
for(i=-256; i<256; i++){ |
4575 | 4575 |
START_TIMER |
4576 |
- put_symbol(&s.c, s.header_state, i*i*i/3*ABS(i), 1); |
|
4576 |
+ put_symbol(&s.c, s.header_state, i*i*i/3*FFABS(i), 1); |
|
4577 | 4577 |
STOP_TIMER("put_symbol") |
4578 | 4578 |
} |
4579 | 4579 |
ff_rac_terminate(&s.c); |
... | ... |
@@ -4587,7 +4587,7 @@ STOP_TIMER("put_symbol") |
4587 | 4587 |
START_TIMER |
4588 | 4588 |
j= get_symbol(&s.c, s.header_state, 1); |
4589 | 4589 |
STOP_TIMER("get_symbol") |
4590 |
- if(j!=i*i*i/3*ABS(i)) printf("fsck: %d != %d\n", i, j); |
|
4590 |
+ if(j!=i*i*i/3*FFABS(i)) printf("fsck: %d != %d\n", i, j); |
|
4591 | 4591 |
} |
4592 | 4592 |
#endif |
4593 | 4593 |
{ |
... | ... |
@@ -4616,9 +4616,9 @@ int64_t g=0; |
4616 | 4616 |
for(x=0; x<width; x++){ |
4617 | 4617 |
int64_t d= buffer[0][x + y*width]; |
4618 | 4618 |
error += d*d; |
4619 |
- if(ABS(width/2-x)<9 && ABS(height/2-y)<9 && level==2) printf("%8lld ", d); |
|
4619 |
+ if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8lld ", d); |
|
4620 | 4620 |
} |
4621 |
- if(ABS(height/2-y)<9 && level==2) printf("\n"); |
|
4621 |
+ if(FFABS(height/2-y)<9 && level==2) printf("\n"); |
|
4622 | 4622 |
} |
4623 | 4623 |
error= (int)(sqrt(error)+0.5); |
4624 | 4624 |
errors[level][orientation]= error; |
... | ... |
@@ -4669,9 +4669,9 @@ int64_t g=0; |
4669 | 4669 |
for(x=0; x<width; x++){ |
4670 | 4670 |
int64_t d= buffer[0][x + y*width]; |
4671 | 4671 |
error += d*d; |
4672 |
- if(ABS(width/2-x)<9 && ABS(height/2-y)<9) printf("%8lld ", d); |
|
4672 |
+ if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9) printf("%8lld ", d); |
|
4673 | 4673 |
} |
4674 |
- if(ABS(height/2-y)<9) printf("\n"); |
|
4674 |
+ if(FFABS(height/2-y)<9) printf("\n"); |
|
4675 | 4675 |
} |
4676 | 4676 |
} |
4677 | 4677 |
|
... | ... |
@@ -1950,9 +1950,9 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i |
1950 | 1950 |
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
1951 | 1951 |
if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) { |
1952 | 1952 |
if(is_intra[xy - wrap]) |
1953 |
- sum = ABS(px) + ABS(py); |
|
1953 |
+ sum = FFABS(px) + FFABS(py); |
|
1954 | 1954 |
else |
1955 |
- sum = ABS(px - A[0]) + ABS(py - A[1]); |
|
1955 |
+ sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
|
1956 | 1956 |
if(sum > 32) { |
1957 | 1957 |
if(get_bits1(&s->gb)) { |
1958 | 1958 |
px = A[0]; |
... | ... |
@@ -1963,9 +1963,9 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i |
1963 | 1963 |
} |
1964 | 1964 |
} else { |
1965 | 1965 |
if(is_intra[xy - 1]) |
1966 |
- sum = ABS(px) + ABS(py); |
|
1966 |
+ sum = FFABS(px) + FFABS(py); |
|
1967 | 1967 |
else |
1968 |
- sum = ABS(px - C[0]) + ABS(py - C[1]); |
|
1968 |
+ sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
|
1969 | 1969 |
if(sum > 32) { |
1970 | 1970 |
if(get_bits1(&s->gb)) { |
1971 | 1971 |
px = A[0]; |
... | ... |
@@ -2218,9 +2218,9 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int |
2218 | 2218 |
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
2219 | 2219 |
if(0 && !s->first_slice_line && s->mb_x) { |
2220 | 2220 |
if(is_intra[xy - wrap]) |
2221 |
- sum = ABS(px) + ABS(py); |
|
2221 |
+ sum = FFABS(px) + FFABS(py); |
|
2222 | 2222 |
else |
2223 |
- sum = ABS(px - A[0]) + ABS(py - A[1]); |
|
2223 |
+ sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
|
2224 | 2224 |
if(sum > 32) { |
2225 | 2225 |
if(get_bits1(&s->gb)) { |
2226 | 2226 |
px = A[0]; |
... | ... |
@@ -2231,9 +2231,9 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int |
2231 | 2231 |
} |
2232 | 2232 |
} else { |
2233 | 2233 |
if(is_intra[xy - 2]) |
2234 |
- sum = ABS(px) + ABS(py); |
|
2234 |
+ sum = FFABS(px) + FFABS(py); |
|
2235 | 2235 |
else |
2236 |
- sum = ABS(px - C[0]) + ABS(py - C[1]); |
|
2236 |
+ sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
|
2237 | 2237 |
if(sum > 32) { |
2238 | 2238 |
if(get_bits1(&s->gb)) { |
2239 | 2239 |
px = A[0]; |
... | ... |
@@ -2295,9 +2295,9 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int |
2295 | 2295 |
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */ |
2296 | 2296 |
if(0 && !s->first_slice_line && s->mb_x) { |
2297 | 2297 |
if(is_intra[xy - wrap]) |
2298 |
- sum = ABS(px) + ABS(py); |
|
2298 |
+ sum = FFABS(px) + FFABS(py); |
|
2299 | 2299 |
else |
2300 |
- sum = ABS(px - A[0]) + ABS(py - A[1]); |
|
2300 |
+ sum = FFABS(px - A[0]) + FFABS(py - A[1]); |
|
2301 | 2301 |
if(sum > 32) { |
2302 | 2302 |
if(get_bits1(&s->gb)) { |
2303 | 2303 |
px = A[0]; |
... | ... |
@@ -2308,9 +2308,9 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int |
2308 | 2308 |
} |
2309 | 2309 |
} else { |
2310 | 2310 |
if(is_intra[xy - 2]) |
2311 |
- sum = ABS(px) + ABS(py); |
|
2311 |
+ sum = FFABS(px) + FFABS(py); |
|
2312 | 2312 |
else |
2313 |
- sum = ABS(px - C[0]) + ABS(py - C[1]); |
|
2313 |
+ sum = FFABS(px - C[0]) + FFABS(py - C[1]); |
|
2314 | 2314 |
if(sum > 32) { |
2315 | 2315 |
if(get_bits1(&s->gb)) { |
2316 | 2316 |
px = A[0]; |
... | ... |
@@ -1236,7 +1236,7 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, |
1236 | 1236 |
static void render_line(int x0, int y0, int x1, int y1, float * buf, int n) { |
1237 | 1237 |
int dy = y1 - y0; |
1238 | 1238 |
int adx = x1 - x0; |
1239 |
- int ady = ABS(dy); |
|
1239 |
+ int ady = FFABS(dy); |
|
1240 | 1240 |
int base = dy / adx; |
1241 | 1241 |
int x = x0; |
1242 | 1242 |
int y = y0; |
... | ... |
@@ -1244,7 +1244,7 @@ static void render_line(int x0, int y0, int x1, int y1, float * buf, int n) { |
1244 | 1244 |
int sy; |
1245 | 1245 |
if (dy < 0) sy = base - 1; |
1246 | 1246 |
else sy = base + 1; |
1247 |
- ady = ady - ABS(base) * adx; |
|
1247 |
+ ady = ady - FFABS(base) * adx; |
|
1248 | 1248 |
if (x >= n) return; |
1249 | 1249 |
buf[x] = ff_vorbis_floor1_inverse_db_table[y]; |
1250 | 1250 |
for (x = x0 + 1; x < x1; x++) { |
... | ... |
@@ -1354,7 +1354,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * |
1354 | 1354 |
high_neigh_offs=vf->list[i].high; |
1355 | 1355 |
dy=floor1_Y_final[high_neigh_offs]-floor1_Y_final[low_neigh_offs]; // render_point begin |
1356 | 1356 |
adx=vf->list[high_neigh_offs].x-vf->list[low_neigh_offs].x; |
1357 |
- ady= ABS(dy); |
|
1357 |
+ ady= FFABS(dy); |
|
1358 | 1358 |
err=ady*(vf->list[i].x-vf->list[low_neigh_offs].x); |
1359 | 1359 |
off=(int16_t)err/(int16_t)adx; |
1360 | 1360 |
if (dy<0) { |
... | ... |
@@ -1455,11 +1455,11 @@ static void reverse_dc_prediction(Vp3DecodeContext *s, |
1455 | 1455 |
/* check for outranging on the [ul u l] and |
1456 | 1456 |
* [ul u ur l] predictors */ |
1457 | 1457 |
if ((transform == 13) || (transform == 15)) { |
1458 |
- if (ABS(predicted_dc - vu) > 128) |
|
1458 |
+ if (FFABS(predicted_dc - vu) > 128) |
|
1459 | 1459 |
predicted_dc = vu; |
1460 |
- else if (ABS(predicted_dc - vl) > 128) |
|
1460 |
+ else if (FFABS(predicted_dc - vl) > 128) |
|
1461 | 1461 |
predicted_dc = vl; |
1462 |
- else if (ABS(predicted_dc - vul) > 128) |
|
1462 |
+ else if (FFABS(predicted_dc - vul) > 128) |
|
1463 | 1463 |
predicted_dc = vul; |
1464 | 1464 |
} |
1465 | 1465 |
|
... | ... |
@@ -1527,7 +1527,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) |
1527 | 1527 |
if (!s->flipped_image) stride = -stride; |
1528 | 1528 |
|
1529 | 1529 |
|
1530 |
- if(ABS(stride) > 2048) |
|
1530 |
+ if(FFABS(stride) > 2048) |
|
1531 | 1531 |
return; //various tables are fixed size |
1532 | 1532 |
|
1533 | 1533 |
/* for each fragment row in the slice (both of them)... */ |
... | ... |
@@ -428,8 +428,8 @@ static void vp6_filter(vp56_context_t *s, uint8_t *dst, uint8_t *src, |
428 | 428 |
filter4 = s->filter_mode; |
429 | 429 |
if (filter4 == 2) { |
430 | 430 |
if (s->max_vector_length && |
431 |
- (ABS(mv.x) > s->max_vector_length || |
|
432 |
- ABS(mv.y) > s->max_vector_length)) { |
|
431 |
+ (FFABS(mv.x) > s->max_vector_length || |
|
432 |
+ FFABS(mv.y) > s->max_vector_length)) { |
|
433 | 433 |
filter4 = 0; |
434 | 434 |
} else if (!s->sample_variance_threshold |
435 | 435 |
|| (vp6_block_variance(src+offset1, stride) |
... | ... |
@@ -513,7 +513,7 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){ |
513 | 513 |
C = s->current_picture.motion_val[0][xy + 2 - wrap]; |
514 | 514 |
|
515 | 515 |
if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag) |
516 |
- diff= FFMAX(ABS(A[0] - B[0]), ABS(A[1] - B[1])); |
|
516 |
+ diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1])); |
|
517 | 517 |
else |
518 | 518 |
diff=0; |
519 | 519 |
|
... | ... |
@@ -488,7 +488,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int |
488 | 488 |
maxlen = FFMAX(maxlen, 200 * 1024); |
489 | 489 |
url_fseek(&s->pb, pos, SEEK_SET); |
490 | 490 |
found = gxf_resync_media(s, maxlen, -1, timestamp); |
491 |
- if (ABS(found - timestamp) > 4) |
|
491 |
+ if (FFABS(found - timestamp) > 4) |
|
492 | 492 |
return -1; |
493 | 493 |
return 0; |
494 | 494 |
} |
... | ... |
@@ -605,7 +605,7 @@ ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts, |
605 | 605 |
pts = ogg_gptopts (s, i, ogg->streams[i].granule); |
606 | 606 |
p = url_ftell (bc); |
607 | 607 |
|
608 |
- if (ABS (pts - target_ts) * st->time_base.num < st->time_base.den) |
|
608 |
+ if (FFABS (pts - target_ts) * st->time_base.num < st->time_base.den) |
|
609 | 609 |
break; |
610 | 610 |
|
611 | 611 |
if (pts > target_ts){ |
... | ... |
@@ -633,7 +633,7 @@ ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts, |
633 | 633 |
} |
634 | 634 |
} |
635 | 635 |
|
636 |
- if (ABS (pts - target_ts) * st->time_base.num < st->time_base.den){ |
|
636 |
+ if (FFABS (pts - target_ts) * st->time_base.num < st->time_base.den){ |
|
637 | 637 |
ogg_restore (s, 1); |
638 | 638 |
ogg_reset (ogg); |
639 | 639 |
}else{ |
... | ... |
@@ -711,8 +711,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, |
711 | 711 |
by knowing the futur */ |
712 | 712 |
} else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ |
713 | 713 |
if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){ |
714 |
- int64_t old_diff= ABS(st->cur_dts - pkt->duration - pkt->pts); |
|
715 |
- int64_t new_diff= ABS(st->cur_dts - pkt->pts); |
|
714 |
+ int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts); |
|
715 |
+ int64_t new_diff= FFABS(st->cur_dts - pkt->pts); |
|
716 | 716 |
if(old_diff < new_diff && old_diff < (pkt->duration>>3)){ |
717 | 717 |
pkt->pts += pkt->duration; |
718 | 718 |
// av_log(NULL, AV_LOG_DEBUG, "id:%d old:%Ld new:%Ld dur:%d cur:%Ld size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); |
... | ... |
@@ -1947,7 +1947,7 @@ int av_find_stream_info(AVFormatContext *ic) |
1947 | 1947 |
|
1948 | 1948 |
best_error= INT64_MAX; |
1949 | 1949 |
for(j=1; j<60*12; j++){ |
1950 |
- error= ABS(1001*12*num - 1001*j*den); |
|
1950 |
+ error= FFABS(1001*12*num - 1001*j*den); |
|
1951 | 1951 |
if(error < best_error){ |
1952 | 1952 |
best_error= error; |
1953 | 1953 |
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, j, 12, INT_MAX); |
... | ... |
@@ -1955,7 +1955,7 @@ int av_find_stream_info(AVFormatContext *ic) |
1955 | 1955 |
} |
1956 | 1956 |
for(j=0; j<3; j++){ |
1957 | 1957 |
static const int ticks[]= {24,30,60}; |
1958 |
- error= ABS(1001*12*num - 1000*12*den * ticks[j]); |
|
1958 |
+ error= FFABS(1001*12*num - 1000*12*den * ticks[j]); |
|
1959 | 1959 |
if(error < best_error){ |
1960 | 1960 |
best_error= error; |
1961 | 1961 |
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, ticks[j]*1000, 1001, INT_MAX); |
... | ... |
@@ -192,7 +192,7 @@ typedef uint64_t uint_fast64_t; |
192 | 192 |
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
193 | 193 |
/* assume b>0 */ |
194 | 194 |
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
195 |
-#define ABS(a) ((a) >= 0 ? (a) : (-(a))) |
|
195 |
+#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) |
|
196 | 196 |
#define FFSIGN(a) ((a) > 0 ? 1 : -1) |
197 | 197 |
|
198 | 198 |
#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
... | ... |
@@ -36,10 +36,10 @@ |
36 | 36 |
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max){ |
37 | 37 |
AVRational a0={0,1}, a1={1,0}; |
38 | 38 |
int sign= (nom<0) ^ (den<0); |
39 |
- int64_t gcd= ff_gcd(ABS(nom), ABS(den)); |
|
39 |
+ int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); |
|
40 | 40 |
|
41 |
- nom = ABS(nom)/gcd; |
|
42 |
- den = ABS(den)/gcd; |
|
41 |
+ nom = FFABS(nom)/gcd; |
|
42 |
+ den = FFABS(den)/gcd; |
|
43 | 43 |
if(nom<=max && den<=max){ |
44 | 44 |
a1= (AVRational){nom, den}; |
45 | 45 |
den=0; |
... | ... |
@@ -330,13 +330,13 @@ static inline void doHorizDefFilter_C(uint8_t dst[], int stride, PPContext *c) |
330 | 330 |
{ |
331 | 331 |
const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]); |
332 | 332 |
|
333 |
- if(ABS(middleEnergy) < 8*c->QP) |
|
333 |
+ if(FFABS(middleEnergy) < 8*c->QP) |
|
334 | 334 |
{ |
335 | 335 |
const int q=(dst[3] - dst[4])/2; |
336 | 336 |
const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]); |
337 | 337 |
const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]); |
338 | 338 |
|
339 |
- int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
|
339 |
+ int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) ); |
|
340 | 340 |
d= FFMAX(d, 0); |
341 | 341 |
|
342 | 342 |
d= (5*d + 32) >> 6; |
... | ... |
@@ -369,8 +369,8 @@ static inline void doHorizLowPass_C(uint8_t dst[], int stride, PPContext *c) |
369 | 369 |
int y; |
370 | 370 |
for(y=0; y<BLOCK_SIZE; y++) |
371 | 371 |
{ |
372 |
- const int first= ABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0]; |
|
373 |
- const int last= ABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7]; |
|
372 |
+ const int first= FFABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0]; |
|
373 |
+ const int last= FFABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7]; |
|
374 | 374 |
|
375 | 375 |
int sums[10]; |
376 | 376 |
sums[0] = 4*first + dst[0] + dst[1] + dst[2] + 4; |
... | ... |
@@ -445,7 +445,7 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP) |
445 | 445 |
int b= src[3] - src[4]; |
446 | 446 |
int c= src[5] - src[6]; |
447 | 447 |
|
448 |
- int d= FFMAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); |
|
448 |
+ int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0); |
|
449 | 449 |
|
450 | 450 |
if(d < QP) |
451 | 451 |
{ |
... | ... |
@@ -505,8 +505,8 @@ static always_inline void do_a_deblock_C(uint8_t *src, int step, int stride, PPC |
505 | 505 |
} |
506 | 506 |
} |
507 | 507 |
if(max-min < 2*QP){ |
508 |
- const int first= ABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0]; |
|
509 |
- const int last= ABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step]; |
|
508 |
+ const int first= FFABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0]; |
|
509 |
+ const int last= FFABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step]; |
|
510 | 510 |
|
511 | 511 |
int sums[10]; |
512 | 512 |
sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4; |
... | ... |
@@ -532,13 +532,13 @@ static always_inline void do_a_deblock_C(uint8_t *src, int step, int stride, PPC |
532 | 532 |
}else{ |
533 | 533 |
const int middleEnergy= 5*(src[4*step] - src[3*step]) + 2*(src[2*step] - src[5*step]); |
534 | 534 |
|
535 |
- if(ABS(middleEnergy) < 8*QP) |
|
535 |
+ if(FFABS(middleEnergy) < 8*QP) |
|
536 | 536 |
{ |
537 | 537 |
const int q=(src[3*step] - src[4*step])/2; |
538 | 538 |
const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]); |
539 | 539 |
const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]); |
540 | 540 |
|
541 |
- int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
|
541 |
+ int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) ); |
|
542 | 542 |
d= FFMAX(d, 0); |
543 | 543 |
|
544 | 544 |
d= (5*d + 32) >> 6; |
... | ... |
@@ -1045,8 +1045,8 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3], |
1045 | 1045 |
int mbHeight= (height+15)>>4; |
1046 | 1046 |
PPMode *mode = (PPMode*)vm; |
1047 | 1047 |
PPContext *c = (PPContext*)vc; |
1048 |
- int minStride= FFMAX(ABS(srcStride[0]), ABS(dstStride[0])); |
|
1049 |
- int absQPStride = ABS(QPStride); |
|
1048 |
+ int minStride= FFMAX(FFABS(srcStride[0]), FFABS(dstStride[0])); |
|
1049 |
+ int absQPStride = FFABS(QPStride); |
|
1050 | 1050 |
|
1051 | 1051 |
// c->stride and c->QPStride are always positive |
1052 | 1052 |
if(c->stride < minStride || c->qpStride < absQPStride) |
... | ... |
@@ -338,8 +338,8 @@ static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c) |
338 | 338 |
src+= stride*3; |
339 | 339 |
for(x=0; x<BLOCK_SIZE; x++) |
340 | 340 |
{ |
341 |
- const int first= ABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1]; |
|
342 |
- const int last= ABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8]; |
|
341 |
+ const int first= FFABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1]; |
|
342 |
+ const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8]; |
|
343 | 343 |
|
344 | 344 |
int sums[10]; |
345 | 345 |
sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4; |
... | ... |
@@ -460,7 +460,7 @@ static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP) |
460 | 460 |
for(x=0; x<BLOCK_SIZE; x++) |
461 | 461 |
{ |
462 | 462 |
const int v = (src[x+l5] - src[x+l4]); |
463 |
- if(ABS(v) < QP15) |
|
463 |
+ if(FFABS(v) < QP15) |
|
464 | 464 |
{ |
465 | 465 |
src[x+l3] +=v>>3; |
466 | 466 |
src[x+l4] +=v>>1; |
... | ... |
@@ -589,7 +589,7 @@ static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co) |
589 | 589 |
int b= src[l4] - src[l5]; |
590 | 590 |
int c= src[l5] - src[l6]; |
591 | 591 |
|
592 |
- int d= ABS(b) - ((ABS(a) + ABS(c))>>1); |
|
592 |
+ int d= FFABS(b) - ((FFABS(a) + FFABS(c))>>1); |
|
593 | 593 |
d= FFMAX(d, 0); |
594 | 594 |
|
595 | 595 |
if(d < co->QP*2) |
... | ... |
@@ -845,13 +845,13 @@ static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext |
845 | 845 |
for(x=0; x<BLOCK_SIZE; x++) |
846 | 846 |
{ |
847 | 847 |
const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]); |
848 |
- if(ABS(middleEnergy)< 8*QP) |
|
848 |
+ if(FFABS(middleEnergy)< 8*QP) |
|
849 | 849 |
{ |
850 | 850 |
const int q=(src[l4] - src[l5])/2; |
851 | 851 |
const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); |
852 | 852 |
const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); |
853 | 853 |
|
854 |
- int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
|
854 |
+ int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) ); |
|
855 | 855 |
d= FFMAX(d, 0); |
856 | 856 |
|
857 | 857 |
d= (5*d + 32) >> 6; |
... | ... |
@@ -880,7 +880,7 @@ src-=8; |
880 | 880 |
for(y=4; y<6; y++) |
881 | 881 |
{ |
882 | 882 |
int d= src[x+y*stride] - tmp[x+(y-4)*8]; |
883 |
- int ad= ABS(d); |
|
883 |
+ int ad= FFABS(d); |
|
884 | 884 |
static int max=0; |
885 | 885 |
static int sum=0; |
886 | 886 |
static int num=0; |
... | ... |
@@ -1149,13 +1149,13 @@ src-=8; |
1149 | 1149 |
for(x=0; x<BLOCK_SIZE; x++) |
1150 | 1150 |
{ |
1151 | 1151 |
const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]); |
1152 |
- if(ABS(middleEnergy) < 8*c->QP) |
|
1152 |
+ if(FFABS(middleEnergy) < 8*c->QP) |
|
1153 | 1153 |
{ |
1154 | 1154 |
const int q=(src[l4] - src[l5])/2; |
1155 | 1155 |
const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); |
1156 | 1156 |
const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); |
1157 | 1157 |
|
1158 |
- int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
|
1158 |
+ int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) ); |
|
1159 | 1159 |
d= FFMAX(d, 0); |
1160 | 1160 |
|
1161 | 1161 |
d= (5*d + 32) >> 6; |
... | ... |
@@ -1491,7 +1491,7 @@ DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1, |
1491 | 1491 |
static int worstRange=0; |
1492 | 1492 |
static int worstDiff=0; |
1493 | 1493 |
int diff= (f - *p); |
1494 |
- int absDiff= ABS(diff); |
|
1494 |
+ int absDiff= FFABS(diff); |
|
1495 | 1495 |
int error= diff*diff; |
1496 | 1496 |
|
1497 | 1497 |
if(x==1 || x==8 || y==1 || y==8) continue; |
... | ... |
@@ -2552,7 +2552,7 @@ L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc)) |
2552 | 2552 |
int d1=ref - cur; |
2553 | 2553 |
// if(x==0 || x==7) d1+= d1>>1; |
2554 | 2554 |
// if(y==0 || y==7) d1+= d1>>1; |
2555 |
-// d+= ABS(d1); |
|
2555 |
+// d+= FFABS(d1); |
|
2556 | 2556 |
d+= d1*d1; |
2557 | 2557 |
// sysd+= d1; |
2558 | 2558 |
} |
... | ... |
@@ -3529,7 +3529,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int |
3529 | 3529 |
dstBlock+=8; |
3530 | 3530 |
srcBlock+=8; |
3531 | 3531 |
} |
3532 |
- if(width==ABS(dstStride)) |
|
3532 |
+ if(width==FFABS(dstStride)) |
|
3533 | 3533 |
linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride); |
3534 | 3534 |
else |
3535 | 3535 |
{ |
... | ... |
@@ -3551,7 +3551,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int |
3551 | 3551 |
uint8_t *tempBlock2= c.tempBlocks + 8; |
3552 | 3552 |
#endif |
3553 | 3553 |
int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride]; |
3554 |
- int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*ABS(QPStride)]; |
|
3554 |
+ int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)]; |
|
3555 | 3555 |
int QP=0; |
3556 | 3556 |
/* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards |
3557 | 3557 |
if not than use a temporary buffer */ |
... | ... |
@@ -3565,14 +3565,14 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int |
3565 | 3565 |
|
3566 | 3566 |
/* duplicate last line of src to fill the void upto line (copyAhead+7) */ |
3567 | 3567 |
for(i=FFMAX(height-y, 8); i<copyAhead+8; i++) |
3568 |
- memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), ABS(srcStride)); |
|
3568 |
+ memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride)); |
|
3569 | 3569 |
|
3570 | 3570 |
/* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/ |
3571 | 3571 |
linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride); |
3572 | 3572 |
|
3573 | 3573 |
/* duplicate last line of dst to fill the void upto line (copyAhead) */ |
3574 | 3574 |
for(i=height-y+1; i<=copyAhead; i++) |
3575 |
- memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), ABS(dstStride)); |
|
3575 |
+ memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride)); |
|
3576 | 3576 |
|
3577 | 3577 |
dstBlock= tempDst + dstStride; |
3578 | 3578 |
srcBlock= tempSrc; |
... | ... |
@@ -3783,7 +3783,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int |
3783 | 3783 |
if(y+15 >= height) |
3784 | 3784 |
{ |
3785 | 3785 |
uint8_t *dstBlock= &(dst[y*dstStride]); |
3786 |
- if(width==ABS(dstStride)) |
|
3786 |
+ if(width==FFABS(dstStride)) |
|
3787 | 3787 |
linecpy(dstBlock, tempDst + dstStride, height-y, dstStride); |
3788 | 3788 |
else |
3789 | 3789 |
{ |