Skip to content

Commit

Permalink
bore: Add docstrings, accept GRAY input
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Sep 12, 2024
1 parent cefd66a commit 9974ba0
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions vsadjust/borders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from itertools import chain
from typing import Sequence

from vstools import CustomEnum, CustomValueError, FunctionUtil, KwargsT, NotFoundEnumValue, PlanesT, core, vs

__all__ = [
Expand All @@ -12,15 +11,33 @@

class bore(CustomEnum):
FIX_BRIGHTNESS: bore = object() # type:ignore
"""Multiply every pixel by an average ratio of each pixel in a line to its nearest pixel in the next line."""

BALANCE: bore = object() # type:ignore
"""Uses linear least squares to calculate the best multiplier for each line."""

def __call__(
self, clip: vs.VideoNode,
left: int | Sequence[int] = 0, right: int | Sequence[int] = 0,
top: int | Sequence[int] = 0, bottom: int | Sequence[int] = 0,
left: int | Sequence[int] = 0,
right: int | Sequence[int] = 0,
top: int | Sequence[int] = 0,
bottom: int | Sequence[int] = 0,
planes: PlanesT = None, **kwargs: KwargsT
) -> vs.VideoNode:
func = FunctionUtil(clip, self.__class__, planes, vs.YUV, 32)
"""
BB-mod style border deringer.
:param clip: Clip to process.
:param left: Number of pixels to adjust on the left border.
:param right: Number of pixels to adjust on the right border.
:param top: Number of pixels to adjust on the top border.
:param bottom: Number of pixels to adjust on the bottom border.
:param planes: Planes to process. Default: All planes.
:return: Clip with borders adjusted.
"""

func = FunctionUtil(clip, self.__class__, planes, (vs.YUV, vs.GRAY), 32)

values = list(zip(*map(func.norm_seq, (left, right, top, bottom))))

Expand Down

0 comments on commit 9974ba0

Please sign in to comment.