Skip to content

Commit

Permalink
Remove all MemeKernels
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Feb 12, 2024
1 parent 73419b2 commit 4e918ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 99 deletions.
99 changes: 2 additions & 97 deletions vskernels/kernels/bicubic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from math import acos, asinh, cos, sqrt
from typing import TYPE_CHECKING, Any
from math import sqrt
from typing import Any

from vstools import CustomValueError, core, vs, inject_self

Expand All @@ -19,25 +19,10 @@
'RobidouxSoft',
'Robidoux',
'RobidouxSharp',
'BicubicDidee',
'SetsuCubic',
'ZewiaCubic',
'BicubicZopti',
'BicubicZoptiNeutral',
'BicubicAuto',
]


class MemeKernel:
if TYPE_CHECKING:
def __init__(self, *args: Any, **kwargs: Any) -> None:
print(DeprecationWarning(
f"{self.__class__.__name__} and other meme Bicubic presets are deprecated!\n"
"They will be removed in the next major update."
))
super().__init__(*args, **kwargs)


class Bicubic(ZimgComplexKernel):
"""
Built-in bicubic resizer.
Expand Down Expand Up @@ -151,86 +136,6 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(b=b, c=c, **kwargs)


class BicubicDidee(MemeKernel, Bicubic): # type: ignore
"""
Kernel inspired by a Didée post.
`See this doom9 post for further information
<https://web.archive.org/web/20220713044016/https://forum.doom9.org/showpost.php?p=1579385>`_.
Bicubic b=-0.5, c=0.25
This is useful for downscaling content, but might not help much with upscaling.
Follows `b + 2c = 0` for downscaling as opposed to `b + 2c = 1` for upscaling.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(b=-1 / 2, c=1 / 4, **kwargs)


class SetsuCubic(MemeKernel, Bicubic): # type: ignore
"""
Schizo (Setsugen's) values calculated from the legendary Pompo-san filterchain.
Useful for heavy post processed content or ringing in general.
Bicubic
strength=200: b=-0.22582213942537233, c=0.06676658576029935
strength=100: b=-0.26470935063297507, c=0.73588297801744030
strength=50: b=-0.24550548633321580, c=0.37020197611906490
strength=1: b=-0.32938660656063920, c=0.21245005943760129
"""

def __init__(self, strength: float = 100.0, **kwargs: Any) -> None:
super().__init__(
asinh(.5) * acos(.5) * -abs(cos(strength * 4)),
abs(asinh(.5) * acos(-.5) * cos((strength * 4) + strength / 2)),
**kwargs
)


class ZewiaCubic(MemeKernel, Bicubic): # type: ignore
"""
Schizo (Zewia's) values he made up for downscaling after prefiltering for anti-aliasing.
It is said these values came up in his mind the morning after a good night of sleep the day
he fell asleep with YouTube music on and the auto recommendations made him listen to Mori Calliope
(his favourite VTuber/Rapper) for 6 hours straight.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(b=-1 / 3, c=1 / 6, **kwargs)


class BicubicZopti(MemeKernel, Bicubic): # type: ignore
"""
Kernel optimized by Zopti.
`See this doom9 post for further information
<https://web.archive.org/web/20220713052137/https://forum.doom9.org/showthread.php?p=1865218>`_.
Bicubic b=-0.6, c=0.4
Optimized for 2160p to 720p (by Boulder). Beware, not neutral. Adds some local contrast.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(b=-0.6, c=0.4, **kwargs)


class BicubicZoptiNeutral(MemeKernel, Bicubic): # type: ignore
"""
Kernel inspired by Zopti.
Bicubic b=-0.6, c=0.3
A slightly more neutral alternative to BicubicZopti.
Follows `b + 2c = 0` for downscaling as opposed to `b + 2c = 1` for upscaling.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(b=-0.6, c=0.3, **kwargs)


class BicubicAuto(ZimgComplexKernel):
"""
Kernel that follows the rule of:
Expand Down
3 changes: 1 addition & 2 deletions vskernels/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Bicubic, BicubicAuto, Catrom, ComplexKernel, Descaler, FmtConv, Impulse, Kernel, KernelT, LinearDescaler, Placebo,
Point, Resampler, ResamplerT, Scaler, ZimgComplexKernel, ZimgDescaler
)
from .kernels.bicubic import MemeKernel
from .types import Center, LeftShift, Slope, TopShift

__all__ = [
Expand Down Expand Up @@ -120,7 +119,7 @@ def __init__(self) -> None:
super().__init__(abstract_kernels)

self.exclude_sub = [
NoShiftBase, NoScaleBase, BicubicAuto, MemeKernel
NoShiftBase, NoScaleBase, BicubicAuto
]

def __contains__(self, key: object) -> bool:
Expand Down

0 comments on commit 4e918ac

Please sign in to comment.