Added assembly versions of HQ2x and HQ3x scalers.
svn-id: r13844
This commit is contained in:
parent
5464e0951b
commit
d33b24036e
12 changed files with 4645 additions and 9 deletions
|
@ -158,6 +158,13 @@ else
|
|||
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
endif
|
||||
|
||||
ifdef HAVE_NASM
|
||||
.SUFFIXES: .asm
|
||||
|
||||
.asm.o:
|
||||
$(NASM) -O1 $(NASMFLAGS) -g -o $*.o $(<)
|
||||
endif
|
||||
|
||||
# Include the dependency tracking files. We add /dev/null at the end
|
||||
# of the list to avoid a warning/error if no .d file exist
|
||||
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS))) /dev/null
|
||||
|
|
1
NEWS
1
NEWS
|
@ -7,6 +7,7 @@ For a more comprehensive changelog for the latest experimental CVS code, see:
|
|||
- Added an 'On Screen Display' to the SDL backend
|
||||
- Rewrote the backend API partially
|
||||
- Comments in config files are preserved now
|
||||
- Added MMX i386 assembler HQ2x and HQ3x scalers
|
||||
|
||||
SCUMM:
|
||||
- Added graphics decoders for 3DO Humongous Entertainment games
|
||||
|
|
5
README
5
README
|
@ -999,6 +999,11 @@ Visual C++ are supported. If you wish to use MP3-compressed CD tracks or
|
|||
USE_MAD. Tools for compressing .SOU files to .SO3 files can be
|
||||
found in the 'tools' CVS module, or in the 'scummvm-tools' package.
|
||||
|
||||
Some parts of ScummVM, particularly scalers, have highly optimized versions
|
||||
written in assembler. If you wish to use this option, you will need to install
|
||||
nasm assembler (see http://nasm.sf.net). Note, that currently we have only x86
|
||||
MMX optimized versions, and they will not compile on other processors.
|
||||
|
||||
On Win9x/NT/XP you can define USE_WINDBG and attach WinDbg to browse debug
|
||||
messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml).
|
||||
|
||||
|
|
|
@ -16,6 +16,12 @@ MODULE_OBJS := \
|
|||
common/scaler/hq2x.o \
|
||||
common/scaler/hq3x.o
|
||||
|
||||
ifdef HAVE_NASM
|
||||
MODULE_OBJS += \
|
||||
common/scaler/hq2x_i386.o \
|
||||
common/scaler/hq3x_i386.o
|
||||
endif
|
||||
|
||||
MODULE_DIRS += \
|
||||
common \
|
||||
common/scaler
|
||||
|
|
|
@ -27,7 +27,22 @@
|
|||
int gBitFormat = 565;
|
||||
|
||||
// RGB-to-YUV lookup table
|
||||
int RGBtoYUV[65536];
|
||||
extern "C" {
|
||||
|
||||
#ifdef USE_NASM
|
||||
// NOTE: if your compiler uses different mangled names, add another
|
||||
// condition here
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define RGBtoYUV _RGBtoYUV
|
||||
#define LUT16to32 _LUT16to32
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
uint RGBtoYUV[65536];
|
||||
uint LUT16to32[65536];
|
||||
}
|
||||
|
||||
static const uint16 dotmatrix_565[16] = {
|
||||
0x01E0, 0x0007, 0x3800, 0x0000,
|
||||
|
@ -63,6 +78,10 @@ void InitLUT(uint32 BitFormat) {
|
|||
int Y, u, v;
|
||||
int gInc, gShift;
|
||||
|
||||
for (int i = 0; i < 65536; i++) {
|
||||
LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
|
||||
}
|
||||
|
||||
if (BitFormat == 565) {
|
||||
gInc = 256 >> 6;
|
||||
gShift = 6 - 3;
|
||||
|
@ -76,8 +95,8 @@ void InitLUT(uint32 BitFormat) {
|
|||
for (b = 0; b < 256; b += 8) {
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2 * g -b) >> 3);
|
||||
RGBtoYUV[ (r << (5+gShift)) + (g << gShift) + (b >> 3) ] = (Y << 16) + (u << 8) + v;
|
||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||
RGBtoYUV[ (r << (5 + gShift)) + (g << gShift) + (b >> 3) ] = (Y << 16) + (u << 8) + v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,25 @@
|
|||
|
||||
#include "common/scaler/intern.h"
|
||||
|
||||
#ifdef USE_NASM
|
||||
// Assembly version of HQ2x
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define hq2x_16 _hq2x_16
|
||||
#endif
|
||||
|
||||
void hq2x_16(const byte *, byte *, uint32, uint32, uint32, uint32);
|
||||
|
||||
}
|
||||
|
||||
void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
hq2x_16(srcPtr, dstPtr, width, height, srcPitch, dstPitch);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef HAS_ALTIVEC
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
|
@ -120,7 +139,6 @@ void HQ2x_555(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
|
|||
#undef bitFormat
|
||||
#endif
|
||||
|
||||
|
||||
void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
#ifdef HAS_ALTIVEC
|
||||
if (isAltiVecAvailable()) {
|
||||
|
@ -131,8 +149,11 @@ void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBitFormat == 565)
|
||||
HQ2x_565(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
HQ2x_555(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
}
|
||||
|
||||
#endif //Assembly version
|
||||
|
|
1941
common/scaler/hq2x_i386.asm
Normal file
1941
common/scaler/hq2x_i386.asm
Normal file
File diff suppressed because it is too large
Load diff
|
@ -22,6 +22,25 @@
|
|||
|
||||
#include "common/scaler/intern.h"
|
||||
|
||||
#ifdef USE_NASM
|
||||
// Assembly version of HQ3x
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define hq3x_16 _hq3x_16
|
||||
#endif
|
||||
|
||||
void hq3x_16(const byte *, byte *, uint32, uint32, uint32, uint32);
|
||||
|
||||
}
|
||||
|
||||
void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
hq3x_16(srcPtr, dstPtr, width, height, srcPitch, dstPitch);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef HAS_ALTIVEC
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
|
@ -122,7 +141,6 @@ void HQ3x_555(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
|
|||
#undef bitFormat
|
||||
#endif
|
||||
|
||||
|
||||
void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
#ifdef HAS_ALTIVEC
|
||||
if (isAltiVecAvailable()) {
|
||||
|
@ -133,8 +151,11 @@ void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBitFormat == 565)
|
||||
HQ3x_565(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
HQ3x_555(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
2533
common/scaler/hq3x_i386.asm
Normal file
2533
common/scaler/hq3x_i386.asm
Normal file
File diff suppressed because it is too large
Load diff
|
@ -153,7 +153,7 @@ static inline bool diffYUV(int yuv1, int yuv2) {
|
|||
* 16bit RGB to YUV conversion table. This table is setup by InitLUT().
|
||||
* Used by the hq scaler family.
|
||||
*/
|
||||
extern int RGBtoYUV[65536];
|
||||
extern "C" uint RGBtoYUV[65536];
|
||||
|
||||
/** Auxiliary macro to simplify creating those template function wrappers. */
|
||||
#define MAKE_WRAPPER(FUNC) \
|
||||
|
|
83
configure
vendored
83
configure
vendored
|
@ -42,12 +42,16 @@ _build_kyra=no
|
|||
_build_saga=no
|
||||
_need_memalign=no
|
||||
_build_plugins=no
|
||||
_nasm=auto
|
||||
# more defaults
|
||||
_backend=sdl
|
||||
_ranlib=ranlib
|
||||
_install=install
|
||||
_sdlconfig=sdl-config
|
||||
_sdlpath="$PATH"
|
||||
_nasmpath="$PATH"
|
||||
NASMFLAGS=""
|
||||
NASM=""
|
||||
_prefix=/usr/local
|
||||
|
||||
_srcdir=`dirname $0`
|
||||
|
@ -177,6 +181,45 @@ rm -f tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp
|
|||
echo $datatype
|
||||
}
|
||||
|
||||
CheckNASM()
|
||||
{
|
||||
echocheck "nasm"
|
||||
if test "$_nasm" = no ; then
|
||||
echo "disabled"
|
||||
return;
|
||||
fi
|
||||
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||
|
||||
for path_dir in $_nasmpath; do
|
||||
if test -x "$path_dir/nasm" ; then
|
||||
NASM="$path_dir/nasm"
|
||||
echo $NASM
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
IFS="$ac_save_ifs"
|
||||
|
||||
if test x$NASM = x -o x$NASM = x'"$NASM"'; then
|
||||
echo "not found"
|
||||
_nasm=no
|
||||
else
|
||||
case $_host_os in
|
||||
mingw* | cygwin*)
|
||||
NASMFLAGS="-f win32"
|
||||
;;
|
||||
openbsd*)
|
||||
NASMFLAGS="-f aoutb"
|
||||
;;
|
||||
*)
|
||||
NASMFLAGS="-f elf"
|
||||
;;
|
||||
esac
|
||||
_nasm=yes
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Greet user
|
||||
#
|
||||
|
@ -245,7 +288,10 @@ Optional Libraries:
|
|||
--with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional)
|
||||
--disable-mpeg2 disable mpeg2 codec for cutscenes [autodetect]
|
||||
|
||||
--with-sdl-prefix=DIR Prefix where the sdl-config script is installed
|
||||
--with-sdl-prefix=DIR Prefix where the sdl-config script is installed (optional)
|
||||
|
||||
--with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
|
||||
--disable-nasm disable assembly language optimizations [autodetect]
|
||||
|
||||
Some influential environment variables:
|
||||
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
||||
|
@ -282,6 +328,8 @@ for ac_option in $@; do
|
|||
--disable-mad) _mad=no ;;
|
||||
--enable-zlib) _zlib=yes ;;
|
||||
--disable-zlib) _zlib=no ;;
|
||||
--enable-nasm) _nasm=yes ;;
|
||||
--disable-nasm) _nasm=no ;;
|
||||
--disable-mpeg2) _mpeg2=no ;;
|
||||
--enable-plugins) _build_plugins=yes ;;
|
||||
--with-mpeg2-prefix=*)
|
||||
|
@ -332,6 +380,10 @@ for ac_option in $@; do
|
|||
arg=`echo $ac_option | cut -d '=' -f 2`
|
||||
_sdlpath="$arg:$arg/bin"
|
||||
;;
|
||||
--with-nasm-prefix=*)
|
||||
arg=`echo $ac_option | cut -d '=' -f 2`
|
||||
_nasmpath="$arg:$arg/bin"
|
||||
;;
|
||||
--host=*)
|
||||
_host=`echo $ac_option | cut -d '=' -f 2`
|
||||
;;
|
||||
|
@ -509,7 +561,6 @@ else
|
|||
_mak_saga='# DISABLE_SAGA = 1'
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$_host"; then
|
||||
# Cross-compiling mode - add your target here if needed
|
||||
case "$_host" in
|
||||
|
@ -847,6 +898,19 @@ fi
|
|||
echo "$_mpeg2"
|
||||
rm -f $TMPC $TMPO$EXEEXT
|
||||
|
||||
#
|
||||
# Check for nasm
|
||||
#
|
||||
CheckNASM
|
||||
|
||||
if test "$_nasm" = yes ; then
|
||||
_def_nasm='#define USE_NASM'
|
||||
_make_def_HAVE_NASM='HAVE_NASM = 1'
|
||||
else
|
||||
_def_nasm='#undef USE_NASM'
|
||||
_make_def_HAVE_NASM='# HAVE_NASM = 1'
|
||||
fi
|
||||
|
||||
#
|
||||
# figure out installation directories
|
||||
#
|
||||
|
@ -892,10 +956,17 @@ fi
|
|||
if test "$_build_kyra" = yes ; then
|
||||
echo " Legend of Kyrandia"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
echo_n "Backend... "
|
||||
echo "$_backend"
|
||||
echo_n "$_backend"
|
||||
|
||||
if test "$_nasm" = yes ; then
|
||||
echo ", assembly routines"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
|
||||
#
|
||||
# Backend related stuff
|
||||
|
@ -954,6 +1025,9 @@ $_def_alsa
|
|||
$_def_zlib
|
||||
$_def_mpeg2
|
||||
|
||||
/* Should we use i386 assembly routines */
|
||||
$_def_nasm
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
EOF
|
||||
|
||||
|
@ -970,6 +1044,8 @@ BACKEND := $_backend
|
|||
MODULES += $MODULES
|
||||
MODULE_DIRS += $MODULE_DIRS
|
||||
EXEEXT := $EXEEXT
|
||||
NASM := $NASM
|
||||
NASMFLAGS := $NASMFLAGS
|
||||
|
||||
PREFIX := $_prefix
|
||||
BINDIR := $_bindir
|
||||
|
@ -977,6 +1053,7 @@ MANDIR := $_mandir
|
|||
|
||||
$_mak_plugins
|
||||
$_make_def_HAVE_GCC3
|
||||
$_make_def_HAVE_NASM
|
||||
$_mak_scumm
|
||||
$_mak_simon
|
||||
$_mak_sky
|
||||
|
|
|
@ -13,6 +13,11 @@ Visual C++ are supported. If you wish to use MP3-compressed CD tracks or
|
|||
USE\_MAD. Tools for compressing .SOU files to .SO3 files can be
|
||||
found in the 'tools' CVS module, or in the 'scummvm-tools' package.
|
||||
|
||||
Some parts of ScummVM, particularly scalers, have highly optimized versions
|
||||
written in assembler. If you wish to use this option, you will need to install
|
||||
nasm assembler (see \url{http://nasm.sf.net}). Note, that currently we have only x86
|
||||
MMX optimized versions, and they will not compile on other processors.
|
||||
|
||||
On Win9x/NT/XP you can define USE\_WINDBG and attach WinDbg to browse debug
|
||||
messages (see \url{http://www.sysinternals.com/ntw2k/freeware/debugview.shtml}).
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue