[Ffmpeg-devel] [PATCH] fix error croping

Luca Abeni lucabe72
Tue Apr 3 14:12:33 CEST 2007

Hi Limin,

Limin Wang wrote:
>> 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?
As far as I remember, the "filtering order" is:
decoder ---> crop ---> rescale / convert pixfmt ---> pad ---> ....

So, cropping happens with the decoder pixfmt, and padding operates on 
the encoder pixfmt. This is why I believe the current code is ok.

> So maybe other place has bug, by my understanding after decode, the pix_fmt
> should be yuv420 instead of yuv422 packed format still.
The pixfmt after deconding depends on the decoder. The "rescale / 
convert pixfmt" step is responsible for converting it to yuv420 (or to 
the needed pixfmt), but this happens after cropping (and before padding).


More information about the ffmpeg-devel mailing list