diff options
author | Max Horn | 2009-01-26 16:45:21 +0000 |
---|---|---|
committer | Max Horn | 2009-01-26 16:45:21 +0000 |
commit | 2042c6d5701e5bf9431f5886e5440f68d3e57d38 (patch) | |
tree | 874410a3dea34af90e83fc1768beb65bda3de568 /graphics/scaler | |
parent | 508f254ff7f962b01055bcd5cde23f43668016f2 (diff) | |
download | scummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.tar.gz scummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.tar.bz2 scummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.zip |
Slightly improved interpolate32_1_1
svn-id: r36075
Diffstat (limited to 'graphics/scaler')
-rw-r--r-- | graphics/scaler/intern.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h index 2e3760b70a..8f1b546685 100644 --- a/graphics/scaler/intern.h +++ b/graphics/scaler/intern.h @@ -40,12 +40,13 @@ /** * Interpolate two 16 bit pixel *pairs* at once with equal weights 1. - * In particular, A and B can contain two pixels/each in the upper - * and lower halves. + * In particular, p1 and p2 can contain two pixels each in the upper + * and lower halves. Requires only 5 operations! + * See <http://www.slack.net/~ant/info/rgb_mixing.html> for details on how this works. */ template<int bitFormat> -static inline uint32 interpolate32_1_1(uint32 A, uint32 B) { - return (((A & kHighBitsMask) + (B & kHighBitsMask)) >> 1) + (A & B & kLowBitsMask); +static inline uint32 interpolate32_1_1(uint32 p1, uint32 p2) { + return (p1 + p2 - ((p1 ^ p2) & kLowBitsMask)) >> 1; } /** |