Check for the presence of llrint(), lrint(), round() and roundf()
and provide simple replacements if they are unavailable. patch by Michael Kostylev, mik niipt ru Originally committed as revision 11326 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
							parent
							
								
									52d086084e
								
							
						
					
					
						commit
						a33cab3a9a
					
				
							
								
								
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -706,6 +706,8 @@ HAVE_LIST="
 | 
			
		||||
    getrusage
 | 
			
		||||
    imlib2
 | 
			
		||||
    inet_aton
 | 
			
		||||
    llrint
 | 
			
		||||
    lrint
 | 
			
		||||
    lrintf
 | 
			
		||||
    machine_ioctl_bt848_h
 | 
			
		||||
    machine_ioctl_meteor_h
 | 
			
		||||
@ -714,6 +716,8 @@ HAVE_LIST="
 | 
			
		||||
    mkstemp
 | 
			
		||||
    mlib
 | 
			
		||||
    ppc64
 | 
			
		||||
    round
 | 
			
		||||
    roundf
 | 
			
		||||
    sdl
 | 
			
		||||
    sdl_video_size
 | 
			
		||||
    soundcard_h
 | 
			
		||||
@ -1593,12 +1597,14 @@ done
 | 
			
		||||
 | 
			
		||||
check_lib math.h sin -lm
 | 
			
		||||
 | 
			
		||||
# test for lrintf in math.h
 | 
			
		||||
check_exec <<EOF && enable lrintf || disable lrintf
 | 
			
		||||
# test for C99 functions in math.h
 | 
			
		||||
for func in llrint lrint lrintf round roundf; do
 | 
			
		||||
    check_exec <<EOF && enable $func || disable $func
 | 
			
		||||
#define _ISOC9X_SOURCE  1
 | 
			
		||||
#include <math.h>
 | 
			
		||||
int main(void) { return (lrintf(3.999f) > 0)?0:1; }
 | 
			
		||||
int main(void) { return ($func(3.999f) > 0)?0:1; }
 | 
			
		||||
EOF
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
enabled_any libamr_nb libamr_wb && enable libamr
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -270,6 +270,20 @@ if((y)<(x)){\
 | 
			
		||||
    }\
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_LLRINT
 | 
			
		||||
static av_always_inline long long llrint(double x)
 | 
			
		||||
{
 | 
			
		||||
    return rint(x);
 | 
			
		||||
}
 | 
			
		||||
#endif /* HAVE_LLRINT */
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_LRINT
 | 
			
		||||
static av_always_inline long int lrint(double x)
 | 
			
		||||
{
 | 
			
		||||
    return rint(x);
 | 
			
		||||
}
 | 
			
		||||
#endif /* HAVE_LRINT */
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_LRINTF
 | 
			
		||||
static av_always_inline long int lrintf(float x)
 | 
			
		||||
{
 | 
			
		||||
@ -277,4 +291,18 @@ static av_always_inline long int lrintf(float x)
 | 
			
		||||
}
 | 
			
		||||
#endif /* HAVE_LRINTF */
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_ROUND
 | 
			
		||||
static av_always_inline double round(double x)
 | 
			
		||||
{
 | 
			
		||||
    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
 | 
			
		||||
}
 | 
			
		||||
#endif /* HAVE_ROUND */
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_ROUNDF
 | 
			
		||||
static av_always_inline float roundf(float x)
 | 
			
		||||
{
 | 
			
		||||
    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
 | 
			
		||||
}
 | 
			
		||||
#endif /* HAVE_ROUNDF */
 | 
			
		||||
 | 
			
		||||
#endif /* FFMPEG_INTERNAL_H */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user