diff options
author | Bertrand Augereau | 2003-06-22 11:52:40 +0000 |
---|---|---|
committer | Bertrand Augereau | 2003-06-22 11:52:40 +0000 |
commit | fa184730af2f2be094aa9f37cd3abf58d10f79ea (patch) | |
tree | 03fd03e7d3f3352a52f0349b0e91ee8c7051aebe /common | |
parent | 4ead10e4d5352e2fd0311ee09a5a99195d5fd97e (diff) | |
download | scummvm-rg350-fa184730af2f2be094aa9f37cd3abf58d10f79ea.tar.gz scummvm-rg350-fa184730af2f2be094aa9f37cd3abf58d10f79ea.tar.bz2 scummvm-rg350-fa184730af2f2be094aa9f37cd3abf58d10f79ea.zip |
Reduced the number of shifts in highly used functions in Super2xSaI and SuperEagle
svn-id: r8604
Diffstat (limited to 'common')
-rw-r--r-- | common/scaler.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/common/scaler.cpp b/common/scaler.cpp index c10bcccfab..1607fef214 100644 --- a/common/scaler.cpp +++ b/common/scaler.cpp @@ -90,17 +90,19 @@ static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D) { } static inline uint32 INTERPOLATE(uint32 A, uint32 B) { - if (A != B) { - return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask)); + if (A != B) { + // Non regression test + assert ((((A & colorMask) + (B & colorMask)) >> 1) + (A & B & lowPixelMask)==(((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask))); + return (((A & colorMask) + (B & colorMask)) >> 1) + (A & B & lowPixelMask); } else return A; } static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D) { - register uint32 x = ((A & qcolorMask) >> 2) + - ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); - register uint32 y = (A & qlowpixelMask) + - (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); + register uint32 x = ((A & qcolorMask) + (B & qcolorMask) + (C & qcolorMask) + (D & qcolorMask))>>2; + // Non regression test + assert (x==((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2)); + register uint32 y = (A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); y = (y >> 2) & qlowpixelMask; return x + y; |