diff options
-rw-r--r-- | libmpcodecs/vf_scale.c | 13 | ||||
-rw-r--r-- | libmpcodecs/vf_scale.h | 1 | ||||
-rw-r--r-- | screenshot.c | 14 |
3 files changed, 20 insertions, 8 deletions
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 585ef4d9a1..6bb076c744 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -704,7 +704,7 @@ void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, Sw } // will use sws_flags & src_filter (from cmd line) -struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat) +static struct SwsContext *sws_getContextFromCmdLine2(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int extraflags) { int flags; SwsFilter *dstFilterParam, *srcFilterParam; @@ -718,6 +718,17 @@ struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); } +struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat) +{ + return sws_getContextFromCmdLine2(srcW, srcH, srcFormat, dstW, dstH, dstFormat, 0); +} + +struct SwsContext *sws_getContextFromCmdLine_hq(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat) +{ + return sws_getContextFromCmdLine2(srcW, srcH, srcFormat, dstW, dstH, dstFormat, + SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP | SWS_ACCURATE_RND | SWS_BITEXACT); +} + /// An example of presets usage static const struct size_preset { char* name; diff --git a/libmpcodecs/vf_scale.h b/libmpcodecs/vf_scale.h index a9b3b506d5..08d651ce16 100644 --- a/libmpcodecs/vf_scale.h +++ b/libmpcodecs/vf_scale.h @@ -21,6 +21,7 @@ int get_sws_cpuflags(void); struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat); +struct SwsContext *sws_getContextFromCmdLine_hq(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat); struct mp_csp_details; int mp_sws_set_colorspace(struct SwsContext *sws, struct mp_csp_details *csp); diff --git a/screenshot.c b/screenshot.c index 9b8c67a89a..5ebe2e647f 100644 --- a/screenshot.c +++ b/screenshot.c @@ -41,7 +41,7 @@ #include "fmt-conversion.h" -//for sws_getContextFromCmdLine and mp_sws_set_colorspace +//for sws_getContextFromCmdLine_hq and mp_sws_set_colorspace #include "libmpcodecs/vf_scale.h" #include "libvo/csputils.h" @@ -147,12 +147,12 @@ void screenshot_save(struct MPContext *mpctx, struct mp_image *image) screenshot_ctx *ctx = screenshot_get_ctx(mpctx); struct mp_image *dst = alloc_mpi(image->w, image->h, IMGFMT_RGB24); - struct SwsContext *sws = sws_getContextFromCmdLine(image->width, - image->height, - image->imgfmt, - dst->width, - dst->height, - dst->imgfmt); + struct SwsContext *sws = sws_getContextFromCmdLine_hq(image->width, + image->height, + image->imgfmt, + dst->width, + dst->height, + dst->imgfmt); struct mp_csp_details colorspace; get_detected_video_colorspace(mpctx->sh_video, &colorspace); |