From 24bfa82a91a49b0e2a120b719a6b89ac2b1b415b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 25 Nov 2012 00:06:16 +0100 Subject: sub: reimplement -spugauss as --sub-gauss Apparently the -spugauss option was popular. The code originally implementing this is gone (scaler stuff in spudec.c). Reimplement it using libswscale to scale and blur image subtitles if the --sub-gauss option is set. The code does some rather lazy padding to allow the blur to spread pixels past the original image bounding box. (This problem exists with normal bilinear scaling too, but is barely noticable.) Technically, this doesn't just blur subtitles, but anything RGBA (or indexed) that enters the OSD rendering path. But only image subtitles produce these OSD formats currently, so no explicit check is done to prevent blurring in other cases. --- sub/sub.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sub/sub.c') diff --git a/sub/sub.c b/sub/sub.c index dd8c887b4c..66ee6ea42c 100644 --- a/sub/sub.c +++ b/sub/sub.c @@ -172,6 +172,8 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, const bool formats[SUBBITMAP_COUNT], struct sub_bitmaps *out_imgs) { + struct MPOpts *opts = osd->opts; + *out_imgs = (struct sub_bitmaps) {0}; if (!osd_res_equals(res, obj->vo_res)) @@ -222,6 +224,9 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, if (formats[SUBBITMAP_RGBA] && out_imgs->format == SUBBITMAP_INDEXED) cached |= osd_conv_idx_to_rgba(obj->cache[0], out_imgs); + if (out_imgs->format == SUBBITMAP_RGBA && opts->sub_gauss != 0.0f) + cached |= osd_conv_blur_rgba(obj->cache[1], out_imgs, opts->sub_gauss); + if (cached) obj->cached = *out_imgs; } -- cgit v1.2.3