[FFmpeg-cvslog] r29010 - in trunk/libswscale: yuv2rgb.c yuv2rgb_template.c

Cédric Schieli cschieli
Sat Mar 21 11:35:43 CET 2009


2009/3/21 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>:
> On Fri, Mar 20, 2009 at 08:42:55PM +0100, C?dric Schieli wrote:
>> 2009/3/20 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>:
>> > On Fri, Mar 20, 2009 at 03:14:28PM +0100, sdrik wrote:
>> >> Modified: trunk/libswscale/yuv2rgb_template.c
>> >> ==============================================================================
>> >> --- trunk/libswscale/yuv2rgb_template.c ? ? ? Fri Mar 20 15:01:51 2009 ? ? ? ?(r29009)
>> >> +++ trunk/libswscale/yuv2rgb_template.c ? ? ? Fri Mar 20 15:14:28 2009 ? ? ? ?(r29010)
>> >> @@ -171,6 +171,14 @@
>> >> ? ? ?__asm__ volatile (EMMS); \
>> >> ? ? ?return srcSliceH; \
>> >>
>> >> +#define YUV2RGB_OPERANDS_ALPHA \
>> >> + ? ? ? ?: "+r" (index), "+r" (image) \
>> >> + ? ? ? ?: "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), "r" (pa - 2*index) \
>> >> + ? ? ? ?); \
>> >> + ? ?} \
>> >> + ? ?__asm__ volatile (EMMS); \
>> >> + ? ?return srcSliceH; \
>> >> +
>> >> ?static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
>> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int srcSliceH, uint8_t* dst[], int dstStride[]){
>> >> ? ? ?int y, h_size;
>> >> @@ -456,3 +464,19 @@ static inline int RENAME(yuv420_rgb32)(S
>> >> ? ? ?YUV2RGB_ENDLOOP(4)
>> >> ? ? ?YUV2RGB_OPERANDS
>> >> ?}
>> >> +
>> >> +static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
>> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int srcSliceH, uint8_t* dst[], int dstStride[]){
>> >> + ? ?int y, h_size;
>> >> +
>> >> + ? ?YUV2RGB_LOOP(4)
>> >> +
>> >> + ? ? ? ?uint8_t *pa = src[3] + y*srcStride[3];
>> >> + ? ? ? ?YUV2RGB_INIT
>> >> + ? ? ? ?YUV2RGB
>> >> + ? ? ? ?"movq ? ? (%6, %0, 2), %%mm3;" ? ? ? ? ? ?/* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
>> >> + ? ? ? ?RGB_PLANAR2PACKED32
>> >> +
>> >> + ? ?YUV2RGB_ENDLOOP(4)
>> >> + ? ?YUV2RGB_OPERANDS_ALPHA
>> >> +}
>> >
>> > Do _not_ commit assembler code without checking compilation with -fPIC
>> > and --enable-debug.
>> > This uses 7 registers and can only be used when the appropriate define
>> > is set.
>>
>> That's why HAVE_7REGS is checked at the callsite :
>
> Well, then the function is not called, but it is still compiled, so that
> doesn't help a bit.
>
>> It build for me with --enable-debug --extra-cflags=-fPIC on x86_32
>
> Forgot --enable-gpl maybe?

No, --enable-gpl was set here.

> Either way it is certain it broke the 32 bit OSX build:
> http://fate.multimedia.cx/index.php?build_record=66730

Yes, I saw this. I guess this has something to do with the compiler
not optimizing out the building of yuva420_rgb32 when !HAVE_7REGS

Does it build with the following (ugly) hack ?

Index: yuv2rgb.c
===================================================================
--- yuv2rgb.c	(revision 29020)
+++ yuv2rgb.c	(working copy)
@@ -508,7 +508,9 @@
         switch (c->dstFormat) {
         case PIX_FMT_RGB32:
             if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
-                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
+#if HAVE_7REGS
+                return yuva420_rgb32_MMX2;
+#endif
             }else return yuv420_rgb32_MMX2;
         case PIX_FMT_BGR24:  return yuv420_rgb24_MMX2;
         case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
@@ -519,7 +521,9 @@
         switch (c->dstFormat) {
         case PIX_FMT_RGB32:
             if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
-                if (HAVE_7REGS) return yuva420_rgb32_MMX;
+#if HAVE_7REGS
+                return yuva420_rgb32_MMX;
+#endif
             }else return yuv420_rgb32_MMX;
         case PIX_FMT_BGR24:  return yuv420_rgb24_MMX;
         case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
Index: yuv2rgb_template.c
===================================================================
--- yuv2rgb_template.c	(revision 29020)
+++ yuv2rgb_template.c	(working copy)
@@ -465,6 +465,7 @@
     YUV2RGB_OPERANDS
 }

+#if HAVE_7REGS
 static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t*
src[], int srcStride[], int srcSliceY,
                                         int srcSliceH, uint8_t*
dst[], int dstStride[]){
     int y, h_size;
@@ -480,3 +481,4 @@
     YUV2RGB_ENDLOOP(4)
     YUV2RGB_OPERANDS_ALPHA
 }
+#endif




More information about the ffmpeg-cvslog mailing list