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

104 Commits

Author SHA1 Message Date
Kacper Michajłow
959ef843d2 vo_gpu_next: fix to allow using dllimport
Address of variables can't be used for constant initialization in C
language modes.
2023-05-27 14:54:59 +02:00
Kacper Michajłow
9fd4ae9529 vo: make mp_frame_perf thread safe
It was unsafe to return pointer to memory that was freed on another
thread, just copy the string to caller owned sturcture.

Fixes crashes when displaying passes stats with gpu-next.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
19c5cd92b2 vo_gpu_next: add size guard for pass->num_samples
This shouldn't happen as the array sizes are the same, but guard against
it in case libplacebo do something naughty.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
3b89a58af7 vo_gpu_next: synchronize voctrl_performance_data access
info_callback is fired quite often and from different thread than any
accesses to this structure.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
695b3c51d1 vo_gpu_next: fix off by one in info_callback
Fixes invalid memory writes.
2023-05-25 16:25:33 +02:00
Niklas Haas
b9a5583f17 vo_gpu_next: fix build on older libplacebo
Introduced by, of all things, a rebase...

Fixes: a5da8b2c87
2023-05-24 22:06:03 +02:00
Niklas Haas
a5da8b2c87 vo_gpu_next: update to new libplacebo gamut mapping API
This just replaces the API calls to get rid of deprecation warnings, it
doesn't yet expand the enum, nor replace them by the proper options.

The translation from tone map modes to hybrid mix parameters is taken
from the libplacebo source code.
2023-05-24 21:32:23 +02:00
Niklas Haas
dc13d47c73 vo_gpu_next: remove --tone-mapping-crosstalk
Removed upstream, to be replaced by constant 0.04.
2023-05-24 21:32:00 +02:00
Kacper Michajłow
9e716d6303 vo_gpu_next: allow to use ICC profile luminance value
Also while at it respect target-peak option when ICC profile is used.

Fixes #11449
2023-05-13 17:08:37 +02:00
Dudemanguy
4502522a7a player: use XDG_CACHE_HOME by default
This adds cache as a possible path for mpv to internally pick
(~/.cache/mpv for non-darwin unix-like systems, the usual config
directory for everyone else). For gpu shader cache and icc cache,
controlling whether or not to write such files is done with the new
--gpu-shader-cache and --icc-cache options respectively. Additionally,
--cache-on-disk no longer requires explicitly setting the --cache-dir
option. The old options, --cache-dir, --gpu-shader-cache-dir, and
--icc-cache-dir simply set an override for the directory to save cache
files. If unset, then the cache is saved in XDG_CACHE_HOME.
2023-05-09 20:37:17 +00:00
Kacper Michajłow
4fd0a39fc8 vo_gpu_next: fixes to allow using dllimport
Address of variables can't be used for constant initialization in C
language modes.

See 0c43d8077e
2023-04-24 13:16:55 +02:00
Harri Nieminen
292a5868cb various: fix typos
Found by codespell
2023-03-28 19:29:44 +00:00
llyyr
685d9cbe5b vo_gpu_next: drop various PL_API_VER checks
We don't need these anymore now that we require PL_API_VER>=264 for
building libplacebo-next
2023-03-26 20:55:58 -07:00
llyyr
3a2f8d42ab vo_gpu_next: compatibility with libplacebo v6.265
libplacebo v6.265.0 removed v4 deprecations. We already require
PL_API_VER >= 202, so we don't need to wrap
pl_tex_transfer_params.row_pitch around a conditional, which exists
since PL_API_VER >= 168. However, pl_source_frame.duration does not exist until
PL_API_VER >= 219, so we should use a conditional directive.
2023-03-13 20:09:06 +01:00
Niklas Haas
dcc9bc5dea vo_gpu_next: compatibility with PL_API_VER >= 254
This field was renamed/moved to a different params struct.
2023-03-06 21:35:10 +01:00
Leo Izen
4defd8bb27 vo_gpu_next: use inverse mapping functions to tag screenshots
Screenshots using the hardware renderer should now include color tags
that map directly from the libplacebo tags, so the if/else logic only
needs to be included once.
2023-03-05 22:37:05 -05:00
Thomas Weißschuh
8d67e891ab vo_gpu_next: fix warning -Wunused-function 2023-02-26 16:45:07 +01:00
Kacper Michajłow
84f6d7a97e vo_gpu_next: fix color space hint with target peak override
Fixes: #11339
2023-02-23 10:14:53 +01:00
Christoph Heinrich
91cc0d8cf6 options: transition options from OPT_FLAG to OPT_BOOL
c784820454 introduced a bool option type
as a replacement for the flag type, but didn't actually transition and
remove the flag type because it would have been too much mundane work.
2023-02-21 17:15:17 +00:00
Niklas Haas
9a752e8b26 vo_gpu_next: add --tone-mapping-visualize 2023-02-19 21:01:40 +01:00
quietvoid
41ad51bda2 vo_gpu_next: parse Dolby Vision metadata for dynamic scene brightness
Improves playback for Dolby Vision video files as the metadata can be
used instead of requiring `hdr-compute-peak=yes`.
2023-02-19 20:50:37 +01:00
Niklas Haas
16ef237da5 vo_gpu_next: allow native CSP screenshots
Useful for getting native screenshots of non-sRGB content, such as HDR
etc.
2023-02-13 21:53:41 +01:00
Niklas Haas
862be6c237 vo_gpu_next: tag screenshots with correct colorspace
When taking window screenshots with a colorspace override, tag them
appropriately, based on the best-known colorspace info. Note that this
is imperfect, we should ideally also attach the output ICC profile if
one exists. But this is better than nothing.

