ALL: Removed last traces of the MPEG2 code

This commit is contained in:
Max Horn 2011-06-01 23:17:43 +02:00
parent 5eae0e1a5c
commit 9db33ea544
20 changed files with 32 additions and 904 deletions

5
README
View file

@ -2052,8 +2052,7 @@ compiler. Several compilers, including GCC, mingw and recent versions of
Microsoft Visual C++ are supported. If you wish to use MP3-compressed CD
tracks or .SOU files, you will need to install the MAD library; likewise
you will need the appropriate libraries for Ogg Vorbis and FLAC
compressed sound. For MPEG2 support, libmpeg2 is required. For
compressed save states, zlib is required.
compressed sound. For compressed save states, zlib is required.
Some parts of ScummVM, particularly scalers, have highly optimized
versions written in assembler. If you wish to use this option, you will
@ -2137,7 +2136,7 @@ debug messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml).
Maemo:
* Get Scratchbox environment with Maemo 2.2 rootstrap (2.2 is for 770 and up)
* Install libmad, Tremor, FLAC, libmpeg2 from source
* Install libmad, Tremor, FLAC from source
* patch scummvm source (some stuff is currently too dirty to be in svn directly)
patch -p1 < backends/platform/maemo/scummvm-[currentversion]-maemo.patch
* update debian/changelog

View file

@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
./configure --backend=caanoo --disable-mt32emu --host=caanoo \
--disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
--with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \

View file

@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
./configure --backend=caanoo --disable-mt32emu --host=caanoo \
--disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
--with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \

View file

@ -17,7 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-all-engines --enable-vkeybd
./configure --backend=gp2x --disable-mt32emu --host=gp2x \
--disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-all-engines --enable-vkeybd
#--enable-plugins --default-dynamic
echo Generating config for GP2X complete. Check for errors.

View file

@ -17,7 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-vkeybd --enable-plugins --default-dynamic
./configure --backend=gp2x --disable-mt32emu --host=gp2x \
--disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-vkeybd --enable-plugins --default-dynamic
# --disable-release --enable-debug
# --enable-plugins --default-dynamic

View file

@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
--disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \

View file

@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
--disable-flac --disable-nasm --disable-hq-scalers \
--with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \

View file

@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
--with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \

View file

@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
--with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \

View file

@ -104,9 +104,6 @@
#$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "$SdlBase\\S90";
#$SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "$SdlBase\\UIQ2"
#$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "$SdlBase\\UIQ3";
## HardlySupported(TM) :P
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "$DevBase\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@ -145,7 +142,6 @@
# $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S60";
# $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S80";
# $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@ -183,7 +179,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@ -221,7 +216,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@ -259,7 +253,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)

View file

@ -114,9 +114,6 @@ Building ScummVM
- flac, the Free Lossless Audio Codec
http://flac.sourceforge.net/
- libmpeg2, a free MPEG-2 video stream decoder
http://libmpeg2.sourceforge.net
Compiling ScummVM
-----------------

View file

@ -47,7 +47,6 @@ ENABLE_MADE = STATIC_PLUGIN
## Pick which libraries you want to use here
USE_MAD = 1
#USE_MPEG2 = 1
#USE_TREMOR = 1
USE_TREMOLO = 1
#USE_FLAC = 1
@ -133,11 +132,6 @@ DEFINES += -DUSE_MAD
LIBS += -lmad
endif
ifdef USE_MPEG2
DEFINES += -DUSE_MPEG2
LIBS += -lmpeg2
endif
ifdef USE_TREMOR
DEFINES += -DUSE_TREMOR -DUSE_VORBIS
LIBS += -ltremorce

53
configure vendored
View file

