[Ffmpeg-cvslog] r6254 - trunk/libavutil/common.h

Michael Niedermayer michaelni
Fri Sep 15 10:32:04 CEST 2006


Hi

On Fri, Sep 15, 2006 at 02:36:49AM +0200, lorenm wrote:
> Author: lorenm
> Date: Fri Sep 15 02:36:49 2006
> New Revision: 6254
> 
> Modified:
>    trunk/libavutil/common.h
> 
> Log:
> asm implementation of mid_pred.
> 20% faster huffyuv decoding, 4% faster ffv1.
> 
> 
> Modified: trunk/libavutil/common.h
> ==============================================================================
> --- trunk/libavutil/common.h	(original)
> +++ trunk/libavutil/common.h	Fri Sep 15 02:36:49 2006
> @@ -235,7 +235,22 @@
>  /* median of 3 */
>  static inline int mid_pred(int a, int b, int c)
>  {
> -#if 0
> +#if (defined(ARCH_X86) && __CPU__ >= 686 || defined(ARCH_X86_64)) && !defined(RUNTIME_CPUDETECT)
> +    int i=a, j=a;
> +    asm volatile(
> +        "cmp    %4, %2 \n\t"
> +        "cmovg  %4, %0 \n\t"
> +        "cmovl  %4, %1 \n\t"
> +        "cmp    %4, %3 \n\t"
> +        "cmovg  %3, %0 \n\t"
> +        "cmovl  %3, %1 \n\t"
> +        "cmp    %3, %2 \n\t"
> +        "cmovl  %1, %0 \n\t"
> +        :"+&r"(i), "+&r"(j)
> +        :"r"(a), "r"(b), "r"(c)
> +    );
> +    return i;

isnt the following faster?

        int i=b;
        asm volatile(
            "cmp    %2, %1 \n\t"
            "cmovg  %1, %0 \n\t"
            "cmovg  %2, %1 \n\t"
            "cmp    %3, %1 \n\t"
            "cmovl  %3, %1 \n\t"
            "cmp    %1, %0 \n\t"
            "cmovg  %1, %0 \n\t"
            :"+&r"(i), "+&r"(a)
            :"r"(b), "r"(c)
        );

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-cvslog mailing list