Jump to content
  • Advertisement
Sign in to follow this  
coolblue

Matrix operations question

This topic is 2608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!