diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch) | |
tree | 1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /video/sws_utils.c | |
parent | Adding upstream version 0.37.0. (diff) | |
download | mpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.tar.xz mpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.zip |
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'video/sws_utils.c')
-rw-r--r-- | video/sws_utils.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/video/sws_utils.c b/video/sws_utils.c index 5e9c358..a07bb55 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -24,6 +24,7 @@ #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 37, 100) #include <libavutil/pixdesc.h> #endif +#include <libplacebo/utils/libav.h> #include "config.h" @@ -156,11 +157,11 @@ bool mp_sws_supports_formats(struct mp_sws_context *ctx, sws_isSupportedOutput(imgfmt2pixfmt(imgfmt_out)); } -static int mp_csp_to_sws_colorspace(enum mp_csp csp) +static int pl_csp_to_sws_colorspace(enum pl_color_system csp) { // The SWS_CS_* macros are just convenience redefinitions of the // AVCOL_SPC_* macros, inside swscale.h. - return mp_csp_to_avcol_spc(csp); + return pl_system_to_av(csp); } static bool cache_valid(struct mp_sws_context *ctx) @@ -289,11 +290,11 @@ int mp_sws_reinit(struct mp_sws_context *ctx) return -1; } - int s_csp = mp_csp_to_sws_colorspace(src.color.space); - int s_range = src.color.levels == MP_CSP_LEVELS_PC; + int s_csp = pl_csp_to_sws_colorspace(src.repr.sys); + int s_range = src.repr.levels == PL_COLOR_LEVELS_FULL; - int d_csp = mp_csp_to_sws_colorspace(dst.color.space); - int d_range = dst.color.levels == MP_CSP_LEVELS_PC; + int d_csp = pl_csp_to_sws_colorspace(src.repr.sys); + int d_range = dst.repr.levels == PL_COLOR_LEVELS_FULL; av_opt_set_int(ctx->sws, "sws_flags", ctx->flags, 0); @@ -308,8 +309,8 @@ int mp_sws_reinit(struct mp_sws_context *ctx) av_opt_set_double(ctx->sws, "param0", ctx->params[0], 0); av_opt_set_double(ctx->sws, "param1", ctx->params[1], 0); - int cr_src = mp_chroma_location_to_av(src.chroma_location); - int cr_dst = mp_chroma_location_to_av(dst.chroma_location); + int cr_src = pl_chroma_to_av(src.chroma_location); + int cr_dst = pl_chroma_to_av(dst.chroma_location); int cr_xpos, cr_ypos; #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 37, 100) if (av_chroma_location_enum_to_pos(&cr_xpos, &cr_ypos, cr_src) >= 0) { @@ -407,11 +408,11 @@ int mp_sws_scale(struct mp_sws_context *ctx, struct mp_image *dst, return mp_zimg_convert(ctx->zimg, dst, src) ? 0 : -1; #endif - if (src->params.color.space == MP_CSP_XYZ && dst->params.color.space != MP_CSP_XYZ) { + if (src->params.repr.sys == PL_COLOR_SYSTEM_XYZ && dst->params.repr.sys != PL_COLOR_SYSTEM_XYZ) { // swsscale has hardcoded gamma 2.2 internally and 2.6 for XYZ - dst->params.color.gamma = MP_CSP_TRC_GAMMA22; + dst->params.color.transfer = PL_COLOR_TRC_GAMMA22; // and sRGB primaries... - dst->params.color.primaries = MP_CSP_PRIM_BT_709; + dst->params.color.primaries = PL_COLOR_PRIM_BT_709; // it doesn't adjust white point though, but it is not worth to support // this case. It would require custom prim with equal energy white point // and sRGB primaries. |