feat: mpv player config

This commit is contained in:
hesam-init 2024-03-17 14:37:22 +03:30
parent 19b5bb9196
commit d9ec9cc071
7 changed files with 852 additions and 1 deletions

View file

@ -0,0 +1 @@
glsl-shaders-append="~/.config/mpv/shader/fsr.glsl"

View file

@ -0,0 +1,17 @@
[extension.gif]
profile-desc=GIF
cache=no
no-pause
loop-file=yes
[extension.png]
profile-desc=PNG
video-aspect-override=no
loop-file=yes
[extension.jpg]
profile-desc=JPG
video-aspect-override=no
loop-file=yes
[extension.jpeg]
profile-desc=JPEG
profile=extension.jpg
loop-file=yes

View file

@ -0,0 +1,21 @@
osd-bar-align-y=-1 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
osd-bar-h=2 # height of osd bar as a fractional percentage of your screen height
osd-bar-w=99 # width of " " "
osd-border-color='#DD322640' # ARGB format
osd-border-size=2 # size for osd text and progress bar
osd-color='#FFFFFFFF' # ARGB format
osd-duration=1000 # hide the osd after x ms
osd-font-size=32
#osd-font='Arial' # sets a custom font (comment out line if font change is undesired)
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}${?frame-drop-count:${!frame-drop-count==0: Dropped: ${frame-drop-count}}}\n${?chapter:Chapter: ${chapter}}'
# UOSC OSD: https://github.com/tomasklaen/uosc
video-sync=display-resample
# uosc provides seeking & volume indicators (via flash-timeline and flash-volume commands)
# if you decide to use them, you don't need osd-bar
#osd-bar=no
# uosc will draw its own window controls and border if you disable window border
#border=no

View file

