1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00
mpv/video/sws_utils.h
wm4 24bfa82a91 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.
2012-11-25 23:40:07 +01:00

32 lines
1.0 KiB
C

#ifndef MPLAYER_SWS_UTILS_H
#define MPLAYER_SWS_UTILS_H
#include <stdbool.h>
#include <libswscale/swscale.h>
struct mp_image;
struct mp_csp_details;
// libswscale currently requires 16 bytes alignment for row pointers and
// strides. Otherwise, it will print warnings and use slow codepaths.
// Guaranteed to be a power of 2 and > 1.
#define SWS_MIN_BYTE_ALIGN 16
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam,
SwsFilter **dstFilterParam);
struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat,
int dstW, int dstH,
int dstFormat);
bool mp_sws_supported_format(int imgfmt);
void mp_image_swscale(struct mp_image *dst, struct mp_image *src,
int my_sws_flags);
void mp_image_sw_blur_scale(struct mp_image *dst, struct mp_image *src,
float gblur);
#endif /* MP_SWS_UTILS_H */
// vim: ts=4 sw=4 et tw=80