[Ffmpeg-devel] [PATCH] fix error croping

Baptiste Coudurier baptiste.coudurier
Tue Apr 3 13:11:21 CEST 2007


Limin Wang wrote:
> Hi,
> 
>>> Hi,
>>>
>>>>> $subj, please review it. If your input yuv is 422 packet format, then
>>>>> you'll failed to crop.
>> [...]
>>> Index: ffmpeg.c
>>> ===================================================================
>>> --- ffmpeg.c	(revision 8565)
>>> +++ ffmpeg.c	(working copy)
>>> @@ -715,7 +715,7 @@
>>>         return;
>>>
>>>     if (ost->video_crop) {
>>> -        if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture 
>>> *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) {
>>> +        if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture 
>>> *)in_picture, enc->pix_fmt, ost->topBand, ost->leftBand) < 0) {
>> I do not think this is ok... At this point, the image is still in the 
>> decoder pixel format. Telling av_picture_crop() that it is in a 
>> different format might lead to a wrong result.
> 
>> I think the correct solution is to implement support for the desired 
>> pixel format in av_picture_crop().
> 
> So the next picture pading should use enc->pix_fmt instead of dec->pix_fmt?

Check input picture and his pixel format, and it's right atm.

> For padding is OK and I check it uses enc->pix_fmt, based on this I try with
> enc->pix_fmt for crop, and the fact is the crop test result is OK. 

crop test cannot be ok, if you supply packed input you'll get this:
"error cropping picture"

> So maybe other place has bug, by my understanding after decode, the pix_fmt
> should be yuv420 instead of yuv422 packed format still. My input is yuv422
> packed format and output is h264.

pix_fmt after decode is dependent of the compressed pixel format.
What is your source ?
Are you sure it is 422 'packed' ? and not 'yuv422p' which means instead
means 4:2:2 planar.

-- 
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