cutcutcodec.core.analysis.video.quality.vmaf_official.vmaf

cutcutcodec.core.analysis.video.quality.vmaf_official.vmaf(ref: Tensor, dis: Tensor, threads: int = 0) Tensor[source]

Call the Netflix vmaf metric on the frames.

Parameters

refarraylike

The reference video frames, transmitted to to_yuvfile, shape ([*batch], height, width, 3).

disarraylike

The distorted video frames, transmitted to to_yuvfile, shape ([*batch], height, width, 3).

threadsint, optional

Defines the number of threads. The value -1 means that the function uses as many calculation threads as there are cores. The default value (0) allows the same behavior as (-1) if the function is called in the main thread, otherwise (1) to avoid nested threads. Any other positive value corresponds to the number of threads used.

Returns

vmafarraylike

All the vmaf values for the pairwise frames.

Examples

>>> import numpy as np
>>> from cutcutcodec.core.analysis.video.quality import vmaf
>>> np.random.seed(0)
>>> ref = np.random.random((720, 1080, 3))  # It could also be a torch array list...
>>> ref[:, :, 1:] -= 0.5  # yuv format
>>> dis = ref.copy()
>>> dis[:, :, 0] = 0.8 * dis[:, :, 0] + 0.2 * np.random.random((720, 1080))
>>> vmaf(ref, dis).round(1)
np.float64(33.7)
>>>