sdl2_frt/src
Sam Lantinga d2a2b0c139 Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions
Sylvain

There are various YUV-RGB conversion coefficients, according to https://www.fourcc.org/fccyvrgb.php
I choose the first (from Video Demystified, with integer multiplication),
but the current SDL2 Dither functions use in fact the next one, which follows a specifications called CCIR 601.

Here's a patch to use the second ones and with previous warning corrections.
There are less multiplications involved because Chroma coefficient is 1.
Also, doing float multiplication is as efficient with vectorization.
In the end, the YUV decoding is faster: ~165 ms vs my previous 195 ms.

Moreover, if SDL2 is compiled with -march=native, then YUV decoding time drops to ~130ms, while older ones remains around ~220 ms.


For information, from jpeg-9 source code:
jpeg-9/jccolor.c

   * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
   * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
   * The conversion equations to be implemented are therefore
   * Y  =  0.29900 * R + 0.58700 * G + 0.11400 * B
   * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B  + CENTERJSAMPLE
   * Cr =  0.50000 * R - 0.41869 * G - 0.08131 * B  + CENTERJSAMPLE

jpeg-9/jdcolor.c

   * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
   * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
   * The conversion equations to be implemented are therefore
   *
   * R = Y                + 1.40200 * Cr
   * G = Y - 0.34414 * Cb - 0.71414 * Cr
   * B = Y + 1.77200 * Cb
2017-10-07 15:26:55 -07:00
..
atomic Add atomics for Watcom/x86 as inline asm 2017-08-18 16:35:55 -04:00
audio audio: Fixed compiler warning on Visual Studio. 2017-09-22 22:28:21 -04:00
core Fixed bug 3854 - arguments to dbus_type_is_basic() were incorrect 2017-10-05 09:37:28 -07:00
cpuinfo SDL_cpuinfo.c: add os/2 support to SDL_GetCPUCount() and SDL_GetSystemRAM(). 2017-08-21 13:00:40 -07:00
dynapi vulkan: use "unsigned int" instead of "unsigned" 2017-09-06 19:35:36 -04:00
events Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
file Fixed bug 3760 - RWops doesn't check for integer overflow when stdio_fseek only supports 32 bits 2017-09-09 08:36:37 -07:00
filesystem filesystem: Patched to compile on QNX. 2017-08-17 03:22:44 -04:00
haptic Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
joystick Added stubs for simple Steam Controller support 2017-09-22 08:32:31 -07:00
libm Updated copyright for 2017 2017-01-01 18:33:28 -08:00
loadso revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
main Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations 2017-08-28 14:34:15 -07:00
power power: whoops, that should be "==" not "!=". 2017-07-03 16:45:12 -04:00
render Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions 2017-10-06 16:50:24 -07:00
stdlib Fixed bug 3813 - gcc7 fallthrough warnings in SDL_iconv.c and SDL_pixels.c 2017-09-10 12:42:38 -07:00
test Added an example for SDL_SetWindowHitTest() when you create a borderless resizable window. 2017-09-22 17:29:32 -07:00
thread Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
timer Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks 2017-08-14 06:28:21 -07:00
video Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions 2017-10-07 15:26:55 -07:00
SDL_assert_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_assert.c Fixed bug 3744 - missing SDLCALL in several functions 2017-08-13 21:06:52 -07:00
SDL_dataqueue.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_dataqueue.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_error_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_error.c Fixed bug 3696 - SDL_ShowMessageBox displays different error from intended 2017-07-10 17:16:12 -07:00
SDL_hints.c A hint with an empty string should be treated as the default value 2017-09-21 14:48:03 -07:00
SDL_internal.h Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
SDL_log.c Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks 2017-08-14 06:28:21 -07:00
SDL.c Backing out broken change from previous commit. 2017-04-01 00:46:42 -04:00