Skip to content

Commit

Permalink
Fix formatting and fix_line_brightness code
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed May 16, 2024
1 parent 50baaa6 commit 9da343b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vsadjust/levels.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Sequence

from vsmasktools import rekt_partial
from vstools import (
ColorRange, ColorRangeT, DitherType, FunctionUtil, PlanesT, depth, get_lowest_values, get_peak_values,
normalize_seq, scale_value, vs
ColorRange, ColorRangeT, DitherType, FunctionUtil, PlanesT, depth, get_lowest_value, get_lowest_values,
get_peak_value, get_peak_values, normalize_seq, scale_value, vs
)

__all__ = [
Expand Down Expand Up @@ -94,8 +95,8 @@ def fix_double_range(clip: vs.VideoNode) -> vs.VideoNode:

def fix_line_brightness(
clip: vs.VideoNode,
rows: Dict[int, float] = {},
columns: Dict[int, float] = {},
rows: dict[int, float] = {},
columns: dict[int, float] = {},
) -> vs.VideoNode:
"""
Fix darkened or brightened luma rows or columns using manual level adjustments.
Expand All @@ -122,9 +123,9 @@ def _fix_line(clip: vs.VideoNode, is_row: bool, num: int, adjustment: float) ->
raise ValueError("fix_line_brightness: adjustment values must be in (-100, 100)")

if adjustment > 0:
adj = lambda c: fix_levels(c, max_in=peak - low_to_peak * adjustment / 100, max_out=peak)
adj = lambda c: fix_levels(c, max_in=peak - low_to_peak * adjustment / 100, max_out=peak) # noqa: E731
elif adjustment < 0:
adj = lambda c: fix_levels(c, min_in=low + low_to_peak * adjustment / 100, min_out=low)
adj = lambda c: fix_levels(c, min_in=low + low_to_peak * adjustment / 100, min_out=low) # noqa: E731
else:
return clip
if is_row:
Expand Down

0 comments on commit 9da343b

Please sign in to comment.