[FFmpeg-devel] MMX optimized functions in yuv2rgb_template.c ignore trailing pixels for non-aligned destination width

Michael Niedermayer michaelni
Mon Apr 27 01:51:58 CEST 2009


On Sat, Apr 18, 2009 at 08:53:26PM +0200, C?dric Schieli wrote:
> > sws_yuv2rgb_mmx_unaligned-3.patch :
> > updated to use sws_yuv2rgb_c_wrappers-2.patch (sligthly faster)

>  yuv2rgb_mmx.c      |    1 +
>  yuv2rgb_template.c |   20 +++++++++++++-------
>  2 files changed, 14 insertions(+), 7 deletions(-)
> faea916dc33feea22a8537cf1a854bff13d52b65  sws_yuv2rgb_mmx_unaligned-3.patch
> Index: ffmpeg/libswscale/x86/yuv2rgb_mmx.c
> ===================================================================
> --- ffmpeg.orig/libswscale/x86/yuv2rgb_mmx.c	2009-04-18 19:12:39.000922309 +0200
> +++ ffmpeg/libswscale/x86/yuv2rgb_mmx.c	2009-04-18 19:12:55.592078658 +0200
> @@ -33,6 +33,7 @@
>  #include "libswscale/rgb2rgb.h"
>  #include "libswscale/swscale.h"
>  #include "libswscale/swscale_internal.h"
> +#include "libswscale/yuv2rgb.h"
>  #include "libavutil/x86_cpu.h"
>  
>  #define DITHER1XBPP // only for MMX
> Index: ffmpeg/libswscale/x86/yuv2rgb_template.c
> ===================================================================
> --- ffmpeg.orig/libswscale/x86/yuv2rgb_template.c	2009-04-18 19:12:39.024922566 +0200
> +++ ffmpeg/libswscale/x86/yuv2rgb_template.c	2009-04-18 20:35:31.108110584 +0200
> @@ -137,6 +137,7 @@
>          uint8_t *py = src[0] + y*srcStride[0];                \
>          uint8_t *pu = src[1] + (y>>1)*srcStride[1];           \
>          uint8_t *pv = src[2] + (y>>1)*srcStride[2];           \
> +        av_unused uint8_t *pa;                                \
>          x86_reg index= -h_size/2;                                \
>  
>  #define YUV2RGB_INIT                                                       \
> @@ -173,7 +174,12 @@
>          : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), "r" (pa - 2*index) \
>          ); \
>  
> -#define YUV2RGB_TRAIL \
> +#define YUV2RGB_TRAIL(func_name, dst_type, alpha) \
> +        if (!(y&1) && h_size < c->dstW)\
> +            if (alpha)\
> +                func_name ## _trail(c, py+h_size, py+h_size+srcStride[0], pu+(h_size>>1), pv+(h_size>>1), pa+h_size, pa+h_size+srcStride[0], (dst_type *)image, (dst_type *)(image+dstStride[0]), y);\
> +            else\
> +                func_name ## _trail(c, py+h_size, py+h_size+srcStride[0], pu+(h_size>>1), pv+(h_size>>1), NULL, NULL, (dst_type *)image, (dst_type *)(image+dstStride[0]), y);\
>      } \
>      __asm__ volatile (EMMS); \
>      return srcSliceH; \

i think ive already said that the code duplication through a macro
should be replaced by a function call
i did not mean a macro doing a function call

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090427/7c488f8b/attachment.pgp>



More information about the ffmpeg-devel mailing list