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

Cédric Schieli cschieli
Fri Mar 20 20:42:55 CET 2009


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 :

@@ -433,7 +506,10 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsConte
 #if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL
    if (c->flags & SWS_CPU_CAPS_MMX2) {
        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:  return yuv420_rgb32_MMX2;
+        case PIX_FMT_RGB32:
+            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
+                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
+            }else return yuv420_rgb32_MMX2;
        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX2;
        case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
        case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
@@ -441,7 +517,10 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsConte
    }
    if (c->flags & SWS_CPU_CAPS_MMX) {
        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:  return yuv420_rgb32_MMX;
+        case PIX_FMT_RGB32:
+            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){
+                if (HAVE_7REGS) return yuva420_rgb32_MMX;
+            }else return yuv420_rgb32_MMX;
        case PIX_FMT_BGR24:  return yuv420_rgb24_MMX;
        case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
        case PIX_FMT_RGB555: return yuv420_rgb15_MMX;

It build for me with --enable-debug --extra-cflags=-fPIC on x86_32




More information about the ffmpeg-cvslog mailing list