Also force 1:1 PAR in this case. In all other cases, default to sRGB.
2023-02-13 21:53:41 +01:00
Niklas Haas
5078132b28 vo_gpu_next: only apply target options in window screenshot mode
When taking an unscaled screenshot, always render to an unspecified
SDR-like space. (Subject to change) Apply output-specific options (ICC
profile, color space overrides, custom LUT) only in window screenshot
mode.

I decided to split this off from subsequent refactors because it is IMO
a bug fix deserving of its own commit.
2023-02-13 21:53:41 +01:00
Niklas Haas
4f84d91df2 vo_gpu_next: be explicit about screenshot repr
Screenshots are currently always RGB. Subject to change, but needs to be
communicated clearly if changed. This commit is not a functional change,
it's merely for code clarity.
2023-02-13 21:53:41 +01:00
Niklas Haas
2d4a243810 vo_gpu_next: expose --tone-mapping=st2094-40 and st2094-10 2023-02-13 17:52:35 +01:00
Niklas Haas
79b093f210 vo_gpu_next: support mapping HDR10+ dynamic metadata
Based on the new upstream helper function `pl_map_hdr_metadata` and the
existing AV_FRAME_DATA_DYNAMIC_HDR_PLUS. This allows us to use SMPTE
2094-40 dynamic HDR tonemapping in mpv, albeit with the limitation of
requiring `--tone-mapping=auto` in order to pick this curve upstream.
2023-02-13 17:52:35 +01:00
Kacper Michajłow
87fb254deb vo_gpu_next: add check for PL_HAVE_LCMS 2023-02-02 14:23:02 +00:00
Kacper Michajłow
0a4b139ddf osdep: add MP_FALLTHROUGH 2023-02-02 14:23:02 +00:00
Niklas Haas
2531a89fcb vo_gpu_next: implement VO_DR_FLAG_HOST_CACHED
For sufficiently new versions of libplacebo.
2023-01-23 14:13:34 +01:00
Niklas Haas
f8c17f55f9 vo: add int flags to the get_image signature
This is a huge disgusting mess to thread through everywhere. Maybe I'm
stupid for attempting to solve the problem this way.
2023-01-23 14:13:34 +01:00
Niklas Haas
e97e0e4d92 vo_gpu_next: don't flush cache on OSD update
Flushing the cache is a hammer-for-a-screw operation, because it nukes
*all* renderer state, including the HDR peak detection state. When
enabling e.g. --hdr-compute-peak, or any other future methods of dynamic
tone mapping, this would lead to bad results (e.g. brightness
fluctuations) whenever the OSD state is updated.

Instead of flushing the cache to force an OSD re-render, instead just
update the frame signature directly whenever its osd_sync value changes.
This accomplishes effectively the same thing but without touching the
HDR state.

This is slightly violating the libplacebo abstraction in a way that
isn't publicly documented. To be on the safe side we could make a carbon
copy of the array before modifying it, but given that this is unlikely
to change upstream I'll probably just end up explicitly documenting it
instead of forcing the copy in mpv.
2022-11-25 02:15:05 +01:00
Niklas Haas
8327ac3e6d vo_gpu_next: fix undefined behavior on alpha-first formats
When the alpha channel is the first component, this code block gets
skipped by the continue, meaning the check for c==0 never passes.

Fix it by explicitly keeping track of whether bits have been set.
2022-11-19 14:12:24 +01:00
Niklas Haas
33136c276c vo_gpu_next: add tunable shader parameters
This is a very simple but easy way of doing it. Ideally, it would be
nice if we could also add some sort of introspection about shader
parameters at runtime, ideally exposing the entire list of parameters as
a custom property dict. But that is a lot of effort for dubious gain.

