[Scummvm-cvs-logs] CVS: scummvm/common/scaler hq2x.h,NONE,1.1 hq3x.h,NONE,1.1 hq2x.cpp,1.8,1.9 hq3x.cpp,1.6,1.7 intern.h,1.9,1.10
Max Horn
fingolfin at users.sourceforge.net
Fri Dec 5 15:27:59 CET 2003
Update of /cvsroot/scummvm/scummvm/common/scaler
In directory sc8-pr-cvs1:/tmp/cvs-serv29337
Modified Files:
hq2x.cpp hq3x.cpp intern.h
Added Files:
hq2x.h hq3x.h
Log Message:
rewrote hq2x/hq3x code so that we can compile both the altivec and plain C version; on OSX, this will only use the altivec code if altivec is actually present
--- NEW FILE: hq2x.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/common/scaler/hq2x.h,v 1.1 2003/12/05 23:27:01 fingolfin Exp $
[...1937 lines suppressed...]
PIXEL11_0
} else {
PIXEL11_100
}
break;
}
w1 = w2;
w4 = w5;
w7 = w8;
w2 = w3;
w5 = w6;
w8 = w9;
q += 2;
}
p += nextlineSrc - width;
q += (nextlineDst - width) * 2;
}
--- NEW FILE: hq3x.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/common/scaler/hq3x.h,v 1.1 2003/12/05 23:27:01 fingolfin Exp $
[...2911 lines suppressed...]
PIXEL22_C
} else {
PIXEL22_2
}
break;
}
w1 = w2;
w4 = w5;
w7 = w8;
w2 = w3;
w5 = w6;
w8 = w9;
q += 3;
}
p += nextlineSrc - width;
q += (nextlineDst - width) * 3;
}
Index: hq2x.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq2x.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hq2x.cpp 8 Nov 2003 22:43:46 -0000 1.8
+++ hq2x.cpp 5 Dec 2003 23:27:01 -0000 1.9
@@ -22,6 +22,20 @@
#include "common/scaler/intern.h"
+#ifdef HAS_ALTIVEC
+#include <sys/sysctl.h>
+
+static bool isAltiVecAvailable() {
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
[...1998 lines suppressed...]
- }
- p += nextlineSrc - width;
- q += (nextlineDst - width) * 2;
+void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+#ifdef HAS_ALTIVEC
+ if (isAltiVecAvailable()) {
+ if (gBitFormat == 565)
+ HQ2x_565_Altivec(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ else
+ HQ2x_555_Altivec(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ return;
}
+#endif
+ if (gBitFormat == 565)
+ HQ2x_565(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ else
+ HQ2x_555(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
}
-
-MAKE_WRAPPER(HQ2x)
Index: hq3x.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq3x.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- hq3x.cpp 2 Oct 2003 23:29:58 -0000 1.6
+++ hq3x.cpp 5 Dec 2003 23:27:01 -0000 1.7
@@ -22,6 +22,19 @@
#include "common/scaler/intern.h"
+#ifdef HAS_ALTIVEC
+#include <sys/sysctl.h>
+
+static bool isAltiVecAvailable() {
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
[...2970 lines suppressed...]
- }
- p += nextlineSrc - width;
- q += (nextlineDst - width) * 3;
+void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+#ifdef HAS_ALTIVEC
+ if (isAltiVecAvailable()) {
+ if (gBitFormat == 565)
+ HQ3x_565_Altivec(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ else
+ HQ3x_555_Altivec(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ return;
}
+#endif
+ if (gBitFormat == 565)
+ HQ3x_565(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ else
+ HQ3x_555(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
}
-
-MAKE_WRAPPER(HQ3x)
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/intern.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- intern.h 6 Nov 2003 23:54:12 -0000 1.9
+++ intern.h 5 Dec 2003 23:27:01 -0000 1.10
@@ -27,12 +27,6 @@
#include "stdafx.h"
#include "common/scummsys.h"
-// HACK HACK HACK
-// Enable *experimental* AltiVec support.
-// This will produce code crashing on any machine *without* Altivec
-//
-#define USE_ALTIVEC 0
-
template<int bitFormat>
struct ColorMasks {
};
More information about the Scummvm-git-logs
mailing list