0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
Commit Graph

155 Commits

Author SHA1 Message Date
Kacper Michajłow
704afb8968 vo_gpu_next: use proper color for subtitles
All SUBBITMAP_LIBASS are converted to sRGB beforehand, for the rest we
need to use video color space.
2023-09-21 21:23:35 +02:00
Kacper Michajłow
66c92dc059 vo_gpu_next: fix unscaled screenshot with --blend-subtitles
Need to use correct adjusted dst.
2023-09-21 02:26:42 +02:00
Kacper Michajłow
4bedcd36f6 vo: make cscale follow scale by default 2023-09-19 22:26:56 +02:00
llyyr
5efc04006b vo_gpu_next: fix blur and taper values being zero
This would always apply the config blur and taper values to the kernel,
even if it was zero because the user didn't specify any.
2023-09-18 17:42:28 +02:00
Niklas Haas
818ef158e8 vo_gpu_next: remove ewa_lanczossharp nag
Upstream finally caved in to peer pressure and added this filter. Of
course, this also removes the fallback for people on older versions of
libplacebo, but people using mpv git master are probably using
libplacebo git master anyway. It's time to debloat this code.
2023-09-16 14:33:45 +02:00
Niklas Haas
400c12fe00 vo_gpu_next: update for new ICC profile API
Upstream has moved from passing struct pl_icc_profile to directly
attaching a managed pl_icc_object, plus providing a new function
pl_icc_update to update the ICC profile object parameters (if needed).

To facilitate this move, pull our ICC params back out of pl_options and
update the target ICC object directly.
2023-09-15 10:58:37 +02:00
Niklas Haas
c9d5b482c1 vo_gpu_next: map --scaler-resizes-only 2023-09-14 18:24:47 +02:00
Kacper Michajłow
49dfa1430b vo_gpu_next: support --blend-subtitles when taking screenshoot 2023-09-09 00:49:19 +00:00
Kacper Michajłow
d467c0e63c vo_gpu_next: support crop in video_screenshot 2023-09-09 00:49:19 +00:00
Niklas Haas
57a6a16172 vo_gpu_next: forwards compatibility with pl_cache
Interrim solution, forwards compatible with new and backwards compatible
with old API. Eventually, we will want to discontinue the use of
deprecated pl_icc_params.save/load and pl_renderer_save/load, but that
requires minimum version bump.
2023-09-08 18:22:31 +02:00
Niklas Haas
67368ac5d2 vo_gpu_next: don't rotate gamut visualization
Causes bad performance with interpolation because the changing hue angle
invalidates the mixing cache, as a result of libplacebo implementations
(specifically, the fact that this graph is drawn during the color
management process, instead of as a separate overlay).

Fix it by just hard-coding a particular, relatively interesting plane
(pi/4 approximately maps onto the red-blue axis).
2023-09-02 22:22:54 +02:00
Niklas Haas
67d31a8266 vo_gpu_next: improve --tonemapping-visualize
Pick a smarter rect, limit it to right half of screen (to allow more
easily using it simultaneously with stats), and also auto-rotate through
the hue plane by default (wrapping once every 10 seconds of playback).

