diff --git a/DOCS/interface-changes/glsl-shader-opts.txt b/DOCS/interface-changes/glsl-shader-opts.txt new file mode 100644 index 0000000000..e350b77aa3 --- /dev/null +++ b/DOCS/interface-changes/glsl-shader-opts.txt @@ -0,0 +1 @@ +``glsl-shader-opts`` now has predefined parameters that can be used. See the documentation for available values. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index f2aa576eca..94aede5636 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -6327,6 +6327,48 @@ them. The shader name is the base part of the shader filename, without the extension. (``--vo=gpu-next`` only) + Some parameters are filled automatically if the shader requests them. + Currently following parameters are available: + + ``PTS`` + PTS of the current frame in seconds. + + ``chroma_offset_x`` + chroma offset to the reference plane in x direction. + + ``chroma_offset_y`` + chroma offset to the reference plane in y direction. + + ``min_luma`` + Minimum luminance value (in cd/m²). + + ``max_luma`` + Maximum luminance value (in cd/m²). + + ``max_cll`` + Maximum Content Light Level (in cd/m²). + + ``max_fall`` + Maximum Frame Average Light Level (in cd/m²). + + ``scene_max_r`` + Maximum scene light level of the red channel (in cd/m²). + + ``scene_max_g`` + Maximum scene light level of the green channel (in cd/m²). + + ``scene_max_b`` + Maximum scene light level of the blue channel (in cd/m²). + + ``scene_avg`` + Average scene light level (in cd/m²). + + ``max_pq_y`` + Maximum PQ luminance (in PQ, 0-1). + + ``avg_pq_y`` + Average PQ luminance (in PQ, 0-1). + ``--deband`` Enable the debanding algorithm. This greatly reduces the amount of visible banding, blocking and other quantization artifacts, at the expense of diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 7fc1ff6d60..00d8c5c65b 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -2080,8 +2080,26 @@ static void update_lut(struct priv *p, struct user_lut *lut) static void update_hook_opts_dynamic(struct priv *p, const struct pl_hook *hook, const struct mp_image *mpi) { - const struct { const char *name; double value; } opts[] = { - { "PTS", mpi->pts }, + float chroma_offset_x, chroma_offset_y; + pl_chroma_location_offset(mpi->params.chroma_location, + &chroma_offset_x, &chroma_offset_y); + const struct { + const char *name; + double value; + } opts[] = { + { "PTS", mpi->pts }, + { "chroma_offset_x", chroma_offset_x }, + { "chroma_offset_y", chroma_offset_y }, + { "min_luma", mpi->params.color.hdr.min_luma }, + { "max_luma", mpi->params.color.hdr.max_luma }, + { "max_cll", mpi->params.color.hdr.max_cll }, + { "max_fall", mpi->params.color.hdr.max_fall }, + { "scene_max_r", mpi->params.color.hdr.scene_max[0] }, + { "scene_max_g", mpi->params.color.hdr.scene_max[1] }, + { "scene_max_b", mpi->params.color.hdr.scene_max[2] }, + { "scene_avg", mpi->params.color.hdr.scene_avg }, + { "max_pq_y", mpi->params.color.hdr.max_pq_y }, + { "avg_pq_y", mpi->params.color.hdr.avg_pq_y }, }; for (int i = 0; i < hook->num_parameters; i++) { @@ -2092,8 +2110,8 @@ static void update_hook_opts_dynamic(struct priv *p, const struct pl_hook *hook, switch (hp->type) { case PL_VAR_FLOAT: hp->data->f = opts[n].value; break; - case PL_VAR_SINT: hp->data->i = round(opts[n].value); break; - case PL_VAR_UINT: hp->data->u = round(opts[n].value); break; + case PL_VAR_SINT: hp->data->i = lrint(opts[n].value); break; + case PL_VAR_UINT: hp->data->u = lrint(opts[n].value); break; } } }