Ripped out all 16 bit filters
This commit is contained in:
parent
decdb9c82e
commit
ed769b1014
|
@ -219,150 +219,6 @@ static inline int GetResult2_32 (u32 A, u32 B, u32 C, u32 D,
|
|||
#define RED_MASK555 0x7C007C00
|
||||
#define GREEN_MASK555 0x03E003E0
|
||||
|
||||
void Super2xSaI (u8 *srcPtr, u32 srcPitch,
|
||||
u8 *deltaPtr, u8 *dstPtr, u32 dstPitch,
|
||||
int width, int height)
|
||||
{
|
||||
u16 *bP;
|
||||
u8 *dP;
|
||||
u32 inc_bP;
|
||||
u32 Nextline = srcPitch >> 1;
|
||||
#ifdef MMX
|
||||
if (cpu_mmx) {
|
||||
for (; height; height--) {
|
||||
_2xSaISuper2xSaILine (srcPtr, deltaPtr, srcPitch, width,
|
||||
dstPtr, dstPitch);
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch * 2;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
inc_bP = 1;
|
||||
|
||||
for (; height; height--) {
|
||||
bP = (u16 *) srcPtr;
|
||||
dP = (u8 *) dstPtr;
|
||||
|
||||
for (u32 finish = width; finish; finish -= inc_bP) {
|
||||
u32 color4, color5, color6;
|
||||
u32 color1, color2, color3;
|
||||
u32 colorA0, colorA1, colorA2, colorA3,
|
||||
colorB0, colorB1, colorB2, colorB3, colorS1, colorS2;
|
||||
u32 product1a, product1b, product2a, product2b;
|
||||
|
||||
//--------------------------------------- B1 B2
|
||||
// 4 5 6 S2
|
||||
// 1 2 3 S1
|
||||
// A1 A2
|
||||
|
||||
colorB0 = *(bP - Nextline - 1);
|
||||
colorB1 = *(bP - Nextline);
|
||||
colorB2 = *(bP - Nextline + 1);
|
||||
colorB3 = *(bP - Nextline + 2);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA0 = *(bP + Nextline + Nextline - 1);
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
colorA3 = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
//--------------------------------------
|
||||
if (color2 == color6 && color5 != color3) {
|
||||
product2b = product1b = color2;
|
||||
} else if (color5 == color3 && color2 != color6) {
|
||||
product2b = product1b = color5;
|
||||
} else if (color5 == color3 && color2 == color6) {
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0)
|
||||
product2b = product1b = color6;
|
||||
else if (r < 0)
|
||||
product2b = product1b = color5;
|
||||
else {
|
||||
product2b = product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
} else {
|
||||
if (color6 == color3 && color3 == colorA1
|
||||
&& color2 != colorA2 && color3 != colorA0)
|
||||
product2b =
|
||||
Q_INTERPOLATE (color3, color3, color3, color2);
|
||||
else if (color5 == color2 && color2 == colorA2
|
||||
&& colorA1 != color3 && color2 != colorA3)
|
||||
product2b =
|
||||
Q_INTERPOLATE (color2, color2, color2, color3);
|
||||
else
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
|
||||
if (color6 == color3 && color6 == colorB1
|
||||
&& color5 != colorB2 && color6 != colorB0)
|
||||
product1b =
|
||||
Q_INTERPOLATE (color6, color6, color6, color5);
|
||||
else if (color5 == color2 && color5 == colorB2
|
||||
&& colorB1 != color6 && color5 != colorB3)
|
||||
product1b =
|
||||
Q_INTERPOLATE (color6, color5, color5, color5);
|
||||
else
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
if (color5 == color3 && color2 != color6 && color4 == color5
|
||||
&& color5 != colorA2)
|
||||
product2a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color5 == color1 && color6 == color5
|
||||
&& color4 != color2 && color5 != colorA0)
|
||||
product2a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
product2a = color2;
|
||||
|
||||
if (color2 == color6 && color5 != color3 && color1 == color2
|
||||
&& color2 != colorB2)
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color4 == color2 && color3 == color2
|
||||
&& color1 != color5 && color2 != colorB0)
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
product1a = color5;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
product1a = (product1a << 16) | product1b;
|
||||
product2a = (product2a << 16) | product2b;
|
||||
#else
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
#endif
|
||||
|
||||
*((u32 *) dP) = product1a;
|
||||
*((u32 *) (dP + dstPitch)) = product2a;
|
||||
|
||||
bP += inc_bP;
|
||||
dP += sizeof (u32);
|
||||
} // end of for ( finish= width etc..)
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
deltaPtr += srcPitch;
|
||||
} // endof: for (; height; height--)
|
||||
}
|
||||
}
|
||||
|
||||
void Super2xSaI32 (u8 *srcPtr, u32 srcPitch,
|
||||
u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch,
|
||||
int width, int height)
|
||||
|
@ -487,153 +343,6 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch,
|
|||
} // endof: for (; height; height--)
|
||||
}
|
||||
|
||||
void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *dP;
|
||||
u16 *bP;
|
||||
u16 *xP;
|
||||
u32 inc_bP;
|
||||
|
||||
#ifdef MMX
|
||||
if (cpu_mmx) {
|
||||
for (; height; height--) {
|
||||
_2xSaISuperEagleLine (srcPtr, deltaPtr, srcPitch, width,
|
||||
dstPtr, dstPitch);
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch * 2;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
inc_bP = 1;
|
||||
|
||||
u32 Nextline = srcPitch >> 1;
|
||||
|
||||
for (; height; height--) {
|
||||
bP = (u16 *) srcPtr;
|
||||
xP = (u16 *) deltaPtr;
|
||||
dP = dstPtr;
|
||||
for (u32 finish = width; finish; finish -= inc_bP) {
|
||||
u32 color4, color5, color6;
|
||||
u32 color1, color2, color3;
|
||||
u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2;
|
||||
u32 product1a, product1b, product2a, product2b;
|
||||
|
||||
colorB1 = *(bP - Nextline);
|
||||
colorB2 = *(bP - Nextline + 1);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
|
||||
// --------------------------------------
|
||||
if (color2 == color6 && color5 != color3) {
|
||||
product1b = product2a = color2;
|
||||
if ((color1 == color2) || (color6 == colorB2)) {
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
product1a = INTERPOLATE (color2, product1a);
|
||||
// product1a = color2;
|
||||
} else {
|
||||
product1a = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
if ((color6 == colorS2) || (color2 == colorA1)) {
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
product2b = INTERPOLATE (color2, product2b);
|
||||
// product2b = color2;
|
||||
} else {
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
}
|
||||
} else if (color5 == color3 && color2 != color6) {
|
||||
product2b = product1a = color5;
|
||||
|
||||
if ((colorB1 == color5) || (color3 == colorS1)) {
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
product1b = INTERPOLATE (color5, product1b);
|
||||
// product1b = color5;
|
||||
} else {
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
if ((color3 == colorA2) || (color4 == color5)) {
|
||||
product2a = INTERPOLATE (color5, color2);
|
||||
product2a = INTERPOLATE (color5, product2a);
|
||||
// product2a = color5;
|
||||
} else {
|
||||
product2a = INTERPOLATE (color2, color3);
|
||||
}
|
||||
|
||||
} else if (color5 == color3 && color2 == color6) {
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0) {
|
||||
product1b = product2a = color2;
|
||||
product1a = product2b = INTERPOLATE (color5, color6);
|
||||
} else if (r < 0) {
|
||||
product2b = product1a = color5;
|
||||
product1b = product2a = INTERPOLATE (color5, color6);
|
||||
} else {
|
||||
product2b = product1a = color5;
|
||||
product1b = product2a = color2;
|
||||
}
|
||||
} else {
|
||||
product2b = product1a = INTERPOLATE (color2, color6);
|
||||
product2b =
|
||||
Q_INTERPOLATE (color3, color3, color3, product2b);
|
||||
product1a =
|
||||
Q_INTERPOLATE (color5, color5, color5, product1a);
|
||||
|
||||
product2a = product1b = INTERPOLATE (color5, color3);
|
||||
product2a =
|
||||
Q_INTERPOLATE (color2, color2, color2, product2a);
|
||||
product1b =
|
||||
Q_INTERPOLATE (color6, color6, color6, product1b);
|
||||
|
||||
// product1a = color5;
|
||||
// product1b = color6;
|
||||
// product2a = color2;
|
||||
// product2b = color3;
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
product1a = (product1a << 16) | product1b;
|
||||
product2a = (product2a << 16) | product2b;
|
||||
#else
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
#endif
|
||||
|
||||
*((u32 *) dP) = product1a;
|
||||
*((u32 *) (dP + dstPitch)) = product2a;
|
||||
*xP = color5;
|
||||
|
||||
bP += inc_bP;
|
||||
xP += inc_bP;
|
||||
dP += sizeof (u32);
|
||||
} // end of for ( finish= width etc..)
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
deltaPtr += srcPitch;
|
||||
} // endof: for (height; height; height--)
|
||||
}
|
||||
}
|
||||
|
||||
void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -762,180 +471,6 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
|
|||
} // endof: for (height; height; height--)
|
||||
}
|
||||
|
||||
void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *dP;
|
||||
u16 *bP;
|
||||
u32 inc_bP;
|
||||
|
||||
#ifdef MMX
|
||||
if (cpu_mmx) {
|
||||
for (; height; height -= 1) {
|
||||
_2xSaILine (srcPtr, deltaPtr, srcPitch, width, dstPtr, dstPitch);
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch * 2;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
inc_bP = 1;
|
||||
|
||||
u32 Nextline = srcPitch >> 1;
|
||||
|
||||
for (; height; height--) {
|
||||
bP = (u16 *) srcPtr;
|
||||
dP = dstPtr;
|
||||
|
||||
for (u32 finish = width; finish; finish -= inc_bP) {
|
||||
|
||||
register u32 colorA, colorB;
|
||||
u32 colorC, colorD,
|
||||
colorE, colorF, colorG, colorH,
|
||||
colorI, colorJ, colorK, colorL,
|
||||
|
||||
colorM, colorN, colorO, colorP;
|
||||
u32 product, product1, product2;
|
||||
|
||||
//---------------------------------------
|
||||
// Map of the pixels: I|E F|J
|
||||
// G|A B|K
|
||||
// H|C D|L
|
||||
// M|N O|P
|
||||
colorI = *(bP - Nextline - 1);
|
||||
colorE = *(bP - Nextline);
|
||||
colorF = *(bP - Nextline + 1);
|
||||
colorJ = *(bP - Nextline + 2);
|
||||
|
||||
colorG = *(bP - 1);
|
||||
colorA = *(bP);
|
||||
colorB = *(bP + 1);
|
||||
colorK = *(bP + 2);
|
||||
|
||||
colorH = *(bP + Nextline - 1);
|
||||
colorC = *(bP + Nextline);
|
||||
colorD = *(bP + Nextline + 1);
|
||||
colorL = *(bP + Nextline + 2);
|
||||
|
||||
colorM = *(bP + Nextline + Nextline - 1);
|
||||
colorN = *(bP + Nextline + Nextline);
|
||||
colorO = *(bP + Nextline + Nextline + 1);
|
||||
colorP = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
if ((colorA == colorD) && (colorB != colorC)) {
|
||||
if (((colorA == colorE) && (colorB == colorL)) ||
|
||||
((colorA == colorC) && (colorA == colorF)
|
||||
&& (colorB != colorE) && (colorB == colorJ))) {
|
||||
product = colorA;
|
||||
} else {
|
||||
product = INTERPOLATE (colorA, colorB);
|
||||
}
|
||||
|
||||
if (((colorA == colorG) && (colorC == colorO)) ||
|
||||
((colorA == colorB) && (colorA == colorH)
|
||||
&& (colorG != colorC) && (colorC == colorM))) {
|
||||
product1 = colorA;
|
||||
} else {
|
||||
product1 = INTERPOLATE (colorA, colorC);
|
||||
}
|
||||
product2 = colorA;
|
||||
} else if ((colorB == colorC) && (colorA != colorD)) {
|
||||
if (((colorB == colorF) && (colorA == colorH)) ||
|
||||
((colorB == colorE) && (colorB == colorD)
|
||||
&& (colorA != colorF) && (colorA == colorI))) {
|
||||
product = colorB;
|
||||
} else {
|
||||
product = INTERPOLATE (colorA, colorB);
|
||||
}
|
||||
|
||||
if (((colorC == colorH) && (colorA == colorF)) ||
|
||||
((colorC == colorG) && (colorC == colorD)
|
||||
&& (colorA != colorH) && (colorA == colorI))) {
|
||||
product1 = colorC;
|
||||
} else {
|
||||
product1 = INTERPOLATE (colorA, colorC);
|
||||
}
|
||||
product2 = colorB;
|
||||
} else if ((colorA == colorD) && (colorB == colorC)) {
|
||||
if (colorA == colorB) {
|
||||
product = colorA;
|
||||
product1 = colorA;
|
||||
product2 = colorA;
|
||||
} else {
|
||||
register int r = 0;
|
||||
|
||||
product1 = INTERPOLATE (colorA, colorC);
|
||||
product = INTERPOLATE (colorA, colorB);
|
||||
|
||||
r +=
|
||||
GetResult1 (colorA, colorB, colorG, colorE,
|
||||
colorI);
|
||||
r +=
|
||||
GetResult2 (colorB, colorA, colorK, colorF,
|
||||
colorJ);
|
||||
r +=
|
||||
GetResult2 (colorB, colorA, colorH, colorN,
|
||||
colorM);
|
||||
r +=
|
||||
GetResult1 (colorA, colorB, colorL, colorO,
|
||||
colorP);
|
||||
|
||||
if (r > 0)
|
||||
product2 = colorA;
|
||||
else if (r < 0)
|
||||
product2 = colorB;
|
||||
else {
|
||||
product2 =
|
||||
Q_INTERPOLATE (colorA, colorB, colorC,
|
||||
colorD);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD);
|
||||
|
||||
if ((colorA == colorC) && (colorA == colorF)
|
||||
&& (colorB != colorE) && (colorB == colorJ)) {
|
||||
product = colorA;
|
||||
} else if ((colorB == colorE) && (colorB == colorD)
|
||||
&& (colorA != colorF) && (colorA == colorI)) {
|
||||
product = colorB;
|
||||
} else {
|
||||
product = INTERPOLATE (colorA, colorB);
|
||||
}
|
||||
|
||||
if ((colorA == colorB) && (colorA == colorH)
|
||||
&& (colorG != colorC) && (colorC == colorM)) {
|
||||
product1 = colorA;
|
||||
} else if ((colorC == colorG) && (colorC == colorD)
|
||||
&& (colorA != colorH) && (colorA == colorI)) {
|
||||
product1 = colorC;
|
||||
} else {
|
||||
product1 = INTERPOLATE (colorA, colorC);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
product = (colorA << 16) | product ;
|
||||
product1 = (product1 << 16) | product2 ;
|
||||
#else
|
||||
product = colorA | (product << 16);
|
||||
product1 = product1 | (product2 << 16);
|
||||
#endif
|
||||
*((s32 *) dP) = product;
|
||||
*((u32 *) (dP + dstPitch)) = product1;
|
||||
|
||||
bP += inc_bP;
|
||||
dP += sizeof (u32);
|
||||
} // end of for ( finish= width etc..)
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
deltaPtr += srcPitch;
|
||||
} // endof: for (height; height; height--)
|
||||
}
|
||||
}
|
||||
|
||||
void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -1132,147 +667,3 @@ static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x,
|
|||
|
||||
return (result & redblueMask) | ((result >> 16) & greenMask);
|
||||
}
|
||||
|
||||
void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch,
|
||||
u32 dstWidth, u32 dstHeight, int width, int height)
|
||||
{
|
||||
u8 *dP;
|
||||
u16 *bP;
|
||||
|
||||
u32 w;
|
||||
u32 h;
|
||||
u32 dw;
|
||||
u32 dh;
|
||||
u32 hfinish;
|
||||
u32 wfinish;
|
||||
|
||||
u32 Nextline = srcPitch >> 1;
|
||||
|
||||
wfinish = (width - 1) << 16; // convert to fixed point
|
||||
dw = wfinish / (dstWidth - 1);
|
||||
hfinish = (height - 1) << 16; // convert to fixed point
|
||||
dh = hfinish / (dstHeight - 1);
|
||||
|
||||
for (h = 0; h < hfinish; h += dh) {
|
||||
u32 y1, y2;
|
||||
|
||||
y1 = h & 0xffff; // fraction part of fixed point
|
||||
bP = (u16 *) (srcPtr + ((h >> 16) * srcPitch));
|
||||
dP = dstPtr;
|
||||
y2 = 0x10000 - y1;
|
||||
|
||||
w = 0;
|
||||
|
||||
for (; w < wfinish;) {
|
||||
u32 A, B, C, D;
|
||||
u32 E, F, G, H;
|
||||
u32 I, J, K, L;
|
||||
u32 x1, x2, a1, f1, f2;
|
||||
u32 position, product1;
|
||||
|
||||
position = w >> 16;
|
||||
A = bP[position]; // current pixel
|
||||
B = bP[position + 1]; // next pixel
|
||||
C = bP[position + Nextline];
|
||||
D = bP[position + Nextline + 1];
|
||||
E = bP[position - Nextline];
|
||||
F = bP[position - Nextline + 1];
|
||||
G = bP[position - 1];
|
||||
H = bP[position + Nextline - 1];
|
||||
I = bP[position + 2];
|
||||
J = bP[position + Nextline + 2];
|
||||
K = bP[position + Nextline + Nextline];
|
||||
L = bP[position + Nextline + Nextline + 1];
|
||||
|
||||
x1 = w & 0xffff; // fraction part of fixed point
|
||||
x2 = 0x10000 - x1;
|
||||
|
||||
/*0*/
|
||||
if (A == B && C == D && A == C)
|
||||
product1 = A;
|
||||
else /*1*/ if (A == D && B != C) {
|
||||
f1 = (x1 >> 1) + (0x10000 >> 2);
|
||||
f2 = (y1 >> 1) + (0x10000 >> 2);
|
||||
if (y1 <= f1 && A == J && A != E) // close to B
|
||||
{
|
||||
a1 = f1 - y1;
|
||||
product1 = Bilinear (A, B, a1);
|
||||
} else if (y1 >= f1 && A == G && A != L) // close to C
|
||||
{
|
||||
a1 = y1 - f1;
|
||||
product1 = Bilinear (A, C, a1);
|
||||
}
|
||||
else if (x1 >= f2 && A == E && A != J) // close to B
|
||||
{
|
||||
a1 = x1 - f2;
|
||||
product1 = Bilinear (A, B, a1);
|
||||
}
|
||||
else if (x1 <= f2 && A == L && A != G) // close to C
|
||||
{
|
||||
a1 = f2 - x1;
|
||||
product1 = Bilinear (A, C, a1);
|
||||
}
|
||||
else if (y1 >= x1) // close to C
|
||||
{
|
||||
a1 = y1 - x1;
|
||||
product1 = Bilinear (A, C, a1);
|
||||
}
|
||||
else if (y1 <= x1) // close to B
|
||||
{
|
||||
a1 = x1 - y1;
|
||||
product1 = Bilinear (A, B, a1);
|
||||
}
|
||||
}
|
||||
else
|
||||
/*2*/
|
||||
if (B == C && A != D)
|
||||
{
|
||||
f1 = (x1 >> 1) + (0x10000 >> 2);
|
||||
f2 = (y1 >> 1) + (0x10000 >> 2);
|
||||
if (y2 >= f1 && B == H && B != F) // close to A
|
||||
{
|
||||
a1 = y2 - f1;
|
||||
product1 = Bilinear (B, A, a1);
|
||||
}
|
||||
else if (y2 <= f1 && B == I && B != K) // close to D
|
||||
{
|
||||
a1 = f1 - y2;
|
||||
product1 = Bilinear (B, D, a1);
|
||||
}
|
||||
else if (x2 >= f2 && B == F && B != H) // close to A
|
||||
{
|
||||
a1 = x2 - f2;
|
||||
product1 = Bilinear (B, A, a1);
|
||||
}
|
||||
else if (x2 <= f2 && B == K && B != I) // close to D
|
||||
{
|
||||
a1 = f2 - x2;
|
||||
product1 = Bilinear (B, D, a1);
|
||||
}
|
||||
else if (y2 >= x1) // close to A
|
||||
{
|
||||
a1 = y2 - x1;
|
||||
product1 = Bilinear (B, A, a1);
|
||||
}
|
||||
else if (y2 <= x1) // close to D
|
||||
{
|
||||
a1 = x1 - y2;
|
||||
product1 = Bilinear (B, D, a1);
|
||||
}
|
||||
}
|
||||
/*3*/
|
||||
else
|
||||
{
|
||||
product1 = Bilinear4 (A, B, C, D, x1, y1);
|
||||
}
|
||||
|
||||
//end First Pixel
|
||||
*(u32 *) dP = product1;
|
||||
dP += 2;
|
||||
w += dw;
|
||||
}
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,471 +39,6 @@
|
|||
|
||||
#ifdef MMX
|
||||
extern "C" bool cpu_mmx;
|
||||
#endif
|
||||
|
||||
static void internal_scale2x_16_def(u16 *dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) {
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
static void internal_scale2x_32_def(u32* dst,
|
||||
const u32* src0,
|
||||
const u32* src1,
|
||||
const u32* src2,
|
||||
unsigned count)
|
||||
{
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
#ifdef MMX
|
||||
static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) {
|
||||
/* always do the first and last run */
|
||||
count -= 2*4;
|
||||
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__(
|
||||
/* first run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq 0(%1), %%mm0\n"
|
||||
"movq 0(%1),%%mm7\n"
|
||||
"movq 8(%1),%%mm1\n"
|
||||
"psllq $48,%%mm0\n"
|
||||
"psllq $48,%%mm1\n"
|
||||
"psrlq $48, %%mm0\n"
|
||||
"movq %%mm7,%%mm2\n"
|
||||
"movq %%mm7,%%mm3\n"
|
||||
"psllq $16,%%mm2\n"
|
||||
"psrlq $16,%%mm3\n"
|
||||
"por %%mm2,%%mm0\n"
|
||||
"por %%mm3,%%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0),%%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"movq %%mm0,%%mm3\n"
|
||||
"movq %%mm1,%%mm5\n"
|
||||
"pcmpeqw %%mm6,%%mm2\n"
|
||||
"pcmpeqw %%mm6,%%mm4\n"
|
||||
"pcmpeqw (%2),%%mm3\n"
|
||||
"pcmpeqw (%2),%%mm5\n"
|
||||
"pandn %%mm2,%%mm3\n"
|
||||
"pandn %%mm4,%%mm5\n"
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"pcmpeqw %%mm1,%%mm2\n"
|
||||
"pcmpeqw %%mm0,%%mm4\n"
|
||||
"pandn %%mm3,%%mm2\n"
|
||||
"pandn %%mm5,%%mm4\n"
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"movq %%mm4,%%mm5\n"
|
||||
"pand %%mm6,%%mm2\n"
|
||||
"pand %%mm6,%%mm4\n"
|
||||
"pandn %%mm7,%%mm3\n"
|
||||
"pandn %%mm7,%%mm5\n"
|
||||
"por %%mm3,%%mm2\n"
|
||||
"por %%mm5,%%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"punpcklwd %%mm4,%%mm2\n"
|
||||
"punpckhwd %%mm4,%%mm3\n"
|
||||
"movq %%mm2,(%3)\n"
|
||||
"movq %%mm3,8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8,%0\n"
|
||||
"addl $8,%1\n"
|
||||
"addl $8,%2\n"
|
||||
"addl $16,%3\n"
|
||||
|
||||
/* central runs */
|
||||
"shrl $2,%4\n"
|
||||
"jz 1f\n"
|
||||
|
||||
"0:\n"
|
||||
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq -8(%1),%%mm0\n"
|
||||
"movq (%1),%%mm7\n"
|
||||
"movq 8(%1),%%mm1\n"
|
||||
"psrlq $48,%%mm0\n"
|
||||
"psllq $48,%%mm1\n"
|
||||
"movq %%mm7,%%mm2\n"
|
||||
"movq %%mm7,%%mm3\n"
|
||||
"psllq $16,%%mm2\n"
|
||||
"psrlq $16,%%mm3\n"
|
||||
"por %%mm2,%%mm0\n"
|
||||
"por %%mm3,%%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0),%%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"movq %%mm0,%%mm3\n"
|
||||
"movq %%mm1,%%mm5\n"
|
||||
"pcmpeqw %%mm6,%%mm2\n"
|
||||
"pcmpeqw %%mm6,%%mm4\n"
|
||||
"pcmpeqw (%2),%%mm3\n"
|
||||
"pcmpeqw (%2),%%mm5\n"
|
||||
"pandn %%mm2,%%mm3\n"
|
||||
"pandn %%mm4,%%mm5\n"
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"pcmpeqw %%mm1,%%mm2\n"
|
||||
"pcmpeqw %%mm0,%%mm4\n"
|
||||
"pandn %%mm3,%%mm2\n"
|
||||
"pandn %%mm5,%%mm4\n"
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"movq %%mm4,%%mm5\n"
|
||||
"pand %%mm6,%%mm2\n"
|
||||
"pand %%mm6,%%mm4\n"
|
||||
"pandn %%mm7,%%mm3\n"
|
||||
"pandn %%mm7,%%mm5\n"
|
||||
"por %%mm3,%%mm2\n"
|
||||
"por %%mm5,%%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"punpcklwd %%mm4,%%mm2\n"
|
||||
"punpckhwd %%mm4,%%mm3\n"
|
||||
"movq %%mm2,(%3)\n"
|
||||
"movq %%mm3,8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8,%0\n"
|
||||
"addl $8,%1\n"
|
||||
"addl $8,%2\n"
|
||||
"addl $16,%3\n"
|
||||
|
||||
"decl %4\n"
|
||||
"jnz 0b\n"
|
||||
"1:\n"
|
||||
|
||||
/* final run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq (%1),%%mm1\n"
|
||||
"movq (%1),%%mm7\n"
|
||||
"movq -8(%1),%%mm0\n"
|
||||
"psrlq $48,%%mm1\n"
|
||||
"psrlq $48,%%mm0\n"
|
||||
"psllq $48,%%mm1\n"
|
||||
"movq %%mm7,%%mm2\n"
|
||||
"movq %%mm7,%%mm3\n"
|
||||
"psllq $16,%%mm2\n"
|
||||
"psrlq $16,%%mm3\n"
|
||||
"por %%mm2,%%mm0\n"
|
||||
"por %%mm3,%%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0),%%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"movq %%mm0,%%mm3\n"
|
||||
"movq %%mm1,%%mm5\n"
|
||||
"pcmpeqw %%mm6,%%mm2\n"
|
||||
"pcmpeqw %%mm6,%%mm4\n"
|
||||
"pcmpeqw (%2),%%mm3\n"
|
||||
"pcmpeqw (%2),%%mm5\n"
|
||||
"pandn %%mm2,%%mm3\n"
|
||||
"pandn %%mm4,%%mm5\n"
|
||||
"movq %%mm0,%%mm2\n"
|
||||
"movq %%mm1,%%mm4\n"
|
||||
"pcmpeqw %%mm1,%%mm2\n"
|
||||
"pcmpeqw %%mm0,%%mm4\n"
|
||||
"pandn %%mm3,%%mm2\n"
|
||||
"pandn %%mm5,%%mm4\n"
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"movq %%mm4,%%mm5\n"
|
||||
"pand %%mm6,%%mm2\n"
|
||||
"pand %%mm6,%%mm4\n"
|
||||
"pandn %%mm7,%%mm3\n"
|
||||
"pandn %%mm7,%%mm5\n"
|
||||
"por %%mm3,%%mm2\n"
|
||||
"por %%mm5,%%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2,%%mm3\n"
|
||||
"punpcklwd %%mm4,%%mm2\n"
|
||||
"punpckhwd %%mm4,%%mm3\n"
|
||||
"movq %%mm2,(%3)\n"
|
||||
"movq %%mm3,8(%3)\n"
|
||||
"emms\n"
|
||||
|
||||
: "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count)
|
||||
:
|
||||
: "cc"
|
||||
);
|
||||
#else
|
||||
__asm {
|
||||
mov eax, src0;
|
||||
mov ebx, src1;
|
||||
mov ecx, src2;
|
||||
mov edx, dst;
|
||||
mov esi, count;
|
||||
|
||||
/* first run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
movq mm0, qword ptr [ebx];
|
||||
movq mm7, qword ptr [ebx];
|
||||
movq mm1, qword ptr [ebx + 8];
|
||||
psllq mm0, 48;
|
||||
psllq mm1, 48;
|
||||
psrlq mm0, 48;
|
||||
movq mm2, mm7;
|
||||
movq mm3, mm7;
|
||||
psllq mm2, 16;
|
||||
psrlq mm3, 16;
|
||||
por mm0, mm2;
|
||||
por mm1, mm3;
|
||||
|
||||
/* current_upper */
|
||||
movq mm6, qword ptr [eax];
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
movq mm2, mm0;
|
||||
movq mm4, mm1;
|
||||
movq mm3, mm0;
|
||||
movq mm5, mm1;
|
||||
pcmpeqw mm2, mm6;
|
||||
pcmpeqw mm4, mm6;
|
||||
pcmpeqw mm3, qword ptr [ecx];
|
||||
pcmpeqw mm5, qword ptr [ecx];
|
||||
pandn mm3,mm2;
|
||||
pandn mm5,mm4;
|
||||
movq mm2,mm0;
|
||||
movq mm4,mm1;
|
||||
pcmpeqw mm2,mm1;
|
||||
pcmpeqw mm4,mm0;
|
||||
pandn mm2,mm3;
|
||||
pandn mm4,mm5;
|
||||
movq mm3,mm2;
|
||||
movq mm5,mm4;
|
||||
pand mm2,mm6;
|
||||
pand mm4,mm6;
|
||||
pandn mm3,mm7;
|
||||
pandn mm5,mm7;
|
||||
por mm2,mm3;
|
||||
por mm4,mm5;
|
||||
|
||||
/* set *dst0 */
|
||||
movq mm3,mm2;
|
||||
punpcklwd mm2,mm4;
|
||||
punpckhwd mm3,mm4;
|
||||
movq qword ptr [edx], mm2;
|
||||
movq qword ptr [edx + 8], mm3;
|
||||
|
||||
/* next */
|
||||
add eax, 8;
|
||||
add ebx, 8;
|
||||
add ecx, 8;
|
||||
add edx, 16;
|
||||
|
||||
/* central runs */
|
||||
shr esi, 2;
|
||||
jz label1;
|
||||
align 4;
|
||||
label0:
|
||||
|
||||
/* set the current, current_pre, current_next registers */
|
||||
movq mm0, qword ptr [ebx-8];
|
||||
movq mm7, qword ptr [ebx];
|
||||
movq mm1, qword ptr [ebx+8];
|
||||
psrlq mm0,48;
|
||||
psllq mm1,48;
|
||||
movq mm2,mm7;
|
||||
movq mm3,mm7;
|
||||
psllq mm2,16;
|
||||
psrlq mm3,16;
|
||||
por mm0,mm2;
|
||||
por mm1,mm3;
|
||||
|
||||
/* current_upper */
|
||||
movq mm6, qword ptr [eax];
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
movq mm2,mm0;
|
||||
movq mm4,mm1;
|
||||
movq mm3,mm0;
|
||||
movq mm5,mm1;
|
||||
pcmpeqw mm2,mm6;
|
||||
pcmpeqw mm4,mm6;
|
||||
pcmpeqw mm3, qword ptr [ecx];
|
||||
pcmpeqw mm5, qword ptr [ecx];
|
||||
pandn mm3,mm2;
|
||||
pandn mm5,mm4;
|
||||
movq mm2,mm0;
|
||||
movq mm4,mm1;
|
||||
pcmpeqw mm2,mm1;
|
||||
pcmpeqw mm4,mm0;
|
||||
pandn mm2,mm3;
|
||||
pandn mm4,mm5;
|
||||
movq mm3,mm2;
|
||||
movq mm5,mm4;
|
||||
pand mm2,mm6;
|
||||
pand mm4,mm6;
|
||||
pandn mm3,mm7;
|
||||
pandn mm5,mm7;
|
||||
por mm2,mm3;
|
||||
por mm4,mm5;
|
||||
|
||||
/* set *dst */
|
||||
movq mm3,mm2;
|
||||
punpcklwd mm2,mm4;
|
||||
punpckhwd mm3,mm4;
|
||||
movq qword ptr [edx], mm2;
|
||||
movq qword ptr [edx+8], mm3;
|
||||
|
||||
/* next */
|
||||
add eax,8;
|
||||
add ebx,8;
|
||||
add ecx,8;
|
||||
add edx,16;
|
||||
|
||||
dec esi;
|
||||
jnz label0;
|
||||
label1:
|
||||
|
||||
/* final run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
movq mm1, qword ptr [ebx];
|
||||
movq mm7, qword ptr [ebx];
|
||||
movq mm0, qword ptr [ebx-8];
|
||||
psrlq mm1,48;
|
||||
psrlq mm0,48;
|
||||
psllq mm1,48;
|
||||
movq mm2,mm7;
|
||||
movq mm3,mm7;
|
||||
psllq mm2,16;
|
||||
psrlq mm3,16;
|
||||
por mm0,mm2;
|
||||
por mm1,mm3;
|
||||
|
||||
/* current_upper */
|
||||
movq mm6, qword ptr [eax];
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
movq mm2,mm0;
|
||||
movq mm4,mm1;
|
||||
movq mm3,mm0;
|
||||
movq mm5,mm1;
|
||||
pcmpeqw mm2,mm6;
|
||||
pcmpeqw mm4,mm6;
|
||||
pcmpeqw mm3, qword ptr [ecx];
|
||||
pcmpeqw mm5, qword ptr [ecx];
|
||||
pandn mm3,mm2;
|
||||
pandn mm5,mm4;
|
||||
movq mm2,mm0;
|
||||
movq mm4,mm1;
|
||||
pcmpeqw mm2,mm1;
|
||||
pcmpeqw mm4,mm0;
|
||||
pandn mm2,mm3;
|
||||
pandn mm4,mm5;
|
||||
movq mm3,mm2;
|
||||
movq mm5,mm4;
|
||||
pand mm2,mm6;
|
||||
pand mm4,mm6;
|
||||
pandn mm3,mm7;
|
||||
pandn mm5,mm7;
|
||||
por mm2,mm3;
|
||||
por mm4,mm5;
|
||||
|
||||
/* set *dst */
|
||||
movq mm3,mm2;
|
||||
punpcklwd mm2,mm4;
|
||||
punpckhwd mm3,mm4;
|
||||
movq qword ptr [edx], mm2;
|
||||
movq qword ptr [edx+8], mm3;
|
||||
|
||||
mov src0, eax;
|
||||
mov src1, ebx;
|
||||
mov src2, ecx;
|
||||
mov dst, edx;
|
||||
mov count, esi;
|
||||
|
||||
emms;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void internal_scale2x_32_mmx_single(u32* dst, const u32* src0, const u32* src1, const u32* src2, unsigned count) {
|
||||
/* always do the first and last run */
|
||||
|
@ -886,12 +421,6 @@ label1:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void internal_scale2x_16_mmx(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) {
|
||||
// assert( count >= 2*4 );
|
||||
internal_scale2x_16_mmx_single(dst0, src0, src1, src2, count);
|
||||
internal_scale2x_16_mmx_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
static void internal_scale2x_32_mmx(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count) {
|
||||
// assert( count >= 2*2 );
|
||||
internal_scale2x_32_mmx_single(dst0, src0, src1, src2, count);
|
||||
|
@ -899,59 +428,48 @@ static void internal_scale2x_32_mmx(u32* dst0, u32* dst1, const u32* src0, const
|
|||
}
|
||||
#endif
|
||||
|
||||
void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
|
||||
static void internal_scale2x_32_def(u32* dst,
|
||||
const u32* src0,
|
||||
const u32* src1,
|
||||
const u32* src2,
|
||||
unsigned count)
|
||||
{
|
||||
u16 *dst0 = (u16 *)dstPtr;
|
||||
u16 *dst1 = dst0 + (dstPitch >> 1);
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
u16 *src0 = (u16 *)srcPtr;
|
||||
u16 *src1 = src0 + (srcPitch >> 1);
|
||||
u16 *src2 = src1 + (srcPitch >> 1);
|
||||
#ifdef MMX
|
||||
if(cpu_mmx) {
|
||||
internal_scale2x_16_mmx(dst0, dst1, src0, src0, src1, width);
|
||||
|
||||
int count = height;
|
||||
|
||||
count -= 2;
|
||||
while(count) {
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
internal_scale2x_16_mmx(dst0, dst1, src0, src1, src2, width);
|
||||
src0 = src1;
|
||||
src1 = src2;
|
||||
src2 += srcPitch >> 1;
|
||||
--count;
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
internal_scale2x_16_mmx(dst0, dst1, src0, src1, src1, width);
|
||||
} else {
|
||||
#endif
|
||||
internal_scale2x_16_def(dst0, src0, src0, src1, width);
|
||||
internal_scale2x_16_def(dst1, src1, src0, src0, width);
|
||||
|
||||
int count = height;
|
||||
|
||||
count -= 2;
|
||||
while(count) {
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
internal_scale2x_16_def(dst0, src0, src1, src2, width);
|
||||
internal_scale2x_16_def(dst1, src2, src1, src0, width);
|
||||
src0 = src1;
|
||||
src1 = src2;
|
||||
src2 += srcPitch >> 1;
|
||||
--count;
|
||||
}
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
internal_scale2x_16_def(dst0, src0, src1, src1, width);
|
||||
internal_scale2x_16_def(dst1, src1, src1, src0, width);
|
||||
#ifdef MMX
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
void AdMame2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
|
|
|
@ -10,29 +10,6 @@
|
|||
((g) >> 3) << systemGreenShift |\
|
||||
((b) >> 3) << systemBlueShift\
|
||||
|
||||
static void fill_rgb_row_16(u16 *from, int src_width, u8 *row, int width)
|
||||
{
|
||||
u8 *copy_start = row + src_width*3;
|
||||
u8 *all_stop = row + width*3;
|
||||
while (row < copy_start) {
|
||||
u16 color = *from++;
|
||||
*row++ = ((color >> systemRedShift) & 0x1f) << 3;
|
||||
*row++ = ((color >> systemGreenShift) & 0x1f) << 3;
|
||||
*row++ = ((color >> systemBlueShift) & 0x1f) << 3;
|
||||
}
|
||||
// any remaining elements to be written to 'row' are a replica of the
|
||||
// preceding pixel
|
||||
u8 *p = row-3;
|
||||
while (row < all_stop) {
|
||||
// we're guaranteed three elements per pixel; could unroll the loop
|
||||
// further, especially with a Duff's Device, but the gains would be
|
||||
// probably limited (judging by profiler output)
|
||||
*row++ = *p++;
|
||||
*row++ = *p++;
|
||||
*row++ = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width)
|
||||
{
|
||||
u8 *copy_start = row + src_width*3;
|
||||
|
@ -56,182 +33,6 @@ static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width)
|
|||
}
|
||||
}
|
||||
|
||||
void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 row_cur[3*322];
|
||||
u8 row_next[3*322];
|
||||
u8 *rgb_row_cur = row_cur;
|
||||
u8 *rgb_row_next = row_next;
|
||||
|
||||
u16 *to = (u16 *)dstPtr;
|
||||
u16 *to_odd = (u16 *)(dstPtr + dstPitch);
|
||||
|
||||
int from_width = width;
|
||||
u16 *from = (u16 *)srcPtr;
|
||||
fill_rgb_row_16(from, from_width, rgb_row_cur, width+1);
|
||||
|
||||
for(int y = 0; y < height; y++) {
|
||||
u16 *from_orig = from;
|
||||
u16 *to_orig = to;
|
||||
|
||||
if (y+1 < height)
|
||||
fill_rgb_row_16(from+width+2, from_width, rgb_row_next,
|
||||
width+1);
|
||||
else
|
||||
fill_rgb_row_16(from, from_width, rgb_row_next, width+1);
|
||||
|
||||
// every pixel in the src region, is extended to 4 pixels in the
|
||||
// destination, arranged in a square 'quad'; if the current src
|
||||
// pixel is 'a', then in what follows 'b' is the src pixel to the
|
||||
// right, 'c' is the src pixel below, and 'd' is the src pixel to
|
||||
// the right and down
|
||||
u8 *cur_row = rgb_row_cur;
|
||||
u8 *next_row = rgb_row_next;
|
||||
u8 *ar = cur_row++;
|
||||
u8 *ag = cur_row++;
|
||||
u8 *ab = cur_row++;
|
||||
u8 *cr = next_row++;
|
||||
u8 *cg = next_row++;
|
||||
u8 *cb = next_row++;
|
||||
for(int x=0; x < width; x++) {
|
||||
u8 *br = cur_row++;
|
||||
u8 *bg = cur_row++;
|
||||
u8 *bb = cur_row++;
|
||||
u8 *dr = next_row++;
|
||||
u8 *dg = next_row++;
|
||||
u8 *db = next_row++;
|
||||
|
||||
// upper left pixel in quad: just copy it in
|
||||
*to++ = RGB(*ar, *ag, *ab);
|
||||
|
||||
// upper right
|
||||
*to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
|
||||
|
||||
// lower left
|
||||
*to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1);
|
||||
|
||||
// lower right
|
||||
*to_odd++ = RGB((*ar+*br+*cr+*dr)>>2,
|
||||
(*ag+*bg+*cg+*dg)>>2,
|
||||
(*ab+*bb+*cb+*db)>>2);
|
||||
|
||||
// 'b' becomes 'a', 'd' becomes 'c'
|
||||
ar = br;
|
||||
ag = bg;
|
||||
ab = bb;
|
||||
cr = dr;
|
||||
cg = dg;
|
||||
cb = db;
|
||||
}
|
||||
|
||||
// the "next" rgb row becomes the current; the old current rgb row is
|
||||
// recycled and serves as the new "next" row
|
||||
u8 *temp;
|
||||
temp = rgb_row_cur;
|
||||
rgb_row_cur = rgb_row_next;
|
||||
rgb_row_next = temp;
|
||||
|
||||
// update the pointers for start of next pair of lines
|
||||
from = (u16 *)((u8 *)from_orig + srcPitch);
|
||||
to = (u16 *)((u8 *)to_orig + (dstPitch << 1));
|
||||
to_odd = (u16 *)((u8 *)to + dstPitch);
|
||||
}
|
||||
}
|
||||
|
||||
void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 row_cur[3*322];
|
||||
u8 row_next[3*322];
|
||||
u8 *rgb_row_cur = row_cur;
|
||||
u8 *rgb_row_next = row_next;
|
||||
|
||||
u16 *to = (u16 *)dstPtr;
|
||||
u16 *to_odd = (u16 *)(dstPtr + dstPitch);
|
||||
|
||||
int from_width = width;
|
||||
u16 *from = (u16 *)srcPtr;
|
||||
fill_rgb_row_16(from, from_width, rgb_row_cur, width+1);
|
||||
|
||||
for(int y = 0; y < height; y++) {
|
||||
u16 *from_orig = from;
|
||||
u16 *to_orig = to;
|
||||
|
||||
if (y+1 < height)
|
||||
fill_rgb_row_16(from+width+2, from_width, rgb_row_next,
|
||||
width+1);
|
||||
else
|
||||
fill_rgb_row_16(from, from_width, rgb_row_next, width+1);
|
||||
|
||||
// every pixel in the src region, is extended to 4 pixels in the
|
||||
// destination, arranged in a square 'quad'; if the current src
|
||||
// pixel is 'a', then in what follows 'b' is the src pixel to the
|
||||
// right, 'c' is the src pixel below, and 'd' is the src pixel to
|
||||
// the right and down
|
||||
u8 *cur_row = rgb_row_cur;
|
||||
u8 *next_row = rgb_row_next;
|
||||
u8 *ar = cur_row++;
|
||||
u8 *ag = cur_row++;
|
||||
u8 *ab = cur_row++;
|
||||
u8 *cr = next_row++;
|
||||
u8 *cg = next_row++;
|
||||
u8 *cb = next_row++;
|
||||
for(int x=0; x < width; x++) {
|
||||
u8 *br = cur_row++;
|
||||
u8 *bg = cur_row++;
|
||||
u8 *bb = cur_row++;
|
||||
u8 *dr = next_row++;
|
||||
u8 *dg = next_row++;
|
||||
u8 *db = next_row++;
|
||||
|
||||
// upper left pixel in quad: just copy it in
|
||||
//*to++ = manip.rgb(*ar, *ag, *ab);
|
||||
#ifdef USE_ORIGINAL_BILINEAR_PLUS
|
||||
*to++ = RGB(
|
||||
(((*ar)<<2) +((*ar)) + (*cr+*br+*br) )>> 3,
|
||||
(((*ag)<<2) +((*ag)) + (*cg+*bg+*bg) )>> 3,
|
||||
(((*ab)<<2) +((*ab)) + (*cb+*bb+*bb) )>> 3);
|
||||
#else
|
||||
*to++ = RGB(
|
||||
(((*ar)<<3) +((*ar)<<1) + (*cr+*br+*br+*cr) )>> 4,
|
||||
(((*ag)<<3) +((*ag)<<1) + (*cg+*bg+*bg+*cg) )>> 4,
|
||||
(((*ab)<<3) +((*ab)<<1) + (*cb+*bb+*bb+*cb) )>> 4);
|
||||
#endif
|
||||
|
||||
// upper right
|
||||
*to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
|
||||
|
||||
// lower left
|
||||
*to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1);
|
||||
|
||||
// lower right
|
||||
*to_odd++ = RGB((*ar+*br+*cr+*dr)>>2,
|
||||
(*ag+*bg+*cg+*dg)>>2,
|
||||
(*ab+*bb+*cb+*db)>>2);
|
||||
|
||||
// 'b' becomes 'a', 'd' becomes 'c'
|
||||
ar = br;
|
||||
ag = bg;
|
||||
ab = bb;
|
||||
cr = dr;
|
||||
cg = dg;
|
||||
cb = db;
|
||||
}
|
||||
|
||||
// the "next" rgb row becomes the current; the old current rgb row is
|
||||
// recycled and serves as the new "next" row
|
||||
u8 *temp;
|
||||
temp = rgb_row_cur;
|
||||
rgb_row_cur = rgb_row_next;
|
||||
rgb_row_next = temp;
|
||||
|
||||
// update the pointers for start of next pair of lines
|
||||
from = (u16 *)((u8 *)from_orig + srcPitch);
|
||||
to = (u16 *)((u8 *)to_orig + (dstPitch << 1));
|
||||
to_odd = (u16 *)((u8 *)to + dstPitch);
|
||||
}
|
||||
}
|
||||
|
||||
void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
|
|
|
@ -37,116 +37,6 @@
|
|||
* This effect is a rewritten implementation of the hq2x effect made by Maxim Stepin
|
||||
*/
|
||||
|
||||
static void hq2x_16_def(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for(i=0;i<count;++i) {
|
||||
unsigned char mask;
|
||||
|
||||
u16 c[9];
|
||||
|
||||
c[1] = src0[0];
|
||||
c[4] = src1[0];
|
||||
c[7] = src2[0];
|
||||
|
||||
if (i>0) {
|
||||
c[0] = src0[-1];
|
||||
c[3] = src1[-1];
|
||||
c[6] = src2[-1];
|
||||
} else {
|
||||
c[0] = c[1];
|
||||
c[3] = c[4];
|
||||
c[6] = c[7];
|
||||
}
|
||||
|
||||
if (i<count-1) {
|
||||
c[2] = src0[1];
|
||||
c[5] = src1[1];
|
||||
c[8] = src2[1];
|
||||
} else {
|
||||
c[2] = c[1];
|
||||
c[5] = c[4];
|
||||
c[8] = c[7];
|
||||
}
|
||||
|
||||
mask = 0;
|
||||
|
||||
if (interp_16_diff(c[0], c[4]))
|
||||
mask |= 1 << 0;
|
||||
if (interp_16_diff(c[1], c[4]))
|
||||
mask |= 1 << 1;
|
||||
if (interp_16_diff(c[2], c[4]))
|
||||
mask |= 1 << 2;
|
||||
if (interp_16_diff(c[3], c[4]))
|
||||
mask |= 1 << 3;
|
||||
if (interp_16_diff(c[5], c[4]))
|
||||
mask |= 1 << 4;
|
||||
if (interp_16_diff(c[6], c[4]))
|
||||
mask |= 1 << 5;
|
||||
if (interp_16_diff(c[7], c[4]))
|
||||
mask |= 1 << 6;
|
||||
if (interp_16_diff(c[8], c[4]))
|
||||
mask |= 1 << 7;
|
||||
|
||||
#define P0 dst0[0]
|
||||
#define P1 dst0[1]
|
||||
#define P2 dst1[0]
|
||||
#define P3 dst1[1]
|
||||
#define MUR interp_16_diff(c[1], c[5])
|
||||
#define MDR interp_16_diff(c[5], c[7])
|
||||
#define MDL interp_16_diff(c[7], c[3])
|
||||
#define MUL interp_16_diff(c[3], c[1])
|
||||
#define IC(p0) c[p0]
|
||||
#define I11(p0,p1) interp_16_11(c[p0], c[p1])
|
||||
#define I211(p0,p1,p2) interp_16_211(c[p0], c[p1], c[p2])
|
||||
#define I31(p0,p1) interp_16_31(c[p0], c[p1])
|
||||
#define I332(p0,p1,p2) interp_16_332(c[p0], c[p1], c[p2])
|
||||
#define I431(p0,p1,p2) interp_16_431(c[p0], c[p1], c[p2])
|
||||
#define I521(p0,p1,p2) interp_16_521(c[p0], c[p1], c[p2])
|
||||
#define I53(p0,p1) interp_16_53(c[p0], c[p1])
|
||||
#define I611(p0,p1,p2) interp_16_611(c[p0], c[p1], c[p2])
|
||||
#define I71(p0,p1) interp_16_71(c[p0], c[p1])
|
||||
#define I772(p0,p1,p2) interp_16_772(c[p0], c[p1], c[p2])
|
||||
#define I97(p0,p1) interp_16_97(c[p0], c[p1])
|
||||
#define I1411(p0,p1,p2) interp_16_1411(c[p0], c[p1], c[p2])
|
||||
#define I151(p0,p1) interp_16_151(c[p0], c[p1])
|
||||
|
||||
switch (mask) {
|
||||
#include "hq2x.h"
|
||||
}
|
||||
|
||||
#undef P0
|
||||
#undef P1
|
||||
#undef P2
|
||||
#undef P3
|
||||
#undef MUR
|
||||
#undef MDR
|
||||
#undef MDL
|
||||
#undef MUL
|
||||
#undef IC
|
||||
#undef I11
|
||||
#undef I211
|
||||
#undef I31
|
||||
#undef I332
|
||||
#undef I431
|
||||
#undef I521
|
||||
#undef I53
|
||||
#undef I611
|
||||
#undef I71
|
||||
#undef I772
|
||||
#undef I97
|
||||
#undef I1411
|
||||
#undef I151
|
||||
|
||||
src0 += 1;
|
||||
src1 += 1;
|
||||
src2 += 1;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void hq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -264,116 +154,6 @@ static void hq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1,
|
|||
* This effect is derived from the hq2x effect made by Maxim Stepin
|
||||
*/
|
||||
|
||||
static void lq2x_16_def(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for(i=0;i<count;++i) {
|
||||
unsigned char mask;
|
||||
|
||||
u16 c[9];
|
||||
|
||||
c[1] = src0[0];
|
||||
c[4] = src1[0];
|
||||
c[7] = src2[0];
|
||||
|
||||
if (i>0) {
|
||||
c[0] = src0[-1];
|
||||
c[3] = src1[-1];
|
||||
c[6] = src2[-1];
|
||||
} else {
|
||||
c[0] = c[1];
|
||||
c[3] = c[4];
|
||||
c[6] = c[7];
|
||||
}
|
||||
|
||||
if (i<count-1) {
|
||||
c[2] = src0[1];
|
||||
c[5] = src1[1];
|
||||
c[8] = src2[1];
|
||||
} else {
|
||||
c[2] = c[1];
|
||||
c[5] = c[4];
|
||||
c[8] = c[7];
|
||||
}
|
||||
|
||||
mask = 0;
|
||||
|
||||
if (c[0] != c[4])
|
||||
mask |= 1 << 0;
|
||||
if (c[1] != c[4])
|
||||
mask |= 1 << 1;
|
||||
if (c[2] != c[4])
|
||||
mask |= 1 << 2;
|
||||
if (c[3] != c[4])
|
||||
mask |= 1 << 3;
|
||||
if (c[5] != c[4])
|
||||
mask |= 1 << 4;
|
||||
if (c[6] != c[4])
|
||||
mask |= 1 << 5;
|
||||
if (c[7] != c[4])
|
||||
mask |= 1 << 6;
|
||||
if (c[8] != c[4])
|
||||
mask |= 1 << 7;
|
||||
|
||||
#define P0 dst0[0]
|
||||
#define P1 dst0[1]
|
||||
#define P2 dst1[0]
|
||||
#define P3 dst1[1]
|
||||
#define MUR (c[1] != c[5])
|
||||
#define MDR (c[5] != c[7])
|
||||
#define MDL (c[7] != c[3])
|
||||
#define MUL (c[3] != c[1])
|
||||
#define IC(p0) c[p0]
|
||||
#define I11(p0,p1) interp_16_11(c[p0], c[p1])
|
||||
#define I211(p0,p1,p2) interp_16_211(c[p0], c[p1], c[p2])
|
||||
#define I31(p0,p1) interp_16_31(c[p0], c[p1])
|
||||
#define I332(p0,p1,p2) interp_16_332(c[p0], c[p1], c[p2])
|
||||
#define I431(p0,p1,p2) interp_16_431(c[p0], c[p1], c[p2])
|
||||
#define I521(p0,p1,p2) interp_16_521(c[p0], c[p1], c[p2])
|
||||
#define I53(p0,p1) interp_16_53(c[p0], c[p1])
|
||||
#define I611(p0,p1,p2) interp_16_611(c[p0], c[p1], c[p2])
|
||||
#define I71(p0,p1) interp_16_71(c[p0], c[p1])
|
||||
#define I772(p0,p1,p2) interp_16_772(c[p0], c[p1], c[p2])
|
||||
#define I97(p0,p1) interp_16_97(c[p0], c[p1])
|
||||
#define I1411(p0,p1,p2) interp_16_1411(c[p0], c[p1], c[p2])
|
||||
#define I151(p0,p1) interp_16_151(c[p0], c[p1])
|
||||
|
||||
switch (mask) {
|
||||
#include "lq2x.h"
|
||||
}
|
||||
|
||||
#undef P0
|
||||
#undef P1
|
||||
#undef P2
|
||||
#undef P3
|
||||
#undef MUR
|
||||
#undef MDR
|
||||
#undef MDL
|
||||
#undef MUL
|
||||
#undef IC
|
||||
#undef I11
|
||||
#undef I211
|
||||
#undef I31
|
||||
#undef I332
|
||||
#undef I431
|
||||
#undef I521
|
||||
#undef I53
|
||||
#undef I611
|
||||
#undef I71
|
||||
#undef I772
|
||||
#undef I97
|
||||
#undef I1411
|
||||
#undef I151
|
||||
|
||||
src0 += 1;
|
||||
src1 += 1;
|
||||
src2 += 1;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -484,35 +264,6 @@ static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1,
|
|||
}
|
||||
}
|
||||
|
||||
void hq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u16 *dst0 = (u16 *)dstPtr;
|
||||
u16 *dst1 = dst0 + (dstPitch >> 1);
|
||||
|
||||
u16 *src0 = (u16 *)srcPtr;
|
||||
u16 *src1 = src0 + (srcPitch >> 1);
|
||||
u16 *src2 = src1 + (srcPitch >> 1);
|
||||
|
||||
hq2x_16_def(dst0, dst1, src0, src0, src1, width);
|
||||
|
||||
int count = height;
|
||||
|
||||
count -= 2;
|
||||
while(count) {
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
hq2x_16_def(dst0, dst1, src0, src1, src2, width);
|
||||
src0 = src1;
|
||||
src1 = src2;
|
||||
src2 += srcPitch >> 1;
|
||||
--count;
|
||||
}
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
hq2x_16_def(dst0, dst1, src0, src1, src1, width);
|
||||
}
|
||||
|
||||
void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -541,35 +292,6 @@ void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
|||
hq2x_32_def(dst0, dst1, src0, src1, src1, width);
|
||||
}
|
||||
|
||||
void lq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u16 *dst0 = (u16 *)dstPtr;
|
||||
u16 *dst1 = dst0 + (dstPitch >> 1);
|
||||
|
||||
u16 *src0 = (u16 *)srcPtr;
|
||||
u16 *src1 = src0 + (srcPitch >> 1);
|
||||
u16 *src2 = src1 + (srcPitch >> 1);
|
||||
|
||||
lq2x_16_def(dst0, dst1, src0, src0, src1, width);
|
||||
|
||||
int count = height;
|
||||
|
||||
count -= 2;
|
||||
while(count) {
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
lq2x_16_def(dst0, dst1, src0, src1, src2, width);
|
||||
src0 = src1;
|
||||
src1 = src2;
|
||||
src2 += srcPitch >> 1;
|
||||
--count;
|
||||
}
|
||||
dst0 += dstPitch;
|
||||
dst1 += dstPitch;
|
||||
lq2x_16_def(dst0, dst1, src0, src1, src1, width);
|
||||
}
|
||||
|
||||
void lq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
|
|
@ -2,82 +2,6 @@
|
|||
|
||||
extern int RGB_LOW_BITS_MASK;
|
||||
|
||||
void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *nextLine, *finish;
|
||||
u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16));
|
||||
|
||||
nextLine = dstPtr + dstPitch;
|
||||
|
||||
do {
|
||||
u32 *bP = (u32 *) srcPtr;
|
||||
u32 *xP = (u32 *) deltaPtr;
|
||||
u32 *dP = (u32 *) dstPtr;
|
||||
u32 *nL = (u32 *) nextLine;
|
||||
u32 currentPixel;
|
||||
u32 nextPixel;
|
||||
u32 currentDelta;
|
||||
u32 nextDelta;
|
||||
|
||||
finish = (u8 *) bP + ((width+2) << 1);
|
||||
nextPixel = *bP++;
|
||||
nextDelta = *xP++;
|
||||
|
||||
do {
|
||||
currentPixel = nextPixel;
|
||||
currentDelta = nextDelta;
|
||||
nextPixel = *bP++;
|
||||
nextDelta = *xP++;
|
||||
|
||||
if ((nextPixel != nextDelta) || (currentPixel != currentDelta)) {
|
||||
u32 colorA, colorB, product;
|
||||
|
||||
*(xP - 2) = currentPixel;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
colorA = currentPixel >> 16;
|
||||
colorB = currentPixel & 0xffff;
|
||||
#else
|
||||
colorA = currentPixel & 0xffff;
|
||||
colorB = currentPixel >> 16;
|
||||
#endif
|
||||
product = (((colorA & colorMask) >> 1) & colorMask) >> 1;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
*(nL) = (product << 16) | (product);
|
||||
*(dP) = (colorA << 16) | product;
|
||||
#else
|
||||
*(nL) = product | (product << 16);
|
||||
*(dP) = colorA | (product << 16);
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
colorA = nextPixel >> 16;
|
||||
#else
|
||||
colorA = nextPixel & 0xffff;
|
||||
#endif
|
||||
product = (((colorB & colorMask) >> 1) & colorMask) >> 1;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
*(nL + 1) = (product << 16) | (product);
|
||||
*(dP + 1) = (colorB << 16) | (product);
|
||||
#else
|
||||
*(nL + 1) = (product) | (product << 16);
|
||||
*(dP + 1) = (colorB) | (product << 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
dP += 2;
|
||||
nL += 2;
|
||||
} while ((u8 *) bP < finish);
|
||||
|
||||
deltaPtr += srcPitch;
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
nextLine += dstPitch << 1;
|
||||
}
|
||||
while (--height);
|
||||
}
|
||||
|
||||
void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
|
|
@ -2,59 +2,6 @@
|
|||
|
||||
extern int RGB_LOW_BITS_MASK;
|
||||
|
||||
void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *nextLine, *finish;
|
||||
|
||||
nextLine = dstPtr + dstPitch;
|
||||
|
||||
do {
|
||||
u32 *bP = (u32 *) srcPtr;
|
||||
u32 *dP = (u32 *) dstPtr;
|
||||
u32 *nL = (u32 *) nextLine;
|
||||
u32 currentPixel;
|
||||
u32 nextPixel;
|
||||
|
||||
finish = (u8 *) bP + ((width+2) << 1);
|
||||
nextPixel = *bP++;
|
||||
|
||||
do {
|
||||
currentPixel = nextPixel;
|
||||
nextPixel = *bP++;
|
||||
u32 colorA, colorB;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
colorA = currentPixel >> 16;
|
||||
colorB = currentPixel & 0xffff;
|
||||
#else
|
||||
colorA = currentPixel & 0xffff;
|
||||
colorB = currentPixel >> 16;
|
||||
#endif
|
||||
|
||||
*(dP) = colorA | colorA<<16;
|
||||
*(nL) = 0;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
colorA = nextPixel >> 16;
|
||||
#else
|
||||
colorA = nextPixel & 0xffff;
|
||||
#endif
|
||||
|
||||
*(dP + 1) = colorB | (colorB << 16);
|
||||
*(nL + 1) = 0;
|
||||
|
||||
dP += 2;
|
||||
nL += 2;
|
||||
} while ((u8 *) bP < finish);
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
nextLine += dstPitch << 1;
|
||||
}
|
||||
while (--height);
|
||||
}
|
||||
|
||||
void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -104,64 +51,6 @@ void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
|||
while (--height);
|
||||
}
|
||||
|
||||
void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *nextLine, *finish;
|
||||
u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16));
|
||||
|
||||
nextLine = dstPtr + dstPitch;
|
||||
|
||||
do {
|
||||
u32 *bP = (u32 *) srcPtr;
|
||||
u32 *dP = (u32 *) dstPtr;
|
||||
u32 *nL = (u32 *) nextLine;
|
||||
u32 currentPixel;
|
||||
u32 nextPixel;
|
||||
|
||||
finish = (u8 *) bP + ((width+2) << 1);
|
||||
nextPixel = *bP++;
|
||||
|
||||
do {
|
||||
currentPixel = nextPixel;
|
||||
nextPixel = *bP++;
|
||||
|
||||
u32 colorA, colorB;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
colorA = currentPixel >> 16;
|
||||
colorB = currentPixel & 0xFFFF;
|
||||
#else
|
||||
colorA = currentPixel & 0xFFFF;
|
||||
colorB = currentPixel >> 16;
|
||||
#endif
|
||||
|
||||
*(dP) = colorA = colorA | ((((colorA & colorMask) >> 1) +
|
||||
((colorB & colorMask) >> 1))) << 16;
|
||||
colorA = ((colorA & colorMask) >> 1);
|
||||
colorA += ((colorA & colorMask) >> 1);
|
||||
*(nL) = colorA;
|
||||
|
||||
colorA = nextPixel & 0xFFFF;
|
||||
|
||||
*(dP + 1) = colorB = colorB | ((((colorA & colorMask) >> 1) +
|
||||
((colorB & colorMask) >> 1))) << 16;
|
||||
colorB = ((colorB & colorMask) >> 1);
|
||||
colorB += ((colorB & colorMask) >> 1);
|
||||
|
||||
*(nL + 1) = colorB;
|
||||
|
||||
dP += 2;
|
||||
nL += 2;
|
||||
} while ((u8 *) bP < finish);
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
nextLine += dstPitch << 1;
|
||||
}
|
||||
while (--height);
|
||||
}
|
||||
|
||||
void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
|
|
@ -1,55 +1,5 @@
|
|||
#include "../System.h"
|
||||
|
||||
void Simple2x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
u8 *nextLine, *finish;
|
||||
|
||||
nextLine = dstPtr + dstPitch;
|
||||
|
||||
do {
|
||||
u32 *bP = (u32 *) srcPtr;
|
||||
u32 *dP = (u32 *) dstPtr;
|
||||
u32 *nL = (u32 *) nextLine;
|
||||
u32 currentPixel;
|
||||
|
||||
finish = (u8 *) bP + ((width+2) << 1);
|
||||
currentPixel = *bP++;
|
||||
|
||||
do {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
u32 color = currentPixel >> 16;
|
||||
#else
|
||||
u32 color = currentPixel & 0xffff;
|
||||
#endif
|
||||
|
||||
color = color | (color << 16);
|
||||
|
||||
*(dP) = color;
|
||||
*(nL) = color;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
color = currentPixel & 0xffff;
|
||||
#else
|
||||
color = currentPixel >> 16;
|
||||
#endif
|
||||
color = color| (color << 16);
|
||||
*(dP + 1) = color;
|
||||
*(nL + 1) = color;
|
||||
|
||||
currentPixel = *bP++;
|
||||
|
||||
dP += 2;
|
||||
nL += 2;
|
||||
} while ((u8 *) bP < finish);
|
||||
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch << 1;
|
||||
nextLine += dstPitch << 1;
|
||||
}
|
||||
while (--height);
|
||||
}
|
||||
|
||||
void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -87,57 +37,6 @@ void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
|||
while (--height);
|
||||
}
|
||||
|
||||
|
||||
void Simple3x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
#define magnification 3
|
||||
#define colorBytes 2 // 16 bit colors = 2 byte colors
|
||||
|
||||
// Generic Simple magnification filter
|
||||
int x, y; // Source Position Counter
|
||||
unsigned int dx, dy; // Destination pixel's pixels
|
||||
unsigned short col; // Source color
|
||||
|
||||
srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image
|
||||
dstPitch = dstPitch / colorBytes;
|
||||
|
||||
unsigned short *src, *dst, *dst2;
|
||||
src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times
|
||||
dst = (unsigned short *)dstPtr;
|
||||
|
||||
for (y = 0; y < height; y++) // Line
|
||||
{
|
||||
for (x = 0; x < width; x++) // Pixel in Line
|
||||
{
|
||||
col = *src;
|
||||
|
||||
dst2 = dst;
|
||||
*dst2 = col;
|
||||
for (dy = 0; dy < magnification; dy++)
|
||||
{
|
||||
for (dx = 0; dx < magnification; dx++)
|
||||
{
|
||||
*dst2 = col;
|
||||
dst2++;
|
||||
}
|
||||
dst2+=dstPitch;
|
||||
dst2-=magnification;
|
||||
}
|
||||
|
||||
src++;
|
||||
dst+=magnification;
|
||||
}
|
||||
src+=srcPitch;
|
||||
dst+=dstPitch * magnification;
|
||||
dst-=width * magnification;
|
||||
}
|
||||
#undef magnification
|
||||
#undef colorBytes
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
@ -186,56 +85,6 @@ void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
|||
#undef colorBytes
|
||||
}
|
||||
|
||||
void Simple4x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
#define magnification 4
|
||||
#define colorBytes 2 // 16 bit colors = 2 byte colors
|
||||
|
||||
// Generic Simple magnification filter
|
||||
int x, y; // Source Position Counter
|
||||
unsigned int dx, dy; // Destination pixel's pixels
|
||||
unsigned short col; // Source color
|
||||
|
||||
srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image
|
||||
dstPitch = dstPitch / colorBytes;
|
||||
|
||||
unsigned short *src, *dst, *dst2;
|
||||
src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times
|
||||
dst = (unsigned short *)dstPtr;
|
||||
|
||||
for (y = 0; y < height; y++) // Line
|
||||
{
|
||||
for (x = 0; x < width; x++) // Pixel in Line
|
||||
{
|
||||
col = *src;
|
||||
|
||||
dst2 = dst;
|
||||
*dst2 = col;
|
||||
for (dy = 0; dy < magnification; dy++)
|
||||
{
|
||||
for (dx = 0; dx < magnification; dx++)
|
||||
{
|
||||
*dst2 = col;
|
||||
dst2++;
|
||||
}
|
||||
dst2+=dstPitch;
|
||||
dst2-=magnification;
|
||||
}
|
||||
|
||||
src++;
|
||||
dst+=magnification;
|
||||
}
|
||||
src+=srcPitch;
|
||||
dst+=dstPitch * magnification;
|
||||
dst-=width * magnification;
|
||||
}
|
||||
#undef magnification
|
||||
#undef colorBytes
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Simple4x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
|
||||
u8 *dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue