This site is no longer active and is available for archival purposes only. Registration and login is disabled.

additive / subtractive blend speed


additive / subtractive blend speed

Postby m|ke » Oct 27, 2006 @ 7:23pm

m|ke
pm Member
 
Posts: 8
Joined: Oct 22, 2006 @ 1:00pm


Postby fast_rx » Oct 28, 2006 @ 2:52pm

User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby m|ke » Oct 28, 2006 @ 8:14pm

m|ke
pm Member
 
Posts: 8
Joined: Oct 22, 2006 @ 1:00pm


Postby Digby » Oct 30, 2006 @ 7:27pm

You might want to investigate reading a DWORD instead of WORD each time through the loop. You pay the same cost on ARM for doing 16 bit ops as you do for 32 bits.

I'd also look at the generated assembly and make sure that the compiler has inlined GetWidth and GetHeight or isn't doing something else dumb like reloading red/green/blue since they are typed as const. Or you could just read the width once into x then while(x--) instead of the for loop.

When I develop routines like this that don't do much with the per-pixel data, I try to quickly determine how fast the routine would run with a "best case" implementation. I do this by commenting out sections of the code with the reasoning that if I did a really, really great job of optimizing, it would never get any faster than not having to execute the code at all. If, after commenting out the code, it didn't make an appreciable difference in the overall performance of the *app*, then I'd spend my time elsewhere. You have to be careful about doing this as the compiler will sometimes turn your entire function into a NOP so you need to look at the generated assembly language to determine the routine is still doing the portion of work that you expect.
With the code that you've posted below, you'll probably find that the time it takes to read and write the pixel data is more than it takes to execute those few bit shifts and addition operations.
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby Dan East » Nov 8, 2006 @ 1:05am

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Dan East » Nov 8, 2006 @ 1:16am

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron