This repo contains user shaders for prescaling in mpv.
For the scripts generating these user shaders, check the source branch. For comparison/performance of prescalers, check the Comparison and Performance wiki.
Shaders in gather/
directory
and compute/
directory
are generally faster but requires recent version of OpenGL.
Use these shaders only if they actually work (i.e. no blue screen and no noticeable distortion).
Shaders in vulkan/
directory
are using rgba16hf
LUT, and required by gpu-api=vulkan
and
gpu-api=d3d11
. Use these shaders if you encountered the following error:
[vo/gpu] Unrecognized/unavailable FORMAT name: 'rgba16f'!
You only need to download shaders you actually use. The following part of this
section assumes that they are in shaders
directory in the mpv
configure
folder (usually ~/.config/mpv/shaders
on Linux).
Use glsl-shaders="prescaler.hook"
option to load those shaders. (This will
override other user shaders, use glsl-shaders-append
in that case)
glsl-shaders="~~/shaders/ravu-r3.hook"
All shaders are for one pass only. If you want to have 4x
upscaling, trigger
the same shader twice. All the shaders here are generated with
max-downscaling-ratio
set to 1.414213
. They will be disabled if upscaling is not necessary.
glsl-shaders-append="~~/shaders/ravu-r3.hook"
glsl-shaders-append="~~/shaders/ravu-r3.hook"
Suffix in the filename indicates the planes that the prescaler will upscale.
- Without any suffix: Works on
YUV
video, upscale only luma plane. (like the oldprescale-luma=...
option inmpv
). -chroma*
: Works onYUV
video, upscale only chroma plane.-yuv
: Works onYUV
video, upscale all planes after they are merged.-rgb
: Works on all video, upscale all planes after they are merged and converted toRGB
.
For nnedi3
prescaler, neurons
and window
settings are indicated in the
filename.
For ravu
prescaler, radius
setting is indicated in the filename.
ravu-*-chroma-{center,left}
are implementations of ravu
, that
will use downscaled luma plane to calculate gradient and guide chroma planes
upscaling. Due to current limitation of mpv
's hook system, there are some
caveats for using those shaders:
- It works with
YUV 4:2:0
format only, and will disable itself if size is not matched exactly, this includes odd width/height of luma plane. - It will NOT work with luma prescalers (for example
ravu-r3.hook
). You should usergb
andyuv
shaders for further upscaling. - You need to explicitly state the chroma location, by choosing one of those
chroma-left
andchroma-center
shaders. If you don't know how to/don't bother to check chroma location of video, or don't watch ancient videos, just choosechroma-left
. If you are using auto-profiles.lua, you can usecond:get('video-params/chroma-location','unknown')=='mpeg2/4/h264'
forchroma-left
shader andcond:get('video-params/chroma-location','unknown')=='mpeg1/jpeg'
forchroma-center
shader. cscale
will still be used to correct minor offset. An EWA scaler likehaasnsoft
is recommended for thecscale
setting.
ravu-lite
is incompatible with--fbo-format=rgb10_a2
(default for some OpenGL ES implementation). Usergba16f
orrgba16
if available.ravu-r4-{rgb,yuv}
causes distortion with lower-end intel card.
Shaders in this repo are licensed under terms of LGPLv3. Check the header of each file for details.