Container for video images. More...
Data Structures | |
struct | gavl_video_frame_t |
Functions | |
GAVL_PUBLIC gavl_video_frame_t * | gavl_video_frame_create (const gavl_video_format_t *format) |
Create video frame. | |
GAVL_PUBLIC gavl_video_frame_t * | gavl_video_frame_create_nopad (const gavl_video_format_t *format) |
Create video frame without padding. | |
GAVL_PUBLIC void | gavl_video_frame_destroy (gavl_video_frame_t *frame) |
Destroy a video frame. | |
GAVL_PUBLIC void | gavl_video_frame_null (gavl_video_frame_t *frame) |
Zero all pointers in the video frame. | |
GAVL_PUBLIC void | gavl_video_frame_clear (gavl_video_frame_t *frame, const gavl_video_format_t *format) |
Fill the frame with black color. | |
GAVL_PUBLIC void | gavl_video_frame_fill (gavl_video_frame_t *frame, const gavl_video_format_t *format, const float *color) |
Fill the frame with a user spefified color. | |
GAVL_PUBLIC void | gavl_video_frame_absdiff (gavl_video_frame_t *dst, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format) |
Fill the frame with the absolute differene of 2 source frames. | |
GAVL_PUBLIC void | gavl_video_frame_psnr (double *psnr, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format) |
Calculate the PSNR of 2 source frames. | |
GAVL_PUBLIC int | gavl_video_frame_ssim (const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, gavl_video_frame_t *dst, const gavl_video_format_t *format) |
Calculate the SSIM of 2 source frames. | |
GAVL_PUBLIC void | gavl_video_frame_copy (const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src) |
Copy one video frame to another. | |
GAVL_PUBLIC void | gavl_video_frame_copy_plane (const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src, int plane) |
Copy a single plane from one video frame to another. | |
GAVL_PUBLIC void | gavl_video_frame_copy_flip_x (const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src) |
Copy one video frame to another with horizontal flipping. | |
GAVL_PUBLIC void | gavl_video_frame_copy_flip_y (const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src) |
Copy one video frame to another with vertical flipping. | |
GAVL_PUBLIC void | gavl_video_frame_copy_flip_xy (const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src) |
Copy one video frame to another with horizontal and vertical flipping. | |
GAVL_PUBLIC void | gavl_video_frame_copy_metadata (gavl_video_frame_t *dst, const gavl_video_frame_t *src) |
Copy metadata of one video frame to another. | |
GAVL_PUBLIC void | gavl_video_frame_get_subframe (gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, gavl_rectangle_i_t *src_rect) |
Get a subframe of another frame. | |
GAVL_PUBLIC void | gavl_video_frame_get_field (gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, int field) |
Get a field from a frame. | |
GAVL_PUBLIC void | gavl_video_frame_dump (gavl_video_frame_t *frame, const gavl_video_format_t *format, const char *namebase) |
Dump a video frame to files. | |
GAVL_PUBLIC void | gavl_video_frame_set_strides (gavl_video_frame_t *frame, const gavl_video_format_t *format) |
Set the strides according to the format. | |
GAVL_PUBLIC void | gavl_video_frame_set_planes (gavl_video_frame_t *frame, const gavl_video_format_t *format, uint8_t *buffer) |
Set the frames according to the format. | |
GAVL_PUBLIC int | gavl_video_frame_extract_channel (const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst) |
Extract one channel of a video frame into a grayscale image. | |
GAVL_PUBLIC int | gavl_video_frame_insert_channel (const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst) |
Insert one channel from a grayscale image into a video frame. | |
GAVL_PUBLIC int | gavl_video_frames_equal (const gavl_video_format_t *format, const gavl_video_frame_t *f1, const gavl_video_frame_t *f2) |
Check if 2 video frames are bit-identical. |
Container for video images.
This is the standardized method of storing one frame with video data. For planar formats, the first scanline starts at planes[0], subsequent scanlines start in intervalls of strides[0] bytes. For planar formats, planes[0] will contain the luminance channel, planes[1] contains Cb (aka U), planes[2] contains Cr (aka V).
Video frames are created with gavl_video_frame_create and destroyed with gavl_video_frame_destroy. The memory can either be allocated by gavl (with memory aligned scanlines) or by the caller.
Gavl video frames are always oriented top->bottom left->right. If you must flip frames, use the functions gavl_video_frame_copy_flip_x, gavl_video_frame_copy_flip_y or gavl_video_frame_copy_flip_xy .
GAVL_PUBLIC gavl_video_frame_t* gavl_video_frame_create | ( | const gavl_video_format_t * | format | ) |
Create video frame.
format | Format of the data to be stored in this frame or NULL |
GAVL_PUBLIC gavl_video_frame_t* gavl_video_frame_create_nopad | ( | const gavl_video_format_t * | format | ) |
Create video frame without padding.
format | Format of the data to be stored in this frame or NULL |
GAVL_PUBLIC void gavl_video_frame_destroy | ( | gavl_video_frame_t * | frame | ) |
Destroy a video frame.
frame | A video frame |
GAVL_PUBLIC void gavl_video_frame_null | ( | gavl_video_frame_t * | frame | ) |
Zero all pointers in the video frame.
frame | A video frame |
GAVL_PUBLIC void gavl_video_frame_clear | ( | gavl_video_frame_t * | frame, | |
const gavl_video_format_t * | format | |||
) |
Fill the frame with black color.
frame | A video frame
|
GAVL_PUBLIC void gavl_video_frame_fill | ( | gavl_video_frame_t * | frame, | |
const gavl_video_format_t * | format, | |||
const float * | color | |||
) |
Fill the frame with a user spefified color.
frame | A video frame
|
GAVL_PUBLIC void gavl_video_frame_absdiff | ( | gavl_video_frame_t * | dst, | |
const gavl_video_frame_t * | src1, | |||
const gavl_video_frame_t * | src2, | |||
const gavl_video_format_t * | format | |||
) |
Fill the frame with the absolute differene of 2 source frames.
format | Format of the data in the frame
|
GAVL_PUBLIC void gavl_video_frame_psnr | ( | double * | psnr, | |
const gavl_video_frame_t * | src1, | |||
const gavl_video_frame_t * | src2, | |||
const gavl_video_format_t * | format | |||
) |
Calculate the PSNR of 2 source frames.
psnr | Returns PSNR for all components (maximum 4)
|
GAVL_PUBLIC int gavl_video_frame_ssim | ( | const gavl_video_frame_t * | src1, | |
const gavl_video_frame_t * | src2, | |||
gavl_video_frame_t * | dst, | |||
const gavl_video_format_t * | format | |||
) |
Calculate the SSIM of 2 source frames.
src1 | First source frame
|
GAVL_PUBLIC void gavl_video_frame_copy | ( | const gavl_video_format_t * | format, | |
gavl_video_frame_t * | dst, | |||
const gavl_video_frame_t * | src | |||
) |
Copy one video frame to another.
format | The format of the frames
|
GAVL_PUBLIC void gavl_video_frame_copy_plane | ( | const gavl_video_format_t * | format, | |
gavl_video_frame_t * | dst, | |||
const gavl_video_frame_t * | src, | |||
int | plane | |||
) |
Copy a single plane from one video frame to another.
format | The format of the frames
|
GAVL_PUBLIC void gavl_video_frame_copy_flip_x | ( | const gavl_video_format_t * | format, | |
gavl_video_frame_t * | dst, | |||
const gavl_video_frame_t * | src | |||
) |
Copy one video frame to another with horizontal flipping.
format | The format of the frames
|
GAVL_PUBLIC void gavl_video_frame_copy_flip_y | ( | const gavl_video_format_t * | format, | |
gavl_video_frame_t * | dst, | |||
const gavl_video_frame_t * | src | |||
) |
Copy one video frame to another with vertical flipping.
format | The format of the frames
|
GAVL_PUBLIC void gavl_video_frame_copy_flip_xy | ( | const gavl_video_format_t * | format, | |
gavl_video_frame_t * | dst, | |||
const gavl_video_frame_t * | src | |||
) |
Copy one video frame to another with horizontal and vertical flipping.
format | The format of the frames
|
GAVL_PUBLIC void gavl_video_frame_copy_metadata | ( | gavl_video_frame_t * | dst, | |
const gavl_video_frame_t * | src | |||
) |
Copy metadata of one video frame to another.
dst | Destination
|
GAVL_PUBLIC void gavl_video_frame_get_subframe | ( | gavl_pixelformat_t | pixelformat, | |
const gavl_video_frame_t * | src, | |||
gavl_video_frame_t * | dst, | |||
gavl_rectangle_i_t * | src_rect | |||
) |
Get a subframe of another frame.
pixelformat | Pixelformat of the frames
|
GAVL_PUBLIC void gavl_video_frame_get_field | ( | gavl_pixelformat_t | pixelformat, | |
const gavl_video_frame_t * | src, | |||
gavl_video_frame_t * | dst, | |||
int | field | |||
) |
Get a field from a frame.
pixelformat | Pixelformat of the frames
|
GAVL_PUBLIC void gavl_video_frame_dump | ( | gavl_video_frame_t * | frame, | |
const gavl_video_format_t * | format, | |||
const char * | namebase | |||
) |
Dump a video frame to files.
frame | Video frame to dump
|
GAVL_PUBLIC void gavl_video_frame_set_strides | ( | gavl_video_frame_t * | frame, | |
const gavl_video_format_t * | format | |||
) |
Set the strides according to the format.
frame | Video frame
|
GAVL_PUBLIC void gavl_video_frame_set_planes | ( | gavl_video_frame_t * | frame, | |
const gavl_video_format_t * | format, | |||
uint8_t * | buffer | |||
) |
Set the frames according to the format.
frame | Video frame
|
GAVL_PUBLIC int gavl_video_frame_extract_channel | ( | const gavl_video_format_t * | format, | |
gavl_color_channel_t | ch, | |||
const gavl_video_frame_t * | src, | |||
gavl_video_frame_t * | dst | |||
) |
Extract one channel of a video frame into a grayscale image.
format | Format of the source frame
|
GAVL_PUBLIC int gavl_video_frame_insert_channel | ( | const gavl_video_format_t * | format, | |
gavl_color_channel_t | ch, | |||
const gavl_video_frame_t * | src, | |||
gavl_video_frame_t * | dst | |||
) |
Insert one channel from a grayscale image into a video frame.
format | Format of the source frame
|
GAVL_PUBLIC int gavl_video_frames_equal | ( | const gavl_video_format_t * | format, | |
const gavl_video_frame_t * | f1, | |||
const gavl_video_frame_t * | f2 | |||
) |
Check if 2 video frames are bit-identical.
format | Format
|