@ -0,0 +1,274 @@
# MPV v3 Input Configuration - version 1.3
# Date: 2023-11-21 09:20:23PM
# MPV Keys: https://mpv.io/manual/stable/#key-names
# Mouse
MOUSE_BTN0 ignore
MOUSE_BTN0_DBL cycle fullscreen
MOUSE_BTN2 cycle pause
#MOUSE_BTN3 ignore
#MOUSE_BTN4 ignore
#MOUSE_BTN5 ignore
#MOUSE_BTN6 ignore
# Trackpad
AXIS_UP ignore
AXIS_DOWN ignore
AXIS_LEFT ignore
AXIS_RIGHT ignore
# Arrow/navigation keys
RIGHT osd-msg-bar seek +5 relative+keyframes
LEFT osd-msg-bar seek -5 relative+keyframes
SHIFT+RIGHT osd-msg-bar seek +1 relative+exact
SHIFT+LEFT osd-msg-bar seek -1 relative+exact
CTRL+RIGHT frame-step ; show-text "Frame: ${estimated-frame-number} / ${estimated-frame-count}"
CTRL+LEFT frame-back-step ; show-text "Frame: ${estimated-frame-number} / ${estimated-frame-count}"
UP osd-msg-bar seek +30 relative+keyframes
DOWN osd-msg-bar seek -30 relative+keyframes
SHIFT+UP osd-msg-bar seek +120 relative+keyframes
SHIFT+DOWN osd-msg-bar seek -120 relative+keyframes
PGUP osd-msg-bar seek +600 relative+keyframes
PGDWN osd-msg-bar seek -600 relative+keyframes
SHIFT+PGUP osd-msg-bar seek +1200 relative+keyframes
SHIFT+PGDWN osd-msg-bar seek +1200 relative+keyframes
ALT+RIGHT sub-seek +1 ; show-text "Sub Seek +1"
ALT+LEFT sub-seek -1 ; show-text "Sub Seek -1"
#ALT+RIGHT add video-pan-x -0.01
#ALT+LEFT add video-pan-x +0.01
#ALT+UP add video-pan-y +0.01
#ALT+DOWN add video-pan-y -0.01
#META+RIGHT add video-zoom +0.05
#META+LEFT add video-zoom -0.05
#META+UP add video-zoom +0.05
#META+DOWN add video-zoom -0.05
# ` [1] [2] [3] [4] [5] [6] [7] [8] [9] [0] - =
# ~ [!] @ # $ % ^ & * ( ) _ +
1 add contrast -1 ; show-text "Contrast: ${contrast}"
2 add contrast +1 ; show-text "Contrast: ${contrast}"
3 add brightness -1 ; show-text "Brightness: ${brightness}"
4 add brightness +1 ; show-text "Brightness: ${brightness}"
5 add gamma -1 ; show-text "Gamma: ${gamma}"
6 add gamma +1 ; show-text "Gamma: ${gamma}"
7 add saturation -1 ; show-text "Saturation: ${saturation}"
8 add saturation +1 ; show-text "Saturation: ${saturation}"
9 add volume -2 ; show-text "Volume: ${volume}"
0 add volume +2 ; show-text "Volume: ${volume}"
! cycle ontop
` ignore
~ ignore
# ignore
$ ignore
% ignore
^ ignore
& ignore
* ignore
§ ignore
± ignore
# [q] [w] [e] [r] [t] [y] [u] [i] [o] [p] [ ]
# [Q] [W] E R [T] [Y] [U] [I] O [P] { }
Q quit
# q script-binding auto_save_state/quit-watch-later-conditional
w script-message osc-playlist
W playlist-shuffle
e playlist-prev ; show-text "${playlist-pos-1}/${playlist-count}"
E ignore
r playlist-next ; show-text "${playlist-pos-1}/${playlist-count}"
R ignore
t cycle-values sub-use-margins "yes" "no"
T cycle-values ass-force-margins "yes" "no" # does not work with :blend-subtitles
CTRL+t cycle-values blend-subtitles "yes" "video" "no"
y cycle-values stretch-image-subs-to-screen "yes" "no"
Y cycle-values stretch-dvd-subs "yes" "no"
u cycle-values hwdec "auto" "no"
U cycle-values vf "format=colorlevels=full" "format=colorlevels=auto" "format=colorlevels=limited"
i script-binding stats/display-stats
I script-binding stats/display-stats-toggle
o cycle-values osd-level 3 1
O ignore
p cycle-values video-rotate 90 180 270 0
P cycle-values video-aspect "16:9" "4:3" "2.35:1" "16:10"
[ ignore
] ignore
{ ignore
} ignore
# [a] [s] [d] [f] [g] [h] [j] [k] [l]
# [A] [S] [D] [F] [G] [H] [J] [K] [L]
a cycle audio # switch audio streams
A cycle-values af "lavfi=[dynaudnorm=f=200:g=5:r=0.1]" "" # dynamic range compression
CTRL+a script-binding auto_audio_device/toggle-switching # toggle automatic audio device switching
s cycle sub # cycle through subtitles
S cycle sub-visibility
CTRL+s cycle secondary-sid
d cycle-values window-scale "1.5" "2.0" "3.0" "0.5" "1.0" ; show-text "Scale: ${window-scale}"
D cycle edition
CTRL+d cycle video
f cycle fullscreen ; show-text "Scale: ${window-scale}"
F vf clr "" ; show-text "Filters cleared"
g cycle-values video-sync display-resample audio ; cycle-values interpolation yes no ; show-text "Interpolation: ${interpolation} (${tscale})"
G cycle-values tscale "linear" "catmull_rom" "mitchell" "bicubic" "oversample" ; show-text "Interpolation: ${interpolation} (${tscale})"
CTRL+g cycle-values interpolation no yes ; show-text "Interpolation: ${interpolation} (${tscale})"
h cycle deinterlace
H script-binding autodeint
j cycle deband
J vf toggle "lavfi=[hqdn3d=2.0]"
K ignore
l cycle-values loop-file yes no ; show-text "${?=loop-file==inf:Looping enabled (file)}${?=loop-file==no:Looping disabled (file)}"
L cycle-values loop-playlist yes no ; show-text "${?=loop-playlist==inf:Looping enabled}${?=loop-playlist==no:Looping disabled}"
CTRL+l ab-loop
# [z] [x] [c] [v] [b] [n] [m] [,] [.]
# [Z] X C V [B] [N] [M] [<] [>]
x script-message osc-chapterlist
X ignore
c script-message osc-playlist
C ignore
v script-message osc-tracklist
V ignore
b add speed +0.05
B add speed -0.05
CTRL+b set speed 1.0
n add audio-delay +0.10
N add audio-delay -0.10
CTRL+n set audio-delay 0
m add sub-delay +0.10
M add sub-delay -0.10
CTRL+m set sub-delay 0
, add sub-scale -0.05 # decrease subtitle font size
< add sub-scale +0.05 # increase subtitle font size
. add sub-pos -1 # move subtitles up
> add sub-pos +1 # move subtitles down
# Adjust timing so that next/prev subtitle is displayed now
/ sub-step +1 ; show-text "Sub Step +1 (timing adjustment)"
? sub-step -1 ; show-text "Sub Step -1 (timing adjustment)"
# [esc] [space] [backspace]
# [tab] [enter]
ESC cycle fullscreen
SPACE cycle pause
IDEOGRAPHIC_SPACE cycle pause
TAB cycle mute
ENTER show-progress
BS revert-seek
SHIFT+BS set speed 1.0 ; set gamma 0 ; set brightness 0 ; set contrast 0 ; set saturation 0 ; set hue 0 ; show-text "Speed/Gamma/Brightness/Contrast/Saturation/Hue resetted"
ALT+BS set video-pan-x 0 ; set video-pan-y 0 ; show-text "Pan resetted"
META+BS set video-zoom 0 ; show-text "Zoom resetted"
# [F1] F2 F3 F4 F5 F6 F7 [F8] [F9] [F10] [F11] [F12]
F1 script-binding console/enable
F8 vf toggle "interpolation=yes,tscale=oversample" ; show-text "Toggled Realtime Motion Interpolation (native) [interpolation=yes,tscale=oversample]" # Soap-opera effect for frame smoothing
F9 apply-profile "upscale-lowres-using-GPU-shaders" ; show-text "Applied GPU upscaler shaders"
F10 cycle-values speed 0.8 0.6 0.4 0.2 1 # Slow speed
F11 cycle-values speed 1.2 1.4 1.6 1.8 2 1 # Faster speed
F12 af toggle "lavfi=[loudnorm=I=-22:TP=-1.5:LRA=2]" # Useful audio normalization for low-audio or whispering scenes (can cause annoying background noise amplification)
# Numpad
KP0 ignore
KP1 ignore
KP2 ignore
KP3 ignore
KP4 ignore
KP5 ignore
KP6 ignore
KP7 ignore
KP8 ignore
KP9 ignore
KP_DEC ignore
KP_ENTER ignore
# Testing at 2023-11-21 09:19:09PM
# Show Loaded Shaders (for dev testing)
` script-binding sview/shader-view
# Show progress bar on MOUSE BUTTON 2 double-click
# MOUSE_BTN2_DBL show-progress
# Seek using mouse wheel
# Quieter alternative for video playback seeking
# (Mechanical keyboard are common these days so this can mindful of other people
# living in the same house)
SHIFT+WHEEL_UP osd-msg-bar seek +120 relative+keyframes
SHIFT+WHEEL_DOWN osd-msg-bar seek -120 relative+keyframes
ALT+WHEEL_UP osd-msg-bar seek +30 relative+keyframes
ALT+WHEEL_DOWN osd-msg-bar seek -30 relative+keyframes
WHEEL_UP osd-msg-bar seek +1 relative+keyframes
WHEEL_DOWN osd-msg-bar seek -1 relative+keyframes
CTRL+WHEEL_UP frame-step
CTRL+WHEEL_DOWN frame-back-step
# Seek using numbers
CTRL+1 osd-msg-bar seek -1 relative+exact
ALT+1 osd-msg-bar seek +1 relative+exact
CTRL+2 osd-msg-bar seek -2 relative+keyframes
ALT+2 osd-msg-bar seek +2 relative+keyframes
CTRL+3 osd-msg-bar seek -3 relative+keyframes
ALT+3 osd-msg-bar seek +3 relative+keyframes
CTRL+4 osd-msg-bar seek -4 relative+keyframes
ALT+4 osd-msg-bar seek +4 relative+keyframes
CTRL+5 osd-msg-bar seek -5 relative+keyframes
ALT+5 osd-msg-bar seek +5 relative+keyframes
CTRL+6 osd-msg-bar seek -6 relative+keyframes
ALT+6 osd-msg-bar seek +6 relative+keyframes