@ -130,7 +130,6 @@ _alsa=auto
_seq_midi=auto
_timidity=auto
_zlib=auto
_mpeg2=no
_png=auto
_theoradec=auto
_faad=auto
@ -746,9 +745,6 @@ Optional Libraries:
--with-zlib-prefix=DIR Prefix where zlib is installed (optional)
--disable-zlib disable zlib (compression) support [autodetect]
--with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional)
--enable-mpeg2 enable mpeg2 codec for cutscenes [no]
--with-opengl-prefix=DIR Prefix where OpenGL (ES) is installed (optional)
--disable-opengl disable OpenGL (ES) support [autodetect]
@ -812,7 +808,6 @@ for ac_option in $@; do
--disable-zlib) _zlib=no ;;
--enable-nasm) _nasm=yes ;;
--disable-nasm) _nasm=no ;;
--enable-mpeg2) _mpeg2=yes ;;
--disable-png) _png=no ;;
--enable-png) _png=yes ;;
--disable-theoradec) _theoradec=no ;;
@ -842,11 +837,6 @@ for ac_option in $@; do
FLUIDSYNTH_CFLAGS="-I$arg/include"
FLUIDSYNTH_LIBS="-L$arg/lib"
;;
--with-mpeg2-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
MPEG2_CFLAGS="-I$arg/include"
MPEG2_LIBS="-L$arg/lib"
;;
--with-alsa-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
ALSA_CFLAGS="-I$arg/include"
@ -2871,49 +2861,6 @@ if test `get_engine_build sword25` = yes && test ! "$_zlib" = yes ; then
engine_disable sword25
fi
#
# Check for LibMPEG2
#
echocheck "libmpeg2 >= 0.3.2"
if test "$_mpeg2" = auto ; then
_mpeg2=no
cat > $TMPC << EOF
typedef signed $type_1_byte int8_t;
typedef signed $type_2_byte int16_t;
typedef signed $type_4_byte int32_t;
typedef unsigned $type_1_byte uint8_t;
typedef unsigned $type_2_byte uint16_t;
typedef unsigned $type_4_byte uint32_t;
#include <mpeg2dec/mpeg2.h>
int main(void) {
/* mpeg2_state_t first appears in 0.4.0 */
mpeg2_state_t state;
#ifdef MPEG2_RELEASE
if (MPEG2_RELEASE >= MPEG2_VERSION(0, 3, 2))
return 0;
#endif
return 1;
}
EOF
if test -n "$_host"; then
# don't execute while cross compiling
cc_check $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && _mpeg2=yes
else
cc_check_no_clean $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO$HOSTEXEEXT && _mpeg2=yes
cc_check_clean
fi
fi
if test "$_mpeg2" = yes ; then
INCLUDES="$INCLUDES $MPEG2_CFLAGS"
LIBS="$LIBS $MPEG2_LIBS -lmpeg2"
fi
define_in_config_if_yes "$_mpeg2" 'USE_MPEG2'
echo "$_mpeg2"
#
# Check for libfluidsynth
#

View file

