Opened 12 years ago

Closed 12 years ago

Last modified 7 months ago

#8644 closed patch

Speedups for plotYUV and related functions

Reported by: SF/robinwatts Owned by: fingolfin
Priority: normal Component: Video
Keywords: Cc:
Game: Broken Sword 1

Description

This patch accelerates the plotYUV1x, plotYUV2x and plotYUV3x functions used for the MPEG playback on all platforms.

The algorithm is fundamentally unchanged, just various additions are moved out from the inner loop, and various additions removed. Finally the loops are reversed to count down towards zero (as on most architectures testing against 0 is cheap/free).

Specifically this patch has been tested with Broken Sword 1 on WinCE, and found to make a significant improvement in speed.

There is no rocket science here - the algorithm hasn't changed at all - it's just an optimised coding.

Ticket imported from: #1705747. Ticket imported from: patches/749.

Attachments (1)

diff (6.2 KB) - added by SF/robinwatts 12 years ago.
Patch with plotYUV etc speedups.

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by SF/robinwatts

Attachment: diff added

Patch with plotYUV etc speedups.

comment:1 Changed 12 years ago by fingolfin

Thanks for the patch.
Please note that the MPEG playback code will eventually be removed in favor of the DXA playback code.

comment:2 Changed 12 years ago by fingolfin

Looking at this patch, it seems to do lots of simple optimizations which indeed any good compiler should automatically perform.. I wonder, are you using GCC with -O2 or -O3 for your speed tests?

comment:3 Changed 12 years ago by SF/robinwatts

Yes, it's lots of simple optimisations. Some of them might be spotted by a good compiler. Some of them might be spotted by a VERY clever compiler. Some of them can't be spotted at all.

Yes, I'm using -O2.

In my experience of compilers, for every once in blue moon time they do something really clever that you never expect them to, they tend to miss lots of simple optimisations that you'd expect them to get.

comment:4 Changed 12 years ago by fingolfin

Owner: set to fingolfin
Status: newclosed

comment:5 Changed 12 years ago by fingolfin

Commited with one small readability tweak.

comment:6 Changed 12 years ago by fingolfin

Thanks a lot, BTW :)

comment:7 Changed 7 months ago by digitall

Component: Video
Game: Broken Sword 1
Note: See TracTickets for help on using tickets.