UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_codec.h
Go to the documentation of this file.
1
11/* Copyright (c) 2005-2023 CESNET z.s.p.o.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, is permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * 3. All advertising materials mentioning features or use of this software
25 * must display the following acknowledgement:
26 *
27 * This product includes software developed by CESNET z.s.p.o.
28 *
29 * 4. Neither the name of the CESNET nor the names of its contributors may be
30 * used to endorse or promote products derived from this software without
31 * specific prior written permission.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
34 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
35 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
36 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
37 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
38 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
43 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
44 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 *
46 */
47#ifndef __video_codec_h
48#define __video_codec_h
49
50#include "types.h" // codec_t
51
52#ifndef __cplusplus
53#include <stdbool.h>
54#endif // !defined __cplusplus
55
56#include "pixfmt_conv.h"
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62#define MAX_BPS 8 /* for Y416 */
63#define MAX_PADDING 64
65#define MAX_PFB_SIZE 8
66#define PIX_BLOCK_LCM 24
67
69void show_codec_help(const char *module, const codec_t *codecs8, const codec_t *codecs10, const codec_t *codecs_ge12);
80codec_t get_codec_from_fcc(uint32_t fourcc) __attribute__((const));
84
86int compare_pixdesc(const struct pixfmt_desc *desc_a, const struct pixfmt_desc *desc_b, const struct pixfmt_desc *src_desc);
87const char *get_pixdesc_desc(struct pixfmt_desc);
88void watch_pixfmt_degrade(const char *mod_name, struct pixfmt_desc desc_src, struct pixfmt_desc desc_dst);
89bool pixdesc_equals(struct pixfmt_desc desc_a, struct pixfmt_desc desc_b);
90
93int vc_get_linesize(unsigned int width, codec_t codec) __attribute__((const));
94int vc_get_size(unsigned int width, codec_t codec) __attribute__((const));
95size_t vc_get_datalen(unsigned int width, unsigned int height, codec_t codec) __attribute__((const));
96void codec_get_planes_subsampling(codec_t pix_fmt, int *sub);
97bool codec_is_420(codec_t pix_fmt);
99bool codec_is_in_set(codec_t codec, const codec_t *set) __attribute__((pure));
103
104void vc_deinterlace(unsigned char *src, long src_linesize, int lines);
105bool vc_deinterlace_ex(codec_t codec, unsigned char *src, size_t src_linesize, unsigned char *dst, size_t dst_pitch, size_t lines);
106
107bool clear_video_buffer(unsigned char *data, size_t linesize, size_t pitch, size_t height, codec_t color_spec);
108
109// conversions from/to planar formats
110void uyvy_to_i422(int width, int height, const unsigned char *in,
111 unsigned char *out);
112void y416_to_i444(int width, int height, const unsigned char *in,
113 unsigned char *out, int depth);
114void i444_16_to_y416(int width, int height, const unsigned char *in,
115 unsigned char *out, int in_depth);
116void i422_16_to_y416(int width, int height, const unsigned char *in,
117 unsigned char *out, int in_depth);
118void i420_16_to_y416(int width, int height, const unsigned char *in,
119 unsigned char *out, int in_depth);
120void i420_8_to_uyvy(int width, int height, const unsigned char *in,
121 unsigned char *out);
122void i422_8_to_uyvy(int width, int height, const unsigned char *in,
123 unsigned char *out);
124void i444_8_to_uyvy(int width, int height, const unsigned char *in,
125 unsigned char *out);
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif
132
struct __attribute__((packed))
Definition rtp.h:88
const char * name
Definition settings.cpp:193
This file contains some common data types.
depth
Definition types.h:125
codec_t
Definition types.h:65
void vc_deinterlace(unsigned char *src, long src_linesize, int lines)
Deinterlaces framebuffer.
const char * get_codec_name_long(codec_t codec) __attribute__((const))
void i420_8_to_uyvy(int width, int height, const unsigned char *in, unsigned char *out)
codec_t get_codec_from_fcc(uint32_t fourcc) __attribute__((const))
bool codec_is_const_size(codec_t codec) __attribute__((const))
void codec_get_planes_subsampling(codec_t pix_fmt, int *sub)
void y416_to_i444(int width, int height, const unsigned char *in, unsigned char *out, int depth)
int vc_get_size(unsigned int width, codec_t codec) __attribute__((const))
struct pixfmt_desc get_pixfmt_desc(codec_t pixfmt)
bool is_codec_opaque(codec_t codec) __attribute__((const))
uint32_t get_fourcc(codec_t codec) __attribute__((const))
int get_pf_block_pixels(codec_t codec) __attribute__((const))
bool vc_deinterlace_ex(codec_t codec, unsigned char *src, size_t src_linesize, unsigned char *dst, size_t dst_pitch, size_t lines)
void uyvy_to_i422(int width, int height, const unsigned char *in, unsigned char *out)
void i444_8_to_uyvy(int width, int height, const unsigned char *in, unsigned char *out)
void i422_16_to_y416(int width, int height, const unsigned char *in, unsigned char *out, int in_depth)
double get_bpp(codec_t codec) __attribute__((const))
const char * get_pixdesc_desc(struct pixfmt_desc)
const char * get_codec_name(codec_t codec) __attribute__((const))
codec_t get_codec_from_file_extension(const char *ext) __attribute__((const))
bool pixdesc_equals(struct pixfmt_desc desc_a, struct pixfmt_desc desc_b)
void watch_pixfmt_degrade(const char *mod_name, struct pixfmt_desc desc_src, struct pixfmt_desc desc_dst)
const char * get_codec_file_extension(codec_t codec) __attribute__((const))
size_t vc_get_datalen(unsigned int width, unsigned int height, codec_t codec) __attribute__((const))
void i420_16_to_y416(int width, int height, const unsigned char *in, unsigned char *out, int in_depth)
bool codec_is_hw_accelerated(codec_t codec) __attribute__((const))
void show_codec_help(const char *module, const codec_t *codecs8, const codec_t *codecs10, const codec_t *codecs_ge12)
Prints list of suppored codecs for video module.
bool codec_is_planar(codec_t codec) __attribute__((const))
int get_pf_block_bytes(codec_t codec) __attribute__((const))
codec_t get_codec_from_name(const char *name) __attribute__((const))
void i422_8_to_uyvy(int width, int height, const unsigned char *in, unsigned char *out)
bool clear_video_buffer(unsigned char *data, size_t linesize, size_t pitch, size_t height, codec_t color_spec)
int compare_pixdesc(const struct pixfmt_desc *desc_a, const struct pixfmt_desc *desc_b, const struct pixfmt_desc *src_desc)
bool is_codec_interframe(codec_t codec) __attribute__((const))
int get_subsampling(codec_t codec) __attribute__((const))
int vc_get_linesize(unsigned int width, codec_t codec) __attribute__((const))
bool codec_is_in_set(codec_t codec, const codec_t *set) __attribute__((pure))
int get_bits_per_component(codec_t codec) __attribute__((const))
bool codec_is_a_rgb(codec_t codec) __attribute__((const))
void i444_16_to_y416(int width, int height, const unsigned char *in, unsigned char *out, int in_depth)
bool codec_is_420(codec_t pix_fmt)