[FFmpeg-devel] [PATCH] do not pointlessly use REG_BP

Reimar Döffinger Reimar.Doeffinger
Fri Jan 1 02:34:42 CET 2010


On Fri, Jan 01, 2010 at 01:32:50AM +0100, Michael Niedermayer wrote:
> On Thu, Dec 31, 2009 at 10:34:35PM +0100, Reimar D?ffinger wrote:
> > Hello,
> > this might cause compilation issues, since EBP might not be available
> > even on x86_64.
> > Since there are enough register, this patch just lets gcc choose a
> > register:
> > Index: swscale_template.c
> > ===================================================================
> > --- swscale_template.c  (revision 30151)
> > +++ swscale_template.c  (working copy)
> > @@ -1225,18 +1225,19 @@
> >          case PIX_FMT_RGB32:
> >              if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
> >  #if ARCH_X86_64
> > +                x86_reg tmp;
> >                  __asm__ volatile(
> > -                    YSCALEYUV2RGB(%%REGBP, %5)
> > -                    YSCALEYUV2RGB_YA(%%REGBP, %5, %6, %7)
> > +                    YSCALEYUV2RGB(%0, %6)
> > +                    YSCALEYUV2RGB_YA(%0, %6, %7, %8)
> >                      "psraw                  $3, %%mm1       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
> >                      "psraw                  $3, %%mm7       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
> >                      "packuswb            %%mm7, %%mm1       \n\t"
> > -                    WRITEBGR32(%4, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
> > +                    WRITEBGR32(%5, 8280(%6), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
>                                                 ^^^^^^^
> and please test it next time

Unfortunately letting the compiler choose the register is not easily
possible due to hardcoded numeric arguments used in the macros.
Alternative version tested with
mplayer -sws 0 http://samples.mplayerhq.hu/FLV/flash_with_alpha/300x180-Scr-f8-056alpha.flv -vf scale=600:400 -vo gl
Index: libswscale/swscale_template.c
===================================================================
--- libswscale/swscale_template.c       (revision 30151)
+++ libswscale/swscale_template.c       (working copy)
@@ -1226,17 +1226,17 @@
             if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
 #if ARCH_X86_64
                 __asm__ volatile(
-                    YSCALEYUV2RGB(%%REGBP, %5)
-                    YSCALEYUV2RGB_YA(%%REGBP, %5, %6, %7)
+                    YSCALEYUV2RGB(%%r8, %5)
+                    YSCALEYUV2RGB_YA(%%r8, %5, %6, %7)
                     "psraw                  $3, %%mm1       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
                     "psraw                  $3, %%mm7       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
                     "packuswb            %%mm7, %%mm1       \n\t"
-                    WRITEBGR32(%4, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
+                    WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
 
                     :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "r" (dest),
                     "a" (&c->redDither)
                     ,"r" (abuf0), "r" (abuf1)
-                    : "%"REG_BP
+                    : "%r8"
                 );
 #else
                 *(uint16_t **)(&c->u_temp)=abuf0;



More information about the ffmpeg-devel mailing list