@ -729,7 +729,6 @@ const Feature s_features[] = {
{ "flac", "USE_FLAC", "libFLAC_static", true, "FLAC support" },
{ "png", "USE_PNG", "libpng", true, "libpng support" },
{ "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" },
{ "mpeg2", "USE_MPEG2", "libmpeg2", false, "mpeg2 codec for cutscenes" },
// Feature flags
{ "scalers", "USE_SCALERS", "", true, "Scalers" },

View file

@ -2151,13 +2151,10 @@
DFAAAFFC0F0112DF003E9390 /* detection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFAAAFFB0F0112DF003E9390 /* detection.cpp */; };
DFAAB0020F011392003E9390 /* thumbnail_intern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFAAB0010F011392003E9390 /* thumbnail_intern.cpp */; };
DFAAD23D0F50120E00C3A4E2 /* console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFAAD2390F50120E00C3A4E2 /* console.cpp */; };
DFB0576811B753AF0015AE65 /* mpeg_player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576211B753AF0015AE65 /* mpeg_player.cpp */; };
DFB0576911B753AF0015AE65 /* qt_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576411B753AF0015AE65 /* qt_decoder.cpp */; };
DFB0576A11B753AF0015AE65 /* video_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576611B753AF0015AE65 /* video_decoder.cpp */; };
DFB0576B11B753AF0015AE65 /* mpeg_player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576211B753AF0015AE65 /* mpeg_player.cpp */; };
DFB0576C11B753AF0015AE65 /* qt_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576411B753AF0015AE65 /* qt_decoder.cpp */; };
DFB0576D11B753AF0015AE65 /* video_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576611B753AF0015AE65 /* video_decoder.cpp */; };
DFB0576E11B753AF0015AE65 /* mpeg_player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576211B753AF0015AE65 /* mpeg_player.cpp */; };
DFB0576F11B753AF0015AE65 /* qt_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576411B753AF0015AE65 /* qt_decoder.cpp */; };
DFB0577011B753AF0015AE65 /* video_decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0576611B753AF0015AE65 /* video_decoder.cpp */; };
DFB0577611B753DA0015AE65 /* rational.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFB0577411B753DA0015AE65 /* rational.cpp */; };
@ -3151,7 +3148,6 @@
DFF95CBF0FB22D5700A3EC78 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF842A190E7BB34E00F5680E /* UIKit.framework */; };
DFF95CC00FB22D5700A3EC78 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF842A270E7BB37500F5680E /* AudioToolbox.framework */; };
DFF95CC10FB22D5700A3EC78 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF842A2E0E7BB39E00F5680E /* QuartzCore.framework */; };
DFF95CCF0FB22D8500A3EC78 /* libmpeg2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DFD6476D0F49F7EF008E18EF /* libmpeg2.a */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -4765,8 +4761,6 @@
DFAAB0010F011392003E9390 /* thumbnail_intern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = thumbnail_intern.cpp; sourceTree = "<group>"; };
DFAAD2390F50120E00C3A4E2 /* console.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = console.cpp; sourceTree = "<group>"; };
DFAAD23A0F50120E00C3A4E2 /* console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = console.h; sourceTree = "<group>"; };
DFB0576211B753AF0015AE65 /* mpeg_player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mpeg_player.cpp; sourceTree = "<group>"; };
DFB0576311B753AF0015AE65 /* mpeg_player.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg_player.h; sourceTree = "<group>"; };
DFB0576411B753AF0015AE65 /* qt_decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = qt_decoder.cpp; sourceTree = "<group>"; };
DFB0576511B753AF0015AE65 /* qt_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qt_decoder.h; sourceTree = "<group>"; };
DFB0576611B753AF0015AE65 /* video_decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_decoder.cpp; sourceTree = "<group>"; };
@ -4834,7 +4828,6 @@
DFD518B90DF34BA600854012 /* scale3x.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale3x.h; sourceTree = "<group>"; };
DFD6476B0F49F7EF008E18EF /* libFLAC.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFLAC.a; path = lib/libFLAC.a; sourceTree = "<group>"; };
DFD6476C0F49F7EF008E18EF /* libmad.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmad.a; path = lib/libmad.a; sourceTree = "<group>"; };
DFD6476D0F49F7EF008E18EF /* libmpeg2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmpeg2.a; path = lib/libmpeg2.a; sourceTree = "<group>"; };
DFD6476F0F49F7EF008E18EF /* libvorbisidec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisidec.a; path = lib/libvorbisidec.a; sourceTree = "<group>"; };
DFE470C10D81F4BA00B6D1FB /* commandLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandLine.cpp; sourceTree = "<group>"; };
DFE470C20D81F4BA00B6D1FB /* commandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = commandLine.h; sourceTree = "<group>"; };
@ -5044,7 +5037,6 @@
DFF959050FB22D3000A3EC78 /* libmad.a in Frameworks */,
DFF959060FB22D3100A3EC78 /* libFLAC.a in Frameworks */,
DFF959080FB22D3300A3EC78 /* libvorbisidec.a in Frameworks */,
DFF95CCF0FB22D8500A3EC78 /* libmpeg2.a in Frameworks */,
DF224E040FB23BC500C8E453 /* OpenGLES.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -5339,8 +5331,6 @@
DF6118610FE3A9410042AD3F /* dxa_decoder.h */,
DF6118620FE3A9410042AD3F /* flic_decoder.cpp */,
DF6118630FE3A9410042AD3F /* flic_decoder.h */,
DFB0576211B753AF0015AE65 /* mpeg_player.cpp */,
DFB0576311B753AF0015AE65 /* mpeg_player.h */,
DFB0576411B753AF0015AE65 /* qt_decoder.cpp */,
DFB0576511B753AF0015AE65 /* qt_decoder.h */,
DF6118640FE3A9410042AD3F /* smk_decoder.cpp */,
@ -7107,7 +7097,6 @@
children = (
DFD6476B0F49F7EF008E18EF /* libFLAC.a */,
DFD6476C0F49F7EF008E18EF /* libmad.a */,
DFD6476D0F49F7EF008E18EF /* libmpeg2.a */,
DFD6476F0F49F7EF008E18EF /* libvorbisidec.a */,
);
name = libs;
@ -8677,7 +8666,6 @@
DF9B9249118E46730069C19D /* error.cpp in Sources */,
DF9B9254118E46A00069C19D /* fontsjis.cpp in Sources */,
DF9B9263118E46FE0069C19D /* error.cpp in Sources */,
DFB0576B11B753AF0015AE65 /* mpeg_player.cpp in Sources */,
DFB0576C11B753AF0015AE65 /* qt_decoder.cpp in Sources */,
DFB0576D11B753AF0015AE65 /* video_decoder.cpp in Sources */,
DFB0577711B753DA0015AE65 /* rational.cpp in Sources */,
@ -9707,7 +9695,6 @@
DF9B924A118E46730069C19D /* error.cpp in Sources */,
DF9B9256118E46A00069C19D /* fontsjis.cpp in Sources */,
DF9B9264118E46FE0069C19D /* error.cpp in Sources */,
DFB0576E11B753AF0015AE65 /* mpeg_player.cpp in Sources */,
DFB0576F11B753AF0015AE65 /* qt_decoder.cpp in Sources */,
DFB0577011B753AF0015AE65 /* video_decoder.cpp in Sources */,
DFB0577811B753DA0015AE65 /* rational.cpp in Sources */,
@ -10738,7 +10725,6 @@
DF9B9248118E46730069C19D /* error.cpp in Sources */,
DF9B9252118E46A00069C19D /* fontsjis.cpp in Sources */,
DF9B9262118E46FE0069C19D /* error.cpp in Sources */,
DFB0576811B753AF0015AE65 /* mpeg_player.cpp in Sources */,
DFB0576911B753AF0015AE65 /* qt_decoder.cpp in Sources */,
DFB0576A11B753AF0015AE65 /* video_decoder.cpp in Sources */,
DFB0577611B753DA0015AE65 /* rational.cpp in Sources */,
@ -11126,7 +11112,6 @@
ENABLE_TUCKER,
USE_FLAC,
USE_MAD,
USE_MPEG2,
USE_TREMOR,
USE_VORBIS,
USE_ZLIB,
@ -11212,7 +11197,6 @@
ENABLE_TUCKER,
USE_FLAC,
USE_MAD,
USE_MPEG2,
USE_TREMOR,
USE_VORBIS,
USE_ZLIB,