View file

@ -0,0 +1,85 @@
# MPV v3 Config - version 1.3
# Date: 2023-11-21 09:26:48PM
# REF: https://github.com/Argon-/mpv-config/blob/master/mpv.conf
# REF: https://github.com/Zabooby/mpv-config
# REF: https://gist.github.com/igv
# Specify fast video rendering preset (for --vo=<gpu|gpu-next> only)
# Recommended for mobile devices or older hardware with limited processing power
#profile=fast
# Specify high quality video rendering preset (for --vo=<gpu|gpu-next> only)
# Offers superior image fidelity and visual quality for an enhanced viewing
# experience on capable hardware
#profile=high-quality
hwdec=auto-safe # Sets auto HW profile
# hwdec=no # Sets decoder to use software decoding (CPU)
# ===== Seeking =====
save-position-on-quit=yes # saves the seekbar position on exit
force-seekable=yes # forces videos to be seekable
# ===== RAM =====
cache=yes # uses a large seekable RAM cache even for local input.
# cache-secs=300 # uses extra large RAM cache (needs cache=yes to make it useful).
demuxer-max-back-bytes=20M # sets fast seeking
demuxer-max-bytes=20M # sets fast seeking
# ===== Video =====
vlang=en,eng # Sets the video language
vo=gpu-next # Sets the video out to an experimental video renderer based on libplacebo
# ===== Audio =====
volume-max=100 # maximum volume in %, everything above 100 results in amplification
volume=70 # default volume, 100 = unchanged
# ===== General =====
keep-open=yes # keeps the player open after a video/playlist ends
hls-bitrate=max # uses max quality for HLS streams
prefetch-playlist=yes # prefetches the playlist
# ===== Terminal =====
# include="~~/configs/mpv_terminal.conf"
# ===== OSD =====
include="~/.config/mpv/conf/mpv-osd.conf"
# ===== Subtitles =====
# include="~~/configs/mpv_subtitles.conf"
# ===== Shaders =====
#include="~~/configs/mpv_shaders.conf"
# ===== File Extensions =====
include="~/.config/mpv/conf/mpv-file.conf"
# TESTING - Hardware Decoder Setttings
# default safe list of auto Hardware Decoder profiles
# (actively supported by the development team)
# ===== NVidia GPU =====
# include="~~/configs/mpv_nvidia_gpu.conf"
# ===== AMD or Intel GPU =====
include="~/.config/mpv/conf/mpv-amd.conf"
# ===========================================================================================================

