natural-harmonia-gropius / hdr-toys

Componentized Rec.2100 to Rec.709 conversion shader for mpv-player, featuring dynamic curves and a uniform color space.
MIT License
112 stars 1 forks source link

Incorrect HDR conversion result #15

Closed natural-harmonia-gropius closed 1 year ago

natural-harmonia-gropius commented 1 year ago

https://github.com/Natural-Harmonia-Gropius/mpv_config/issues/11#issuecomment-1407580910

natural-harmonia-gropius commented 1 year ago

@pintassilgo Let's continue to look at the issue here.

sorry, you need to use mpv 0.35.1, 0.35.0 doesn't support --glsl-shader-opts. https://github.com/mpv-player/mpv/pull/10827

~~Can you share the screenshot of stats page? For my config, press tab 2, and console, press /. I only have a windows PC and I can get same results to you under vo=gpu.~~

vo=gpu-next image vo=gpu image

pintassilgo commented 1 year ago

sorry, you need to use mpv 0.35.1, 0.35.0 doesn't support --glsl-shader-opts.

The version I use is a build from git in 2022.12.22, the commit implementing that option was made in Nov 11, 2022, so my mpv is compatible.

image

natural-harmonia-gropius commented 1 year ago

I need the screenshot of console, should be some error there.

pintassilgo commented 1 year ago

AV1 image

VP9 version has empty console, but same results image

natural-harmonia-gropius commented 1 year ago

That unrecognized command is, try newer version, or report an issue to mpv.

I don't know much about Linux, maybe version of libplacebo in your mpv is not enough.

pintassilgo commented 1 year ago

I just installed 0.35.1 and the result is the same.

It's also worth noting I use a rolling release distro, so packages should be very new.

natural-harmonia-gropius commented 1 year ago

Then I think you need to upgrade libplacebo, but I don't know how to do it. https://github.com/haasn/libplacebo

pintassilgo commented 1 year ago

libplacebo is in latest version, v5.229.2.

Also tried with mpv 0.35.1 flatpak version which includes all dependencies and was just released.

natural-harmonia-gropius commented 1 year ago

Open an issue to mpv, //!PARAM in shader can't be parsed.

pintassilgo commented 1 year ago

https://github.com/Natural-Harmonia-Gropius/mpv_config/blob/3f893e6e514db8c14ac0c2c0a56663c7ab0ffdec/portable_config/shaders/hdr-toys/gamut-mapping/compress.glsl#L157-L161

Look here, from official mpv manual: https://mpv.io/manual/master/#options-glsl-shaders

Looking to popular shaders, every word in the //!WORD format is present in the link above, like //!HOOK and //!DESC. But there's no //!PARAM. It doesn't seem to be supported, I don't know how it works for you.

Look here, from source: https://github.com/mpv-player/mpv/blob/master/video/out/gpu/user_shaders.c

In the code, search from every occurrences of bstr_eatstart0(&line. You'll see all the supported commands and PARAM is not among them.

image

natural-harmonia-gropius commented 1 year ago

It's a feature of libplacebo (gpu-next), you have the latest mpv and libplacebo, they should support this. https://libplacebo.org/custom-shaders/#param-name

pintassilgo commented 1 year ago

I don't understand the code, but it seems to be mpv's fault, since there's code about other commands like HOOKand BIND but not for PARAM, TYPE...

Strange how it works for you since there's no code in mpv source about these commands you use.

natural-harmonia-gropius commented 1 year ago

https://github.com/mpv-player/mpv/blob/master/video/out/gpu is vo=gpu, of course not support. the shader is sent to libplacebo.so or something like this, process not be done in mpv.

pintassilgo commented 1 year ago

So I have no clue where and how to report this issue. =/

natural-harmonia-gropius commented 1 year ago

https://github.com/mpv-player/mpv/issues

Just follow the mpv issue template. Remove # and run mpv with that av1 video, log file will appear in portable_config. image

Title: gpu_next: //!PARAM in shader can't be parsed.

Content: image Your log here.

pintassilgo commented 1 year ago

Thanks. Reported here: https://github.com/mpv-player/mpv/issues/11238

If you have something else to add, please comment there as you know much more about all of this than me.

pintassilgo commented 1 year ago

So the answer is

libplacebo version unfortunately too old. You need the latest experimental version built from git master. This functionality hasn't made its way into any stable release yet.

From where you got your libplacebo?

natural-harmonia-gropius commented 1 year ago

No idea with Linux, I would suggest waiting for the next stable release.

For me, windows have an all-in-one exe nightly build. https://github.com/shinchiro/mpv-winbuild-cmake/releases

natural-harmonia-gropius commented 1 year ago

https://archlinux.org/packages/extra/x86_64/libplacebo/

I can't update the package, so close this.