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

Summary: fastpath BlitNtoN
Product: SDL Reporter: Sylvain <sylvain.becker>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: don't know   
Hardware: All   
OS: All   
Attachments: test case
patch

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 ...