View file

@ -0,0 +1,453 @@
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// FidelityFX FSR v1.0.2 by AMD
// ported to mpv by agyild
// Changelog
// Made it compatible with pre-OpenGL 4.0 renderers
// Made it directly operate on LUMA plane, since the original shader was operating on LUMA by deriving it from RGB. This should cause a major increase in performance, especially on OpenGL 4.0+ renderers (4+2 texture lookups vs. 12+5)
// Removed transparency preservation mechanism since the alpha channel is a separate source plane than LUMA
// Added optional performance-saving lossy optimizations to EASU (Credit: atyuwen, https://atyuwen.github.io/posts/optimizing-fsr/)
//
// Notes
// Per AMD's guidelines only upscales content up to 4x (e.g., 1080p -> 2160p, 720p -> 1440p etc.) and everything else in between,
// that means FSR will scale up to 4x at maximum, and any further scaling will be processed by mpv's scalers
//!HOOK LUMA
//!BIND HOOKED
//!SAVE EASUTEX
//!DESC FidelityFX Super Resolution v1.0.2 (EASU)
//!WHEN OUTPUT.w OUTPUT.h * LUMA.w LUMA.h * / 1.0 >
//!WIDTH OUTPUT.w OUTPUT.w LUMA.w 2 * < * LUMA.w 2 * OUTPUT.w LUMA.w 2 * > * + OUTPUT.w OUTPUT.w LUMA.w 2 * = * +
//!HEIGHT OUTPUT.h OUTPUT.h LUMA.h 2 * < * LUMA.h 2 * OUTPUT.h LUMA.h 2 * > * + OUTPUT.h OUTPUT.h LUMA.h 2 * = * +
//!COMPONENTS 1
// User variables - EASU
#define FSR_PQ 0 // Whether the source content has PQ gamma or not. Needs to be set to the same value for both passes. 0 or 1.
#define FSR_EASU_DERING 1 // If set to 0, disables deringing for a small increase in performance. 0 or 1.
#define FSR_EASU_SIMPLE_ANALYSIS 0 // If set to 1, uses a simpler single-pass direction and length analysis for an increase in performance. 0 or 1.
#define FSR_EASU_QUIT_EARLY 0 // If set to 1, uses bilinear filtering for non-edge pixels and skips EASU on those regions for an increase in performance. 0 or 1.
// Shader code
#ifndef FSR_EASU_DIR_THRESHOLD
#if (FSR_EASU_QUIT_EARLY == 1)
#define FSR_EASU_DIR_THRESHOLD 64.0
#elif (FSR_EASU_QUIT_EARLY == 0)
#define FSR_EASU_DIR_THRESHOLD 32768.0
#endif
#endif
float APrxLoRcpF1(float a) {
return uintBitsToFloat(uint(0x7ef07ebb) - floatBitsToUint(a));
}
float APrxLoRsqF1(float a) {
return uintBitsToFloat(uint(0x5f347d74) - (floatBitsToUint(a) >> uint(1)));
}
float AMin3F1(float x, float y, float z) {
return min(x, min(y, z));
}
float AMax3F1(float x, float y, float z) {
return max(x, max(y, z));
}
#if (FSR_PQ == 1)
float ToGamma2(float a) {
return pow(a, 4.0);
}
#endif
// Filtering for a given tap for the scalar.
void FsrEasuTap(
inout float aC, // Accumulated color, with negative lobe.
inout float aW, // Accumulated weight.
vec2 off, // Pixel offset from resolve position to tap.
vec2 dir, // Gradient direction.
vec2 len, // Length.
float lob, // Negative lobe strength.
float clp, // Clipping point.
float c){ // Tap color.
// Rotate offset by direction.
vec2 v;
v.x = (off.x * ( dir.x)) + (off.y * dir.y);
v.y = (off.x * (-dir.y)) + (off.y * dir.x);
// Anisotropy.
v *= len;
// Compute distance^2.
float d2 = v.x * v.x + v.y * v.y;
// Limit to the window as at corner, 2 taps can easily be outside.
d2 = min(d2, clp);
// Approximation of lancos2 without sin() or rcp(), or sqrt() to get x.
// (25/16 * (2/5 * x^2 - 1)^2 - (25/16 - 1)) * (1/4 * x^2 - 1)^2
// |_______________________________________| |_______________|
// base window
// The general form of the 'base' is,
// (a*(b*x^2-1)^2-(a-1))
// Where 'a=1/(2*b-b^2)' and 'b' moves around the negative lobe.
float wB = float(2.0 / 5.0) * d2 + -1.0;
float wA = lob * d2 + -1.0;
wB *= wB;
wA *= wA;
wB = float(25.0 / 16.0) * wB + float(-(25.0 / 16.0 - 1.0));
float w = wB * wA;
// Do weighted average.
aC += c * w;
aW += w;
}
// Accumulate direction and length.
void FsrEasuSet(
inout vec2 dir,
inout float len,
vec2 pp,
#if (FSR_EASU_SIMPLE_ANALYSIS == 1)
float b, float c,
float i, float j, float f, float e,
float k, float l, float h, float g,
float o, float n
#elif (FSR_EASU_SIMPLE_ANALYSIS == 0)
bool biS, bool biT, bool biU, bool biV,
float lA, float lB, float lC, float lD, float lE
#endif
){
// Compute bilinear weight, branches factor out as predicates are compiler time immediates.
// s t
// u v
#if (FSR_EASU_SIMPLE_ANALYSIS == 1)
vec4 w = vec4(0.0);
w.x = (1.0 - pp.x) * (1.0 - pp.y);
w.y = pp.x * (1.0 - pp.y);
w.z = (1.0 - pp.x) * pp.y;
w.w = pp.x * pp.y;
float lA = dot(w, vec4(b, c, f, g));
float lB = dot(w, vec4(e, f, i, j));
float lC = dot(w, vec4(f, g, j, k));
float lD = dot(w, vec4(g, h, k, l));
float lE = dot(w, vec4(j, k, n, o));
#elif (FSR_EASU_SIMPLE_ANALYSIS == 0)
float w = 0.0;
if (biS)
w = (1.0 - pp.x) * (1.0 - pp.y);
if (biT)
w = pp.x * (1.0 - pp.y);
if (biU)
w = (1.0 - pp.x) * pp.y;
if (biV)
w = pp.x * pp.y;
#endif
// Direction is the '+' diff.
// a
// b c d
// e
// Then takes magnitude from abs average of both sides of 'c'.
// Length converts gradient reversal to 0, smoothly to non-reversal at 1, shaped, then adding horz and vert terms.
float dc = lD - lC;
float cb = lC - lB;
float lenX = max(abs(dc), abs(cb));
lenX = APrxLoRcpF1(lenX);
float dirX = lD - lB;
lenX = clamp(abs(dirX) * lenX, 0.0, 1.0);
lenX *= lenX;
// Repeat for the y axis.
float ec = lE - lC;
float ca = lC - lA;
float lenY = max(abs(ec), abs(ca));
lenY = APrxLoRcpF1(lenY);
float dirY = lE - lA;
lenY = clamp(abs(dirY) * lenY, 0.0, 1.0);
lenY *= lenY;
#if (FSR_EASU_SIMPLE_ANALYSIS == 1)
len = lenX + lenY;
dir = vec2(dirX, dirY);
#elif (FSR_EASU_SIMPLE_ANALYSIS == 0)
dir += vec2(dirX, dirY) * w;
len += dot(vec2(w), vec2(lenX, lenY));
#endif
}
vec4 hook() {
// Result
vec4 pix = vec4(0.0, 0.0, 0.0, 1.0);
//------------------------------------------------------------------------------------------------------------------------------
// +---+---+
// | | |
// +--(0)--+
// | b | c |
// +---F---+---+---+
// | e | f | g | h |
// +--(1)--+--(2)--+
// | i | j | k | l |
// +---+---+---+---+
// | n | o |
// +--(3)--+
// | | |
// +---+---+
// Get position of 'F'.
vec2 pp = HOOKED_pos * HOOKED_size - vec2(0.5);
vec2 fp = floor(pp);
pp -= fp;
//------------------------------------------------------------------------------------------------------------------------------
// 12-tap kernel.
// b c
// e f g h
// i j k l
// n o
// Gather 4 ordering.
// a b
// r g
// Allowing dead-code removal to remove the 'z's.
#if (defined(HOOKED_gather) && (__VERSION__ >= 400 || (GL_ES && __VERSION__ >= 310)))
vec4 bczzL = HOOKED_gather(vec2((fp + vec2(1.0, -1.0)) * HOOKED_pt), 0);
vec4 ijfeL = HOOKED_gather(vec2((fp + vec2(0.0, 1.0)) * HOOKED_pt), 0);
vec4 klhgL = HOOKED_gather(vec2((fp + vec2(2.0, 1.0)) * HOOKED_pt), 0);
vec4 zzonL = HOOKED_gather(vec2((fp + vec2(1.0, 3.0)) * HOOKED_pt), 0);
#else
// pre-OpenGL 4.0 compatibility
float b = HOOKED_tex(vec2((fp + vec2(0.5, -0.5)) * HOOKED_pt)).r;
float c = HOOKED_tex(vec2((fp + vec2(1.5, -0.5)) * HOOKED_pt)).r;
float e = HOOKED_tex(vec2((fp + vec2(-0.5, 0.5)) * HOOKED_pt)).r;
float f = HOOKED_tex(vec2((fp + vec2( 0.5, 0.5)) * HOOKED_pt)).r;
float g = HOOKED_tex(vec2((fp + vec2( 1.5, 0.5)) * HOOKED_pt)).r;
float h = HOOKED_tex(vec2((fp + vec2( 2.5, 0.5)) * HOOKED_pt)).r;
float i = HOOKED_tex(vec2((fp + vec2(-0.5, 1.5)) * HOOKED_pt)).r;
float j = HOOKED_tex(vec2((fp + vec2( 0.5, 1.5)) * HOOKED_pt)).r;
float k = HOOKED_tex(vec2((fp + vec2( 1.5, 1.5)) * HOOKED_pt)).r;
float l = HOOKED_tex(vec2((fp + vec2( 2.5, 1.5)) * HOOKED_pt)).r;
float n = HOOKED_tex(vec2((fp + vec2(0.5, 2.5) ) * HOOKED_pt)).r;
float o = HOOKED_tex(vec2((fp + vec2(1.5, 2.5) ) * HOOKED_pt)).r;
vec4 bczzL = vec4(b, c, 0.0, 0.0);
vec4 ijfeL = vec4(i, j, f, e);
vec4 klhgL = vec4(k, l, h, g);
vec4 zzonL = vec4(0.0, 0.0, o, n);
#endif
//------------------------------------------------------------------------------------------------------------------------------
// Rename.
float bL = bczzL.x;
float cL = bczzL.y;
float iL = ijfeL.x;
float jL = ijfeL.y;
float fL = ijfeL.z;
float eL = ijfeL.w;
float kL = klhgL.x;
float lL = klhgL.y;
float hL = klhgL.z;
float gL = klhgL.w;
float oL = zzonL.z;
float nL = zzonL.w;
#if (FSR_PQ == 1)
// Not the most performance-friendly solution, but should work until mpv adds proper gamma transformation functions for shaders
bL = ToGamma2(bL);
cL = ToGamma2(cL);
iL = ToGamma2(iL);
jL = ToGamma2(jL);
fL = ToGamma2(fL);
eL = ToGamma2(eL);
kL = ToGamma2(kL);
lL = ToGamma2(lL);
hL = ToGamma2(hL);
gL = ToGamma2(gL);
oL = ToGamma2(oL);
nL = ToGamma2(nL);
#endif
// Accumulate for bilinear interpolation.
vec2 dir = vec2(0.0);
float len = 0.0;
#if (FSR_EASU_SIMPLE_ANALYSIS == 1)
FsrEasuSet(dir, len, pp, bL, cL, iL, jL, fL, eL, kL, lL, hL, gL, oL, nL);
#elif (FSR_EASU_SIMPLE_ANALYSIS == 0)
FsrEasuSet(dir, len, pp, true, false, false, false, bL, eL, fL, gL, jL);
FsrEasuSet(dir, len, pp, false, true, false, false, cL, fL, gL, hL, kL);
FsrEasuSet(dir, len, pp, false, false, true, false, fL, iL, jL, kL, nL);
FsrEasuSet(dir, len, pp, false, false, false, true, gL, jL, kL, lL, oL);
#endif
//------------------------------------------------------------------------------------------------------------------------------
// Normalize with approximation, and cleanup close to zero.
vec2 dir2 = dir * dir;
float dirR = dir2.x + dir2.y;
bool zro = dirR < float(1.0 / FSR_EASU_DIR_THRESHOLD);
dirR = APrxLoRsqF1(dirR);
#if (FSR_EASU_QUIT_EARLY == 1)
if (zro) {
vec4 w = vec4(0.0);
w.x = (1.0 - pp.x) * (1.0 - pp.y);
w.y = pp.x * (1.0 - pp.y);
w.z = (1.0 - pp.x) * pp.y;
w.w = pp.x * pp.y;
pix.r = clamp(dot(w, vec4(fL, gL, jL, kL)), 0.0, 1.0);
return pix;
}
#elif (FSR_EASU_QUIT_EARLY == 0)
dirR = zro ? 1.0 : dirR;
dir.x = zro ? 1.0 : dir.x;
#endif
dir *= vec2(dirR);
// Transform from {0 to 2} to {0 to 1} range, and shape with square.
len = len * 0.5;
len *= len;
// Stretch kernel {1.0 vert|horz, to sqrt(2.0) on diagonal}.
float stretch = (dir.x * dir.x + dir.y * dir.y) * APrxLoRcpF1(max(abs(dir.x), abs(dir.y)));
// Anisotropic length after rotation,
// x := 1.0 lerp to 'stretch' on edges
// y := 1.0 lerp to 2x on edges
vec2 len2 = vec2(1.0 + (stretch - 1.0) * len, 1.0 + -0.5 * len);
// Based on the amount of 'edge',
// the window shifts from +/-{sqrt(2.0) to slightly beyond 2.0}.
float lob = 0.5 + float((1.0 / 4.0 - 0.04) - 0.5) * len;
// Set distance^2 clipping point to the end of the adjustable window.
float clp = APrxLoRcpF1(lob);
//------------------------------------------------------------------------------------------------------------------------------
// Accumulation
// b c
// e f g h
// i j k l
// n o
float aC = 0.0;
float aW = 0.0;
FsrEasuTap(aC, aW, vec2( 0.0,-1.0) - pp, dir, len2, lob, clp, bL); // b
FsrEasuTap(aC, aW, vec2( 1.0,-1.0) - pp, dir, len2, lob, clp, cL); // c
FsrEasuTap(aC, aW, vec2(-1.0, 1.0) - pp, dir, len2, lob, clp, iL); // i
FsrEasuTap(aC, aW, vec2( 0.0, 1.0) - pp, dir, len2, lob, clp, jL); // j
FsrEasuTap(aC, aW, vec2( 0.0, 0.0) - pp, dir, len2, lob, clp, fL); // f
FsrEasuTap(aC, aW, vec2(-1.0, 0.0) - pp, dir, len2, lob, clp, eL); // e
FsrEasuTap(aC, aW, vec2( 1.0, 1.0) - pp, dir, len2, lob, clp, kL); // k
FsrEasuTap(aC, aW, vec2( 2.0, 1.0) - pp, dir, len2, lob, clp, lL); // l
FsrEasuTap(aC, aW, vec2( 2.0, 0.0) - pp, dir, len2, lob, clp, hL); // h
FsrEasuTap(aC, aW, vec2( 1.0, 0.0) - pp, dir, len2, lob, clp, gL); // g
FsrEasuTap(aC, aW, vec2( 1.0, 2.0) - pp, dir, len2, lob, clp, oL); // o
FsrEasuTap(aC, aW, vec2( 0.0, 2.0) - pp, dir, len2, lob, clp, nL); // n
//------------------------------------------------------------------------------------------------------------------------------
// Normalize and dering.
pix.r = aC / aW;
#if (FSR_EASU_DERING == 1)
float min1 = min(AMin3F1(fL, gL, jL), kL);
float max1 = max(AMax3F1(fL, gL, jL), kL);
pix.r = clamp(pix.r, min1, max1);
#endif
pix.r = clamp(pix.r, 0.0, 1.0);
return pix;
}
//!HOOK LUMA
//!BIND EASUTEX
//!DESC FidelityFX Super Resolution v1.0.2 (RCAS)
//!WIDTH EASUTEX.w
//!HEIGHT EASUTEX.h
//!COMPONENTS 1
// User variables - RCAS
#define SHARPNESS 0.2 // Controls the amount of sharpening. The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}. 0.0 to 2.0.
#define FSR_RCAS_DENOISE 1 // If set to 1, lessens the sharpening on noisy areas. Can be disabled for better performance. 0 or 1.
#define FSR_PQ 0 // Whether the source content has PQ gamma or not. Needs to be set to the same value for both passes. 0 or 1.
// Shader code
#define FSR_RCAS_LIMIT (0.25 - (1.0 / 16.0)) // This is set at the limit of providing unnatural results for sharpening.
float APrxMedRcpF1(float a) {
float b = uintBitsToFloat(uint(0x7ef19fff) - floatBitsToUint(a));
return b * (-b * a + 2.0);
}
float AMax3F1(float x, float y, float z) {
return max(x, max(y, z));
}
float AMin3F1(float x, float y, float z) {
return min(x, min(y, z));
}
#if (FSR_PQ == 1)
float FromGamma2(float a) {
return sqrt(sqrt(a));
}
#endif
vec4 hook() {
// Algorithm uses minimal 3x3 pixel neighborhood.
// b
// d e f
// h
#if (defined(EASUTEX_gather) && (__VERSION__ >= 400 || (GL_ES && __VERSION__ >= 310)))
vec3 bde = EASUTEX_gather(EASUTEX_pos + EASUTEX_pt * vec2(-0.5), 0).xyz;
float b = bde.z;
float d = bde.x;
float e = bde.y;
vec2 fh = EASUTEX_gather(EASUTEX_pos + EASUTEX_pt * vec2(0.5), 0).zx;
float f = fh.x;
float h = fh.y;
#else
float b = EASUTEX_texOff(vec2( 0.0, -1.0)).r;
float d = EASUTEX_texOff(vec2(-1.0, 0.0)).r;
float e = EASUTEX_tex(EASUTEX_pos).r;
float f = EASUTEX_texOff(vec2(1.0, 0.0)).r;
float h = EASUTEX_texOff(vec2(0.0, 1.0)).r;
#endif
// Min and max of ring.
float mn1L = min(AMin3F1(b, d, f), h);
float mx1L = max(AMax3F1(b, d, f), h);
// Immediate constants for peak range.
vec2 peakC = vec2(1.0, -1.0 * 4.0);
// Limiters, these need to be high precision RCPs.
float hitMinL = min(mn1L, e) / (4.0 * mx1L);
float hitMaxL = (peakC.x - max(mx1L, e)) / (4.0 * mn1L + peakC.y);
float lobeL = max(-hitMinL, hitMaxL);
float lobe = max(float(-FSR_RCAS_LIMIT), min(lobeL, 0.0)) * exp2(-clamp(float(SHARPNESS), 0.0, 2.0));
// Apply noise removal.
#if (FSR_RCAS_DENOISE == 1)
// Noise detection.
float nz = 0.25 * b + 0.25 * d + 0.25 * f + 0.25 * h - e;
nz = clamp(abs(nz) * APrxMedRcpF1(AMax3F1(AMax3F1(b, d, e), f, h) - AMin3F1(AMin3F1(b, d, e), f, h)), 0.0, 1.0);
nz = -0.5 * nz + 1.0;
lobe *= nz;
#endif
// Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.
float rcpL = APrxMedRcpF1(4.0 * lobe + 1.0);
vec4 pix = vec4(0.0, 0.0, 0.0, 1.0);
pix.r = float((lobe * b + lobe * d + lobe * h + lobe * f + e) * rcpL);
#if (FSR_PQ == 1)
pix.r = FromGamma2(pix.r);
#endif
return pix;
}

