testyuv.c
Go to the documentation of this file.
/*
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#include "SDL_test_font.h"
#include "testyuv_cvt.h"
/* 422 (YUY2, etc) formats are the largest */
#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2)
/* Return true if the YUV format is packed pixels */
static SDL_bool is_packed_yuv_format(Uint32 format)
{
return (format == SDL_PIXELFORMAT_YUY2 ||
format == SDL_PIXELFORMAT_UYVY ||
format == SDL_PIXELFORMAT_YVYU);
}
/* Create a surface with a good pattern for verifying YUV conversion */
static SDL_Surface *generate_test_pattern(int pattern_size)
{
SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24);
if (pattern) {
int i, x, y;
Uint8 *p, c;
const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */
/* R, G, B in alternating horizontal bands */
for (y = 0; y < pattern->h; y += thickness) {
for (i = 0; i < thickness; ++i) {
p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3);
for (x = 0; x < pattern->w; ++x) {
*p = 0xFF;
p += 3;
}
}
}
/* Black and white in alternating vertical bands */
c = 0xFF;
for (x = 1*thickness; x < pattern->w; x += 2*thickness) {
for (i = 0; i < thickness; ++i) {
p = (Uint8 *)pattern->pixels + (x + i)*3;
for (y = 0; y < pattern->h; ++y) {
SDL_memset(p, c, 3);
p += pattern->pitch;
}
}
if (c) {
c = 0x00;
} else {
c = 0xFF;
}
}
}
return pattern;
}
static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface)
{
const int tolerance = 20;
const int size = (surface->h * surface->pitch);
Uint8 *rgb;
SDL_bool result = SDL_FALSE;
rgb = (Uint8 *)SDL_malloc(size);
if (!rgb) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory");
return SDL_FALSE;
}
if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) {
int x, y;
result = SDL_TRUE;
for (y = 0; y < surface->h; ++y) {
const Uint8 *actual = rgb + y * surface->pitch;
const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch;
for (x = 0; x < surface->w; ++x) {
int deltaR = (int)actual[0] - expected[0];
int deltaG = (int)actual[1] - expected[1];
int deltaB = (int)actual[2] - expected[2];
int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB);
if (distance > tolerance) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance);
result = SDL_FALSE;
}
actual += 3;
expected += 3;
}
}
} else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError());
}
SDL_free(rgb);
return result;
}
static int run_automated_tests(int pattern_size, int extra_pitch)
{
const Uint32 formats[] = {
SDL_PIXELFORMAT_YV12,
SDL_PIXELFORMAT_IYUV,
SDL_PIXELFORMAT_NV12,
SDL_PIXELFORMAT_NV21,
SDL_PIXELFORMAT_YUY2,
SDL_PIXELFORMAT_UYVY,
SDL_PIXELFORMAT_YVYU
};
int i, j;
SDL_Surface *pattern = generate_test_pattern(pattern_size);
const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch);
Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len);
Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len);
int yuv1_pitch, yuv2_pitch;
int result = -1;
if (!pattern || !yuv1 || !yuv2) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces");
goto done;
}
/* Verify conversion from YUV formats */
for (i = 0; i < SDL_arraysize(formats); ++i) {
if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i]));
goto done;
}
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w);
if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i]));
goto done;
}
}
/* Verify conversion to YUV formats */
for (i = 0; i < SDL_arraysize(formats); ++i) {
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
goto done;
}
if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i]));
goto done;
}
}
/* Verify conversion between YUV formats */
for (i = 0; i < SDL_arraysize(formats); ++i) {
for (j = 0; j < SDL_arraysize(formats); ++j) {
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch;
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
goto done;
}
if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError());
goto done;
}
if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]));
goto done;
}
}
}
/* Verify conversion between YUV formats in-place */
for (i = 0; i < SDL_arraysize(formats); ++i) {
for (j = 0; j < SDL_arraysize(formats); ++j) {
if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) {
/* Can't change plane vs packed pixel layout in-place */
continue;
}
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch;
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
goto done;
}
if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError());
goto done;
}
if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]));
goto done;
}
}
}
result = 0;
done:
SDL_free(yuv1);
SDL_free(yuv2);
SDL_FreeSurface(pattern);
return result;
}
int
main(int argc, char **argv)
{
struct {
SDL_bool enable_intrinsics;
int pattern_size;
int extra_pitch;
} automated_test_params[] = {
/* Test: even width and height */
{ SDL_FALSE, 2, 0 },
{ SDL_FALSE, 4, 0 },
/* Test: odd width and height */
{ SDL_FALSE, 1, 0 },
{ SDL_FALSE, 3, 0 },
/* Test: even width and height, extra pitch */
{ SDL_FALSE, 2, 3 },
{ SDL_FALSE, 4, 3 },
/* Test: odd width and height, extra pitch */
{ SDL_FALSE, 1, 3 },
{ SDL_FALSE, 3, 3 },
/* Test: even width and height with intrinsics */
{ SDL_TRUE, 32, 0 },
/* Test: odd width and height with intrinsics */
{ SDL_TRUE, 33, 0 },
{ SDL_TRUE, 37, 0 },
/* Test: even width and height with intrinsics, extra pitch */
{ SDL_TRUE, 32, 3 },
/* Test: odd width and height with intrinsics, extra pitch */
{ SDL_TRUE, 33, 3 },
{ SDL_TRUE, 37, 3 },
};
int arg = 1;
const char *filename;
SDL_Surface *original;
SDL_Surface *converted;
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *output[3];
const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" };
char title[128];
const char *yuv_name;
const char *yuv_mode;
Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888;
Uint32 yuv_format = SDL_PIXELFORMAT_YV12;
int current = 0;
int pitch;
Uint8 *raw_yuv;
Uint32 then, now, i, iterations = 100;
SDL_bool should_run_automated_tests = SDL_FALSE;
while (argv[arg] && *argv[arg] == '-') {
if (SDL_strcmp(argv[arg], "--jpeg") == 0) {
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG);
} else if (SDL_strcmp(argv[arg], "--bt601") == 0) {
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601);
} else if (SDL_strcmp(argv[arg], "--bt709") == 0) {
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709);
} else if (SDL_strcmp(argv[arg], "--auto") == 0) {
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC);
} else if (SDL_strcmp(argv[arg], "--yv12") == 0) {
yuv_format = SDL_PIXELFORMAT_YV12;
} else if (SDL_strcmp(argv[arg], "--iyuv") == 0) {
yuv_format = SDL_PIXELFORMAT_IYUV;
} else if (SDL_strcmp(argv[arg], "--yuy2") == 0) {
yuv_format = SDL_PIXELFORMAT_YUY2;
} else if (SDL_strcmp(argv[arg], "--uyvy") == 0) {
yuv_format = SDL_PIXELFORMAT_UYVY;
} else if (SDL_strcmp(argv[arg], "--yvyu") == 0) {
yuv_format = SDL_PIXELFORMAT_YVYU;
} else if (SDL_strcmp(argv[arg], "--nv12") == 0) {
yuv_format = SDL_PIXELFORMAT_NV12;
} else if (SDL_strcmp(argv[arg], "--nv21") == 0) {
yuv_format = SDL_PIXELFORMAT_NV21;
} else if (SDL_strcmp(argv[arg], "--rgb555") == 0) {
rgb_format = SDL_PIXELFORMAT_RGB555;
} else if (SDL_strcmp(argv[arg], "--rgb565") == 0) {
rgb_format = SDL_PIXELFORMAT_RGB565;
} else if (SDL_strcmp(argv[arg], "--rgb24") == 0) {
rgb_format = SDL_PIXELFORMAT_RGB24;
} else if (SDL_strcmp(argv[arg], "--argb") == 0) {
rgb_format = SDL_PIXELFORMAT_ARGB8888;
} else if (SDL_strcmp(argv[arg], "--abgr") == 0) {
rgb_format = SDL_PIXELFORMAT_ABGR8888;
} else if (SDL_strcmp(argv[arg], "--rgba") == 0) {
rgb_format = SDL_PIXELFORMAT_RGBA8888;
} else if (SDL_strcmp(argv[arg], "--bgra") == 0) {
rgb_format = SDL_PIXELFORMAT_BGRA8888;
} else if (SDL_strcmp(argv[arg], "--automated") == 0) {
should_run_automated_tests = SDL_TRUE;
} else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]);
return 1;
}
++arg;
}
/* Run automated tests */
if (should_run_automated_tests) {
for (i = 0; i < SDL_arraysize(automated_test_params); ++i) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n",
automated_test_params[i].pattern_size,
automated_test_params[i].extra_pitch,
automated_test_params[i].enable_intrinsics ? "enabled" : "disabled");
if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) {
return 2;
}
}
return 0;
}
if (argv[arg]) {
filename = argv[arg];
} else {
filename = "testyuv.bmp";
}
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0);
if (!original) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
return 3;
}
raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0));
ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h,
SDL_GetYUVConversionModeForResolution(original->w, original->h),
0, 100);
pitch = CalculateYUVPitch(yuv_format, original->w);
converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format);
if (!converted) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
return 3;
}
then = SDL_GetTicks();
for ( i = 0; i < iterations; ++i ) {
SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch);
}
now = SDL_GetTicks();
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations);
window = SDL_CreateWindow("YUV test",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
original->w, original->h,
0);
if (!window) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
return 4;
}
renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
return 4;
}
output[0] = SDL_CreateTextureFromSurface(renderer, original);
output[1] = SDL_CreateTextureFromSurface(renderer, converted);
output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h);
if (!output[0] || !output[1] || !output[2]) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
return 5;
}
SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch);
yuv_name = SDL_GetPixelFormatName(yuv_format);
if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) {
yuv_name += 16;
}
switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) {
case SDL_YUV_CONVERSION_JPEG:
yuv_mode = "JPEG";
break;
case SDL_YUV_CONVERSION_BT601:
yuv_mode = "BT.601";
break;
case SDL_YUV_CONVERSION_BT709:
yuv_mode = "BT.709";
break;
default:
yuv_mode = "UNKNOWN";
break;
}
{ int done = 0;
while ( !done )
{
SDL_Event event;
while (SDL_PollEvent(&event) > 0) {
if (event.type == SDL_QUIT) {
done = 1;
}
if (event.type == SDL_KEYDOWN) {
if (event.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
} else if (event.key.keysym.sym == SDLK_LEFT) {
--current;
} else if (event.key.keysym.sym == SDLK_RIGHT) {
++current;
}
}
if (event.type == SDL_MOUSEBUTTONDOWN) {
if (event.button.x < (original->w/2)) {
--current;
} else {
++current;
}
}
}
/* Handle wrapping */
if (current < 0) {
current += SDL_arraysize(output);
}
if (current >= SDL_arraysize(output)) {
current -= SDL_arraysize(output);
}
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, output[current], NULL, NULL);
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
if (current == 0) {
SDLTest_DrawString(renderer, 4, 4, titles[current]);
} else {
SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode);
SDLTest_DrawString(renderer, 4, 4, title);
}
SDL_RenderPresent(renderer);
SDL_Delay(10);
}
}
SDL_Quit();
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
SDL_CreateTexture
#define SDL_CreateTexture
Definition: SDL_dynapi_overrides.h:306
is_packed_yuv_format
static SDL_bool is_packed_yuv_format(Uint32 format)
Definition: testyuv.c:26
SDL_YUV_CONVERSION_JPEG
Definition: SDL_surface.h:105
SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:248
SDL_ConvertSurfaceFormat
#define SDL_ConvertSurfaceFormat
Definition: SDL_dynapi_overrides.h:464
SDL_PollEvent
#define SDL_PollEvent
Definition: SDL_dynapi_overrides.h:122
SDL_KEYDOWN
Definition: SDL_events.h:93
SDL_GetError
#define SDL_GetError
Definition: SDL_dynapi_overrides.h:113
SDL_TRUE
Definition: SDL_stdinc.h:142
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_Surface::h
int h
Definition: SDL_surface.h:73
SDL_LoadBMP
#define SDL_LoadBMP(file)
Definition: SDL_surface.h:200
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_PIXELFORMAT_RGBX8888
Definition: SDL_pixels.h:239
SDL_FALSE
Definition: SDL_stdinc.h:141
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
surface
EGLSurface surface
Definition: eglext.h:248
SDL_MOUSEBUTTONDOWN
Definition: SDL_events.h:103
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_QUIT
Definition: SDL_events.h:60
run_automated_tests
static int run_automated_tests(int pattern_size, int extra_pitch)
Definition: testyuv.c:114
SDL_Renderer
Definition: SDL_sysrender.h:76
SDL_test_font.h
SDLK_RIGHT
Definition: SDL_keycode.h:151
SDL_PIXELFORMAT_NV21
Definition: SDL_pixels.h:289
SDL_CreateWindow
#define SDL_CreateWindow
Definition: SDL_dynapi_overrides.h:514
SDL_WINDOWPOS_UNDEFINED
#define SDL_WINDOWPOS_UNDEFINED
Definition: SDL_video.h:130
iterations
static int iterations
Definition: testsprite2.c:43
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
SDL_Surface::w
int w
Definition: SDL_surface.h:73
SDL_strncmp
#define SDL_strncmp
Definition: SDL_dynapi_overrides.h:418
SDL_UpdateTexture
#define SDL_UpdateTexture
Definition: SDL_dynapi_overrides.h:315
verify_yuv_data
static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface)
Definition: testyuv.c:74
distance
GLsizei GLsizei GLfloat distance
Definition: SDL_opengl_glext.h:9200
SDL_Texture
Definition: SDL_sysrender.h:49
MAX_YUV_SURFACE_SIZE
#define MAX_YUV_SURFACE_SIZE(W, H, P)
Definition: testyuv.c:22
SDL_PIXELFORMAT_YVYU
Definition: SDL_pixels.h:285
SDL_LogError
#define SDL_LogError
Definition: SDL_dynapi_overrides.h:36
format
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:251
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:343
pattern
GLubyte * pattern
Definition: SDL_opengl_glext.h:3486
main
int main(int argc, char **argv)
Definition: testyuv.c:220
SDL_PIXELFORMAT_NV12
Definition: SDL_pixels.h:287
SDL_CreateTextureFromSurface
#define SDL_CreateTextureFromSurface
Definition: SDL_dynapi_overrides.h:307
SDL_GetTicks
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:254
SDL_SetYUVConversionMode
#define SDL_SetYUVConversionMode
Definition: SDL_dynapi_overrides.h:663
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:75
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
sort_controllers.filename
string filename
Definition: sort_controllers.py:8
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_Quit
#define SDL_Quit
Definition: SDL_dynapi_overrides.h:58
sort_controllers.output
output
Definition: sort_controllers.py:10
done
int done
Definition: checkkeys.c:28
SDLTest_DrawString
int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s)
Draw a string in the currently set font.
Definition: SDL_test_font.c:3222
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:50
SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:94
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_KeyboardEvent::keysym
SDL_Keysym keysym
Definition: SDL_events.h:199
SDL_YUV_CONVERSION_AUTOMATIC
Definition: SDL_surface.h:108
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:537
CalculateYUVPitch
int CalculateYUVPitch(Uint32 format, int width)
Definition: testyuv_cvt.c:282
SDL_Delay
#define SDL_Delay
Definition: SDL_dynapi_overrides.h:486
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
generate_test_pattern
static SDL_Surface * generate_test_pattern(int pattern_size)
Definition: testyuv.c:34
SDLK_LEFT
Definition: SDL_keycode.h:152
NULL
#define NULL
Definition: begin_code.h:164
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_YUV_CONVERSION_BT601
Definition: SDL_surface.h:106
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:334
SDL_PIXELFORMAT_YV12
Definition: SDL_pixels.h:277
SDL_PIXELFORMAT_RGB565
Definition: SDL_pixels.h:224
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_Event::key
SDL_KeyboardEvent key
Definition: SDL_events.h:530
formats
EGLint EGLint * formats
Definition: eglext.h:718
SDL_YUV_CONVERSION_BT709
Definition: SDL_surface.h:107
SDL_LogInfo
#define SDL_LogInfo
Definition: SDL_dynapi_overrides.h:34
SDL_PIXELFORMAT_IYUV
Definition: SDL_pixels.h:279
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:73
SDL_Keysym::sym
SDL_Keycode sym
Definition: SDL_keyboard.h:50
SDL_Surface::pitch
int pitch
Definition: SDL_surface.h:74
SDL_Event::button
SDL_MouseButtonEvent button
Definition: SDL_events.h:534
SDL_MouseButtonEvent::x
Sint32 x
Definition: SDL_events.h:258
SDL_PIXELFORMAT_RGB24
Definition: SDL_pixels.h:230
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:40
SDL_PIXELFORMAT_UYVY
Definition: SDL_pixels.h:283
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
SDL_Event
General event structure.
Definition: SDL_events.h:525
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:330
SDL_ConvertPixels
#define SDL_ConvertPixels
Definition: SDL_dynapi_overrides.h:465
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
SDL_PIXELFORMAT_YUY2
Definition: SDL_pixels.h:281
SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:257
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:317
SDL_GetYUVConversionModeForResolution
#define SDL_GetYUVConversionModeForResolution
Definition: SDL_dynapi_overrides.h:665
SDLK_ESCAPE
Definition: SDL_keycode.h:55
SDL_CreateRGBSurfaceWithFormat
#define SDL_CreateRGBSurfaceWithFormat
Definition: SDL_dynapi_overrides.h:606
SDL.h
testyuv_cvt.h
SDL_LOG_CATEGORY_APPLICATION
Definition: SDL_log.h:66
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:301
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:346
SDL_Event::type
Uint32 type
Definition: SDL_events.h:527
ConvertRGBtoYUV
SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
Definition: testyuv_cvt.c:262
SDL_GetPixelFormatName
#define SDL_GetPixelFormatName
Definition: SDL_dynapi_overrides.h:277
SDL_PIXELFORMAT_RGB555
Definition: SDL_pixels.h:194