repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix: enforce LF for text files

9ce2a9360bea7a05c5574ee67a7fd70ff56c0c4c

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (47)

.gitattributes

Modified
1 +* text=auto eol=lf
1 3 # BEGIN bootstripper secrets
2 4 MusicBrainz/Picard.ini -text filter=dotfiles-aes -diff merge=dotfiles-aes
3 5 zed/settings.json -text filter=dotfiles-aes -diff merge=dotfiles-aes

aerc/aerc.conf

Modified
1 -#
2 -# aerc main configuration
4 -[general]
5 -#
6 -# Used as a default path for save operations if no other path is specified.
7 -# ~ is expanded to the current user home dir.
8 -#
9 -default-save-path=~/Downloads
11 -# If set to "gpg", aerc will use system gpg binary and keystore for all crypto
12 -# operations. If set to "internal", the internal openpgp keyring will be used.
13 -# If set to "auto", the system gpg will be preferred unless the internal
14 -# keyring already exists, in which case the latter will be used.
16 -# Default: auto
17 -#pgp-provider=auto
19 -# By default, the file permissions of accounts.conf must be restrictive and
20 -# only allow reading by the file owner (0600). Set this option to true to
21 -# ignore this permission check. Use this with care as it may expose your
22 -# credentials.
24 -# Default: false
25 -#unsafe-accounts-conf=false
27 -# Output log messages to specified file. A path starting with ~/ is expanded to
28 -# the user home dir. When redirecting aerc's output to a file using > shell
29 -# redirection, this setting is ignored and log messages are printed to stdout.
31 -#log-file=
33 -# Only log messages above the specified level to log-file. Supported levels
34 -# are: trace, debug, info, warn and error. When redirecting aerc's output to
35 -# a file using > shell redirection, this setting is ignored and the log level
36 -# is forced to trace.
38 -# Default: info
39 -#log-level=info
41 -# Set the $TERM environment variable used for the embedded terminal.
43 -# Default: xterm-256color
44 -#term=xterm-256color
46 -# Display OSC8 strings in the embedded terminal
48 -# Default: false
49 -enable-osc8=true
51 -# Default shell command to use for :menu. This will be executed with sh -c and
52 -# will run in an popover dialog.
54 -# Any occurrence of %f will be replaced by a temporary file path where the
55 -# command is expected to write output lines to be consumed by :menu. Otherwise,
56 -# the lines will be read from the command's standard output.
58 -# Examples:
59 -# default-menu-cmd=fzf
60 -# default-menu-cmd=fzf --multi
61 -# default-menu-cmd=dmenu -l 20
62 -# default-menu-cmd=ranger --choosefiles=%f
64 -default-menu-cmd=yazi --chooser-file %f
66 -[ui]
68 -# Describes the format for each row in a mailbox view. This is a comma
69 -# separated list of column names with an optional align and width suffix. After
70 -# the column name, one of the '<' (left), ':' (center) or '>' (right) alignment
71 -# characters can be added (by default, left) followed by an optional width
72 -# specifier. The width is either an integer representing a fixed number of
73 -# characters, or a percentage between 1% and 99% representing a fraction of the
74 -# terminal width. It can also be one of the '*' (auto) or '=' (fit) special
75 -# width specifiers. Auto width columns will be equally attributed the remaining
76 -# terminal width. Fit width columns take the width of their contents. If no
77 -# width specifier is set, '*' is used by default.
79 -# Default: date<20,name<17,flags>4,subject<*
80 -index-columns=date<6,flags>4,name<24,subject<*
83 -# Each name in index-columns must have a corresponding column-$name setting.
84 -# All column-$name settings accept golang text/template syntax. See
85 -# aerc-templates(7) for available template attributes and functions.
87 -# Here are some examples to show the To field instead of the From field for
88 -# an email (modifying column-name):
90 -# 1. a generic one
91 -# column-name={{ .Peer | names | join ", " }}
92 -# 2. based upon the selected folder
93 -# column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}}
95 -# Default settings
96 -#column-date={{.DateAutoFormat .Date.Local}}
97 -#column-name={{index (.From | names) 0}}
98 -#column-flags={{.Flags | join ""}}
99 -#column-subject={{.ThreadPrefix}}{{if .ThreadFolded}}{{printf "{%d}" .ThreadCount}}{{end}}{{.Subject}}
102 -# String separator inserted between columns. When the column width specifier is
103 -# an exact number of characters, the separator is added to it (i.e. the exact
104 -# width will be fully available for the column contents).
106 -# Default: " "
107 -#column-separator=" "
110 -# See time.Time#Format at https://godoc.org/time#Time.Format
112 -# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
113 -#timestamp-format=2006-01-02 03:04 PM
114 -timestamp-format=02.01.2006 03:04h
115 -# FIXME it would be nice to have different formats for the viewer
118 -# Index-only time format for messages that were received/sent today.
119 -# If this is not specified, timestamp-format is used instead.
121 -this-day-time-format=03:04h
124 -# Index-only time format for messages that were received/sent within the last
125 -# 7 days. If this is not specified, timestamp-format is used instead.
127 -this-week-time-format=02.01
130 -# Index-only time format for messages that were received/sent this year.
131 -# If this is not specified, timestamp-format is used instead.
133 -this-year-time-format=01.2006
136 -# Width of the sidebar, including the border.
138 -# Default: 20
139 -sidebar-width=24
142 -# Message to display when viewing an empty folder.
144 -# Default: (no messages)
145 -#empty-message=(no messages)
147 -# Message to display when no folders exists or are all filtered
149 -# Default: (no folders)
150 -#empty-dirlist=(no folders)
152 -# Value to set {{.Subject}} template to when subject is empty.
154 -# Default: (no subject)
155 -#empty-subject=(no subject)
157 -# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
159 -# Default: false
160 -mouse-enabled=true
163 -# Ring the bell when new messages are received
165 -# Default: true
166 -#new-message-bell=true
169 -# Template to use for Account tab titles
171 -# Default: {{.Account}}
172 -#tab-title-account={{.Account}}
174 -# Marker to show before a pinned tab's name.
176 -# Default: `
177 -#pinned-tab-marker='`'
179 -# Template for the left side of the directory list.
180 -# See aerc-templates(7) for all available fields and functions.
182 -# Default: {{.Folder}}
183 -dirlist-left={{.Folder}}{{if .Recent}} 󰺻{{end}}
185 -# Template for the right side of the directory list.
186 -# See aerc-templates(7) for all available fields and functions.
188 -# Default: {{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}}
189 -#dirlist-right={{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}}
191 -# Delay after which the messages are actually listed when entering a directory.
192 -# This avoids loading messages when skipping over folders and makes the UI more
193 -# responsive. If you do not want that, set it to 0s.
195 -# Default: 200ms
196 -dirlist-delay=100ms
198 -# Display the directory list as a foldable tree that allows to collapse and
199 -# expand the folders.
201 -# Default: false
202 -dirlist-tree=true
204 -# If dirlist-tree is enabled, set level at which folders are collapsed by
205 -# default. Set to 0 to disable.
207 -# Default: 0
208 -dirlist-collapse=3
210 -# List of space-separated criteria to sort the messages by, see *sort*
211 -# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
212 -# reverses that criterion.
214 -# Example: "from -r date"
216 -sort=-r date from
218 -# Moves to next message when the current message is deleted
220 -# Default: true
221 -#next-message-on-delete=true
223 -# Automatically set the "seen" flag when a message is opened in the message
224 -# viewer.
226 -# Default: true
227 -#auto-mark-read=true
229 -# The directories where the stylesets are stored. It takes a colon-separated
230 -# list of directories. If this is unset or if a styleset cannot be found, the
231 -# following paths will be used as a fallback in that order:
233 -# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
234 -# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
235 -# /usr/local/share/aerc/stylesets
236 -# /usr/share/aerc/stylesets
238 -#stylesets-dirs=
240 -# Uncomment to use box-drawing characters for vertical and horizontal borders.
242 -# Default: " "
243 -border-char-vertical="│"
244 -border-char-horizontal="─"
246 -# Sets the styleset to use for the aerc ui elements.
248 -# Default: default
249 -styleset-name=nugu-dark
251 -# Activates fuzzy search in commands and their arguments: the typed string is
252 -# searched in the command or option in any position, and need not be
253 -# consecutive characters in the command or option.
255 -# Default: false
256 -fuzzy-complete=true
258 -# How long to wait after the last input before auto-completion is triggered.
260 -# Default: 250ms
261 -#completion-delay=250ms
263 -# The minimum required characters to allow auto-completion to be triggered after
264 -# completion-delay.
266 -# Setting this to "manual" disables automatic completion, leaving only the
267 -# manually triggered completion with the $complete key (see aerc-binds(5) for
268 -# more details).
270 -# Default: 1
271 -#completion-min-chars=1
274 -# Global switch for completion popovers
276 -# Default: true
277 -#completion-popovers=true
279 -# Uncomment to use UTF-8 symbols to indicate PGP status of messages
281 -# Default: ASCII
282 -icon-unencrypted=󰇷
283 -icon-encrypted=✔
284 -icon-signed=✔
285 -icon-signed-encrypted=✔
286 -icon-unknown=✘
287 -icon-invalid=⚠
289 -# Reverses the order of the message list. By default, the message list is
290 -# ordered with the newest (highest UID) message on top. Reversing the order
291 -# will put the oldest (lowest UID) message on top. This can be useful in cases
292 -# where the backend does not support sorting.
294 -# Default: false
295 -#reverse-msglist-order = false
297 -# Reverse display of the mesage threads. Default order is the the intial
298 -# message is on the top with all the replies being displayed below. The
299 -# reverse option will put the initial message at the bottom with the
300 -# replies on top.
302 -# Default: false
303 -#reverse-thread-order=false
305 -# Sort the thread siblings according to the sort criteria for the messages. If
306 -# sort-thread-siblings is false, the thread siblings will be sorted based on
307 -# the message UID in ascending order. This option is only applicable for
308 -# client-side threading with a backend that enables sorting. Note that there's
309 -# a performance impact when sorting is activated.
311 -# Default: false
312 -#sort-thread-siblings=false
314 -[ui:account=oliver]
316 -# Enable a threaded view of messages. If this is not supported by the backend
317 -# (IMAP server or notmuch), threads will be built by the client.
319 -# Default: false
320 -threading-enabled=true
322 -# Force client-side thread building
324 -# Default: false
325 -#force-client-threads=false
327 -# Show thread context enables messages which do not match the current query (or
328 -# belong to the current mailbox) to be shown for context. These messages can be
329 -# styled separately using "msglist_thread_context" in a styleset. This feature
330 -# is not supported by all backends
332 -# Default: false
333 -#show-thread-context=false
335 -# Debounce client-side thread building
337 -# Default: 50ms
338 -#client-threads-delay=50ms
341 -# Thread prefix customization:
344 -# Customize the thread prefix appearance by selecting the arrow head.
346 -# Default: ">"
347 -#thread-prefix-tip = ">"
350 -# Customize the thread prefix appearance by selecting the arrow indentation.
352 -# Default: " "
353 -#thread-prefix-indent = " "
356 -# Customize the thread prefix appearance by selecting the vertical extension of
357 -# the arrow.
359 -# Default: "│"
360 -#thread-prefix-stem = "│"
363 -# Customize the thread prefix appearance by selecting the horizontal extension
364 -# of the arrow.
366 -# Default: ""
367 -#thread-prefix-limb = ""
370 -# Customize the thread prefix appearance by selecting the folded thread
371 -# indicator.
373 -# Default: ""
374 -#thread-prefix-folded = ""
377 -# Customize the thread prefix appearance by selecting the unfolded thread
378 -# indicator.
380 -# Default: ""
381 -#thread-prefix-unfolded = ""
384 -# Customize the thread prefix appearance by selecting the first child connector.
386 -# Default: ""
387 -#thread-prefix-first-child = ""
390 -# Customize the thread prefix appearance by selecting the connector used if
391 -# the message has siblings.
393 -# Default: "├─"
394 -#thread-prefix-has-siblings = "├─"
397 -# Customize the thread prefix appearance by selecting the connector used if the
398 -# message has no parents and no children.
400 -# Default: ""
401 -#thread-prefix-lone = ""
404 -# Customize the thread prefix appearance by selecting the connector used if the
405 -# message has no parents and has children.
407 -# Default: ""
408 -#thread-prefix-orphan = ""
411 -# Customize the thread prefix appearance by selecting the connector for the last
412 -# sibling.
414 -# Default: "└─"
415 -#thread-prefix-last-sibling = "└─"
418 -# Customize the reversed thread prefix appearance by selecting the connector for
419 -# the last sibling.
421 -# Default: "┌─"
422 -#thread-prefix-last-sibling-reverse = "┌─"
425 -# Customize the reversed thread prefix appearance by selecting the first child
426 -# connector.
428 -# Default: ""
429 -#thread-prefix-first-child-reverse = ""
432 -# Customize the reversed thread prefix appearance by selecting the connector
433 -# used if the message has no parents and has children.
435 -# Default: ""
436 -#thread-prefix-orphan-reverse = ""
438 -[statusline]
440 -# Describes the format for the status line. This is a comma separated list of
441 -# column names with an optional align and width suffix. See [ui].index-columns
442 -# for more details. To completely mute the status line except for push
443 -# notifications, explicitly set status-columns to an empty string.
445 -# Default: left<*,center:=,right>*
446 -#status-columns=left<*,center:=,right>*
449 -# Each name in status-columns must have a corresponding column-$name setting.
450 -# All column-$name settings accept golang text/template syntax. See
451 -# aerc-templates(7) for available template attributes and functions.
453 -# Default settings
454 -#column-left=[{{.Account}}] {{.StatusInfo}}
455 -#column-center={{.PendingKeys}}
456 -#column-right={{.TrayInfo}}
459 -# String separator inserted between columns.
460 -# See [ui].column-separator for more details.
462 -#column-separator=" "
464 -# Specifies the separator between grouped statusline elements.
466 -# Default: " | "
467 -#separator=" | "
469 -# Defines the mode for displaying the status elements.
470 -# Options: text, icon
472 -# Default: text
473 -#display-mode=text
475 -[viewer]
477 -# Specifies the pager to use when displaying emails. Note that some filters
478 -# may add ANSI codes to add color to rendered emails, so you may want to use a
479 -# pager which supports ANSI codes.
481 -# Default: less -Rc
482 -#pager=less -Rc
485 -# If an email offers several versions (multipart), you can configure which
486 -# mimetype to prefer. For example, this can be used to prefer plaintext over
487 -# html emails.
489 -# Default: text/plain,text/html
490 -#alternatives=text/plain,text/html
493 -# Default setting to determine whether to show full headers or only parsed
494 -# ones in message viewer.
496 -# Default: false
497 -#show-headers=false
500 -# Layout of headers when viewing a message. To display multiple headers in the
501 -# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
502 -# none of their specified headers are present in the message.
504 -# Default: From|To,Cc|Bcc,Date,Subject
505 -#header-layout=From|To,Cc|Bcc,Date,Subject
507 -# Whether to always show the mimetype of an email, even when it is just a single part
509 -# Default: false
510 -#always-show-mime=false
512 -# Define the maximum height of the mimetype switcher before a scrollbar is used.
513 -# The height of the mimetype switcher is restricted to half of the display
514 -# height. If the provided value for the height is zero, the number of parts will
515 -# be used as the height of the type switcher.
517 -# Default: 0
518 -#max-mime-height = 0
520 -# Parses and extracts http links when viewing a message. Links can then be
521 -# accessed with the open-link command.
523 -# Default: true
524 -#parse-http-links=true
526 -[compose]
528 -# Specifies the command to run the editor with. It will be shown in an embedded
529 -# terminal, though it may also launch a graphical window if the environment
530 -# supports it. Defaults to $EDITOR, or vi.
531 -editor=nvim
534 -# When set, aerc will create and read .eml files for composing that have
535 -# non-standard \n linebreaks. This is only relevant if the used editor does not
536 -# support CRLF linebreaks.
538 -#lf-editor=false
541 -# Default header fields to display when composing a message. To display
542 -# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
544 -# Default: To|From,Subject
545 -#header-layout=To|From,Subject
548 -# Edit headers into the text editor instead than separate fields.
550 -# When this is true, address-book-cmd is not supported and address completion
551 -# is left to the editor itself. Also, displaying multiple headers on the same
552 -# line is not possible.
554 -# Default: false
555 -#edit-headers=false
558 -# Specifies the command to be used to tab-complete email addresses. Any
559 -# occurrence of "%s" in the address-book-cmd will be replaced with what the
560 -# user has typed so far.
562 -# The command must output the completions to standard output, one completion
563 -# per line. Each line must be tab-delimited, with an email address occurring as
564 -# the first field. Only the email address field is required. The second field,
565 -# if present, will be treated as the contact name. Additional fields are
566 -# ignored.
568 -# This parameter can also be set per account in accounts.conf.
569 -#address-book-cmd=
571 -# Specifies the command to be used to select attachments. Any occurrence of
572 -# '%s' in the file-picker-cmd will be replaced with the argument <arg>
573 -# to :attach -m <arg>. Any occurence of '%f' will be replaced by the
574 -# location of a temporary file, from which aerc will read the selected files.
576 -# If '%f' is not present, the command must output the selected files to
577 -# standard output, one file per line. If it is present, then aerc does not
578 -# capture the standard output and instead reads the files from the temporary
579 -# file which should have the same format.
580 -file-picker-cmd=yazi --chooser-file %f
583 -# Allow to address yourself when replying
585 -# Default: true
586 -#reply-to-self=true
588 -# Warn before sending an email with an empty subject.
590 -# Default: false
591 -empty-subject-warning=true
594 -# Warn before sending an email that matches the specified regexp but does not
595 -# have any attachments. Leave empty to disable this feature.
597 -# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The
598 -# "(?im)" flags are set by default (case-insensitive and multi-line).
600 -# Example:
601 -# no-attachment-warning=^[^>]*attach(ed|ment)
603 -no-attachment-warning=^[^>]*(attach|attached|attachment|anhang)
606 -# When set, aerc will generate "format=flowed" bodies with a content type of
607 -# "text/plain; format=flowed" as described in RFC3676. This format is easier to
608 -# handle for some mailing software, and generally just looks like ordinary
609 -# text. To actually make use of this format's features, you'll need support in
610 -# your editor.
612 -format-flowed=true
614 -[multipart-converters]
616 -# Converters allow to generate multipart/alternative messages by converting the
617 -# main text/plain part into any other MIME type. Only exact MIME types are
618 -# accepted. The commands are invoked with sh -c and are expected to output
619 -# valid UTF-8 text.
621 -# Example (obviously, this requires that you write your main text/plain body
622 -# using the markdown syntax):
623 -#text/html=pandoc -f markdown -t html --standalone
625 -[filters]
627 -# Filters allow you to pipe an email body through a shell command to render
628 -# certain emails differently, e.g. highlighting them with ANSI escape codes.
630 -# The commands are invoked with sh -c. The following folders are prepended to
631 -# the system $PATH to allow referencing filters from their name only:
633 -# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters
634 -# ~/.local/libexec/aerc/filters
635 -# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters
636 -# $PREFIX/libexec/aerc/filters
637 -# $PREFIX/share/aerc/filters
638 -# /usr/libexec/aerc/filters
639 -# /usr/share/aerc/filters
641 -# If you want to run a program in your default $PATH which has the same name
642 -# as a builtin filter (e.g. /usr/bin/colorize), use its absolute path.
644 -# The following variables are defined in the filter command environment:
646 -# AERC_MIME_TYPE the part MIME type/subtype
647 -# AERC_FORMAT the part content type format= parameter
648 -# AERC_FILENAME the attachment filename (if any)
649 -# AERC_SUBJECT the message Subject header value
650 -# AERC_FROM the message From header value
652 -# The first filter which matches the email's mimetype will be used, so order
653 -# them from most to least specific.
655 -# You can also match on non-mimetypes, by prefixing with the header to match
656 -# against (non-case-sensitive) and a comma, e.g. subject,text will match a
657 -# subject which contains "text". Use header,~regex to match against a regex.
659 -text/plain=colorize
660 -text/calendar=calendar
661 -message/delivery-status=colorize
662 -message/rfc822=colorize
663 -text/html=pandoc -f html -t plain | colorize
664 -#text/html=html | colorize
665 -#text/*=bat -fP --file-name="$AERC_FILENAME"
666 -#application/x-sh=bat -fP -l sh
667 -image/*=wezterm imgcat --width $(tput cols)
668 -#subject,~Git(hub|lab)=lolcat -f
669 -#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize
671 -# This special filter is only used to post-process email headers when
672 -# [viewer].show-headers=true
673 -# By default, headers are piped directly into the pager.
675 -.headers=colorize
677 -[openers]
679 -# Openers allow you to specify the command to use for the :open and :open-link
680 -# actions on a per-MIME-type basis. The :open-link URL scheme is used to
681 -# determine the MIME type as follows: x-scheme-handler/<scheme>.
683 -# {} is expanded as the temporary filename or URL to be opened with proper
684 -# shell quoting. If it is not encountered in the command, the filename/URL will
685 -# be appended to the end of the command. The command will then be executed with
686 -# `sh -c`.
688 -# Like [filters], openers support basic shell globbing. The first opener which
689 -# matches the part's MIME type (or URL scheme handler MIME type) will be used,
690 -# so order them from most to least specific.
692 -# Examples:
693 -x-scheme-handler/irc=weechat
694 -# x-scheme-handler/http*=printf '%s' {} | wl-copy
695 -# text/html=surf -dfgms
696 -# text/plain=gvim {} +125
697 -# message/rfc822=thunderbird
699 -[hooks]
701 -# Hooks are triggered whenever the associated event occurs.
704 -# Executed when a new email arrives in the selected folder
705 -mail-received=notify-send "📫 [$AERC_ACCOUNT/$AERC_FOLDER] New mail from $AERC_FROM_NAME" "$AERC_SUBJECT"
708 -# Executed when mail is deleted from a folder
709 -#mail-deleted=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
712 -# Executed when aerc adds mail to a folder
713 -#mail-added=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
716 -# Executed when aerc starts
717 -#aerc-startup=aerc :terminal calcurse && aerc :next-tab
720 -# Executed when aerc shuts down.
721 -#aerc-shutdown=
723 -[templates]
724 -# Templates are used to populate email bodies automatically.
727 -# The directories where the templates are stored. It takes a colon-separated
728 -# list of directories. If this is unset or if a template cannot be found, the
729 -# following paths will be used as a fallback in that order:
731 -# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates
732 -# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates
733 -# /usr/local/share/aerc/templates
734 -# /usr/share/aerc/templates
736 -#template-dirs=
738 -# The default template to be used for new messages.
740 -# default: new_message
741 -#new-message=new_message
743 -# The default template to be used for quoted replies.
745 -# default: quoted_reply
746 -#quoted-reply=quoted_reply
748 -# The default template to be used for forward as body.
750 -# default: forward_as_body
751 -#forwards=forward_as_body
1 +#
2 +# aerc main configuration
4 +[general]
5 +#
6 +# Used as a default path for save operations if no other path is specified.
7 +# ~ is expanded to the current user home dir.
8 +#
9 +default-save-path=~/Downloads
11 +# If set to "gpg", aerc will use system gpg binary and keystore for all crypto
12 +# operations. If set to "internal", the internal openpgp keyring will be used.
13 +# If set to "auto", the system gpg will be preferred unless the internal
14 +# keyring already exists, in which case the latter will be used.
16 +# Default: auto
17 +#pgp-provider=auto
19 +# By default, the file permissions of accounts.conf must be restrictive and
20 +# only allow reading by the file owner (0600). Set this option to true to
21 +# ignore this permission check. Use this with care as it may expose your
22 +# credentials.
24 +# Default: false
25 +#unsafe-accounts-conf=false
27 +# Output log messages to specified file. A path starting with ~/ is expanded to
28 +# the user home dir. When redirecting aerc's output to a file using > shell
29 +# redirection, this setting is ignored and log messages are printed to stdout.
31 +#log-file=
33 +# Only log messages above the specified level to log-file. Supported levels
34 +# are: trace, debug, info, warn and error. When redirecting aerc's output to
35 +# a file using > shell redirection, this setting is ignored and the log level
36 +# is forced to trace.
38 +# Default: info
39 +#log-level=info
41 +# Set the $TERM environment variable used for the embedded terminal.
43 +# Default: xterm-256color
44 +#term=xterm-256color
46 +# Display OSC8 strings in the embedded terminal
48 +# Default: false
49 +enable-osc8=true
51 +# Default shell command to use for :menu. This will be executed with sh -c and
52 +# will run in an popover dialog.
54 +# Any occurrence of %f will be replaced by a temporary file path where the
55 +# command is expected to write output lines to be consumed by :menu. Otherwise,
56 +# the lines will be read from the command's standard output.
58 +# Examples:
59 +# default-menu-cmd=fzf
60 +# default-menu-cmd=fzf --multi
61 +# default-menu-cmd=dmenu -l 20
62 +# default-menu-cmd=ranger --choosefiles=%f
64 +default-menu-cmd=yazi --chooser-file %f
66 +[ui]
68 +# Describes the format for each row in a mailbox view. This is a comma
69 +# separated list of column names with an optional align and width suffix. After
70 +# the column name, one of the '<' (left), ':' (center) or '>' (right) alignment
71 +# characters can be added (by default, left) followed by an optional width
72 +# specifier. The width is either an integer representing a fixed number of
73 +# characters, or a percentage between 1% and 99% representing a fraction of the
74 +# terminal width. It can also be one of the '*' (auto) or '=' (fit) special
75 +# width specifiers. Auto width columns will be equally attributed the remaining
76 +# terminal width. Fit width columns take the width of their contents. If no
77 +# width specifier is set, '*' is used by default.
79 +# Default: date<20,name<17,flags>4,subject<*
80 +index-columns=date<6,flags>4,name<24,subject<*
83 +# Each name in index-columns must have a corresponding column-$name setting.
84 +# All column-$name settings accept golang text/template syntax. See
85 +# aerc-templates(7) for available template attributes and functions.
87 +# Here are some examples to show the To field instead of the From field for
88 +# an email (modifying column-name):
90 +# 1. a generic one
91 +# column-name={{ .Peer | names | join ", " }}
92 +# 2. based upon the selected folder
93 +# column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}}
95 +# Default settings
96 +#column-date={{.DateAutoFormat .Date.Local}}
97 +#column-name={{index (.From | names) 0}}
98 +#column-flags={{.Flags | join ""}}
99 +#column-subject={{.ThreadPrefix}}{{if .ThreadFolded}}{{printf "{%d}" .ThreadCount}}{{end}}{{.Subject}}
102 +# String separator inserted between columns. When the column width specifier is
103 +# an exact number of characters, the separator is added to it (i.e. the exact
104 +# width will be fully available for the column contents).
106 +# Default: " "
107 +#column-separator=" "
110 +# See time.Time#Format at https://godoc.org/time#Time.Format
112 +# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
113 +#timestamp-format=2006-01-02 03:04 PM
114 +timestamp-format=02.01.2006 03:04h
115 +# FIXME it would be nice to have different formats for the viewer
118 +# Index-only time format for messages that were received/sent today.
119 +# If this is not specified, timestamp-format is used instead.
121 +this-day-time-format=03:04h
124 +# Index-only time format for messages that were received/sent within the last
125 +# 7 days. If this is not specified, timestamp-format is used instead.
127 +this-week-time-format=02.01
130 +# Index-only time format for messages that were received/sent this year.
131 +# If this is not specified, timestamp-format is used instead.
133 +this-year-time-format=01.2006
136 +# Width of the sidebar, including the border.
138 +# Default: 20
139 +sidebar-width=24
142 +# Message to display when viewing an empty folder.
144 +# Default: (no messages)
145 +#empty-message=(no messages)
147 +# Message to display when no folders exists or are all filtered
149 +# Default: (no folders)
150 +#empty-dirlist=(no folders)
152 +# Value to set {{.Subject}} template to when subject is empty.
154 +# Default: (no subject)
155 +#empty-subject=(no subject)
157 +# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
159 +# Default: false
160 +mouse-enabled=true
163 +# Ring the bell when new messages are received
165 +# Default: true
166 +#new-message-bell=true
169 +# Template to use for Account tab titles
171 +# Default: {{.Account}}
172 +#tab-title-account={{.Account}}
174 +# Marker to show before a pinned tab's name.
176 +# Default: `
177 +#pinned-tab-marker='`'
179 +# Template for the left side of the directory list.
180 +# See aerc-templates(7) for all available fields and functions.
182 +# Default: {{.Folder}}
183 +dirlist-left={{.Folder}}{{if .Recent}} 󰺻{{end}}
185 +# Template for the right side of the directory list.
186 +# See aerc-templates(7) for all available fields and functions.
188 +# Default: {{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}}
189 +#dirlist-right={{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}}
191 +# Delay after which the messages are actually listed when entering a directory.
192 +# This avoids loading messages when skipping over folders and makes the UI more
193 +# responsive. If you do not want that, set it to 0s.
195 +# Default: 200ms
196 +dirlist-delay=100ms
198 +# Display the directory list as a foldable tree that allows to collapse and
199 +# expand the folders.
201 +# Default: false
202 +dirlist-tree=true
204 +# If dirlist-tree is enabled, set level at which folders are collapsed by
205 +# default. Set to 0 to disable.
207 +# Default: 0
208 +dirlist-collapse=3
210 +# List of space-separated criteria to sort the messages by, see *sort*
211 +# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
212 +# reverses that criterion.
214 +# Example: "from -r date"
216 +sort=-r date from
218 +# Moves to next message when the current message is deleted
220 +# Default: true
221 +#next-message-on-delete=true
223 +# Automatically set the "seen" flag when a message is opened in the message
224 +# viewer.
226 +# Default: true
227 +#auto-mark-read=true
229 +# The directories where the stylesets are stored. It takes a colon-separated
230 +# list of directories. If this is unset or if a styleset cannot be found, the
231 +# following paths will be used as a fallback in that order:
233 +# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
234 +# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
235 +# /usr/local/share/aerc/stylesets
236 +# /usr/share/aerc/stylesets
238 +#stylesets-dirs=
240 +# Uncomment to use box-drawing characters for vertical and horizontal borders.
242 +# Default: " "
243 +border-char-vertical="│"
244 +border-char-horizontal="─"
246 +# Sets the styleset to use for the aerc ui elements.
248 +# Default: default
249 +styleset-name=nugu-dark
251 +# Activates fuzzy search in commands and their arguments: the typed string is
252 +# searched in the command or option in any position, and need not be
253 +# consecutive characters in the command or option.
255 +# Default: false
256 +fuzzy-complete=true
258 +# How long to wait after the last input before auto-completion is triggered.
260 +# Default: 250ms
261 +#completion-delay=250ms
263 +# The minimum required characters to allow auto-completion to be triggered after
264 +# completion-delay.
266 +# Setting this to "manual" disables automatic completion, leaving only the
267 +# manually triggered completion with the $complete key (see aerc-binds(5) for
268 +# more details).
270 +# Default: 1
271 +#completion-min-chars=1
274 +# Global switch for completion popovers
276 +# Default: true
277 +#completion-popovers=true
279 +# Uncomment to use UTF-8 symbols to indicate PGP status of messages
281 +# Default: ASCII
282 +icon-unencrypted=󰇷
283 +icon-encrypted=✔
284 +icon-signed=✔
285 +icon-signed-encrypted=✔
286 +icon-unknown=✘
287 +icon-invalid=⚠
289 +# Reverses the order of the message list. By default, the message list is
290 +# ordered with the newest (highest UID) message on top. Reversing the order
291 +# will put the oldest (lowest UID) message on top. This can be useful in cases
292 +# where the backend does not support sorting.
294 +# Default: false
295 +#reverse-msglist-order = false
297 +# Reverse display of the mesage threads. Default order is the the intial
298 +# message is on the top with all the replies being displayed below. The
299 +# reverse option will put the initial message at the bottom with the
300 +# replies on top.
302 +# Default: false
303 +#reverse-thread-order=false
305 +# Sort the thread siblings according to the sort criteria for the messages. If
306 +# sort-thread-siblings is false, the thread siblings will be sorted based on
307 +# the message UID in ascending order. This option is only applicable for
308 +# client-side threading with a backend that enables sorting. Note that there's
309 +# a performance impact when sorting is activated.
311 +# Default: false
312 +#sort-thread-siblings=false
314 +[ui:account=oliver]
316 +# Enable a threaded view of messages. If this is not supported by the backend
317 +# (IMAP server or notmuch), threads will be built by the client.
319 +# Default: false
320 +threading-enabled=true
322 +# Force client-side thread building
324 +# Default: false
325 +#force-client-threads=false
327 +# Show thread context enables messages which do not match the current query (or
328 +# belong to the current mailbox) to be shown for context. These messages can be
329 +# styled separately using "msglist_thread_context" in a styleset. This feature
330 +# is not supported by all backends
332 +# Default: false
333 +#show-thread-context=false
335 +# Debounce client-side thread building
337 +# Default: 50ms
338 +#client-threads-delay=50ms
341 +# Thread prefix customization:
344 +# Customize the thread prefix appearance by selecting the arrow head.
346 +# Default: ">"
347 +#thread-prefix-tip = ">"
350 +# Customize the thread prefix appearance by selecting the arrow indentation.
352 +# Default: " "
353 +#thread-prefix-indent = " "
356 +# Customize the thread prefix appearance by selecting the vertical extension of
357 +# the arrow.
359 +# Default: "│"
360 +#thread-prefix-stem = "│"
363 +# Customize the thread prefix appearance by selecting the horizontal extension
364 +# of the arrow.
366 +# Default: ""
367 +#thread-prefix-limb = ""
370 +# Customize the thread prefix appearance by selecting the folded thread
371 +# indicator.
373 +# Default: ""
374 +#thread-prefix-folded = ""
377 +# Customize the thread prefix appearance by selecting the unfolded thread
378 +# indicator.
380 +# Default: ""
381 +#thread-prefix-unfolded = ""
384 +# Customize the thread prefix appearance by selecting the first child connector.
386 +# Default: ""
387 +#thread-prefix-first-child = ""
390 +# Customize the thread prefix appearance by selecting the connector used if
391 +# the message has siblings.
393 +# Default: "├─"
394 +#thread-prefix-has-siblings = "├─"
397 +# Customize the thread prefix appearance by selecting the connector used if the
398 +# message has no parents and no children.
400 +# Default: ""
401 +#thread-prefix-lone = ""
404 +# Customize the thread prefix appearance by selecting the connector used if the
405 +# message has no parents and has children.
407 +# Default: ""
408 +#thread-prefix-orphan = ""
411 +# Customize the thread prefix appearance by selecting the connector for the last
412 +# sibling.
414 +# Default: "└─"
415 +#thread-prefix-last-sibling = "└─"
418 +# Customize the reversed thread prefix appearance by selecting the connector for
419 +# the last sibling.
421 +# Default: "┌─"
422 +#thread-prefix-last-sibling-reverse = "┌─"
425 +# Customize the reversed thread prefix appearance by selecting the first child
426 +# connector.
428 +# Default: ""
429 +#thread-prefix-first-child-reverse = ""
432 +# Customize the reversed thread prefix appearance by selecting the connector
433 +# used if the message has no parents and has children.
435 +# Default: ""
436 +#thread-prefix-orphan-reverse = ""
438 +[statusline]
440 +# Describes the format for the status line. This is a comma separated list of
441 +# column names with an optional align and width suffix. See [ui].index-columns
442 +# for more details. To completely mute the status line except for push
443 +# notifications, explicitly set status-columns to an empty string.
445 +# Default: left<*,center:=,right>*
446 +#status-columns=left<*,center:=,right>*
449 +# Each name in status-columns must have a corresponding column-$name setting.
450 +# All column-$name settings accept golang text/template syntax. See
451 +# aerc-templates(7) for available template attributes and functions.
453 +# Default settings
454 +#column-left=[{{.Account}}] {{.StatusInfo}}
455 +#column-center={{.PendingKeys}}
456 +#column-right={{.TrayInfo}}
459 +# String separator inserted between columns.
460 +# See [ui].column-separator for more details.
462 +#column-separator=" "
464 +# Specifies the separator between grouped statusline elements.
466 +# Default: " | "
467 +#separator=" | "
469 +# Defines the mode for displaying the status elements.
470 +# Options: text, icon
472 +# Default: text
473 +#display-mode=text
475 +[viewer]
477 +# Specifies the pager to use when displaying emails. Note that some filters
478 +# may add ANSI codes to add color to rendered emails, so you may want to use a
479 +# pager which supports ANSI codes.
481 +# Default: less -Rc
482 +#pager=less -Rc
485 +# If an email offers several versions (multipart), you can configure which
486 +# mimetype to prefer. For example, this can be used to prefer plaintext over
487 +# html emails.
489 +# Default: text/plain,text/html
490 +#alternatives=text/plain,text/html
493 +# Default setting to determine whether to show full headers or only parsed
494 +# ones in message viewer.
496 +# Default: false
497 +#show-headers=false
500 +# Layout of headers when viewing a message. To display multiple headers in the
501 +# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
502 +# none of their specified headers are present in the message.
504 +# Default: From|To,Cc|Bcc,Date,Subject
505 +#header-layout=From|To,Cc|Bcc,Date,Subject
507 +# Whether to always show the mimetype of an email, even when it is just a single part
509 +# Default: false
510 +#always-show-mime=false
512 +# Define the maximum height of the mimetype switcher before a scrollbar is used.
513 +# The height of the mimetype switcher is restricted to half of the display
514 +# height. If the provided value for the height is zero, the number of parts will
515 +# be used as the height of the type switcher.
517 +# Default: 0
518 +#max-mime-height = 0
520 +# Parses and extracts http links when viewing a message. Links can then be
521 +# accessed with the open-link command.
523 +# Default: true
524 +#parse-http-links=true
526 +[compose]
528 +# Specifies the command to run the editor with. It will be shown in an embedded
529 +# terminal, though it may also launch a graphical window if the environment
530 +# supports it. Defaults to $EDITOR, or vi.
531 +editor=nvim
534 +# When set, aerc will create and read .eml files for composing that have
535 +# non-standard \n linebreaks. This is only relevant if the used editor does not
536 +# support CRLF linebreaks.
538 +#lf-editor=false
541 +# Default header fields to display when composing a message. To display
542 +# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
544 +# Default: To|From,Subject
545 +#header-layout=To|From,Subject
548 +# Edit headers into the text editor instead than separate fields.
550 +# When this is true, address-book-cmd is not supported and address completion
551 +# is left to the editor itself. Also, displaying multiple headers on the same
552 +# line is not possible.
554 +# Default: false
555 +#edit-headers=false
558 +# Specifies the command to be used to tab-complete email addresses. Any
559 +# occurrence of "%s" in the address-book-cmd will be replaced with what the
560 +# user has typed so far.
562 +# The command must output the completions to standard output, one completion
563 +# per line. Each line must be tab-delimited, with an email address occurring as
564 +# the first field. Only the email address field is required. The second field,
565 +# if present, will be treated as the contact name. Additional fields are
566 +# ignored.
568 +# This parameter can also be set per account in accounts.conf.
569 +#address-book-cmd=
571 +# Specifies the command to be used to select attachments. Any occurrence of
572 +# '%s' in the file-picker-cmd will be replaced with the argument <arg>
573 +# to :attach -m <arg>. Any occurence of '%f' will be replaced by the
574 +# location of a temporary file, from which aerc will read the selected files.
576 +# If '%f' is not present, the command must output the selected files to
577 +# standard output, one file per line. If it is present, then aerc does not
578 +# capture the standard output and instead reads the files from the temporary
579 +# file which should have the same format.
580 +file-picker-cmd=yazi --chooser-file %f
583 +# Allow to address yourself when replying
585 +# Default: true
586 +#reply-to-self=true
588 +# Warn before sending an email with an empty subject.
590 +# Default: false
591 +empty-subject-warning=true
594 +# Warn before sending an email that matches the specified regexp but does not
595 +# have any attachments. Leave empty to disable this feature.
597 +# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The
598 +# "(?im)" flags are set by default (case-insensitive and multi-line).
600 +# Example:
601 +# no-attachment-warning=^[^>]*attach(ed|ment)
603 +no-attachment-warning=^[^>]*(attach|attached|attachment|anhang)
606 +# When set, aerc will generate "format=flowed" bodies with a content type of
607 +# "text/plain; format=flowed" as described in RFC3676. This format is easier to
608 +# handle for some mailing software, and generally just looks like ordinary
609 +# text. To actually make use of this format's features, you'll need support in
610 +# your editor.
612 +format-flowed=true
614 +[multipart-converters]
616 +# Converters allow to generate multipart/alternative messages by converting the
617 +# main text/plain part into any other MIME type. Only exact MIME types are
618 +# accepted. The commands are invoked with sh -c and are expected to output
619 +# valid UTF-8 text.
621 +# Example (obviously, this requires that you write your main text/plain body
622 +# using the markdown syntax):
623 +#text/html=pandoc -f markdown -t html --standalone
625 +[filters]
627 +# Filters allow you to pipe an email body through a shell command to render
628 +# certain emails differently, e.g. highlighting them with ANSI escape codes.
630 +# The commands are invoked with sh -c. The following folders are prepended to
631 +# the system $PATH to allow referencing filters from their name only:
633 +# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters
634 +# ~/.local/libexec/aerc/filters
635 +# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters
636 +# $PREFIX/libexec/aerc/filters
637 +# $PREFIX/share/aerc/filters
638 +# /usr/libexec/aerc/filters
639 +# /usr/share/aerc/filters
641 +# If you want to run a program in your default $PATH which has the same name
642 +# as a builtin filter (e.g. /usr/bin/colorize), use its absolute path.
644 +# The following variables are defined in the filter command environment:
646 +# AERC_MIME_TYPE the part MIME type/subtype
647 +# AERC_FORMAT the part content type format= parameter
648 +# AERC_FILENAME the attachment filename (if any)
649 +# AERC_SUBJECT the message Subject header value
650 +# AERC_FROM the message From header value
652 +# The first filter which matches the email's mimetype will be used, so order
653 +# them from most to least specific.
655 +# You can also match on non-mimetypes, by prefixing with the header to match
656 +# against (non-case-sensitive) and a comma, e.g. subject,text will match a
657 +# subject which contains "text". Use header,~regex to match against a regex.
659 +text/plain=colorize
660 +text/calendar=calendar
661 +message/delivery-status=colorize
662 +message/rfc822=colorize
663 +text/html=pandoc -f html -t plain | colorize
664 +#text/html=html | colorize
665 +#text/*=bat -fP --file-name="$AERC_FILENAME"
666 +#application/x-sh=bat -fP -l sh
667 +image/*=wezterm imgcat --width $(tput cols)
668 +#subject,~Git(hub|lab)=lolcat -f
669 +#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize
671 +# This special filter is only used to post-process email headers when
672 +# [viewer].show-headers=true
673 +# By default, headers are piped directly into the pager.
675 +.headers=colorize
677 +[openers]
679 +# Openers allow you to specify the command to use for the :open and :open-link
680 +# actions on a per-MIME-type basis. The :open-link URL scheme is used to
681 +# determine the MIME type as follows: x-scheme-handler/<scheme>.
683 +# {} is expanded as the temporary filename or URL to be opened with proper
684 +# shell quoting. If it is not encountered in the command, the filename/URL will
685 +# be appended to the end of the command. The command will then be executed with
686 +# `sh -c`.
688 +# Like [filters], openers support basic shell globbing. The first opener which
689 +# matches the part's MIME type (or URL scheme handler MIME type) will be used,
690 +# so order them from most to least specific.
692 +# Examples:
693 +x-scheme-handler/irc=weechat
694 +# x-scheme-handler/http*=printf '%s' {} | wl-copy
695 +# text/html=surf -dfgms
696 +# text/plain=gvim {} +125
697 +# message/rfc822=thunderbird
699 +[hooks]
701 +# Hooks are triggered whenever the associated event occurs.
704 +# Executed when a new email arrives in the selected folder
705 +mail-received=notify-send "📫 [$AERC_ACCOUNT/$AERC_FOLDER] New mail from $AERC_FROM_NAME" "$AERC_SUBJECT"
708 +# Executed when mail is deleted from a folder
709 +#mail-deleted=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
712 +# Executed when aerc adds mail to a folder
713 +#mail-added=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
716 +# Executed when aerc starts
717 +#aerc-startup=aerc :terminal calcurse && aerc :next-tab
720 +# Executed when aerc shuts down.
721 +#aerc-shutdown=
723 +[templates]
724 +# Templates are used to populate email bodies automatically.
727 +# The directories where the templates are stored. It takes a colon-separated
728 +# list of directories. If this is unset or if a template cannot be found, the
729 +# following paths will be used as a fallback in that order:
731 +# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates
732 +# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates
733 +# /usr/local/share/aerc/templates
734 +# /usr/share/aerc/templates
736 +#template-dirs=
738 +# The default template to be used for new messages.
740 +# default: new_message
741 +#new-message=new_message
743 +# The default template to be used for quoted replies.
745 +# default: quoted_reply
746 +#quoted-reply=quoted_reply
748 +# The default template to be used for forward as body.
750 +# default: forward_as_body
751 +#forwards=forward_as_body

aerc/binds.conf

Modified
1 -# Binds are of the form <key sequence> = <command to run>
2 -# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
3 -# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
4 -<C-p> = :prev-tab<Enter>
5 -<C-PgUp> = :prev-tab<Enter>
6 -<C-n> = :next-tab<Enter>
7 -<C-PgDn> = :next-tab<Enter>
8 -\[t = :prev-tab<Enter>
9 -\]t = :next-tab<Enter>
10 -<C-t> = :term<Enter>
11 -? = :help keys<Enter>
12 -<C-c> = :prompt 'Quit?' quit<Enter>
13 -<C-q> = :prompt 'Quit?' quit<Enter>
14 -<C-z> = :suspend<Enter>
16 -[messages]
17 -q = :prompt 'Quit?' quit<Enter>
19 -j = :next<Enter>
20 -<Down> = :next<Enter>
21 -<C-d> = :next 50%<Enter>
22 -<C-f> = :next 100%<Enter>
23 -<PgDn> = :next 100%<Enter>
25 -k = :prev<Enter>
26 -<Up> = :prev<Enter>
27 -<C-u> = :prev 50%<Enter>
28 -<C-b> = :prev 100%<Enter>
29 -<PgUp> = :prev 100%<Enter>
30 -g = :select 0<Enter>
31 -G = :select -1<Enter>
33 -J = :next-folder<Enter>
34 -<C-Down> = :next-folder<Enter>
35 -K = :prev-folder<Enter>
36 -<C-Up> = :prev-folder<Enter>
37 -H = :collapse-folder<Enter>
38 -<C-Left> = :collapse-folder<Enter>
39 -L = :expand-folder<Enter>
40 -<C-Right> = :expand-folder<Enter>
42 -v = :mark -t<Enter>
43 -<Space> = :mark -t<Enter>:next<Enter>
44 -V = :mark -v<Enter>
46 -T = :toggle-threads<Enter>
47 -zc = :fold<Enter>
48 -zo = :unfold<Enter>
49 -za = :fold -t<Enter>
50 -zM = :fold -a<Enter>
51 -zR = :unfold -a<Enter>
52 -<tab> = :fold -t<Enter>
54 -<Enter> = :view<Enter>
55 -d = :prompt 'Really delete this message?' 'delete-message'<Enter>
56 -D = :delete<Enter>
57 -a = :archive flat<Enter>
58 -A = :unmark -a<Enter>:mark -T<Enter>:archive flat<Enter>
60 -C = :compose<Enter>
61 -m = :compose<Enter>
63 -rr = :reply -a<Enter>
64 -rq = :reply -aq<Enter>
65 -Rr = :reply<Enter>
66 -Rq = :reply -q<Enter>
68 -c = :cf<space>
69 -$ = :term<space>
70 -! = :term<space>
71 -| = :pipe<space>
73 -/ = :search<space>
74 -\ = :filter<space>
75 -n = :next-result<Enter>
76 -N = :prev-result<Enter>
77 -<Esc> = :clear<Enter>
79 -s = :split<Enter>
80 -S = :vsplit<Enter>
82 -pl = :patch list<Enter>
83 -pa = :patch apply <Tab>
84 -pd = :patch drop <Tab>
85 -pb = :patch rebase<Enter>
86 -pt = :patch term<Enter>
87 -ps = :patch switch <Tab>
89 -[messages:folder=Drafts]
90 -<Enter> = :recall<Enter>
92 -[view]
93 -/ = :toggle-key-passthrough<Enter>/
94 -q = :close<Enter>
95 -O = :open<Enter>
96 -o = :open<Enter>
97 -E = :pipe -p nvim -R -n -c 'setlocal ft=mail nomodifiable' -<Enter>
98 -S = :save<space>
99 -Y = :pipe -pb ~/.config/aerc/copy-to-clipboard current-part<Enter>
100 -M = :pipe -mb ~/.config/aerc/copy-to-clipboard full-message<Enter>
101 -| = :pipe<space>
102 -D = :delete<Enter>
103 -A = :archive flat<Enter>
105 -<C-l> = :open-link <space>
107 -f = :forward<Enter>
108 -rr = :reply -a<Enter>
109 -rq = :reply -aq<Enter>
110 -Rr = :reply<Enter>
111 -Rq = :reply -q<Enter>
113 -H = :toggle-headers<Enter>
114 -<C-k> = :prev-part<Enter>
115 -<C-Up> = :prev-part<Enter>
116 -<C-j> = :next-part<Enter>
117 -<C-Down> = :next-part<Enter>
118 -J = :next<Enter>
119 -<C-Right> = :next<Enter>
120 -K = :prev<Enter>
121 -<C-Left> = :prev<Enter>
123 -[view::passthrough]
124 -$noinherit = true
125 -$ex = <C-x>
126 -<Esc> = :toggle-key-passthrough<Enter>
128 -[compose]
129 -# Keybindings used when the embedded terminal is not selected in the compose
130 -# view
131 -$noinherit = true
132 -$ex = <C-x>
133 -$complete = <C-o>
134 -<C-k> = :prev-field<Enter>
135 -<C-Up> = :prev-field<Enter>
136 -<C-j> = :next-field<Enter>
137 -<C-Down> = :next-field<Enter>
138 -<A-p> = :switch-account -p<Enter>
139 -<C-Left> = :switch-account -p<Enter>
140 -<A-n> = :switch-account -n<Enter>
141 -<C-Right> = :switch-account -n<Enter>
142 -<tab> = :next-field<Enter>
143 -<backtab> = :prev-field<Enter>
144 -<C-p> = :prev-tab<Enter>
145 -<C-PgUp> = :prev-tab<Enter>
146 -<C-n> = :next-tab<Enter>
147 -<C-PgDn> = :next-tab<Enter>
149 -[compose::editor]
150 -# Keybindings used when the embedded terminal is selected in the compose view
151 -$noinherit = true
152 -$ex = <C-x>
153 -<C-k> = :prev-field<Enter>
154 -<C-Up> = :prev-field<Enter>
155 -<C-j> = :next-field<Enter>
156 -<C-Down> = :next-field<Enter>
157 -<C-p> = :prev-tab<Enter>
158 -<C-PgUp> = :prev-tab<Enter>
159 -<C-n> = :next-tab<Enter>
160 -<C-PgDn> = :next-tab<Enter>
162 -[compose::review]
163 -# Keybindings used when reviewing a message to be sent
164 -y = :send<Enter>
165 -n = :abort<Enter>
166 -v = :preview<Enter>
167 -p = :postpone<Enter>
168 -q = :choose -o d discard abort -o p postpone postpone<Enter>
169 -e = :edit<Enter>
170 -a = :attach<space>
171 -d = :detach<space>
173 -[terminal]
174 -$noinherit = true
175 -$ex = <C-x>
177 -<C-p> = :prev-tab<Enter>
178 -<C-n> = :next-tab<Enter>
179 -<C-PgUp> = :prev-tab<Enter>
180 -<C-PgDn> = :next-tab<Enter>
1 +# Binds are of the form <key sequence> = <command to run>
2 +# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
3 +# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
4 +<C-p> = :prev-tab<Enter>
5 +<C-PgUp> = :prev-tab<Enter>
6 +<C-n> = :next-tab<Enter>
7 +<C-PgDn> = :next-tab<Enter>
8 +\[t = :prev-tab<Enter>
9 +\]t = :next-tab<Enter>
10 +<C-t> = :term<Enter>
11 +? = :help keys<Enter>
12 +<C-c> = :prompt 'Quit?' quit<Enter>
13 +<C-q> = :prompt 'Quit?' quit<Enter>
14 +<C-z> = :suspend<Enter>
16 +[messages]
17 +q = :prompt 'Quit?' quit<Enter>
19 +j = :next<Enter>
20 +<Down> = :next<Enter>
21 +<C-d> = :next 50%<Enter>
22 +<C-f> = :next 100%<Enter>
23 +<PgDn> = :next 100%<Enter>
25 +k = :prev<Enter>
26 +<Up> = :prev<Enter>
27 +<C-u> = :prev 50%<Enter>
28 +<C-b> = :prev 100%<Enter>
29 +<PgUp> = :prev 100%<Enter>
30 +g = :select 0<Enter>
31 +G = :select -1<Enter>
33 +J = :next-folder<Enter>
34 +<C-Down> = :next-folder<Enter>
35 +K = :prev-folder<Enter>
36 +<C-Up> = :prev-folder<Enter>
37 +H = :collapse-folder<Enter>
38 +<C-Left> = :collapse-folder<Enter>
39 +L = :expand-folder<Enter>
40 +<C-Right> = :expand-folder<Enter>
42 +v = :mark -t<Enter>
43 +<Space> = :mark -t<Enter>:next<Enter>
44 +V = :mark -v<Enter>
46 +T = :toggle-threads<Enter>
47 +zc = :fold<Enter>
48 +zo = :unfold<Enter>
49 +za = :fold -t<Enter>
50 +zM = :fold -a<Enter>
51 +zR = :unfold -a<Enter>
52 +<tab> = :fold -t<Enter>
54 +<Enter> = :view<Enter>
55 +d = :prompt 'Really delete this message?' 'delete-message'<Enter>
56 +D = :delete<Enter>
57 +a = :archive flat<Enter>
58 +A = :unmark -a<Enter>:mark -T<Enter>:archive flat<Enter>
60 +C = :compose<Enter>
61 +m = :compose<Enter>
63 +rr = :reply -a<Enter>
64 +rq = :reply -aq<Enter>
65 +Rr = :reply<Enter>
66 +Rq = :reply -q<Enter>
68 +c = :cf<space>
69 +$ = :term<space>
70 +! = :term<space>
71 +| = :pipe<space>
73 +/ = :search<space>
74 +\ = :filter<space>
75 +n = :next-result<Enter>
76 +N = :prev-result<Enter>
77 +<Esc> = :clear<Enter>
79 +s = :split<Enter>
80 +S = :vsplit<Enter>
82 +pl = :patch list<Enter>
83 +pa = :patch apply <Tab>
84 +pd = :patch drop <Tab>
85 +pb = :patch rebase<Enter>
86 +pt = :patch term<Enter>
87 +ps = :patch switch <Tab>
89 +[messages:folder=Drafts]
90 +<Enter> = :recall<Enter>
92 +[view]
93 +/ = :toggle-key-passthrough<Enter>/
94 +q = :close<Enter>
95 +O = :open<Enter>
96 +o = :open<Enter>
97 +E = :pipe -p nvim -R -n -c 'setlocal ft=mail nomodifiable' -<Enter>
98 +S = :save<space>
99 +Y = :pipe -pb ~/.config/aerc/copy-to-clipboard current-part<Enter>
100 +M = :pipe -mb ~/.config/aerc/copy-to-clipboard full-message<Enter>
101 +| = :pipe<space>
102 +D = :delete<Enter>
103 +A = :archive flat<Enter>
105 +<C-l> = :open-link <space>
107 +f = :forward<Enter>
108 +rr = :reply -a<Enter>
109 +rq = :reply -aq<Enter>
110 +Rr = :reply<Enter>
111 +Rq = :reply -q<Enter>
113 +H = :toggle-headers<Enter>
114 +<C-k> = :prev-part<Enter>
115 +<C-Up> = :prev-part<Enter>
116 +<C-j> = :next-part<Enter>
117 +<C-Down> = :next-part<Enter>
118 +J = :next<Enter>
119 +<C-Right> = :next<Enter>
120 +K = :prev<Enter>
121 +<C-Left> = :prev<Enter>
123 +[view::passthrough]
124 +$noinherit = true
125 +$ex = <C-x>
126 +<Esc> = :toggle-key-passthrough<Enter>
128 +[compose]
129 +# Keybindings used when the embedded terminal is not selected in the compose
130 +# view
131 +$noinherit = true
132 +$ex = <C-x>
133 +$complete = <C-o>
134 +<C-k> = :prev-field<Enter>
135 +<C-Up> = :prev-field<Enter>
136 +<C-j> = :next-field<Enter>
137 +<C-Down> = :next-field<Enter>
138 +<A-p> = :switch-account -p<Enter>
139 +<C-Left> = :switch-account -p<Enter>
140 +<A-n> = :switch-account -n<Enter>
141 +<C-Right> = :switch-account -n<Enter>
142 +<tab> = :next-field<Enter>
143 +<backtab> = :prev-field<Enter>
144 +<C-p> = :prev-tab<Enter>
145 +<C-PgUp> = :prev-tab<Enter>
146 +<C-n> = :next-tab<Enter>
147 +<C-PgDn> = :next-tab<Enter>
149 +[compose::editor]
150 +# Keybindings used when the embedded terminal is selected in the compose view
151 +$noinherit = true
152 +$ex = <C-x>
153 +<C-k> = :prev-field<Enter>
154 +<C-Up> = :prev-field<Enter>
155 +<C-j> = :next-field<Enter>
156 +<C-Down> = :next-field<Enter>
157 +<C-p> = :prev-tab<Enter>
158 +<C-PgUp> = :prev-tab<Enter>
159 +<C-n> = :next-tab<Enter>
160 +<C-PgDn> = :next-tab<Enter>
162 +[compose::review]
163 +# Keybindings used when reviewing a message to be sent
164 +y = :send<Enter>
165 +n = :abort<Enter>
166 +v = :preview<Enter>
167 +p = :postpone<Enter>
168 +q = :choose -o d discard abort -o p postpone postpone<Enter>
169 +e = :edit<Enter>
170 +a = :attach<space>
171 +d = :detach<space>
173 +[terminal]
174 +$noinherit = true
175 +$ex = <C-x>
177 +<C-p> = :prev-tab<Enter>
178 +<C-n> = :next-tab<Enter>
179 +<C-PgUp> = :prev-tab<Enter>
180 +<C-PgDn> = :next-tab<Enter>

bat/config

Modified
1 -# apply colors from my terminal color scheme
2 ---theme=ansi
3 ---style=full
5 ---tabs 2
6 -#--show-all
7 -#--nonprintable-notation=unicode
9 -# use features of modern terminals
10 ---italic-text=always
12 -# Map some unknown file types to (hopefully similar) known ones
13 ---map-syntax "*.nu:Rust"
14 ---map-syntax ".stignore:Git Ignore"
1 +# apply colors from my terminal color scheme
2 +--theme=ansi
3 +--style=full
5 +--tabs 2
6 +#--show-all
7 +#--nonprintable-notation=unicode
9 +# use features of modern terminals
10 +--italic-text=always
12 +# Map some unknown file types to (hopefully similar) known ones
13 +--map-syntax "*.nu:Rust"
14 +--map-syntax ".stignore:Git Ignore"

bottom/bottom.toml

Modified
2 -# This is a default config file for bottom. All of the settings are commented
3 -# out by default; if you wish to change them uncomment and modify as you see
4 -# fit.
6 -# This group of options represents a command-line flag/option. Flags explicitly
7 -# added when running (ie: btm -a) will override this config file if an option
8 -# is also set here.
9 -[flags]
11 -# Whether to hide the average cpu entry.
12 -#hide_avg_cpu = false
14 -# Whether to use dot markers rather than braille.
15 -dot_marker = true
17 -# The update rate of the application.
18 -rate = 350
20 -# Whether to put the CPU legend to the left.
21 -left_legend = true
23 -# Whether to set CPU% on a process to be based on the total CPU or just current usage.
24 -#current_usage = false
26 -# Whether to group processes with the same name together by default.
27 -group_processes = true
29 -# Whether to make process searching case sensitive by default.
30 -#case_sensitive = false
32 -# Whether to make process searching look for matching the entire word by default.
33 -#whole_word = false
35 -# Whether to make process searching use regex by default.
36 -#regex = false
38 -# Defaults to Celsius. Temperature is one of:
39 -#temperature_type = "k"
40 -#temperature_type = "f"
41 -#temperature_type = "c"
42 -#temperature_type = "kelvin"
43 -#temperature_type = "fahrenheit"
44 -temperature_type = "celsius"
46 -# The default time interval (in milliseconds).
47 -#default_time_value = 60000
49 -# The time delta on each zoom in/out action (in milliseconds).
50 -#time_delta = 15000
52 -# Override layout default widget
53 -#default_widget_type = "proc"
54 -#default_widget_count = 1
56 -# Use basic mode
57 -#basic = false
59 -# Use the old network legend style
60 -#use_old_network_legend = false
62 -# Remove space in tables
63 -#hide_table_gap = false
65 -##########################################################
67 -# These are all the components that support custom theming. Note that colour support
68 -# will, at the end of the day, depend on terminal support - for example, the
69 -# macOS default Terminal does NOT like custom colours and it will glitch out.
70 -[colors]
72 -# Represents the colour of table headers (processes, CPU, disks, temperature).
73 -#table_header_color="LightBlue"
75 -# Represents the colour of the label each widget has.
76 -widget_title_color = "Blue"
78 -# Represents the average CPU color.
79 -#avg_cpu_color="Red"
81 -# Represents the colour the core will use in the CPU legend and graph.
82 -#cpu_core_colors=["LightMagenta", "LightYellow", "LightCyan", "LightGreen", "LightBlue", "LightRed", "Cyan", "Green", "Blue", "Red"]
84 -# Represents the colour RAM will use in the memory legend and graph.
85 -ram_color = "LightGreen"
87 -# Represents the colour SWAP will use in the memory legend and graph.
88 -#swap_color="LightYellow"
90 -# Represents the colour rx will use in the network legend and graph.
91 -#rx_color="LightCyan"
93 -# Represents the colour tx will use in the network legend and graph.
94 -#tx_color="LightGreen"
96 -# Represents the colour of the border of unselected widgets.
97 -border_color = "Blue"
99 -# Represents the colour of the border of selected widgets.
100 -#highlighted_border_color="LightBlue"
102 -# Represents the colour of most text.
103 -text_color = "Blue"
105 -# Represents the colour of text that is selected.
106 -#selected_text_color="Black"
108 -# Represents the background colour of text that is selected.
109 -#selected_bg_color="LightBlue"
111 -# Represents the colour of the lines and text of the graph.
112 -graph_color = "Blue"
114 -# Represents the colours of the battery based on charge
115 -#battery_colors = ["red", "yellow", "yellow", "green", "green", "green"]
118 -##########################################################
120 -# Layout - layouts follow a pattern like this:
121 -# [[row]] represents a row in the application.
122 -# [[row.child]] represents either a widget or a column.
123 -# [[row.child.child]] represents a widget.
125 -# All widgets must have the type value set to one of ["cpu", "mem", "proc", "net", "temp", "disk", "empty"].
126 -# All layout components have a ratio value - if this is not set, then it defaults to 1.
128 -# The default widget layout:
129 -[[row]]
130 -ratio = 60
131 -[[row.child]]
132 -type = "proc"
133 -default = true
134 -[[row]]
135 -ratio = 20
136 -[[row.child]]
137 -type = "cpu"
138 -[[row]]
139 -ratio = 10
140 -[[row.child]]
141 -type = "mem"
2 +# This is a default config file for bottom. All of the settings are commented
3 +# out by default; if you wish to change them uncomment and modify as you see
4 +# fit.
6 +# This group of options represents a command-line flag/option. Flags explicitly
7 +# added when running (ie: btm -a) will override this config file if an option
8 +# is also set here.
9 +[flags]
11 +# Whether to hide the average cpu entry.
12 +#hide_avg_cpu = false
14 +# Whether to use dot markers rather than braille.
15 +dot_marker = true
17 +# The update rate of the application.
18 +rate = 350
20 +# Whether to put the CPU legend to the left.
21 +left_legend = true
23 +# Whether to set CPU% on a process to be based on the total CPU or just current usage.
24 +#current_usage = false
26 +# Whether to group processes with the same name together by default.
27 +group_processes = true
29 +# Whether to make process searching case sensitive by default.
30 +#case_sensitive = false
32 +# Whether to make process searching look for matching the entire word by default.
33 +#whole_word = false
35 +# Whether to make process searching use regex by default.
36 +#regex = false
38 +# Defaults to Celsius. Temperature is one of:
39 +#temperature_type = "k"
40 +#temperature_type = "f"
41 +#temperature_type = "c"
42 +#temperature_type = "kelvin"
43 +#temperature_type = "fahrenheit"
44 +temperature_type = "celsius"
46 +# The default time interval (in milliseconds).
47 +#default_time_value = 60000
49 +# The time delta on each zoom in/out action (in milliseconds).
50 +#time_delta = 15000
52 +# Override layout default widget
53 +#default_widget_type = "proc"
54 +#default_widget_count = 1
56 +# Use basic mode
57 +#basic = false
59 +# Use the old network legend style
60 +#use_old_network_legend = false
62 +# Remove space in tables
63 +#hide_table_gap = false
65 +##########################################################
67 +# These are all the components that support custom theming. Note that colour support
68 +# will, at the end of the day, depend on terminal support - for example, the
69 +# macOS default Terminal does NOT like custom colours and it will glitch out.
70 +[colors]
72 +# Represents the colour of table headers (processes, CPU, disks, temperature).
73 +#table_header_color="LightBlue"
75 +# Represents the colour of the label each widget has.
76 +widget_title_color = "Blue"
78 +# Represents the average CPU color.
79 +#avg_cpu_color="Red"
81 +# Represents the colour the core will use in the CPU legend and graph.
82 +#cpu_core_colors=["LightMagenta", "LightYellow", "LightCyan", "LightGreen", "LightBlue", "LightRed", "Cyan", "Green", "Blue", "Red"]
84 +# Represents the colour RAM will use in the memory legend and graph.
85 +ram_color = "LightGreen"
87 +# Represents the colour SWAP will use in the memory legend and graph.
88 +#swap_color="LightYellow"
90 +# Represents the colour rx will use in the network legend and graph.
91 +#rx_color="LightCyan"
93 +# Represents the colour tx will use in the network legend and graph.
94 +#tx_color="LightGreen"
96 +# Represents the colour of the border of unselected widgets.
97 +border_color = "Blue"
99 +# Represents the colour of the border of selected widgets.
100 +#highlighted_border_color="LightBlue"
102 +# Represents the colour of most text.
103 +text_color = "Blue"
105 +# Represents the colour of text that is selected.
106 +#selected_text_color="Black"
108 +# Represents the background colour of text that is selected.
109 +#selected_bg_color="LightBlue"
111 +# Represents the colour of the lines and text of the graph.
112 +graph_color = "Blue"
114 +# Represents the colours of the battery based on charge
115 +#battery_colors = ["red", "yellow", "yellow", "green", "green", "green"]
118 +##########################################################
120 +# Layout - layouts follow a pattern like this:
121 +# [[row]] represents a row in the application.
122 +# [[row.child]] represents either a widget or a column.
123 +# [[row.child.child]] represents a widget.
125 +# All widgets must have the type value set to one of ["cpu", "mem", "proc", "net", "temp", "disk", "empty"].
126 +# All layout components have a ratio value - if this is not set, then it defaults to 1.
128 +# The default widget layout:
129 +[[row]]
130 +ratio = 60
131 +[[row.child]]
132 +type = "proc"
133 +default = true
134 +[[row]]
135 +ratio = 20
136 +[[row.child]]
137 +type = "cpu"
138 +[[row]]
139 +ratio = 10
140 +[[row.child]]
141 +type = "mem"

claude/RTK.md

Modified
1 -# RTK - Rust Token Killer
3 -**Usage**: Token-optimized CLI proxy (60-90% savings on dev operations)
5 -## Meta Commands (always use rtk directly)
7 -```bash
8 -rtk gain # Show token savings analytics
9 -rtk gain --history # Show command usage history with savings
10 -rtk discover # Analyze Claude Code history for missed opportunities
11 -rtk proxy <cmd> # Execute raw command without filtering (for debugging)
12 -```
14 -## Installation Verification
16 -```bash
17 -rtk --version # Should show: rtk X.Y.Z
18 -rtk gain # Should work (not "command not found")
19 -which rtk # Verify correct binary
20 -```
22 -⚠️ **Name collision**: If `rtk gain` fails, you may have reachingforthejack/rtk (Rust Type Kit) installed instead.
24 -## Hook-Based Usage
26 -All other commands are automatically rewritten by the Claude Code hook.
27 -Example: `git status` → `rtk git status` (transparent, 0 tokens overhead)
29 -Refer to CLAUDE.md for full command reference.
1 +# RTK - Rust Token Killer
3 +**Usage**: Token-optimized CLI proxy (60-90% savings on dev operations)
5 +## Meta Commands (always use rtk directly)
7 +```bash
8 +rtk gain # Show token savings analytics
9 +rtk gain --history # Show command usage history with savings
10 +rtk discover # Analyze Claude Code history for missed opportunities
11 +rtk proxy <cmd> # Execute raw command without filtering (for debugging)
12 +```
14 +## Installation Verification
16 +```bash
17 +rtk --version # Should show: rtk X.Y.Z
18 +rtk gain # Should work (not "command not found")
19 +which rtk # Verify correct binary
20 +```
22 +⚠️ **Name collision**: If `rtk gain` fails, you may have reachingforthejack/rtk (Rust Type Kit) installed instead.
24 +## Hook-Based Usage
26 +All other commands are automatically rewritten by the Claude Code hook.
27 +Example: `git status` → `rtk git status` (transparent, 0 tokens overhead)
29 +Refer to CLAUDE.md for full command reference.

git/gitconfig.isp

Modified
1 -[user]
2 - name = Oliver Krylow
3 - email = o.krylow@isp-insoft.de
4 - signingKey = ~/.ssh/code.isp-insoft.de
6 -[gui]
7 - fontui = -family \"PT Mono\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
8 - fontdiff = -family Cousine -size 12 -weight normal -slant roman -underline 0 -overstrike 0
10 -[sendemail]
11 - smtpserver = sslout.df.eu
12 - smtpuser = o.krylow@isp-insoft.de
13 - smtpencryption = ssl
14 - smtpserverport = 465
15 - annotate = yes
17 -[core]
18 -# Windows Linebreaks behalten, wir nutzen gitattributes für explizite Kontrolle
19 - autocrlf = false
20 -[branch]
21 -# Immer den neusten Branch auf anhieb finden, da diese wahrscheinlich relevanter sind
22 - sort = committerdate
23 -[pull]
24 -# führt git pull mit --rebase aus, um unnötige Merge-Commits zu vermeiden
25 - rebase = true
26 -[rebase]
27 -# Stashed und Entstashed lokale Änderungen um Konflikte beim Rebase zu vermeiden
28 - autostash = true
29 -# Falls gestackte PRs verwendet werden (absichtlich oder ausversehen), wird hier der Workflow vereinfacht
30 - updateRefs = true
31 -[merge]
32 -# Stashed und Entstashed lokale Änderungen um Konflikte beim Merge zu vermeiden
33 - autostash = true
34 -[push]
35 -# Spart einem bei neuen Branches immer wieder den Remote-Server und Branch spezifizieren zu müssern
36 - autoSetupRemote = true
37 -[submodule]
38 -# Submodule bleiben manuell; automatisches Recurse macht Pull/Rebase fragil.
39 - recurse = false
1 +[user]
2 + name = Oliver Krylow
3 + email = o.krylow@isp-insoft.de
4 + signingKey = ~/.ssh/code.isp-insoft.de
6 +[gui]
7 + fontui = -family \"PT Mono\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
8 + fontdiff = -family Cousine -size 12 -weight normal -slant roman -underline 0 -overstrike 0
10 +[sendemail]
11 + smtpserver = sslout.df.eu
12 + smtpuser = o.krylow@isp-insoft.de
13 + smtpencryption = ssl
14 + smtpserverport = 465
15 + annotate = yes
17 +[core]
18 +# Windows Linebreaks behalten, wir nutzen gitattributes für explizite Kontrolle
19 + autocrlf = false
20 +[branch]
21 +# Immer den neusten Branch auf anhieb finden, da diese wahrscheinlich relevanter sind
22 + sort = committerdate
23 +[pull]
24 +# führt git pull mit --rebase aus, um unnötige Merge-Commits zu vermeiden
25 + rebase = true
26 +[rebase]
27 +# Stashed und Entstashed lokale Änderungen um Konflikte beim Rebase zu vermeiden
28 + autostash = true
29 +# Falls gestackte PRs verwendet werden (absichtlich oder ausversehen), wird hier der Workflow vereinfacht
30 + updateRefs = true
31 +[merge]
32 +# Stashed und Entstashed lokale Änderungen um Konflikte beim Merge zu vermeiden
33 + autostash = true
34 +[push]
35 +# Spart einem bei neuen Branches immer wieder den Remote-Server und Branch spezifizieren zu müssern
36 + autoSetupRemote = true
37 +[submodule]
38 +# Submodule bleiben manuell; automatisches Recurse macht Pull/Rebase fragil.
39 + recurse = false

mpv/scripts/skip.lua

Modified
1 --- Importing mpv module
2 -local mpv = require('mp')
3 -local mpv_options = require("mp.options")
5 -local options = { -- setting default options
6 - op_start = 0, op_end = 0, ed_start = 0, ed_end = 0,
7 -}
8 -mpv_options.read_options(options, "skip") --reading script-opts data
10 --- Main function to check and skip if within the defined section
11 -local function skip()
12 - local current_time = mp.get_property_number("time-pos")
13 -
14 - if not current_time then
15 - return
16 - end
18 - -- Check for opening sequence
19 - if current_time >= options.op_start and current_time < options.op_end then
20 - mp.set_property_number("time-pos", options.op_end)
21 - end
22 -
23 - -- Check for ending sequence
24 - if current_time >= options.ed_start and current_time < options.ed_end then
25 - mp.set_property_number("time-pos", options.ed_end)
26 - end
27 -end
29 --- Bind the function to be called whenever the time position is changed
1 +-- Importing mpv module
2 +local mpv = require('mp')
3 +local mpv_options = require("mp.options")
5 +local options = { -- setting default options
6 + op_start = 0, op_end = 0, ed_start = 0, ed_end = 0,
7 +}
8 +mpv_options.read_options(options, "skip") --reading script-opts data
10 +-- Main function to check and skip if within the defined section
11 +local function skip()
12 + local current_time = mp.get_property_number("time-pos")
14 + if not current_time then
15 + return
16 + end
18 + -- Check for opening sequence
19 + if current_time >= options.op_start and current_time < options.op_end then
20 + mp.set_property_number("time-pos", options.op_end)
21 + end
23 + -- Check for ending sequence
24 + if current_time >= options.ed_start and current_time < options.ed_end then
25 + mp.set_property_number("time-pos", options.ed_end)
26 + end
27 +end
29 +-- Bind the function to be called whenever the time position is changed
30 30 mp.observe_property("time-pos", "number", skip)

mpv/shaders/Anime4K_AutoDownscalePre_x2.glsl

Modified
1 -// This is free and unencumbered software released into the public domain.
3 -// Anyone is free to copy, modify, publish, use, compile, sell, or
4 -// distribute this software, either in source code form or as a compiled
5 -// binary, for any purpose, commercial or non-commercial, and by any
6 -// means.
8 -// In jurisdictions that recognize copyright laws, the author or authors
9 -// of this software dedicate any and all copyright interest in the
10 -// software to the public domain. We make this dedication for the benefit
11 -// of the public at large and to the detriment of our heirs and
12 -// successors. We intend this dedication to be an overt act of
13 -// relinquishment in perpetuity of all present and future rights to this
14 -// software under copyright law.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 -// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 -// OTHER DEALINGS IN THE SOFTWARE.
24 -// For more information, please refer to <https://unlicense.org>
26 -//!DESC Anime4K-v4.0-AutoDownscalePre-x2
27 -//!HOOK MAIN
28 -//!BIND HOOKED
29 -//!BIND NATIVE
30 -//!WHEN OUTPUT.w NATIVE.w / 2.0 < OUTPUT.h NATIVE.h / 2.0 < * OUTPUT.w NATIVE.w / 1.2 > OUTPUT.h NATIVE.h / 1.2 > * *
31 -//!WIDTH OUTPUT.w
32 -//!HEIGHT OUTPUT.h
34 -vec4 hook() {
35 - return HOOKED_tex(HOOKED_pos);
36 -}
1 +// This is free and unencumbered software released into the public domain.
3 +// Anyone is free to copy, modify, publish, use, compile, sell, or
4 +// distribute this software, either in source code form or as a compiled
5 +// binary, for any purpose, commercial or non-commercial, and by any
6 +// means.
8 +// In jurisdictions that recognize copyright laws, the author or authors
9 +// of this software dedicate any and all copyright interest in the
10 +// software to the public domain. We make this dedication for the benefit
11 +// of the public at large and to the detriment of our heirs and
12 +// successors. We intend this dedication to be an overt act of
13 +// relinquishment in perpetuity of all present and future rights to this
14 +// software under copyright law.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 +// OTHER DEALINGS IN THE SOFTWARE.
24 +// For more information, please refer to <https://unlicense.org>
26 +//!DESC Anime4K-v4.0-AutoDownscalePre-x2
27 +//!HOOK MAIN
28 +//!BIND HOOKED
29 +//!BIND NATIVE
30 +//!WHEN OUTPUT.w NATIVE.w / 2.0 < OUTPUT.h NATIVE.h / 2.0 < * OUTPUT.w NATIVE.w / 1.2 > OUTPUT.h NATIVE.h / 1.2 > * *
31 +//!WIDTH OUTPUT.w
32 +//!HEIGHT OUTPUT.h
34 +vec4 hook() {
35 + return HOOKED_tex(HOOKED_pos);

mpv/shaders/Anime4K_AutoDownscalePre_x4.glsl

Modified
1 -// This is free and unencumbered software released into the public domain.
3 -// Anyone is free to copy, modify, publish, use, compile, sell, or
4 -// distribute this software, either in source code form or as a compiled
5 -// binary, for any purpose, commercial or non-commercial, and by any
6 -// means.
8 -// In jurisdictions that recognize copyright laws, the author or authors
9 -// of this software dedicate any and all copyright interest in the
10 -// software to the public domain. We make this dedication for the benefit
11 -// of the public at large and to the detriment of our heirs and
12 -// successors. We intend this dedication to be an overt act of
13 -// relinquishment in perpetuity of all present and future rights to this
14 -// software under copyright law.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 -// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 -// OTHER DEALINGS IN THE SOFTWARE.
24 -// For more information, please refer to <https://unlicense.org>
26 -//!DESC Anime4K-v3.2-AutoDownscalePre-x4
27 -//!HOOK MAIN
28 -//!BIND HOOKED
29 -//!BIND NATIVE
30 -//!WHEN OUTPUT.w NATIVE.w / 4.0 < OUTPUT.h NATIVE.h / 4.0 < * OUTPUT.w NATIVE.w / 2.4 > OUTPUT.h NATIVE.h / 2.4 > * *
31 -//!WIDTH OUTPUT.w 2 /
32 -//!HEIGHT OUTPUT.h 2 /
34 -vec4 hook() {
35 - return HOOKED_tex(HOOKED_pos);
36 -}
1 +// This is free and unencumbered software released into the public domain.
3 +// Anyone is free to copy, modify, publish, use, compile, sell, or
4 +// distribute this software, either in source code form or as a compiled
5 +// binary, for any purpose, commercial or non-commercial, and by any
6 +// means.
8 +// In jurisdictions that recognize copyright laws, the author or authors
9 +// of this software dedicate any and all copyright interest in the
10 +// software to the public domain. We make this dedication for the benefit
11 +// of the public at large and to the detriment of our heirs and
12 +// successors. We intend this dedication to be an overt act of
13 +// relinquishment in perpetuity of all present and future rights to this
14 +// software under copyright law.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 +// OTHER DEALINGS IN THE SOFTWARE.
24 +// For more information, please refer to <https://unlicense.org>
26 +//!DESC Anime4K-v3.2-AutoDownscalePre-x4
27 +//!HOOK MAIN
28 +//!BIND HOOKED
29 +//!BIND NATIVE
30 +//!WHEN OUTPUT.w NATIVE.w / 4.0 < OUTPUT.h NATIVE.h / 4.0 < * OUTPUT.w NATIVE.w / 2.4 > OUTPUT.h NATIVE.h / 2.4 > * *
31 +//!WIDTH OUTPUT.w 2 /
32 +//!HEIGHT OUTPUT.h 2 /
34 +vec4 hook() {
35 + return HOOKED_tex(HOOKED_pos);

mpv/shaders/Anime4K_Clamp_Highlights.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v4.0-De-Ring-Compute-Statistics
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE STATSMAX
28 -//!COMPONENTS 1
30 -#define KERNELSIZE 5 //Kernel size, must be an positive odd integer.
31 -#define KERNELHALFSIZE 2 //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
33 -float get_luma(vec4 rgba) {
34 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
35 -}
37 -vec4 hook() {
39 - float gmax = 0.0;
40 -
41 - for (int i=0; i<KERNELSIZE; i++) {
42 - float g = get_luma(MAIN_texOff(vec2(i - KERNELHALFSIZE, 0)));
43 -
44 - gmax = max(g, gmax);
45 - }
46 -
47 - return vec4(gmax, 0.0, 0.0, 0.0);
48 -}
50 -//!DESC Anime4K-v4.0-De-Ring-Compute-Statistics
51 -//!HOOK MAIN
52 -//!BIND HOOKED
53 -//!BIND STATSMAX
54 -//!SAVE STATSMAX
55 -//!COMPONENTS 1
57 -#define KERNELSIZE 5 //Kernel size, must be an positive odd integer.
58 -#define KERNELHALFSIZE 2 //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
60 -vec4 hook() {
62 - float gmax = 0.0;
63 -
64 - for (int i=0; i<KERNELSIZE; i++) {
65 - float g = STATSMAX_texOff(vec2(0, i - KERNELHALFSIZE)).x;
66 -
67 - gmax = max(g, gmax);
68 - }
69 -
70 - return vec4(gmax, 0.0, 0.0, 0.0);
71 -}
73 -//!DESC Anime4K-v4.0-De-Ring-Clamp
74 -//!HOOK PREKERNEL
75 -//!BIND HOOKED
76 -//!BIND STATSMAX
78 -float get_luma(vec4 rgba) {
79 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
80 -}
82 -vec4 hook() {
84 - float current_luma = get_luma(HOOKED_tex(HOOKED_pos));
85 - float new_luma = min(current_luma, STATSMAX_tex(HOOKED_pos).x);
86 -
87 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
88 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
89 - return HOOKED_tex(HOOKED_pos) - (current_luma - new_luma);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v4.0-De-Ring-Compute-Statistics
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE STATSMAX
28 +//!COMPONENTS 1
30 +#define KERNELSIZE 5 //Kernel size, must be an positive odd integer.
31 +#define KERNELHALFSIZE 2 //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
33 +float get_luma(vec4 rgba) {
34 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
37 +vec4 hook() {
39 + float gmax = 0.0;
41 + for (int i=0; i<KERNELSIZE; i++) {
42 + float g = get_luma(MAIN_texOff(vec2(i - KERNELHALFSIZE, 0)));
44 + gmax = max(g, gmax);
45 + }
47 + return vec4(gmax, 0.0, 0.0, 0.0);
50 +//!DESC Anime4K-v4.0-De-Ring-Compute-Statistics
51 +//!HOOK MAIN
52 +//!BIND HOOKED
53 +//!BIND STATSMAX
54 +//!SAVE STATSMAX
55 +//!COMPONENTS 1
57 +#define KERNELSIZE 5 //Kernel size, must be an positive odd integer.
58 +#define KERNELHALFSIZE 2 //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
60 +vec4 hook() {
62 + float gmax = 0.0;
64 + for (int i=0; i<KERNELSIZE; i++) {
65 + float g = STATSMAX_texOff(vec2(0, i - KERNELHALFSIZE)).x;
67 + gmax = max(g, gmax);
68 + }
70 + return vec4(gmax, 0.0, 0.0, 0.0);
73 +//!DESC Anime4K-v4.0-De-Ring-Clamp
74 +//!HOOK PREKERNEL
75 +//!BIND HOOKED
76 +//!BIND STATSMAX
78 +float get_luma(vec4 rgba) {
79 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
82 +vec4 hook() {
84 + float current_luma = get_luma(HOOKED_tex(HOOKED_pos));
85 + float new_luma = min(current_luma, STATSMAX_tex(HOOKED_pos).x);
87 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
88 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
89 + return HOOKED_tex(HOOKED_pos) - (current_luma - new_luma);

mpv/shaders/Anime4K_Darken_Fast.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Difference-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE LINEKERNEL
43 -//!WIDTH HOOKED.w 2 /
44 -//!HEIGHT HOOKED.h 2 /
45 -//!COMPONENTS 1
47 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
49 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 -float gaussian(float x, float s, float m) {
54 - float scaled = (x - m) / s;
55 - return exp(-0.5 * scaled * scaled);
58 -float comp_gaussian_x() {
60 - float g = 0.0;
61 - float gn = 0.0;
63 - for (int i=0; i<KERNELSIZE; i++) {
64 - float di = float(i - KERNELHALFSIZE);
65 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
67 - g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
68 - gn = gn + gf;
70 - }
72 - return g / gn;
75 -vec4 hook() {
76 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
79 -//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Difference-Y
80 -//!HOOK MAIN
81 -//!BIND HOOKED
82 -//!BIND LINELUMA
83 -//!BIND LINEKERNEL
84 -//!SAVE LINEKERNEL
85 -//!WIDTH HOOKED.w 2 /
86 -//!HEIGHT HOOKED.h 2 /
87 -//!COMPONENTS 1
89 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
91 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
92 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
93 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
95 -float gaussian(float x, float s, float m) {
96 - float scaled = (x - m) / s;
97 - return exp(-0.5 * scaled * scaled);
100 -float comp_gaussian_y() {
102 - float g = 0.0;
103 - float gn = 0.0;
105 - for (int i=0; i<KERNELSIZE; i++) {
106 - float di = float(i - KERNELHALFSIZE);
107 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
109 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
110 - gn = gn + gf;
112 - }
114 - return g / gn;
117 -vec4 hook() {
118 - return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
121 -//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Gaussian-X
122 -//!HOOK MAIN
123 -//!BIND HOOKED
124 -//!BIND LINEKERNEL
125 -//!SAVE LINEKERNEL
126 -//!WIDTH HOOKED.w 2 /
127 -//!HEIGHT HOOKED.h 2 /
128 -//!COMPONENTS 1
130 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
132 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
133 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
134 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
136 -float gaussian(float x, float s, float m) {
137 - float scaled = (x - m) / s;
138 - return exp(-0.5 * scaled * scaled);
141 -float comp_gaussian_x() {
143 - float g = 0.0;
144 - float gn = 0.0;
146 - for (int i=0; i<KERNELSIZE; i++) {
147 - float di = float(i - KERNELHALFSIZE);
148 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
150 - g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
151 - gn = gn + gf;
153 - }
155 - return g / gn;
158 -vec4 hook() {
159 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
162 -//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Gaussian-Y
163 -//!HOOK MAIN
164 -//!BIND HOOKED
165 -//!BIND LINEKERNEL
166 -//!SAVE LINEKERNEL
167 -//!WIDTH HOOKED.w 2 /
168 -//!HEIGHT HOOKED.h 2 /
169 -//!COMPONENTS 1
171 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
173 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
174 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
175 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
177 -float gaussian(float x, float s, float m) {
178 - float scaled = (x - m) / s;
179 - return exp(-0.5 * scaled * scaled);
182 -float comp_gaussian_y() {
184 - float g = 0.0;
185 - float gn = 0.0;
187 - for (int i=0; i<KERNELSIZE; i++) {
188 - float di = float(i - KERNELHALFSIZE);
189 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
191 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
192 - gn = gn + gf;
194 - }
196 - return g / gn;
199 -vec4 hook() {
200 - return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
204 -//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Upsample
205 -//!HOOK MAIN
206 -//!BIND HOOKED
207 -//!BIND LINEKERNEL
209 -#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
211 -vec4 hook() {
212 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
213 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
214 - return HOOKED_tex(HOOKED_pos) + (LINEKERNEL_tex(HOOKED_pos).x * STRENGTH);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Difference-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE LINEKERNEL
43 +//!WIDTH HOOKED.w 2 /
44 +//!HEIGHT HOOKED.h 2 /
45 +//!COMPONENTS 1
47 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
49 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 +float gaussian(float x, float s, float m) {
54 + float scaled = (x - m) / s;
55 + return exp(-0.5 * scaled * scaled);
58 +float comp_gaussian_x() {
60 + float g = 0.0;
61 + float gn = 0.0;
63 + for (int i=0; i<KERNELSIZE; i++) {
64 + float di = float(i - KERNELHALFSIZE);
65 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
67 + g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
68 + gn = gn + gf;
70 + }
72 + return g / gn;
75 +vec4 hook() {
76 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
79 +//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Difference-Y
80 +//!HOOK MAIN
81 +//!BIND HOOKED
82 +//!BIND LINELUMA
83 +//!BIND LINEKERNEL
84 +//!SAVE LINEKERNEL
85 +//!WIDTH HOOKED.w 2 /
86 +//!HEIGHT HOOKED.h 2 /
87 +//!COMPONENTS 1
89 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
91 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
92 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
93 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
95 +float gaussian(float x, float s, float m) {
96 + float scaled = (x - m) / s;
97 + return exp(-0.5 * scaled * scaled);
100 +float comp_gaussian_y() {
102 + float g = 0.0;
103 + float gn = 0.0;
105 + for (int i=0; i<KERNELSIZE; i++) {
106 + float di = float(i - KERNELHALFSIZE);
107 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
109 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
110 + gn = gn + gf;
114 + return g / gn;
117 +vec4 hook() {
118 + return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
121 +//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Gaussian-X
122 +//!HOOK MAIN
123 +//!BIND HOOKED
124 +//!BIND LINEKERNEL
125 +//!SAVE LINEKERNEL
126 +//!WIDTH HOOKED.w 2 /
127 +//!HEIGHT HOOKED.h 2 /
128 +//!COMPONENTS 1
130 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
132 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
133 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
134 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
136 +float gaussian(float x, float s, float m) {
137 + float scaled = (x - m) / s;
138 + return exp(-0.5 * scaled * scaled);
141 +float comp_gaussian_x() {
143 + float g = 0.0;
144 + float gn = 0.0;
146 + for (int i=0; i<KERNELSIZE; i++) {
147 + float di = float(i - KERNELHALFSIZE);
148 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
150 + g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
151 + gn = gn + gf;
155 + return g / gn;
158 +vec4 hook() {
159 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
162 +//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Gaussian-Y
163 +//!HOOK MAIN
164 +//!BIND HOOKED
165 +//!BIND LINEKERNEL
166 +//!SAVE LINEKERNEL
167 +//!WIDTH HOOKED.w 2 /
168 +//!HEIGHT HOOKED.h 2 /
169 +//!COMPONENTS 1
171 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
173 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
174 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
175 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
177 +float gaussian(float x, float s, float m) {
178 + float scaled = (x - m) / s;
179 + return exp(-0.5 * scaled * scaled);
182 +float comp_gaussian_y() {
184 + float g = 0.0;
185 + float gn = 0.0;
187 + for (int i=0; i<KERNELSIZE; i++) {
188 + float di = float(i - KERNELHALFSIZE);
189 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
191 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
192 + gn = gn + gf;
196 + return g / gn;
199 +vec4 hook() {
200 + return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
204 +//!DESC Anime4K-v3.2-Darken-DoG-(Fast)-Upsample
205 +//!HOOK MAIN
206 +//!BIND HOOKED
207 +//!BIND LINEKERNEL
209 +#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
211 +vec4 hook() {
212 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
213 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
214 + return HOOKED_tex(HOOKED_pos) + (LINEKERNEL_tex(HOOKED_pos).x * STRENGTH);

mpv/shaders/Anime4K_Darken_HQ.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Difference-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE LINEKERNEL
43 -//!COMPONENTS 1
45 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
47 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
48 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
49 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
51 -float gaussian(float x, float s, float m) {
52 - float scaled = (x - m) / s;
53 - return exp(-0.5 * scaled * scaled);
56 -float comp_gaussian_x() {
58 - float g = 0.0;
59 - float gn = 0.0;
61 - for (int i=0; i<KERNELSIZE; i++) {
62 - float di = float(i - KERNELHALFSIZE);
63 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
65 - g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
66 - gn = gn + gf;
68 - }
70 - return g / gn;
73 -vec4 hook() {
74 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
77 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Difference-Y
78 -//!HOOK MAIN
79 -//!BIND HOOKED
80 -//!BIND LINELUMA
81 -//!BIND LINEKERNEL
82 -//!SAVE LINEKERNEL
83 -//!COMPONENTS 1
85 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
87 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
88 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
89 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
91 -float gaussian(float x, float s, float m) {
92 - float scaled = (x - m) / s;
93 - return exp(-0.5 * scaled * scaled);
96 -float comp_gaussian_y() {
98 - float g = 0.0;
99 - float gn = 0.0;
101 - for (int i=0; i<KERNELSIZE; i++) {
102 - float di = float(i - KERNELHALFSIZE);
103 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
105 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
106 - gn = gn + gf;
108 - }
110 - return g / gn;
113 -vec4 hook() {
114 - return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
117 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Gaussian-X
118 -//!HOOK MAIN
119 -//!BIND HOOKED
120 -//!BIND LINEKERNEL
121 -//!SAVE LINEKERNEL
122 -//!COMPONENTS 1
124 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
126 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
127 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
128 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
130 -float gaussian(float x, float s, float m) {
131 - float scaled = (x - m) / s;
132 - return exp(-0.5 * scaled * scaled);
135 -float comp_gaussian_x() {
137 - float g = 0.0;
138 - float gn = 0.0;
140 - for (int i=0; i<KERNELSIZE; i++) {
141 - float di = float(i - KERNELHALFSIZE);
142 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
144 - g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
145 - gn = gn + gf;
147 - }
149 - return g / gn;
152 -vec4 hook() {
153 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
156 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Gaussian-Y
157 -//!HOOK MAIN
158 -//!BIND HOOKED
159 -//!BIND LINEKERNEL
161 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
163 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
164 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
165 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
167 -float gaussian(float x, float s, float m) {
168 - float scaled = (x - m) / s;
169 - return exp(-0.5 * scaled * scaled);
172 -float comp_gaussian_y() {
174 - float g = 0.0;
175 - float gn = 0.0;
177 - for (int i=0; i<KERNELSIZE; i++) {
178 - float di = float(i - KERNELHALFSIZE);
179 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
181 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
182 - gn = gn + gf;
184 - }
186 - return g / gn;
191 -#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
193 -vec4 hook() {
194 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
195 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
196 - return HOOKED_tex(HOOKED_pos) + (comp_gaussian_y() * STRENGTH);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Difference-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE LINEKERNEL
43 +//!COMPONENTS 1
45 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
47 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
48 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
49 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
51 +float gaussian(float x, float s, float m) {
52 + float scaled = (x - m) / s;
53 + return exp(-0.5 * scaled * scaled);
56 +float comp_gaussian_x() {
58 + float g = 0.0;
59 + float gn = 0.0;
61 + for (int i=0; i<KERNELSIZE; i++) {
62 + float di = float(i - KERNELHALFSIZE);
63 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
65 + g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
66 + gn = gn + gf;
68 + }
70 + return g / gn;
73 +vec4 hook() {
74 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
77 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Difference-Y
78 +//!HOOK MAIN
79 +//!BIND HOOKED
80 +//!BIND LINELUMA
81 +//!BIND LINEKERNEL
82 +//!SAVE LINEKERNEL
83 +//!COMPONENTS 1
85 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
87 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
88 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
89 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
91 +float gaussian(float x, float s, float m) {
92 + float scaled = (x - m) / s;
93 + return exp(-0.5 * scaled * scaled);
96 +float comp_gaussian_y() {
98 + float g = 0.0;
99 + float gn = 0.0;
101 + for (int i=0; i<KERNELSIZE; i++) {
102 + float di = float(i - KERNELHALFSIZE);
103 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
105 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
106 + gn = gn + gf;
110 + return g / gn;
113 +vec4 hook() {
114 + return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
117 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Gaussian-X
118 +//!HOOK MAIN
119 +//!BIND HOOKED
120 +//!BIND LINEKERNEL
121 +//!SAVE LINEKERNEL
122 +//!COMPONENTS 1
124 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
126 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
127 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
128 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
130 +float gaussian(float x, float s, float m) {
131 + float scaled = (x - m) / s;
132 + return exp(-0.5 * scaled * scaled);
135 +float comp_gaussian_x() {
137 + float g = 0.0;
138 + float gn = 0.0;
140 + for (int i=0; i<KERNELSIZE; i++) {
141 + float di = float(i - KERNELHALFSIZE);
142 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
144 + g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
145 + gn = gn + gf;
149 + return g / gn;
152 +vec4 hook() {
153 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
156 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Gaussian-Y
157 +//!HOOK MAIN
158 +//!BIND HOOKED
159 +//!BIND LINEKERNEL
161 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
163 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
164 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
165 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
167 +float gaussian(float x, float s, float m) {
168 + float scaled = (x - m) / s;
169 + return exp(-0.5 * scaled * scaled);
172 +float comp_gaussian_y() {
174 + float g = 0.0;
175 + float gn = 0.0;
177 + for (int i=0; i<KERNELSIZE; i++) {
178 + float di = float(i - KERNELHALFSIZE);
179 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
181 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
182 + gn = gn + gf;
186 + return g / gn;
191 +#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
193 +vec4 hook() {
194 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
195 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
196 + return HOOKED_tex(HOOKED_pos) + (comp_gaussian_y() * STRENGTH);

mpv/shaders/Anime4K_Darken_VeryFast.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!WIDTH HOOKED.w 2 /
29 -//!HEIGHT HOOKED.h 2 /
30 -//!COMPONENTS 1
32 -float get_luma(vec4 rgba) {
33 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
36 -vec4 hook() {
37 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
40 -//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-X
41 -//!HOOK MAIN
42 -//!BIND HOOKED
43 -//!BIND LINELUMA
44 -//!SAVE LINEKERNEL
45 -//!WIDTH HOOKED.w 4 /
46 -//!HEIGHT HOOKED.h 4 /
47 -//!COMPONENTS 1
49 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
51 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
52 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
53 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
55 -float gaussian(float x, float s, float m) {
56 - float scaled = (x - m) / s;
57 - return exp(-0.5 * scaled * scaled);
60 -float comp_gaussian_x() {
62 - float g = 0.0;
63 - float gn = 0.0;
65 - for (int i=0; i<KERNELSIZE; i++) {
66 - float di = float(i - KERNELHALFSIZE);
67 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
69 - g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
70 - gn = gn + gf;
72 - }
74 - return g / gn;
77 -vec4 hook() {
78 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
81 -//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-Y
82 -//!HOOK MAIN
83 -//!BIND HOOKED
84 -//!BIND LINELUMA
85 -//!BIND LINEKERNEL
86 -//!SAVE LINEKERNEL
87 -//!WIDTH HOOKED.w 4 /
88 -//!HEIGHT HOOKED.h 4 /
89 -//!COMPONENTS 1
91 -#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
93 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
94 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
95 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
97 -float gaussian(float x, float s, float m) {
98 - float scaled = (x - m) / s;
99 - return exp(-0.5 * scaled * scaled);
102 -float comp_gaussian_y() {
104 - float g = 0.0;
105 - float gn = 0.0;
107 - for (int i=0; i<KERNELSIZE; i++) {
108 - float di = float(i - KERNELHALFSIZE);
109 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
111 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
112 - gn = gn + gf;
114 - }
116 - return g / gn;
119 -vec4 hook() {
120 - return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
123 -//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-X
124 -//!HOOK MAIN
125 -//!BIND HOOKED
126 -//!BIND LINEKERNEL
127 -//!SAVE LINEKERNEL
128 -//!WIDTH HOOKED.w 4 /
129 -//!HEIGHT HOOKED.h 4 /
130 -//!COMPONENTS 1
132 -#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
134 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
135 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
136 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
138 -float gaussian(float x, float s, float m) {
139 - float scaled = (x - m) / s;
140 - return exp(-0.5 * scaled * scaled);
143 -float comp_gaussian_x() {
145 - float g = 0.0;
146 - float gn = 0.0;
148 - for (int i=0; i<KERNELSIZE; i++) {
149 - float di = float(i - KERNELHALFSIZE);
150 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
152 - g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
153 - gn = gn + gf;
155 - }
157 - return g / gn;
160 -vec4 hook() {
161 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
164 -//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-Y
165 -//!HOOK MAIN
166 -//!BIND HOOKED
167 -//!BIND LINEKERNEL
168 -//!SAVE LINEKERNEL
169 -//!WIDTH HOOKED.w 4 /
170 -//!HEIGHT HOOKED.h 4 /
171 -//!COMPONENTS 1
173 -#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
175 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
176 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
177 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
179 -float gaussian(float x, float s, float m) {
180 - float scaled = (x - m) / s;
181 - return exp(-0.5 * scaled * scaled);
184 -float comp_gaussian_y() {
186 - float g = 0.0;
187 - float gn = 0.0;
189 - for (int i=0; i<KERNELSIZE; i++) {
190 - float di = float(i - KERNELHALFSIZE);
191 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
193 - g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
194 - gn = gn + gf;
196 - }
198 - return g / gn;
201 -vec4 hook() {
202 - return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
206 -//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Upsample
207 -//!HOOK MAIN
208 -//!BIND HOOKED
209 -//!BIND LINEKERNEL
211 -#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
213 -vec4 hook() {
214 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
215 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
216 - return HOOKED_tex(HOOKED_pos) + (LINEKERNEL_tex(HOOKED_pos).x * STRENGTH);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Darken-DoG-(HQ)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!WIDTH HOOKED.w 2 /
29 +//!HEIGHT HOOKED.h 2 /
30 +//!COMPONENTS 1
32 +float get_luma(vec4 rgba) {
33 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
36 +vec4 hook() {
37 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
40 +//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-X
41 +//!HOOK MAIN
42 +//!BIND HOOKED
43 +//!BIND LINELUMA
44 +//!SAVE LINEKERNEL
45 +//!WIDTH HOOKED.w 4 /
46 +//!HEIGHT HOOKED.h 4 /
47 +//!COMPONENTS 1
49 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
51 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
52 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
53 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
55 +float gaussian(float x, float s, float m) {
56 + float scaled = (x - m) / s;
57 + return exp(-0.5 * scaled * scaled);
60 +float comp_gaussian_x() {
62 + float g = 0.0;
63 + float gn = 0.0;
65 + for (int i=0; i<KERNELSIZE; i++) {
66 + float di = float(i - KERNELHALFSIZE);
67 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
69 + g = g + LINELUMA_texOff(vec2(di, 0.0)).x * gf;
70 + gn = gn + gf;
72 + }
74 + return g / gn;
77 +vec4 hook() {
78 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
81 +//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-Y
82 +//!HOOK MAIN
83 +//!BIND HOOKED
84 +//!BIND LINELUMA
85 +//!BIND LINEKERNEL
86 +//!SAVE LINEKERNEL
87 +//!WIDTH HOOKED.w 4 /
88 +//!HEIGHT HOOKED.h 4 /
89 +//!COMPONENTS 1
91 +#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
93 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
94 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
95 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
97 +float gaussian(float x, float s, float m) {
98 + float scaled = (x - m) / s;
99 + return exp(-0.5 * scaled * scaled);
102 +float comp_gaussian_y() {
104 + float g = 0.0;
105 + float gn = 0.0;
107 + for (int i=0; i<KERNELSIZE; i++) {
108 + float di = float(i - KERNELHALFSIZE);
109 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
111 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
112 + gn = gn + gf;
116 + return g / gn;
119 +vec4 hook() {
120 + return vec4(min(LINELUMA_tex(HOOKED_pos).x - comp_gaussian_y(), 0.0), 0.0, 0.0, 0.0);
123 +//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-X
124 +//!HOOK MAIN
125 +//!BIND HOOKED
126 +//!BIND LINEKERNEL
127 +//!SAVE LINEKERNEL
128 +//!WIDTH HOOKED.w 4 /
129 +//!HEIGHT HOOKED.h 4 /
130 +//!COMPONENTS 1
132 +#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
134 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
135 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
136 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
138 +float gaussian(float x, float s, float m) {
139 + float scaled = (x - m) / s;
140 + return exp(-0.5 * scaled * scaled);
143 +float comp_gaussian_x() {
145 + float g = 0.0;
146 + float gn = 0.0;
148 + for (int i=0; i<KERNELSIZE; i++) {
149 + float di = float(i - KERNELHALFSIZE);
150 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
152 + g = g + LINEKERNEL_texOff(vec2(di, 0.0)).x * gf;
153 + gn = gn + gf;
157 + return g / gn;
160 +vec4 hook() {
161 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
164 +//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Gaussian-Y
165 +//!HOOK MAIN
166 +//!BIND HOOKED
167 +//!BIND LINEKERNEL
168 +//!SAVE LINEKERNEL
169 +//!WIDTH HOOKED.w 4 /
170 +//!HEIGHT HOOKED.h 4 /
171 +//!COMPONENTS 1
173 +#define SPATIAL_SIGMA (0.25 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
175 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
176 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
177 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
179 +float gaussian(float x, float s, float m) {
180 + float scaled = (x - m) / s;
181 + return exp(-0.5 * scaled * scaled);
184 +float comp_gaussian_y() {
186 + float g = 0.0;
187 + float gn = 0.0;
189 + for (int i=0; i<KERNELSIZE; i++) {
190 + float di = float(i - KERNELHALFSIZE);
191 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
193 + g = g + LINEKERNEL_texOff(vec2(0.0, di)).x * gf;
194 + gn = gn + gf;
198 + return g / gn;
201 +vec4 hook() {
202 + return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
206 +//!DESC Anime4K-v3.2-Darken-DoG-(VeryFast)-Upsample
207 +//!HOOK MAIN
208 +//!BIND HOOKED
209 +//!BIND LINEKERNEL
211 +#define STRENGTH 1.5 //Line darken proportional strength, higher is darker.
213 +vec4 hook() {
214 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
215 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
216 + return HOOKED_tex(HOOKED_pos) + (LINEKERNEL_tex(HOOKED_pos).x * STRENGTH);

mpv/shaders/Anime4K_Deblur_DoG.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Deblur-DoG-(HQ)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Deblur-DoG-Kernel-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE MMKERNEL
43 -//!COMPONENTS 3
45 -#define L_tex LINELUMA_tex
47 -float max3v(float a, float b, float c) {
48 - return max(max(a, b), c);
50 -float min3v(float a, float b, float c) {
51 - return min(min(a, b), c);
54 -vec2 minmax3(vec2 pos, vec2 d) {
55 - float a = L_tex(pos - d).x;
56 - float b = L_tex(pos).x;
57 - float c = L_tex(pos + d).x;
59 - return vec2(min3v(a, b, c), max3v(a, b, c));
62 -float lumGaussian7(vec2 pos, vec2 d) {
63 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
64 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
65 - g = g + (L_tex(pos).x) * 0.38774;
67 - return g;
71 -vec4 hook() {
72 - return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0.0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0.0)), 0.0);
76 -//!DESC Anime4K-v3.2-Deblur-DoG-Kernel-Y
77 -//!HOOK MAIN
78 -//!BIND HOOKED
79 -//!BIND MMKERNEL
80 -//!SAVE MMKERNEL
81 -//!COMPONENTS 3
83 -#define L_tex MMKERNEL_tex
85 -float max3v(float a, float b, float c) {
86 - return max(max(a, b), c);
88 -float min3v(float a, float b, float c) {
89 - return min(min(a, b), c);
92 -vec2 minmax3(vec2 pos, vec2 d) {
93 - float a0 = L_tex(pos - d).y;
94 - float b0 = L_tex(pos).y;
95 - float c0 = L_tex(pos + d).y;
97 - float a1 = L_tex(pos - d).z;
98 - float b1 = L_tex(pos).z;
99 - float c1 = L_tex(pos + d).z;
101 - return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
104 -float lumGaussian7(vec2 pos, vec2 d) {
105 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
106 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
107 - g = g + (L_tex(pos).x) * 0.38774;
109 - return g;
113 -vec4 hook() {
114 - return vec4(lumGaussian7(HOOKED_pos, vec2(0.0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0.0, HOOKED_pt.y)), 0.0);
117 -//!DESC Anime4K-v3.2-Deblur-DoG-Apply
118 -//!HOOK MAIN
119 -//!BIND HOOKED
120 -//!BIND LINELUMA
121 -//!BIND MMKERNEL
123 -#define STRENGTH 0.6 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
124 -#define BLUR_CURVE 0.6 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
125 -#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
126 -#define NOISE_THRESHOLD 0.001 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
128 -#define L_tex LINELUMA_tex
130 -vec4 hook() {
131 - float c = (L_tex(HOOKED_pos).x - MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
133 - float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
135 - float c_t = abs(c);
136 - if (c_t > NOISE_THRESHOLD) {
137 - c_t = (c_t - NOISE_THRESHOLD) / t_range;
138 - c_t = pow(c_t, BLUR_CURVE);
139 - c_t = c_t * t_range + NOISE_THRESHOLD;
140 - c_t = c_t * sign(c);
141 - } else {
142 - c_t = c;
143 - }
145 - float cc = clamp(c_t + L_tex(HOOKED_pos).x, MMKERNEL_tex(HOOKED_pos).y, MMKERNEL_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
147 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
148 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
149 - return HOOKED_tex(HOOKED_pos) + cc;
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Deblur-DoG-(HQ)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Deblur-DoG-Kernel-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE MMKERNEL
43 +//!COMPONENTS 3
45 +#define L_tex LINELUMA_tex
47 +float max3v(float a, float b, float c) {
48 + return max(max(a, b), c);
50 +float min3v(float a, float b, float c) {
51 + return min(min(a, b), c);
54 +vec2 minmax3(vec2 pos, vec2 d) {
55 + float a = L_tex(pos - d).x;
56 + float b = L_tex(pos).x;
57 + float c = L_tex(pos + d).x;
59 + return vec2(min3v(a, b, c), max3v(a, b, c));
62 +float lumGaussian7(vec2 pos, vec2 d) {
63 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
64 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
65 + g = g + (L_tex(pos).x) * 0.38774;
67 + return g;
71 +vec4 hook() {
72 + return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0.0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0.0)), 0.0);
76 +//!DESC Anime4K-v3.2-Deblur-DoG-Kernel-Y
77 +//!HOOK MAIN
78 +//!BIND HOOKED
79 +//!BIND MMKERNEL
80 +//!SAVE MMKERNEL
81 +//!COMPONENTS 3
83 +#define L_tex MMKERNEL_tex
85 +float max3v(float a, float b, float c) {
86 + return max(max(a, b), c);
88 +float min3v(float a, float b, float c) {
89 + return min(min(a, b), c);
92 +vec2 minmax3(vec2 pos, vec2 d) {
93 + float a0 = L_tex(pos - d).y;
94 + float b0 = L_tex(pos).y;
95 + float c0 = L_tex(pos + d).y;
97 + float a1 = L_tex(pos - d).z;
98 + float b1 = L_tex(pos).z;
99 + float c1 = L_tex(pos + d).z;
101 + return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
104 +float lumGaussian7(vec2 pos, vec2 d) {
105 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
106 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
107 + g = g + (L_tex(pos).x) * 0.38774;
109 + return g;
113 +vec4 hook() {
114 + return vec4(lumGaussian7(HOOKED_pos, vec2(0.0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0.0, HOOKED_pt.y)), 0.0);
117 +//!DESC Anime4K-v3.2-Deblur-DoG-Apply
118 +//!HOOK MAIN
119 +//!BIND HOOKED
120 +//!BIND LINELUMA
121 +//!BIND MMKERNEL
123 +#define STRENGTH 0.6 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
124 +#define BLUR_CURVE 0.6 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
125 +#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
126 +#define NOISE_THRESHOLD 0.001 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
128 +#define L_tex LINELUMA_tex
130 +vec4 hook() {
131 + float c = (L_tex(HOOKED_pos).x - MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
133 + float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
135 + float c_t = abs(c);
136 + if (c_t > NOISE_THRESHOLD) {
137 + c_t = (c_t - NOISE_THRESHOLD) / t_range;
138 + c_t = pow(c_t, BLUR_CURVE);
139 + c_t = c_t * t_range + NOISE_THRESHOLD;
140 + c_t = c_t * sign(c);
141 + } else {
142 + c_t = c;
145 + float cc = clamp(c_t + L_tex(HOOKED_pos).x, MMKERNEL_tex(HOOKED_pos).y, MMKERNEL_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
147 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
148 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
149 + return HOOKED_tex(HOOKED_pos) + cc;

mpv/shaders/Anime4K_Deblur_Original.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Deblur-Original-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Deblur-Original-Kernel-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE LUMAD
43 -//!WIDTH MAIN.w 2 *
44 -//!HEIGHT MAIN.h 2 *
45 -//!COMPONENTS 2
47 -vec4 hook() {
48 - vec2 d = HOOKED_pt;
50 - //[tl t tr]
51 - //[ l c r]
52 - //[bl b br]
53 - float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 - float c = LINELUMA_tex(HOOKED_pos).x;
55 - float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 - //Horizontal Gradient
59 - //[-1 0 1]
60 - //[-2 0 2]
61 - //[-1 0 1]
62 - float xgrad = (-l + r);
64 - //Vertical Gradient
65 - //[-1 -2 -1]
66 - //[ 0 0 0]
67 - //[ 1 2 1]
68 - float ygrad = (l + c + c + r);
70 - //Computes the luminance's gradient
71 - return vec4(xgrad, ygrad, 0.0, 0.0);
75 -//!DESC Anime4K-v3.2-Deblur-Original-Kernel-Y
76 -//!HOOK MAIN
77 -//!BIND HOOKED
78 -//!BIND LUMAD
79 -//!SAVE LUMAD
80 -//!WIDTH MAIN.w 2 *
81 -//!HEIGHT MAIN.h 2 *
82 -//!COMPONENTS 2
85 -/* --------------------- SETTINGS --------------------- */
87 -//Strength of edge refinement, good values are between 0.2 and 4
88 -#define REFINE_STRENGTH 1.0
91 -/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 -//Bias of the refinement function, good values are between 0 and 1
94 -#define REFINE_BIAS 0.0
96 -//Polynomial fit obtained by minimizing MSE error on image
97 -#define P5 ( 11.68129591)
98 -#define P4 (-42.46906057)
99 -#define P3 ( 60.28286266)
100 -#define P2 (-41.84451327)
101 -#define P1 ( 14.05517353)
102 -#define P0 (-1.081521930)
104 -/* ----------------- END OF SETTINGS ----------------- */
106 -float power_function(float x) {
107 - float x2 = x * x;
108 - float x3 = x2 * x;
109 - float x4 = x2 * x2;
110 - float x5 = x2 * x3;
112 - return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 -vec4 hook() {
116 - vec2 d = HOOKED_pt;
118 - //[tl t tr]
119 - //[ l cc r]
120 - //[bl b br]
121 - float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 - float cx = LUMAD_tex(HOOKED_pos).x;
123 - float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 - float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 - //float cy = LUMAD_tex(HOOKED_pos).y;
128 - float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 - //Horizontal Gradient
132 - //[-1 0 1]
133 - //[-2 0 2]
134 - //[-1 0 1]
135 - float xgrad = (tx + cx + cx + bx);
137 - //Vertical Gradient
138 - //[-1 -2 -1]
139 - //[ 0 0 0]
140 - //[ 1 2 1]
141 - float ygrad = (-ty + by);
143 - //Computes the luminance's gradient
144 - float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 - float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 - return vec4(sobel_norm, dval, 0.0, 0.0);
151 -//!DESC Anime4K-v3.2-Deblur-Original-Kernel-X
152 -//!HOOK MAIN
153 -//!BIND HOOKED
154 -//!BIND LUMAD
155 -//!SAVE LUMAMM
156 -//!WIDTH MAIN.w 2 *
157 -//!HEIGHT MAIN.h 2 *
158 -//!COMPONENTS 2
161 -vec4 hook() {
162 - vec2 d = HOOKED_pt;
164 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 - return vec4(0.0);
166 - }
168 - //[tl t tr]
169 - //[ l c r]
170 - //[bl b br]
171 - float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 - float c = LUMAD_tex(HOOKED_pos).x;
173 - float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 - //Horizontal Gradient
176 - //[-1 0 1]
177 - //[-2 0 2]
178 - //[-1 0 1]
179 - float xgrad = (-l + r);
181 - //Vertical Gradient
182 - //[-1 -2 -1]
183 - //[ 0 0 0]
184 - //[ 1 2 1]
185 - float ygrad = (l + c + c + r);
188 - return vec4(xgrad, ygrad, 0.0, 0.0);
192 -//!DESC Anime4K-v3.2-Deblur-Original-Kernel-Y
193 -//!HOOK MAIN
194 -//!BIND HOOKED
195 -//!BIND LUMAD
196 -//!BIND LUMAMM
197 -//!SAVE LUMAMM
198 -//!WIDTH MAIN.w 2 *
199 -//!HEIGHT MAIN.h 2 *
200 -//!COMPONENTS 2
202 -vec4 hook() {
203 - vec2 d = HOOKED_pt;
205 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 - return vec4(0.0);
207 - }
209 - //[tl t tr]
210 - //[ l cc r]
211 - //[bl b br]
212 - float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 - float cx = LUMAMM_tex(HOOKED_pos).x;
214 - float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 - float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 - //float cy = LUMAMM_tex(HOOKED_pos).y;
218 - float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 - //Horizontal Gradient
221 - //[-1 0 1]
222 - //[-2 0 2]
223 - //[-1 0 1]
224 - float xgrad = (tx + cx + cx + bx);
226 - //Vertical Gradient
227 - //[-1 -2 -1]
228 - //[ 0 0 0]
229 - //[ 1 2 1]
230 - float ygrad = (-ty + by);
232 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 - if (norm <= 0.001) {
234 - xgrad = 0.0;
235 - ygrad = 0.0;
236 - norm = 1.0;
237 - }
239 - return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 -//!DESC Anime4K-v3.2-Deblur-Original-Apply
244 -//!HOOK MAIN
245 -//!BIND HOOKED
246 -//!BIND LUMAD
247 -//!BIND LUMAMM
248 -//!WIDTH MAIN.w 2 *
249 -//!HEIGHT MAIN.h 2 *
250 -//!SAVE RESAMPLED
253 -vec4 hook() {
254 - vec2 d = HOOKED_pt;
256 - float dval = LUMAD_tex(HOOKED_pos).y;
257 - if (dval < 0.1) {
258 - return HOOKED_tex(HOOKED_pos);
259 - }
261 - vec4 dc = LUMAMM_tex(HOOKED_pos);
262 - if (abs(dc.x + dc.y) <= 0.0001) {
263 - return HOOKED_tex(HOOKED_pos);
264 - }
266 - float xpos = -sign(dc.x);
267 - float ypos = -sign(dc.y);
269 - vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
270 - vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
272 - float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
274 - vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
276 - return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);
280 -//!DESC Anime4K-v3.2-Deblur-Original-Resample
281 -//!HOOK MAIN
282 -//!BIND HOOKED
283 -//!BIND RESAMPLED
285 -vec4 hook() {
286 - return RESAMPLED_tex(HOOKED_pos);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Deblur-Original-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Deblur-Original-Kernel-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE LUMAD
43 +//!WIDTH MAIN.w 2 *
44 +//!HEIGHT MAIN.h 2 *
45 +//!COMPONENTS 2
47 +vec4 hook() {
48 + vec2 d = HOOKED_pt;
50 + //[tl t tr]
51 + //[ l c r]
52 + //[bl b br]
53 + float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 + float c = LINELUMA_tex(HOOKED_pos).x;
55 + float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 + //Horizontal Gradient
59 + //[-1 0 1]
60 + //[-2 0 2]
61 + //[-1 0 1]
62 + float xgrad = (-l + r);
64 + //Vertical Gradient
65 + //[-1 -2 -1]
66 + //[ 0 0 0]
67 + //[ 1 2 1]
68 + float ygrad = (l + c + c + r);
70 + //Computes the luminance's gradient
71 + return vec4(xgrad, ygrad, 0.0, 0.0);
75 +//!DESC Anime4K-v3.2-Deblur-Original-Kernel-Y
76 +//!HOOK MAIN
77 +//!BIND HOOKED
78 +//!BIND LUMAD
79 +//!SAVE LUMAD
80 +//!WIDTH MAIN.w 2 *
81 +//!HEIGHT MAIN.h 2 *
82 +//!COMPONENTS 2
85 +/* --------------------- SETTINGS --------------------- */
87 +//Strength of edge refinement, good values are between 0.2 and 4
88 +#define REFINE_STRENGTH 1.0
91 +/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 +//Bias of the refinement function, good values are between 0 and 1
94 +#define REFINE_BIAS 0.0
96 +//Polynomial fit obtained by minimizing MSE error on image
97 +#define P5 ( 11.68129591)
98 +#define P4 (-42.46906057)
99 +#define P3 ( 60.28286266)
100 +#define P2 (-41.84451327)
101 +#define P1 ( 14.05517353)
102 +#define P0 (-1.081521930)
104 +/* ----------------- END OF SETTINGS ----------------- */
106 +float power_function(float x) {
107 + float x2 = x * x;
108 + float x3 = x2 * x;
109 + float x4 = x2 * x2;
110 + float x5 = x2 * x3;
112 + return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 +vec4 hook() {
116 + vec2 d = HOOKED_pt;
118 + //[tl t tr]
119 + //[ l cc r]
120 + //[bl b br]
121 + float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 + float cx = LUMAD_tex(HOOKED_pos).x;
123 + float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 + float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 + //float cy = LUMAD_tex(HOOKED_pos).y;
128 + float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 + //Horizontal Gradient
132 + //[-1 0 1]
133 + //[-2 0 2]
134 + //[-1 0 1]
135 + float xgrad = (tx + cx + cx + bx);
137 + //Vertical Gradient
138 + //[-1 -2 -1]
139 + //[ 0 0 0]
140 + //[ 1 2 1]
141 + float ygrad = (-ty + by);
143 + //Computes the luminance's gradient
144 + float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 + float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 + return vec4(sobel_norm, dval, 0.0, 0.0);
151 +//!DESC Anime4K-v3.2-Deblur-Original-Kernel-X
152 +//!HOOK MAIN
153 +//!BIND HOOKED
154 +//!BIND LUMAD
155 +//!SAVE LUMAMM
156 +//!WIDTH MAIN.w 2 *
157 +//!HEIGHT MAIN.h 2 *
158 +//!COMPONENTS 2
161 +vec4 hook() {
162 + vec2 d = HOOKED_pt;
164 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 + return vec4(0.0);
168 + //[tl t tr]
169 + //[ l c r]
170 + //[bl b br]
171 + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 + float c = LUMAD_tex(HOOKED_pos).x;
173 + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 + //Horizontal Gradient
176 + //[-1 0 1]
177 + //[-2 0 2]
178 + //[-1 0 1]
179 + float xgrad = (-l + r);
181 + //Vertical Gradient
182 + //[-1 -2 -1]
183 + //[ 0 0 0]
184 + //[ 1 2 1]
185 + float ygrad = (l + c + c + r);
188 + return vec4(xgrad, ygrad, 0.0, 0.0);
192 +//!DESC Anime4K-v3.2-Deblur-Original-Kernel-Y
193 +//!HOOK MAIN
194 +//!BIND HOOKED
195 +//!BIND LUMAD
196 +//!BIND LUMAMM
197 +//!SAVE LUMAMM
198 +//!WIDTH MAIN.w 2 *
199 +//!HEIGHT MAIN.h 2 *
200 +//!COMPONENTS 2
202 +vec4 hook() {
203 + vec2 d = HOOKED_pt;
205 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 + return vec4(0.0);
209 + //[tl t tr]
210 + //[ l cc r]
211 + //[bl b br]
212 + float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 + float cx = LUMAMM_tex(HOOKED_pos).x;
214 + float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 + float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 + //float cy = LUMAMM_tex(HOOKED_pos).y;
218 + float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 + //Horizontal Gradient
221 + //[-1 0 1]
222 + //[-2 0 2]
223 + //[-1 0 1]
224 + float xgrad = (tx + cx + cx + bx);
226 + //Vertical Gradient
227 + //[-1 -2 -1]
228 + //[ 0 0 0]
229 + //[ 1 2 1]
230 + float ygrad = (-ty + by);
232 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 + if (norm <= 0.001) {
234 + xgrad = 0.0;
235 + ygrad = 0.0;
236 + norm = 1.0;
239 + return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 +//!DESC Anime4K-v3.2-Deblur-Original-Apply
244 +//!HOOK MAIN
245 +//!BIND HOOKED
246 +//!BIND LUMAD
247 +//!BIND LUMAMM
248 +//!WIDTH MAIN.w 2 *
249 +//!HEIGHT MAIN.h 2 *
250 +//!SAVE RESAMPLED
253 +vec4 hook() {
254 + vec2 d = HOOKED_pt;
256 + float dval = LUMAD_tex(HOOKED_pos).y;
257 + if (dval < 0.1) {
258 + return HOOKED_tex(HOOKED_pos);
261 + vec4 dc = LUMAMM_tex(HOOKED_pos);
262 + if (abs(dc.x + dc.y) <= 0.0001) {
263 + return HOOKED_tex(HOOKED_pos);
266 + float xpos = -sign(dc.x);
267 + float ypos = -sign(dc.y);
269 + vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
270 + vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
272 + float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
274 + vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
276 + return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);
280 +//!DESC Anime4K-v3.2-Deblur-Original-Resample
281 +//!HOOK MAIN
282 +//!BIND HOOKED
283 +//!BIND RESAMPLED
285 +vec4 hook() {
286 + return RESAMPLED_tex(HOOKED_pos);

mpv/shaders/Anime4K_Denoise_Bilateral_Mean.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Denoise-Bilateral-Mean
25 -//!HOOK MAIN
26 -//!BIND HOOKED
28 -#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
29 -#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
31 -#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
33 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
34 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
35 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
37 -#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
39 -vec4 gaussian_vec(vec4 x, vec4 s, vec4 m) {
40 - vec4 scaled = (x - m) / s;
41 - return exp(-0.5 * scaled * scaled);
42 -}
44 -float gaussian(float x, float s, float m) {
45 - float scaled = (x - m) / s;
46 - return exp(-0.5 * scaled * scaled);
47 -}
49 -vec4 hook() {
50 - vec4 sum = vec4(0.0);
51 - vec4 n = vec4(0.0);
52 -
53 - vec4 vc = HOOKED_tex(HOOKED_pos);
54 -
55 - vec4 is = pow(vc + 0.0001, vec4(INTENSITY_POWER_CURVE)) * INTENSITY_SIGMA;
56 - float ss = SPATIAL_SIGMA;
57 -
58 - for (int i=0; i<KERNELLEN; i++) {
59 - vec2 ipos = GETOFFSET(i);
60 - vec4 v = HOOKED_texOff(ipos);
61 - vec4 d = gaussian_vec(v, is, vc) * gaussian(length(ipos), ss, 0.0);
62 - sum += d * v;
63 - n += d;
64 - }
65 -
66 - return sum / n;
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Denoise-Bilateral-Mean
25 +//!HOOK MAIN
26 +//!BIND HOOKED
28 +#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
29 +#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
31 +#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
33 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
34 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
35 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
37 +#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
39 +vec4 gaussian_vec(vec4 x, vec4 s, vec4 m) {
40 + vec4 scaled = (x - m) / s;
41 + return exp(-0.5 * scaled * scaled);
44 +float gaussian(float x, float s, float m) {
45 + float scaled = (x - m) / s;
46 + return exp(-0.5 * scaled * scaled);
49 +vec4 hook() {
50 + vec4 sum = vec4(0.0);
51 + vec4 n = vec4(0.0);
53 + vec4 vc = HOOKED_tex(HOOKED_pos);
55 + vec4 is = pow(vc + 0.0001, vec4(INTENSITY_POWER_CURVE)) * INTENSITY_SIGMA;
56 + float ss = SPATIAL_SIGMA;
58 + for (int i=0; i<KERNELLEN; i++) {
59 + vec2 ipos = GETOFFSET(i);
60 + vec4 v = HOOKED_texOff(ipos);
61 + vec4 d = gaussian_vec(v, is, vc) * gaussian(length(ipos), ss, 0.0);
62 + sum += d * v;
63 + n += d;
64 + }
66 + return sum / n;

mpv/shaders/Anime4K_Denoise_Bilateral_Median.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Denoise-Bilateral-Median-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Denoise-Bilateral-Median-Apply
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
43 -#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
44 -#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
45 -#define HISTOGRAM_REGULARIZATION 0.0 //Histogram regularization window size, higher values approximate a bilateral "closest-to-mean" filter.
47 -#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
49 -#define KERNELSIZE int(max(int(SPATIAL_SIGMA), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 -#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
55 -float gaussian(float x, float s, float m) {
56 - float scaled = (x - m) / s;
57 - return exp(-0.5 * scaled * scaled);
60 -vec4 getMedian(vec4 v[KERNELLEN], float w[KERNELLEN], float n) {
62 - for (int i=0; i<KERNELLEN; i++) {
63 - float w_above = 0.0;
64 - float w_below = 0.0;
65 - for (int j=0; j<KERNELLEN; j++) {
66 - if (v[j].x > v[i].x) {
67 - w_above += w[j];
68 - } else if (v[j].x < v[i].x) {
69 - w_below += w[j];
70 - }
71 - }
73 - if ((n - w_above) / n >= 0.5 && w_below / n <= 0.5) {
74 - return v[i];
75 - }
76 - }
79 -vec4 hook() {
80 - vec4 histogram_v[KERNELLEN];
81 - float histogram_l[KERNELLEN];
82 - float histogram_w[KERNELLEN];
83 - float n = 0.0;
85 - float vc = LINELUMA_tex(HOOKED_pos).x;
87 - float is = pow(vc + 0.0001, INTENSITY_POWER_CURVE) * INTENSITY_SIGMA;
88 - float ss = SPATIAL_SIGMA;
90 - for (int i=0; i<KERNELLEN; i++) {
91 - vec2 ipos = GETOFFSET(i);
92 - histogram_v[i] = HOOKED_texOff(ipos);
93 - histogram_l[i] = LINELUMA_texOff(ipos).x;
94 - histogram_w[i] = gaussian(histogram_l[i], is, vc) * gaussian(length(ipos), ss, 0.0);
95 - n += histogram_w[i];
96 - }
98 - if (HISTOGRAM_REGULARIZATION > 0.0) {
99 - float histogram_wn[KERNELLEN];
100 - n = 0.0;
102 - for (int i=0; i<KERNELLEN; i++) {
103 - histogram_wn[i] = 0.0;
104 - }
106 - for (int i=0; i<KERNELLEN; i++) {
107 - histogram_wn[i] += gaussian(0.0, HISTOGRAM_REGULARIZATION, 0.0) * histogram_w[i];
108 - for (int j=(i+1); j<KERNELLEN; j++) {
109 - float d = gaussian(histogram_l[j], HISTOGRAM_REGULARIZATION, histogram_l[i]);
110 - histogram_wn[j] += d * histogram_w[i];
111 - histogram_wn[i] += d * histogram_w[j];
112 - }
113 - n += histogram_wn[i];
114 - }
116 - return getMedian(histogram_v, histogram_wn, n);
117 - }
119 - return getMedian(histogram_v, histogram_w, n);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Denoise-Bilateral-Median-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Denoise-Bilateral-Median-Apply
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
43 +#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
44 +#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
45 +#define HISTOGRAM_REGULARIZATION 0.0 //Histogram regularization window size, higher values approximate a bilateral "closest-to-mean" filter.
47 +#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
49 +#define KERNELSIZE int(max(int(SPATIAL_SIGMA), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 +#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
55 +float gaussian(float x, float s, float m) {
56 + float scaled = (x - m) / s;
57 + return exp(-0.5 * scaled * scaled);
60 +vec4 getMedian(vec4 v[KERNELLEN], float w[KERNELLEN], float n) {
62 + for (int i=0; i<KERNELLEN; i++) {
63 + float w_above = 0.0;
64 + float w_below = 0.0;
65 + for (int j=0; j<KERNELLEN; j++) {
66 + if (v[j].x > v[i].x) {
67 + w_above += w[j];
68 + } else if (v[j].x < v[i].x) {
69 + w_below += w[j];
70 + }
71 + }
73 + if ((n - w_above) / n >= 0.5 && w_below / n <= 0.5) {
74 + return v[i];
75 + }
76 + }
79 +vec4 hook() {
80 + vec4 histogram_v[KERNELLEN];
81 + float histogram_l[KERNELLEN];
82 + float histogram_w[KERNELLEN];
83 + float n = 0.0;
85 + float vc = LINELUMA_tex(HOOKED_pos).x;
87 + float is = pow(vc + 0.0001, INTENSITY_POWER_CURVE) * INTENSITY_SIGMA;
88 + float ss = SPATIAL_SIGMA;
90 + for (int i=0; i<KERNELLEN; i++) {
91 + vec2 ipos = GETOFFSET(i);
92 + histogram_v[i] = HOOKED_texOff(ipos);
93 + histogram_l[i] = LINELUMA_texOff(ipos).x;
94 + histogram_w[i] = gaussian(histogram_l[i], is, vc) * gaussian(length(ipos), ss, 0.0);
95 + n += histogram_w[i];
96 + }
98 + if (HISTOGRAM_REGULARIZATION > 0.0) {
99 + float histogram_wn[KERNELLEN];
100 + n = 0.0;
102 + for (int i=0; i<KERNELLEN; i++) {
103 + histogram_wn[i] = 0.0;
106 + for (int i=0; i<KERNELLEN; i++) {
107 + histogram_wn[i] += gaussian(0.0, HISTOGRAM_REGULARIZATION, 0.0) * histogram_w[i];
108 + for (int j=(i+1); j<KERNELLEN; j++) {
109 + float d = gaussian(histogram_l[j], HISTOGRAM_REGULARIZATION, histogram_l[i]);
110 + histogram_wn[j] += d * histogram_w[i];
111 + histogram_wn[i] += d * histogram_w[j];
113 + n += histogram_wn[i];
116 + return getMedian(histogram_v, histogram_wn, n);
119 + return getMedian(histogram_v, histogram_w, n);

mpv/shaders/Anime4K_Denoise_Bilateral_Mode.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Denoise-Bilateral-Mode-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.1-Denoise-Bilateral-Mode-Apply
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
43 -#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
44 -#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
45 -#define HISTOGRAM_REGULARIZATION 0.2 //Histogram regularization window size, higher values approximate a bilateral "closest-to-mean" filter.
47 -#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
49 -#define KERNELSIZE int(max(int(SPATIAL_SIGMA), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 -#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
55 -float gaussian(float x, float s, float m) {
56 - float scaled = (x - m) / s;
57 - return exp(-0.5 * scaled * scaled);
60 -vec4 getMode(vec4 v[KERNELLEN], float w[KERNELLEN]) {
61 - vec4 maxv = vec4(0);
62 - float maxw = 0.0;
64 - for (int i=0; i<KERNELLEN; i++) {
65 - if (w[i] >= maxw) {
66 - maxw = w[i];
67 - maxv = v[i];
68 - }
69 - }
71 - return maxv;
74 -vec4 hook() {
75 - vec4 histogram_v[KERNELLEN];
76 - float histogram_l[KERNELLEN];
77 - float histogram_w[KERNELLEN];
78 - float histogram_wn[KERNELLEN];
80 - float vc = LINELUMA_tex(HOOKED_pos).x;
82 - float is = pow(vc + 0.0001, INTENSITY_POWER_CURVE) * INTENSITY_SIGMA;
83 - float ss = SPATIAL_SIGMA;
85 - for (int i=0; i<KERNELLEN; i++) {
86 - vec2 ipos = GETOFFSET(i);
87 - histogram_v[i] = HOOKED_texOff(ipos);
88 - histogram_l[i] = LINELUMA_texOff(ipos).x;
89 - histogram_w[i] = gaussian(histogram_l[i], is, vc) * gaussian(length(ipos), ss, 0.0);
90 - histogram_wn[i] = 0.0;
91 - }
93 - for (int i=0; i<KERNELLEN; i++) {
94 - histogram_wn[i] += gaussian(0.0, HISTOGRAM_REGULARIZATION, 0.0) * histogram_w[i];
95 - for (int j=(i+1); j<KERNELLEN; j++) {
96 - float d = gaussian(histogram_l[j], HISTOGRAM_REGULARIZATION, histogram_l[i]);
97 - histogram_wn[j] += d * histogram_w[i];
98 - histogram_wn[i] += d * histogram_w[j];
99 - }
100 - }
102 - return getMode(histogram_v, histogram_wn);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Denoise-Bilateral-Mode-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.1-Denoise-Bilateral-Mode-Apply
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
43 +#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
44 +#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
45 +#define HISTOGRAM_REGULARIZATION 0.2 //Histogram regularization window size, higher values approximate a bilateral "closest-to-mean" filter.
47 +#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.
49 +#define KERNELSIZE int(max(int(SPATIAL_SIGMA), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
50 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
51 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
53 +#define GETOFFSET(i) vec2((i % KERNELSIZE) - KERNELHALFSIZE, (i / KERNELSIZE) - KERNELHALFSIZE)
55 +float gaussian(float x, float s, float m) {
56 + float scaled = (x - m) / s;
57 + return exp(-0.5 * scaled * scaled);
60 +vec4 getMode(vec4 v[KERNELLEN], float w[KERNELLEN]) {
61 + vec4 maxv = vec4(0);
62 + float maxw = 0.0;
64 + for (int i=0; i<KERNELLEN; i++) {
65 + if (w[i] >= maxw) {
66 + maxw = w[i];
67 + maxv = v[i];
68 + }
69 + }
71 + return maxv;
74 +vec4 hook() {
75 + vec4 histogram_v[KERNELLEN];
76 + float histogram_l[KERNELLEN];
77 + float histogram_w[KERNELLEN];
78 + float histogram_wn[KERNELLEN];
80 + float vc = LINELUMA_tex(HOOKED_pos).x;
82 + float is = pow(vc + 0.0001, INTENSITY_POWER_CURVE) * INTENSITY_SIGMA;
83 + float ss = SPATIAL_SIGMA;
85 + for (int i=0; i<KERNELLEN; i++) {
86 + vec2 ipos = GETOFFSET(i);
87 + histogram_v[i] = HOOKED_texOff(ipos);
88 + histogram_l[i] = LINELUMA_texOff(ipos).x;
89 + histogram_w[i] = gaussian(histogram_l[i], is, vc) * gaussian(length(ipos), ss, 0.0);
90 + histogram_wn[i] = 0.0;
91 + }
93 + for (int i=0; i<KERNELLEN; i++) {
94 + histogram_wn[i] += gaussian(0.0, HISTOGRAM_REGULARIZATION, 0.0) * histogram_w[i];
95 + for (int j=(i+1); j<KERNELLEN; j++) {
96 + float d = gaussian(histogram_l[j], HISTOGRAM_REGULARIZATION, histogram_l[i]);
97 + histogram_wn[j] += d * histogram_w[i];
98 + histogram_wn[i] += d * histogram_w[j];
99 + }
102 + return getMode(histogram_v, histogram_wn);

mpv/shaders/Anime4K_Thin_Fast.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Thin-(Fast)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Thin-(Fast)-Sobel-X
39 -//!HOOK MAIN
40 -//!BIND LINELUMA
41 -//!SAVE LINESOBEL
42 -//!WIDTH HOOKED.w 2 /
43 -//!HEIGHT HOOKED.h 2 /
44 -//!COMPONENTS 2
46 -vec4 hook() {
47 - float l = LINELUMA_texOff(vec2(-1.0, 0.0)).x;
48 - float c = LINELUMA_tex(LINELUMA_pos).x;
49 - float r = LINELUMA_texOff(vec2(1.0, 0.0)).x;
51 - float xgrad = (-l + r);
52 - float ygrad = (l + c + c + r);
54 - return vec4(xgrad, ygrad, 0.0, 0.0);
58 -//!DESC Anime4K-v3.2-Thin-(Fast)-Sobel-Y
59 -//!HOOK MAIN
60 -//!BIND LINESOBEL
61 -//!SAVE LINESOBEL
62 -//!WIDTH HOOKED.w 2 /
63 -//!HEIGHT HOOKED.h 2 /
64 -//!COMPONENTS 1
66 -vec4 hook() {
67 - float tx = LINESOBEL_texOff(vec2(0.0, -0.5)).x;
68 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
69 - float bx = LINESOBEL_texOff(vec2(0.0, 0.5)).x;
71 - float ty = LINESOBEL_texOff(vec2(0.0, -0.5)).y;
72 - float by = LINESOBEL_texOff(vec2(0.0, 0.5)).y;
74 - float xgrad = (tx + cx + cx + bx) / 8.0;
76 - float ygrad = (-ty + by) / 8.0;
78 - //Computes the luminance's gradient
79 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
80 - return vec4(pow(norm, 0.7));
84 -//!DESC Anime4K-v3.2-Thin-(Fast)-Gaussian-X
85 -//!HOOK MAIN
86 -//!BIND HOOKED
87 -//!BIND LINESOBEL
88 -//!SAVE LINESOBEL
89 -//!WIDTH HOOKED.w 2 /
90 -//!HEIGHT HOOKED.h 2 /
91 -//!COMPONENTS 1
93 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
95 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
96 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
97 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
99 -float gaussian(float x, float s, float m) {
100 - float scaled = (x - m) / s;
101 - return exp(-0.5 * scaled * scaled);
104 -float comp_gaussian_x() {
106 - float g = 0.0;
107 - float gn = 0.0;
109 - for (int i=0; i<KERNELSIZE; i++) {
110 - float di = float(i - KERNELHALFSIZE);
111 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
113 - g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
114 - gn = gn + gf;
116 - }
118 - return g / gn;
121 -vec4 hook() {
122 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
126 -//!DESC Anime4K-v3.2-Thin-(Fast)-Gaussian-Y
127 -//!HOOK MAIN
128 -//!BIND HOOKED
129 -//!BIND LINESOBEL
130 -//!SAVE LINESOBEL
131 -//!WIDTH HOOKED.w 2 /
132 -//!HEIGHT HOOKED.h 2 /
133 -//!COMPONENTS 1
135 -#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
137 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
138 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
139 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
141 -float gaussian(float x, float s, float m) {
142 - float scaled = (x - m) / s;
143 - return exp(-0.5 * scaled * scaled);
146 -float comp_gaussian_y() {
148 - float g = 0.0;
149 - float gn = 0.0;
151 - for (int i=0; i<KERNELSIZE; i++) {
152 - float di = float(i - KERNELHALFSIZE);
153 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
155 - g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
156 - gn = gn + gf;
158 - }
160 - return g / gn;
163 -vec4 hook() {
164 - return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
167 -//!DESC Anime4K-v3.2-Thin-(Fast)-Kernel-X
168 -//!HOOK MAIN
169 -//!BIND LINESOBEL
170 -//!SAVE LINESOBEL
171 -//!WIDTH HOOKED.w 2 /
172 -//!HEIGHT HOOKED.h 2 /
173 -//!COMPONENTS 2
175 -vec4 hook() {
176 - float l = LINESOBEL_texOff(vec2(-0.5, 0.0)).x;
177 - float c = LINESOBEL_tex(LINESOBEL_pos).x;
178 - float r = LINESOBEL_texOff(vec2(0.5, 0.0)).x;
180 - float xgrad = (-l + r);
181 - float ygrad = (l + c + c + r);
183 - return vec4(xgrad, ygrad, 0.0, 0.0);
187 -//!DESC Anime4K-v3.2-Thin-(Fast)-Kernel-Y
188 -//!HOOK MAIN
189 -//!BIND LINESOBEL
190 -//!SAVE LINESOBEL
191 -//!WIDTH HOOKED.w 2 /
192 -//!HEIGHT HOOKED.h 2 /
193 -//!COMPONENTS 2
195 -vec4 hook() {
196 - float tx = LINESOBEL_texOff(vec2(0.0, -0.5)).x;
197 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
198 - float bx = LINESOBEL_texOff(vec2(0.0, 0.5)).x;
200 - float ty = LINESOBEL_texOff(vec2(0.0, -0.5)).y;
201 - float by = LINESOBEL_texOff(vec2(0.0, 0.5)).y;
203 - float xgrad = (tx + cx + cx + bx) / 8.0;
205 - float ygrad = (-ty + by) / 8.0;
207 - //Computes the luminance's gradient
208 - return vec4(xgrad, ygrad, 0.0, 0.0);
212 -//!DESC Anime4K-v3.2-Thin-(Fast)-Warp
213 -//!HOOK MAIN
214 -//!BIND HOOKED
215 -//!BIND LINESOBEL
217 -#define STRENGTH 0.6 //Strength of warping for each iteration
218 -#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
220 -vec4 hook() {
221 - vec2 d = HOOKED_pt;
223 - float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
225 - vec2 pos = HOOKED_pos;
226 - for (int i=0; i<ITERATIONS; i++) {
227 - vec2 dn = LINESOBEL_tex(pos).xy;
228 - vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
229 - pos -= dd;
230 - }
232 - return HOOKED_tex(pos);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Thin-(Fast)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Thin-(Fast)-Sobel-X
39 +//!HOOK MAIN
40 +//!BIND LINELUMA
41 +//!SAVE LINESOBEL
42 +//!WIDTH HOOKED.w 2 /
43 +//!HEIGHT HOOKED.h 2 /
44 +//!COMPONENTS 2
46 +vec4 hook() {
47 + float l = LINELUMA_texOff(vec2(-1.0, 0.0)).x;
48 + float c = LINELUMA_tex(LINELUMA_pos).x;
49 + float r = LINELUMA_texOff(vec2(1.0, 0.0)).x;
51 + float xgrad = (-l + r);
52 + float ygrad = (l + c + c + r);
54 + return vec4(xgrad, ygrad, 0.0, 0.0);
58 +//!DESC Anime4K-v3.2-Thin-(Fast)-Sobel-Y
59 +//!HOOK MAIN
60 +//!BIND LINESOBEL
61 +//!SAVE LINESOBEL
62 +//!WIDTH HOOKED.w 2 /
63 +//!HEIGHT HOOKED.h 2 /
64 +//!COMPONENTS 1
66 +vec4 hook() {
67 + float tx = LINESOBEL_texOff(vec2(0.0, -0.5)).x;
68 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
69 + float bx = LINESOBEL_texOff(vec2(0.0, 0.5)).x;
71 + float ty = LINESOBEL_texOff(vec2(0.0, -0.5)).y;
72 + float by = LINESOBEL_texOff(vec2(0.0, 0.5)).y;
74 + float xgrad = (tx + cx + cx + bx) / 8.0;
76 + float ygrad = (-ty + by) / 8.0;
78 + //Computes the luminance's gradient
79 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
80 + return vec4(pow(norm, 0.7));
84 +//!DESC Anime4K-v3.2-Thin-(Fast)-Gaussian-X
85 +//!HOOK MAIN
86 +//!BIND HOOKED
87 +//!BIND LINESOBEL
88 +//!SAVE LINESOBEL
89 +//!WIDTH HOOKED.w 2 /
90 +//!HEIGHT HOOKED.h 2 /
91 +//!COMPONENTS 1
93 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
95 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
96 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
97 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
99 +float gaussian(float x, float s, float m) {
100 + float scaled = (x - m) / s;
101 + return exp(-0.5 * scaled * scaled);
104 +float comp_gaussian_x() {
106 + float g = 0.0;
107 + float gn = 0.0;
109 + for (int i=0; i<KERNELSIZE; i++) {
110 + float di = float(i - KERNELHALFSIZE);
111 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
113 + g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
114 + gn = gn + gf;
118 + return g / gn;
121 +vec4 hook() {
122 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
126 +//!DESC Anime4K-v3.2-Thin-(Fast)-Gaussian-Y
127 +//!HOOK MAIN
128 +//!BIND HOOKED
129 +//!BIND LINESOBEL
130 +//!SAVE LINESOBEL
131 +//!WIDTH HOOKED.w 2 /
132 +//!HEIGHT HOOKED.h 2 /
133 +//!COMPONENTS 1
135 +#define SPATIAL_SIGMA (1.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
137 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
138 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
139 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
141 +float gaussian(float x, float s, float m) {
142 + float scaled = (x - m) / s;
143 + return exp(-0.5 * scaled * scaled);
146 +float comp_gaussian_y() {
148 + float g = 0.0;
149 + float gn = 0.0;
151 + for (int i=0; i<KERNELSIZE; i++) {
152 + float di = float(i - KERNELHALFSIZE);
153 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
155 + g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
156 + gn = gn + gf;
160 + return g / gn;
163 +vec4 hook() {
164 + return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
167 +//!DESC Anime4K-v3.2-Thin-(Fast)-Kernel-X
168 +//!HOOK MAIN
169 +//!BIND LINESOBEL
170 +//!SAVE LINESOBEL
171 +//!WIDTH HOOKED.w 2 /
172 +//!HEIGHT HOOKED.h 2 /
173 +//!COMPONENTS 2
175 +vec4 hook() {
176 + float l = LINESOBEL_texOff(vec2(-0.5, 0.0)).x;
177 + float c = LINESOBEL_tex(LINESOBEL_pos).x;
178 + float r = LINESOBEL_texOff(vec2(0.5, 0.0)).x;
180 + float xgrad = (-l + r);
181 + float ygrad = (l + c + c + r);
183 + return vec4(xgrad, ygrad, 0.0, 0.0);
187 +//!DESC Anime4K-v3.2-Thin-(Fast)-Kernel-Y
188 +//!HOOK MAIN
189 +//!BIND LINESOBEL
190 +//!SAVE LINESOBEL
191 +//!WIDTH HOOKED.w 2 /
192 +//!HEIGHT HOOKED.h 2 /
193 +//!COMPONENTS 2
195 +vec4 hook() {
196 + float tx = LINESOBEL_texOff(vec2(0.0, -0.5)).x;
197 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
198 + float bx = LINESOBEL_texOff(vec2(0.0, 0.5)).x;
200 + float ty = LINESOBEL_texOff(vec2(0.0, -0.5)).y;
201 + float by = LINESOBEL_texOff(vec2(0.0, 0.5)).y;
203 + float xgrad = (tx + cx + cx + bx) / 8.0;
205 + float ygrad = (-ty + by) / 8.0;
207 + //Computes the luminance's gradient
208 + return vec4(xgrad, ygrad, 0.0, 0.0);
212 +//!DESC Anime4K-v3.2-Thin-(Fast)-Warp
213 +//!HOOK MAIN
214 +//!BIND HOOKED
215 +//!BIND LINESOBEL
217 +#define STRENGTH 0.6 //Strength of warping for each iteration
218 +#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
220 +vec4 hook() {
221 + vec2 d = HOOKED_pt;
223 + float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
225 + vec2 pos = HOOKED_pos;
226 + for (int i=0; i<ITERATIONS; i++) {
227 + vec2 dn = LINESOBEL_tex(pos).xy;
228 + vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
229 + pos -= dd;
232 + return HOOKED_tex(pos);

mpv/shaders/Anime4K_Thin_HQ.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Thin-(HQ)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Thin-(HQ)-Sobel-X
39 -//!HOOK MAIN
40 -//!BIND LINELUMA
41 -//!SAVE LINESOBEL
42 -//!COMPONENTS 2
44 -vec4 hook() {
45 - float l = LINELUMA_texOff(vec2(-1.0, 0.0)).x;
46 - float c = LINELUMA_tex(LINELUMA_pos).x;
47 - float r = LINELUMA_texOff(vec2(1.0, 0.0)).x;
49 - float xgrad = (-l + r);
50 - float ygrad = (l + c + c + r);
52 - return vec4(xgrad, ygrad, 0.0, 0.0);
56 -//!DESC Anime4K-v3.2-Thin-(HQ)-Sobel-Y
57 -//!HOOK MAIN
58 -//!BIND LINESOBEL
59 -//!SAVE LINESOBEL
60 -//!COMPONENTS 1
62 -vec4 hook() {
63 - float tx = LINESOBEL_texOff(vec2(0.0, -1.0)).x;
64 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
65 - float bx = LINESOBEL_texOff(vec2(0.0, 1.0)).x;
67 - float ty = LINESOBEL_texOff(vec2(0.0, -1.0)).y;
68 - float by = LINESOBEL_texOff(vec2(0.0, 1.0)).y;
70 - float xgrad = (tx + cx + cx + bx) / 8.0;
72 - float ygrad = (-ty + by) / 8.0;
74 - //Computes the luminance's gradient
75 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
76 - return vec4(pow(norm, 0.7));
80 -//!DESC Anime4K-v3.2-Thin-(HQ)-Gaussian-X
81 -//!HOOK MAIN
82 -//!BIND HOOKED
83 -//!BIND LINESOBEL
84 -//!SAVE LINESOBEL
85 -//!COMPONENTS 1
87 -#define SPATIAL_SIGMA (2.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
89 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
90 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
91 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
93 -float gaussian(float x, float s, float m) {
94 - float scaled = (x - m) / s;
95 - return exp(-0.5 * scaled * scaled);
98 -float comp_gaussian_x() {
100 - float g = 0.0;
101 - float gn = 0.0;
103 - for (int i=0; i<KERNELSIZE; i++) {
104 - float di = float(i - KERNELHALFSIZE);
105 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
107 - g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
108 - gn = gn + gf;
110 - }
112 - return g / gn;
115 -vec4 hook() {
116 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
120 -//!DESC Anime4K-v3.2-Thin-(HQ)-Gaussian-Y
121 -//!HOOK MAIN
122 -//!BIND HOOKED
123 -//!BIND LINESOBEL
124 -//!SAVE LINESOBEL
125 -//!COMPONENTS 1
127 -#define SPATIAL_SIGMA (2.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
129 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
130 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
131 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
133 -float gaussian(float x, float s, float m) {
134 - float scaled = (x - m) / s;
135 - return exp(-0.5 * scaled * scaled);
138 -float comp_gaussian_y() {
140 - float g = 0.0;
141 - float gn = 0.0;
143 - for (int i=0; i<KERNELSIZE; i++) {
144 - float di = float(i - KERNELHALFSIZE);
145 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
147 - g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
148 - gn = gn + gf;
150 - }
152 - return g / gn;
155 -vec4 hook() {
156 - return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
159 -//!DESC Anime4K-v3.2-Thin-(HQ)-Kernel-X
160 -//!HOOK MAIN
161 -//!BIND LINESOBEL
162 -//!SAVE LINESOBEL
163 -//!COMPONENTS 2
165 -vec4 hook() {
166 - float l = LINESOBEL_texOff(vec2(-1.0, 0.0)).x;
167 - float c = LINESOBEL_tex(LINESOBEL_pos).x;
168 - float r = LINESOBEL_texOff(vec2(1.0, 0.0)).x;
170 - float xgrad = (-l + r);
171 - float ygrad = (l + c + c + r);
173 - return vec4(xgrad, ygrad, 0.0, 0.0);
177 -//!DESC Anime4K-v3.2-Thin-(HQ)-Kernel-Y
178 -//!HOOK MAIN
179 -//!BIND LINESOBEL
180 -//!SAVE LINESOBEL
181 -//!COMPONENTS 2
183 -vec4 hook() {
184 - float tx = LINESOBEL_texOff(vec2(0.0, -1.0)).x;
185 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
186 - float bx = LINESOBEL_texOff(vec2(0.0, 1.0)).x;
188 - float ty = LINESOBEL_texOff(vec2(0.0, -1.0)).y;
189 - float by = LINESOBEL_texOff(vec2(0.0, 1.0)).y;
191 - float xgrad = (tx + cx + cx + bx) / 8.0;
193 - float ygrad = (-ty + by) / 8.0;
195 - //Computes the luminance's gradient
196 - return vec4(xgrad, ygrad, 0.0, 0.0);
200 -//!DESC Anime4K-v3.2-Thin-(HQ)-Warp
201 -//!HOOK MAIN
202 -//!BIND HOOKED
203 -//!BIND LINESOBEL
205 -#define STRENGTH 0.6 //Strength of warping for each iteration
206 -#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
208 -vec4 hook() {
209 - vec2 d = HOOKED_pt;
211 - float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
213 - vec2 pos = HOOKED_pos;
214 - for (int i=0; i<ITERATIONS; i++) {
215 - vec2 dn = LINESOBEL_tex(pos).xy;
216 - vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
217 - pos -= dd;
218 - }
220 - return HOOKED_tex(pos);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Thin-(HQ)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Thin-(HQ)-Sobel-X
39 +//!HOOK MAIN
40 +//!BIND LINELUMA
41 +//!SAVE LINESOBEL
42 +//!COMPONENTS 2
44 +vec4 hook() {
45 + float l = LINELUMA_texOff(vec2(-1.0, 0.0)).x;
46 + float c = LINELUMA_tex(LINELUMA_pos).x;
47 + float r = LINELUMA_texOff(vec2(1.0, 0.0)).x;
49 + float xgrad = (-l + r);
50 + float ygrad = (l + c + c + r);
52 + return vec4(xgrad, ygrad, 0.0, 0.0);
56 +//!DESC Anime4K-v3.2-Thin-(HQ)-Sobel-Y
57 +//!HOOK MAIN
58 +//!BIND LINESOBEL
59 +//!SAVE LINESOBEL
60 +//!COMPONENTS 1
62 +vec4 hook() {
63 + float tx = LINESOBEL_texOff(vec2(0.0, -1.0)).x;
64 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
65 + float bx = LINESOBEL_texOff(vec2(0.0, 1.0)).x;
67 + float ty = LINESOBEL_texOff(vec2(0.0, -1.0)).y;
68 + float by = LINESOBEL_texOff(vec2(0.0, 1.0)).y;
70 + float xgrad = (tx + cx + cx + bx) / 8.0;
72 + float ygrad = (-ty + by) / 8.0;
74 + //Computes the luminance's gradient
75 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
76 + return vec4(pow(norm, 0.7));
80 +//!DESC Anime4K-v3.2-Thin-(HQ)-Gaussian-X
81 +//!HOOK MAIN
82 +//!BIND HOOKED
83 +//!BIND LINESOBEL
84 +//!SAVE LINESOBEL
85 +//!COMPONENTS 1
87 +#define SPATIAL_SIGMA (2.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
89 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
90 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
91 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
93 +float gaussian(float x, float s, float m) {
94 + float scaled = (x - m) / s;
95 + return exp(-0.5 * scaled * scaled);
98 +float comp_gaussian_x() {
100 + float g = 0.0;
101 + float gn = 0.0;
103 + for (int i=0; i<KERNELSIZE; i++) {
104 + float di = float(i - KERNELHALFSIZE);
105 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
107 + g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
108 + gn = gn + gf;
112 + return g / gn;
115 +vec4 hook() {
116 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
120 +//!DESC Anime4K-v3.2-Thin-(HQ)-Gaussian-Y
121 +//!HOOK MAIN
122 +//!BIND HOOKED
123 +//!BIND LINESOBEL
124 +//!SAVE LINESOBEL
125 +//!COMPONENTS 1
127 +#define SPATIAL_SIGMA (2.0 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
129 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
130 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
131 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
133 +float gaussian(float x, float s, float m) {
134 + float scaled = (x - m) / s;
135 + return exp(-0.5 * scaled * scaled);
138 +float comp_gaussian_y() {
140 + float g = 0.0;
141 + float gn = 0.0;
143 + for (int i=0; i<KERNELSIZE; i++) {
144 + float di = float(i - KERNELHALFSIZE);
145 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
147 + g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
148 + gn = gn + gf;
152 + return g / gn;
155 +vec4 hook() {
156 + return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
159 +//!DESC Anime4K-v3.2-Thin-(HQ)-Kernel-X
160 +//!HOOK MAIN
161 +//!BIND LINESOBEL
162 +//!SAVE LINESOBEL
163 +//!COMPONENTS 2
165 +vec4 hook() {
166 + float l = LINESOBEL_texOff(vec2(-1.0, 0.0)).x;
167 + float c = LINESOBEL_tex(LINESOBEL_pos).x;
168 + float r = LINESOBEL_texOff(vec2(1.0, 0.0)).x;
170 + float xgrad = (-l + r);
171 + float ygrad = (l + c + c + r);
173 + return vec4(xgrad, ygrad, 0.0, 0.0);
177 +//!DESC Anime4K-v3.2-Thin-(HQ)-Kernel-Y
178 +//!HOOK MAIN
179 +//!BIND LINESOBEL
180 +//!SAVE LINESOBEL
181 +//!COMPONENTS 2
183 +vec4 hook() {
184 + float tx = LINESOBEL_texOff(vec2(0.0, -1.0)).x;
185 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
186 + float bx = LINESOBEL_texOff(vec2(0.0, 1.0)).x;
188 + float ty = LINESOBEL_texOff(vec2(0.0, -1.0)).y;
189 + float by = LINESOBEL_texOff(vec2(0.0, 1.0)).y;
191 + float xgrad = (tx + cx + cx + bx) / 8.0;
193 + float ygrad = (-ty + by) / 8.0;
195 + //Computes the luminance's gradient
196 + return vec4(xgrad, ygrad, 0.0, 0.0);
200 +//!DESC Anime4K-v3.2-Thin-(HQ)-Warp
201 +//!HOOK MAIN
202 +//!BIND HOOKED
203 +//!BIND LINESOBEL
205 +#define STRENGTH 0.6 //Strength of warping for each iteration
206 +#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
208 +vec4 hook() {
209 + vec2 d = HOOKED_pt;
211 + float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
213 + vec2 pos = HOOKED_pos;
214 + for (int i=0; i<ITERATIONS; i++) {
215 + vec2 dn = LINESOBEL_tex(pos).xy;
216 + vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
217 + pos -= dd;
220 + return HOOKED_tex(pos);

mpv/shaders/Anime4K_Thin_VeryFast.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!WIDTH HOOKED.w 2 /
29 -//!HEIGHT HOOKED.h 2 /
30 -//!COMPONENTS 1
32 -float get_luma(vec4 rgba) {
33 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
36 -vec4 hook() {
37 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
40 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Sobel-X
41 -//!HOOK MAIN
42 -//!BIND LINELUMA
43 -//!SAVE LINESOBEL
44 -//!WIDTH HOOKED.w 4 /
45 -//!HEIGHT HOOKED.h 4 /
46 -//!COMPONENTS 2
48 -vec4 hook() {
49 - float l = LINELUMA_texOff(vec2(-0.5, 0.0)).x;
50 - float c = LINELUMA_tex(LINELUMA_pos).x;
51 - float r = LINELUMA_texOff(vec2(0.5, 0.0)).x;
53 - float xgrad = (-l + r);
54 - float ygrad = (l + c + c + r);
56 - return vec4(xgrad, ygrad, 0.0, 0.0);
60 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Sobel-Y
61 -//!HOOK MAIN
62 -//!BIND LINESOBEL
63 -//!SAVE LINESOBEL
64 -//!WIDTH HOOKED.w 4 /
65 -//!HEIGHT HOOKED.h 4 /
66 -//!COMPONENTS 1
68 -vec4 hook() {
69 - float tx = LINESOBEL_texOff(vec2(0.0, -0.25)).x;
70 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
71 - float bx = LINESOBEL_texOff(vec2(0.0, 0.25)).x;
73 - float ty = LINESOBEL_texOff(vec2(0.0, -0.25)).y;
74 - float by = LINESOBEL_texOff(vec2(0.0, 0.25)).y;
76 - float xgrad = (tx + cx + cx + bx) / 8.0;
78 - float ygrad = (-ty + by) / 8.0;
80 - //Computes the luminance's gradient
81 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
82 - return vec4(pow(norm, 0.7));
86 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Gaussian-X
87 -//!HOOK MAIN
88 -//!BIND HOOKED
89 -//!BIND LINESOBEL
90 -//!SAVE LINESOBEL
91 -//!WIDTH HOOKED.w 4 /
92 -//!HEIGHT HOOKED.h 4 /
93 -//!COMPONENTS 1
95 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
97 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
98 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
99 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
101 -float gaussian(float x, float s, float m) {
102 - float scaled = (x - m) / s;
103 - return exp(-0.5 * scaled * scaled);
106 -float comp_gaussian_x() {
108 - float g = 0.0;
109 - float gn = 0.0;
111 - for (int i=0; i<KERNELSIZE; i++) {
112 - float di = float(i - KERNELHALFSIZE);
113 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
115 - g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
116 - gn = gn + gf;
118 - }
120 - return g / gn;
123 -vec4 hook() {
124 - return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
128 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Gaussian-Y
129 -//!HOOK MAIN
130 -//!BIND HOOKED
131 -//!BIND LINESOBEL
132 -//!SAVE LINESOBEL
133 -//!WIDTH HOOKED.w 4 /
134 -//!HEIGHT HOOKED.h 4 /
135 -//!COMPONENTS 1
137 -#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
139 -#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
140 -#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
141 -#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
143 -float gaussian(float x, float s, float m) {
144 - float scaled = (x - m) / s;
145 - return exp(-0.5 * scaled * scaled);
148 -float comp_gaussian_y() {
150 - float g = 0.0;
151 - float gn = 0.0;
153 - for (int i=0; i<KERNELSIZE; i++) {
154 - float di = float(i - KERNELHALFSIZE);
155 - float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
157 - g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
158 - gn = gn + gf;
160 - }
162 - return g / gn;
165 -vec4 hook() {
166 - return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
169 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Kernel-X
170 -//!HOOK MAIN
171 -//!BIND LINESOBEL
172 -//!SAVE LINESOBEL
173 -//!WIDTH HOOKED.w 4 /
174 -//!HEIGHT HOOKED.h 4 /
175 -//!COMPONENTS 2
177 -vec4 hook() {
178 - float l = LINESOBEL_texOff(vec2(-0.25, 0.0)).x;
179 - float c = LINESOBEL_tex(LINESOBEL_pos).x;
180 - float r = LINESOBEL_texOff(vec2(0.25, 0.0)).x;
182 - float xgrad = (-l + r);
183 - float ygrad = (l + c + c + r);
185 - return vec4(xgrad, ygrad, 0.0, 0.0);
189 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Kernel-Y
190 -//!HOOK MAIN
191 -//!BIND LINESOBEL
192 -//!SAVE LINESOBEL
193 -//!WIDTH HOOKED.w 4 /
194 -//!HEIGHT HOOKED.h 4 /
195 -//!COMPONENTS 2
197 -vec4 hook() {
198 - float tx = LINESOBEL_texOff(vec2(0.0, -0.25)).x;
199 - float cx = LINESOBEL_tex(LINESOBEL_pos).x;
200 - float bx = LINESOBEL_texOff(vec2(0.0, 0.25)).x;
202 - float ty = LINESOBEL_texOff(vec2(0.0, -0.25)).y;
203 - float by = LINESOBEL_texOff(vec2(0.0, 0.25)).y;
205 - float xgrad = (tx + cx + cx + bx) / 8.0;
207 - float ygrad = (-ty + by) / 8.0;
209 - //Computes the luminance's gradient
210 - return vec4(xgrad, ygrad, 0.0, 0.0);
214 -//!DESC Anime4K-v3.2-Thin-(VeryFast)-Warp
215 -//!HOOK MAIN
216 -//!BIND HOOKED
217 -//!BIND LINESOBEL
219 -#define STRENGTH 0.6 //Strength of warping for each iteration
220 -#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
222 -vec4 hook() {
223 - vec2 d = HOOKED_pt;
225 - float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
227 - vec2 pos = HOOKED_pos;
228 - for (int i=0; i<ITERATIONS; i++) {
229 - vec2 dn = LINESOBEL_tex(pos).xy;
230 - vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
231 - pos -= dd;
232 - }
234 - return HOOKED_tex(pos);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!WIDTH HOOKED.w 2 /
29 +//!HEIGHT HOOKED.h 2 /
30 +//!COMPONENTS 1
32 +float get_luma(vec4 rgba) {
33 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
36 +vec4 hook() {
37 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
40 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Sobel-X
41 +//!HOOK MAIN
42 +//!BIND LINELUMA
43 +//!SAVE LINESOBEL
44 +//!WIDTH HOOKED.w 4 /
45 +//!HEIGHT HOOKED.h 4 /
46 +//!COMPONENTS 2
48 +vec4 hook() {
49 + float l = LINELUMA_texOff(vec2(-0.5, 0.0)).x;
50 + float c = LINELUMA_tex(LINELUMA_pos).x;
51 + float r = LINELUMA_texOff(vec2(0.5, 0.0)).x;
53 + float xgrad = (-l + r);
54 + float ygrad = (l + c + c + r);
56 + return vec4(xgrad, ygrad, 0.0, 0.0);
60 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Sobel-Y
61 +//!HOOK MAIN
62 +//!BIND LINESOBEL
63 +//!SAVE LINESOBEL
64 +//!WIDTH HOOKED.w 4 /
65 +//!HEIGHT HOOKED.h 4 /
66 +//!COMPONENTS 1
68 +vec4 hook() {
69 + float tx = LINESOBEL_texOff(vec2(0.0, -0.25)).x;
70 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
71 + float bx = LINESOBEL_texOff(vec2(0.0, 0.25)).x;
73 + float ty = LINESOBEL_texOff(vec2(0.0, -0.25)).y;
74 + float by = LINESOBEL_texOff(vec2(0.0, 0.25)).y;
76 + float xgrad = (tx + cx + cx + bx) / 8.0;
78 + float ygrad = (-ty + by) / 8.0;
80 + //Computes the luminance's gradient
81 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
82 + return vec4(pow(norm, 0.7));
86 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Gaussian-X
87 +//!HOOK MAIN
88 +//!BIND HOOKED
89 +//!BIND LINESOBEL
90 +//!SAVE LINESOBEL
91 +//!WIDTH HOOKED.w 4 /
92 +//!HEIGHT HOOKED.h 4 /
93 +//!COMPONENTS 1
95 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
97 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
98 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
99 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
101 +float gaussian(float x, float s, float m) {
102 + float scaled = (x - m) / s;
103 + return exp(-0.5 * scaled * scaled);
106 +float comp_gaussian_x() {
108 + float g = 0.0;
109 + float gn = 0.0;
111 + for (int i=0; i<KERNELSIZE; i++) {
112 + float di = float(i - KERNELHALFSIZE);
113 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
115 + g = g + LINESOBEL_texOff(vec2(di, 0.0)).x * gf;
116 + gn = gn + gf;
120 + return g / gn;
123 +vec4 hook() {
124 + return vec4(comp_gaussian_x(), 0.0, 0.0, 0.0);
128 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Gaussian-Y
129 +//!HOOK MAIN
130 +//!BIND HOOKED
131 +//!BIND LINESOBEL
132 +//!SAVE LINESOBEL
133 +//!WIDTH HOOKED.w 4 /
134 +//!HEIGHT HOOKED.h 4 /
135 +//!COMPONENTS 1
137 +#define SPATIAL_SIGMA (0.5 * float(HOOKED_size.y) / 1080.0) //Spatial window size, must be a positive real number.
139 +#define KERNELSIZE (max(int(ceil(SPATIAL_SIGMA * 2.0)), 1) * 2 + 1) //Kernel size, must be an positive odd integer.
140 +#define KERNELHALFSIZE (int(KERNELSIZE/2)) //Half of the kernel size without remainder. Must be equal to trunc(KERNELSIZE/2).
141 +#define KERNELLEN (KERNELSIZE * KERNELSIZE) //Total area of kernel. Must be equal to KERNELSIZE * KERNELSIZE.
143 +float gaussian(float x, float s, float m) {
144 + float scaled = (x - m) / s;
145 + return exp(-0.5 * scaled * scaled);
148 +float comp_gaussian_y() {
150 + float g = 0.0;
151 + float gn = 0.0;
153 + for (int i=0; i<KERNELSIZE; i++) {
154 + float di = float(i - KERNELHALFSIZE);
155 + float gf = gaussian(di, SPATIAL_SIGMA, 0.0);
157 + g = g + LINESOBEL_texOff(vec2(0.0, di)).x * gf;
158 + gn = gn + gf;
162 + return g / gn;
165 +vec4 hook() {
166 + return vec4(comp_gaussian_y(), 0.0, 0.0, 0.0);
169 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Kernel-X
170 +//!HOOK MAIN
171 +//!BIND LINESOBEL
172 +//!SAVE LINESOBEL
173 +//!WIDTH HOOKED.w 4 /
174 +//!HEIGHT HOOKED.h 4 /
175 +//!COMPONENTS 2
177 +vec4 hook() {
178 + float l = LINESOBEL_texOff(vec2(-0.25, 0.0)).x;
179 + float c = LINESOBEL_tex(LINESOBEL_pos).x;
180 + float r = LINESOBEL_texOff(vec2(0.25, 0.0)).x;
182 + float xgrad = (-l + r);
183 + float ygrad = (l + c + c + r);
185 + return vec4(xgrad, ygrad, 0.0, 0.0);
189 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Kernel-Y
190 +//!HOOK MAIN
191 +//!BIND LINESOBEL
192 +//!SAVE LINESOBEL
193 +//!WIDTH HOOKED.w 4 /
194 +//!HEIGHT HOOKED.h 4 /
195 +//!COMPONENTS 2
197 +vec4 hook() {
198 + float tx = LINESOBEL_texOff(vec2(0.0, -0.25)).x;
199 + float cx = LINESOBEL_tex(LINESOBEL_pos).x;
200 + float bx = LINESOBEL_texOff(vec2(0.0, 0.25)).x;
202 + float ty = LINESOBEL_texOff(vec2(0.0, -0.25)).y;
203 + float by = LINESOBEL_texOff(vec2(0.0, 0.25)).y;
205 + float xgrad = (tx + cx + cx + bx) / 8.0;
207 + float ygrad = (-ty + by) / 8.0;
209 + //Computes the luminance's gradient
210 + return vec4(xgrad, ygrad, 0.0, 0.0);
214 +//!DESC Anime4K-v3.2-Thin-(VeryFast)-Warp
215 +//!HOOK MAIN
216 +//!BIND HOOKED
217 +//!BIND LINESOBEL
219 +#define STRENGTH 0.6 //Strength of warping for each iteration
220 +#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
222 +vec4 hook() {
223 + vec2 d = HOOKED_pt;
225 + float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
227 + vec2 pos = HOOKED_pos;
228 + for (int i=0; i<ITERATIONS; i++) {
229 + vec2 dn = LINESOBEL_tex(pos).xy;
230 + vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
231 + pos -= dd;
234 + return HOOKED_tex(pos);

mpv/shaders/Anime4K_Upscale_DTD_x2.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
39 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 -//!HOOK MAIN
41 -//!BIND HOOKED
42 -//!BIND LINELUMA
43 -//!SAVE MMKERNEL
44 -//!COMPONENTS 1
46 -#define L_tex LINELUMA_tex
48 -#define SIGMA 1.0
50 -float gaussian(float x, float s, float m) {
51 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
54 -float lumGaussian(vec2 pos, vec2 d) {
55 - float s = SIGMA * HOOKED_size.y / 1080.0;
56 - float kernel_size = s * 2.0 + 1.0;
58 - float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
59 - float gn = gaussian(0.0, s, 0.0);
61 - g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
62 - gn += gaussian(1.0, s, 0.0) * 2.0;
64 - for (int i=2; float(i)<kernel_size; i++) {
65 - g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
66 - gn += gaussian(float(i), s, 0.0) * 2.0;
67 - }
69 - return g / gn;
72 -vec4 hook() {
73 - return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
76 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
77 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
78 -//!HOOK MAIN
79 -//!BIND HOOKED
80 -//!BIND LINELUMA
81 -//!BIND MMKERNEL
82 -//!SAVE MMKERNEL
83 -//!COMPONENTS 1
85 -#define L_tex MMKERNEL_tex
87 -#define SIGMA 1.0
89 -float gaussian(float x, float s, float m) {
90 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
93 -float lumGaussian(vec2 pos, vec2 d) {
94 - float s = SIGMA * HOOKED_size.y / 1080.0;
95 - float kernel_size = s * 2.0 + 1.0;
97 - float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
98 - float gn = gaussian(0.0, s, 0.0);
100 - g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
101 - gn += gaussian(1.0, s, 0.0) * 2.0;
103 - for (int i=2; float(i)<kernel_size; i++) {
104 - g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
105 - gn += gaussian(float(i), s, 0.0) * 2.0;
106 - }
108 - return g / gn;
111 -vec4 hook() {
112 - return vec4(min(LINELUMA_tex(HOOKED_pos).x - lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0.0));
115 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
116 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
117 -//!HOOK MAIN
118 -//!BIND HOOKED
119 -//!BIND MMKERNEL
120 -//!SAVE MMKERNEL
121 -//!COMPONENTS 1
123 -#define L_tex MMKERNEL_tex
125 -#define SIGMA 0.4
127 -float gaussian(float x, float s, float m) {
128 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
131 -float lumGaussian(vec2 pos, vec2 d) {
132 - float s = SIGMA * HOOKED_size.y / 1080.0;
133 - float kernel_size = s * 2.0 + 1.0;
135 - float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
136 - float gn = gaussian(0.0, s, 0.0);
138 - g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
139 - gn += gaussian(1.0, s, 0.0) * 2.0;
141 - for (int i=2; float(i)<kernel_size; i++) {
142 - g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
143 - gn += gaussian(float(i), s, 0.0) * 2.0;
144 - }
146 - return g / gn;
149 -vec4 hook() {
150 - return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
153 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
154 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
155 -//!HOOK MAIN
156 -//!BIND HOOKED
157 -//!BIND MMKERNEL
158 -//!SAVE MMKERNEL
159 -//!COMPONENTS 1
161 -#define L_tex MMKERNEL_tex
163 -#define SIGMA 0.4
165 -float gaussian(float x, float s, float m) {
166 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
169 -float lumGaussian(vec2 pos, vec2 d) {
170 - float s = SIGMA * HOOKED_size.y / 1080.0;
171 - float kernel_size = s * 2.0 + 1.0;
173 - float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
174 - float gn = gaussian(0.0, s, 0.0);
176 - g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
177 - gn += gaussian(1.0, s, 0.0) * 2.0;
179 - for (int i=2; float(i)<kernel_size; i++) {
180 - g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
181 - gn += gaussian(float(i), s, 0.0) * 2.0;
182 - }
184 - return g / gn;
187 -vec4 hook() {
188 - return vec4(lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y)));
191 -//!DESC Anime4K-v3.2-Upscale-DTD-x2
192 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
193 -//!HOOK MAIN
194 -//!BIND HOOKED
195 -//!BIND MMKERNEL
197 -#define STRENGTH 1.8 //Line darken proportional strength, higher is darker.
199 -vec4 hook() {
200 - float c = (MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
201 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
202 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
203 - return HOOKED_tex(HOOKED_pos) + c;
206 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
207 -//!HOOK MAIN
208 -//!BIND HOOKED
209 -//!SAVE LINELUMA
210 -//!COMPONENTS 1
212 -float get_luma(vec4 rgba) {
213 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
216 -vec4 hook() {
217 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
220 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
221 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
222 -//!HOOK MAIN
223 -//!BIND HOOKED
224 -//!BIND LINELUMA
225 -//!SAVE LUMAD
226 -//!COMPONENTS 2
228 -#define L_tex LINELUMA_tex
230 -vec4 hook() {
231 - vec2 d = HOOKED_pt;
233 - //[tl t tr]
234 - //[ l c r]
235 - //[bl b br]
236 - float l = L_tex(HOOKED_pos + vec2(-d.x, 0)).x;
237 - float c = L_tex(HOOKED_pos).x;
238 - float r = L_tex(HOOKED_pos + vec2(d.x, 0)).x;
241 - //Horizontal Gradient
242 - //[-1 0 1]
243 - //[-2 0 2]
244 - //[-1 0 1]
245 - float xgrad = (-l + r);
247 - //Vertical Gradient
248 - //[-1 -2 -1]
249 - //[ 0 0 0]
250 - //[ 1 2 1]
251 - float ygrad = (l + c + c + r);
253 - //Computes the luminance's gradient
254 - return vec4(xgrad, ygrad, 0, 0);
258 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
259 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
260 -//!HOOK MAIN
261 -//!BIND HOOKED
262 -//!BIND LUMAD
263 -//!SAVE LUMAD
264 -//!COMPONENTS 1
266 -vec4 hook() {
267 - vec2 d = HOOKED_pt;
269 - //[tl t tr]
270 - //[ l cc r]
271 - //[bl b br]
272 - float tx = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).x;
273 - float cx = LUMAD_tex(HOOKED_pos).x;
274 - float bx = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).x;
277 - float ty = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).y;
278 - //float cy = LUMAD_tex(HOOKED_pos).y;
279 - float by = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).y;
282 - //Horizontal Gradient
283 - //[-1 0 1]
284 - //[-2 0 2]
285 - //[-1 0 1]
286 - float xgrad = (tx + cx + cx + bx) / 8.0;
288 - //Vertical Gradient
289 - //[-1 -2 -1]
290 - //[ 0 0 0]
291 - //[ 1 2 1]
292 - float ygrad = (-ty + by) / 8.0;
294 - //Computes the luminance's gradient
295 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
296 - return vec4(pow(norm, 0.7));
300 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
301 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
302 -//!HOOK MAIN
303 -//!BIND HOOKED
304 -//!BIND LUMAD
305 -//!SAVE LUMADG
306 -//!COMPONENTS 1
308 -#define L_tex LUMAD_tex
310 -#define SIGMA (HOOKED_size.y / 1080.0) * 2.0
311 -#define KERNELSIZE (SIGMA * 2.0 + 1.0)
313 -float gaussian(float x, float s, float m) {
314 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
317 -float lumGaussian(vec2 pos, vec2 d) {
318 - float g = (L_tex(pos).x) * gaussian(0.0, SIGMA, 0.0);
319 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, SIGMA, 0.0);
320 - for (int i=2; float(i)<KERNELSIZE; i++) {
321 - g = g + (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), SIGMA, 0.0);
322 - }
324 - return g;
327 -vec4 hook() {
328 - return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
332 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
333 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
334 -//!HOOK MAIN
335 -//!BIND HOOKED
336 -//!BIND LUMAD
337 -//!BIND LUMADG
338 -//!SAVE LUMAD
339 -//!COMPONENTS 1
341 -#define L_tex LUMADG_tex
343 -#define SIGMA (HOOKED_size.y / 1080.0) * 2.0
344 -#define KERNELSIZE (SIGMA * 2.0 + 1.0)
346 -float gaussian(float x, float s, float m) {
347 - return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
350 -float lumGaussian(vec2 pos, vec2 d) {
351 - float g = (L_tex(pos).x) * gaussian(0.0, SIGMA, 0.0);
352 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, SIGMA, 0.0);
353 - for (int i=2; float(i)<KERNELSIZE; i++) {
354 - g = g + (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), SIGMA, 0.0);
355 - }
357 - return g;
360 -vec4 hook() {
361 - float g = lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y));
362 - return vec4(g);
368 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
369 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
370 -//!HOOK MAIN
371 -//!BIND HOOKED
372 -//!BIND LUMAD
373 -//!SAVE LUMAD2
374 -//!COMPONENTS 2
376 -vec4 hook() {
377 - vec2 d = HOOKED_pt;
379 - //[tl t tr]
380 - //[ l c r]
381 - //[bl b br]
382 - float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0)).x;
383 - float c = LUMAD_tex(HOOKED_pos).x;
384 - float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0)).x;
387 - //Horizontal Gradient
388 - //[-1 0 1]
389 - //[-2 0 2]
390 - //[-1 0 1]
391 - float xgrad = (-l + r);
393 - //Vertical Gradient
394 - //[-1 -2 -1]
395 - //[ 0 0 0]
396 - //[ 1 2 1]
397 - float ygrad = (l + c + c + r);
399 - //Computes the luminance's gradient
400 - return vec4(xgrad, ygrad, 0, 0);
404 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
405 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
406 -//!HOOK MAIN
407 -//!BIND HOOKED
408 -//!BIND LUMAD2
409 -//!SAVE LUMAD2
410 -//!COMPONENTS 2
412 -vec4 hook() {
413 - vec2 d = HOOKED_pt;
415 - //[tl t tr]
416 - //[ l cc r]
417 - //[bl b br]
418 - float tx = LUMAD2_tex(HOOKED_pos + vec2(0, -d.y)).x;
419 - float cx = LUMAD2_tex(HOOKED_pos).x;
420 - float bx = LUMAD2_tex(HOOKED_pos + vec2(0, d.y)).x;
423 - float ty = LUMAD2_tex(HOOKED_pos + vec2(0, -d.y)).y;
424 - //float cy = LUMAD2_tex(HOOKED_pos).y;
425 - float by = LUMAD2_tex(HOOKED_pos + vec2(0, d.y)).y;
428 - //Horizontal Gradient
429 - //[-1 0 1]
430 - //[-2 0 2]
431 - //[-1 0 1]
432 - float xgrad = (tx + cx + cx + bx) / 8.0;
434 - //Vertical Gradient
435 - //[-1 -2 -1]
436 - //[ 0 0 0]
437 - //[ 1 2 1]
438 - float ygrad = (-ty + by) / 8.0;
440 - //Computes the luminance's gradient
441 - return vec4(xgrad, ygrad, 0, 0);
444 -//!DESC Anime4K-v3.2-Upscale-DTD-x2
445 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
446 -//!HOOK MAIN
447 -//!BIND HOOKED
448 -//!BIND LUMAD
449 -//!BIND LUMAD2
450 -//!SAVE MAINTEMPTHIN
451 -//!WIDTH MAIN.w 2 *
452 -//!HEIGHT MAIN.h 2 *
454 -#define STRENGTH 0.4 //Strength of warping for each iteration
455 -#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
457 -#define L_tex HOOKED_tex
459 -vec4 hook() {
460 - vec2 d = HOOKED_pt;
462 - float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
464 - vec2 pos = HOOKED_pos;
465 - for (int i=0; i<ITERATIONS; i++) {
466 - vec2 dn = LUMAD2_tex(pos).xy;
467 - vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
468 - pos -= dd;
469 - }
471 - return L_tex(pos);
475 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
476 -//!HOOK MAIN
477 -//!BIND HOOKED
478 -//!BIND MAINTEMPTHIN
479 -//!COMPONENTS 1
480 -//!SAVE MAINTEMP
481 -//!WIDTH MAIN.w 2 *
482 -//!HEIGHT MAIN.h 2 *
484 -float get_luma(vec4 rgba) {
485 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
488 -vec4 hook() {
489 - return vec4(get_luma(MAINTEMPTHIN_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
492 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
493 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
494 -//!HOOK MAIN
495 -//!BIND HOOKED
496 -//!BIND MAINTEMP
497 -//!SAVE MMKERNEL
498 -//!COMPONENTS 3
500 -#define L_tex MAINTEMP_tex
502 -float max3v(float a, float b, float c) {
503 - return max(max(a, b), c);
505 -float min3v(float a, float b, float c) {
506 - return min(min(a, b), c);
509 -vec2 minmax3(vec2 pos, vec2 d) {
510 - float a = L_tex(pos - d).x;
511 - float b = L_tex(pos).x;
512 - float c = L_tex(pos + d).x;
514 - return vec2(min3v(a, b, c), max3v(a, b, c));
517 -float lumGaussian7(vec2 pos, vec2 d) {
518 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
519 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
520 - g = g + (L_tex(pos).x) * 0.38774;
522 - return g;
526 -vec4 hook() {
527 - return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
531 -//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
532 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
533 -//!HOOK MAIN
534 -//!BIND HOOKED
535 -//!BIND MMKERNEL
536 -//!SAVE MMKERNEL
537 -//!COMPONENTS 3
539 -#define L_tex MMKERNEL_tex
541 -float max3v(float a, float b, float c) {
542 - return max(max(a, b), c);
544 -float min3v(float a, float b, float c) {
545 - return min(min(a, b), c);
548 -vec2 minmax3(vec2 pos, vec2 d) {
549 - float a0 = L_tex(pos - d).y;
550 - float b0 = L_tex(pos).y;
551 - float c0 = L_tex(pos + d).y;
553 - float a1 = L_tex(pos - d).z;
554 - float b1 = L_tex(pos).z;
555 - float c1 = L_tex(pos + d).z;
557 - return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
560 -float lumGaussian7(vec2 pos, vec2 d) {
561 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
562 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
563 - g = g + (L_tex(pos).x) * 0.38774;
565 - return g;
569 -vec4 hook() {
570 - return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
573 -//!DESC Anime4K-v3.2-Upscale-DTD-x2
574 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
575 -//!HOOK MAIN
576 -//!BIND HOOKED
577 -//!BIND MAINTEMPTHIN
578 -//!BIND MAINTEMP
579 -//!BIND MMKERNEL
580 -//!WIDTH MAIN.w 2 *
581 -//!HEIGHT MAIN.h 2 *
583 -#define STRENGTH 0.5 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
584 -#define BLUR_CURVE 0.8 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
585 -#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
586 -#define NOISE_THRESHOLD 0.004 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
588 -#define L_tex MAINTEMP_tex
590 -vec4 hook() {
591 - float c = (L_tex(HOOKED_pos).x - MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
593 - float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
595 - float c_t = abs(c);
596 - if (c_t > NOISE_THRESHOLD) {
597 - c_t = (c_t - NOISE_THRESHOLD) / t_range;
598 - c_t = pow(c_t, BLUR_CURVE);
599 - c_t = c_t * t_range + NOISE_THRESHOLD;
600 - c_t = c_t * sign(c);
601 - } else {
602 - c_t = c;
603 - }
605 - float cc = clamp(c_t + L_tex(HOOKED_pos).x, MMKERNEL_tex(HOOKED_pos).y, MMKERNEL_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
607 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
608 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
609 - return MAINTEMPTHIN_tex(HOOKED_pos) + cc;
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
39 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 +//!HOOK MAIN
41 +//!BIND HOOKED
42 +//!BIND LINELUMA
43 +//!SAVE MMKERNEL
44 +//!COMPONENTS 1
46 +#define L_tex LINELUMA_tex
48 +#define SIGMA 1.0
50 +float gaussian(float x, float s, float m) {
51 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
54 +float lumGaussian(vec2 pos, vec2 d) {
55 + float s = SIGMA * HOOKED_size.y / 1080.0;
56 + float kernel_size = s * 2.0 + 1.0;
58 + float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
59 + float gn = gaussian(0.0, s, 0.0);
61 + g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
62 + gn += gaussian(1.0, s, 0.0) * 2.0;
64 + for (int i=2; float(i)<kernel_size; i++) {
65 + g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
66 + gn += gaussian(float(i), s, 0.0) * 2.0;
67 + }
69 + return g / gn;
72 +vec4 hook() {
73 + return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
76 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
77 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
78 +//!HOOK MAIN
79 +//!BIND HOOKED
80 +//!BIND LINELUMA
81 +//!BIND MMKERNEL
82 +//!SAVE MMKERNEL
83 +//!COMPONENTS 1
85 +#define L_tex MMKERNEL_tex
87 +#define SIGMA 1.0
89 +float gaussian(float x, float s, float m) {
90 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
93 +float lumGaussian(vec2 pos, vec2 d) {
94 + float s = SIGMA * HOOKED_size.y / 1080.0;
95 + float kernel_size = s * 2.0 + 1.0;
97 + float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
98 + float gn = gaussian(0.0, s, 0.0);
100 + g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
101 + gn += gaussian(1.0, s, 0.0) * 2.0;
103 + for (int i=2; float(i)<kernel_size; i++) {
104 + g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
105 + gn += gaussian(float(i), s, 0.0) * 2.0;
108 + return g / gn;
111 +vec4 hook() {
112 + return vec4(min(LINELUMA_tex(HOOKED_pos).x - lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0.0));
115 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
116 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
117 +//!HOOK MAIN
118 +//!BIND HOOKED
119 +//!BIND MMKERNEL
120 +//!SAVE MMKERNEL
121 +//!COMPONENTS 1
123 +#define L_tex MMKERNEL_tex
125 +#define SIGMA 0.4
127 +float gaussian(float x, float s, float m) {
128 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
131 +float lumGaussian(vec2 pos, vec2 d) {
132 + float s = SIGMA * HOOKED_size.y / 1080.0;
133 + float kernel_size = s * 2.0 + 1.0;
135 + float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
136 + float gn = gaussian(0.0, s, 0.0);
138 + g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
139 + gn += gaussian(1.0, s, 0.0) * 2.0;
141 + for (int i=2; float(i)<kernel_size; i++) {
142 + g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
143 + gn += gaussian(float(i), s, 0.0) * 2.0;
146 + return g / gn;
149 +vec4 hook() {
150 + return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
153 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
154 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
155 +//!HOOK MAIN
156 +//!BIND HOOKED
157 +//!BIND MMKERNEL
158 +//!SAVE MMKERNEL
159 +//!COMPONENTS 1
161 +#define L_tex MMKERNEL_tex
163 +#define SIGMA 0.4
165 +float gaussian(float x, float s, float m) {
166 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
169 +float lumGaussian(vec2 pos, vec2 d) {
170 + float s = SIGMA * HOOKED_size.y / 1080.0;
171 + float kernel_size = s * 2.0 + 1.0;
173 + float g = (L_tex(pos).x) * gaussian(0.0, s, 0.0);
174 + float gn = gaussian(0.0, s, 0.0);
176 + g += (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, s, 0.0);
177 + gn += gaussian(1.0, s, 0.0) * 2.0;
179 + for (int i=2; float(i)<kernel_size; i++) {
180 + g += (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), s, 0.0);
181 + gn += gaussian(float(i), s, 0.0) * 2.0;
184 + return g / gn;
187 +vec4 hook() {
188 + return vec4(lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y)));
191 +//!DESC Anime4K-v3.2-Upscale-DTD-x2
192 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
193 +//!HOOK MAIN
194 +//!BIND HOOKED
195 +//!BIND MMKERNEL
197 +#define STRENGTH 1.8 //Line darken proportional strength, higher is darker.
199 +vec4 hook() {
200 + float c = (MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
201 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
202 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
203 + return HOOKED_tex(HOOKED_pos) + c;
206 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
207 +//!HOOK MAIN
208 +//!BIND HOOKED
209 +//!SAVE LINELUMA
210 +//!COMPONENTS 1
212 +float get_luma(vec4 rgba) {
213 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
216 +vec4 hook() {
217 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
220 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
221 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
222 +//!HOOK MAIN
223 +//!BIND HOOKED
224 +//!BIND LINELUMA
225 +//!SAVE LUMAD
226 +//!COMPONENTS 2
228 +#define L_tex LINELUMA_tex
230 +vec4 hook() {
231 + vec2 d = HOOKED_pt;
233 + //[tl t tr]
234 + //[ l c r]
235 + //[bl b br]
236 + float l = L_tex(HOOKED_pos + vec2(-d.x, 0)).x;
237 + float c = L_tex(HOOKED_pos).x;
238 + float r = L_tex(HOOKED_pos + vec2(d.x, 0)).x;
241 + //Horizontal Gradient
242 + //[-1 0 1]
243 + //[-2 0 2]
244 + //[-1 0 1]
245 + float xgrad = (-l + r);
247 + //Vertical Gradient
248 + //[-1 -2 -1]
249 + //[ 0 0 0]
250 + //[ 1 2 1]
251 + float ygrad = (l + c + c + r);
253 + //Computes the luminance's gradient
254 + return vec4(xgrad, ygrad, 0, 0);
258 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
259 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
260 +//!HOOK MAIN
261 +//!BIND HOOKED
262 +//!BIND LUMAD
263 +//!SAVE LUMAD
264 +//!COMPONENTS 1
266 +vec4 hook() {
267 + vec2 d = HOOKED_pt;
269 + //[tl t tr]
270 + //[ l cc r]
271 + //[bl b br]
272 + float tx = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).x;
273 + float cx = LUMAD_tex(HOOKED_pos).x;
274 + float bx = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).x;
277 + float ty = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).y;
278 + //float cy = LUMAD_tex(HOOKED_pos).y;
279 + float by = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).y;
282 + //Horizontal Gradient
283 + //[-1 0 1]
284 + //[-2 0 2]
285 + //[-1 0 1]
286 + float xgrad = (tx + cx + cx + bx) / 8.0;
288 + //Vertical Gradient
289 + //[-1 -2 -1]
290 + //[ 0 0 0]
291 + //[ 1 2 1]
292 + float ygrad = (-ty + by) / 8.0;
294 + //Computes the luminance's gradient
295 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
296 + return vec4(pow(norm, 0.7));
300 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
301 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
302 +//!HOOK MAIN
303 +//!BIND HOOKED
304 +//!BIND LUMAD
305 +//!SAVE LUMADG
306 +//!COMPONENTS 1
308 +#define L_tex LUMAD_tex
310 +#define SIGMA (HOOKED_size.y / 1080.0) * 2.0
311 +#define KERNELSIZE (SIGMA * 2.0 + 1.0)
313 +float gaussian(float x, float s, float m) {
314 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
317 +float lumGaussian(vec2 pos, vec2 d) {
318 + float g = (L_tex(pos).x) * gaussian(0.0, SIGMA, 0.0);
319 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, SIGMA, 0.0);
320 + for (int i=2; float(i)<KERNELSIZE; i++) {
321 + g = g + (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), SIGMA, 0.0);
324 + return g;
327 +vec4 hook() {
328 + return vec4(lumGaussian(HOOKED_pos, vec2(HOOKED_pt.x, 0)));
332 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
333 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
334 +//!HOOK MAIN
335 +//!BIND HOOKED
336 +//!BIND LUMAD
337 +//!BIND LUMADG
338 +//!SAVE LUMAD
339 +//!COMPONENTS 1
341 +#define L_tex LUMADG_tex
343 +#define SIGMA (HOOKED_size.y / 1080.0) * 2.0
344 +#define KERNELSIZE (SIGMA * 2.0 + 1.0)
346 +float gaussian(float x, float s, float m) {
347 + return (1.0 / (s * sqrt(2.0 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0));
350 +float lumGaussian(vec2 pos, vec2 d) {
351 + float g = (L_tex(pos).x) * gaussian(0.0, SIGMA, 0.0);
352 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * gaussian(1.0, SIGMA, 0.0);
353 + for (int i=2; float(i)<KERNELSIZE; i++) {
354 + g = g + (L_tex(pos - (d * float(i))).x + L_tex(pos + (d * float(i))).x) * gaussian(float(i), SIGMA, 0.0);
357 + return g;
360 +vec4 hook() {
361 + float g = lumGaussian(HOOKED_pos, vec2(0, HOOKED_pt.y));
362 + return vec4(g);
368 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
369 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
370 +//!HOOK MAIN
371 +//!BIND HOOKED
372 +//!BIND LUMAD
373 +//!SAVE LUMAD2
374 +//!COMPONENTS 2
376 +vec4 hook() {
377 + vec2 d = HOOKED_pt;
379 + //[tl t tr]
380 + //[ l c r]
381 + //[bl b br]
382 + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0)).x;
383 + float c = LUMAD_tex(HOOKED_pos).x;
384 + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0)).x;
387 + //Horizontal Gradient
388 + //[-1 0 1]
389 + //[-2 0 2]
390 + //[-1 0 1]
391 + float xgrad = (-l + r);
393 + //Vertical Gradient
394 + //[-1 -2 -1]
395 + //[ 0 0 0]
396 + //[ 1 2 1]
397 + float ygrad = (l + c + c + r);
399 + //Computes the luminance's gradient
400 + return vec4(xgrad, ygrad, 0, 0);
404 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
405 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
406 +//!HOOK MAIN
407 +//!BIND HOOKED
408 +//!BIND LUMAD2
409 +//!SAVE LUMAD2
410 +//!COMPONENTS 2
412 +vec4 hook() {
413 + vec2 d = HOOKED_pt;
415 + //[tl t tr]
416 + //[ l cc r]
417 + //[bl b br]
418 + float tx = LUMAD2_tex(HOOKED_pos + vec2(0, -d.y)).x;
419 + float cx = LUMAD2_tex(HOOKED_pos).x;
420 + float bx = LUMAD2_tex(HOOKED_pos + vec2(0, d.y)).x;
423 + float ty = LUMAD2_tex(HOOKED_pos + vec2(0, -d.y)).y;
424 + //float cy = LUMAD2_tex(HOOKED_pos).y;
425 + float by = LUMAD2_tex(HOOKED_pos + vec2(0, d.y)).y;
428 + //Horizontal Gradient
429 + //[-1 0 1]
430 + //[-2 0 2]
431 + //[-1 0 1]
432 + float xgrad = (tx + cx + cx + bx) / 8.0;
434 + //Vertical Gradient
435 + //[-1 -2 -1]
436 + //[ 0 0 0]
437 + //[ 1 2 1]
438 + float ygrad = (-ty + by) / 8.0;
440 + //Computes the luminance's gradient
441 + return vec4(xgrad, ygrad, 0, 0);
444 +//!DESC Anime4K-v3.2-Upscale-DTD-x2
445 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
446 +//!HOOK MAIN
447 +//!BIND HOOKED
448 +//!BIND LUMAD
449 +//!BIND LUMAD2
450 +//!SAVE MAINTEMPTHIN
451 +//!WIDTH MAIN.w 2 *
452 +//!HEIGHT MAIN.h 2 *
454 +#define STRENGTH 0.4 //Strength of warping for each iteration
455 +#define ITERATIONS 1 //Number of iterations for the forwards solver, decreasing strength and increasing iterations improves quality at the cost of speed.
457 +#define L_tex HOOKED_tex
459 +vec4 hook() {
460 + vec2 d = HOOKED_pt;
462 + float relstr = HOOKED_size.y / 1080.0 * STRENGTH;
464 + vec2 pos = HOOKED_pos;
465 + for (int i=0; i<ITERATIONS; i++) {
466 + vec2 dn = LUMAD2_tex(pos).xy;
467 + vec2 dd = (dn / (length(dn) + 0.01)) * d * relstr; //Quasi-normalization for large vectors, avoids divide by zero
468 + pos -= dd;
471 + return L_tex(pos);
475 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Luma
476 +//!HOOK MAIN
477 +//!BIND HOOKED
478 +//!BIND MAINTEMPTHIN
479 +//!COMPONENTS 1
480 +//!SAVE MAINTEMP
481 +//!WIDTH MAIN.w 2 *
482 +//!HEIGHT MAIN.h 2 *
484 +float get_luma(vec4 rgba) {
485 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
488 +vec4 hook() {
489 + return vec4(get_luma(MAINTEMPTHIN_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
492 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-X
493 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
494 +//!HOOK MAIN
495 +//!BIND HOOKED
496 +//!BIND MAINTEMP
497 +//!SAVE MMKERNEL
498 +//!COMPONENTS 3
500 +#define L_tex MAINTEMP_tex
502 +float max3v(float a, float b, float c) {
503 + return max(max(a, b), c);
505 +float min3v(float a, float b, float c) {
506 + return min(min(a, b), c);
509 +vec2 minmax3(vec2 pos, vec2 d) {
510 + float a = L_tex(pos - d).x;
511 + float b = L_tex(pos).x;
512 + float c = L_tex(pos + d).x;
514 + return vec2(min3v(a, b, c), max3v(a, b, c));
517 +float lumGaussian7(vec2 pos, vec2 d) {
518 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
519 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
520 + g = g + (L_tex(pos).x) * 0.38774;
522 + return g;
526 +vec4 hook() {
527 + return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
531 +//!DESC Anime4K-v3.2-Upscale-DTD-x2-Kernel-Y
532 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
533 +//!HOOK MAIN
534 +//!BIND HOOKED
535 +//!BIND MMKERNEL
536 +//!SAVE MMKERNEL
537 +//!COMPONENTS 3
539 +#define L_tex MMKERNEL_tex
541 +float max3v(float a, float b, float c) {
542 + return max(max(a, b), c);
544 +float min3v(float a, float b, float c) {
545 + return min(min(a, b), c);
548 +vec2 minmax3(vec2 pos, vec2 d) {
549 + float a0 = L_tex(pos - d).y;
550 + float b0 = L_tex(pos).y;
551 + float c0 = L_tex(pos + d).y;
553 + float a1 = L_tex(pos - d).z;
554 + float b1 = L_tex(pos).z;
555 + float c1 = L_tex(pos + d).z;
557 + return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
560 +float lumGaussian7(vec2 pos, vec2 d) {
561 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
562 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
563 + g = g + (L_tex(pos).x) * 0.38774;
565 + return g;
569 +vec4 hook() {
570 + return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
573 +//!DESC Anime4K-v3.2-Upscale-DTD-x2
574 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
575 +//!HOOK MAIN
576 +//!BIND HOOKED
577 +//!BIND MAINTEMPTHIN
578 +//!BIND MAINTEMP
579 +//!BIND MMKERNEL
580 +//!WIDTH MAIN.w 2 *
581 +//!HEIGHT MAIN.h 2 *
583 +#define STRENGTH 0.5 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
584 +#define BLUR_CURVE 0.8 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
585 +#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
586 +#define NOISE_THRESHOLD 0.004 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
588 +#define L_tex MAINTEMP_tex
590 +vec4 hook() {
591 + float c = (L_tex(HOOKED_pos).x - MMKERNEL_tex(HOOKED_pos).x) * STRENGTH;
593 + float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
595 + float c_t = abs(c);
596 + if (c_t > NOISE_THRESHOLD) {
597 + c_t = (c_t - NOISE_THRESHOLD) / t_range;
598 + c_t = pow(c_t, BLUR_CURVE);
599 + c_t = c_t * t_range + NOISE_THRESHOLD;
600 + c_t = c_t * sign(c);
601 + } else {
602 + c_t = c;
605 + float cc = clamp(c_t + L_tex(HOOKED_pos).x, MMKERNEL_tex(HOOKED_pos).y, MMKERNEL_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
607 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
608 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
609 + return MAINTEMPTHIN_tex(HOOKED_pos) + cc;

mpv/shaders/Anime4K_Upscale_Deblur_DoG_x2.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Kernel-X
39 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 -//!HOOK MAIN
41 -//!BIND HOOKED
42 -//!BIND LINELUMA
43 -//!SAVE GAUSS_X2
44 -//!COMPONENTS 3
46 -#define L_tex LINELUMA_tex
48 -float max3v(float a, float b, float c) {
49 - return max(max(a, b), c);
51 -float min3v(float a, float b, float c) {
52 - return min(min(a, b), c);
55 -vec2 minmax3(vec2 pos, vec2 d) {
56 - float a = L_tex(pos - d).x;
57 - float b = L_tex(pos).x;
58 - float c = L_tex(pos + d).x;
60 - return vec2(min3v(a, b, c), max3v(a, b, c));
63 -float lumGaussian7(vec2 pos, vec2 d) {
64 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
65 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
66 - g = g + (L_tex(pos).x) * 0.38774;
68 - return g;
72 -vec4 hook() {
73 - return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
77 -//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Kernel-Y
78 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
79 -//!HOOK MAIN
80 -//!BIND HOOKED
81 -//!BIND GAUSS_X2
82 -//!SAVE GAUSS_X2
83 -//!COMPONENTS 3
85 -#define L_tex GAUSS_X2_tex
87 -float max3v(float a, float b, float c) {
88 - return max(max(a, b), c);
90 -float min3v(float a, float b, float c) {
91 - return min(min(a, b), c);
94 -vec2 minmax3(vec2 pos, vec2 d) {
95 - float a0 = L_tex(pos - d).y;
96 - float b0 = L_tex(pos).y;
97 - float c0 = L_tex(pos + d).y;
99 - float a1 = L_tex(pos - d).z;
100 - float b1 = L_tex(pos).z;
101 - float c1 = L_tex(pos + d).z;
103 - return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
106 -float lumGaussian7(vec2 pos, vec2 d) {
107 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
108 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
109 - g = g + (L_tex(pos).x) * 0.38774;
111 - return g;
115 -vec4 hook() {
116 - return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
119 -//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Apply
120 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
121 -//!HOOK MAIN
122 -//!BIND HOOKED
123 -//!BIND LINELUMA
124 -//!BIND GAUSS_X2
125 -//!WIDTH MAIN.w 2 *
126 -//!HEIGHT MAIN.h 2 *
128 -#define STRENGTH 0.6 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
129 -#define BLUR_CURVE 0.6 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
130 -#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
131 -#define NOISE_THRESHOLD 0.001 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
133 -#define L_tex LINELUMA_tex
135 -vec4 hook() {
136 - float c = (L_tex(HOOKED_pos).x - GAUSS_X2_tex(HOOKED_pos).x) * STRENGTH;
138 - float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
140 - float c_t = abs(c);
141 - if (c_t > NOISE_THRESHOLD && c_t < BLUR_THRESHOLD) {
142 - c_t = (c_t - NOISE_THRESHOLD) / t_range;
143 - c_t = pow(c_t, BLUR_CURVE);
144 - c_t = c_t * t_range + NOISE_THRESHOLD;
145 - c_t = c_t * sign(c);
146 - } else {
147 - c_t = c;
148 - }
150 - float cc = clamp(c_t + L_tex(HOOKED_pos).x, GAUSS_X2_tex(HOOKED_pos).y, GAUSS_X2_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
152 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
153 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
154 - return HOOKED_tex(HOOKED_pos) + cc;
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Kernel-X
39 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 +//!HOOK MAIN
41 +//!BIND HOOKED
42 +//!BIND LINELUMA
43 +//!SAVE GAUSS_X2
44 +//!COMPONENTS 3
46 +#define L_tex LINELUMA_tex
48 +float max3v(float a, float b, float c) {
49 + return max(max(a, b), c);
51 +float min3v(float a, float b, float c) {
52 + return min(min(a, b), c);
55 +vec2 minmax3(vec2 pos, vec2 d) {
56 + float a = L_tex(pos - d).x;
57 + float b = L_tex(pos).x;
58 + float c = L_tex(pos + d).x;
60 + return vec2(min3v(a, b, c), max3v(a, b, c));
63 +float lumGaussian7(vec2 pos, vec2 d) {
64 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
65 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
66 + g = g + (L_tex(pos).x) * 0.38774;
68 + return g;
72 +vec4 hook() {
73 + return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
77 +//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Kernel-Y
78 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
79 +//!HOOK MAIN
80 +//!BIND HOOKED
81 +//!BIND GAUSS_X2
82 +//!SAVE GAUSS_X2
83 +//!COMPONENTS 3
85 +#define L_tex GAUSS_X2_tex
87 +float max3v(float a, float b, float c) {
88 + return max(max(a, b), c);
90 +float min3v(float a, float b, float c) {
91 + return min(min(a, b), c);
94 +vec2 minmax3(vec2 pos, vec2 d) {
95 + float a0 = L_tex(pos - d).y;
96 + float b0 = L_tex(pos).y;
97 + float c0 = L_tex(pos + d).y;
99 + float a1 = L_tex(pos - d).z;
100 + float b1 = L_tex(pos).z;
101 + float c1 = L_tex(pos + d).z;
103 + return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
106 +float lumGaussian7(vec2 pos, vec2 d) {
107 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
108 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
109 + g = g + (L_tex(pos).x) * 0.38774;
111 + return g;
115 +vec4 hook() {
116 + return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
119 +//!DESC Anime4K-v3.2-Upscale-Deblur-DoG-x2-Apply
120 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
121 +//!HOOK MAIN
122 +//!BIND HOOKED
123 +//!BIND LINELUMA
124 +//!BIND GAUSS_X2
125 +//!WIDTH MAIN.w 2 *
126 +//!HEIGHT MAIN.h 2 *
128 +#define STRENGTH 0.6 //De-blur proportional strength, higher is sharper. However, it is better to tweak BLUR_CURVE instead to avoid ringing.
129 +#define BLUR_CURVE 0.6 //De-blur power curve, lower is sharper. Good values are between 0.3 - 1. Values greater than 1 softens the image;
130 +#define BLUR_THRESHOLD 0.1 //Value where curve kicks in, used to not de-blur already sharp edges. Only de-blur values that fall below this threshold.
131 +#define NOISE_THRESHOLD 0.001 //Value where curve stops, used to not sharpen noise. Only de-blur values that fall above this threshold.
133 +#define L_tex LINELUMA_tex
135 +vec4 hook() {
136 + float c = (L_tex(HOOKED_pos).x - GAUSS_X2_tex(HOOKED_pos).x) * STRENGTH;
138 + float t_range = BLUR_THRESHOLD - NOISE_THRESHOLD;
140 + float c_t = abs(c);
141 + if (c_t > NOISE_THRESHOLD && c_t < BLUR_THRESHOLD) {
142 + c_t = (c_t - NOISE_THRESHOLD) / t_range;
143 + c_t = pow(c_t, BLUR_CURVE);
144 + c_t = c_t * t_range + NOISE_THRESHOLD;
145 + c_t = c_t * sign(c);
146 + } else {
147 + c_t = c;
150 + float cc = clamp(c_t + L_tex(HOOKED_pos).x, GAUSS_X2_tex(HOOKED_pos).y, GAUSS_X2_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
152 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
153 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
154 + return HOOKED_tex(HOOKED_pos) + cc;

mpv/shaders/Anime4K_Upscale_Deblur_Original_x2.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE LUMAD
43 -//!WIDTH MAIN.w 2 *
44 -//!HEIGHT MAIN.h 2 *
45 -//!COMPONENTS 2
47 -vec4 hook() {
48 - vec2 d = HOOKED_pt;
50 - //[tl t tr]
51 - //[ l c r]
52 - //[bl b br]
53 - float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 - float c = LINELUMA_tex(HOOKED_pos).x;
55 - float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 - //Horizontal Gradient
59 - //[-1 0 1]
60 - //[-2 0 2]
61 - //[-1 0 1]
62 - float xgrad = (-l + r);
64 - //Vertical Gradient
65 - //[-1 -2 -1]
66 - //[ 0 0 0]
67 - //[ 1 2 1]
68 - float ygrad = (l + c + c + r);
70 - //Computes the luminance's gradient
71 - return vec4(xgrad, ygrad, 0.0, 0.0);
75 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-Y
76 -//!HOOK MAIN
77 -//!BIND HOOKED
78 -//!BIND LUMAD
79 -//!SAVE LUMAD
80 -//!WIDTH MAIN.w 2 *
81 -//!HEIGHT MAIN.h 2 *
82 -//!COMPONENTS 2
85 -/* --------------------- SETTINGS --------------------- */
87 -//Strength of edge refinement, good values are between 0.2 and 4
88 -#define REFINE_STRENGTH 1.0
91 -/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 -//Bias of the refinement function, good values are between 0 and 1
94 -#define REFINE_BIAS 0.0
96 -//Polynomial fit obtained by minimizing MSE error on image
97 -#define P5 ( 11.68129591)
98 -#define P4 (-42.46906057)
99 -#define P3 ( 60.28286266)
100 -#define P2 (-41.84451327)
101 -#define P1 ( 14.05517353)
102 -#define P0 (-1.081521930)
104 -/* ----------------- END OF SETTINGS ----------------- */
106 -float power_function(float x) {
107 - float x2 = x * x;
108 - float x3 = x2 * x;
109 - float x4 = x2 * x2;
110 - float x5 = x2 * x3;
112 - return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 -vec4 hook() {
116 - vec2 d = HOOKED_pt;
118 - //[tl t tr]
119 - //[ l cc r]
120 - //[bl b br]
121 - float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 - float cx = LUMAD_tex(HOOKED_pos).x;
123 - float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 - float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 - //float cy = LUMAD_tex(HOOKED_pos).y;
128 - float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 - //Horizontal Gradient
132 - //[-1 0 1]
133 - //[-2 0 2]
134 - //[-1 0 1]
135 - float xgrad = (tx + cx + cx + bx);
137 - //Vertical Gradient
138 - //[-1 -2 -1]
139 - //[ 0 0 0]
140 - //[ 1 2 1]
141 - float ygrad = (-ty + by);
143 - //Computes the luminance's gradient
144 - float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 - float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 - return vec4(sobel_norm, dval, 0.0, 0.0);
151 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-X
152 -//!HOOK MAIN
153 -//!BIND HOOKED
154 -//!BIND LUMAD
155 -//!SAVE LUMAMM
156 -//!WIDTH MAIN.w 2 *
157 -//!HEIGHT MAIN.h 2 *
158 -//!COMPONENTS 2
161 -vec4 hook() {
162 - vec2 d = HOOKED_pt;
164 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 - return vec4(0.0);
166 - }
168 - //[tl t tr]
169 - //[ l c r]
170 - //[bl b br]
171 - float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 - float c = LUMAD_tex(HOOKED_pos).x;
173 - float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 - //Horizontal Gradient
176 - //[-1 0 1]
177 - //[-2 0 2]
178 - //[-1 0 1]
179 - float xgrad = (-l + r);
181 - //Vertical Gradient
182 - //[-1 -2 -1]
183 - //[ 0 0 0]
184 - //[ 1 2 1]
185 - float ygrad = (l + c + c + r);
188 - return vec4(xgrad, ygrad, 0.0, 0.0);
192 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-Y
193 -//!HOOK MAIN
194 -//!BIND HOOKED
195 -//!BIND LUMAD
196 -//!BIND LUMAMM
197 -//!SAVE LUMAMM
198 -//!WIDTH MAIN.w 2 *
199 -//!HEIGHT MAIN.h 2 *
200 -//!COMPONENTS 2
202 -vec4 hook() {
203 - vec2 d = HOOKED_pt;
205 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 - return vec4(0.0);
207 - }
209 - //[tl t tr]
210 - //[ l cc r]
211 - //[bl b br]
212 - float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 - float cx = LUMAMM_tex(HOOKED_pos).x;
214 - float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 - float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 - //float cy = LUMAMM_tex(HOOKED_pos).y;
218 - float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 - //Horizontal Gradient
221 - //[-1 0 1]
222 - //[-2 0 2]
223 - //[-1 0 1]
224 - float xgrad = (tx + cx + cx + bx);
226 - //Vertical Gradient
227 - //[-1 -2 -1]
228 - //[ 0 0 0]
229 - //[ 1 2 1]
230 - float ygrad = (-ty + by);
232 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 - if (norm <= 0.001) {
234 - xgrad = 0.0;
235 - ygrad = 0.0;
236 - norm = 1.0;
237 - }
239 - return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 -//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Apply
244 -//!HOOK MAIN
245 -//!BIND HOOKED
246 -//!BIND LUMAD
247 -//!BIND LUMAMM
248 -//!WIDTH MAIN.w 2 *
249 -//!HEIGHT MAIN.h 2 *
252 -vec4 hook() {
253 - vec2 d = HOOKED_pt;
255 - float dval = LUMAD_tex(HOOKED_pos).y;
256 - if (dval < 0.1) {
257 - return HOOKED_tex(HOOKED_pos);
258 - }
260 - vec4 dc = LUMAMM_tex(HOOKED_pos);
261 - if (abs(dc.x + dc.y) <= 0.0001) {
262 - return HOOKED_tex(HOOKED_pos);
263 - }
265 - float xpos = -sign(dc.x);
266 - float ypos = -sign(dc.y);
268 - vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
269 - vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
271 - float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
273 - vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
275 - return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE LUMAD
43 +//!WIDTH MAIN.w 2 *
44 +//!HEIGHT MAIN.h 2 *
45 +//!COMPONENTS 2
47 +vec4 hook() {
48 + vec2 d = HOOKED_pt;
50 + //[tl t tr]
51 + //[ l c r]
52 + //[bl b br]
53 + float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 + float c = LINELUMA_tex(HOOKED_pos).x;
55 + float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 + //Horizontal Gradient
59 + //[-1 0 1]
60 + //[-2 0 2]
61 + //[-1 0 1]
62 + float xgrad = (-l + r);
64 + //Vertical Gradient
65 + //[-1 -2 -1]
66 + //[ 0 0 0]
67 + //[ 1 2 1]
68 + float ygrad = (l + c + c + r);
70 + //Computes the luminance's gradient
71 + return vec4(xgrad, ygrad, 0.0, 0.0);
75 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-Y
76 +//!HOOK MAIN
77 +//!BIND HOOKED
78 +//!BIND LUMAD
79 +//!SAVE LUMAD
80 +//!WIDTH MAIN.w 2 *
81 +//!HEIGHT MAIN.h 2 *
82 +//!COMPONENTS 2
85 +/* --------------------- SETTINGS --------------------- */
87 +//Strength of edge refinement, good values are between 0.2 and 4
88 +#define REFINE_STRENGTH 1.0
91 +/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 +//Bias of the refinement function, good values are between 0 and 1
94 +#define REFINE_BIAS 0.0
96 +//Polynomial fit obtained by minimizing MSE error on image
97 +#define P5 ( 11.68129591)
98 +#define P4 (-42.46906057)
99 +#define P3 ( 60.28286266)
100 +#define P2 (-41.84451327)
101 +#define P1 ( 14.05517353)
102 +#define P0 (-1.081521930)
104 +/* ----------------- END OF SETTINGS ----------------- */
106 +float power_function(float x) {
107 + float x2 = x * x;
108 + float x3 = x2 * x;
109 + float x4 = x2 * x2;
110 + float x5 = x2 * x3;
112 + return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 +vec4 hook() {
116 + vec2 d = HOOKED_pt;
118 + //[tl t tr]
119 + //[ l cc r]
120 + //[bl b br]
121 + float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 + float cx = LUMAD_tex(HOOKED_pos).x;
123 + float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 + float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 + //float cy = LUMAD_tex(HOOKED_pos).y;
128 + float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 + //Horizontal Gradient
132 + //[-1 0 1]
133 + //[-2 0 2]
134 + //[-1 0 1]
135 + float xgrad = (tx + cx + cx + bx);
137 + //Vertical Gradient
138 + //[-1 -2 -1]
139 + //[ 0 0 0]
140 + //[ 1 2 1]
141 + float ygrad = (-ty + by);
143 + //Computes the luminance's gradient
144 + float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 + float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 + return vec4(sobel_norm, dval, 0.0, 0.0);
151 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-X
152 +//!HOOK MAIN
153 +//!BIND HOOKED
154 +//!BIND LUMAD
155 +//!SAVE LUMAMM
156 +//!WIDTH MAIN.w 2 *
157 +//!HEIGHT MAIN.h 2 *
158 +//!COMPONENTS 2
161 +vec4 hook() {
162 + vec2 d = HOOKED_pt;
164 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 + return vec4(0.0);
168 + //[tl t tr]
169 + //[ l c r]
170 + //[bl b br]
171 + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 + float c = LUMAD_tex(HOOKED_pos).x;
173 + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 + //Horizontal Gradient
176 + //[-1 0 1]
177 + //[-2 0 2]
178 + //[-1 0 1]
179 + float xgrad = (-l + r);
181 + //Vertical Gradient
182 + //[-1 -2 -1]
183 + //[ 0 0 0]
184 + //[ 1 2 1]
185 + float ygrad = (l + c + c + r);
188 + return vec4(xgrad, ygrad, 0.0, 0.0);
192 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Kernel-Y
193 +//!HOOK MAIN
194 +//!BIND HOOKED
195 +//!BIND LUMAD
196 +//!BIND LUMAMM
197 +//!SAVE LUMAMM
198 +//!WIDTH MAIN.w 2 *
199 +//!HEIGHT MAIN.h 2 *
200 +//!COMPONENTS 2
202 +vec4 hook() {
203 + vec2 d = HOOKED_pt;
205 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 + return vec4(0.0);
209 + //[tl t tr]
210 + //[ l cc r]
211 + //[bl b br]
212 + float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 + float cx = LUMAMM_tex(HOOKED_pos).x;
214 + float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 + float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 + //float cy = LUMAMM_tex(HOOKED_pos).y;
218 + float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 + //Horizontal Gradient
221 + //[-1 0 1]
222 + //[-2 0 2]
223 + //[-1 0 1]
224 + float xgrad = (tx + cx + cx + bx);
226 + //Vertical Gradient
227 + //[-1 -2 -1]
228 + //[ 0 0 0]
229 + //[ 1 2 1]
230 + float ygrad = (-ty + by);
232 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 + if (norm <= 0.001) {
234 + xgrad = 0.0;
235 + ygrad = 0.0;
236 + norm = 1.0;
239 + return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 +//!DESC Anime4K-v3.2-Upscale-Deblur-Original-x2-Apply
244 +//!HOOK MAIN
245 +//!BIND HOOKED
246 +//!BIND LUMAD
247 +//!BIND LUMAMM
248 +//!WIDTH MAIN.w 2 *
249 +//!HEIGHT MAIN.h 2 *
252 +vec4 hook() {
253 + vec2 d = HOOKED_pt;
255 + float dval = LUMAD_tex(HOOKED_pos).y;
256 + if (dval < 0.1) {
257 + return HOOKED_tex(HOOKED_pos);
260 + vec4 dc = LUMAMM_tex(HOOKED_pos);
261 + if (abs(dc.x + dc.y) <= 0.0001) {
262 + return HOOKED_tex(HOOKED_pos);
265 + float xpos = -sign(dc.x);
266 + float ypos = -sign(dc.y);
268 + vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
269 + vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
271 + float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
273 + vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
275 + return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);

mpv/shaders/Anime4K_Upscale_DoG_x2.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Upscale-DoG-x2-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Upscale-DoG-x2-Kernel-X
39 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 -//!HOOK MAIN
41 -//!BIND HOOKED
42 -//!BIND LINELUMA
43 -//!SAVE GAUSS_X2
44 -//!COMPONENTS 3
46 -#define L_tex LINELUMA_tex
48 -float max3v(float a, float b, float c) {
49 - return max(max(a, b), c);
51 -float min3v(float a, float b, float c) {
52 - return min(min(a, b), c);
55 -vec2 minmax3(vec2 pos, vec2 d) {
56 - float a = L_tex(pos - d).x;
57 - float b = L_tex(pos).x;
58 - float c = L_tex(pos + d).x;
60 - return vec2(min3v(a, b, c), max3v(a, b, c));
63 -float lumGaussian7(vec2 pos, vec2 d) {
64 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
65 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
66 - g = g + (L_tex(pos).x) * 0.38774;
68 - return g;
72 -vec4 hook() {
73 - return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
77 -//!DESC Anime4K-v3.2-Upscale-DoG-x2-Kernel-Y
78 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
79 -//!HOOK MAIN
80 -//!BIND HOOKED
81 -//!BIND GAUSS_X2
82 -//!SAVE GAUSS_X2
83 -//!COMPONENTS 3
85 -#define L_tex GAUSS_X2_tex
87 -float max3v(float a, float b, float c) {
88 - return max(max(a, b), c);
90 -float min3v(float a, float b, float c) {
91 - return min(min(a, b), c);
94 -vec2 minmax3(vec2 pos, vec2 d) {
95 - float a0 = L_tex(pos - d).y;
96 - float b0 = L_tex(pos).y;
97 - float c0 = L_tex(pos + d).y;
99 - float a1 = L_tex(pos - d).z;
100 - float b1 = L_tex(pos).z;
101 - float c1 = L_tex(pos + d).z;
103 - return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
106 -float lumGaussian7(vec2 pos, vec2 d) {
107 - float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
108 - g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
109 - g = g + (L_tex(pos).x) * 0.38774;
111 - return g;
115 -vec4 hook() {
116 - return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
119 -//!DESC Anime4K-v3.2-Upscale-DoG-x2-Apply
120 -//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
121 -//!HOOK MAIN
122 -//!BIND HOOKED
123 -//!BIND LINELUMA
124 -//!BIND GAUSS_X2
125 -//!WIDTH MAIN.w 2 *
126 -//!HEIGHT MAIN.h 2 *
128 -#define STRENGTH 0.8 //De-blur proportional strength, higher is sharper.
130 -#define L_tex LINELUMA_tex
132 -vec4 hook() {
134 - float c = (L_tex(HOOKED_pos).x - GAUSS_X2_tex(HOOKED_pos).x) * STRENGTH;
135 - float cc = clamp(c + L_tex(HOOKED_pos).x, GAUSS_X2_tex(HOOKED_pos).y, GAUSS_X2_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
137 - //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
138 - //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
139 - return HOOKED_tex(HOOKED_pos) + cc;
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Upscale-DoG-x2-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Upscale-DoG-x2-Kernel-X
39 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
40 +//!HOOK MAIN
41 +//!BIND HOOKED
42 +//!BIND LINELUMA
43 +//!SAVE GAUSS_X2
44 +//!COMPONENTS 3
46 +#define L_tex LINELUMA_tex
48 +float max3v(float a, float b, float c) {
49 + return max(max(a, b), c);
51 +float min3v(float a, float b, float c) {
52 + return min(min(a, b), c);
55 +vec2 minmax3(vec2 pos, vec2 d) {
56 + float a = L_tex(pos - d).x;
57 + float b = L_tex(pos).x;
58 + float c = L_tex(pos + d).x;
60 + return vec2(min3v(a, b, c), max3v(a, b, c));
63 +float lumGaussian7(vec2 pos, vec2 d) {
64 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
65 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
66 + g = g + (L_tex(pos).x) * 0.38774;
68 + return g;
72 +vec4 hook() {
73 + return vec4(lumGaussian7(HOOKED_pos, vec2(HOOKED_pt.x, 0)), minmax3(HOOKED_pos, vec2(HOOKED_pt.x, 0)), 0);
77 +//!DESC Anime4K-v3.2-Upscale-DoG-x2-Kernel-Y
78 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
79 +//!HOOK MAIN
80 +//!BIND HOOKED
81 +//!BIND GAUSS_X2
82 +//!SAVE GAUSS_X2
83 +//!COMPONENTS 3
85 +#define L_tex GAUSS_X2_tex
87 +float max3v(float a, float b, float c) {
88 + return max(max(a, b), c);
90 +float min3v(float a, float b, float c) {
91 + return min(min(a, b), c);
94 +vec2 minmax3(vec2 pos, vec2 d) {
95 + float a0 = L_tex(pos - d).y;
96 + float b0 = L_tex(pos).y;
97 + float c0 = L_tex(pos + d).y;
99 + float a1 = L_tex(pos - d).z;
100 + float b1 = L_tex(pos).z;
101 + float c1 = L_tex(pos + d).z;
103 + return vec2(min3v(a0, b0, c0), max3v(a1, b1, c1));
106 +float lumGaussian7(vec2 pos, vec2 d) {
107 + float g = (L_tex(pos - (d + d)).x + L_tex(pos + (d + d)).x) * 0.06136;
108 + g = g + (L_tex(pos - d).x + L_tex(pos + d).x) * 0.24477;
109 + g = g + (L_tex(pos).x) * 0.38774;
111 + return g;
115 +vec4 hook() {
116 + return vec4(lumGaussian7(HOOKED_pos, vec2(0, HOOKED_pt.y)), minmax3(HOOKED_pos, vec2(0, HOOKED_pt.y)), 0);
119 +//!DESC Anime4K-v3.2-Upscale-DoG-x2-Apply
120 +//!WHEN OUTPUT.w MAIN.w / 1.200 > OUTPUT.h MAIN.h / 1.200 > *
121 +//!HOOK MAIN
122 +//!BIND HOOKED
123 +//!BIND LINELUMA
124 +//!BIND GAUSS_X2
125 +//!WIDTH MAIN.w 2 *
126 +//!HEIGHT MAIN.h 2 *
128 +#define STRENGTH 0.8 //De-blur proportional strength, higher is sharper.
130 +#define L_tex LINELUMA_tex
132 +vec4 hook() {
134 + float c = (L_tex(HOOKED_pos).x - GAUSS_X2_tex(HOOKED_pos).x) * STRENGTH;
135 + float cc = clamp(c + L_tex(HOOKED_pos).x, GAUSS_X2_tex(HOOKED_pos).y, GAUSS_X2_tex(HOOKED_pos).z) - L_tex(HOOKED_pos).x;
137 + //This trick is only possible if the inverse Y->RGB matrix has 1 for every row... (which is the case for BT.709)
138 + //Otherwise we would need to convert RGB to YUV, modify Y then convert back to RGB.
139 + return HOOKED_tex(HOOKED_pos) + cc;

mpv/shaders/Anime4K_Upscale_Original_x2.glsl

Modified
1 -// MIT License
3 -// Copyright (c) 2019-2021 bloc97
4 -// All rights reserved.
6 -// Permission is hereby granted, free of charge, to any person obtaining a copy
7 -// of this software and associated documentation files (the "Software"), to deal
8 -// in the Software without restriction, including without limitation the rights
9 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 -// copies of the Software, and to permit persons to whom the Software is
11 -// furnished to do so, subject to the following conditions:
13 -// The above copyright notice and this permission notice shall be included in all
14 -// copies or substantial portions of the Software.
16 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 -// SOFTWARE.
24 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Luma
25 -//!HOOK MAIN
26 -//!BIND HOOKED
27 -//!SAVE LINELUMA
28 -//!COMPONENTS 1
30 -float get_luma(vec4 rgba) {
31 - return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 -vec4 hook() {
35 - return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-X
39 -//!HOOK MAIN
40 -//!BIND HOOKED
41 -//!BIND LINELUMA
42 -//!SAVE LUMAD
43 -//!WIDTH MAIN.w 2 *
44 -//!HEIGHT MAIN.h 2 *
45 -//!COMPONENTS 2
47 -vec4 hook() {
48 - vec2 d = HOOKED_pt;
50 - //[tl t tr]
51 - //[ l c r]
52 - //[bl b br]
53 - float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 - float c = LINELUMA_tex(HOOKED_pos).x;
55 - float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 - //Horizontal Gradient
59 - //[-1 0 1]
60 - //[-2 0 2]
61 - //[-1 0 1]
62 - float xgrad = (-l + r);
64 - //Vertical Gradient
65 - //[-1 -2 -1]
66 - //[ 0 0 0]
67 - //[ 1 2 1]
68 - float ygrad = (l + c + c + r);
70 - //Computes the luminance's gradient
71 - return vec4(xgrad, ygrad, 0.0, 0.0);
75 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-Y
76 -//!HOOK MAIN
77 -//!BIND HOOKED
78 -//!BIND LUMAD
79 -//!SAVE LUMAD
80 -//!WIDTH MAIN.w 2 *
81 -//!HEIGHT MAIN.h 2 *
82 -//!COMPONENTS 2
85 -/* --------------------- SETTINGS --------------------- */
87 -//Strength of edge refinement, good values are between 0.2 and 4
88 -#define REFINE_STRENGTH 0.5
91 -/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 -//Bias of the refinement function, good values are between 0 and 1
94 -#define REFINE_BIAS 0.0
96 -//Polynomial fit obtained by minimizing MSE error on image
97 -#define P5 ( 11.68129591)
98 -#define P4 (-42.46906057)
99 -#define P3 ( 60.28286266)
100 -#define P2 (-41.84451327)
101 -#define P1 ( 14.05517353)
102 -#define P0 (-1.081521930)
104 -/* ----------------- END OF SETTINGS ----------------- */
106 -float power_function(float x) {
107 - float x2 = x * x;
108 - float x3 = x2 * x;
109 - float x4 = x2 * x2;
110 - float x5 = x2 * x3;
112 - return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 -vec4 hook() {
116 - vec2 d = HOOKED_pt;
118 - //[tl t tr]
119 - //[ l cc r]
120 - //[bl b br]
121 - float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 - float cx = LUMAD_tex(HOOKED_pos).x;
123 - float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 - float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 - //float cy = LUMAD_tex(HOOKED_pos).y;
128 - float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 - //Horizontal Gradient
132 - //[-1 0 1]
133 - //[-2 0 2]
134 - //[-1 0 1]
135 - float xgrad = (tx + cx + cx + bx);
137 - //Vertical Gradient
138 - //[-1 -2 -1]
139 - //[ 0 0 0]
140 - //[ 1 2 1]
141 - float ygrad = (-ty + by);
143 - //Computes the luminance's gradient
144 - float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 - float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 - return vec4(sobel_norm, dval, 0.0, 0.0);
151 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-X
152 -//!HOOK MAIN
153 -//!BIND HOOKED
154 -//!BIND LUMAD
155 -//!SAVE LUMAMM
156 -//!WIDTH MAIN.w 2 *
157 -//!HEIGHT MAIN.h 2 *
158 -//!COMPONENTS 2
161 -vec4 hook() {
162 - vec2 d = HOOKED_pt;
164 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 - return vec4(0.0);
166 - }
168 - //[tl t tr]
169 - //[ l c r]
170 - //[bl b br]
171 - float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 - float c = LUMAD_tex(HOOKED_pos).x;
173 - float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 - //Horizontal Gradient
176 - //[-1 0 1]
177 - //[-2 0 2]
178 - //[-1 0 1]
179 - float xgrad = (-l + r);
181 - //Vertical Gradient
182 - //[-1 -2 -1]
183 - //[ 0 0 0]
184 - //[ 1 2 1]
185 - float ygrad = (l + c + c + r);
188 - return vec4(xgrad, ygrad, 0.0, 0.0);
192 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-Y
193 -//!HOOK MAIN
194 -//!BIND HOOKED
195 -//!BIND LUMAD
196 -//!BIND LUMAMM
197 -//!SAVE LUMAMM
198 -//!WIDTH MAIN.w 2 *
199 -//!HEIGHT MAIN.h 2 *
200 -//!COMPONENTS 2
202 -vec4 hook() {
203 - vec2 d = HOOKED_pt;
205 - if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 - return vec4(0.0);
207 - }
209 - //[tl t tr]
210 - //[ l cc r]
211 - //[bl b br]
212 - float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 - float cx = LUMAMM_tex(HOOKED_pos).x;
214 - float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 - float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 - //float cy = LUMAMM_tex(HOOKED_pos).y;
218 - float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 - //Horizontal Gradient
221 - //[-1 0 1]
222 - //[-2 0 2]
223 - //[-1 0 1]
224 - float xgrad = (tx + cx + cx + bx);
226 - //Vertical Gradient
227 - //[-1 -2 -1]
228 - //[ 0 0 0]
229 - //[ 1 2 1]
230 - float ygrad = (-ty + by);
232 - float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 - if (norm <= 0.001) {
234 - xgrad = 0.0;
235 - ygrad = 0.0;
236 - norm = 1.0;
237 - }
239 - return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 -//!DESC Anime4K-v3.2-Upscale-Original-x2-Apply
244 -//!HOOK MAIN
245 -//!BIND HOOKED
246 -//!BIND LUMAD
247 -//!BIND LUMAMM
248 -//!WIDTH MAIN.w 2 *
249 -//!HEIGHT MAIN.h 2 *
252 -vec4 hook() {
253 - vec2 d = HOOKED_pt;
255 - float dval = LUMAD_tex(HOOKED_pos).y;
256 - if (dval < 0.1) {
257 - return HOOKED_tex(HOOKED_pos);
258 - }
260 - vec4 dc = LUMAMM_tex(HOOKED_pos);
261 - if (abs(dc.x + dc.y) <= 0.0001) {
262 - return HOOKED_tex(HOOKED_pos);
263 - }
265 - float xpos = -sign(dc.x);
266 - float ypos = -sign(dc.y);
268 - vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
269 - vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
271 - float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
273 - vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
275 - return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);
1 +// MIT License
3 +// Copyright (c) 2019-2021 bloc97
4 +// All rights reserved.
6 +// Permission is hereby granted, free of charge, to any person obtaining a copy
7 +// of this software and associated documentation files (the "Software"), to deal
8 +// in the Software without restriction, including without limitation the rights
9 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +// copies of the Software, and to permit persons to whom the Software is
11 +// furnished to do so, subject to the following conditions:
13 +// The above copyright notice and this permission notice shall be included in all
14 +// copies or substantial portions of the Software.
16 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 +// SOFTWARE.
24 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Luma
25 +//!HOOK MAIN
26 +//!BIND HOOKED
27 +//!SAVE LINELUMA
28 +//!COMPONENTS 1
30 +float get_luma(vec4 rgba) {
31 + return dot(vec4(0.299, 0.587, 0.114, 0.0), rgba);
34 +vec4 hook() {
35 + return vec4(get_luma(HOOKED_tex(HOOKED_pos)), 0.0, 0.0, 0.0);
38 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-X
39 +//!HOOK MAIN
40 +//!BIND HOOKED
41 +//!BIND LINELUMA
42 +//!SAVE LUMAD
43 +//!WIDTH MAIN.w 2 *
44 +//!HEIGHT MAIN.h 2 *
45 +//!COMPONENTS 2
47 +vec4 hook() {
48 + vec2 d = HOOKED_pt;
50 + //[tl t tr]
51 + //[ l c r]
52 + //[bl b br]
53 + float l = LINELUMA_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
54 + float c = LINELUMA_tex(HOOKED_pos).x;
55 + float r = LINELUMA_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
58 + //Horizontal Gradient
59 + //[-1 0 1]
60 + //[-2 0 2]
61 + //[-1 0 1]
62 + float xgrad = (-l + r);
64 + //Vertical Gradient
65 + //[-1 -2 -1]
66 + //[ 0 0 0]
67 + //[ 1 2 1]
68 + float ygrad = (l + c + c + r);
70 + //Computes the luminance's gradient
71 + return vec4(xgrad, ygrad, 0.0, 0.0);
75 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-Y
76 +//!HOOK MAIN
77 +//!BIND HOOKED
78 +//!BIND LUMAD
79 +//!SAVE LUMAD
80 +//!WIDTH MAIN.w 2 *
81 +//!HEIGHT MAIN.h 2 *
82 +//!COMPONENTS 2
85 +/* --------------------- SETTINGS --------------------- */
87 +//Strength of edge refinement, good values are between 0.2 and 4
88 +#define REFINE_STRENGTH 0.5
91 +/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */
93 +//Bias of the refinement function, good values are between 0 and 1
94 +#define REFINE_BIAS 0.0
96 +//Polynomial fit obtained by minimizing MSE error on image
97 +#define P5 ( 11.68129591)
98 +#define P4 (-42.46906057)
99 +#define P3 ( 60.28286266)
100 +#define P2 (-41.84451327)
101 +#define P1 ( 14.05517353)
102 +#define P0 (-1.081521930)
104 +/* ----------------- END OF SETTINGS ----------------- */
106 +float power_function(float x) {
107 + float x2 = x * x;
108 + float x3 = x2 * x;
109 + float x4 = x2 * x2;
110 + float x5 = x2 * x3;
112 + return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0;
115 +vec4 hook() {
116 + vec2 d = HOOKED_pt;
118 + //[tl t tr]
119 + //[ l cc r]
120 + //[bl b br]
121 + float tx = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
122 + float cx = LUMAD_tex(HOOKED_pos).x;
123 + float bx = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).x;
126 + float ty = LUMAD_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
127 + //float cy = LUMAD_tex(HOOKED_pos).y;
128 + float by = LUMAD_tex(HOOKED_pos + vec2(0.0, d.y)).y;
131 + //Horizontal Gradient
132 + //[-1 0 1]
133 + //[-2 0 2]
134 + //[-1 0 1]
135 + float xgrad = (tx + cx + cx + bx);
137 + //Vertical Gradient
138 + //[-1 -2 -1]
139 + //[ 0 0 0]
140 + //[ 1 2 1]
141 + float ygrad = (-ty + by);
143 + //Computes the luminance's gradient
144 + float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0.0, 1.0);
146 + float dval = clamp(power_function(clamp(sobel_norm, 0.0, 1.0)) * REFINE_STRENGTH + REFINE_BIAS, 0.0, 1.0);
148 + return vec4(sobel_norm, dval, 0.0, 0.0);
151 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-X
152 +//!HOOK MAIN
153 +//!BIND HOOKED
154 +//!BIND LUMAD
155 +//!SAVE LUMAMM
156 +//!WIDTH MAIN.w 2 *
157 +//!HEIGHT MAIN.h 2 *
158 +//!COMPONENTS 2
161 +vec4 hook() {
162 + vec2 d = HOOKED_pt;
164 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
165 + return vec4(0.0);
168 + //[tl t tr]
169 + //[ l c r]
170 + //[bl b br]
171 + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0.0)).x;
172 + float c = LUMAD_tex(HOOKED_pos).x;
173 + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0.0)).x;
175 + //Horizontal Gradient
176 + //[-1 0 1]
177 + //[-2 0 2]
178 + //[-1 0 1]
179 + float xgrad = (-l + r);
181 + //Vertical Gradient
182 + //[-1 -2 -1]
183 + //[ 0 0 0]
184 + //[ 1 2 1]
185 + float ygrad = (l + c + c + r);
188 + return vec4(xgrad, ygrad, 0.0, 0.0);
192 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Kernel-Y
193 +//!HOOK MAIN
194 +//!BIND HOOKED
195 +//!BIND LUMAD
196 +//!BIND LUMAMM
197 +//!SAVE LUMAMM
198 +//!WIDTH MAIN.w 2 *
199 +//!HEIGHT MAIN.h 2 *
200 +//!COMPONENTS 2
202 +vec4 hook() {
203 + vec2 d = HOOKED_pt;
205 + if (LUMAD_tex(HOOKED_pos).y < 0.1) {
206 + return vec4(0.0);
209 + //[tl t tr]
210 + //[ l cc r]
211 + //[bl b br]
212 + float tx = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).x;
213 + float cx = LUMAMM_tex(HOOKED_pos).x;
214 + float bx = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).x;
216 + float ty = LUMAMM_tex(HOOKED_pos + vec2(0.0, -d.y)).y;
217 + //float cy = LUMAMM_tex(HOOKED_pos).y;
218 + float by = LUMAMM_tex(HOOKED_pos + vec2(0.0, d.y)).y;
220 + //Horizontal Gradient
221 + //[-1 0 1]
222 + //[-2 0 2]
223 + //[-1 0 1]
224 + float xgrad = (tx + cx + cx + bx);
226 + //Vertical Gradient
227 + //[-1 -2 -1]
228 + //[ 0 0 0]
229 + //[ 1 2 1]
230 + float ygrad = (-ty + by);
232 + float norm = sqrt(xgrad * xgrad + ygrad * ygrad);
233 + if (norm <= 0.001) {
234 + xgrad = 0.0;
235 + ygrad = 0.0;
236 + norm = 1.0;
239 + return vec4(xgrad/norm, ygrad/norm, 0.0, 0.0);
243 +//!DESC Anime4K-v3.2-Upscale-Original-x2-Apply
244 +//!HOOK MAIN
245 +//!BIND HOOKED
246 +//!BIND LUMAD
247 +//!BIND LUMAMM
248 +//!WIDTH MAIN.w 2 *
249 +//!HEIGHT MAIN.h 2 *
252 +vec4 hook() {
253 + vec2 d = HOOKED_pt;
255 + float dval = LUMAD_tex(HOOKED_pos).y;
256 + if (dval < 0.1) {
257 + return HOOKED_tex(HOOKED_pos);
260 + vec4 dc = LUMAMM_tex(HOOKED_pos);
261 + if (abs(dc.x + dc.y) <= 0.0001) {
262 + return HOOKED_tex(HOOKED_pos);
265 + float xpos = -sign(dc.x);
266 + float ypos = -sign(dc.y);
268 + vec4 xval = HOOKED_tex(HOOKED_pos + vec2(d.x * xpos, 0.0));
269 + vec4 yval = HOOKED_tex(HOOKED_pos + vec2(0.0, d.y * ypos));
271 + float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y));
273 + vec4 avg = xyratio * xval + (1.0 - xyratio) * yval;
275 + return avg * dval + HOOKED_tex(HOOKED_pos) * (1.0 - dval);

neovide/config.toml

Modified
1 -frame = "none"
2 -tabs = true
3 -theme = "auto"
1 +frame = "none"
2 +tabs = true
3 +theme = "auto"

neovim/.editorconfig

Modified
1 -root = true
3 -# see https://github.com/CppCXY/EmmyLuaCodeStyle
4 -# optional space/tab
5 -indent_style = space
6 -# if indent_style is space, this is valid
7 -indent_size = 2
8 -# if indent_style is tab, this is valid
9 -tab_width = 2
10 -# none/single/double
11 -quote_style = single
13 -continuation_indent = 2
15 -# this mean utf8 length , if this is 'unset' then the line width is no longer checked
16 -# this option decides when to chopdown the code
17 -max_line_length = 120
19 -# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
20 -# in neovim the value 'auto' is not a valid option, please use 'unset'
21 -end_of_line = lf
23 -# none/ comma / semicolon / only_kv_colon
24 -table_separator_style = comma
26 -#optional keep/never/always/smart
27 -trailing_table_separator = smart
29 -# keep/remove/remove_table_only/remove_string_only
30 -call_arg_parentheses = remove
32 -detect_end_of_line = false
34 -# this will check text end with new line
35 -insert_final_newline = true
37 -# [space]
38 -space_around_table_field_list = true
40 -space_before_attribute = true
42 -space_before_function_open_parenthesis = false
44 -space_before_function_call_open_parenthesis = false
46 -space_before_closure_open_parenthesis = true
48 -# optional always/only_string/only_table/none
49 -# or true/false
50 -space_before_function_call_single_arg = always
52 -space_before_open_square_bracket = false
54 -space_inside_function_call_parentheses = true
56 -space_inside_function_param_list_parentheses = true
58 -space_inside_square_brackets = false
60 -# like t[#t+1] = 1
61 -space_around_table_append_operator = false
63 -ignore_spaces_inside_function_call = false
65 -space_before_inline_comment = 1
67 -# [operator space]
68 -space_around_math_operator = true
70 -space_after_comma = true
72 -space_after_comma_in_for_statement = true
74 -space_around_concat_operator = true
76 -# [align]
78 -align_call_args = true
80 -align_function_params = true
82 -align_continuous_assign_statement = true
84 -align_continuous_rect_table_field = true
86 -align_continuous_line_space = 2
88 -align_if_branch = true
90 -# option none / always / contain_curly/
91 -align_array_table = true
93 -align_continuous_similar_call_args = true
95 -align_continuous_inline_comment = true
96 -# option none / always / only_call_stmt
97 -align_chain_expr = none
99 -# [indent]
101 -never_indent_before_if_condition = false
103 -never_indent_comment_on_if_branch = false
105 -# [line space]
107 -# The following configuration supports four expressions
108 -# keep
109 -# fixed(n)
110 -# min(n)
111 -# max(n)
112 -# for eg. min(2)
114 -line_space_after_if_statement = keep
116 -line_space_after_do_statement = keep
118 -line_space_after_while_statement = keep
120 -line_space_after_repeat_statement = keep
122 -line_space_after_for_statement = keep
124 -line_space_after_local_or_assign_statement = keep
126 -line_space_after_function_statement = fixed(2)
128 -line_space_after_expression_statement = keep
130 -line_space_after_comment = keep
132 -# [line break]
133 -break_all_list_when_line_exceed = false
135 -auto_collapse_lines = false
137 -break_before_braces = false
138 -# [preference]
139 -ignore_space_after_colon = false
141 -remove_call_expression_list_finish_comma = false
1 +root = true
3 +# see https://github.com/CppCXY/EmmyLuaCodeStyle
4 +# optional space/tab
5 +indent_style = space
6 +# if indent_style is space, this is valid
7 +indent_size = 2
8 +# if indent_style is tab, this is valid
9 +tab_width = 2
10 +# none/single/double
11 +quote_style = single
13 +continuation_indent = 2
15 +# this mean utf8 length , if this is 'unset' then the line width is no longer checked
16 +# this option decides when to chopdown the code
17 +max_line_length = 120
19 +# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
20 +# in neovim the value 'auto' is not a valid option, please use 'unset'
21 +end_of_line = lf
23 +# none/ comma / semicolon / only_kv_colon
24 +table_separator_style = comma
26 +#optional keep/never/always/smart
27 +trailing_table_separator = smart
29 +# keep/remove/remove_table_only/remove_string_only
30 +call_arg_parentheses = remove
32 +detect_end_of_line = false
34 +# this will check text end with new line
35 +insert_final_newline = true
37 +# [space]
38 +space_around_table_field_list = true
40 +space_before_attribute = true
42 +space_before_function_open_parenthesis = false
44 +space_before_function_call_open_parenthesis = false
46 +space_before_closure_open_parenthesis = true
48 +# optional always/only_string/only_table/none
49 +# or true/false
50 +space_before_function_call_single_arg = always
52 +space_before_open_square_bracket = false
54 +space_inside_function_call_parentheses = true
56 +space_inside_function_param_list_parentheses = true
58 +space_inside_square_brackets = false
60 +# like t[#t+1] = 1
61 +space_around_table_append_operator = false
63 +ignore_spaces_inside_function_call = false
65 +space_before_inline_comment = 1
67 +# [operator space]
68 +space_around_math_operator = true
70 +space_after_comma = true
72 +space_after_comma_in_for_statement = true
74 +space_around_concat_operator = true
76 +# [align]
78 +align_call_args = true
80 +align_function_params = true
82 +align_continuous_assign_statement = true
84 +align_continuous_rect_table_field = true
86 +align_continuous_line_space = 2
88 +align_if_branch = true
90 +# option none / always / contain_curly/
91 +align_array_table = true
93 +align_continuous_similar_call_args = true
95 +align_continuous_inline_comment = true
96 +# option none / always / only_call_stmt
97 +align_chain_expr = none
99 +# [indent]
101 +never_indent_before_if_condition = false
103 +never_indent_comment_on_if_branch = false
105 +# [line space]
107 +# The following configuration supports four expressions
108 +# keep
109 +# fixed(n)
110 +# min(n)
111 +# max(n)
112 +# for eg. min(2)
114 +line_space_after_if_statement = keep
116 +line_space_after_do_statement = keep
118 +line_space_after_while_statement = keep
120 +line_space_after_repeat_statement = keep
122 +line_space_after_for_statement = keep
124 +line_space_after_local_or_assign_statement = keep
126 +line_space_after_function_statement = fixed(2)
128 +line_space_after_expression_statement = keep
130 +line_space_after_comment = keep
132 +# [line break]
133 +break_all_list_when_line_exceed = false
135 +auto_collapse_lines = false
137 +break_before_braces = false
138 +# [preference]
139 +ignore_space_after_colon = false
141 +remove_call_expression_list_finish_comma = false

neovim/sample_files/A.prg

Modified
1 -CLEAR
2 -? "Hello, you glorious bastard of a world!"
4 -QUIT
1 +CLEAR
2 +? "Hello, you glorious bastard of a world!"
4 +QUIT

nushell/modules/notes.nu

Modified
1 -### bugabingas custom note taking and organizing system
2 -###
3 -### notes are grouped into contexts (folders), so that i can distinguish between
4 -### personal and work related notes.
6 -#TODO: subbcommands:
7 -# - search
8 -# - graph
10 -def validate_context [
11 - context: string
12 -] {
13 - if not ($env.NOTES | path exists) {
14 - error make {
15 - msg: "No notes folder found in environment variables.
16 - Make sure a NOTES variable exists in $env."
17 - }
18 - }
19 - if not ($env.NOTES | path join $context | path exists) {
20 -error make {
21 - msg: $"The given context ($context) does not exist in ($env.NOTES).
22 - Create it and try again."
23 - }
24 - }
27 - export def main [
28 - --context: string = "bugabinga" # which context do the notes belong to
29 -] {
30 - # TODO: autocomplete function for context parameter
31 - # TODO: the context needs to get overridden by env var, so that switch between work and personal is easy
33 - validate_context $context
35 - ls --short-names ($env.NOTES | path join $context)
36 - # TODO: print some high level view of the notes. tree, graph, text ?
39 -def new_note_id [] { random binary 3 | encode base64 --nopad --url }
41 -def new_note [
42 - title: string # title of note. will be used for title and initial heading
43 - author: string # author, usually me...
44 - date: string # creation date of note
45 - tags: list<string> # a list of tags, if already known
46 - context: string # note context
47 -] {
48 - $"---
49 -title: ($title)
50 -author: ($author)
51 -date: ($date)
52 -tags:
53 -- ($context)
54 -($tags | each { '- ' + $in } | str join (char nl))
55 ----
60 -def edit [ ...rest ] {
61 - let editor = if ( $env.EDITOR == null ) { 'vi' } else { $env.EDITOR }
62 - run-external $editor ...$rest
65 -def notes_directory [
66 - context: string # which context do the notes belong to
67 -] {
68 - $env.NOTES | path join $context
71 -export def new [
72 - title?: string # title of new node
73 - --tags: list<string> # some optional tags for the note
74 - --context: string = "bugabinga" # which context do the notes belong to
75 -] {
76 - validate_context $context
78 - let title = if ($title | is-empty) { input "gimme title: " } else { $title }
79 - let author = 'Oliver Jan Krylow'
80 - # german dates. what can i say...
81 - let date = date now | format date "%d/%m/%Y"
82 - let tags = if ($tags == null) { [] } else { $tags }
84 - let note_content = new_note $title $author $date $tags $context
85 - let note_file_name = $"(new_note_id)-($title | str kebab-case).md"
86 - let note_file = [ (notes_directory $context) $note_file_name] | path join
88 - if ($note_file | path exists) {
89 - error make {
90 - msg: "the note you are trying to create exists already"
91 - }
92 - }
93 - $note_content | save --raw $note_file
94 - edit $note_file
97 -export def open [
98 - query: string = "" # intial search term
99 - --context: string = "bugabinga" # which context do the notes belong to
100 -] {
101 - let note = ls --short-names --threads ( notes_directory $context) |
102 - sort-by --reverse modified |
103 - get name |
104 - to text |
105 - ^sk --query $query --bind $"f1:execute\(inlyne (notes_directory $context)/{}\)" --preview $"glow (notes_directory $context)/{}" --header "F1: GUI Preview"
107 - edit ( notes_directory $context | path join $note)
1 +### bugabingas custom note taking and organizing system
2 +###
3 +### notes are grouped into contexts (folders), so that i can distinguish between
4 +### personal and work related notes.
6 +#TODO: subbcommands:
7 +# - search
8 +# - graph
10 +def validate_context [
11 + context: string
12 +] {
13 + if not ($env.NOTES | path exists) {
14 + error make {
15 + msg: "No notes folder found in environment variables.
16 + Make sure a NOTES variable exists in $env."
17 + }
18 + }
19 + if not ($env.NOTES | path join $context | path exists) {
20 +error make {
21 + msg: $"The given context ($context) does not exist in ($env.NOTES).
22 + Create it and try again."
23 + }
24 + }
27 + export def main [
28 + --context: string = "bugabinga" # which context do the notes belong to
29 +] {
30 + # TODO: autocomplete function for context parameter
31 + # TODO: the context needs to get overridden by env var, so that switch between work and personal is easy
33 + validate_context $context
35 + ls --short-names ($env.NOTES | path join $context)
36 + # TODO: print some high level view of the notes. tree, graph, text ?
39 +def new_note_id [] { random binary 3 | encode base64 --nopad --url }
41 +def new_note [
42 + title: string # title of note. will be used for title and initial heading
43 + author: string # author, usually me...
44 + date: string # creation date of note
45 + tags: list<string> # a list of tags, if already known
46 + context: string # note context
47 +] {
48 + $"---
49 +title: ($title)
50 +author: ($author)
51 +date: ($date)
52 +tags:
53 +- ($context)
54 +($tags | each { '- ' + $in } | str join (char nl))
55 +---
60 +def edit [ ...rest ] {
61 + let editor = if ( $env.EDITOR == null ) { 'vi' } else { $env.EDITOR }
62 + run-external $editor ...$rest
65 +def notes_directory [
66 + context: string # which context do the notes belong to
67 +] {
68 + $env.NOTES | path join $context
71 +export def new [
72 + title?: string # title of new node
73 + --tags: list<string> # some optional tags for the note
74 + --context: string = "bugabinga" # which context do the notes belong to
75 +] {
76 + validate_context $context
78 + let title = if ($title | is-empty) { input "gimme title: " } else { $title }
79 + let author = 'Oliver Jan Krylow'
80 + # german dates. what can i say...
81 + let date = date now | format date "%d/%m/%Y"
82 + let tags = if ($tags == null) { [] } else { $tags }
84 + let note_content = new_note $title $author $date $tags $context
85 + let note_file_name = $"(new_note_id)-($title | str kebab-case).md"
86 + let note_file = [ (notes_directory $context) $note_file_name] | path join
88 + if ($note_file | path exists) {
89 + error make {
90 + msg: "the note you are trying to create exists already"
91 + }
92 + }
93 + $note_content | save --raw $note_file
94 + edit $note_file
97 +export def open [
98 + query: string = "" # intial search term
99 + --context: string = "bugabinga" # which context do the notes belong to
100 +] {
101 + let note = ls --short-names --threads ( notes_directory $context) |
102 + sort-by --reverse modified |
103 + get name |
104 + to text |
105 + ^sk --query $query --bind $"f1:execute\(inlyne (notes_directory $context)/{}\)" --preview $"glow (notes_directory $context)/{}" --header "F1: GUI Preview"
107 + edit ( notes_directory $context | path join $note)

nushell/modules/todo.nu

Modified
1 -def print_markdown [ md: path ] {
2 - if not ( which mdcat | is-empty ) { mdcat $md; return }
3 - if not ( which glow | is-empty ) { glow $md; return }
4 - if not ( which bat | is-empty ) { bat --no-pager $md; return }
5 - open $md
6 -}
8 -# Render my To-Do file in the terminal
9 -export def main [] { print_markdown ($env.NOTES | path join "TODO.md") }
11 -# Open my To-Do file for editing
12 -export def edit [] { run-external $env.EDITOR ($env.NOTES | path join "TODO.md") }
14 -# Open a list of commands, that I would like to remember to use
15 -export def commands [] { print_markdown ($env.NOTES | path join "COMMANDS.md") }
17 -# Open the list of commands to remember for editing.
18 -export def "commands edit" [] { run-external $env.EDITOR ($env.NOTES | path join "COMMANDS.md") }
1 +def print_markdown [ md: path ] {
2 + if not ( which mdcat | is-empty ) { mdcat $md; return }
3 + if not ( which glow | is-empty ) { glow $md; return }
4 + if not ( which bat | is-empty ) { bat --no-pager $md; return }
5 + open $md
6 +}
8 +# Render my To-Do file in the terminal
9 +export def main [] { print_markdown ($env.NOTES | path join "TODO.md") }
11 +# Open my To-Do file for editing
12 +export def edit [] { run-external $env.EDITOR ($env.NOTES | path join "TODO.md") }
14 +# Open a list of commands, that I would like to remember to use
15 +export def commands [] { print_markdown ($env.NOTES | path join "COMMANDS.md") }
17 +# Open the list of commands to remember for editing.
18 +export def "commands edit" [] { run-external $env.EDITOR ($env.NOTES | path join "COMMANDS.md") }

pi/agent/prompts/brainstorm.md

Modified
1 ----
2 -description: Brainstorm ideas
3 -argument-hint: "[focus-area]"
4 -mask: astra
5 ----
7 -# Brainstorm ideas
9 -**Focus**:
10 -$ARGUMENTS
12 -General brainstorm areas:
14 -- Features & capabilities
15 -- Architecture improvements
16 -- UX enhancements
17 -- Integration ideas
18 -- Performance optimizations
20 -Run all phases systematically.
21 -Ask clarifying questions.
22 -No fluff.
23 -Output ideas well formatted and terse.
1 +---
2 +description: Brainstorm ideas
3 +argument-hint: "[focus-area]"
4 +mask: astra
5 +---
7 +# Brainstorm ideas
9 +**Focus**:
10 +$ARGUMENTS
12 +General brainstorm areas:
14 +- Features & capabilities
15 +- Architecture improvements
16 +- UX enhancements
17 +- Integration ideas
18 +- Performance optimizations
20 +Run all phases systematically.
21 +Ask clarifying questions.
22 +No fluff.
23 +Output ideas well formatted and terse.

pi/agent/prompts/grill.md

Modified
1 ----
2 -description: A relentless interview to sharpen a plan or design
3 -mask: astra
4 ----
6 -Run a `/skill:grilling` session.
1 +---
2 +description: A relentless interview to sharpen a plan or design
3 +mask: astra
4 +---
6 +Run a `/skill:grilling` session.

pi/agent/prompts/handoff.md

Modified
1 ----
2 -description: Compact current conversation into a handoff document
3 -mask: astra
4 -argument-hint: "What will the next session be used for?"
5 ----
7 -Write a handoff document summarising the current conversation so a fresh agent can continue the work.
8 -Save to the temporary directory of the user's OS - not the current workspace.
10 -Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
12 -Do not duplicate content already captured in other artifacts (Specs, PRDs, plans, ADRs, issues, commits, diffs).
13 -Reference them by path or URL instead.
15 -Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
17 -If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
19 -**Next-session focus**:
20 -$ARGUMENTS
1 +---
2 +description: Compact current conversation into a handoff document
3 +mask: astra
4 +argument-hint: "What will the next session be used for?"
5 +---
7 +Write a handoff document summarising the current conversation so a fresh agent can continue the work.
8 +Save to the temporary directory of the user's OS - not the current workspace.
10 +Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
12 +Do not duplicate content already captured in other artifacts (Specs, PRDs, plans, ADRs, issues, commits, diffs).
13 +Reference them by path or URL instead.
15 +Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
17 +If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
19 +**Next-session focus**:
20 +$ARGUMENTS

pi/agent/prompts/note-taker.md

Modified
1 ----
2 -description: Collect rapid note snippets, then compile them in my voice
3 -argument-hint: "[topic]"
4 -mask: astra
5 ----
7 -# Take notes
9 -**Topic**:
10 -$ARGUMENTS
12 -## Capture
14 -- Treat each following message as a note until I say `done`.
15 -- During capture, output nothing. Never acknowledge, summarize, discuss, or question a snippet.
16 -- Correct obvious spelling silently without changing meaning.
17 -- Preserve my terminology, language, numbers, and dates.
18 -- Never complete missing referents or invent relationships.
19 -- Track ambiguity for the final `Open` section.
20 -- Do not research or write files unless I explicitly ask.
22 -## Done
24 -- On `done`, compile and sort the notes.
25 -- Use only necessary headings.
26 -- Separate facts, goals, decisions, actions, dates, and open questions when present.
27 -- Surface contradictions and missing information.
28 -- Write the compiled notes in my voice, as if I authored them.
29 -- Preserve my language, terminology, register, certainty, and stance.
30 -- Discuss the compiled notes, then await instructions.
32 -## Revision
34 -- Apply requested corrections and deletions exactly.
35 -- Do not broaden narrow feedback.
36 -- Save only when asked.
1 +---
2 +description: Collect rapid note snippets, then compile them in my voice
3 +argument-hint: "[topic]"
4 +mask: astra
5 +---
7 +# Take notes
9 +**Topic**:
10 +$ARGUMENTS
12 +## Capture
14 +- Treat each following message as a note until I say `done`.
15 +- During capture, output nothing. Never acknowledge, summarize, discuss, or question a snippet.
16 +- Correct obvious spelling silently without changing meaning.
17 +- Preserve my terminology, language, numbers, and dates.
18 +- Never complete missing referents or invent relationships.
19 +- Track ambiguity for the final `Open` section.
20 +- Do not research or write files unless I explicitly ask.
22 +## Done
24 +- On `done`, compile and sort the notes.
25 +- Use only necessary headings.
26 +- Separate facts, goals, decisions, actions, dates, and open questions when present.
27 +- Surface contradictions and missing information.
28 +- Write the compiled notes in my voice, as if I authored them.
29 +- Preserve my language, terminology, register, certainty, and stance.
30 +- Discuss the compiled notes, then await instructions.
32 +## Revision
34 +- Apply requested corrections and deletions exactly.
35 +- Do not broaden narrow feedback.
36 +- Save only when asked.

pi/agent/prompts/reflect.md

Modified
1 ----
2 -description: Mine Pi sessions for next high-impact workflow asset
3 -mask: astra
4 -argument-hint: "[focus]"
5 ----
7 -# Mine Pi sessions for next high-impact workflow asset
9 -Reflect on Pi usage and propose workflow assets.
11 -**Focus**:
12 -$ARGUMENTS
14 -Inputs:
16 -- Load the `pi-sessions` skill.
17 - Use its `scripts/inspect.mjs` helper for discovery and bounded metadata.
18 - Inspect branch-aware timelines before drawing conclusions.
19 - Start with `list`; narrow by name/cwd/date before requesting safe text excerpts.
20 - Do not invent JSONL parsers or scan HOME.
21 -- Count persisted user turns.
22 - Exclude abandoned branches, retained-tail copies, and test fixtures.
23 - Report sample scope and cite session IDs plus entry IDs/lines.
24 - Tool errors alone are not evidence of product defects.
25 -- Check existing prompts for style:
26 - `~/.pi/agent/prompts/*.md`, `.pi/prompts/*.md`, `prompts/*.md`.
27 -- Check existing skills/prompts/extensions:
28 - global, project, and package dirs.
30 -Find:
32 -1. Repeated tasks, friction, manual rituals, missed checks.
33 -2. Existing prompt/skill/ext to improve or merge into.
34 -3. Candidate new prompts, skills, extensions.
35 -4. Best location:
36 - global vs project/package.
38 -Output:
40 -- `Findings`:
41 - terse bullets with evidence.
42 -- `Candidates`:
43 - prompt / skill / extension, one-line value each.
44 -- `Pick`:
45 - select one highest-impact candidate and explain why.
46 -- `Draft`:
47 - minimal outline or file path + core behavior.
48 -- `Nothing`:
49 - if no worthy candidate, say so and explain why.
51 -Rules:
53 -- Keep wording terse.
54 - No fluff.
55 - No bullshit.
56 -- Match style of existing prompts.
57 -- Do not implement unless explicitly asked.
1 +---
2 +description: Mine Pi sessions for next high-impact workflow asset
3 +mask: astra
4 +argument-hint: "[focus]"
5 +---
7 +# Mine Pi sessions for next high-impact workflow asset
9 +Reflect on Pi usage and propose workflow assets.
11 +**Focus**:
12 +$ARGUMENTS
14 +Inputs:
16 +- Load the `pi-sessions` skill.
17 + Use its `scripts/inspect.mjs` helper for discovery and bounded metadata.
18 + Inspect branch-aware timelines before drawing conclusions.
19 + Start with `list`; narrow by name/cwd/date before requesting safe text excerpts.
20 + Do not invent JSONL parsers or scan HOME.
21 +- Count persisted user turns.
22 + Exclude abandoned branches, retained-tail copies, and test fixtures.
23 + Report sample scope and cite session IDs plus entry IDs/lines.
24 + Tool errors alone are not evidence of product defects.
25 +- Check existing prompts for style:
26 + `~/.pi/agent/prompts/*.md`, `.pi/prompts/*.md`, `prompts/*.md`.
27 +- Check existing skills/prompts/extensions:
28 + global, project, and package dirs.
30 +Find:
32 +1. Repeated tasks, friction, manual rituals, missed checks.
33 +2. Existing prompt/skill/ext to improve or merge into.
34 +3. Candidate new prompts, skills, extensions.
35 +4. Best location:
36 + global vs project/package.
38 +Output:
40 +- `Findings`:
41 + terse bullets with evidence.
42 +- `Candidates`:
43 + prompt / skill / extension, one-line value each.
44 +- `Pick`:
45 + select one highest-impact candidate and explain why.
46 +- `Draft`:
47 + minimal outline or file path + core behavior.
48 +- `Nothing`:
49 + if no worthy candidate, say so and explain why.
51 +Rules:
53 +- Keep wording terse.
54 + No fluff.
55 + No bullshit.
56 +- Match style of existing prompts.
57 +- Do not implement unless explicitly asked.

pi/agent/prompts/sensei.md

Modified
1 ----
2 -description: Stateful teaching workspace for learning a skill or concept
3 -argument-hint: "<topic-or-goal>"
4 -mask: astra
5 ----
7 -# Sensei
9 -Teach me a skill or concept over multiple sessions.
10 -Do not compress explanations to my normal terse preference; teaching needs room.
11 -Prefer clear, concrete explanation, examples, practice, and feedback.
12 -Use HTML lessons because they are better for review, layout, print, and interaction.
14 -**Topic / goal**:
15 -$ARGUMENTS
17 -## Workspace
19 -Use the current directory as a teaching workspace.
20 -Create files only when needed.
22 -- `MISSION.md` — why I care, what success looks like, constraints, out of scope.
23 - Format: `sensei/MISSION-FORMAT.md`.
24 -- `RESOURCES.md` — trusted sources and communities.
25 - Format: `sensei/RESOURCES-FORMAT.md`.
26 -- `GLOSSARY.md` — terms I can already use correctly.
27 - Format: `sensei/GLOSSARY-FORMAT.md`.
28 -- `learning-records/0001-slug.md` — durable learning evidence.
29 - Format: `sensei/LEARNING-RECORD-FORMAT.md`.
30 -- `lessons/0001-slug.html` — one focused lesson per file.
31 -- `reference/*.html` — printable cheatsheets, summaries, diagrams.
32 -- `assets/*` — shared CSS, quiz widgets, diagrams, simulators.
33 -- `NOTES.md` — teaching preferences and working notes.
35 -## First move
37 -If `MISSION.md` is missing or vague, interview me until the mission is concrete.
38 -Ask one question at a time.
39 -Prefer multiple choice when useful.
40 -Do not write lessons before the mission is usable.
42 -## Teaching loop
44 -1. Read mission, notes, glossary, learning records, resources, and existing assets.
45 -2. Identify my zone of proximal development.
46 -3. Pick one tight lesson objective tied to the mission.
47 -4. Ground claims in trusted resources; search/fetch if resources are thin.
48 -5. Write one self-contained HTML lesson in `lessons/`.
49 -6. Reuse `assets/`; create shared CSS before the first lesson if missing.
50 -7. Include explanation, worked examples, retrieval practice, and immediate feedback.
51 -8. Add/update glossary only for terms I can use correctly.
52 -9. Add a learning record only when there is evidence of understanding.
53 -10. Recommend exactly one next primary source or exercise.
55 -## Lesson standard
57 -Each HTML lesson should be beautiful, readable, and printable.
58 -Use calm typography, strong hierarchy, examples, callouts, and small interactive checks where useful.
59 -Keep each lesson focused enough to finish quickly.
60 -End with: recap, practice prompt, and invitation to ask follow-up questions.
62 -## Rules
64 -- Explanation over brevity.
65 -- One concept per lesson.
66 -- Retrieval beats rereading.
67 -- Storage strength beats fluency illusion.
68 -- Knowledge comes from sources; wisdom comes from practice and community.
69 -- Do not log coverage as learning.
70 -- Do not create giant courses upfront.
71 -- Do not duplicate reference material across lessons; link it.
1 +---
2 +description: Stateful teaching workspace for learning a skill or concept
3 +argument-hint: "<topic-or-goal>"
4 +mask: astra
5 +---
7 +# Sensei
9 +Teach me a skill or concept over multiple sessions.
10 +Do not compress explanations to my normal terse preference; teaching needs room.
11 +Prefer clear, concrete explanation, examples, practice, and feedback.
12 +Use HTML lessons because they are better for review, layout, print, and interaction.
14 +**Topic / goal**:
15 +$ARGUMENTS
17 +## Workspace
19 +Use the current directory as a teaching workspace.
20 +Create files only when needed.
22 +- `MISSION.md` — why I care, what success looks like, constraints, out of scope.
23 + Format: `sensei/MISSION-FORMAT.md`.
24 +- `RESOURCES.md` — trusted sources and communities.
25 + Format: `sensei/RESOURCES-FORMAT.md`.
26 +- `GLOSSARY.md` — terms I can already use correctly.
27 + Format: `sensei/GLOSSARY-FORMAT.md`.
28 +- `learning-records/0001-slug.md` — durable learning evidence.
29 + Format: `sensei/LEARNING-RECORD-FORMAT.md`.
30 +- `lessons/0001-slug.html` — one focused lesson per file.
31 +- `reference/*.html` — printable cheatsheets, summaries, diagrams.
32 +- `assets/*` — shared CSS, quiz widgets, diagrams, simulators.
33 +- `NOTES.md` — teaching preferences and working notes.
35 +## First move
37 +If `MISSION.md` is missing or vague, interview me until the mission is concrete.
38 +Ask one question at a time.
39 +Prefer multiple choice when useful.
40 +Do not write lessons before the mission is usable.
42 +## Teaching loop
44 +1. Read mission, notes, glossary, learning records, resources, and existing assets.
45 +2. Identify my zone of proximal development.
46 +3. Pick one tight lesson objective tied to the mission.
47 +4. Ground claims in trusted resources; search/fetch if resources are thin.
48 +5. Write one self-contained HTML lesson in `lessons/`.
49 +6. Reuse `assets/`; create shared CSS before the first lesson if missing.
50 +7. Include explanation, worked examples, retrieval practice, and immediate feedback.
51 +8. Add/update glossary only for terms I can use correctly.
52 +9. Add a learning record only when there is evidence of understanding.
53 +10. Recommend exactly one next primary source or exercise.
55 +## Lesson standard
57 +Each HTML lesson should be beautiful, readable, and printable.
58 +Use calm typography, strong hierarchy, examples, callouts, and small interactive checks where useful.
59 +Keep each lesson focused enough to finish quickly.
60 +End with: recap, practice prompt, and invitation to ask follow-up questions.
62 +## Rules
64 +- Explanation over brevity.
65 +- One concept per lesson.
66 +- Retrieval beats rereading.
67 +- Storage strength beats fluency illusion.
68 +- Knowledge comes from sources; wisdom comes from practice and community.
69 +- Do not log coverage as learning.
70 +- Do not create giant courses upfront.
71 +- Do not duplicate reference material across lessons; link it.

pi/agent/prompts/wiki.md

Modified
1 ----
2 -description: "Use the wiki skill for research and persistent knowledge."
3 -argument-hint: "[operation] [focus|source|query]"
4 -section: Knowledge
5 -topLevelCli: true
6 -mask: sol-xhigh
7 ----
9 -# /wiki
11 -Load and follow the `wiki` skill; resolve it from available skills, not a guessed install path.
12 -Treat `$ARGUMENTS` as its operation and input.
13 -The skill owns defaults, workflow, safety, storage, and tool selection.
1 +---
2 +description: "Use the wiki skill for research and persistent knowledge."
3 +argument-hint: "[operation] [focus|source|query]"
4 +section: Knowledge
5 +topLevelCli: true
6 +mask: sol-xhigh
7 +---
9 +# /wiki
11 +Load and follow the `wiki` skill; resolve it from available skills, not a guessed install path.
12 +Treat `$ARGUMENTS` as its operation and input.
13 +The skill owns defaults, workflow, safety, storage, and tool selection.

pi/agent/prompts/wtf.md

Modified
1 ----
2 -description: Agent behavior feedback — surprise, confusion, or annoyance
3 -mask: astra
4 -argument-hint: "<what happened>"
5 ----
7 -The agent just surprised, confused, or annoyed me. Here's what happened:
9 -$@
11 -**Do NOT argue, justify, or explain why you did what you did.**
13 -Instead:
15 -1. **Acknowledge** — Briefly confirm you understand the complaint (1 sentence max).
16 -2. **Recall** — Use wiki skill to check `wtf/` for relevant past lessons.
17 -3. **Fix it** — Immediately correct the problem.
18 -4. **Learn** — Use wiki skill to retro this lesson into `wtf/`.
20 -Tone: direct, no apology essays, no hedging. Just fix it and move on.
22 -<!-- WTF -->
1 +---
2 +description: Agent behavior feedback — surprise, confusion, or annoyance
3 +mask: astra
4 +argument-hint: "<what happened>"
5 +---
7 +The agent just surprised, confused, or annoyed me. Here's what happened:
9 +$@
11 +**Do NOT argue, justify, or explain why you did what you did.**
13 +Instead:
15 +1. **Acknowledge** — Briefly confirm you understand the complaint (1 sentence max).
16 +2. **Recall** — Use wiki skill to check `wtf/` for relevant past lessons.
17 +3. **Fix it** — Immediately correct the problem.
18 +4. **Learn** — Use wiki skill to retro this lesson into `wtf/`.
20 +Tone: direct, no apology essays, no hedging. Just fix it and move on.
22 +<!-- WTF -->

topgrade/win32.toml

Modified
1 -[misc]
3 -# FIXME: sudo ist noch nicht erlaubt bei der isp.
4 -# das sollte entfernt werden, da es nicht funktioniert, wenn ein system frisch ist.
5 -# pre_sudo = true
6 -# sudo_command = "gsudo"
7 -cleanup = true
9 -disable = ['powershell', 'microsoft_store', 'pip3', 'system', 'wsl']
11 -[pre_commands]
12 -"00 Winget Export" = 'winget export --source winget --nowarn --output C:\Users\okr\Tools\winget_installed_apps.json'
14 -[post_commands]
15 -"00 Cleanup Downloads Folder" = "nu --commands 'ls ~/Downloads | where modified < ((date now) - 30day) | par-each { rm -rf $in.name }'"
17 -[commands]
18 -"WSL ArchLinux-dev" = "wsl --distribution ArchLinux-dev --exec /usr/sbin/topgrade -y"
19 -"Windows Update" = "powershell -NoProfile -Command 'Get-WindowsUpdate -MicrosoftUpdate -UpdateType Software -AcceptAll -Install -IgnoreReboot'"
21 -[containers]
22 -runtime = "podman"
23 -system_prune = true
25 -[windows]
26 -open_remotes_in_new_terminal = true
27 -wsl_update_use_web_download = true
1 +[misc]
3 +# FIXME: sudo ist noch nicht erlaubt bei der isp.
4 +# das sollte entfernt werden, da es nicht funktioniert, wenn ein system frisch ist.
5 +# pre_sudo = true
6 +# sudo_command = "gsudo"
7 +cleanup = true
9 +disable = ['powershell', 'microsoft_store', 'pip3', 'system', 'wsl']
11 +[pre_commands]
12 +"00 Winget Export" = 'winget export --source winget --nowarn --output C:\Users\okr\Tools\winget_installed_apps.json'
14 +[post_commands]
15 +"00 Cleanup Downloads Folder" = "nu --commands 'ls ~/Downloads | where modified < ((date now) - 30day) | par-each { rm -rf $in.name }'"
17 +[commands]
18 +"WSL ArchLinux-dev" = "wsl --distribution ArchLinux-dev --exec /usr/sbin/topgrade -y"
19 +"Windows Update" = "powershell -NoProfile -Command 'Get-WindowsUpdate -MicrosoftUpdate -UpdateType Software -AcceptAll -Install -IgnoreReboot'"
21 +[containers]
22 +runtime = "podman"
23 +system_prune = true
25 +[windows]
26 +open_remotes_in_new_terminal = true
27 +wsl_update_use_web_download = true

yazi/package.toml

Modified
1 -[[plugin.deps]]
2 -use = "yazi-rs/plugins:full-border"
3 -rev = "4dc7f1b"
4 -hash = "f281261ff04ad7ec867c3f802a50835f"
6 -[[plugin.deps]]
7 -use = "yazi-rs/plugins:toggle-pane"
8 -rev = "4dc7f1b"
9 -hash = "5b2fbef7d1513ce38ff72623a071a5e"
11 -[[plugin.deps]]
12 -use = "yazi-rs/plugins:smart-enter"
13 -rev = "4dc7f1b"
14 -hash = "187cc58ba7ac3befd49c342129e6f1b6"
16 -[[plugin.deps]]
17 -use = "yazi-rs/plugins:smart-filter"
18 -rev = "4dc7f1b"
19 -hash = "d6f7351ea25a43c9b5f4315fa1e23935"
21 -[[plugin.deps]]
22 -use = "yazi-rs/plugins:smart-paste"
23 -rev = "4dc7f1b"
24 -hash = "5be02722d97561b6f7aec22429aa00be"
26 -[[plugin.deps]]
27 -use = "yazi-rs/plugins:git"
28 -rev = "4dc7f1b"
29 -hash = "5bb0bfab901d3601c370eafdd66edd31"
31 -[[plugin.deps]]
32 -use = "yazi-rs/plugins:chmod"
33 -rev = "4dc7f1b"
34 -hash = "87472b05a8c420100f6a2b9cde1e7746"
36 -[[plugin.deps]]
37 -use = "yazi-rs/plugins:diff"
38 -rev = "4dc7f1b"
39 -hash = "14558d2829c0aa05e99c57de8f74d199"
41 -[[plugin.deps]]
42 -use = "yazi-rs/plugins:piper"
43 -rev = "4dc7f1b"
44 -hash = "45a533508a9840cc5a10cf6129f63e6a"
46 -[[plugin.deps]]
47 -use = "ndtoan96/ouch"
48 -rev = "cfe4f50"
49 -hash = "eff5702573b6cfba61e4ac8b1969629a"
51 -[[plugin.deps]]
52 -use = "llanosrocas/yaziline"
53 -rev = "029b27d"
54 -hash = "ceeb45e796faf0d9eed10831ffec7701"
56 -[flavor]
57 -deps = []
1 +[[plugin.deps]]
2 +use = "yazi-rs/plugins:full-border"
3 +rev = "4dc7f1b"
4 +hash = "f281261ff04ad7ec867c3f802a50835f"
6 +[[plugin.deps]]
7 +use = "yazi-rs/plugins:toggle-pane"
8 +rev = "4dc7f1b"
9 +hash = "5b2fbef7d1513ce38ff72623a071a5e"
11 +[[plugin.deps]]
12 +use = "yazi-rs/plugins:smart-enter"
13 +rev = "4dc7f1b"
14 +hash = "187cc58ba7ac3befd49c342129e6f1b6"
16 +[[plugin.deps]]
17 +use = "yazi-rs/plugins:smart-filter"
18 +rev = "4dc7f1b"
19 +hash = "d6f7351ea25a43c9b5f4315fa1e23935"
21 +[[plugin.deps]]
22 +use = "yazi-rs/plugins:smart-paste"
23 +rev = "4dc7f1b"
24 +hash = "5be02722d97561b6f7aec22429aa00be"
26 +[[plugin.deps]]
27 +use = "yazi-rs/plugins:git"
28 +rev = "4dc7f1b"
29 +hash = "5bb0bfab901d3601c370eafdd66edd31"
31 +[[plugin.deps]]
32 +use = "yazi-rs/plugins:chmod"
33 +rev = "4dc7f1b"
34 +hash = "87472b05a8c420100f6a2b9cde1e7746"
36 +[[plugin.deps]]
37 +use = "yazi-rs/plugins:diff"
38 +rev = "4dc7f1b"
39 +hash = "14558d2829c0aa05e99c57de8f74d199"
41 +[[plugin.deps]]
42 +use = "yazi-rs/plugins:piper"
43 +rev = "4dc7f1b"
44 +hash = "45a533508a9840cc5a10cf6129f63e6a"
46 +[[plugin.deps]]
47 +use = "ndtoan96/ouch"
48 +rev = "cfe4f50"
49 +hash = "eff5702573b6cfba61e4ac8b1969629a"
51 +[[plugin.deps]]
52 +use = "llanosrocas/yaziline"
53 +rev = "029b27d"
54 +hash = "ceeb45e796faf0d9eed10831ffec7701"
56 +[flavor]
57 +deps = []

yazi/theme.toml

Modified
1 -[flavor]
2 -dark = "nugu-dark"
3 -light = "nugu-light"
1 +[flavor]
2 +dark = "nugu-dark"
3 +light = "nugu-light"

yazi/yazi.toml

Modified
1 -# A TOML linter such as Tombi can use this schema to validate your config.
2 -#:schema https://yazi-rs.github.io/schemas/yazi.json
4 -[mgr]
5 -show_hidden = true
6 -sort_by = "natural"
7 -sort_dir_first = true
8 -linemode = "none"
10 -[opener]
11 -edit = [
12 - { run = 'nvim %s', desc = "nvim", block = true, for = "unix" },
13 -]
14 -play = [
15 - { run = 'mpv %s', desc = "mpv", orphan = true, for = "unix" },
16 -]
17 -open = [
18 - { run = 'xdg-open %s1', desc = "Open", for = "linux" },
19 -]
20 -extract = [
21 - { run = 'ouch d -y %s', desc = "Extract here with ouch", for = "unix" },
22 -]
24 -[open]
25 -prepend_rules = [
26 - { mime = "text/*", use = [ "edit", "reveal" ] },
27 - { mime = "application/{json,ndjson,javascript,wine-extension-ini}", use = [ "edit", "reveal" ] },
28 -]
30 -[plugin]
31 -prepend_fetchers = [
32 - { url = "*", run = "git", group = "git" },
33 - { url = "*/", run = "git", group = "git" },
34 -]
35 -prepend_previewers = [
36 - { url = "*.md", mime = "text/markdown", run = 'piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"' },
37 - { mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}", run = "ouch" },
38 -]
39 -append_previewers = [
40 - { url = "*", run = 'piper -- hexyl --border=none --terminal-width=$w "$1"' },
41 -]
1 +# A TOML linter such as Tombi can use this schema to validate your config.
2 +#:schema https://yazi-rs.github.io/schemas/yazi.json
4 +[mgr]
5 +show_hidden = true
6 +sort_by = "natural"
7 +sort_dir_first = true
8 +linemode = "none"
10 +[opener]
11 +edit = [
12 + { run = 'nvim %s', desc = "nvim", block = true, for = "unix" },
14 +play = [
15 + { run = 'mpv %s', desc = "mpv", orphan = true, for = "unix" },
17 +open = [
18 + { run = 'xdg-open %s1', desc = "Open", for = "linux" },
20 +extract = [
21 + { run = 'ouch d -y %s', desc = "Extract here with ouch", for = "unix" },
24 +[open]
25 +prepend_rules = [
26 + { mime = "text/*", use = [ "edit", "reveal" ] },
27 + { mime = "application/{json,ndjson,javascript,wine-extension-ini}", use = [ "edit", "reveal" ] },
30 +[plugin]
31 +prepend_fetchers = [
32 + { url = "*", run = "git", group = "git" },
33 + { url = "*/", run = "git", group = "git" },
35 +prepend_previewers = [
36 + { url = "*.md", mime = "text/markdown", run = 'piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"' },
37 + { mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}", run = "ouch" },
39 +append_previewers = [
40 + { url = "*", run = 'piper -- hexyl --border=none --terminal-width=$w "$1"' },

zed/.gitignore

Modified
1 -settings_backup.json
1 +settings_backup.json

zed/keymap.json

Modified
1 -[
2 - {
3 - "context": "vim_mode == normal",
4 - "bindings": {},
5 - },
6 - {
7 - "context": "vim_mode == insert",
8 - "bindings": {},
9 - },
10 - {
11 - "context": "vim_mode == visual",
12 - "bindings": {},
13 - },
14 -]
1 +[
2 + {
3 + "context": "vim_mode == normal",
4 + "bindings": {},
5 + },
6 + {
7 + "context": "vim_mode == insert",
8 + "bindings": {},
9 + },
10 + {
11 + "context": "vim_mode == visual",
12 + "bindings": {},
13 + },

zed/themes/nugu.json

Modified
1 -{
2 - "$schema": "https://zed.dev/schema/themes/v0.2.0.json",
3 - "name": "Nugu",
4 - "author": "bugabinga",
5 - "themes": [
6 - {
7 - "name": "Nugu Dark",
8 - "appearance": "dark",
9 - "style": {
10 - "accents": [
11 - "#d86dd8",
12 - "#b59ae4",
13 - "#7ba1aa"
14 - ],
15 - "background.appearance": "opaque",
16 - "border": "#9d9d9d",
17 - "border.variant": "#9d9d9d",
18 - "border.focused": "#d86dd8",
19 - "border.selected": "#d86dd8",
20 - "border.transparent": "#9d9d9d00",
21 - "border.disabled": "#9d9d9d60",
22 - "elevated_surface.background": "#9d9d9d2c",
23 - "surface.background": "#242424",
24 - "background": "#121212",
25 - "element.background": "#242424",
26 - "element.hover": "#9aabae0a",
27 - "element.active": "#9aabae0a",
28 - "element.selected": "#9aabae0a",
29 - "element.disabled": "#24242480",
30 - "drop_target.background": "#d86dd880",
31 - "ghost_element.background": null,
32 - "ghost_element.hover": "#9d9d9d80",
33 - "ghost_element.active": "#9aabae0a",
34 - "ghost_element.selected": "#9aabae0a",
35 - "ghost_element.disabled": "#9d9d9d60",
36 - "text": "#ededed",
37 - "text.muted": "#9d9d9d",
38 - "text.placeholder": "#9d9d9d",
39 - "text.disabled": "#9d9d9d",
40 - "text.accent": "#d86dd8",
41 - "icon": "#ededed",
42 - "icon.muted": "#9d9d9d",
43 - "icon.disabled": "#9d9d9d",
44 - "icon.placeholder": "#9d9d9d",
45 - "icon.accent": "#d86dd8",
46 - "status_bar.background": "#242424",
47 - "title_bar.background": "#242424",
48 - "title_bar.inactive_background": "#242424",
49 - "toolbar.background": "#242424",
50 - "tab_bar.background": "#242424",
51 - "tab.inactive_background": "#242424",
52 - "tab.active_background": "#242424",
53 - "search.match_background": "#7ba1aa80",
54 - "panel.background": "#242424",
55 - "panel.focused_border": "#d86dd8",
56 - "pane.focused_border": "#d86dd8",
57 - "pane_group.border": "#9d9d9d",
58 - "panel.indent_guide": "#9d9d9d60",
59 - "panel.indent_guide_active": "#9d9d9d",
60 - "panel.indent_guide_hover": "#d86dd8",
61 - "scrollbar.thumb.background": "#9d9d9d",
62 - "scrollbar.thumb.hover_background": "#9d9d9d",
63 - "scrollbar.thumb.border": "#9d9d9d",
64 - "scrollbar.track.background": "#242424",
65 - "scrollbar.track.border": "#9d9d9d60",
66 - "editor.foreground": "#ededed",
67 - "editor.background": "#121212",
68 - "editor.gutter.background": "#242424",
69 - "editor.subheader.background": "#242424",
70 - "editor.indent_guide": "#9d9d9d60",
71 - "editor.indent_guide_active": "#9d9d9d",
72 - "editor.active_line.background": "#242424cd",
73 - "editor.highlighted_line.background": "#24242410",
74 - "editor.line_number": "#9d9d9d",
75 - "editor.active_line_number": "#f3effb",
76 - "editor.invisible": "#9d9d9d80",
77 - "editor.wrap_guide": "#9d9d9d40",
78 - "editor.active_wrap_guide": "#9d9d9d80",
79 - "editor.document_highlight.bracket_background": "#7ba1aa40",
80 - "editor.document_highlight.read_background": "#d86dd840",
81 - "editor.document_highlight.write_background": "#f0ee6940",
82 - "terminal.background": "#121212",
83 - "terminal.ansi.background": "#121212",
84 - "terminal.foreground": "#ededed",
85 - "terminal.bright_foreground": "#f3effb",
86 - "terminal.dim_foreground": "#8b8b8b",
87 - "terminal.ansi.black": "#8b8b8b",
88 - "terminal.ansi.bright_black": "#9d9d9d",
89 - "terminal.ansi.dim_black": "#8b8b8b",
90 - "terminal.ansi.red": "#ec6376",
91 - "terminal.ansi.bright_red": "#ec6376",
92 - "terminal.ansi.dim_red": "#ec6376",
93 - "terminal.ansi.green": "#7ba1aa",
94 - "terminal.ansi.bright_green": "#9aabae",
95 - "terminal.ansi.dim_green": "#7ba1aa",
96 - "terminal.ansi.yellow": "#f0ee69",
97 - "terminal.ansi.bright_yellow": "#f0ee69",
98 - "terminal.ansi.dim_yellow": "#f0ee69",
99 - "terminal.ansi.blue": "#b59ae4",
100 - "terminal.ansi.bright_blue": "#dfd3f3",
101 - "terminal.ansi.dim_blue": "#b59ae4",
102 - "terminal.ansi.magenta": "#d151d1",
103 - "terminal.ansi.bright_magenta": "#d86dd8",
104 - "terminal.ansi.dim_magenta": "#d151d1",
105 - "terminal.ansi.cyan": "#3ec5e3",
106 - "terminal.ansi.bright_cyan": "#c9b6eb",
107 - "terminal.ansi.dim_cyan": "#3ec5e3",
108 - "terminal.ansi.white": "#ededed",
109 - "terminal.ansi.bright_white": "#f3effb",
110 - "terminal.ansi.dim_white": "#8b8b8b",
111 - "link_text.hover": "#d86dd8",
112 - "conflict": "#ec6376",
113 - "conflict.background": "#ec637610",
114 - "conflict.border": "#ec6376ff",
115 - "created": "#7ba1aa",
116 - "created.background": "#7ba1aa10",
117 - "created.border": "#7ba1aaff",
118 - "deleted": "#ec6376",
119 - "deleted.background": "#ec637610",
120 - "deleted.border": "#ec6376ff",
121 - "error": "#ec6376",
122 - "error.background": "#ec637610",
123 - "error.border": "#ec6376ff",
124 - "hidden": "#9d9d9d",
125 - "hidden.background": "#24242440",
126 - "hidden.border": "#9d9d9d60",
127 - "hint": "#3ec5e3",
128 - "hint.background": "#3ec5e310",
129 - "hint.border": "#3ec5e3ff",
130 - "ignored": "#8b8b8b60",
131 - "ignored.background": "#24242440",
132 - "ignored.border": "#9d9d9d40",
133 - "info": "#3ec5e3",
134 - "info.background": "#3ec5e310",
135 - "info.border": "#3ec5e3ff",
136 - "modified": "#c9b6eb",
137 - "modified.background": "#c9b6eb10",
138 - "modified.border": "#c9b6ebff",
139 - "predictive": "#8b8b8b80",
140 - "predictive.border": "#9d9d9d",
141 - "predictive.background": "#9aabae80",
142 - "renamed": "#c9b6eb",
143 - "renamed.border": "#c9b6ebff",
144 - "renamed.background": "#c9b6eb10",
145 - "success": "#7ba1aa",
146 - "success.background": "#7ba1aa10",
147 - "success.border": "#7ba1aaff",
148 - "unreachable": "#8b8b8b60",
149 - "unreachable.background": "#24242440",
150 - "unreachable.border": "#9d9d9d60",
151 - "warning": "#f0ee69",
152 - "warning.background": "#f0ee6910",
153 - "warning.border": "#f0ee69ff",
154 - "players": [
155 - {
156 - "cursor": "#d86dd8",
157 - "background": "#d86dd880",
158 - "selection": "#d86dd860"
159 - },
160 - {
161 - "cursor": "#f0ee69",
162 - "background": "#f0ee6980",
163 - "selection": "#f0ee6960"
164 - }
165 - ],
166 - "syntax": {
167 - "attribute": {
168 - "color": "#8b8b8b",
169 - "font_style": null,
170 - "font_weight": null
171 - },
172 - "boolean": {
173 - "color": "#7ba1aa",
174 - "font_style": "italic",
175 - "font_weight": null
176 - },
177 - "comment": {
178 - "color": "#dfd3f3",
179 - "font_style": "italic",
180 - "font_weight": 700
181 - },
182 - "comment.doc": {
183 - "color": "#dfd3f3",
184 - "font_style": "italic",
185 - "font_weight": 700
186 - },
187 - "constant": {
188 - "color": "#7ba1aa",
189 - "font_style": "italic",
190 - "font_weight": null
191 - },
192 - "constant.builtin": {
193 - "color": "#7ba1aa",
194 - "font_style": "italic",
195 - "font_weight": null
196 - },
197 - "constructor": {
198 - "color": "#dfd3f3",
199 - "font_style": null,
200 - "font_weight": 700
201 - },
202 - "embedded": {
203 - "color": "#ededed",
204 - "font_style": null,
205 - "font_weight": null
206 - },
207 - "emphasis": {
208 - "color": "#d151d1",
209 - "font_style": "italic",
210 - "font_weight": null
211 - },
212 - "emphasis.strong": {
213 - "color": "#d151d1",
214 - "font_style": null,
215 - "font_weight": 700
216 - },
217 - "enum": {
218 - "color": "#ededed",
219 - "font_style": null,
220 - "font_weight": null
221 - },
222 - "function": {
223 - "color": "#ededed",
224 - "font_style": null,
225 - "font_weight": null
226 - },
227 - "hint": {
228 - "color": "#c9b6eb",
229 - "font_style": null,
230 - "font_weight": null
231 - },
232 - "keyword": {
233 - "color": "#8b8b8b",
234 - "font_style": null,
235 - "font_weight": null
236 - },
237 - "label": {
238 - "color": "#8b8b8b",
239 - "font_style": null,
240 - "font_weight": null
241 - },
242 - "link_text": {
243 - "color": "#ededed",
244 - "font_style": null,
245 - "font_weight": null
246 - },
247 - "link_uri": {
248 - "color": "#7ba1aa",
249 - "font_style": "italic",
250 - "font_weight": null
251 - },
252 - "number": {
253 - "color": "#7ba1aa",
254 - "font_style": "italic",
255 - "font_weight": null
256 - },
257 - "operator": {
258 - "color": "#8b8b8b",
259 - "font_style": null,
260 - "font_weight": null
261 - },
262 - "preproc": {
263 - "color": "#dfd3f3",
264 - "font_style": null,
265 - "font_weight": 700
266 - },
267 - "primary": {
268 - "color": "#ededed",
269 - "font_style": null,
270 - "font_weight": null
271 - },
272 - "property": {
273 - "color": "#ededed",
274 - "font_style": null,
275 - "font_weight": null
276 - },
277 - "punctuation": {
278 - "color": "#8b8b8b",
279 - "font_style": null,
280 - "font_weight": null
281 - },
282 - "punctuation.bracket": {
283 - "color": "#8b8b8b",
284 - "font_style": null,
285 - "font_weight": null
286 - },
287 - "punctuation.delimiter": {
288 - "color": "#8b8b8b",
289 - "font_style": null,
290 - "font_weight": null
291 - },
292 - "punctuation.list_marker": {
293 - "color": "#8b8b8b",
294 - "font_style": null,
295 - "font_weight": null
296 - },
297 - "punctuation.special": {
298 - "color": "#dfd3f3",
299 - "font_style": null,
300 - "font_weight": 700
301 - },
302 - "string": {
303 - "color": "#7ba1aa",
304 - "font_style": "italic",
305 - "font_weight": null
306 - },
307 - "string.escape": {
308 - "color": "#dfd3f3",
309 - "font_style": null,
310 - "font_weight": 700
311 - },
312 - "string.regex": {
313 - "color": "#dbdbdb",
314 - "background_color": "#ed5eed",
315 - "font_style": null,
316 - "font_weight": 700
317 - },
318 - "string.special": {
319 - "color": "#dfd3f3",
320 - "font_style": null,
321 - "font_weight": 700
322 - },
323 - "string.special.symbol": {
324 - "color": "#dfd3f3",
325 - "font_style": null,
326 - "font_weight": 700
327 - },
328 - "tag": {
329 - "color": "#dfd3f3",
330 - "font_style": null,
331 - "font_weight": 700
332 - },
333 - "tag.doctype": {
334 - "color": "#dfd3f3",
335 - "font_style": null,
336 - "font_weight": 700
337 - },
338 - "text": {
339 - "color": "#ededed",
340 - "font_style": null,
341 - "font_weight": null
342 - },
343 - "text.literal": {
344 - "color": "#dfd3f3",
345 - "font_style": "italic",
346 - "font_weight": 700
347 - },
348 - "title": {
349 - "color": "#dfd3f3",
350 - "font_style": null,
351 - "font_weight": 700
352 - },
353 - "type": {
354 - "color": "#ededed",
355 - "font_style": null,
356 - "font_weight": null
357 - },
358 - "type.builtin": {
359 - "color": "#ededed",
360 - "font_style": null,
361 - "font_weight": null
362 - },
363 - "variable": {
364 - "color": "#ededed",
365 - "font_style": null,
366 - "font_weight": null
367 - },
368 - "variable.parameter": {
369 - "color": "#b59ae4",
370 - "font_style": null,
371 - "font_weight": 700
372 - },
373 - "variable.special": {
374 - "color": "#dfd3f3",
375 - "font_style": null,
376 - "font_weight": 700
377 - },
378 - "variant": {
379 - "color": "#ededed",
380 - "font_style": null,
381 - "font_weight": null
382 - }
383 - }
384 - }
385 - },
386 - {
387 - "name": "Nugu Light",
388 - "appearance": "light",
389 - "style": {
390 - "accents": [
391 - "#922792",
392 - "#715696",
393 - "#184e5b"
394 - ],
395 - "background.appearance": "opaque",
396 - "border": "#292929",
397 - "border.variant": "#292929",
398 - "border.focused": "#922792",
399 - "border.selected": "#922792",
400 - "border.transparent": "#29292900",
401 - "border.disabled": "#29292960",
402 - "elevated_surface.background": "#ededed",
403 - "surface.background": "#ededed",
404 - "background": "#ededed",
405 - "element.background": "#dbdbdb",
406 - "element.hover": "#15333b2b",
407 - "element.active": "#15333b2b",
408 - "element.selected": "#15333b2b",
409 - "element.disabled": "#dbdbdb80",
410 - "drop_target.background": "#92279280",
411 - "ghost_element.background": null,
412 - "ghost_element.hover": "#29292980",
413 - "ghost_element.active": "#15333b2b",
414 - "ghost_element.selected": "#15333b2b",
415 - "ghost_element.disabled": "#29292960",
416 - "text": "#121212",
417 - "text.muted": "#292929",
418 - "text.placeholder": "#292929",
419 - "text.disabled": "#292929",
420 - "text.accent": "#922792",
421 - "icon": "#121212",
422 - "icon.muted": "#292929",
423 - "icon.disabled": "#292929",
424 - "icon.placeholder": "#292929",
425 - "icon.accent": "#922792",
426 - "status_bar.background": "#dbdbdb",
427 - "title_bar.background": "#dbdbdb",
428 - "title_bar.inactive_background": "#dbdbdb",
429 - "toolbar.background": "#dbdbdb",
430 - "tab_bar.background": "#dbdbdb",
431 - "tab.inactive_background": "#dbdbdb",
432 - "tab.active_background": "#ededed",
433 - "search.match_background": "#184e5b80",
434 - "panel.background": "#dbdbdb",
435 - "panel.focused_border": "#922792",
436 - "pane.focused_border": "#922792",
437 - "pane_group.border": "#292929",
438 - "panel.indent_guide": "#29292960",
439 - "panel.indent_guide_active": "#292929",
440 - "panel.indent_guide_hover": "#922792",
441 - "scrollbar.thumb.background": "#292929",
442 - "scrollbar.thumb.hover_background": "#292929",
443 - "scrollbar.thumb.border": "#292929",
444 - "scrollbar.track.background": "#dbdbdb",
445 - "scrollbar.track.border": "#29292960",
446 - "editor.foreground": "#121212",
447 - "editor.background": "#ededed",
448 - "editor.gutter.background": "#dbdbdb",
449 - "editor.subheader.background": "#ededed",
450 - "editor.indent_guide": "#29292960",
451 - "editor.indent_guide_active": "#292929",
452 - "editor.active_line.background": "#dbdbdb3f",
453 - "editor.highlighted_line.background": "#dbdbdb10",
454 - "editor.line_number": "#292929",
455 - "editor.active_line_number": "#3e2f53",
456 - "editor.invisible": "#29292980",
457 - "editor.wrap_guide": "#29292940",
458 - "editor.active_wrap_guide": "#29292980",
459 - "editor.document_highlight.bracket_background": "#184e5b40",
460 - "editor.document_highlight.read_background": "#92279240",
461 - "editor.document_highlight.write_background": "#6e6c1040",
462 - "terminal.background": "#ededed",
463 - "terminal.ansi.background": "#ededed",
464 - "terminal.foreground": "#121212",
465 - "terminal.bright_foreground": "#3e2f53",
466 - "terminal.dim_foreground": "#3b3b3b",
467 - "terminal.ansi.black": "#3b3b3b",
468 - "terminal.ansi.bright_black": "#292929",
469 - "terminal.ansi.dim_black": "#3b3b3b",
470 - "terminal.ansi.red": "#bd172e",
471 - "terminal.ansi.bright_red": "#bd172e",
472 - "terminal.ansi.dim_red": "#bd172e",
473 - "terminal.ansi.green": "#184e5b",
474 - "terminal.ansi.bright_green": "#15333b",
475 - "terminal.ansi.dim_green": "#184e5b",
476 - "terminal.ansi.yellow": "#6e6c10",
477 - "terminal.ansi.bright_yellow": "#6e6c10",
478 - "terminal.ansi.dim_yellow": "#6e6c10",
479 - "terminal.ansi.blue": "#715696",
480 - "terminal.ansi.bright_blue": "#4f3c69",
481 - "terminal.ansi.dim_blue": "#715696",
482 - "terminal.ansi.magenta": "#ae2eae",
483 - "terminal.ansi.bright_magenta": "#922792",
484 - "terminal.ansi.dim_magenta": "#ae2eae",
485 - "terminal.ansi.cyan": "#116477",
486 - "terminal.ansi.bright_cyan": "#604980",
487 - "terminal.ansi.dim_cyan": "#116477",
488 - "terminal.ansi.white": "#121212",
489 - "terminal.ansi.bright_white": "#3e2f53",
490 - "terminal.ansi.dim_white": "#3b3b3b",
491 - "link_text.hover": "#922792",
492 - "conflict": "#bd172e",
493 - "conflict.background": "#bd172e06",
494 - "conflict.border": "#bd172ec0",
495 - "created": "#184e5b",
496 - "created.background": "#184e5b06",
497 - "created.border": "#184e5bc0",
498 - "deleted": "#bd172e",
499 - "deleted.background": "#bd172e06",
500 - "deleted.border": "#bd172ec0",
501 - "error": "#bd172e",
502 - "error.background": "#bd172e06",
503 - "error.border": "#bd172ec0",
504 - "hidden": "#292929",
505 - "hidden.background": "#dbdbdb40",
506 - "hidden.border": "#29292960",
507 - "hint": "#116477",
508 - "hint.background": "#11647706",
509 - "hint.border": "#116477c0",
510 - "ignored": "#3b3b3b60",
511 - "ignored.background": "#dbdbdb40",
512 - "ignored.border": "#29292940",
513 - "info": "#116477",
514 - "info.background": "#11647706",
515 - "info.border": "#116477c0",
516 - "modified": "#604980",
517 - "modified.background": "#60498006",
518 - "modified.border": "#604980c0",
519 - "predictive": "#3b3b3b80",
520 - "predictive.border": "#292929",
521 - "predictive.background": "#15333b80",
522 - "renamed": "#604980",
523 - "renamed.border": "#604980c0",
524 - "renamed.background": "#60498006",
525 - "success": "#184e5b",
526 - "success.background": "#184e5b06",
527 - "success.border": "#184e5bc0",
528 - "unreachable": "#3b3b3b60",
529 - "unreachable.background": "#dbdbdb40",
530 - "unreachable.border": "#29292960",
531 - "warning": "#6e6c10",
532 - "warning.background": "#6e6c1006",
533 - "warning.border": "#6e6c10c0",
534 - "players": [
535 - {
536 - "cursor": "#922792",
537 - "background": "#92279280",
538 - "selection": "#92279260"
539 - },
540 - {
541 - "cursor": "#6e6c10",
542 - "background": "#6e6c1080",
543 - "selection": "#6e6c1060"
544 - }
545 - ],
546 - "syntax": {
547 - "attribute": {
548 - "color": "#3b3b3b",
549 - "font_style": null,
550 - "font_weight": null
551 - },
552 - "boolean": {
553 - "color": "#184e5b",
554 - "font_style": "italic",
555 - "font_weight": null
556 - },
557 - "comment": {
558 - "color": "#4f3c69",
559 - "font_style": "italic",
560 - "font_weight": 700
561 - },
562 - "comment.doc": {
563 - "color": "#4f3c69",
564 - "font_style": "italic",
565 - "font_weight": 700
566 - },
567 - "constant": {
568 - "color": "#184e5b",
569 - "font_style": "italic",
570 - "font_weight": null
571 - },
572 - "constant.builtin": {
573 - "color": "#184e5b",
574 - "font_style": "italic",
575 - "font_weight": null
576 - },
577 - "constructor": {
578 - "color": "#4f3c69",
579 - "font_style": null,
580 - "font_weight": 700
581 - },
582 - "embedded": {
583 - "color": "#121212",
584 - "font_style": null,
585 - "font_weight": null
586 - },
587 - "emphasis": {
588 - "color": "#ae2eae",
589 - "font_style": "italic",
590 - "font_weight": null
591 - },
592 - "emphasis.strong": {
593 - "color": "#ae2eae",
594 - "font_style": null,
595 - "font_weight": 700
596 - },
597 - "enum": {
598 - "color": "#121212",
599 - "font_style": null,
600 - "font_weight": null
601 - },
602 - "function": {
603 - "color": "#121212",
604 - "font_style": null,
605 - "font_weight": null
606 - },
607 - "hint": {
608 - "color": "#604980",
609 - "font_style": null,
610 - "font_weight": null
611 - },
612 - "keyword": {
613 - "color": "#3b3b3b",
614 - "font_style": null,
615 - "font_weight": null
616 - },
617 - "label": {
618 - "color": "#3b3b3b",
619 - "font_style": null,
620 - "font_weight": null
621 - },
622 - "link_text": {
623 - "color": "#121212",
624 - "font_style": null,
625 - "font_weight": null
626 - },
627 - "link_uri": {
628 - "color": "#184e5b",
629 - "font_style": "italic",
630 - "font_weight": null
631 - },
632 - "number": {
633 - "color": "#184e5b",
634 - "font_style": "italic",
635 - "font_weight": null
636 - },
637 - "operator": {
638 - "color": "#3b3b3b",
639 - "font_style": null,
640 - "font_weight": null
641 - },
642 - "preproc": {
643 - "color": "#4f3c69",
644 - "font_style": null,
645 - "font_weight": 700
646 - },
647 - "primary": {
648 - "color": "#121212",
649 - "font_style": null,
650 - "font_weight": null
651 - },
652 - "property": {
653 - "color": "#121212",
654 - "font_style": null,
655 - "font_weight": null
656 - },
657 - "punctuation": {
658 - "color": "#3b3b3b",
659 - "font_style": null,
660 - "font_weight": null
661 - },
662 - "punctuation.bracket": {
663 - "color": "#3b3b3b",
664 - "font_style": null,
665 - "font_weight": null
666 - },
667 - "punctuation.delimiter": {
668 - "color": "#3b3b3b",
669 - "font_style": null,
670 - "font_weight": null
671 - },
672 - "punctuation.list_marker": {
673 - "color": "#3b3b3b",
674 - "font_style": null,
675 - "font_weight": null
676 - },
677 - "punctuation.special": {
678 - "color": "#4f3c69",
679 - "font_style": null,
680 - "font_weight": 700
681 - },
682 - "string": {
683 - "color": "#184e5b",
684 - "font_style": "italic",
685 - "font_weight": null
686 - },
687 - "string.escape": {
688 - "color": "#4f3c69",
689 - "font_style": null,
690 - "font_weight": 700
691 - },
692 - "string.regex": {
693 - "color": "#242424",
694 - "background_color": "#a112a1",
695 - "font_style": null,
696 - "font_weight": 700
697 - },
698 - "string.special": {
699 - "color": "#4f3c69",
700 - "font_style": null,
701 - "font_weight": 700
702 - },
703 - "string.special.symbol": {
704 - "color": "#4f3c69",
705 - "font_style": null,
706 - "font_weight": 700
707 - },
708 - "tag": {
709 - "color": "#4f3c69",
710 - "font_style": null,
711 - "font_weight": 700
712 - },
713 - "tag.doctype": {
714 - "color": "#4f3c69",
715 - "font_style": null,
716 - "font_weight": 700
717 - },
718 - "text": {
719 - "color": "#121212",
720 - "font_style": null,
721 - "font_weight": null
722 - },
723 - "text.literal": {
724 - "color": "#4f3c69",
725 - "font_style": "italic",
726 - "font_weight": 700
727 - },
728 - "title": {
729 - "color": "#4f3c69",
730 - "font_style": null,
731 - "font_weight": 700
732 - },
733 - "type": {
734 - "color": "#121212",
735 - "font_style": null,
736 - "font_weight": null
737 - },
738 - "type.builtin": {
739 - "color": "#121212",
740 - "font_style": null,
741 - "font_weight": null
742 - },
743 - "variable": {
744 - "color": "#121212",
745 - "font_style": null,
746 - "font_weight": null
747 - },
748 - "variable.parameter": {
749 - "color": "#715696",
750 - "font_style": null,
751 - "font_weight": 700
752 - },
753 - "variable.special": {
754 - "color": "#4f3c69",
755 - "font_style": null,
756 - "font_weight": 700
757 - },
758 - "variant": {
759 - "color": "#121212",
760 - "font_style": null,
761 - "font_weight": null
762 - }
763 - }
764 - }
765 - }
766 - ]
1 +{
2 + "$schema": "https://zed.dev/schema/themes/v0.2.0.json",
3 + "name": "Nugu",
4 + "author": "bugabinga",
5 + "themes": [
6 + {
7 + "name": "Nugu Dark",
8 + "appearance": "dark",
9 + "style": {
10 + "accents": [
11 + "#d86dd8",
12 + "#b59ae4",
13 + "#7ba1aa"
14 + ],
15 + "background.appearance": "opaque",
16 + "border": "#9d9d9d",
17 + "border.variant": "#9d9d9d",
18 + "border.focused": "#d86dd8",
19 + "border.selected": "#d86dd8",
20 + "border.transparent": "#9d9d9d00",
21 + "border.disabled": "#9d9d9d60",
22 + "elevated_surface.background": "#9d9d9d2c",
23 + "surface.background": "#242424",
24 + "background": "#121212",
25 + "element.background": "#242424",
26 + "element.hover": "#9aabae0a",
27 + "element.active": "#9aabae0a",
28 + "element.selected": "#9aabae0a",
29 + "element.disabled": "#24242480",
30 + "drop_target.background": "#d86dd880",
31 + "ghost_element.background": null,
32 + "ghost_element.hover": "#9d9d9d80",
33 + "ghost_element.active": "#9aabae0a",
34 + "ghost_element.selected": "#9aabae0a",
35 + "ghost_element.disabled": "#9d9d9d60",
36 + "text": "#ededed",
37 + "text.muted": "#9d9d9d",
38 + "text.placeholder": "#9d9d9d",
39 + "text.disabled": "#9d9d9d",
40 + "text.accent": "#d86dd8",
41 + "icon": "#ededed",
42 + "icon.muted": "#9d9d9d",
43 + "icon.disabled": "#9d9d9d",
44 + "icon.placeholder": "#9d9d9d",
45 + "icon.accent": "#d86dd8",
46 + "status_bar.background": "#242424",
47 + "title_bar.background": "#242424",
48 + "title_bar.inactive_background": "#242424",
49 + "toolbar.background": "#242424",
50 + "tab_bar.background": "#242424",
51 + "tab.inactive_background": "#242424",
52 + "tab.active_background": "#242424",
53 + "search.match_background": "#7ba1aa80",
54 + "panel.background": "#242424",
55 + "panel.focused_border": "#d86dd8",
56 + "pane.focused_border": "#d86dd8",
57 + "pane_group.border": "#9d9d9d",
58 + "panel.indent_guide": "#9d9d9d60",
59 + "panel.indent_guide_active": "#9d9d9d",
60 + "panel.indent_guide_hover": "#d86dd8",
61 + "scrollbar.thumb.background": "#9d9d9d",
62 + "scrollbar.thumb.hover_background": "#9d9d9d",
63 + "scrollbar.thumb.border": "#9d9d9d",
64 + "scrollbar.track.background": "#242424",
65 + "scrollbar.track.border": "#9d9d9d60",
66 + "editor.foreground": "#ededed",
67 + "editor.background": "#121212",
68 + "editor.gutter.background": "#242424",
69 + "editor.subheader.background": "#242424",
70 + "editor.indent_guide": "#9d9d9d60",
71 + "editor.indent_guide_active": "#9d9d9d",
72 + "editor.active_line.background": "#242424cd",
73 + "editor.highlighted_line.background": "#24242410",
74 + "editor.line_number": "#9d9d9d",
75 + "editor.active_line_number": "#f3effb",
76 + "editor.invisible": "#9d9d9d80",
77 + "editor.wrap_guide": "#9d9d9d40",
78 + "editor.active_wrap_guide": "#9d9d9d80",
79 + "editor.document_highlight.bracket_background": "#7ba1aa40",
80 + "editor.document_highlight.read_background": "#d86dd840",
81 + "editor.document_highlight.write_background": "#f0ee6940",
82 + "terminal.background": "#121212",
83 + "terminal.ansi.background": "#121212",
84 + "terminal.foreground": "#ededed",
85 + "terminal.bright_foreground": "#f3effb",
86 + "terminal.dim_foreground": "#8b8b8b",
87 + "terminal.ansi.black": "#8b8b8b",
88 + "terminal.ansi.bright_black": "#9d9d9d",
89 + "terminal.ansi.dim_black": "#8b8b8b",
90 + "terminal.ansi.red": "#ec6376",
91 + "terminal.ansi.bright_red": "#ec6376",
92 + "terminal.ansi.dim_red": "#ec6376",
93 + "terminal.ansi.green": "#7ba1aa",
94 + "terminal.ansi.bright_green": "#9aabae",
95 + "terminal.ansi.dim_green": "#7ba1aa",
96 + "terminal.ansi.yellow": "#f0ee69",
97 + "terminal.ansi.bright_yellow": "#f0ee69",
98 + "terminal.ansi.dim_yellow": "#f0ee69",
99 + "terminal.ansi.blue": "#b59ae4",
100 + "terminal.ansi.bright_blue": "#dfd3f3",
101 + "terminal.ansi.dim_blue": "#b59ae4",
102 + "terminal.ansi.magenta": "#d151d1",
103 + "terminal.ansi.bright_magenta": "#d86dd8",
104 + "terminal.ansi.dim_magenta": "#d151d1",
105 + "terminal.ansi.cyan": "#3ec5e3",
106 + "terminal.ansi.bright_cyan": "#c9b6eb",
107 + "terminal.ansi.dim_cyan": "#3ec5e3",
108 + "terminal.ansi.white": "#ededed",
109 + "terminal.ansi.bright_white": "#f3effb",
110 + "terminal.ansi.dim_white": "#8b8b8b",
111 + "link_text.hover": "#d86dd8",
112 + "conflict": "#ec6376",
113 + "conflict.background": "#ec637610",
114 + "conflict.border": "#ec6376ff",
115 + "created": "#7ba1aa",
116 + "created.background": "#7ba1aa10",
117 + "created.border": "#7ba1aaff",
118 + "deleted": "#ec6376",
119 + "deleted.background": "#ec637610",
120 + "deleted.border": "#ec6376ff",
121 + "error": "#ec6376",
122 + "error.background": "#ec637610",
123 + "error.border": "#ec6376ff",
124 + "hidden": "#9d9d9d",
125 + "hidden.background": "#24242440",
126 + "hidden.border": "#9d9d9d60",
127 + "hint": "#3ec5e3",
128 + "hint.background": "#3ec5e310",
129 + "hint.border": "#3ec5e3ff",
130 + "ignored": "#8b8b8b60",
131 + "ignored.background": "#24242440",
132 + "ignored.border": "#9d9d9d40",
133 + "info": "#3ec5e3",
134 + "info.background": "#3ec5e310",
135 + "info.border": "#3ec5e3ff",
136 + "modified": "#c9b6eb",
137 + "modified.background": "#c9b6eb10",
138 + "modified.border": "#c9b6ebff",
139 + "predictive": "#8b8b8b80",
140 + "predictive.border": "#9d9d9d",
141 + "predictive.background": "#9aabae80",
142 + "renamed": "#c9b6eb",
143 + "renamed.border": "#c9b6ebff",
144 + "renamed.background": "#c9b6eb10",
145 + "success": "#7ba1aa",
146 + "success.background": "#7ba1aa10",
147 + "success.border": "#7ba1aaff",
148 + "unreachable": "#8b8b8b60",
149 + "unreachable.background": "#24242440",
150 + "unreachable.border": "#9d9d9d60",
151 + "warning": "#f0ee69",
152 + "warning.background": "#f0ee6910",
153 + "warning.border": "#f0ee69ff",
154 + "players": [
156 + "cursor": "#d86dd8",
157 + "background": "#d86dd880",
158 + "selection": "#d86dd860"
159 + },
161 + "cursor": "#f0ee69",
162 + "background": "#f0ee6980",
163 + "selection": "#f0ee6960"
165 + ],
166 + "syntax": {
167 + "attribute": {
168 + "color": "#8b8b8b",
169 + "font_style": null,
170 + "font_weight": null
171 + },
172 + "boolean": {
173 + "color": "#7ba1aa",
174 + "font_style": "italic",
175 + "font_weight": null
176 + },
177 + "comment": {
178 + "color": "#dfd3f3",
179 + "font_style": "italic",
180 + "font_weight": 700
181 + },
182 + "comment.doc": {
183 + "color": "#dfd3f3",
184 + "font_style": "italic",
185 + "font_weight": 700
186 + },
187 + "constant": {
188 + "color": "#7ba1aa",
189 + "font_style": "italic",
190 + "font_weight": null
191 + },
192 + "constant.builtin": {
193 + "color": "#7ba1aa",
194 + "font_style": "italic",
195 + "font_weight": null
196 + },
197 + "constructor": {
198 + "color": "#dfd3f3",
199 + "font_style": null,
200 + "font_weight": 700
201 + },
202 + "embedded": {
203 + "color": "#ededed",
204 + "font_style": null,
205 + "font_weight": null
206 + },
207 + "emphasis": {
208 + "color": "#d151d1",
209 + "font_style": "italic",
210 + "font_weight": null
211 + },
212 + "emphasis.strong": {
213 + "color": "#d151d1",
214 + "font_style": null,
215 + "font_weight": 700
216 + },
217 + "enum": {
218 + "color": "#ededed",
219 + "font_style": null,
220 + "font_weight": null
221 + },
222 + "function": {
223 + "color": "#ededed",
224 + "font_style": null,
225 + "font_weight": null
226 + },
227 + "hint": {
228 + "color": "#c9b6eb",
229 + "font_style": null,
230 + "font_weight": null
231 + },
232 + "keyword": {
233 + "color": "#8b8b8b",
234 + "font_style": null,
235 + "font_weight": null
236 + },
237 + "label": {
238 + "color": "#8b8b8b",
239 + "font_style": null,
240 + "font_weight": null
241 + },
242 + "link_text": {
243 + "color": "#ededed",
244 + "font_style": null,
245 + "font_weight": null
246 + },
247 + "link_uri": {
248 + "color": "#7ba1aa",
249 + "font_style": "italic",
250 + "font_weight": null
251 + },
252 + "number": {
253 + "color": "#7ba1aa",
254 + "font_style": "italic",
255 + "font_weight": null
256 + },
257 + "operator": {
258 + "color": "#8b8b8b",
259 + "font_style": null,
260 + "font_weight": null
261 + },
262 + "preproc": {
263 + "color": "#dfd3f3",
264 + "font_style": null,
265 + "font_weight": 700
266 + },
267 + "primary": {
268 + "color": "#ededed",
269 + "font_style": null,
270 + "font_weight": null
271 + },
272 + "property": {
273 + "color": "#ededed",
274 + "font_style": null,
275 + "font_weight": null
276 + },
277 + "punctuation": {
278 + "color": "#8b8b8b",
279 + "font_style": null,
280 + "font_weight": null
281 + },
282 + "punctuation.bracket": {
283 + "color": "#8b8b8b",
284 + "font_style": null,
285 + "font_weight": null
286 + },
287 + "punctuation.delimiter": {
288 + "color": "#8b8b8b",
289 + "font_style": null,
290 + "font_weight": null
291 + },
292 + "punctuation.list_marker": {
293 + "color": "#8b8b8b",
294 + "font_style": null,
295 + "font_weight": null
296 + },
297 + "punctuation.special": {
298 + "color": "#dfd3f3",
299 + "font_style": null,
300 + "font_weight": 700
301 + },
302 + "string": {
303 + "color": "#7ba1aa",
304 + "font_style": "italic",
305 + "font_weight": null
306 + },
307 + "string.escape": {
308 + "color": "#dfd3f3",
309 + "font_style": null,
310 + "font_weight": 700
311 + },
312 + "string.regex": {
313 + "color": "#dbdbdb",
314 + "background_color": "#ed5eed",
315 + "font_style": null,
316 + "font_weight": 700
317 + },
318 + "string.special": {
319 + "color": "#dfd3f3",
320 + "font_style": null,
321 + "font_weight": 700
322 + },
323 + "string.special.symbol": {
324 + "color": "#dfd3f3",
325 + "font_style": null,
326 + "font_weight": 700
327 + },
328 + "tag": {
329 + "color": "#dfd3f3",
330 + "font_style": null,
331 + "font_weight": 700
332 + },
333 + "tag.doctype": {
334 + "color": "#dfd3f3",
335 + "font_style": null,
336 + "font_weight": 700
337 + },
338 + "text": {
339 + "color": "#ededed",
340 + "font_style": null,
341 + "font_weight": null
342 + },
343 + "text.literal": {
344 + "color": "#dfd3f3",
345 + "font_style": "italic",
346 + "font_weight": 700
347 + },
348 + "title": {
349 + "color": "#dfd3f3",
350 + "font_style": null,
351 + "font_weight": 700
352 + },
353 + "type": {
354 + "color": "#ededed",
355 + "font_style": null,
356 + "font_weight": null
357 + },
358 + "type.builtin": {
359 + "color": "#ededed",
360 + "font_style": null,
361 + "font_weight": null
362 + },
363 + "variable": {
364 + "color": "#ededed",
365 + "font_style": null,
366 + "font_weight": null
367 + },
368 + "variable.parameter": {
369 + "color": "#b59ae4",
370 + "font_style": null,
371 + "font_weight": 700
372 + },
373 + "variable.special": {
374 + "color": "#dfd3f3",
375 + "font_style": null,
376 + "font_weight": 700
377 + },
378 + "variant": {
379 + "color": "#ededed",
380 + "font_style": null,
381 + "font_weight": null
385 + },
387 + "name": "Nugu Light",
388 + "appearance": "light",
389 + "style": {
390 + "accents": [
391 + "#922792",
392 + "#715696",
393 + "#184e5b"
394 + ],
395 + "background.appearance": "opaque",
396 + "border": "#292929",
397 + "border.variant": "#292929",
398 + "border.focused": "#922792",
399 + "border.selected": "#922792",
400 + "border.transparent": "#29292900",
401 + "border.disabled": "#29292960",
402 + "elevated_surface.background": "#ededed",
403 + "surface.background": "#ededed",
404 + "background": "#ededed",
405 + "element.background": "#dbdbdb",
406 + "element.hover": "#15333b2b",
407 + "element.active": "#15333b2b",
408 + "element.selected": "#15333b2b",
409 + "element.disabled": "#dbdbdb80",
410 + "drop_target.background": "#92279280",
411 + "ghost_element.background": null,
412 + "ghost_element.hover": "#29292980",
413 + "ghost_element.active": "#15333b2b",
414 + "ghost_element.selected": "#15333b2b",
415 + "ghost_element.disabled": "#29292960",
416 + "text": "#121212",
417 + "text.muted": "#292929",
418 + "text.placeholder": "#292929",
419 + "text.disabled": "#292929",
420 + "text.accent": "#922792",
421 + "icon": "#121212",
422 + "icon.muted": "#292929",
423 + "icon.disabled": "#292929",
424 + "icon.placeholder": "#292929",
425 + "icon.accent": "#922792",
426 + "status_bar.background": "#dbdbdb",
427 + "title_bar.background": "#dbdbdb",
428 + "title_bar.inactive_background": "#dbdbdb",
429 + "toolbar.background": "#dbdbdb",
430 + "tab_bar.background": "#dbdbdb",
431 + "tab.inactive_background": "#dbdbdb",
432 + "tab.active_background": "#ededed",
433 + "search.match_background": "#184e5b80",
434 + "panel.background": "#dbdbdb",
435 + "panel.focused_border": "#922792",
436 + "pane.focused_border": "#922792",
437 + "pane_group.border": "#292929",
438 + "panel.indent_guide": "#29292960",
439 + "panel.indent_guide_active": "#292929",
440 + "panel.indent_guide_hover": "#922792",
441 + "scrollbar.thumb.background": "#292929",
442 + "scrollbar.thumb.hover_background": "#292929",
443 + "scrollbar.thumb.border": "#292929",
444 + "scrollbar.track.background": "#dbdbdb",
445 + "scrollbar.track.border": "#29292960",
446 + "editor.foreground": "#121212",
447 + "editor.background": "#ededed",
448 + "editor.gutter.background": "#dbdbdb",
449 + "editor.subheader.background": "#ededed",
450 + "editor.indent_guide": "#29292960",
451 + "editor.indent_guide_active": "#292929",
452 + "editor.active_line.background": "#dbdbdb3f",
453 + "editor.highlighted_line.background": "#dbdbdb10",
454 + "editor.line_number": "#292929",
455 + "editor.active_line_number": "#3e2f53",
456 + "editor.invisible": "#29292980",
457 + "editor.wrap_guide": "#29292940",
458 + "editor.active_wrap_guide": "#29292980",
459 + "editor.document_highlight.bracket_background": "#184e5b40",
460 + "editor.document_highlight.read_background": "#92279240",
461 + "editor.document_highlight.write_background": "#6e6c1040",
462 + "terminal.background": "#ededed",
463 + "terminal.ansi.background": "#ededed",
464 + "terminal.foreground": "#121212",
465 + "terminal.bright_foreground": "#3e2f53",
466 + "terminal.dim_foreground": "#3b3b3b",
467 + "terminal.ansi.black": "#3b3b3b",
468 + "terminal.ansi.bright_black": "#292929",
469 + "terminal.ansi.dim_black": "#3b3b3b",
470 + "terminal.ansi.red": "#bd172e",
471 + "terminal.ansi.bright_red": "#bd172e",
472 + "terminal.ansi.dim_red": "#bd172e",
473 + "terminal.ansi.green": "#184e5b",
474 + "terminal.ansi.bright_green": "#15333b",
475 + "terminal.ansi.dim_green": "#184e5b",
476 + "terminal.ansi.yellow": "#6e6c10",
477 + "terminal.ansi.bright_yellow": "#6e6c10",
478 + "terminal.ansi.dim_yellow": "#6e6c10",
479 + "terminal.ansi.blue": "#715696",
480 + "terminal.ansi.bright_blue": "#4f3c69",
481 + "terminal.ansi.dim_blue": "#715696",
482 + "terminal.ansi.magenta": "#ae2eae",
483 + "terminal.ansi.bright_magenta": "#922792",
484 + "terminal.ansi.dim_magenta": "#ae2eae",
485 + "terminal.ansi.cyan": "#116477",
486 + "terminal.ansi.bright_cyan": "#604980",
487 + "terminal.ansi.dim_cyan": "#116477",
488 + "terminal.ansi.white": "#121212",
489 + "terminal.ansi.bright_white": "#3e2f53",
490 + "terminal.ansi.dim_white": "#3b3b3b",
491 + "link_text.hover": "#922792",
492 + "conflict": "#bd172e",
493 + "conflict.background": "#bd172e06",
494 + "conflict.border": "#bd172ec0",
495 + "created": "#184e5b",
496 + "created.background": "#184e5b06",
497 + "created.border": "#184e5bc0",
498 + "deleted": "#bd172e",
499 + "deleted.background": "#bd172e06",
500 + "deleted.border": "#bd172ec0",
501 + "error": "#bd172e",
502 + "error.background": "#bd172e06",
503 + "error.border": "#bd172ec0",
504 + "hidden": "#292929",
505 + "hidden.background": "#dbdbdb40",
506 + "hidden.border": "#29292960",
507 + "hint": "#116477",
508 + "hint.background": "#11647706",
509 + "hint.border": "#116477c0",
510 + "ignored": "#3b3b3b60",
511 + "ignored.background": "#dbdbdb40",
512 + "ignored.border": "#29292940",
513 + "info": "#116477",
514 + "info.background": "#11647706",
515 + "info.border": "#116477c0",
516 + "modified": "#604980",
517 + "modified.background": "#60498006",
518 + "modified.border": "#604980c0",
519 + "predictive": "#3b3b3b80",
520 + "predictive.border": "#292929",
521 + "predictive.background": "#15333b80",
522 + "renamed": "#604980",
523 + "renamed.border": "#604980c0",
524 + "renamed.background": "#60498006",
525 + "success": "#184e5b",
526 + "success.background": "#184e5b06",
527 + "success.border": "#184e5bc0",
528 + "unreachable": "#3b3b3b60",
529 + "unreachable.background": "#dbdbdb40",
530 + "unreachable.border": "#29292960",
531 + "warning": "#6e6c10",
532 + "warning.background": "#6e6c1006",
533 + "warning.border": "#6e6c10c0",
534 + "players": [
536 + "cursor": "#922792",
537 + "background": "#92279280",
538 + "selection": "#92279260"
539 + },
541 + "cursor": "#6e6c10",
542 + "background": "#6e6c1080",
543 + "selection": "#6e6c1060"
545 + ],
546 + "syntax": {
547 + "attribute": {
548 + "color": "#3b3b3b",
549 + "font_style": null,
550 + "font_weight": null
551 + },
552 + "boolean": {
553 + "color": "#184e5b",
554 + "font_style": "italic",
555 + "font_weight": null
556 + },
557 + "comment": {
558 + "color": "#4f3c69",
559 + "font_style": "italic",
560 + "font_weight": 700
561 + },
562 + "comment.doc": {
563 + "color": "#4f3c69",
564 + "font_style": "italic",
565 + "font_weight": 700
566 + },
567 + "constant": {
568 + "color": "#184e5b",
569 + "font_style": "italic",
570 + "font_weight": null
571 + },
572 + "constant.builtin": {
573 + "color": "#184e5b",
574 + "font_style": "italic",
575 + "font_weight": null
576 + },
577 + "constructor": {
578 + "color": "#4f3c69",
579 + "font_style": null,
580 + "font_weight": 700
581 + },
582 + "embedded": {
583 + "color": "#121212",
584 + "font_style": null,
585 + "font_weight": null
586 + },
587 + "emphasis": {
588 + "color": "#ae2eae",
589 + "font_style": "italic",
590 + "font_weight": null
591 + },
592 + "emphasis.strong": {
593 + "color": "#ae2eae",
594 + "font_style": null,
595 + "font_weight": 700
596 + },
597 + "enum": {
598 + "color": "#121212",
599 + "font_style": null,
600 + "font_weight": null
601 + },
602 + "function": {
603 + "color": "#121212",
604 + "font_style": null,
605 + "font_weight": null
606 + },
607 + "hint": {
608 + "color": "#604980",
609 + "font_style": null,
610 + "font_weight": null
611 + },
612 + "keyword": {
613 + "color": "#3b3b3b",
614 + "font_style": null,
615 + "font_weight": null
616 + },
617 + "label": {
618 + "color": "#3b3b3b",
619 + "font_style": null,
620 + "font_weight": null
621 + },
622 + "link_text": {
623 + "color": "#121212",
624 + "font_style": null,
625 + "font_weight": null
626 + },
627 + "link_uri": {
628 + "color": "#184e5b",
629 + "font_style": "italic",
630 + "font_weight": null
631 + },
632 + "number": {
633 + "color": "#184e5b",
634 + "font_style": "italic",
635 + "font_weight": null
636 + },
637 + "operator": {
638 + "color": "#3b3b3b",
639 + "font_style": null,
640 + "font_weight": null
641 + },
642 + "preproc": {
643 + "color": "#4f3c69",
644 + "font_style": null,
645 + "font_weight": 700
646 + },
647 + "primary": {
648 + "color": "#121212",
649 + "font_style": null,
650 + "font_weight": null
651 + },
652 + "property": {
653 + "color": "#121212",
654 + "font_style": null,
655 + "font_weight": null
656 + },
657 + "punctuation": {
658 + "color": "#3b3b3b",
659 + "font_style": null,
660 + "font_weight": null
661 + },
662 + "punctuation.bracket": {
663 + "color": "#3b3b3b",
664 + "font_style": null,
665 + "font_weight": null
666 + },
667 + "punctuation.delimiter": {
668 + "color": "#3b3b3b",
669 + "font_style": null,
670 + "font_weight": null
671 + },
672 + "punctuation.list_marker": {
673 + "color": "#3b3b3b",
674 + "font_style": null,
675 + "font_weight": null
676 + },
677 + "punctuation.special": {
678 + "color": "#4f3c69",
679 + "font_style": null,
680 + "font_weight": 700
681 + },
682 + "string": {
683 + "color": "#184e5b",
684 + "font_style": "italic",
685 + "font_weight": null
686 + },
687 + "string.escape": {
688 + "color": "#4f3c69",
689 + "font_style": null,
690 + "font_weight": 700
691 + },
692 + "string.regex": {
693 + "color": "#242424",
694 + "background_color": "#a112a1",
695 + "font_style": null,
696 + "font_weight": 700
697 + },
698 + "string.special": {
699 + "color": "#4f3c69",
700 + "font_style": null,
701 + "font_weight": 700
702 + },
703 + "string.special.symbol": {
704 + "color": "#4f3c69",
705 + "font_style": null,
706 + "font_weight": 700
707 + },
708 + "tag": {
709 + "color": "#4f3c69",
710 + "font_style": null,
711 + "font_weight": 700
712 + },
713 + "tag.doctype": {
714 + "color": "#4f3c69",
715 + "font_style": null,
716 + "font_weight": 700
717 + },
718 + "text": {
719 + "color": "#121212",
720 + "font_style": null,
721 + "font_weight": null
722 + },
723 + "text.literal": {
724 + "color": "#4f3c69",
725 + "font_style": "italic",
726 + "font_weight": 700
727 + },
728 + "title": {
729 + "color": "#4f3c69",
730 + "font_style": null,
731 + "font_weight": 700
732 + },
733 + "type": {
734 + "color": "#121212",
735 + "font_style": null,
736 + "font_weight": null
737 + },
738 + "type.builtin": {
739 + "color": "#121212",
740 + "font_style": null,
741 + "font_weight": null
742 + },
743 + "variable": {
744 + "color": "#121212",
745 + "font_style": null,
746 + "font_weight": null
747 + },
748 + "variable.parameter": {
749 + "color": "#715696",
750 + "font_style": null,
751 + "font_weight": 700
752 + },
753 + "variable.special": {
754 + "color": "#4f3c69",
755 + "font_style": null,
756 + "font_weight": 700
757 + },
758 + "variant": {
759 + "color": "#121212",
760 + "font_style": null,
761 + "font_weight": null