It's worth noting that, as currently implemented, re-setting
`glsl-shader-opts` to a new value doesn't reset back previously mutated
values to their defaults.
2022-11-11 13:58:35 +01:00
Niklas Haas
6acb7db9fa vo_gpu_next: set background transparency
Fixes: https://github.com/mpv-player/mpv/issues/10815
2022-11-01 19:09:40 +01:00
rcombs
dfb5b0c55f vo_gpu_next: fix crash on uninit after startup failure 2022-10-14 15:37:49 +02:00
Niklas Haas
98e6fb26a3 vo_gpu_next: respect --blend-subtitles=<yes/no>
This brings vo_gpu_next's behavior more in line with vo_gpu. Currently,
the status quo was that `vo_gpu_next` generated subtitles with the full
resolution of the dst crop, even though practical limitations of
libplacebo meant that such subtitles inevitably got cut off at the video
boundaries. This was actually a worse status quo than `vo_gpu`, which
simply constrained subtitles to the video dimensions to prevent these
issues.

With this change, the behavior is the same as `vo_gpu`, which has the
exact same problem w.r.t interpolation. Users are back to choosing
between --blend-subtitles=yes and not having subtitles in margins,
and using --blend-subtitles=no and not having subtitle interpolation.

There are different pros and cons to each approach, and I still
ultimately plan on allowing libplacebo to interpolate subtitles even in
the black bars, to solve this issue once and for all. But for now, let's
not let perfect be the enemy of good.

No attempt is made to implement `--blend-subs=video`, which I consider
deprecated.

Fixes: https://github.com/mpv-player/mpv/issues/10272
2022-09-29 22:02:00 +02:00
Niklas Haas
3376f775e3 vo_gpu_next: fix screenshots of rotated sources
I actually don't quite understand why this is needed, since in theory we
should already be doing the rotation as part of applying the crop. But I
guess that code doesn't quite work. This is the only way it works, so
it's probably correct. (And note that `vo_gpu` does the same internally)
2022-09-27 21:32:46 +02:00
Niklas Haas
1c8fdf6992 vo_gpu_next: use static assert for array size
This is used in other places in the code, so it should be fine.
2022-09-27 01:35:53 +02:00
Niklas Haas
6b9b032d51 vo_gpu_next: update render_info for upstream API change
This fixes an issue where blend stages with multiple passes got
overwritten by later passes, with only the final pass (typically the
overlayp pass) actually being shown.
2022-09-26 21:14:34 +02:00
Niklas Haas
2b0736ed83 vo_gpu_next: implement --video-output-levels
This was ignored as an oversight.
2022-09-25 20:31:22 +02:00
Niklas Haas
1fb5f06c66 vo_gpu_next: support error diffusion dithering
One step closer to vo_gpu_next feature parity with vo_gpu!
2022-09-20 14:59:00 +02:00
Niklas Haas
b9c7e5b5ff vo_gpu_next: only require full pixel byte alignment
The current code also rejects e.g. rgb30, even though this format is
perfectly valid, because it only checks for alignment of the used bits.
2022-09-12 16:01:07 +02:00
Niklas Haas
30ca46259e vo_gpu_next: implement ICC 3DLUT caching
Relies on a new upstream API for adding save/load callbacks to the ICC
3DLUT generation parameters.

Closes: https://github.com/mpv-player/mpv/issues/10252
2022-09-12 15:35:17 +02:00
Niklas Haas
7a6dc79e29 vo_gpu_next: use correct pixel size when mapping formats
`total_bits` may be less than the true pixel stride (`bpp`) for formats
which contain extra ignored components (e.g. rgb0).
2022-09-12 15:25:56 +02:00
Tillmann Karras
1800891a1d vo_gpu_next: fix typo affecting --target-trc option 2022-09-02 22:03:33 -04:00
Niklas Haas
04062b6f89 vo_gpu_next: display subtitles without video stream
Fixes https://github.com/mpv-player/mpv/issues/10594
2022-08-31 13:33:05 +02:00
Niklas Haas
6e4dd334fe vo_gpu_next: fix screenshots on single-frame files
This check was wrong/outdated. PL_QUEUE_MORE does not imply an empty
frame mix, it can still contain partial frames.
2022-07-23 14:54:39 +02:00
Niklas Haas
8ef744d1b7 vo_gpu_next: don't crash on !frame->current
This path incorrectly assumes there is a current frame.
2022-07-18 22:03:06 +02:00
Niklas Haas
3a2838c88d vo_gpu_next: implement --cscale
Fixes #9451
2022-06-24 16:11:17 +02:00