60 uint32_t *data = s->
data;
62 for (
int cur_x = r->
x; cur_x < r->x + r->
w; ++cur_x) {
63 for (
int cur_y = r->
y; cur_y < r->y + r->
h; ++cur_y) {
65 *(data + (long) s->
w * cur_y + cur_x) = color;
77static void toI420(
unsigned char *out,
const unsigned char *input,
int width,
int height)
79 const unsigned char *in = (
const unsigned char *) input;
80 int w_ch = (width + 1) / 2;
81 int h_ch = (height + 1) / 2;
82 unsigned char *y = out;
83 unsigned char *u0 = out + width * height;
84 unsigned char *v0 = out + width * height + w_ch * h_ch;
85 unsigned char *u1 = u0, *v1 = v0;
87 for (
int i = 0; i < height; i += 1) {
88 for (
int j = 0; j < ((width + 1) & ~1); j += 2) {
93 *u1 = (*u1 + *in++) / 2;
102 *v1 = (*v1 + *in++) / 2;
106 if (j + 1 == width) {
117 unsigned char *tmp_buffer = NULL;
120 tmp_buffer = malloc(2L * ((width + 1U) ^ 1U) * height);
123 for (
int i = 0; i < height; ++i) {
130 toI420(out, in, width, height);
135 assert(decoder != NULL);
138 for (
int i = 0; i < height; ++i) {
151 bool print_i420 = !src_8b_only;
152 printf(
"Supported codecs (%s):\n",
name);
160 if (c ==
I420 && !print_i420) {
int vc_get_linesize(unsigned int width, codec_t codec)
const char * get_codec_name(codec_t codec)
int color_printf(const char *format,...)
decoder_t get_decoder_from_to(codec_t in, codec_t out)
decoder_func_t * decoder_t
const uint32_t rect_colors[]
static bool testcard_conv_handled_internally(codec_t c)
void testcard_show_codec_help(const char *name, bool src_8b_only)
void testcard_fillRect(struct testcard_pixmap *s, struct testcard_rect *r, uint32_t color)
static void toI420(unsigned char *out, const unsigned char *input, int width, int height)
bool testcard_has_conversion(codec_t c)
void testcard_convert_buffer(codec_t in_c, codec_t out_c, unsigned char *out, unsigned const char *in, int width, int height)
@ YUYV
YCbCr 422 8-bit - Y0 Cb Y1 Cr.
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ VIDEO_CODEC_NONE
dummy color spec
@ RG48
16-bit RGB little-endian (RlRhGl...)
@ VIDEO_CODEC_COUNT
count of known video codecs (including VIDEO_CODEC_NONE)
@ RGBA
RGBA 8-bit, big-endian.
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
This is an umbrella header for video functions.
bool is_codec_opaque(codec_t codec)
int vc_get_size(unsigned int width, codec_t codec)
const char * get_codec_name_long(codec_t codec)
int get_bits_per_component(codec_t codec)