cutcutcodec.core.io.framecaster
This module, implemented in C, offers functions to normalize frames.
Functions
Convert a frame from the RGB space to float32 frame in the RGB space. |
|
Convert a frame from the YUV space to float32 frame in the Y'PbPr space. |
|
Convert a frame from the RGB float32 space to uint8 frame in rgb24. |
|
Convert a frame from the Y'PbPr float32 space to uint16 frame in the YUV tv space. |
Details
- cutcutcodec.core.io.framecaster.from_rgb()
Convert a frame from the RGB space to float32 frame in the RGB space.
add 1 leading channel to grayscale frame (h x w -> h x w x 1)
cast into float32
convert limited range to full range (based on UIT-R)
Parameters
- framenp.ndarray
The float32, uint8 or uint16 video frame of shape (height, width, [channels]).
- is_tvbool
If True, consider the input as a limited range coding.
- threadsint, default=0
Number of threads used.
Returns
- normalizednp.ndarray[np.float32, np.float32, np.float32]
The normalized frame with [r, g, b] in [0, 1]**3.
Notes
It is optimized for C contiguous array.
This function makes a safe copy of the input frame, no modification inplace.
- cutcutcodec.core.io.framecaster.from_yuv()
Convert a frame from the YUV space to float32 frame in the Y’PbPr space.
add 1 leading channel to grayscale frame (h x w -> h x w x 1)
cast into float32
convert limited range to full range (based on UIT-R)
Parameters
- framenp.ndarray
The float32, uint8 or uint16 video frame of shape (height, width, [channels]), with optional channel dimension in {1, 3, 4}.
- is_tvbool
If True, consider the input as a limited range coding.
- threadsint, default=0
Number of threads used.
Returns
- normalizednp.ndarray[np.float32, np.float32, np.float32]
The normalized frame with [y, u, v] in [0, 1] x [-1/2, 1/2]**2.
Notes
It is optimized for C contiguous array.
This function makes a safe copy of the input frame, no modification inplace.
- cutcutcodec.core.io.framecaster.to_rgb()
Convert a frame from the RGB float32 space to uint8 frame in rgb24.
Parameters
- framenp.ndarray[np.float32, np.float32, np.float32]
The float32 video frame of shape (height, width, channels).
- to_tvbool, default=False
If True, convert the frame in limited range, default is full range.
- threadsint, default=0
Number of threads used.
Returns
- outnp.ndarray[np.uint8]
The YUV frame in limited range.
Notes
It is optimized for C contiguous array.
This function makes a safe copy of the input frame, no modification inplace.
- cutcutcodec.core.io.framecaster.to_yuv()
Convert a frame from the Y’PbPr float32 space to uint16 frame in the YUV tv space.
Parameters
- framenp.ndarray[np.float32, np.float32, np.float32]
The float32 video frame of shape (height, width, channels).
- to_tvbool, default=True
If False, convert the frame in full range, default is limited range.
- threadsint, default=0
Number of threads used.
Returns
- outnp.ndarray[np.uint16]
The YUV frame in limited range.
Notes
It is optimized for C contiguous array.
This function makes a safe copy of the input frame, no modification inplace.