sws_utils: make hq swscale flags available with mp_sws_hq_flags

No need to duplicate this on the call-site.
This commit is contained in:
wm4 2013-07-18 13:48:57 +02:00
parent 7f88e36911
commit b606a6ce1a
3 changed files with 8 additions and 7 deletions

View File

@ -20,7 +20,6 @@
#include <string.h>
#include <setjmp.h>
#include <libswscale/swscale.h>
#include <libavcodec/avcodec.h>
#include <libavutil/mem.h>
@ -288,10 +287,7 @@ int write_image(struct mp_image *image, const struct image_writer_opts *opts,
struct mp_image *dst = mp_image_alloc(destfmt, d_w, d_h);
mp_image_copy_attributes(dst, image);
int flags = SWS_LANCZOS | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP |
SWS_ACCURATE_RND | SWS_BITEXACT;
mp_image_swscale(dst, image, flags);
mp_image_swscale(dst, image, mp_sws_hq_flags);
allocated_image = dst;
image = dst;

View File

@ -39,6 +39,10 @@ int sws_chr_hshift = 0;
float sws_chr_sharpen = 0.0;
float sws_lum_sharpen = 0.0;
// Highest quality, but also slowest.
const int mp_sws_hq_flags = SWS_LANCZOS | SWS_FULL_CHR_H_INT |
SWS_FULL_CHR_H_INP | SWS_ACCURATE_RND |
SWS_BITEXACT;
// Set ctx parameters to global command line flags.
void mp_sws_set_from_cmdline(struct mp_sws_context *ctx)
@ -271,8 +275,7 @@ void mp_image_sw_blur_scale(struct mp_image *dst, struct mp_image *src,
float gblur)
{
struct mp_sws_context *ctx = mp_sws_alloc(NULL);
ctx->flags = SWS_LANCZOS | SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP |
SWS_ACCURATE_RND | SWS_BITEXACT;
ctx->flags = mp_sws_hq_flags;
ctx->src_filter = sws_getDefaultFilter(gblur, gblur, 0, 0, 0, 0, 0);
ctx->force_reload = true;
mp_sws_scale(ctx, dst, src);

View File

@ -13,6 +13,8 @@ struct mp_csp_details;
// Guaranteed to be a power of 2 and > 1.
#define SWS_MIN_BYTE_ALIGN 16
extern const int mp_sws_hq_flags;
bool mp_sws_supported_format(int imgfmt);
void mp_image_swscale(struct mp_image *dst, struct mp_image *src,