diff options
author | wm4 <wm4@nowhere> | 2013-07-18 13:17:56 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-18 13:31:01 +0200 |
commit | d8659c9aa0ab74a3dabb321f34e93dd7f3890b03 (patch) | |
tree | 5116f8710d67cd9409dc54dee2e3cf5ef5e99bc6 /video/mp_image.c | |
parent | 48789b354648b9892ec63dc91b91f7a3d5b588e4 (diff) | |
download | mpv-d8659c9aa0ab74a3dabb321f34e93dd7f3890b03.tar.bz2 mpv-d8659c9aa0ab74a3dabb321f34e93dd7f3890b03.tar.xz |
sws_utils: refactor swscale wrapper code
This splits the monolithic mp_image_swscale() function into a bunch of
functions and a context struct. This means it's possible to set
arbitrary parameters (e.g. even obscure ones without getting in the
way), and you don't have to create the context on every call.
This code is preparation for removing duplicated libswscale API usage
from other parts of the code.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 029c5fa91b..238f591858 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -405,22 +405,18 @@ void mp_image_vflip(struct mp_image *img) } } -enum mp_csp mp_image_csp(struct mp_image *img) +bool mp_image_params_equals(const struct mp_image_params *p1, + const struct mp_image_params *p2) { - if (img->colorspace != MP_CSP_AUTO) - return img->colorspace; - return (img->flags & MP_IMGFLAG_YUV) ? MP_CSP_BT_601 : MP_CSP_RGB; + return p1->imgfmt == p2->imgfmt && + p1->w == p2->w && p1->h == p2->h && + p1->d_w == p2->d_w && p1->d_h == p2->d_h && + p1->colorspace == p2->colorspace && + p1->colorlevels == p2->colorlevels; } -enum mp_csp_levels mp_image_levels(struct mp_image *img) -{ - if (img->levels != MP_CSP_LEVELS_AUTO) - return img->levels; - return (img->flags & MP_IMGFLAG_YUV) ? MP_CSP_LEVELS_TV : MP_CSP_LEVELS_PC; -} - -static void mp_image_params_from_image(struct mp_image_params *params, - const struct mp_image *image) +void mp_image_params_from_image(struct mp_image_params *params, + const struct mp_image *image) { // (Ideally mp_image should use mp_image_params directly instead) *params = (struct mp_image_params) { |