[Libav-user] sws_scale has weird behavior when not resizing
nowget at qq.com
Fri Jul 13 13:32:47 CEST 2012
------ 原始邮件 ------
From:"Alex Cohn"<alexcohn at netvision.net.il>;
To:"This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<libav-user at ffmpeg.org>;
Subject:Re: [Libav-user] sws_scale has weird behavior when not resizing
On Jul 12, 2012 6:30 PM, "Alexandre Millette" <amillett at matrox.com> wrote:
> Hello all.
> I'm working on a C++ video player using libav.
> Upon testing with various video formats and files, I've encountered a problem with a small MPEG4/mp4v file (190x240).
> The issue is that a small green band (6 px in width) will appear on the right side of the frames.
> This is what I've gathered so far:
> - The YUV420 frame read in the stream is ok.
> - The RGB32 frame output by sws_scale (there is no resize, the function is used only for conversion purpose) has the green band, so the problem comes from sws_scale.
> - The green color comes from the original allocation of the YUV frame (data to 0 equals to a green shade).
> - If sws_scale is used also as a resizing device (say converting YUV420 190x240 to RGB32 191x240), there is no colored band, but the frame is of course 1 pixel wider than intended (frame accuracy is an important feature of the project, so this is not acceptable).
I believe your problem could be rooted in bicubic transform. It makes n9 sense when source and target sizes are the same. Try to set linear.
> img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P,
> ? w, h, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL);
> Thank you,
> Alex M
I hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user