[Ffmpeg-devel] swscaler BUG in PIX_FMT_YUV410P -> PIX_FMT_RGBA32

GizmoSDK gizmo_video
Tue Feb 20 21:08:24 CET 2007


20 feb 2007 kl. 20.23 skrev GizmoSDK:

>
> 20 feb 2007 kl. 08.29 skrev gizmo_video:
>
>>
>>
>> 				Fr?n: Michael Niedermayer <michaelni at gmx.at>
>> Skickat: den 20 februari 2007 01:10
>> Till: FFmpeg development discussions and patches <ffmpeg- 
>> devel at mplayerhq.hu>
>> ?mne: Re: [Ffmpeg-devel] swscaler BUG in PIX_FMT_YUV410P ->  
>> PIX_FMT_RGBA32
>>
>> Hi
>>
>> On Mon, Feb 19, 2007 at 10:11:07PM +0100, GizmoSDK wrote:
>>>
>>> 19 feb 2007 kl. 21.45 skrev GizmoSDK:
>>>
>>>> When converting a image of format PIX_FMT_YUV410P to
>>>> PIX_FMT_RGBA32, using MMX but not MMX2 the blue rgb component is
>>>> mixed into the green so a blue image gets green.
>>>>
>>>> The context is initialised with
>>>>
>>>> m_img_convert_ctx = sws_getContext(
>>>> m_pVideoCodecCtx->width, m_pVideoCodecCtx->height,
>>>> PIX_FMT_RGBA32,
>>>> m_pVideoCodecCtx->width, m_pVideoCodecCtx->height,
>>>> m_pVideoCodecCtx->pix_fmt,
>>>> 0, NULL, NULL, NULL);
>>>>
>>>> and the conversion is done with
>>>>
>>>> sws_scale(m_img_convert_ctx, m_pFrame->data, m_pFrame->linesize,0,
>>>> m_pVideoCodecCtx->height, m_pFrameRGB->data, m_pFrameRGB- 
>>>> >linesize);
>>>>
>>>> The size of src==dst so its a plain translation of format A to B.
>>>>
>>>> This bug occurs in
>>>> FFmpeg version SVN-r8028, Copyright (c) 2000-2007 Fabrice Bellard,
>>>> et al.
>>>> configuration: --disable-opts --disable-strip --enable-swscaler --
>>>> enable-xvid --enable-libfaad --extra-cflags=-I/Users/amo/
>>>> xvidcore-1.1.0/src -I/Users/amo/faad2/include --enable-gpl --extra-
>>>> ldflags=-L/Users/amo/xvidcore-1.1.0/build/generic/=build -L/Users/
>>>> amo/faad2/libfaad/.libs --disable-dv1394 --disable-ipv6 --disable-
>>>> vhook --disable-bktr --disable-v4l2 --disable-v4l
>>>> libavutil version: 49.3.0
>>>> libavcodec version: 51.33.0
>>>> libavformat version: 51.10.0
>>>> built on Feb 19 2007 20:26:15, gcc: 4.0.1 (Apple Computer, Inc.
>>>> build 5367)
>>>
>>> I suspect that the error is in swscale_template.c:1107
>>>
>>> switch(c->dstFormat)
>>> {
>>> case PIX_FMT_RGB32:
>>> YSCALEYUV2PACKEDX
>>> YSCALEYUV2RGBX
>>> WRITEBGR32(%4, %5, %%REGa)
>>> YSCALEYUV2PACKEDX_END
>>> return;
>>>
>>>
>>> where the rgb gets mangled some how. But its just a guess as all
>>> these macros makes it virtually impossibly to debug without bettr
>>> knowledge of the code...
>>
>>> mplayer -vf scale,format=YVU9,scale,format=bgr32,scale and rgb32  
>>> works
>>> that is with mmx2 disabled
>>> -> bug closed / not reproduceable
>>
>> I think that there is a bug anyway ! Here is a sample that when  
>> unpacked with the code above gets green instead of blue.
>>
>> swscaler is enabled. Bug reproducable on  OSX and on MingW Win32  
>> when unpacking to PIX_FMT_RGB32.
>>
>> The bug doesn't occur using img_convert without swscaler enabled.
>>
>> http://www.gizmosdk.se/vid1.mov
>
> I have now verified that the RGB values before the WRITEBGR32(%4, % 
> 5, %%REGa) macro is corrupt. So my guess is that there is something  
> wrong in the unapcking or conversion of the PIX_FMT_YUV410P format.  
> Will check more but there is definitely a bug. The vid1.mov played  
> with ffplay gives a correct image but when dest format is rgb32  
> something gets wrong.
>

If i use the flag SWS_BICUBIC for the sws_flags everything works  
fine. Else if set to zero both the mmx and the non accelerated  
conversion of YUV410P fails.

Is this a bug or a feature ;-)

/Anders Mod?n





More information about the ffmpeg-devel mailing list