View file

@ -8,9 +8,9 @@ adapt the below instructions where necessary.
1) Collect sources:
Place scummvm-%{version}.tar.bz2, libmad-0.15.1b.tar.bz2 and
mpeg2dec-0.4.0b.tar.bz2 in /usr/src/redhat/SOURCES .
If you have different versions of mpeg2dec or libmad, put the correct version
Place scummvm-%{version}.tar.bz2 and libmad-0.15.1b.tar.bz2
in /usr/src/redhat/SOURCES .
If you have a different version of libmad, put the correct version
numbers in the .spec file.
Place scummvm.spec in /usr/src/redhat/SPECS .
@ -28,8 +28,7 @@ the source RPM in /usr/src/redhat/SRPMS
Note: libmad and mpeg2dec are statically linked into the scummvm binary
because Fedora does not carry libmad and mpeg2dec packages, so I did not
Note: libmad is statically linked into the scummvm binary
because Fedora does not carry a libmad package, so I did not
want to make the scummvm package depend on them.
You can get libmad from http://www.underbit.com/products/mad/
and mpeg2dec from http://libmpeg2.sourceforge.net/ .
You can get libmad from http://www.underbit.com/products/mad/ .

View file

@ -92,10 +92,6 @@ ifdef USE_MAD
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmad.a
endif
ifdef USE_MPEG2
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmpeg2.a
endif
ifdef USE_PNG
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libpng.a
endif

View file

@ -5,7 +5,6 @@ MODULE_OBJS := \
coktel_decoder.o \
dxa_decoder.o \
flic_decoder.o \
mpeg_player.o \
qt_decoder.o \
smk_decoder.o \
video_decoder.o \

View file

