[FFmpeg-devel] [RFC] Cleanse swscale

Luca Barbato lu_zero
Wed Jan 12 18:21:00 CET 2011


On 1/12/11 5:26 PM, Michael Niedermayer wrote:
> true, i did not mean to suggest that extreem, but rather something like:
>
> function()
> {
>      FUNCTION_ASM
>      for ( lines in image )
>          do stuff
>      BARRIER
> }
>
> and provide FUNCTION_ASM /BARRIER from #included files or provide empty defines
> for C

Let me expand,

Now is:

#if ARCH
#define FEATURE
#undef FEATURE_2
#define POSTFIX _ARCH
#include skel_c.c
#elif ARCH2
#define FEATURE
#undef FEATURE
#define POSTFIX _ARCH
#include skel_c.c
#elif ARCH3
...

In the main C code

Plus the behemoth you have in the _template.c file I already exemplified.

> its still the same code just restructured by the preprocessor
> and that change could have been done 1 function at a time when someone wanted
> to add optimizations NEON or otherwise

Then the code then have to be imported in the template

foo_template.c

#if ARCH
#include arch_defs.h
#elif
...

and  in the arch_defs.h have something like

#define FUNCTION_ASM_N \
    __asm__(blah)

And for each unimplemented function we have a duplicate and we assume 
the building blocks are the same, we aren't using plain asm file (so 
we'd have the situation in which we call a function from a function)

> Now, iam not saying this should be done now but rather that it could have been
> done when someone wanted to optimize function() into another asm and didnt
> want to add another set of ifdefs

Doesn't work that well and we'd still have something as hard to track 
and manipulate with another layer of indirection...

> In the end its you who works on the cleanup and you have to decide what is the
> most practical way to improve it

I'm trying to make it clean by small steps but cleanup everything in a 
single batch.

Once I get that part in shape I'll move to make sure the initialization 
code gets more uniform as well.

lu



More information about the ffmpeg-devel mailing list