[Ffmpeg-devel] Re: cropping/padding/rescaling patchset

Luca Abeni lucabe72
Mon Mar 20 18:33:02 CET 2006

Hi Baptiste,

On Mon, 2006-03-20 at 17:17 +0100, Baptiste COUDURIER wrote:
> Hi Luca,
> Luca Abeni wrote:
> > [...]
> > -    if (ost->video_resample) {
> > +    final_picture = formatted_picture;
> > +    padding_src = formatted_picture;
> > +    if (ost->video_pad) {
> >          final_picture = &ost->pict_tmp;
> > -        img_resample(ost->img_resample_ctx, (AVPicture*)final_picture, (AVPicture*)formatted_picture);
> > +        if (img_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, target_pixfmt, ost->padtop, ost->padleft) < 0) {
> > +             av_log(NULL, AV_LOG_ERROR, "error padding picture\n");
> > +             goto the_end;
> > +        }
> Explain me why you have to crop in order to pad the picture. 
Opsss... Sorry, that is needed (I think :) only if you pad & rescale at
the same time.

> I dont get it. If you only pad, size is increased, you must not crop it
> by padding sizes.
Yes, you are right. If you only pad, this crop is not needed.

It is only needed if you pad & rescale. In this case, this img_crop() is
used to find the place where the rescaled image has to be put. Note that
if you do not rescale, picture_pad_temp (the picture generated by this
crop, pointed by resampling_dst) is never used.

> This is a bit confusing, final picture is FINAL, so it must be last
> picture, feeded into av_encode.
Well, after all the filtering (crop, rescaling, pixel format conversion
-if needed-, and finally padding) final_picture is a pointer to the
picture to be encoded. But each filter can change it. Or am I
misunderstanding your comment? (In this case, I apologize)

> Besides that Its a really good job. Thanks a lot Luca.
Thanks. I'll resend a modified version of the second patch in few moments.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 Prestiti Online. Scopri subito se sei finanziabile. in 24 ore senza spese n? anticipi, clicca qui
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2908&d=20-3

More information about the ffmpeg-devel mailing list