@ -1,622 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// The YUV to RGB conversion code is derived from SDL's YUV overlay code, which
// in turn appears to be derived from mpeg_play. The following copyright
// notices have been included in accordance with the original license. Please
// note that the term "software" in this context only applies to the
// buildLookup() and plotYUV*() functions below.
// Copyright (c) 1995 The Regents of the University of California.
// All rights reserved.
//
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose, without fee, and without written agreement is
// hereby granted, provided that the above copyright notice and the following
// two paragraphs appear in all copies of this software.
//
// IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
// OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
// CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
// ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
// PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// Copyright (c) 1995 Erik Corry
// All rights reserved.
//
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose, without fee, and without written agreement is
// hereby granted, provided that the above copyright notice and the following
// two paragraphs appear in all copies of this software.
//
// IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
// THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
// BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// Portions of this software Copyright (c) 1995 Brown University.
// All rights reserved.
//
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose, without fee, and without written agreement
// is hereby granted, provided that the above copyright notice and the
// following two paragraphs appear in all copies of this software.
//
// IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR
// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
// OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
// UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
// BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
// SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "video/mpeg_player.h"
#include "common/file.h"
#include "common/system.h"
#include "common/util.h"
namespace Video {
BaseAnimationState::BaseAnimationState(OSystem *sys, int width, int height)
: _movieWidth(width), _movieHeight(height), _frameWidth(width), _frameHeight(height), _sys(sys) {
#ifndef BACKEND_8BIT
const int screenW = _sys->getOverlayWidth();
const int screenH = _sys->getOverlayHeight();
_movieScale = MIN(screenW / _movieWidth, screenH / _movieHeight);
assert(_movieScale >= 1);
if (_movieScale > 3)
_movieScale = 3;
_colorTab = NULL;
_rgbToPix = NULL;
memset(&_overlayFormat, 0, sizeof(_overlayFormat));
#endif
}
BaseAnimationState::~BaseAnimationState() {
#ifdef USE_MPEG2
if (_mpegDecoder)
mpeg2_close(_mpegDecoder);
delete _mpegFile;
#ifndef BACKEND_8BIT
_sys->hideOverlay();
free(_overlay);
free(_colorTab);
free(_rgbToPix);
#endif
#endif
}
bool BaseAnimationState::init(const char *name) {
#ifdef USE_MPEG2
char tempFile[512];
_mpegDecoder = NULL;
_mpegFile = NULL;
#ifdef BACKEND_8BIT
uint i, p;
// Load lookup palettes
sprintf(tempFile, "%s.pal", name);
Common::File f;
if (!f.open(tempFile)) {
warning("Cutscene: %s palette missing", tempFile);
return false;
}
p = 0;
while (!f.eos()) {
_palettes[p].end = f.readUint16LE();
_palettes[p].cnt = f.readUint16LE();
for (i = 0; i < _palettes[p].cnt; i++) {
_palettes[p].pal[4 * i] = f.readByte();
_palettes[p].pal[4 * i + 1] = f.readByte();
_palettes[p].pal[4 * i + 2] = f.readByte();
_palettes[p].pal[4 * i + 3] = 0;
}
for (; i < 256; i++) {
_palettes[p].pal[4 * i] = 0;
_palettes[p].pal[4 * i + 1] = 0;
_palettes[p].pal[4 * i + 2] = 0;
_palettes[p].pal[4 * i + 3] = 0;
}
p++;
}
f.close();
_palNum = 0;
_maxPalNum = p;
setPalette(_palettes[_palNum].pal);
_lut = _lut2 = _yuvLookup[0];
_curPal = -1;
_cr = 0;
buildLookup(_palNum, 256);
_lut2 = _yuvLookup[1];
_lutCalcNum = (BITDEPTH + _palettes[_palNum].end + 2) / (_palettes[_palNum].end + 2);
#else
buildLookup();
_overlay = (OverlayColor *)calloc(_movieScale * _movieWidth * _movieScale * _movieHeight, sizeof(OverlayColor));
_sys->showOverlay();
#endif
// Open MPEG2 stream
_mpegFile = new Common::File();
sprintf(tempFile, "%s.mp2", name);
if (!_mpegFile->open(tempFile)) {
warning("Cutscene: Could not open %s", tempFile);
return false;
}
// Load and configure decoder
_mpegDecoder = mpeg2_init();
if (_mpegDecoder == NULL) {
warning("Cutscene: Could not allocate an MPEG2 decoder");
return false;
}
_mpegInfo = mpeg2_info(_mpegDecoder);
_frameNum = 0;
return true;
#else /* USE_MPEG2 */
return false;
#endif
}
bool BaseAnimationState::decodeFrame() {
#ifdef USE_MPEG2
mpeg2_state_t state;
const mpeg2_sequence_t *sequence_i;
size_t size = (size_t) -1;
static byte buf[BUFFER_SIZE];
do {
state = mpeg2_parse(_mpegDecoder);
sequence_i = _mpegInfo->sequence;
switch (state) {
case STATE_BUFFER:
size = _mpegFile->read(buf, BUFFER_SIZE);
mpeg2_buffer(_mpegDecoder, buf, buf + size);
break;
case STATE_SLICE:
case STATE_END:
if (_mpegInfo->display_fbuf) {
checkPaletteSwitch();
drawYUV(sequence_i->width, sequence_i->height, _mpegInfo->display_fbuf->buf);
#ifdef BACKEND_8BIT
buildLookup(_palNum + 1, _lutCalcNum);
#endif
_frameNum++;
return true;
}
break;
default:
break;
}
} while (size);
#endif
return false;
}
bool BaseAnimationState::checkPaletteSwitch() {
#ifdef BACKEND_8BIT
// if we have reached the last image with this palette, switch to new one
if (_frameNum == _palettes[_palNum].end) {
unsigned char *l = _lut2;
_palNum++;
setPalette(_palettes[_palNum].pal);
_lutCalcNum = (BITDEPTH + _palettes[_palNum].end - (_frameNum + 1) + 2) / (_palettes[_palNum].end - (_frameNum + 1) + 2);
_lut2 = _lut;
_lut = l;
return true;
}
#endif
return false;
}
void BaseAnimationState::handleScreenChanged() {
#ifndef BACKEND_8BIT
const int screenW = _sys->getOverlayWidth();
const int screenH = _sys->getOverlayHeight();
int newScale = MIN(screenW / _movieWidth, screenH / _movieHeight);
assert(newScale >= 1);
if (newScale > 3)
newScale = 3;
if (newScale != _movieScale) {
// HACK: Since frames generally do not cover the entire screen,
// We need to undraw the old frame. This is a very hacky
// way of doing that.
OverlayColor *buf = (OverlayColor *)calloc(screenW * screenH, sizeof(OverlayColor));
_sys->copyRectToOverlay(buf, screenW, 0, 0, screenW, screenH);
free(buf);
free(_overlay);
_movieScale = newScale;
_overlay = (OverlayColor *)calloc(_movieScale * _movieWidth * _movieScale * _movieHeight, sizeof(OverlayColor));
}
buildLookup();
#endif
}
#ifdef BACKEND_8BIT
/**
* Build 'Best-Match' RGB lookup table
*/
void BaseAnimationState::buildLookup(int p, int lines) {
int y, cb;
int r, g, b, ii;
if (p >= _maxPalNum)
return;
if (p != _curPal) {
_curPal = p;
_cr = 0;
_pos = 0;
}
if (_cr > BITDEPTH)
return;
for (ii = 0; ii < lines; ii++) {
r = (-16 * 256 + (int) (256 * 1.596) * ((_cr << SHIFT) - 128)) / 256;
for (cb = 0; cb <= BITDEPTH; cb++) {
g = (-16 * 256 - (int) (0.813 * 256) * ((_cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256;
b = (-16 * 256 + (int) (2.018 * 256) * ((cb << SHIFT) - 128)) / 256;
for (y = 0; y <= BITDEPTH; y++) {
int idx, bst = 0;
int dis = 2 * SQR(r - _palettes[p].pal[0]) + 4 * SQR(g - _palettes[p].pal[1]) + SQR(b - _palettes[p].pal[2]);
for (idx = 1; idx < 256; idx++) {
long d2 = 2 * SQR(r - _palettes[p].pal[4 * idx]) + 4 * SQR(g - _palettes[p].pal[4 * idx + 1]) + SQR(b - _palettes[p].pal[4 * idx + 2]);
if (d2 < dis) {
bst = idx;
dis = d2;
}
}
_lut2[_pos++] = bst;
r += (1 << SHIFT);
g += (1 << SHIFT);
b += (1 << SHIFT);
}
r -= (BITDEPTH + 1) * (1 << SHIFT);
}
_cr++;
if (_cr > BITDEPTH)
return;
}
}
#else
void BaseAnimationState::buildLookup() {
// Do we already have lookup tables for this bit format?
Graphics::PixelFormat format = _sys->getOverlayFormat();
if (format == _overlayFormat && _colorTab && _rgbToPix)
return;
free(_colorTab);
free(_rgbToPix);
_colorTab = (int16 *)malloc(4 * 256 * sizeof(int16));
int16 *Cr_r_tab = &_colorTab[0 * 256];
int16 *Cr_g_tab = &_colorTab[1 * 256];
int16 *Cb_g_tab = &_colorTab[2 * 256];
int16 *Cb_b_tab = &_colorTab[3 * 256];
_rgbToPix = (OverlayColor *)malloc(3 * 768 * sizeof(OverlayColor));
OverlayColor *r_2_pix_alloc = &_rgbToPix[0 * 768];
OverlayColor *g_2_pix_alloc = &_rgbToPix[1 * 768];
OverlayColor *b_2_pix_alloc = &_rgbToPix[2 * 768];
int16 CR, CB;
int i;
// Generate the tables for the display surface
for (i = 0; i < 256; i++) {
// Gamma correction (luminescence table) and chroma correction
// would be done here. See the Berkeley mpeg_play sources.
CR = CB = (i - 128);
Cr_r_tab[i] = (int16) ( (0.419 / 0.299) * CR) + 0 * 768 + 256;
Cr_g_tab[i] = (int16) (-(0.299 / 0.419) * CR) + 1 * 768 + 256;
Cb_g_tab[i] = (int16) (-(0.114 / 0.331) * CB);
Cb_b_tab[i] = (int16) ( (0.587 / 0.331) * CB) + 2 * 768 + 256;
}
// Set up entries 0-255 in rgb-to-pixel value tables.
for (i = 0; i < 256; i++) {
r_2_pix_alloc[i + 256] = format.RGBToColor(i, 0, 0);
g_2_pix_alloc[i + 256] = format.RGBToColor(0, i, 0);
b_2_pix_alloc[i + 256] = format.RGBToColor(0, 0, i);
}
// Spread out the values we have to the rest of the array so that we do
// not need to check for overflow.
for (i = 0; i < 256; i++) {
r_2_pix_alloc[i] = r_2_pix_alloc[256];
r_2_pix_alloc[i + 512] = r_2_pix_alloc[511];
g_2_pix_alloc[i] = g_2_pix_alloc[256];
g_2_pix_alloc[i + 512] = g_2_pix_alloc[511];
b_2_pix_alloc[i] = b_2_pix_alloc[256];
b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
}
_overlayFormat = format;
}
void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {
switch (_movieScale) {
case 1:
plotYUV1x(width, height, dat);
break;
case 2:
plotYUV2x(width, height, dat);
break;
case 3:
plotYUV3x(width, height, dat);
break;
}
}
void BaseAnimationState::plotYUV1x(int width, int height, byte *const *dat) {
byte *lum = dat[0];
byte *cr = dat[2];
byte *cb = dat[1];
byte *lum2 = lum + width;
int16 cr_r;
int16 crb_g;
int16 cb_b;
OverlayColor *row1 = _overlay;
OverlayColor *row2 = row1 + _movieWidth;
int x;
for (; height > 0; height -= 2) {
OverlayColor *r1 = row1;
OverlayColor *r2 = row2;
for (x = width; x > 0; x -= 2) {
register OverlayColor *L;
cr_r = _colorTab[*cr + 0 * 256];
crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];
cb_b = _colorTab[*cb + 3 * 256];
++cr;
++cb;
L = &_rgbToPix[*lum++];
*r1++ = L[cr_r] | L[crb_g] | L[cb_b];
L = &_rgbToPix[*lum++];
*r1++ = L[cr_r] | L[crb_g] | L[cb_b];
// Now, do second row.
L = &_rgbToPix[*lum2++];
*r2++ = L[cr_r] | L[crb_g] | L[cb_b];
L = &_rgbToPix[*lum2++];
*r2++ = L[cr_r] | L[crb_g] | L[cb_b];
}
lum += width;
lum2 += width;
row1 += 2 * _movieWidth;
row2 += 2 * _movieWidth;
}
}
void BaseAnimationState::plotYUV2x(int width, int height, byte *const *dat) {
byte *lum = dat[0];
byte *cr = dat[2];
byte *cb = dat[1];
byte *lum2 = lum + width;
int16 cr_r;
int16 crb_g;
int16 cb_b;
OverlayColor *row1 = _overlay;
OverlayColor *row2 = row1 + 2 * 2 * _movieWidth;
int x;
for (; height > 0; height -= 2) {
OverlayColor *r1 = row1;
OverlayColor *r2 = row2;
for (x = width; x > 0; x -= 2) {
register OverlayColor *L;
register OverlayColor C;
cr_r = _colorTab[*cr + 0 * 256];
crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];
cb_b = _colorTab[*cb + 3 * 256];
++cr;
++cb;
L = &_rgbToPix[*lum++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r1++ = C;
*r1++ = C;
L = &_rgbToPix[*lum++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r1++ = C;
*r1++ = C;
// Now, do second row.
L = &_rgbToPix[*lum2++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r2++ = C;
*r2++ = C;
L = &_rgbToPix[*lum2++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r2++ = C;
*r2++ = C;
}
memcpy(row1 + 2 * _movieWidth, row1, 2 * _movieWidth * sizeof(OverlayColor));
memcpy(row2 + 2 * _movieWidth, row2, 2 * _movieWidth * sizeof(OverlayColor));
lum += width;
lum2 += width;
row1 += 4 * 2 * _movieWidth;
row2 += 4 * 2 * _movieWidth;
}
}
void BaseAnimationState::plotYUV3x(int width, int height, byte *const *dat) {
byte *lum = dat[0];
byte *cr = dat[2];
byte *cb = dat[1];
byte *lum2 = lum + width;
int16 cr_r;
int16 crb_g;
int16 cb_b;
OverlayColor *row1 = _overlay;
OverlayColor *row2 = row1 + 3 * 3 * _movieWidth;
int x;
for (; height > 0; height -= 2) {
OverlayColor *r1 = row1;
OverlayColor *r2 = row2;
for (x = width; x > 0; x -= 2) {
register OverlayColor *L;
register OverlayColor C;
cr_r = _colorTab[*cr + 0 * 256];
crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];
cb_b = _colorTab[*cb + 3 * 256];
++cr;
++cb;
L = &_rgbToPix[*lum++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r1++ = C;
*r1++ = C;
*r1++ = C;
L = &_rgbToPix[*lum++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r1++ = C;
*r1++ = C;
*r1++ = C;
// Now, do second row.
L = &_rgbToPix[*lum2++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r2++ = C;
*r2++ = C;
*r2++ = C;
L = &_rgbToPix[*lum2++];
C = L[cr_r] | L[crb_g] | L[cb_b];
*r2++ = C;
*r2++ = C;
*r2++ = C;
}
memcpy(row1 + 3 * _movieWidth, row1, 3 * _movieWidth * sizeof(OverlayColor));
memcpy(row1 + 2 * 3 * _movieWidth, row1, 3 * _movieWidth * sizeof(OverlayColor));
memcpy(row2 + 3 * _movieWidth, row2, 3 * _movieWidth * sizeof(OverlayColor));
memcpy(row2 + 2 * 3 * _movieWidth, row2, 3 * _movieWidth * sizeof(OverlayColor));
lum += width;
lum2 += width;
row1 += 6 * 3 * _movieWidth;
row2 += 6 * 3 * _movieWidth;
}
}
#endif
void BaseAnimationState::updateScreen() {
#ifndef BACKEND_8BIT
int width = _movieScale * _frameWidth;
int height = _movieScale * _frameHeight;
int pitch = _movieScale * _movieWidth;
const int screenW = _sys->getOverlayWidth();
const int screenH = _sys->getOverlayHeight();
int x = (screenW - _movieScale * _frameWidth) / 2;
int y = (screenH - _movieScale * _frameHeight) / 2;
_sys->copyRectToOverlay(_overlay, pitch, x, y, width, height);
#endif
_sys->updateScreen();
}
} // End of namespace Video

View file

@ -1,169 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef VIDEO_MPEG_PLAYER_H
#define VIDEO_MPEG_PLAYER_H
#include "common/scummsys.h"
#include "graphics/pixelformat.h"
// Uncomment this if you are using libmpeg2 0.3.1.
// #define USE_MPEG2_0_3_1
#ifdef USE_MPEG2
#if defined(__PLAYSTATION2__)
typedef uint8 uint8_t;
typedef uint16 uint16_t;
typedef uint32 uint32_t;
#elif defined(_WIN32_WCE)
typedef signed char int8_t;
typedef signed short int16_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
#elif defined(_MSC_VER)
typedef signed char int8_t;
typedef signed short int16_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
#if !defined(SDL_COMPILEDVERSION) || (SDL_COMPILEDVERSION < 1210)
typedef signed long int32_t;
typedef unsigned long uint32_t;
#endif
#else
# include <inttypes.h>
#endif
extern "C" {
#include <mpeg2dec/mpeg2.h>
}
#ifdef USE_MPEG2_0_3_1
typedef int mpeg2_state_t;
typedef sequence_t mpeg2_sequence_t;
#define STATE_BUFFER -1
#endif
#endif
#ifdef BACKEND_8BIT
#define SQR(x) ((x) * (x))
#define SHIFT 3
#else
#define SHIFT 1
#endif
#define BITDEPTH (1 << (8 - SHIFT))
#define ROUNDADD (1 << (SHIFT - 1))
#define BUFFER_SIZE 4096
namespace Common {
class File;
}
class OSystem;
namespace Video {
class BaseAnimationState {
protected:
const int _movieWidth;
const int _movieHeight;
int _frameWidth;
int _frameHeight;
#ifndef BACKEND_8BIT
int _movieScale;
#endif
OSystem *_sys;
uint _frameNum;
#ifdef USE_MPEG2
mpeg2dec_t *_mpegDecoder;
const mpeg2_info_t *_mpegInfo;
#endif
Common::File *_mpegFile;
#ifdef BACKEND_8BIT
int _palNum;
int _maxPalNum;
byte _yuvLookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
byte *_lut;
byte *_lut2;
int _lutCalcNum;
int _curPal;
int _cr;
int _pos;
struct {
uint cnt;
uint end;
byte pal[4 * 256];
} _palettes[50];
#else
OverlayColor *_overlay;
Graphics::PixelFormat _overlayFormat;
int16 *_colorTab;
OverlayColor *_rgbToPix;
#endif
public:
BaseAnimationState(OSystem *sys, int width, int height);
virtual ~BaseAnimationState();
bool init(const char *name);
bool decodeFrame();
void handleScreenChanged();
void updateScreen();
#ifndef BACKEND_8BIT
void buildLookup();
#endif
int getFrameWidth() { return _frameWidth; }
int getFrameHeight() { return _frameHeight; }
protected:
bool checkPaletteSwitch();
virtual void drawYUV(int width, int height, byte *const *dat) = 0;
#ifdef BACKEND_8BIT
void buildLookup(int p, int lines);
virtual void setPalette(byte *pal) = 0;
#else
void plotYUV(int width, int height, byte *const *dat);
void plotYUV1x(int width, int height, byte *const *dat);
void plotYUV2x(int width, int height, byte *const *dat);
void plotYUV3x(int width, int height, byte *const *dat);
#endif
};
} // End of namespace Video
#endif