[FFmpeg-devel] [PATCH 3/3] postproc: Fix unprotected inline asm

Michael Niedermayer michaelni at gmx.at
Sat Sep 8 02:13:42 CEST 2012


On Fri, Sep 07, 2012 at 10:48:29AM -0400, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libpostproc/postprocess.c          |   58 ++++++-------
>  libpostproc/postprocess_template.c |  166 ++++++++++++++++++------------------
>  2 files changed, 112 insertions(+), 112 deletions(-)
> 
> diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
> index 3c3f68c..ba91e2b 100644
> --- a/libpostproc/postprocess.c
> +++ b/libpostproc/postprocess.c
> @@ -80,9 +80,9 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> -//#undef HAVE_MMXEXT
> -//#define HAVE_AMD3DNOW
> -//#undef HAVE_MMX
> +//#undef HAVE_MMXEXT_INLINE
> +//#define HAVE_AMD3DNOW_INLINE
> +//#undef HAVE_MMX_INLINE
>  //#undef ARCH_X86
>  //#define DEBUG_BRIGHTNESS
>  #include "postprocess.h"
> @@ -165,7 +165,7 @@ static const char *replaceTable[]=
>  };
>  
>  
> -#if ARCH_X86
> +#if ARCH_X86 && HAVE_INLINE_ASM
>  static inline void prefetchnta(void *p)
>  {
>      __asm__ volatile(   "prefetchnta (%0)\n\t"

> @@ -546,25 +546,25 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step, int stride,
>  
>  #if ARCH_X86
>  
> -#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMXEXT) || CONFIG_RUNTIME_CPUDETECT
> +#if (HAVE_MMX_INLINE && !HAVE_AMD3DNOW_INLINE && !HAVE_MMXEXT_INLINE) || (CONFIG_RUNTIME_CPUDETECT && HAVE_MMX_INLINE)
>  #define COMPILE_MMX
>  #endif
>  
> -#if HAVE_MMXEXT || CONFIG_RUNTIME_CPUDETECT
> +#if HAVE_MMXEXT_INLINE
>  #define COMPILE_MMX2
>  #endif
>  
> -#if (HAVE_AMD3DNOW && !HAVE_MMXEXT) || CONFIG_RUNTIME_CPUDETECT
> +#if (HAVE_AMD3DNOW_INLINE && !HAVE_MMXEXT_INLINE) || (CONFIG_RUNTIME_CPUDETECT && HAVE_AMD3DNOW_INLINE)

That looks a bit convoluted and it will fail for some combinations
of the HAVEs

i suspect that adding "&& HAVE_INLINE_ASM" to the ARCH_X86 above
and leaving the CONFIG_RUNTIME_CPUDETECT as they are should fix it

also there doesnt exist cases where some but not the other inline
asm is supported in libpp. What exist are 2 use cases
1. compile with all optimizations and select the best at runtime
2. compile exactly the best optimization only for each case. That
   is optimize for one specific CPU without unused functions.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120908/b9f45c78/attachment.asc>


More information about the ffmpeg-devel mailing list