Commit Graph

17 Commits

Author SHA1 Message Date
Sylvain Becker
bb9a9080dc Fix pointer warnings 2019-02-07 16:13:25 +01:00
Sylvain Becker
3543a44ae4 Faster blit when using CopyAlpha + ColorKey
Applied to following formats:

ABGR8888 -> ARGB8888 :  faster x7   (3959672 -> 537227)
ABGR8888 -> BGRA8888 :  faster x7   (4008716 -> 532064)
ABGR8888 -> RGBA8888 :  faster x7   (3998576 -> 530964)

ARGB8888 -> ABGR8888 :  faster x7   (3942420 -> 532503)
ARGB8888 -> BGRA8888 :  faster x7   (3995382 -> 527722)
ARGB8888 -> RGBA8888 :  faster x7   (4259330 -> 543033)

BGRA8888 -> ABGR8888 :  faster x7   (4110411 -> 529402)
BGRA8888 -> ARGB8888 :  faster x7   (4071906 -> 538393)
BGRA8888 -> RGBA8888 :  faster x6   (4038320 -> 585141)

RGBA8888 -> ABGR8888 :  faster x7   (3937018 -> 534127)
RGBA8888 -> ARGB8888 :  faster x7   (3979577 -> 537810)
RGBA8888 -> BGRA8888 :  faster x7   (3975656 -> 528355)
2019-02-07 15:12:17 +01:00
Sylvain Becker
7b8bac5958 Add fast paths in BlitNtoNKey
All following conversions are faster (with colorkey, but no blending).
(ratio isn't very accurate)

ABGR8888 -> BGR888 :  faster x9   (2699035 -> 297425)

ARGB8888 -> RGB888 :  faster x8   (2659266 -> 296137)

BGR24 -> BGR24 :  faster x5   (2232482 -> 445897)
BGR24 -> RGB24 :  faster x4   (2150023 -> 448576)

BGR888 -> ABGR8888 :  faster x8   (2649957 -> 307595)

BGRA8888 -> BGRX8888 :  faster x9   (2696041 -> 297596)

BGRX8888 -> BGRA8888 :  faster x8   (2662011 -> 299463)
BGRX8888 -> BGRX8888 :  faster x9   (2733346 -> 295045)

RGB24 -> BGR24 :  faster x4   (2154551 -> 485262)
RGB24 -> RGB24 :  faster x4   (2149878 -> 484870)

RGB888 -> ARGB8888 :  faster x8   (2762877 -> 324946)

RGBA8888 -> RGBX8888 :  faster x8   (2657855 -> 297753)

RGBX8888 -> RGBA8888 :  faster x8   (2661360 -> 296655)
RGBX8888 -> RGBX8888 :  faster x8   (2649287 -> 308268)
2019-01-30 22:50:20 +01:00
Sylvain Becker
a052d81bdf Add explicit unsigned int and char types in (for bug 4290) 2019-01-30 15:31:07 +01:00
Sylvain Becker
1128d57316 Fixed bug 4290 - add fastpaths for format conversion in BlitNtoN
All following conversion are faster (no colorkey, no blending).
(ratio isn't very accurate)

ABGR8888 -> ARGB8888 :  faster x6   (2655837 -> 416607)
ABGR8888 -> BGR24 :  faster x7   (2470117 -> 325693)
ABGR8888 -> RGB24 :  faster x7   (2478107 -> 335445)
ABGR8888 -> RGB888 :  faster x9   (3178524 -> 333859)

ARGB8888 -> ABGR8888 :  faster x6   (2648366 -> 406977)
ARGB8888 -> BGR24 :  faster x7   (2474978 -> 327819)
ARGB8888 -> BGR888 :  faster x9   (3189072 -> 326710)
ARGB8888 -> RGB24 :  faster x7   (2473689 -> 324729)

BGR24 -> ABGR8888 :  faster x6   (2268763 -> 359946)
BGR24 -> ARGB8888 :  faster x6   (2306393 -> 359213)
BGR24 -> BGR888 :  faster x6   (2231141 -> 324195)
BGR24 -> RGB24 :  faster x4   (1557835 -> 322033)
BGR24 -> RGB888 :  faster x6   (2229854 -> 323849)

BGR888 -> ARGB8888 :  faster x8   (3215202 -> 363137)
BGR888 -> BGR24 :  faster x7   (2474775 -> 347916)
BGR888 -> RGB24 :  faster x7   (2532783 -> 327354)
BGR888 -> RGB888 :  faster x9   (3134634 -> 344987)

RGB24 -> ABGR8888 :  faster x6   (2229486 -> 358919)
RGB24 -> ARGB8888 :  faster x6   (2271587 -> 358521)
RGB24 -> BGR24 :  faster x4   (1530913 -> 321149)
RGB24 -> BGR888 :  faster x6   (2227284 -> 327453)
RGB24 -> RGB888 :  faster x6   (2227125 -> 329061)

RGB888 -> ABGR8888 :  faster x8   (3163292 -> 362445)
RGB888 -> BGR24 :  faster x7   (2469489 -> 327127)
RGB888 -> BGR888 :  faster x9   (3190526 -> 326022)
RGB888 -> RGB24 :  faster x7   (2479084 -> 324982)
2019-01-30 15:23:33 +01:00
Sam Lantinga
5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga
6e35e42145 Working on bug 3921 - Add some Fastpath to BlitNtoNKey and BlitNtoNKeyCopyAlpha
Sylvain

I did various benches. with clang 6.0.0 on linux, and ndk-r16b on android (NDK_TOOLCHAIN_VERSION=clang).

- still see a x10 speed factor.
- with duff_loops, it does not use vectorisation (but doesn't seem to be a problem).

on linux my patch is already at full speed on -O2, whereas the duff_loops need -O3 (200 ms at -03, and 300ms at -02).

I realized that on Android, I had a slight variation which fits best.
both on linux with -O2 and -O3, and on android with 02/03 and armeabi-v7a/arm64.

Here's the patch.
2018-10-01 14:43:03 -07:00
Ozkan Sezer
922623e1b6 SDL_blit_N.c (BlitNtoNKeyCopyAlpha): fix -Wshadow warnings by adding _
suffix to the temp Pixel local in the DUFFS_LOOP.
SDL_blit.h (ASSEMBLE_RGB):  add _ prefix to temp Pixel locals to avoid
  any possible shadowings.


The warnings were like the following:

In file included from src/video/SDL_blit_N.c:26:0:
src/video/SDL_blit_N.c: In function 'BlitNtoNKeyCopyAlpha':
src/video/SDL_blit_N.c:2421:24: warning: declaration of 'Pixel' shadows a previous local [-Wshadow]
                 Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
                        ^
src/video/SDL_blit.h:475:21: note: in definition of macro 'DUFFS_LOOP8'
     case 0: do {    pixel_copy_increment; /* fallthrough */             \
                     ^
src/video/SDL_blit_N.c:2419:13: note: in expansion of macro 'DUFFS_LOOP'
             DUFFS_LOOP(
             ^
src/video/SDL_blit_N.c:2399:12: warning: shadowed declaration is here [-Wshadow]
     Uint32 Pixel;
            ^
2018-10-01 21:29:11 +03:00
Sam Lantinga
7df0f4fdac Fixed bug 4277 - warnings patch
Sylvain

Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command

They are automatically enabled with -Wall
2018-09-27 14:56:29 -07:00
Sam Lantinga
e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Philipp Wiesemann
e5d9b25d8c Fixed comment style. 2017-02-26 21:20:39 +01:00
Sam Lantinga
45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
818d1d3e80 Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga
39ba2ab835 Fixed NULL pointer dereference, thanks Ozkan Sezer 2016-10-22 17:53:03 -07:00
Sam Lantinga
5b14a943a8 Fixed bug 3466 - Can't build 2.0.5 on ppc64
/home/fedora/SDL2-2.0.5/src/video/SDL_blit_N.c: In function 'calc_swizzle32':
/home/fedora/SDL2-2.0.5/src/video/SDL_blit_N.c:127:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
     ^
2016-10-22 11:01:55 -07:00
Sam Lantinga
42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann
0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00