cutcutcodec.core.analysis.video.complexity.rms_time_diff
- cutcutcodec.core.analysis.video.complexity.rms_time_diff(imgs: Tensor) Tensor[source]
Compute the temporal root mean square time difference complexity for 2 images.
Note
It comes from
ENCODING TIME AND ENERGY MODEL FOR SVT-AV1 BASED ON VIDEO COMPLEXITY.This function implements the following formula:
\[C_{td} = \sqrt{ \frac{1}{hw} \sum_{\boldsymbol{i} \in [\![1, h]\!] \times [\![1, w]\!]}\left( \boldsymbol{Y_t}(\boldsymbol{i}) - \boldsymbol{Y_{t+1}}(\boldsymbol{i}) \right)^2 }\]- With:
\(\boldsymbol{Y}\) the Y layer of the image as a 2d matrix.
\(t+1\) the frame just after \(t\).
Parameters
- imgsarraylike
The Y[UV] images, of shape ([*batch], 2, height, width, [channels]). Only the Y component is used. It has to be in range [0, 1].
Returns
- rms_sobelarraylike
The \(C_{td} \in \mathbb{R}^+\) scalar for each couple of image (of shape batch).
Examples
>>> import numpy as np >>> from cutcutcodec.core.analysis.video.complexity import rms_time_diff >>> np.random.seed(0) >>> imgs = np.random.random((2, 720, 1080, 3)) # It could also be a torch array list... >>> rms_time_diff(imgs).round(1) np.float64(0.4) >>>