Skip to content

utils

Functions:

normalize_thscd

normalize_thscd(
    thscd: int | tuple[int | None, float | None] | None,
) -> tuple[int | None, float | None]
Source code in vsdenoise/mvtools/utils.py
29
30
def normalize_thscd(thscd: int | tuple[int | None, float | None] | None) -> tuple[int | None, float | None]:
    return (None, None) if thscd is None else thscd if isinstance(thscd, tuple) else (thscd, None)

refine_blksize

refine_blksize(
    blksize: int | tuple[int, ...], divisor: int | tuple[int, ...] = (2, 2)
) -> tuple[int, int]

Normalize and refine blksize.

Parameters:

  • blksize

    (int | tuple[int, ...]) –

    Block size to refine.

  • divisor

    (int | tuple[int, ...], default: (2, 2) ) –

    Block size divisor.

Returns:

  • tuple[int, int]

    Normalized and refined blksize tuple.

Source code in vsdenoise/mvtools/utils.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def refine_blksize(blksize: int | tuple[int, ...], divisor: int | tuple[int, ...] = (2, 2)) -> tuple[int, int]:
    """
    Normalize and refine blksize.

    Args:
        blksize: Block size to refine.
        divisor: Block size divisor.

    Returns:
        Normalized and refined blksize tuple.
    """

    nblksize = normalize_seq(blksize, 2)
    ndivisor = normalize_seq(divisor, 2)

    return (
        nblksize[0] // ndivisor[0] if ndivisor[0] else 0,
        nblksize[1] // ndivisor[1] if ndivisor[1] else 0,
    )