Skip to main content
GameDev.net gamedev.net
🔒 Locked

Matrix operations question

Started by coolblue Oct 25, 2011 at 10:31 PM 2 replies 1.1k views
Original Post
coolblue
coolblue
I have been reading about matrix operations and have a question.




Take a look at the following article http://www.switchonthecode.com/tutorials/csharp-tutorial-convert-a-color-image-to-grayscale




I understand why example 2 is quicker than example 1 due to the way the data is being accessed. However I do not understand why example 3 is quicker than example 2 as surely although it is using a built in gdi+ method to alter the pixels both examples are still having to effectively set the pixel values in the same way (ie adding values to each pixel)?




If anyone can explain the difference to me then I would be grateful.

Cornstalks
Cornstalks
While I can't say exactly what method 3 is doing underneath it all (i.e. all the implementation details), I would assume there is a lot of optimizations that the method makes. For example, it can potentially employ SSE, hardware acceleration (by using the graphics card), parallelism (there's no reason it can't compute it all using multiple threads), etc. There's a lot of potential options here, and to be honest I'm not sure exactly which options it's using without exposing the underlying code of the draw calls.
Evil Steve
Evil Steve
Moving to General Programming; this isn't DirectX related.
Adam_42
Adam_42
If you read the comments on the linked article (especially the long comment by 'rc' near the bottom) you'll find out that method 2 is the quickest when it's been optimized a bit more.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.