[FFmpeg-devel] [RFC] remove lrintf fallback implementation
Víctor Paesa
wzrlpy
Sun Oct 21 01:46:08 CEST 2007
Hi,
M?ns Rullg?rd said:
> "V?ctor Paesa" <wzrlpy at arsystel.com> writes:
>
>> Index: configure
>> ==================================================================>
>> --- configure (revision 10822) +++ configure (working copy)
>> @@ -701,6 +701,7 @@
>> getrusage
>> imlib2
>> inet_aton
>> + llrint
>> lrintf
>> machine_ioctl_bt848_h
>> machine_ioctl_meteor_h
>
> Alphabetical order OK.
Remarkably unusual, isn't it? ;-)
>> @@ -1501,6 +1502,7 @@
>> check_func inet_aton
>> check_func memalign
>> check_func mkstemp
>> +check_func2 math.h llrint
>> check_func2 windows.h GetProcessTimes
>
> Is it necessary to use check_func2?
check_func works also fine for Cygwin, though I can't speak for other
systems.
>> Index: libavutil/internal.h
>> ==================================================================>
>> --- libavutil/internal.h (revision 10822) +++
>> libavutil/internal.h (working copy)
>> @@ -278,4 +278,17 @@
>> }
>> #endif /* HAVE_LRINTF */
>>
>> +#ifndef HAVE_LLRINT
>> +#if defined(ARCH_X86)
>> +static av_always_inline long long int llrint(double x)
>> +{
>> + long long int llrintres;
>> + asm
>> + ("fistpll %0"
>> + : "=m" (llrintres) : "t" (x) : "st");
>
> The formatting of this asm() statement is incredibly ugly.
I must confess I am an asm-illiterate, for me every asm is ugly. I made
another (mostly blind) attempt.
>> + return llrintres;
>> +}
>> +#endif /* defined(ARCH_X86) */
>> +#endif /* HAVE_LLRINT */
>
> And what it's not ARCH_X86?
I cannot remember any other architecture reporting here the lack of
llrint(), should they exist, they can also add some asm().
Regards,
V?ctor
Patch follows:
$ svn diff configure libavutil/internal.h
Index: configure
===================================================================
--- configure (revision 10822)
+++ configure (working copy)
@@ -701,6 +701,7 @@
getrusage
imlib2
inet_aton
+ llrint
lrintf
machine_ioctl_bt848_h
machine_ioctl_meteor_h
@@ -1499,6 +1500,7 @@
check_func gethrtime
check_func getrusage
check_func inet_aton
+check_func llrint
check_func memalign
check_func mkstemp
check_func2 windows.h GetProcessTimes
Index: libavutil/internal.h
===================================================================
--- libavutil/internal.h (revision 10822)
+++ libavutil/internal.h (working copy)
@@ -278,4 +278,17 @@
}
#endif /* HAVE_LRINTF */
+#ifndef HAVE_LLRINT
+#if defined(ARCH_X86)
+static av_always_inline long long int llrint(double x)
+{
+ long long int llrintres;
+ asm(
+ "fistpll %0" : "=m" (llrintres) : "t" (x) : "st"
+ );
+ return llrintres;
+}
+#endif /* defined(ARCH_X86) */
+#endif /* HAVE_LLRINT */
+
#endif /* FFMPEG_INTERNAL_H */
More information about the ffmpeg-devel
mailing list