[Ffmpeg-devel] [PATCH] fix error croping
Baptiste Coudurier
baptiste.coudurier
Wed Apr 4 11:01:24 CEST 2007
Hi
Limin Wang wrote:
> Hi,
>
>> [...]
>>> Index: ffmpeg.c
>>> ===================================================================
>>> --- ffmpeg.c (revision 8622)
>>> +++ ffmpeg.c (working copy)
>>> @@ -730,7 +730,7 @@
>>> if (ost->video_pad) {
>>> final_picture = &ost->pict_tmp;
>>> if (ost->video_resample) {
>>> - if (av_picture_crop((AVPicture *)&picture_pad_temp,
>>> (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) {
>>> + if (av_picture_crop((AVPicture *)&picture_pad_temp,
>>> (AVPicture *)final_picture, dec->pix_fmt, ost->padtop, ost->padleft) < 0) {
>>> av_log(NULL, AV_LOG_ERROR, "error padding picture\n");
>>> return;
>>> }
>> As I said yesterday, I believe the code is ok as it is, and this change
>> is an error. Note that here av_picture_crop() is used on the final
>> picture, to identify the area in which resampling must output.
>> And the final picture is in enc->pix_fmt pixel format.
>
> Attached patch to remove the fix which is wrong.
>
> Thanks,
> Limin
>
>
> ------------------------------------------------------------------------
>
> Index: libavcodec/imgconvert.c
> ===================================================================
> --- libavcodec/imgconvert.c (revision 8622)
> +++ libavcodec/imgconvert.c (working copy)
> @@ -2220,19 +2220,22 @@
> int y_shift;
> int x_shift;
>
> - if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt]))
> + if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
> return -1;
What about PAL8/MONOWHITE etc ? Does it work ?
> - y_shift = pix_fmt_info[pix_fmt].y_chroma_shift;
> - x_shift = pix_fmt_info[pix_fmt].x_chroma_shift;
> -
> dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
That seems wrong, like Luca said.
[...]
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
More information about the ffmpeg-devel
mailing list