According to various literature, Lanczos and Sinc are better for downscaling, while Spline and Gaussian so they are set in case these condistions are found.
Inspired from a patch by wm4 <[email protected]> --- libswscale/utils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libswscale/utils.c b/libswscale/utils.c index 2781985..200cf55 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -914,6 +914,19 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SWS_SINC | SWS_SPLINE | SWS_BICUBLIN); + + /* provide a default scaler if not set by caller. + * Bicubic performs better for upscaling, bilinear for + * downscaling and lanczos is ok for the general case. + */ + if (!i) + if (srcW <= dstW && srcH <= dstH) + i &= SWS_BICUBIC; + else if (srcW > dstW && srcH > dstH) + i &= SWS_BILINEAR; + else + i &= SWS_LANCZOS; + if (!i || (i & (i - 1))) { av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); -- 1.7.9.5 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
