Tue, 10 Oct 2017 11:56:54 -0400Added SDL_PeekIntoDataQueue().
Ryan C. Gordon <icculus@icculus.org> [Tue, 10 Oct 2017 11:56:54 -0400] rev 11582
Added SDL_PeekIntoDataQueue().

Tue, 10 Oct 2017 11:10:15 -0700Exposed the joystick locking functions for multi-threaded access to the joystick API
Sam Lantinga <slouken@libsdl.org> [Tue, 10 Oct 2017 11:10:15 -0700] rev 11581
Exposed the joystick locking functions for multi-threaded access to the joystick API

Mon, 09 Oct 2017 21:36:10 +0200atari:gem: Do not change system palette if application does not have focus SDL-1.2
Patrice Mandin <patmandin@gmail.com> [Mon, 09 Oct 2017 21:36:10 +0200] rev 11580
atari:gem: Do not change system palette if application does not have focus

Mon, 09 Oct 2017 11:45:15 -0700Fixed crash in SDL_IsGameController() on Windows if called when a controller is being removed
Sam Lantinga <slouken@libsdl.org> [Mon, 09 Oct 2017 11:45:15 -0700] rev 11579
Fixed crash in SDL_IsGameController() on Windows if called when a controller is being removed

Sun, 08 Oct 2017 10:59:03 -0700Fixed bug 3865 - [PATCH] Support for GreenAsia Inc. PSX to USB converter as SDL_GameController
Sam Lantinga <slouken@libsdl.org> [Sun, 08 Oct 2017 10:59:03 -0700] rev 11578
Fixed bug 3865 - [PATCH] Support for GreenAsia Inc. PSX to USB converter as SDL_GameController

Manuel

I would like this small patch merged that adds support for my GreenAsia Inc. PSX to USB converter, so SDL_IsGameController() returns true when using this adaptor.
It's interesting because PSX/PS2 controllers connected using this model won't be detected as gamecontrollers otherwise, only as joysticks.

Sat, 07 Oct 2017 15:26:55 -0700Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions
Sam Lantinga <slouken@libsdl.org> [Sat, 07 Oct 2017 15:26:55 -0700] rev 11577
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

Sat, 07 Oct 2017 12:00:04 +0200atari:gem: Handle padding redraw when moving window behind other windows SDL-1.2
Patrice Mandin <patmandin@gmail.com> [Sat, 07 Oct 2017 12:00:04 +0200] rev 11576
atari:gem: Handle padding redraw when moving window behind other windows

Fri, 06 Oct 2017 21:43:59 -0700Fixed restoring window size when coming out of fullscreen desktop mode.
Sam Lantinga <slouken@libsdl.org> [Fri, 06 Oct 2017 21:43:59 -0700] rev 11575
Fixed restoring window size when coming out of fullscreen desktop mode.
Use the style of the window as it will be, not as it currently is at the
time of the AdjustWindowRect call.

Fri, 06 Oct 2017 16:50:24 -0700Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions
Sam Lantinga <slouken@libsdl.org> [Fri, 06 Oct 2017 16:50:24 -0700] rev 11574
Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions

Sylvain

Few issues with YUV on SDL2 when using odd dimensions, and missing conversions from/back to YUV formats.

1) The big part is that SDL_ConvertPixels() does not convert to/from YUV in most cases. This now works with any format and also with odd dimensions,
by adding two internal functions SDL_ConvertPixels_YUV_to_ARGB8888 and SDL_ConvertPixels_ARGB8888_to_YUV (could it be XRGB888 ?).
The target format is hard coded to ARGB888 (which is the default in the internal of the software renderer).
In case of different YUV conversion, it will do an intermediate conversion to a ARGB8888 buffer.

SDL_ConvertPixels_YUV_to_ARGB8888 is somehow redundant with all the "Color*Dither*Mod*".
But it allows some completeness of SDL_ConvertPixels to handle all YUV format.
It also works with odd dimensions.

Moreover, I did some benchmark(SDL_ConvertPixel vs Color32DitherYV12Mod1X and Color32DitherYUY2Mod1X).
gcc-6.3 and clang-4.0. gcc performs better than clang. And, with gcc, SDL_ConvertPixels() performs better (20%) than the two C function Color32Dither*().
For instance, to convert 10 times a 3888x2592 image, it takes ~195 ms with SDL_ConvertPixels and ~235 ms with Color32Dither*().
Especially because of gcc vectorize feature that optimises all conversion loops (-ftree-loop-vectorize).

Nb: I put no image pitch for the YUV buffers. because it complexify a little bit the code and the API :
There would be some ambiguity when setting the pitch exactly to image width:
would it a be pitch of image width (for luma and chroma). or just contiguous data ? (could set pitch=0 for the later).


2) Small issues with odd dimensions:
If width "w" is odd, luma plane width is still "w" whereas chroma planes will be "(w + 1)/2". Almost the same for odd h.
Solution is to strategically substitute "w" by "(w+1)/2" at the good places ...

- In the repository, SDL_ConvertPixels() handles YUV only if yuv source format is exactly the same as YUV destination format.
It basically does a memcpy of pixels, but it's done incorrectly when width or height is odd (wrong size of chroma planes). This is fixed.

- SDL Renderers don't support odd width/height for YUV textures.
This is fixed for software, opengl, opengles2. (opengles 1 does not support it and fallback to software rendering).
This is *not* fixed for D3D and D3D11 ... (and others, psp ?)
Only *two* Dither function are fixed ... not sure if others are really used.

- This is not possible to create a NV12/NV12 texture with the software renderer, whereas other renderers allow it.
This is fixed, by using SDL_ConvertPixels underneath.

- It was not possible to SDL_UpdateTexture() of format NV12/NV21 with the software renderer. this is fixed.

Here's also two testcases:
- that do all combination of conversion.
- to test partial UpdateTexture

Fri, 06 Oct 2017 16:42:43 -0700Fixed bug 3862 - Install is broken when adding SDL2 to an existing CMake project
Sam Lantinga <slouken@libsdl.org> [Fri, 06 Oct 2017 16:42:43 -0700] rev 11573
Fixed bug 3862 - Install is broken when adding SDL2 to an existing CMake project

Steve Robinson

In my existing CMake project, I use add_subdirectory to add the source for SDL2. This worked fine in 2.0.5, but now in 2.0.6 when I build the INSTALL CMake target, I get this error:

file INSTALL cannot find "D:/path/to/SDL2Config.cmake".
Call Stack (most recent call first):
3rdparty/SDL2/cmake_install.cmake:32 (include)
3rdparty/cmake_install.cmake:36 (include)
cmake_install.cmake:32 (include)

To fix this, I changed line 1770 from this:
${CMAKE_SOURCE_DIR}/SDL2Config.cmake

To this:
${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake