[FFmpeg-devel] [PATCH 1/5] add AV_CPU_FLAG_BFIN for libswscale

Måns Rullgård mans
Tue Sep 28 02:25:07 CEST 2010


Janne Grunau <janne-ffmpeg at jannau.net> writes:

> On Tue, Sep 28, 2010 at 12:17:10AM +0100, M?ns Rullg?rd wrote:
>> Janne Grunau <janne-ffmpeg at jannau.net> writes:
>> 
>> > ---
>> >  libavutil/cpu.c |    1 +
>> >  libavutil/cpu.h |    1 +
>> >  2 files changed, 2 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/libavutil/cpu.c b/libavutil/cpu.c
>> > index 1548530..12c230d 100644
>> > --- a/libavutil/cpu.c
>> > +++ b/libavutil/cpu.c
>> > @@ -27,6 +27,7 @@ int av_get_cpu_flags(void)
>> >          return flags;
>> >
>> >      if (ARCH_ARM) flags = ff_get_cpu_flags_arm();
>> > +    if (ARCH_BFIN) flags = AV_CPU_FLAG_BFIN;
>> >      if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
>> >      if (ARCH_X86) flags = ff_get_cpu_flags_x86();
>> >
>> > diff --git a/libavutil/cpu.h b/libavutil/cpu.h
>> > index 71cc265..6412a54 100644
>> > --- a/libavutil/cpu.h
>> > +++ b/libavutil/cpu.h
>> > @@ -38,6 +38,7 @@
>> >  #define AV_CPU_FLAG_SSE42        0x0200 ///< Nehalem SSE4.2 functions
>> >  #define AV_CPU_FLAG_IWMMXT       0x0100 ///< XScale IWMMXT
>> >  #define AV_CPU_FLAG_ALTIVEC      0x0001 ///< standard
>> > +#define AV_CPU_FLAG_BFIN         0x0001
>> 
>> What is the point of this?  Blackfin is not optional on Blackfin any
>> more than x86 is optional on such CPUs.
>
> The difference is that there is no x86 optimized code but libswscale
> has Blackfin optimized code/asm.
> libswscale seems to use the SWS_CPU_CAPS more as runtime selectable
> algorithm switches. The only minor advantage I see with this approach is
> runtime switching between general C code and Blackfin specific code.

If a flag for this really is required, I think an arch-independent
"base" flag would make more sense.  There is no need to single out the
CPU that happens to be the only one currently having optimisations for
the base instruction set.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list