Commit df4da384 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use standard abs() function where appropriate

parent a62b01ec
...@@ -931,7 +931,7 @@ static int InputIntfEventCallback( intf_thread_t *p_intf, ...@@ -931,7 +931,7 @@ static int InputIntfEventCallback( intf_thread_t *p_intf,
p_intf->p_sys->i_last_input_pos_event = i_now; p_intf->p_sys->i_last_input_pos_event = i_now;
p_intf->p_sys->i_last_input_pos = i_pos; p_intf->p_sys->i_last_input_pos = i_pos;
if( ABS( i_pos - i_projected_pos ) < SEEK_THRESHOLD ) if( llabs( i_pos - i_projected_pos ) < SEEK_THRESHOLD )
break; break;
p_info->signal = SIGNAL_SEEK; p_info->signal = SIGNAL_SEEK;
......
...@@ -38,7 +38,6 @@ static const DBusObjectPathVTable dbus_mpris_vtable = { ...@@ -38,7 +38,6 @@ static const DBusObjectPathVTable dbus_mpris_vtable = {
NULL, NULL, NULL, NULL NULL, NULL, NULL, NULL
}; };
#define ABS(x) ( ( x ) > 0 ? ( x ) : ( -1 * ( x ) ) )
#define SEEK_THRESHOLD 1000 /* µsec */ #define SEEK_THRESHOLD 1000 /* µsec */
#endif //dbus.h #endif //dbus.h
...@@ -91,8 +91,6 @@ static int Seek ( demux_t *, mtime_t, int ); ...@@ -91,8 +91,6 @@ static int Seek ( demux_t *, mtime_t, int );
static int Demux_Seekable ( demux_t * ); static int Demux_Seekable ( demux_t * );
static int Demux_UnSeekable( demux_t * ); static int Demux_UnSeekable( demux_t * );
#define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) )
static char *FromACP( const char *str ) static char *FromACP( const char *str )
{ {
return FromCharset(vlc_pgettext("GetACP", "CP1252"), str, strlen(str)); return FromCharset(vlc_pgettext("GetACP", "CP1252"), str, strlen(str));
...@@ -893,11 +891,11 @@ static int Demux_Seekable( demux_t *p_demux ) ...@@ -893,11 +891,11 @@ static int Demux_Seekable( demux_t *p_demux )
if( tk->i_samplesize ) if( tk->i_samplesize )
{ {
toread[i_track].i_toread = AVI_PTSToByte( tk, __ABS( i_dpts ) ); toread[i_track].i_toread = AVI_PTSToByte( tk, llabs( i_dpts ) );
} }
else else
{ {
toread[i_track].i_toread = AVI_PTSToChunk( tk, __ABS( i_dpts ) ); toread[i_track].i_toread = AVI_PTSToChunk( tk, llabs( i_dpts ) );
} }
if( i_dpts < 0 ) if( i_dpts < 0 )
...@@ -1248,7 +1246,7 @@ static int Demux_UnSeekable( demux_t *p_demux ) ...@@ -1248,7 +1246,7 @@ static int Demux_UnSeekable( demux_t *p_demux )
else else
{ {
/* check for time */ /* check for time */
if( __ABS( AVI_GetPTS( p_stream ) - if( llabs( AVI_GetPTS( p_stream ) -
AVI_GetPTS( p_stream_master ) )< 600*1000 ) AVI_GetPTS( p_stream_master ) )< 600*1000 )
{ {
/* load it and send to decoder */ /* load it and send to decoder */
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
*/ */
/* Needed for Yadif, but also some others. */ /* Needed for Yadif, but also some others. */
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
#define FFMAX(a,b) __MAX(a,b) #define FFMAX(a,b) __MAX(a,b)
#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
#define FFMIN(a,b) __MIN(a,b) #define FFMIN(a,b) __MIN(a,b)
......
...@@ -88,18 +88,18 @@ static void yadif_filter_line_c(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8 ...@@ -88,18 +88,18 @@ static void yadif_filter_line_c(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8
int c= cur[mrefs]; int c= cur[mrefs];
int d= (prev2[0] + next2[0])>>1; int d= (prev2[0] + next2[0])>>1;
int e= cur[prefs]; int e= cur[prefs];
int temporal_diff0= FFABS(prev2[0] - next2[0]); int temporal_diff0= abs(prev2[0] - next2[0]);
int temporal_diff1=( FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; int temporal_diff1=( abs(prev[mrefs] - c) + abs(prev[prefs] - e) )>>1;
int temporal_diff2=( FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; int temporal_diff2=( abs(next[mrefs] - c) + abs(next[prefs] - e) )>>1;
int diff= FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); int diff= FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
int spatial_pred= (c+e)>>1; int spatial_pred= (c+e)>>1;
int spatial_score= FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e) int spatial_score= abs(cur[mrefs-1] - cur[prefs-1]) + abs(c-e)
+ FFABS(cur[mrefs+1] - cur[prefs+1]) - 1; + abs(cur[mrefs+1] - cur[prefs+1]) - 1;
#define CHECK(j)\ #define CHECK(j)\
{ int score= FFABS(cur[mrefs-1+j] - cur[prefs-1-j])\ { int score= abs(cur[mrefs-1+j] - cur[prefs-1-j])\
+ FFABS(cur[mrefs +j] - cur[prefs -j])\ + abs(cur[mrefs +j] - cur[prefs -j])\
+ FFABS(cur[mrefs+1+j] - cur[prefs+1-j]);\ + abs(cur[mrefs+1+j] - cur[prefs+1-j]);\
if(score < spatial_score){\ if(score < spatial_score){\
spatial_score= score;\ spatial_score= score;\
spatial_pred= (cur[mrefs +j] + cur[prefs -j])>>1;\ spatial_pred= (cur[mrefs +j] + cur[prefs -j])>>1;\
......
...@@ -182,8 +182,6 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -182,8 +182,6 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
//===========================================================================// //===========================================================================//
#define ABS(A) ( (A) > 0 ? (A) : -(A) )
static void PrecalcCoefs(int *Ct, double Dist25) static void PrecalcCoefs(int *Ct, double Dist25)
{ {
int i; int i;
...@@ -193,7 +191,7 @@ static void PrecalcCoefs(int *Ct, double Dist25) ...@@ -193,7 +191,7 @@ static void PrecalcCoefs(int *Ct, double Dist25)
for (i = -255*16; i <= 255*16; i++) for (i = -255*16; i <= 255*16; i++)
{ {
Simil = 1.0 - ABS(i) / (16*255.0); Simil = 1.0 - abs(i) / (16*255.0);
C = pow(Simil, Gamma) * 65536.0 * (double)i / 16.0; C = pow(Simil, Gamma) * 65536.0 * (double)i / 16.0;
Ct[16*256+i] = (C<0) ? (C-0.5) : (C+0.5); Ct[16*256+i] = (C<0) ? (C-0.5) : (C+0.5);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment