aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-01-25 04:29:25 +0000
committerMax Horn2009-01-25 04:29:25 +0000
commitdd586e0e209d60e15a1f061d1171f36e80a0f0a3 (patch)
tree40bf2063badbf52f5aef96a14b1d9d32dcfc1dd8
parent6297561f7caefe5a7f5bf65ec8ca5e3eaa87f2c4 (diff)
downloadscummvm-rg350-dd586e0e209d60e15a1f061d1171f36e80a0f0a3.tar.gz
scummvm-rg350-dd586e0e209d60e15a1f061d1171f36e80a0f0a3.tar.bz2
scummvm-rg350-dd586e0e209d60e15a1f061d1171f36e80a0f0a3.zip
Renamed lowBits -> kLowBitsMask and highBits -> kHighBitsMask
svn-id: r36049
-rw-r--r--graphics/colormasks.h25
-rw-r--r--graphics/scaler.cpp12
-rw-r--r--graphics/scaler/intern.h55
3 files changed, 22 insertions, 70 deletions
diff --git a/graphics/colormasks.h b/graphics/colormasks.h
index 6afc8cdd77..9330585b6b 100644
--- a/graphics/colormasks.h
+++ b/graphics/colormasks.h
@@ -56,7 +56,7 @@ The meaning of these is masks is the following:
appropriate data).
- The highBits / lowBits / qhighBits / qlowBits are special values that are
+ The kHighBitsMask / kLowBitsMask / qhighBits / qlowBits are special values that are
used in the super-optimized interpolation functions in scaler/intern.h
and scaler/aspect.cpp. Currently they are only available in 555 and 565 mode.
To be specific: They pack the masks for two 16 bit pixels at once. The pixels
@@ -70,8 +70,8 @@ The meaning of these is masks is the following:
template<>
struct ColorMasks<565> {
enum {
- highBits = 0xF7DEF7DE,
- lowBits = 0x08210821,
+ kHighBitsMask = 0xF7DEF7DE,
+ kLowBitsMask = 0x08210821,
qhighBits = 0xE79CE79C,
qlowBits = 0x18631863,
@@ -88,21 +88,21 @@ struct ColorMasks<565> {
kGreenShift = kBlueBits,
kBlueShift = 0,
- kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
- kRedMask = ((1 << kRedBits) - 1) << kRedShift,
- kGreenMask = ((1 << kGreenBits) - 1) << kGreenShift,
- kBlueMask = ((1 << kBlueBits) - 1) << kBlueShift,
-
- kRedBlueMask = kRedMask | kBlueMask
+ kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
+ kRedMask = ((1 << kRedBits) - 1) << kRedShift,
+ kGreenMask = ((1 << kGreenBits) - 1) << kGreenShift,
+ kBlueMask = ((1 << kBlueBits) - 1) << kBlueShift,
+ kRedBlueMask = kRedMask | kBlueMask,
+ kLowBits = (1 << kRedShift) | (1 << kGreenShift) | (1 << kBlueShift)
};
};
template<>
struct ColorMasks<555> {
enum {
- highBits = 0x7BDE7BDE,
- lowBits = 0x04210421,
+ kHighBitsMask = 0x7BDE7BDE,
+ kLowBitsMask = 0x04210421,
qhighBits = 0x739C739C,
qlowBits = 0x0C630C63,
@@ -124,7 +124,8 @@ struct ColorMasks<555> {
kGreenMask = ((1 << kGreenBits) - 1) << kGreenShift,
kBlueMask = ((1 << kBlueBits) - 1) << kBlueShift,
- kRedBlueMask = kRedMask | kBlueMask
+ kRedBlueMask = kRedMask | kBlueMask,
+ kLowBits = (1 << kRedShift) | (1 << kGreenShift) | (1 << kBlueShift)
};
};
diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp
index f540c60205..e5029920f6 100644
--- a/graphics/scaler.cpp
+++ b/graphics/scaler.cpp
@@ -121,21 +121,21 @@ void InitScalers(uint32 BitFormat) {
gBitFormat = BitFormat;
#ifndef DISABLE_HQ_SCALERS
- #undef highBits;
- #undef lowBits;
+ #undef kHighBitsMask;
+ #undef kLowBitsMask;
if (gBitFormat == 555) {
InitLUT(Graphics::createPixelFormat<555>());
#ifdef USE_NASM
- hqx_highbits = Graphics::ColorMasks<555>::highBits;
- hqx_lowbits = Graphics::ColorMasks<555>::lowBits & 0xFFFF;
+ hqx_highbits = Graphics::ColorMasks<555>::kHighBitsMask;
+ hqx_lowbits = Graphics::ColorMasks<555>::kLowBitsMask & 0xFFFF;
#endif
}
if (gBitFormat == 565) {
InitLUT(Graphics::createPixelFormat<565>());
#ifdef USE_NASM
- hqx_highbits = Graphics::ColorMasks<565>::highBits;
- hqx_lowbits = Graphics::ColorMasks<565>::lowBits & 0xFFFF;
+ hqx_highbits = Graphics::ColorMasks<565>::kHighBitsMask;
+ hqx_lowbits = Graphics::ColorMasks<565>::kLowBitsMask & 0xFFFF;
#endif
}
#endif
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index cb78bb5bb5..2e3760b70a 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -30,8 +30,8 @@
#include "graphics/colormasks.h"
-#define highBits Graphics::ColorMasks<bitFormat>::highBits
-#define lowBits Graphics::ColorMasks<bitFormat>::lowBits
+#define kHighBitsMask Graphics::ColorMasks<bitFormat>::kHighBitsMask
+#define kLowBitsMask Graphics::ColorMasks<bitFormat>::kLowBitsMask
#define qhighBits Graphics::ColorMasks<bitFormat>::qhighBits
#define qlowBits Graphics::ColorMasks<bitFormat>::qlowBits
#define redblueMask Graphics::ColorMasks<bitFormat>::kRedBlueMask
@@ -45,7 +45,7 @@
*/
template<int bitFormat>
static inline uint32 interpolate32_1_1(uint32 A, uint32 B) {
- return (((A & highBits) >> 1) + ((B & highBits) >> 1) + (A & B & lowBits));
+ return (((A & kHighBitsMask) + (B & kHighBitsMask)) >> 1) + (A & B & kLowBitsMask);
}
/**
@@ -99,55 +99,6 @@ static inline uint16 interpolate16_3(uint16 p1, uint16 p2, uint16 p3) {
}
-template<int bitFormat>
-static inline unsigned interpolate16_3_1(unsigned c1, unsigned c2) {
- const unsigned lowbits=(((c1<<1)&(lowBits<<1))+(c1&qlowBits)+(c2&qlowBits))&qlowBits;
- return ((c1*3+c2) - lowbits) >> 2;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_2_1_1(unsigned c1, unsigned c2, unsigned c3) {
- c1<<=1;
- const unsigned lowbits=((c1&(lowBits<<1))+(c2&qlowBits)+(c3&qlowBits))&qlowBits;
- return ((c1+c2+c3) - lowbits) >> 2;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_1_1(unsigned c1, unsigned c2) {
- return ( c1+c2 - ((c1^c2)&lowBits) ) >> 1;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_5_2_1(unsigned c1, unsigned c2, unsigned c3) {
- c2<<=1;
- const unsigned lowbits=( ((c1<<2)&(lowBits<<2))+(c1&0x1CE7)+(c2&0x18C6)+(c3&0x1CE7) ) & 0x1CE7;
- return ((c1*5+c2+c3) - lowbits) >> 3;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_6_1_1(unsigned c1, unsigned c2, unsigned c3) {
- const unsigned lowbits=(((((c1<<1)&(lowBits<<1))+(c1&qlowBits))<<1)+(c2&0x1CE7)+(c3&0x1CE7))&0x1CE7;
- return ((c1*6+c2+c3) - lowbits) >> 3;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_2_3_3(unsigned c1, unsigned c2, unsigned c3) {
- c1<<=1;
- const unsigned rb=(c1&(redblueMask<<1))+((c2&redblueMask)+(c3&redblueMask))*3;
- const unsigned g=(c1&(greenMask<<1))+((c2&greenMask)+(c3&greenMask))*3;
- return ((rb&(redblueMask<<3))|(g&(greenMask<<8)))>>3;
-}
-
-template<int bitFormat>
-static inline unsigned interpolate16_14_1_1(unsigned c1, unsigned c2, unsigned c3) {
- const unsigned rb=(c1&redblueMask)*14+(c2&redblueMask)+(c3&redblueMask);
- const unsigned g=(c1&greenMask)*14+(c2&greenMask)+(c3&greenMask);
- return ((rb&(redblueMask<<4))|(g&(greenMask<<4)))>>4;
-}
-
-
-
-
/**
* Compare two YUV values (encoded 8-8-8) and check if they differ by more than
* a certain hard coded threshold. Used by the hq scaler family.