diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-06 13:38:02 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-06 13:44:05 +0400 |
commit | 5710f55e490d0c3cf7348b3ca91c8c0fe4274be2 (patch) | |
tree | 033991c8946d5c7cf0acec24991633a6836253f6 /libswscale/utils.c | |
parent | 7fb123429e6c153e9ea1e1af6e0165c3583894d0 (diff) | |
parent | 6b3ff6f91a535d6383f41ca7bdf760165dcb6015 (diff) |
Merge commit '6b3ff6f91a535d6383f41ca7bdf760165dcb6015'
* commit '6b3ff6f91a535d6383f41ca7bdf760165dcb6015':
swscale: provide a default scaler if none is set
Conflicts:
libswscale/utils.c
The default is left at bicubic until someone has compared the scalers
properly speed and quality wise.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index a2e3ce1723..3daa4f4fad 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1155,8 +1155,19 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SWS_SINC | SWS_SPLINE | SWS_BICUBLIN); - if (!i || (i & (i - 1))) { - av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen, got %X\n", i); + + /* provide a default scaler if not set by caller */ + if (!i) { + if (dstW < srcW && dstH < srcH) + flags |= SWS_BICUBIC; + else if (dstW > srcW && dstH > srcH) + flags |= SWS_BICUBIC; + else + flags |= SWS_BICUBIC; + c->flags = flags; + } else if (i & (i - 1)) { + av_log(c, AV_LOG_ERROR, + "Exactly one scaler algorithm must be chosen, got %X\n", i); return AVERROR(EINVAL); } /* sanity check */ |