[Libav-user] How is cropping and scaling implemented

Kristensen, Odd-Arild okristensen at albany.edu
Sat Jan 31 22:22:45 CET 2015

I have been looking the the implementation details for cropping and scaling. I found filter_frame() in vf_crop.c which seems to implement cropping, but I cannot trace where this function is being called. If filter_frame() does perform cropping, how does

frame->data<http://ffmpeg.org/doxygen/trunk/structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992>[0] += s->y<http://ffmpeg.org/doxygen/trunk/structCropContext.html#a76d61913bbc541445c022ca5a98446b9> * frame->linesize<http://ffmpeg.org/doxygen/trunk/structAVFrame.html#aa52bfc6605f6a3059a0c3226cc0f6567>[0];
frame->data<http://ffmpeg.org/doxygen/trunk/structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992>[0] += s->x<http://ffmpeg.org/doxygen/trunk/structCropContext.html#a9727f01e3312088c95ea7f08f6254972> * s->max_step<http://ffmpeg.org/doxygen/trunk/structCropContext.html#aa70d5633fae29ee999840abe72fee168>[0];

in any way change the pixels of the video?

Scaling on the other hand seem to be done by sws_scale() if I am not mistaken. But the wording in the documentation confuses me. Does it change/convert the pixel format of the video, or does it actually scale the video/frame to a different resolution?

Thanks for any clarification.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150131/a6792ac1/attachment.html>

More information about the Libav-user mailing list