I briefly considered making it based on wallclock time instead of pts,
but this has the rather unfortunate downside of only being updated
sporadically as the user moves the mouse over OSC elements. (Of course,
we could also forcibly redraw the screen continously to avoid it, but
I'd rather not make such an invasive change for no real reason)

This design also allows you to pause and focus on (via framestepping)
individual parts of the hue graph that you're interested in.
2023-08-30 17:10:13 +02:00
Kacper Michajłow
38ac67308b vo_gpu_next: add support for VOCTRL_HDR_METADATA 2023-08-29 20:58:44 +02:00
Niklas Haas
3e612c07f4 vo_gpu_next: fix --target-contrast=inf
Somehow this overrode max_luma instead of min_luma...

Fixes: 347fbd6fa3
2023-08-28 18:30:54 +02:00
Niklas Haas
902bbdad35 vo_gpu_next: update tmp params before rendering frame
Gives the correct queue size value for the subsequent pl_queue_update()
calls, which avoids a bit of unnecessary overhead.
2023-08-27 14:39:45 +02:00
Niklas Haas
0fd357a416 vo_gpu_next: make option shim consistent with new API
Avoids some unnecessary #ifdef and allows us to isolate the shim to a
single location.
2023-08-27 14:39:45 +02:00
Niklas Haas
835fd7bdeb vo_gpu_next: avoid duplicate code (cosmetic)
Also avoids 80col violation.
2023-08-27 14:39:45 +02:00
Niklas Haas
6fb9d92b25 vo_gpu_next: correctly set params.frame_mixer
This was incorrectly adapted from the old options system, we forgot to
ever actually assign p->frame_mixer to params.frame_mixer.

Fixes: d2082841df
2023-08-27 14:39:45 +02:00
Niklas Haas
23e9b57791 vo_gpu_next: don't nuke main options state in video_screenshot
This actually fixes a bug that was present in this code even before the
new pl_options system, which is that `video_screenshot` would
permanently leave `peak_detect_params.allow_delayed` as false, until
something else forced options re-application due to options cache
change.
2023-08-27 14:39:45 +02:00
Niklas Haas
87aa65285b vo_gpu_next: don't override main options in draw_frame
Instead, take a stack copy of the relevant struct. Avoids leaving
temporary state dangling after this function returns.

Fixes: 40b6afcfca
2023-08-27 14:39:45 +02:00
Niklas Haas
af9b53f3a3 vo_gpu_next: move line to correct location (cosmetic) 2023-08-21 19:50:20 +02:00
Niklas Haas
32ee937afa vo_gpu_next: correctly handle GAMUT_AUTO
Fixes: https://github.com/mpv-player/mpv/issues/12208
2023-08-21 19:49:59 +02:00
Niklas Haas
ef4c6dfcf5 vo_gpu_next: reword error message on empty screenshot
This can happen under perfectly legitimate circumstances if no file is
loaded yet.
2023-08-21 13:43:20 +02:00
Niklas Haas
2791eb64e8 vo_gpu_next: correctly clear removed hooks
Before d208284, this was implicitly reset back to 0 at the start of
every update_options(). But we no longer explicitly reset par->params,
so we need to do it manually here for the hooks.

Fixes: https://github.com/mpv-player/mpv/issues/12203
2023-08-19 23:39:25 +02:00
Niklas Haas
7ae4396ea5 vo_gpu_next: fix typo in video_screenshot()
Undefined behavior (bad initializer). Somehow didn't trigger a warning
on my end...

Fixes: a8192eda6c
2023-08-19 16:03:09 +02:00
Niklas Haas
a8192eda6c vo_gpu_next: add --libplacebo-opts
To help test not-yet-exposed options, and for debugging purposes.
2023-08-19 14:12:24 +02:00
Niklas Haas
40b6afcfca vo_gpu_next: don't re-set frame_mixer
This is already set by map_scaler, just disable it if unwanted.
2023-08-19 14:12:24 +02:00
Niklas Haas
47f756d64b vo_gpu_next: move allow_delayed to move appropriate place
No need to override this so late in the general (non-screenshot) code.
2023-08-19 14:12:24 +02:00
Niklas Haas
d2082841df vo_gpu_next: switch to new pl_options system
With a backwards compatibility shim for older versions of libplacebo in
which we simply define the relevant subset of this struct ourselves and
initialize it to known-good values, to be able to continue using our
options assigning code.

It's worth pointing out that our use of scalers deviates from how
pl_options was intended to be used, as a consequence of backwards
compatibility with pre-308 versions of libplacebo. But this should work
fine in practice, since we don't care about serializing these custom
scalers correctly. Users can still override them using the built-in
pl_options scalers when loading custom scalers via --libplacebo-options.
(To be added in the next commit)
2023-08-19 14:12:24 +02:00
Niklas Haas
152a95f215 vo_gpu_next: fix leak of --icc-profile-auto on uninit
This was already correctly freed when acquiring a new profile, but never
freed on uninit. Fix by reparenting the profile onto `p`, which is what
vo_gpu also does.
2023-08-18 19:07:39 +02:00
Niklas Haas
f97584cadc vo_gpu_next: drop redundant PL_HAVE_LCMS check
This header is installed unconditionally starting with libplacebo
v4.208.0, so we are safe to remove the check.
2023-08-18 16:40:44 +02:00
Kacper Michajłow
f274ff2f2b vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy
Instead copy the data on-demand when VOCTRL_PERFORMANCE_DATA is
requested.
2023-08-18 16:39:57 +02:00
Niklas Haas
442adb0553 vo_gpu_next: drop PL_API_VER compatibility paths
v6.292 implied by minimum dependency.
2023-08-18 16:39:57 +02:00
Dudemanguy
efefe3a6dc vo_gpu_next: actually fix screenshots with PAR
983e8f0100 resulted in the correct
dimensions, but it was not actually right because vo_gpu_next still had
the src and dst rects the same. This just needs to work like how vo_gpu
does where the src is the image params and the dst is desired output. So
basically, just copy that code over here. Fixes #12108 and as a bonus,
overriding the aspect ratio now results in correct screenshots
(previously didn't work at now and then with the above commit it had
correct dimensions but still incorrect output).
2023-08-08 21:28:10 -05:00
Dudemanguy
983e8f0100 vo_gpu_next: take into account PAR when taking screenshots
Using the width and height params directly doesn't actually work if PAR
is something other than 1. Instead, use mp_image_params_get_dsize and
calculate the correct dimensions which matches the vo_gpu behavior.
2023-08-07 21:09:30 -05:00
Niklas Haas
cf01646c39 vo_gpu_next: add ability to use named hook params
Closes: https://github.com/mpv-player/mpv/issues/12093
2023-08-07 19:34:44 +02:00
Niklas Haas
35a6b26b78 vo_gpu_next: increase non-interpolation queue size
1 is not enough to prevent PL_QUEUE_MORE, because the pl_queue is
designed to always know the next frame (in addition to the current).
Before haasn/libplacebo@112bb886, this was was (wrongly) silently
omitted by the pl_queue code, but that fix exposed this.

While it's technically API misuse on mpv side, due to the mpv vo code
having its own internal queueing and timing control, it shouldn't
actually make any difference in practice (and likely, the error message
showing up is the only meaningful bug here - the issue is entirely
cosmetic).

Fixes: https://github.com/mpv-player/mpv/issues/12101
2023-08-07 10:42:08 +02:00
Niklas Haas
f6de44dd6a vo_gpu_next: update for new pl_filter configuration API
Configuration of filter parameters was moved from pl_filter_function (of
which the user had to make a copy) to pl_filter_config, with the
pl_filter_function remaining immutable.

Implement this new logic in a way that can reasonably exist side-by-side
with the old configuration API. Once we drop support for PL_API_VER
below 303, we can drastically simplify this code.
2023-08-06 22:44:54 +02:00
Dudemanguy
59ac302dff vo_gpu/vo_gpu_next: fix setting an empty dscale
The manual currently says that if dscale is unset, --scale will be
applied. However, this only works at init time. If you change the dscale
filter to be empty later, vo_gpu will segfault and vo_gpu_next will
throw an error and refuse the changes. That's because when the option is
unset at runtime, the value becomes "" not NULL and the vo's never
accounted for this. Fixes #12031.
2023-08-05 14:01:02 +00:00
Niklas Haas
45e95311b8 vo_gpu_next: add --hdr-peak-percentile 2023-08-04 16:58:44 +02:00
Niklas Haas
3bf1d22879 vo_gpu_next: fix assertion on wayland
This code failed to handle the case of the swapchain submission being
skipped because the window was invisible.

Fixes: f9dc695b58
2023-07-29 19:09:45 +02:00
Niklas Haas
f9dc695b58 vo_gpu_next: delay swapchain submit until flip_frame()
Presents frames at the correct time when DS is disabled.
2023-07-29 17:09:59 +02:00
sfan5
5236003db5 Revert "vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy"
We wanted to preserve the libplacebo v5.264.0 requirement for gpu_next
for this release, since this is the what most Linux distributions are shipping.
The VLC 3 <-> libplacebo v6 situation is an additional reason distros are not
likely to ship the newest libplacebo release soon.
This reverts commit b73d96776c.
2023-07-23 15:40:41 +02:00
Niklas Haas
02595011eb vo_gpu_next: add --hdr-contrast-recovery/smoothness
New upstream feature. Disabled by default.
2023-07-18 15:22:18 +02:00
Kacper Michajłow
347fbd6fa3 vo_gpu_next: add --target-contrast option
For better control over target display levels.
2023-07-17 18:50:34 +02:00
Dudemanguy
ee69d99bd4 various: correctly ignore cache files with --no-config
--no-config should prevent loading user files of any type: configs,
cache, etc. For cache files, this case wasn't properly handled and it
was assumed they would always get something. vo_gpu's shader cache
actually already handles this, so it was left untouched. In theory,
demuxer cache should never have this issue because saving it to disk is
disabled by default (and likely that will never change), but go ahead
and change it for consistency's sake. Fixes some segfaults with
--no-config and various combinations of settings (particularly
--vo=gpu-next).
2023-07-06 13:08:23 +00:00
Kacper Michajłow
d2c28bc4df vo_gpu_next: remove synchronization from info_callback
VOCTRL is processed on VO thread.
2023-07-02 16:20:48 +02:00
Kacper Michajłow
b73d96776c vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy
Instead copy the data on-demand when VOCTRL_PERFORMANCE_DATA is
requested.
2023-07-02 16:20:48 +02:00
Niklas Haas
0af81b16d8 vo_gpu_next: add --corner-rounding option
For better or worse.
2023-06-21 23:52:35 +02:00
Niklas Haas
f1600ea9cf vo_gpu_next: add missing --gamut-mapping-mode options
Adds the missing upstream values that were exposed by the new gamut
mapping API.
2023-06-21 23:52:35 +02:00