On Tue, Aug 09, 2011 at 05:31:44PM +0200, Diego Biurrun wrote:
> On Tue, Aug 09, 2011 at 12:19:06PM +0200, Kostya wrote:
> > On Tue, Aug 09, 2011 at 12:18:34PM +0200, Kostya wrote:
> > > On Tue, Aug 09, 2011 at 12:03:35PM +0200, Diego Biurrun wrote:
> > > > On Tue, Aug 09, 2011 at 11:20:09AM +0200, Kostya Shishkov wrote:
> > > > > +void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
> > > > > +{
> > > > > +    av_unused int mm_flags = av_get_cpu_flags();
> > > > > +
> > > > > +#if HAVE_YASM
> > > > > +    c->put_rv40_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
> > > > > +    c->put_rv40_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
> > > > > +    if (mm_flags & AV_CPU_FLAG_MMX2) {
> > > > > +        c->avg_rv40_chroma_pixels_tab[0] = 
> > > > > ff_avg_rv40_chroma_mc8_mmx2;
> > > > > +        c->avg_rv40_chroma_pixels_tab[1] = 
> > > > > ff_avg_rv40_chroma_mc4_mmx2;
> > > > > +    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
> > > > > +        c->avg_rv40_chroma_pixels_tab[0] = 
> > > > > ff_avg_rv40_chroma_mc8_3dnow;
> > > > > +        c->avg_rv40_chroma_pixels_tab[1] = 
> > > > > ff_avg_rv40_chroma_mc4_3dnow;
> > > > > +    }
> > > > > +#endif
> > > > > +}
> > > > 
> > > > The file is only compiled in the YASM case, so the #if and the av_unused
> > > > are unnecessary.
> > > 
> > > My mistake, it should be under general MMX case.
> > 
> > And a new patch.
> 
> I still don't get it ...
> 
> > --- a/libavcodec/x86/Makefile
> > +++ b/libavcodec/x86/Makefile
> > @@ -21,6 +21,10 @@ YASM-OBJS-$(CONFIG_H264PRED)           += 
> > x86/h264_intrapred.o          \
> >                                            x86/h264_intrapred_10bit.o
> >  MMX-OBJS-$(CONFIG_H264PRED)            += x86/h264_intrapred_init.o
> >  
> > +MMX-OBJS-$(CONFIG_RV30_DECODER)        += x86/rv34dsp.o                 \
> > +
> > +MMX-OBJS-$(CONFIG_RV40_DECODER)        += x86/rv34dsp.o                 \
> 
> ... here the condition is MMX, but ...
 
Yes, that's the common logic - call optimised function initialisation when
certain configuration parameter is set (which is HAVE_MMX for x86).

> > --- /dev/null
> > +++ b/libavcodec/x86/rv34dsp.c
> > @@ -0,0 +1,59 @@
> > +void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
> > +{
> > +    av_unused int mm_flags = av_get_cpu_flags();
> > +
> > +#if HAVE_YASM
> > +    c->put_rv40_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
> > +    c->put_rv40_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
> > +    if (mm_flags & AV_CPU_FLAG_MMX2) {
> > +        c->avg_rv40_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
> > +        c->avg_rv40_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmx2;
> > +    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
> > +        c->avg_rv40_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
> > +        c->avg_rv40_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
> > +    }
> > +#endif
> > +}
> 
> ... here it is YASM - what gives?

Due to the legacy we can have x86 optimisations in many different formats.
Currently the only optimisations here are made with YASM assembly but
situation may change in the future.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to