[FFmpeg-cvslog] r32011 - in trunk/libswscale: swscale.c swscale_template.c

Måns Rullgård mans
Sun Sep 5 11:36:07 CEST 2010


Ramiro Polla <ramiro.polla at gmail.com> writes:

> 2010/9/4 M?ns Rullg?rd <mans at mansr.com>:
>> Ramiro Polla <ramiro.polla at gmail.com> writes:
>>> On Mon, Aug 23, 2010 at 6:22 PM, mru <subversion at mplayerhq.hu> wrote:
>>>> Author: mru
>>>> Date: Mon Aug 23 23:22:24 2010
>>>> New Revision: 32011
>>>>
>>>> Log:
>>>> swscale: fix unaligned accesses in (RGB|BGR)32_1 to YUV conversion
>>>>
>>>> Modified:
>>>> ? trunk/libswscale/swscale.c
>>>> ? trunk/libswscale/swscale_template.c
>>>
>>> This broke some conversions (screws up chroma), for example:
>>> ?yuv420p 96x96 -> argb ?64x 64 flags= 2 CRC=9cc86f93 SSD= ? ?2, ?957, ?666, ? ?0
>>
>> Can you provide any more details? ?Which function is broken?
>
> bgr321ToUV and rgb321ToUV. Shouldn't the pixel data be shifted before
> the mask? (as in attached patch)
>
> Index: swscale.c
> ===================================================================
> --- swscale.c	(revision 32049)
> +++ swscale.c	(working copy)
> @@ -1069,9 +1069,9 @@
>  {\
>      int i;\
>      for (i=0; i<width; i++) {\
> -        int b= (((const type*)src)[i]&maskb)>>(shb+shp);\
> -        int g= (((const type*)src)[i]&maskg)>>(shg+shp);\
> -        int r= (((const type*)src)[i]&maskr)>>(shr+shp);\
> +        int b= ((((const type*)src)[i]>>shp)&maskb)>>shb;\
> +        int g= ((((const type*)src)[i]>>shp)&maskg)>>shg;\
> +        int r= ((((const type*)src)[i]>>shp)&maskr)>>shr;\
>  \
>          dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\
>          dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\

Probably correct.  Does it fix the problem you saw without breaking
anything else?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-cvslog mailing list