View file

@ -7,7 +7,7 @@ DISABLE_GRUB_MENU=false
declare -A PACKAGES=(
["BASE_PACKAGES"]="cronie git stow eza dbus seatd elogind polkit NetworkManager gnome-keyring polkit-gnome mesa-dri pipewire wireplumber inotify-tools void-repo-multilib void-repo-nonfree wpa_supplicant wifish wpa-cute wpa_gui xorg gnome-keyring polkit-gnome mtpfs inotify-tools ffmpeg libnotify"
["DEVEL_PACKAGES"]="base-devel startup-notification-devel cairo-devel xcb-util-devel xcb-util-cursor-devel xcb-util-xrm-devel xcb-util-wm-devel"
["AMD_DRIVERS"]="opencv Vulkan-Headers Vulkan-Tools Vulkan-ValidationLayers-32bit mesa-vulkan-radeon mesa-vulkan-radeon-32bit vulkan-loader vulkan-loader-32bit libspa-vulkan libspa-vulkan-32bit amdvlk mesa-dri"
["AMD_DRIVERS"]="opencv Vulkan-Headers Vulkan-Tools Vulkan-ValidationLayers-32bit mesa-vulkan-radeon mesa-vulkan-radeon-32bit vulkan-loader vulkan-loader-32bit libspa-vulkan libspa-vulkan-32bit amdvlk mesa-dri mesa-vaapi"
["HYPRLAND_PACKAGES"]="Waybar avizo dunst swaybg mpvpaper grim jq slurp cliphist wl-clipboard swayidle pavucontrol nemo eog pavucontrol evince xorg-server-xwayland xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-utils"
["SYSTEM_APPS"]="alacritty zellij bat dust aria2 fzf neofetch bat octoxbps"
)