Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


MMX Saturation in 16bpp

This topic is 6917 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

Hi all! Im just finished with by 32bpp blitroutines using MMX. Saturation, Alphablending etc is pretty easy to do in 32bpp, but how can you get advantage of MMX using 16bpp? If anyone could give me a hint adding two pixles together in 16bpp with saturation and MMX I would be very grateful! Cheers / Tooon

Share this post

Link to post
Share on other sites
OK, will not packed word aremetic just make sure that
the word it self wont overflow? I need an algoritm wich adds each attribute of R,G,B so R cant for example be larger than 32, green 64 etc etc...

if we have the color (R=31, G=0, B=31) in a word, adding color (R=31,G=63,B=31) should result in (R=31, G=63, B=31).

In 32bpp each attribute is stored in a specific byte and has
a max value of 255, wich makes this procedure easy to accomplish (paddusb).

Don''t know if I should bother using MMX for this, or if it will just be as fast using "normal" asm methods.

/ Tooon

Share this post

Link to post
Share on other sites
Ah, I didn't read your post carefully enough. I couldn't think of an elegant way either. Here's my best guess.

You'll have to pardon quasi-MMX

[Assume 5 - 5 - 5 ]

movq MM0,[ESI]
movq MM2,MM0
movq MM3,MM0
movq MM4,MM0
and MM3, REDFILTER //The green colors
and MM4, REDFILTER //The blue colors

At this point, all the colors are low-bit-aligned in their word. Each register (MM2 - MM4) contains 4 pixels, each with a single color component.

Edited by - WMiller on May 10, 2000 5:02:32 PM

Share this post

Link to post
Share on other sites

  • 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!