deinterlacing.tools module

deinterlacing.tools.ImageBlockGenerator

Type alias for a generator of image blocks

alias of Generator[tuple[int, int], None, None]

deinterlacing.tools.NDArrayLike

Type alias for numpy array-like data structures.

deinterlacing.tools.extract_image_block(images, start, stop, pool)[source]
Parameters:
Return type:

ndarray

deinterlacing.tools.index_image_blocks(images, block_size, unstable=None)[source]

Index the image blocks for batch processing during deinterlacing. This function returns a generator yielding tuples of start and end indices for each block of images to be processed. It takes into account the unstable parameter, which specifies how many frames should be processed individually before switching to batch-wise processing.

Parameters:
Return type:

Generator[tuple[int, int], None, None]

Returns:

A generator yielding tuples of (start_index, end_index) for each block.

deinterlacing.tools.wrap_cupy(function, *parameter)[source]

Convenience decorator that wraps a CuPy function such that incoming numpy arrays are converted to cupy arrays and swapped back on return.

Parameters:
  • function (Callable[[ndarray], ndarray]) – any CuPy function that accepts a CuPy array

  • parameter (str) – name/s of the parameter to be converted

Return type:

Callable[[ndarray], ndarray]

Returns:

wrapped function