aboutsummaryrefslogtreecommitdiff
path: root/graphics/scaler
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/scaler')
-rw-r--r--graphics/scaler/2xsai.cpp6
-rw-r--r--graphics/scaler/hq2x_i386.asm10
-rw-r--r--graphics/scaler/hq3x_i386.asm10
-rw-r--r--graphics/scaler/intern.h23
4 files changed, 13 insertions, 36 deletions
diff --git a/graphics/scaler/2xsai.cpp b/graphics/scaler/2xsai.cpp
index f56d5f7e40..37b5457dd8 100644
--- a/graphics/scaler/2xsai.cpp
+++ b/graphics/scaler/2xsai.cpp
@@ -46,9 +46,9 @@ static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D) {
return rmap[y][x];
}
-#define interpolate_1_1 interpolate16_2<bitFormat, 1, 1>
-#define interpolate_3_1 interpolate16_2<bitFormat, 3, 1>
-#define interpolate_6_1_1 interpolate16_3<bitFormat, 6, 1, 1>
+#define interpolate_1_1 interpolate16_1_1<Graphics::ColorMasks<bitFormat> >
+#define interpolate_3_1 interpolate16_3_1<Graphics::ColorMasks<bitFormat> >
+#define interpolate_6_1_1 interpolate16_6_1_1<Graphics::ColorMasks<bitFormat> >
#define interpolate_1_1_1_1 interpolate32_1_1_1_1<bitFormat>
template<int bitFormat>
diff --git a/graphics/scaler/hq2x_i386.asm b/graphics/scaler/hq2x_i386.asm
index 6dd97ed763..3de1095e74 100644
--- a/graphics/scaler/hq2x_i386.asm
+++ b/graphics/scaler/hq2x_i386.asm
@@ -148,7 +148,7 @@ SECTION .text
mov %1,dx
%endmacro
-; interpolate16_3<bitFormat,2,1,1>
+; interpolate16_2_1_1
; Mix three pixels with weight 2, 1, and 1, respectively: (c1*2+c2+c3)/4;
%macro Interp2 4
mov edx,%3
@@ -166,7 +166,7 @@ SECTION .text
mov %1,dx
%endmacro
-; interpolate16_3<bitFormat,5,2,1>
+; interpolate16_5_2_1
; Mix three pixels with weight 5, 2, and 1, respectively: (c1*5+c2*2+c3)/8;
%macro Interp6 3
; Unpack eax to ecx and multiply by 5
@@ -212,7 +212,7 @@ SECTION .text
mov %1, dx
%endmacro
-; interpolate16_3<bitFormat,6,1,1>
+; interpolate16_6_1_1
; Mix three pixels with weight 6, 1, and 1, respectively: (c1*6+c2+c3)/8;
%macro Interp7 3
; Unpack eax to ecx and multiply by 6
@@ -258,7 +258,7 @@ SECTION .text
mov %1, dx
%endmacro
-; interpolate16_3<bitFormat,2,3,3>
+; interpolate16_2_3_3
; Mix three pixels with weight 2, 3, and 3, respectively: (c1*2+(c2+c3)*3)/8;
%macro Interp9 3
; unpack c2
@@ -305,7 +305,7 @@ SECTION .text
mov %1, dx
%endmacro
-; interpolate16_3<bitFormat,14,1,1>
+; interpolate16_14_1_1
; Mix three pixels with weight 14, 1, and 1, respectively: (c1*14+c2+c3)/16;
%macro Interp10 3
; Unpack eax to ecx and multiply by 14
diff --git a/graphics/scaler/hq3x_i386.asm b/graphics/scaler/hq3x_i386.asm
index 1b470f5663..c3d1daec37 100644
--- a/graphics/scaler/hq3x_i386.asm
+++ b/graphics/scaler/hq3x_i386.asm
@@ -131,7 +131,7 @@ SECTION .text
%%fin:
%endmacro
-; interpolate16_2<bitFormat,3,1>
+; interpolate16_3_1
; Mix two pixels with weight 3 and 1, respectively: (c1*3+c2)/4;
%macro Interp1 3
mov edx,%2
@@ -147,7 +147,7 @@ SECTION .text
mov %1,dx
%endmacro
-; interpolate16_3<bitFormat,2,1,1>
+; interpolate16_2_1_1
; Mix three pixels with weight 2, 1, and 1, respectively: (c1*2+c2+c3)/4;
%macro Interp2 4
mov edx,%3
@@ -165,7 +165,7 @@ SECTION .text
mov %1,dx
%endmacro
-; interpolate16_2<bitFormat,7,1>
+; interpolate16_7_1
; Mix two pixels with weight 7 and 1, respectively: (c1*7+c2)/8;
%macro Interp3 2
; ((p1&kLowBitsMask)<<2)
@@ -204,7 +204,7 @@ SECTION .text
mov %1,dx
%endmacro
-; interpolate16_3<bitFormat,2,7,7>
+; interpolate16_2_7_7
; Mix three pixels with weight 2, 7, and 7, respectively: (c1*2+(c2+c3)*7)/16;
%macro Interp4 3
; unpack c2
@@ -251,7 +251,7 @@ SECTION .text
mov %1, dx
%endmacro
-; interpolate16_2<bitFormat,1,1>
+; interpolate16_1_1
; Mix two pixels with weight 1 and 1, respectively: (c1+c2)/2;
%macro Interp5 3
mov edx,%2
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index 7546d39021..aec3ad13b5 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -77,29 +77,6 @@ static inline uint32 interpolate32_1_1_1_1(uint32 p1, uint32 p2, uint32 p3, uint
}
/**
- * Interpolate two 16 bit pixels with the weights specified in the template
- * parameters.
- * @note w1 and w2 must sum up to 2, 4, 8 or 16.
- */
-template<int bitFormat, int w1, int w2>
-static inline uint16 interpolate16_2(uint16 p1, uint16 p2) {
- return ((((p1 & redblueMask) * w1 + (p2 & redblueMask) * w2) / (w1 + w2)) & redblueMask) |
- ((((p1 & greenMask) * w1 + (p2 & greenMask) * w2) / (w1 + w2)) & greenMask);
-}
-
-/**
- * Interpolate three 16 bit pixels with the weights specified in the template
- * parameters.
- * @note w1, w2 and w3 must sum up to 2, 4, 8 or 16.
- */
-template<int bitFormat, int w1, int w2, int w3>
-static inline uint16 interpolate16_3(uint16 p1, uint16 p2, uint16 p3) {
- return ((((p1 & redblueMask) * w1 + (p2 & redblueMask) * w2 + (p3 & redblueMask) * w3) / (w1 + w2 + w3)) & redblueMask) |
- ((((p1 & greenMask) * w1 + (p2 & greenMask) * w2 + (p3 & greenMask) * w3) / (w1 + w2 + w3)) & greenMask);
-}
-
-
-/**
* Interpolate two 16 bit pixels with weights 1 and 1, i.e., (p1+p2)/2.
* See <http://www.slack.net/~ant/info/rgb_mixing.html> for details on how this works.
*/