aboutsummaryrefslogtreecommitdiff
path: root/graphics/scaler/intern.h
diff options
context:
space:
mode:
authorMax Horn2009-01-24 23:06:58 +0000
committerMax Horn2009-01-24 23:06:58 +0000
commit16e7a7cd30e3523a53c0038b4e04289e07424479 (patch)
treea8671c66cec3b3b3b73e95fecbc67bbf9ddb26e4 /graphics/scaler/intern.h
parente5feb689dfa8afc3d6af3ae6e66343cfc61b855c (diff)
downloadscummvm-rg350-16e7a7cd30e3523a53c0038b4e04289e07424479.tar.gz
scummvm-rg350-16e7a7cd30e3523a53c0038b4e04289e07424479.tar.bz2
scummvm-rg350-16e7a7cd30e3523a53c0038b4e04289e07424479.zip
Turned two vars of the HQ2x/HQ3x ASM implementation into global vars, to make it possible to adjust them for 555 vs. 565 mode (555 mode is still a bit buggy, due to the interpolation code they use)
svn-id: r36046
Diffstat (limited to 'graphics/scaler/intern.h')
-rw-r--r--graphics/scaler/intern.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index 5955aa1bac..cb78bb5bb5 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -76,7 +76,6 @@ static inline uint32 interpolate32_1_1_1_1(uint32 A, uint32 B, uint32 C, uint32
return x + y;
}
-
/**
* Interpolate two 16 bit pixels with the weights specified in the template
* parameters. Used by the hq scaler family.
@@ -100,6 +99,55 @@ 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.