[FFmpeg-devel] [PATCH]Remove b5Dither and friends from libswscale

Michael Niedermayer michaelni
Fri Mar 28 00:15:49 CET 2008


On Tue, Mar 25, 2008 at 01:30:23PM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached is a patch that tries to get rid of b5Dither, g5Dither, g6Dither 
> and r5Dither from libswscale.

[...]
> Index: libswscale/swscale_internal.h
> ===================================================================
> --- libswscale/swscale_internal.h	(Revision 26271)
> +++ libswscale/swscale_internal.h	(Arbeitskopie)
> @@ -111,6 +111,7 @@
>  
>  #define RED_DITHER            "0*8"
>  #define GREEN_DITHER          "1*8"
> +#define GREEN6_DITHER         "11*8+4*4*25*2+40"
>  #define BLUE_DITHER           "2*8"

The number does not seem correct

[...]

> Index: libswscale/yuv2rgb_template.c
> ===================================================================
> --- libswscale/yuv2rgb_template.c	(Revision 26271)
> +++ libswscale/yuv2rgb_template.c	(Arbeitskopie)
[...]

> @@ -143,10 +143,10 @@
>          uint8_t *pv = src[2] + (y>>1)*srcStride[2];
>          long index= -h_size/2;
>  
> -        b5Dither= ff_dither8[y&1];
> -        g6Dither= ff_dither4[y&1];
> -        g5Dither= ff_dither8[y&1];
> -        r5Dither= ff_dither8[(y+1)&1];
> +        c->blueDither   = ff_dither8[y&1];
> +        c->green6Dither = ff_dither4[y&1];
> +        c->greenDither  = ff_dither8[y&1];
> +        c->redDither    = ff_dither8[(y+1)&1];
>          /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
>             pixels in each iteration */
>          __asm__ __volatile__ (
[...]
> @@ -238,10 +238,10 @@
>          uint8_t *pv = src[2] + (y>>1)*srcStride[2];
>          long index= -h_size/2;
>  
> -        b5Dither= ff_dither8[y&1];
> -        g6Dither= ff_dither4[y&1];
> -        g5Dither= ff_dither8[y&1];
> -        r5Dither= ff_dither8[(y+1)&1];
> +        c->blueDither   = ff_dither8[y&1];
> +        c->green6Dither = ff_dither4[y&1];
> +        c->greenDither  = ff_dither8[y&1];
> +        c->redDither    = ff_dither8[(y+1)&1];
>          /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
>             pixels in each iteration */
>          __asm__ __volatile__ (
> @@ -254,9 +254,9 @@

As only 3 of the 4 are used there is no need to init all 3.
Which also means this code does not need 2 green dither vars in the context


[...]
>  #ifdef HAVE_MMX
> -        b5Dither= ff_dither8[dstY&1];
> -        g6Dither= ff_dither4[dstY&1];
> -        g5Dither= ff_dither8[dstY&1];
> -        r5Dither= ff_dither8[(dstY+1)&1];
> +        c->blueDither   = ff_dither8[dstY&1];
> +        c->green6Dither = ff_dither4[dstY&1];
> +        c->greenDither  = ff_dither8[dstY&1];
> +        c->redDither    = ff_dither8[(dstY+1)&1];
>  #endif

A simple if(RGB16) could be used to avoid the introduction of green6Dither
i think.

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20080328/d25ef709/attachment.pgp>



More information about the ffmpeg-devel mailing list