We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4290 - fastpath BlitNtoN
Summary: fastpath BlitNtoN
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: don't know
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-02 10:15 UTC by Sylvain
Modified: 2019-01-30 14:35 UTC (History)
1 user (show)

See Also:


Attachments
test case (2.90 KB, text/x-csrc)
2018-10-02 10:15 UTC, Sylvain
Details
patch (2.21 KB, patch)
2018-10-02 10:16 UTC, Sylvain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2018-10-02 10:15:46 UTC
Created attachment 3334 [details]
test case

I have also this patch to add fast paths to BlitNtoN

- when you expand to a pixel format of size 24 to 32.
- when you remove an alpha channel and switch RGB to BGR.

Seems to be 7 or 8 times faster.
Comment 1 Sylvain 2018-10-02 10:16:48 UTC
Created attachment 3335 [details]
patch
Comment 2 Ozkan Sezer 2018-10-02 12:14:21 UTC
For the "Fastpath: expand 24 -> 32" case, I suggest:
-        int alphashift = alpha << 24;
+        unsigned alphashift = alpha << 24;
Comment 3 Sylvain 2018-10-02 17:53:04 UTC
Yes you're right
Comment 4 Sylvain 2019-01-24 18:09:42 UTC
Probably some issue with RGB_24 since it depends on BYTES_ORDER,
then, the code should be moved to normal_blit_3 and normal_blit_4 in SDL_blit_N.c
Comment 5 Sam Lantinga 2019-01-25 09:53:58 UTC
Yup, can you update the patch with those fixes?
Comment 6 Sylvain 2019-01-30 14:35:56 UTC
Fixed in 
 https://hg.libsdl.org/SDL/rev/57b136cff952
 https://hg.libsdl.org/SDL/rev/338b02acfdfc

With some more than what was doing the original patch!

I've added an ifdef for little endian, as I'm not 100% sure for big endian.

Probably it can be done by inverting the use of the two function same_rgb / inv_rgb ...