summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-04 03:55:38 +0100
committerDudemanguy <random342@airmail.cc>2024-01-22 14:54:55 +0000
commit66e451f4e6e0d0b259eddfd3673f1aa5ff127726 (patch)
tree1cc78476cefa222f351b2cf0c22b7d7496f320bb /video/filter
parent9dd1a137479a41944b43ba45cdd76d63eca75038 (diff)
downloadmpv-66e451f4e6e0d0b259eddfd3673f1aa5ff127726.tar.bz2
mpv-66e451f4e6e0d0b259eddfd3673f1aa5ff127726.tar.xz
csputils: replace mp_colorspace with pl_color_space
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_d3d11vpp.c4
-rw-r--r--video/filter/vf_fingerprint.c2
-rw-r--r--video/filter/vf_format.c28
-rw-r--r--video/filter/vf_vapoursynth.c7
-rw-r--r--video/filter/vf_vavpp.c2
5 files changed, 22 insertions, 21 deletions
diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c
index 3f00c5aa4d..d63acd11ce 100644
--- a/video/filter/vf_d3d11vpp.c
+++ b/video/filter/vf_d3d11vpp.c
@@ -210,8 +210,8 @@ static int recreate_video_proc(struct mp_filter *vf)
FALSE, 0);
D3D11_VIDEO_PROCESSOR_COLOR_SPACE csp = {
- .YCbCr_Matrix = p->params.color.space != MP_CSP_BT_601,
- .Nominal_Range = p->params.color.levels == MP_CSP_LEVELS_TV ? 1 : 2,
+ .YCbCr_Matrix = p->params.repr.sys != PL_COLOR_SYSTEM_BT_601,
+ .Nominal_Range = p->params.repr.levels == PL_COLOR_LEVELS_LIMITED ? 1 : 2,
};
ID3D11VideoContext_VideoProcessorSetStreamColorSpace(p->video_ctx,
p->video_proc,
diff --git a/video/filter/vf_fingerprint.c b/video/filter/vf_fingerprint.c
index 8714382ff3..87248193d6 100644
--- a/video/filter/vf_fingerprint.c
+++ b/video/filter/vf_fingerprint.c
@@ -104,7 +104,7 @@ static void f_process(struct mp_filter *f)
// "portable" across source video.
p->scaled->params.color = mpi->params.color;
// Make output always full range; no reason to lose precision.
- p->scaled->params.color.levels = MP_CSP_LEVELS_PC;
+ p->scaled->params.repr.levels = PL_COLOR_LEVELS_FULL;
if (!mp_zimg_convert(p->zimg, p->scaled, mpi)) {
if (!p->fallback_warning) {
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index 4997d6f173..4a14fc9102 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -65,26 +65,26 @@ static void set_params(struct vf_format_opts *p, struct mp_image_params *out,
bool set_size)
{
if (p->colormatrix)
- out->color.space = p->colormatrix;
+ out->repr.sys = p->colormatrix;
if (p->colorlevels)
- out->color.levels = p->colorlevels;
+ out->repr.levels = p->colorlevels;
if (p->primaries)
out->color.primaries = p->primaries;
if (p->gamma) {
- enum mp_csp_trc in_gamma = p->gamma;
- out->color.gamma = p->gamma;
- if (in_gamma != out->color.gamma) {
+ enum pl_color_transfer in_gamma = p->gamma;
+ out->color.transfer = p->gamma;
+ if (in_gamma != out->color.transfer) {
// When changing the gamma function explicitly, also reset stuff
// related to the gamma function since that information will almost
// surely be false now and have to be re-inferred
out->color.hdr = (struct pl_hdr_metadata){0};
- out->color.light = MP_CSP_LIGHT_AUTO;
+ out->light = MP_CSP_LIGHT_AUTO;
}
}
if (p->sig_peak)
out->color.hdr = (struct pl_hdr_metadata){ .max_luma = p->sig_peak * MP_REF_WHITE };
if (p->light)
- out->color.light = p->light;
+ out->light = p->light;
if (p->chroma_location)
out->chroma_location = p->chroma_location;
if (p->stereo_in)
@@ -122,10 +122,10 @@ static void vf_format_process(struct mp_filter *f)
int outfmt = priv->opts->fmt;
// If we convert from RGB to YUV, default to limited range.
- if (mp_imgfmt_get_forced_csp(img->imgfmt) == MP_CSP_RGB &&
- outfmt && mp_imgfmt_get_forced_csp(outfmt) == MP_CSP_AUTO)
+ if (mp_imgfmt_get_forced_csp(img->imgfmt) == PL_COLOR_SYSTEM_RGB &&
+ outfmt && mp_imgfmt_get_forced_csp(outfmt) == PL_COLOR_SYSTEM_UNKNOWN)
{
- par.color.levels = MP_CSP_LEVELS_TV;
+ par.repr.levels = PL_COLOR_LEVELS_LIMITED;
}
set_params(priv->opts, &par, true);
@@ -204,10 +204,10 @@ static struct mp_filter *vf_format_create(struct mp_filter *parent, void *option
#define OPT_BASE_STRUCT struct vf_format_opts
static const m_option_t vf_opts_fields[] = {
{"fmt", OPT_IMAGEFORMAT(fmt)},
- {"colormatrix", OPT_CHOICE_C(colormatrix, mp_csp_names)},
- {"colorlevels", OPT_CHOICE_C(colorlevels, mp_csp_levels_names)},
- {"primaries", OPT_CHOICE_C(primaries, mp_csp_prim_names)},
- {"gamma", OPT_CHOICE_C(gamma, mp_csp_trc_names)},
+ {"colormatrix", OPT_CHOICE_C(colormatrix, pl_csp_names)},
+ {"colorlevels", OPT_CHOICE_C(colorlevels, pl_csp_levels_names)},
+ {"primaries", OPT_CHOICE_C(primaries, pl_csp_prim_names)},
+ {"gamma", OPT_CHOICE_C(gamma, pl_csp_trc_names)},
{"sig-peak", OPT_FLOAT(sig_peak)},
{"light", OPT_CHOICE_C(light, mp_csp_light_names)},
{"chroma-location", OPT_CHOICE_C(chroma_location, mp_chroma_names)},
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 583a196f3b..5a3ce423d1 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -27,6 +27,7 @@
#include <libavutil/rational.h>
#include <libavutil/cpu.h>
+#include <libplacebo/utils/libav.h>
#include "common/msg.h"
#include "filters/f_autoconvert.h"
@@ -184,13 +185,13 @@ static void copy_mp_to_vs_frame_props_map(struct priv *p, VSMap *map,
struct mp_image_params *params = &img->params;
p->vsapi->propSetInt(map, "_SARNum", params->p_w, 0);
p->vsapi->propSetInt(map, "_SARDen", params->p_h, 0);
- if (params->color.levels) {
+ if (params->repr.levels) {
p->vsapi->propSetInt(map, "_ColorRange",
- params->color.levels == MP_CSP_LEVELS_TV, 0);
+ params->repr.levels == PL_COLOR_LEVELS_LIMITED, 0);
}
// The docs explicitly say it uses libavcodec values.
p->vsapi->propSetInt(map, "_ColorSpace",
- mp_csp_to_avcol_spc(params->color.space), 0);
+ pl_system_to_av(params->repr.sys), 0);
if (params->chroma_location) {
p->vsapi->propSetInt(map, "_ChromaLocation",
params->chroma_location == MP_CHROMA_CENTER, 0);
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index 52be148111..f70fe1f4a6 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -208,7 +208,7 @@ static struct mp_image *render(struct mp_filter *vf)
mp_image_copy_attributes(img, in);
- unsigned int flags = va_get_colorspace_flag(p->params.color.space);
+ unsigned int flags = va_get_colorspace_flag(p->params.repr.sys);
if (!mp_refqueue_should_deint(p->queue)) {
flags |= VA_FRAME_PICTURE;
} else if (mp_refqueue_is_top_field(p->queue)) {