SDL/src/video
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
..
android Fixed bug 3799 - SDL_CreateWindow fails with SDL_WINDOW_VULKAN (libvulkan.so.1 not found) 2017-09-06 01:10:10 -07:00
cocoa Mac: Fix the menu bar not always working for non-.app-bundled apps. Fixes bug #3051. 2017-09-25 20:49:31 -03:00
directfb Fixed 3783 - Default libGL path for directFB on Linux differs from x11 path 2017-08-28 09:51:25 -07:00
dummy Updated copyright for 2017 2017-01-01 18:33:28 -08:00
emscripten Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
haiku Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
khronos Fixed bug 3616 - SDL_GL_CreateContext fails with SDL_GL_CONTEXT_DEBUG_FLAG and ANGLE/GLES 2.0 2017-08-29 22:04:43 -07:00
kmsdrm Fixed bug 3792 - [KMS/DRM] Wrong GBM format 2017-09-01 12:54:38 -07:00
mir Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
nacl Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
pandora Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
psp Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
qnx Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
raspberry Fixed bug 3805 - Why is there no --enable-video-rpi option in configure? 2017-09-08 22:21:01 -07:00
uikit iOS MoltenVK code style cleanup. 2017-09-21 20:30:25 -03:00
vivante Guarded EGL code with SDL_VIDEO_OPENGL_EGL 2017-09-22 08:30:37 -07:00
wayland wayland: Fix bug 3814 -Wmissing-field-initializers 2017-09-29 10:07:37 -07:00
windows Fixed restoring window size when coming out of fullscreen desktop mode. 2017-10-06 21:43:59 -07:00
winrt Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
x11 x11: make sure SDL_GetGlobalMouseState notices mouse warping through SDL APIs. 2017-09-05 16:15:54 -04:00
SDL_blit.c Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks 2017-08-14 06:28:21 -07:00
SDL_blit.h Fixed bug 3815 - implicit-fallthrough warning - DUFFS_LOOP4 and friends 2017-09-10 12:49:41 -07:00
SDL_blit_0.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_1.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_A.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_blit_auto.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_auto.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_N.c Fixed comment style. 2017-02-26 21:20:39 +01:00
SDL_blit_slow.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_slow.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_bmp.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_clipboard.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_egl.c revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
SDL_egl_c.h Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_fillrect.c Fixed bug 3780 - GCC 7 implicit fallthrough warnings 2017-09-06 04:32:30 -07:00
SDL_pixels.c surface: Make sure SDL_ConvertSurface() deals with palettes (thanks, Sylvain!). 2017-09-14 08:37:27 -04:00
SDL_pixels_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel.c Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks 2017-08-14 06:28:21 -07:00
SDL_RLEaccel_c.h Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks 2017-08-14 06:28:21 -07:00
SDL_shape.c Fixed bug 3699 - Shaped windows are distorted unless width is divisible by 8 2017-07-11 08:16:00 -07:00
SDL_shape_internals.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_stretch.c Fixed bug 3808 - fix a typo in SDL_stretch.c 2017-09-09 08:20:56 -07:00
SDL_surface.c Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions 2017-10-07 15:26:55 -07:00
SDL_sysvideo.h video: Let video targets optionally decide their default OpenGL configs. 2017-09-02 19:35:32 -04:00
SDL_video.c Fixed tabs to spaces 2017-09-10 12:40:45 -07:00
SDL_vulkan_internal.h Fixed build when Wayland is dynamically loaded 2017-08-28 01:42:18 -07:00
SDL_vulkan_utils.c Avoid hitting ERR_MAX_STRLEN limit. 2017-09-22 22:30:02 +09:00
sdlgenblit.pl Updated copyright for 2017 2017-01-01 18:33:28 -08:00