[FFmpeg-devel] [PATCH] make building swscale rgb template conditional

Luca Barbato lu_zero
Wed Aug 25 16:14:21 CEST 2010


On 08/25/2010 10:18 AM, Michael Niedermayer wrote:
> On Wed, Aug 25, 2010 at 12:34:01AM -0300, Ramiro Polla wrote:
>> On Tue, Aug 17, 2010 at 7:39 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> On Sun, Aug 15, 2010 at 10:34:47PM +0200, Luca Barbato wrote:
>>>> $subj + why the sse2 variant is always disabled?
>>>>
>>>> lu
>>>>
>>>> --
>>>>
>>>> Luca Barbato
>>>> Gentoo/linux
>>>> http://dev.gentoo.org/~lu_zero
>>>>
>>>
>>>>  rgb2rgb.c          |   78 ++++++++++++++++++------------
>>>>  rgb2rgb_template.c |  134 ++++++++++++++++++++++++++---------------------------
>>>>  2 files changed, 114 insertions(+), 98 deletions(-)
>>>> 5c27bf038a4cebac04892e6434ff946149b89a22  swscale-make-rgb-templates-build-conditional.diff
>>>> diff --git a/rgb2rgb.c b/rgb2rgb.c
>>>> index f92e165..3a6395a 100644
>>>> --- a/rgb2rgb.c
>>>> +++ b/rgb2rgb.c
>>>> @@ -148,41 +148,57 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask)  = 0x0000001f0000001fULL;
>>>>
>>>>  //Note: We have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW + MMX2 one.
>>>>  //plain C versions
>>>> -#undef HAVE_MMX
>>>> -#undef HAVE_MMX2
>>>> -#undef HAVE_AMD3DNOW
>>>> -#undef HAVE_SSE2
>>>> -#define HAVE_MMX 0
>>>> -#define HAVE_MMX2 0
>>>> -#define HAVE_AMD3DNOW 0
>>>> -#define HAVE_SSE2 0
>>>> +
>>>> +#define TEMPLATE_SSE2 0 // never enabled.
>>>> +
>>>> +#define TEMPLATE_MMX 0
>>>> +#define TEMPLATE_MMX2 0
>>>> +#define TEMPLATE_AMD3DNOW 0
>>>>  #define RENAME(a) a ## _C
>>>>  #include "rgb2rgb_template.c"
>>>> +#undef RENAME
>>>> +#undef TEMPLATE_AMD3DNOW
>>>> +#undef TEMPLATE_MMX2
>>>> +#undef TEMPLATE_MMX
>>>>
>>>>  #if ARCH_X86
>>>>
>>>>  //MMX versions
>>>> -#undef RENAME
>>>> -#undef HAVE_MMX
>>>> -#define HAVE_MMX 1
>>>> -#define RENAME(a) a ## _MMX
>>>> -#include "rgb2rgb_template.c"
>>>> -
>>>> +#ifdef HAVE_MMX
>>>> +#   define TEMPLATE_MMX 1
>>>> +#   define TEMPLATE_MMX2 0
>>>> +#   define TEMPLATE_AMD3DNOW 0
>>>> +#   define RENAME(a) a ## _MMX
>>>> +#   include "rgb2rgb_template.c"
>>>> +#   undef RENAME
>>>> +#   undef TEMPLATE_AMD3DNOW
>>>> +#   undef TEMPLATE_MMX2
>>>> +#   undef TEMPLATE_MMX
>>>
>>> inconsistent to the names used in swscale*
>>
>> No reply from Luca, so I send a new patchset that works like in
>> swscale.c (and factors some code out).
> 
>>  swscale.c |   40 ++++++++++++++++++++++++++++------------
>>  1 file changed, 28 insertions(+), 12 deletions(-)
>> 1c823b32dc37bc9e2e0de54e170f1e9f12d8e22f  0001-swscale-Always-define-COMPILE_xxx-to-either-0-or-1.patch
>> From d24ed5ef306b8464439ba3c73fb07414e368f5da Mon Sep 17 00:00:00 2001
>> From: Ramiro Polla <ramiro.polla at gmail.com>
>> Date: Wed, 25 Aug 2010 00:12:46 -0300
>> Subject: [PATCH] swscale: Always define COMPILE_xxx to either 0 or 1.
> 
> ok
> [...]
> 
> 
>>  swscale.c |   48 +++++++++++++++++++++++++-----------------------
>>  1 file changed, 25 insertions(+), 23 deletions(-)
>> 97e2ce3157686bcd6c958d39046a1ba74aba845c  0002-swscale-simplify-selection-of-optimizations-to-comp.patch
>> From a5a86307a1b2e0fc488174a4a878d81b8a3557b8 Mon Sep 17 00:00:00 2001
>> From: Ramiro Polla <ramiro.polla at gmail.com>
>> Date: Wed, 25 Aug 2010 00:13:33 -0300
>> Subject: [PATCH] swscale: simplify selection of optimizations to compile.
> 
> ok
> 
> [...]
> 
> 
>>  rgb2rgb.c          |   28 ++++-------
>>  rgb2rgb_template.c |  134 ++++++++++++++++++++++++++---------------------------
>>  2 files changed, 79 insertions(+), 83 deletions(-)
>> cc67f107305b6399de3dcfcb90a29a7829df7855  0003-rgb2rgb-Do-not-misuse-HAVE_-defines.-Introduce-COMP.patch
>> From 1197df87cd922bb2d9bc015f1429a5dc15d06bcb Mon Sep 17 00:00:00 2001
>> From: Ramiro Polla <ramiro.polla at gmail.com>
>> Date: Wed, 25 Aug 2010 00:14:03 -0300
>> Subject: [PATCH] rgb2rgb: Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and
>>  use them instead.
> 
> SSE2 is always disabled after this patch
> i dont think it was always disabled before, because the code likely was
> tested when it was written

Apparently not and that was the question I was waiting for an answer...

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero




More information about the ffmpeg-devel mailing list