1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-23 03:37:27 +00:00

Merge svn changes up to r27649

Conflicts:
	Makefile
	configure
	libvo/x11_common.c
This commit is contained in:
Uoti Urpala 2008-09-20 16:13:33 +03:00
commit 849dc0ba31
53 changed files with 2237 additions and 2497 deletions

View File

@ -56,6 +56,7 @@ MPlayer (1.0)
libmpeg2:
* enable Alpha/ARM optimizations in libmpeg2
* SSE2-optimized IDCT routines from upstream libmpeg2
* libmpeg2 updated to version 0.5.1
Drivers:
* replace PolypAudio by PulseAudio (-ao pulse)

View File

@ -61,11 +61,11 @@ Copyright: 1998, 1999 Eric Smith <eric@brouhaha.com>
License: GNU General Public License
Name: libmpeg2
Version: 0.4.1 + patches
Version: 0.5.1 + patches
Homepage: http://libmpeg2.sourceforge.net/
Directory: libmpeg2
Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
2000-2003 Michel Lespinasse <walken@zoy.org>
2000-2004 Michel Lespinasse <walken@zoy.org>
2002-2003 Falk Hueffner <falk@debian.org>
2003 David S. Miller <davem@redhat.com>
2003 Regis Duchesne <hpreg@zoy.org>

View File

@ -905,7 +905,7 @@ to ensure it does not cause security problems (e.g.\& make sure to use full
paths if "." is in your path like on Windows).
.sp 1
This can be "misused" to disable screensavers that do not support the proper
X API.
X API (also see \-stop\-xscreensaver).
If you think this is too complicated, ask the author of the screensaver
program to support the proper X APIs.
.sp 1
@ -3217,6 +3217,8 @@ do not know the screen resolution like fbdev, x11 and TV-out.
.TP
.B \-stop\-xscreensaver (X11 only)
Turns off xscreensaver at startup and turns it on again on exit.
If your screensaver supports neither the XSS nor XResetScreenSaver
API please use \-heartbeat\-cmd instead.
.
.TP
.B "\-vm \ \ \ "
@ -3915,7 +3917,7 @@ Explicitly choose the Matrox device name to use (default: /dev/\:mga_vid).
.PD 1
.
.TP
.B s3fb (Linux only) (see also \-vf yuv2 and \-dr)
.B s3fb (Linux only) (also see \-vf yuv2 and \-dr)
S3 Virge specific video output driver.
This driver supports the card's YUV conversion and scaling, double
buffering and direct rendering features.
@ -4477,8 +4479,21 @@ This is not a bug, but a side effect of not decoding at full resolution.
If <w> is specified lowres decoding will be used only if the width of the
video is major than or equal to <w>.
.RE
.IPs "o\ \ \ \ "
FIXME: undocumented
.B o=<key>=<value>[,<key>=<value>[,...]]
Pass AVOptions to libavcodec decoder
Note, a patch to make the o= unneeded and pass all unknown options through
the AVOption system is welcome.
A full list of AVOptions can be found in FFmpeg manual.
Note that some options may conflict with MEncoder options.
.sp 1
.RS
.I EXAMPLE:
.RE
.RSs
.PD 0
.IPs o=debug=pict
.PD 1
.RE
.IPs "sb=<number> (MPEG-2 only)"
Skip the given number of macroblock rows at the bottom.
.IPs "st=<number> (MPEG-2 only)"
@ -7630,9 +7645,11 @@ Read the source for full details.
.
.TP
.B o=<key>=<value>[,<key>=<value>[,...]]
Pass AVOptions to libavcodec
Pass AVOptions to libavcodec encoder
Note, a patch to make the o= unneeded and pass all unknown options through
the AVOption system is welcome.
A full list of AVOptions can be found in FFmpeg manual.
Note that some AVOptions may conflict with MEncoder options.
.sp 1
.RS
.I EXAMPLE:
@ -7889,7 +7906,7 @@ so quality may be low.
motion estimation search range (default: 0 (unlimited))
.
.TP
.B mbd=<0\-2> (see also *cmp, qpel)
.B mbd=<0\-2> (also see *cmp, qpel)
Macroblock decision algorithm (high quality mode), encode each macro
block in all modes and choose the best.
This is slow but results in better quality and file size.
@ -9075,9 +9092,6 @@ FIXME: Document this.
.B skip_threshold=<0\-1000000>
FIXME: Document this.
.
.TP
.B "o\ \ \ \ \ \ "
FIXME: undocumented
.
.
.SS nuv (\-nuvopts)
@ -10473,8 +10487,21 @@ Maximum length in seconds to analyze the stream properties.
Force a specific libavformat demuxer.
.
.TP
.B "o\ \ \ \ \ \ "
FIXME: undocumented
.B o=<key>=<value>[,<key>=<value>[,...]]
Pass AVOptions to libavformat demuxer
Note, a patch to make the o= unneeded and pass all unknown options through
the AVOption system is welcome.
A full list of AVOptions can be found in FFmpeg manual.
Note that some options may conflict with MPlayer/MEncoder options.
.sp 1
.RS
.I EXAMPLE:
.RE
.RSs
.PD 0
.IPs o=ignidx
.PD 1
.RE
.
.TP
.B probesize=<value>
@ -10532,6 +10559,8 @@ MPEG-4 format
MPEG-4 format with extra header flags required by Apple iPod firmware
.IPs "dv\ \ \ "
Sony Digital Video container
.IPs "matroska\ \ \ "
Matroska
.RE
.PD 1
.TP
@ -10541,8 +10570,21 @@ currently it is meaningful only for MPEG[12].
Sometimes raising it is necessary in order to avoid "buffer underflows".
.
.TP
.B "o\ \ \ \ \ \ "
FIXME: undocumented
.B o=<key>=<value>[,<key>=<value>[,...]]
Pass AVOptions to libavformat muxer
Note, a patch to make the o= unneeded and pass all unknown options through
the AVOption system is welcome.
A full list of AVOptions can be found in FFmpeg manual.
Note that some options may conflict with MEncoder options.
.sp 1
.RS
.I EXAMPLE:
.RE
.RSs
.PD 0
.IPs o=packetsize=100
.PD 1
.RE
.
.TP
.B packetsize=<size>

View File

@ -1,4 +1,4 @@
.\" Synced with r27407
.\" Synced with r27607
.\" MPlayer (C) 2000-2008 MPlayer Team
.\" Ezt a man oldalt Gabucino, Diego Biurrun és Jonas Jermann készíti/készítette
.\" Karbantartó: Gabrov
@ -33,7 +33,7 @@
.\" Név
.\" --------------------------------------------------------------------------
.
.TH MPlayer 1 "2008. 08. 06." "MPlayer Project" "A film lejátszó"
.TH MPlayer 1 "2008. 09. 14." "MPlayer Project" "A film lejátszó"
.
.SH NÉV
mplayer \- film lejátszó
@ -906,7 +906,7 @@ hogy ne okozzon biztons
utakat használsz, ha a "." benne van az elérési utadban, mint Windows alatt).
.sp 1
Ezt "ki lehet használni" az olyan képernyővédő letiltásához, amely nem
támogatja ehhez a megfelelõ X API-kat.
támogatja ehhez a megfelelő X API-kat (lásd még \-stop\-xscreensaver).
Ha úgy gondolod, hogy ez túl komplikált, kérd meg a képernyővédő
szerzőjét, hogy támogassa a szükséges X API-kat.
.sp 1
@ -3230,6 +3230,8 @@ ami nem tudja a k
.TP
.B \-stop\-xscreensaver (csak X11)
Kikapcsolja az xscreensaver-t a lejátszás indításakor, kilépéskor újraindítja.
Ha a képernyő védőd sem az XSS, sem az XResetScreenSaver API-t nem támogatja,
használd inkább a \-heartbeat\-cmd kapcsolót.
.
.TP
.B "\-vm \ \ \ "
@ -3474,8 +3476,9 @@ Nagyon gyors kimeneti vide
.RSs
.IPs <aleszköz>
Explicit kiválasztja a használni kívánt VIDIX aleszközt.
A használható aleszközök a cyberblade, mach64,
mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, sis és unichrome.
A használható aleszközök a cyberblade, ivtv, mach64,
mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, s3, sh_veu,
sis_vid és unichrome.
.RE
.PD 1
.
@ -7410,11 +7413,11 @@ A codec specifikus k
.B \-<codec>opts <opció1[=érték1]:opció2[=érték2]:...>
.
.PP
Ahol a <codec> lehet: lavc, xvidenc, lame, toolame, twolame,
Ahol a <codec> lehet: lavc, xvidenc, mp3lame, toolame, twolame,
nuv, xvfw, faac, x264enc, mpeg, lavf.
.
.
s.SS lame (\-lameopts)
s.SS mp3lame (\-lameopts)
.
.TP
.B "help\ \ \ "
@ -7648,6 +7651,21 @@ N
.PD 1
.
.TP
.B o=<kulcs>=<érték>[,<kulcs>=<érték>[,...]]
AVOption átadása a libavcodec-nek
Emlékezz rá, hogy az o= kapcsolót feleslegessé tevő, az összes ismeretlen
opciót a AVOption rendszernek átadó javítást szívesen fogadunk.
.sp 1
.RS
.I PÉLDA:
.RE
.RSs
.PD 0
.IPs o=bt=100k
.PD 1
.RE
.
.TP
.B acodec=<érték>
audió codec (alapértelmezett: mp2)
.PD 0

View File

@ -23,6 +23,8 @@ Documentation:
* document channels.conf syntax
* ability for multiple languages/locales in one binary
Small improvements:
* vo_mga should completely blank the screen like fbdev and tdfxfb
@ -87,7 +89,7 @@ Filters:
* xinerama video filter that splits movie to 2 screens (like zr)
* mixing of multiple videos (picture in picture, ...)
* mixing of multiple videos (picture in picture, review shmem patch)
* video watermark/logo filter (apply vf_overlay patch?)

View File

@ -326,7 +326,8 @@ The name comes from the fact that this method encodes the file
<emphasis>twice</emphasis>. The first encoding (dubbed pass) creates some
temporary files (<filename>*.log</filename>) with a size of few megabytes, do
not delete them yet (you can delete the AVI or rather just not create any video
by redirecting it into <filename>/dev/null</filename>).
by redirecting it into <filename>/dev/null</filename>
or on Windows into <filename>NUL</filename>).
In the second pass, the two pass output
file is created, using the bitrate data from the temporary files. The
resulting file will have much better image quality. If this is the first

View File

@ -296,8 +296,8 @@ SRCS_COMMON-$(HAVE_SYS_MMAN_H) += libaf/af_export.c osdep/mmap_anon.c
SRCS_COMMON-$(JPEG) += libmpcodecs/vd_ijpg.c
SRCS_COMMON-$(LADSPA) += libaf/af_ladspa.c
SRCS_COMMON-$(LIBA52) += libmpcodecs/ad_hwac3.c \
libmpcodecs/ad_liba52.c \
liba52/crc.c \
libmpcodecs/ad_liba52.c
SRCS_COMMON-$(LIBA52_INTERNAL) += liba52/crc.c \
liba52/resample.c \
liba52/bit_allocate.c \
liba52/bitstream.c \
@ -637,7 +637,7 @@ COMMON_LIBS-$(LIBAVFORMAT_A) += ffmpeg/libavformat/libavformat.a
COMMON_LIBS-$(LIBAVCODEC_A) += ffmpeg/libavcodec/libavcodec.a
COMMON_LIBS-$(LIBAVUTIL_A) += ffmpeg/libavutil/libavutil.a
COMMON_LIBS-$(LIBPOSTPROC_A) += ffmpeg/libpostproc/libpostproc.a
COMMON_LIBS = libswscale/libswscale.a
COMMON_LIBS-$(LIBSWSCALE_A) += libswscale/libswscale.a
COMMON_LIBS += $(COMMON_LIBS-yes)
OBJS_COMMON += $(addsuffix .o, $(basename $(SRCS_COMMON)))
@ -755,7 +755,7 @@ mplayer$(EXESUF): $(MPLAYER_DEPS)
$(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
$(HOST_CC) -O -I. -Iffmpeg -DCODECS2HTML -o $@ $<
$(HOST_CC) -O -DCODECS2HTML $(EXTRA_INC) -Iffmpeg -o $@ $<
codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf
./$^ > $@

View File

@ -15,7 +15,7 @@
# This script is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# version 2.1 of the License, or (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of

93
configure vendored
View File

@ -293,10 +293,12 @@ Codecs:
--disable-libavcodec_a disable static libavcodec [autodetect]
--disable-libavformat_a disable static libavformat [autodetect]
--disable-libpostproc_a disable static libpostproc [autodetect]
--disable-libswscale_a disable static libswscale [autodetect]
--disable-libavutil_so disable shared libavutil [autodetect]
--disable-libavcodec_so disable shared libavcodec [autodetect]
--disable-libavformat_so disable shared libavformat [autodetect]
--disable-libpostproc_so disable shared libpostproc [autodetect]
--disable-libswscale_so disable shared libswscale [autodetect]
--disable-libavcodec_mpegaudio_hp disable high precision audio decoding
in libavcodec [enabled]
--disable-tremor-internal disable internal Tremor [enabled]
@ -320,7 +322,8 @@ Codecs:
--enable-xmms enable XMMS input plugin support [disabled]
--enable-libdca enable libdca support [autodetect]
--disable-mp3lib disable builtin mp3lib [enabled]
--disable-liba52 disable builtin liba52 [enabled]
--disable-liba52 disable liba52 [autodetect]
--disable-liba52-internal disable builtin liba52 [autodetect]
--disable-libmpeg2 disable builtin libmpeg2 [autodetect]
--disable-musepack disable musepack support [autodetect]
--disable-libamr_nb disable libamr narrowband [autodetect]
@ -517,6 +520,8 @@ _libavformat_a=auto
_libavformat_so=auto
_libpostproc_a=auto
_libpostproc_so=auto
_libswscale_a=auto
_libswscale_so=auto
_libavcodec_mpegaudio_hp=yes
_mencoder=yes
_mplayer=yes
@ -574,7 +579,8 @@ _libvorbis=auto
_speex=auto
_theora=auto
_mp3lib=yes
_liba52=yes
_liba52=auto
_liba52_internal=auto
_libdca=auto
_libmpeg2=auto
_faad=auto
@ -938,6 +944,8 @@ for ac_option do
--disable-theora) _theora=no ;;
--enable-mp3lib) _mp3lib=yes ;;
--disable-mp3lib) _mp3lib=no ;;
--enable-liba52-internal) _liba52_internal=yes ;;
--disable-liba52-internal) _liba52_internal=no ;;
--enable-liba52) _liba52=yes ;;
--disable-liba52) _liba52=no ;;
--enable-libdca) _libdca=yes ;;
@ -1082,6 +1090,10 @@ for ac_option do
--disable-libpostproc_a) _libpostproc_a=no ;;
--enable-libpostproc_so) _libpostproc_so=yes ;;
--disable-libpostproc_so) _libpostproc_so=no ;;
--enable-libswscale_a) _libswscale_a=yes ;;
--disable-libswscale_a) _libswscale_a=no ;;
--enable-libswscale_so) _libswscale_so=yes ;;
--disable-libswscale_so) _libswscale_so=no ;;
--enable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=yes ;;
--disable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=no ;;
@ -1350,6 +1362,7 @@ if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then
fi
_inc_extra="$_inc_extra -I."
_timer=timer-linux.c
_getch=getch2.c
if freebsd ; then
@ -6041,7 +6054,7 @@ EOF
done
if test "$_theora" = no && test "$_tremor_internal" = yes; then
for _ld_theora in "`$_pkg_config --silence-errors --libs --cflags theora`" "-ltheora -logg"; do
cc_check -I. tremor/bitwise.c $_ld_theora \
cc_check tremor/bitwise.c $_ld_theora \
&& _ld_extra="$_ld_extra $_ld_theora" && theora=yes && break
done
fi
@ -6068,12 +6081,29 @@ else
fi
echores "$_mp3lib"
echocheck "internal liba52 support"
echocheck "liba52 support"
_def_liba52='#undef CONFIG_LIBA52'
_def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL"
if test "$_liba52_internal" = auto ; then
_liba52=yes
_liba52_internal=yes
_def_liba52_internal="#define CONFIG_LIBA52_INTERNAL 1"
_res_comment="internal"
elif test "$_liba52_internal" = no && test "$_liba52" = auto ; then
_liba52=no
cat > $TMPC << EOF
#include <inttypes.h>
#include <a52dec/a52.h>
int main(void) { a52_state_t *testHand; testHand=a52_init(0); return 0; }
EOF
cc_check -la52 && _liba52=yes
_ld_extra="$_ld_extra -la52"
_res_comment="external"
fi
if test "$_liba52" = yes ; then
_def_liba52='#define CONFIG_LIBA52 1'
_codecmodules="liba52 $_codecmodules"
_codecmodules="liba52($_res_comment) $_codecmodules"
else
_def_liba52='#undef CONFIG_LIBA52'
_nocodecmodules="liba52 $_nocodecmodules"
fi
echores "$_liba52"
@ -6562,7 +6592,6 @@ if test "$_libpostproc_a" = auto ; then
elif test "$_libpostproc_so" = auto ; then
_libpostproc_so=no
cat > $TMPC << EOF
#define CONFIG_LIBPOSTPROC 1
#include <inttypes.h>
#include <libpostproc/postprocess.h>
int main(void) { pp_get_mode_by_name_and_quality("de", 0); return 0; }
@ -6584,6 +6613,40 @@ test "$_libpostproc_so" = yes \
&& _def_libpostproc_so='#define CONFIG_LIBPOSTPROC_SO 1'
echores "$_libpostproc"
echocheck "FFmpeg libswscale"
if test "$_libswscale_a" = auto ; then
_libswscale_a=no
if test -d libswscale && test -f libswscale/swscale.h ; then
_libswscale_a='yes'
_res_comment="static"
fi
elif test "$_libswscale_so" = auto ; then
_libswscale_so=no
_res_comment="using libswscale.so, but static libswscale is recommended"
cat > $TMPC << EOF
#include <libswscale/swscale.h>
int main(void) { sws_scale(0, 0, 0, 0, 0, 0, 0); return 0; }
EOF
if $_pkg_config --exists libswscale ; then
_inc_libswscale=`$_pkg_config --cflags libswscale`
_ld_tmp=`$_pkg_config --libs libswscale`
cc_check $_inc_libswscale $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" \
&& _libswscale_so=yes
elif cc_check -lswscale ; then
_ld_extra="$_ld_extra -lswscale"
_libswscale_so=yes
fi
fi
_libswscale=no
_def_libswscale='#undef CONFIG_LIBSWSCALE'
_def_libswscale_a='#undef CONFIG_LIBSWSCALE_A'
_def_libswscale_so='#undef CONFIG_LIBSWSCALE_SO'
test "$_libswscale_a" = yes || test "$_libswscale_so" = yes && _libswscale=yes
test "$_libswscale" = yes && _def_libswscale='#define CONFIG_LIBSWSCALE 1'
test "$_libswscale_a" = yes && _def_libswscale_a='#define CONFIG_LIBSWSCALE_A 1'
test "$_libswscale_so" = yes \
&& _def_libswscale_so='#define CONFIG_LIBSWSCALE_SO 1'
echores "$_libswscale"
echocheck "libamr narrowband"
if test "$_libamr_nb" = auto ; then
@ -7738,6 +7801,8 @@ if test "$_largefiles" = yes || freebsd ; then
fi
fi
CXXFLAGS=" $CFLAGS -Iffmpeg -D__STDC_LIMIT_MACROS"
cat > $TMPC << EOF
int main(void) { return 0; }
EOF
@ -7748,8 +7813,7 @@ if test "$cc_vendor" = "gnu" ; then
fi
CFLAGS_FFMPEG="-I../.. $CFLAGS"
CFLAGS="-I. -Iffmpeg $CFLAGS"
CXXFLAGS=" $CFLAGS -D__STDC_LIMIT_MACROS"
CFLAGS="-Iffmpeg $CFLAGS"
cc_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer"
@ -7825,6 +7889,7 @@ MPLAYER = $_mplayer
#internal libraries
LIBA52 = $_liba52
LIBA52_INTERNAL = $_liba52_internal
LIBMPEG2 = $_libmpeg2
MP3LIB = $_mp3lib
TREMOR_INTERNAL = $_tremor_internal
@ -7953,6 +8018,9 @@ LIBAVFORMAT_SO = $_libavformat_so
LIBPOSTPROC = $_libpostproc
LIBPOSTPROC_A = $_libpostproc_a
LIBPOSTPROC_SO = $_libpostproc_so
LIBSWSCALE = $_libswscale
LIBSWSCALE_A = $_libswscale_a
LIBSWSCALE_SO = $_libswscale_so
BUILD_STATIC=yes
SRC_PATH=..
@ -8322,6 +8390,10 @@ $_def_libavutil
$_def_libavutil_a
$_def_libavutil_so
$_def_libswscale
$_def_libswscale_a
$_def_libswscale_so
/* Use libavcodec's decoders */
#define CONFIG_DECODERS 1
#define ENABLE_DECODERS 1
@ -8368,6 +8440,9 @@ $_def_xvid_lavc
/* Use codec libs included in mplayer CVS / source dist: */
$_def_mp3lib
/* enable liba52 support */
$_def_liba52_internal
$_def_liba52
$_def_libmpeg2

View File

@ -382,25 +382,15 @@ static void check_os_katmai_support( void )
mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0);
if (ret < 0 || !has_sse) {
gCpuCaps.hasSSE=0;
mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
} else {
gCpuCaps.hasSSE=1;
mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" );
}
gCpuCaps.hasSSE = ret >= 0 && has_sse;
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
mib[1] = CPU_SSE2;
varlen = sizeof(has_sse2);
mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " );
ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0);
if (ret < 0 || !has_sse2) {
gCpuCaps.hasSSE2=0;
mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
} else {
gCpuCaps.hasSSE2=1;
mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" );
}
gCpuCaps.hasSSE2 = ret >= 0 && has_sse2;
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE2 ? "yes.\n" : "no!\n" );
#else
gCpuCaps.hasSSE = 0;
mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" );
@ -412,8 +402,7 @@ static void check_os_katmai_support( void )
exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse);
__asm __volatile ("xorps %xmm0, %xmm0");
SetUnhandledExceptionFilter(exc_fil);
if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
}
#elif defined(__OS2__)
EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse };
@ -422,8 +411,7 @@ static void check_os_katmai_support( void )
DosSetExceptionHandler( &RegRec );
__asm __volatile ("xorps %xmm0, %xmm0");
DosUnsetExceptionHandler( &RegRec );
if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
}
#elif defined(__linux__)
#if defined(_POSIX_SOURCE)
@ -447,11 +435,7 @@ static void check_os_katmai_support( void )
// __asm __volatile ("xorps %%xmm0, %%xmm0");
__asm __volatile ("xorps %xmm0, %xmm0");
if ( gCpuCaps.hasSSE ) {
mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
} else {
mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
}
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
}
/* Restore the original signal handlers.
@ -461,11 +445,7 @@ static void check_os_katmai_support( void )
/* If we've gotten to here and the XMM CPUID bit is still set, we're
* safe to go ahead and hook out the SSE code throughout Mesa.
*/
if ( gCpuCaps.hasSSE ) {
mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE passed.\n" );
} else {
mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE failed!\n" );
}
mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE %s\n", gCpuCaps.hasSSE ? "passed." : "failed!" );
#else
/* We can't use POSIX signal handling to test the availability of
* SSE, so we disable it by default.

View File

@ -85,6 +85,14 @@ videocodec mpegpes
fourcc xdv7,xdv8,xdv9
fourcc xdva,xdvb,xdvc
fourcc xdvd,xdve,xdvf
fourcc xd5a,xd5b,xd5c
fourcc xd5d,xd5e,xd5f
fourcc xd59
fourcc mx5n,mx4n,mx4p
fourcc mx3n,mx3p
fourcc AVmp
fourcc mp2v,mpgv
fourcc VCR2
driver mpegpes
out MPES
@ -119,6 +127,14 @@ videocodec ffmpeg2
fourcc xdv7,xdv8,xdv9
fourcc xdva,xdvb,xdvc
fourcc xdvd,xdve,xdvf
fourcc xd5a,xd5b,xd5c
fourcc xd5d,xd5e,xd5f
fourcc xd59
fourcc mx5n,mx4n,mx4p
fourcc mx3n,mx3p
fourcc AVmp
fourcc VCR2
fourcc mp2v,mpgv
driver ffmpeg
dll "mpeg2video"
out YV12,I420,IYUV
@ -147,6 +163,13 @@ videocodec ffmpeg12
fourcc xdv7,xdv8,xdv9
fourcc xdva,xdvb,xdvc
fourcc xdvd,xdve,xdvf
fourcc xd5a,xd5b,xd5c
fourcc xd5d,xd5e,xd5f
fourcc xd59
fourcc mx5n,mx4n,mx4p
fourcc mx3n,mx3p
fourcc AVmp
fourcc mp2v,mpgv
driver ffmpeg
dll "mpegvideo"
out YV12,I420,IYUV
@ -176,6 +199,13 @@ videocodec mpeg12
fourcc xdv7,xdv8,xdv9
fourcc xdva,xdvb,xdvc
fourcc xdvd,xdve,xdvf
fourcc xd5a,xd5b,xd5c
fourcc xd5d,xd5e,xd5f
fourcc xd59
fourcc mx5n,mx4n,mx4p
fourcc mx3n,mx3p
fourcc AVmp
fourcc mp2v,mpgv
driver libmpeg2
; dll "libmpeg2"
out YV12,I420,IYUV
@ -203,6 +233,13 @@ videocodec ffmpeg12mc
fourcc xdv7,xdv8,xdv9
fourcc xdva,xdvb,xdvc
fourcc xdvd,xdve,xdvf
fourcc xd5a,xd5b,xd5c
fourcc xd5d,xd5e,xd5f
fourcc xd59
fourcc mx5n,mx4n,mx4p
fourcc mx3n,mx3p
fourcc AVmp
fourcc mp2v,mpgv
driver ffmpeg
dll "mpegvideo_xvmc"
out IDCT_MPEG2
@ -617,6 +654,7 @@ videocodec ffindeo2
info "Indeo 2 native decoder"
status working
fourcc RT21
fourcc IV20
driver ffmpeg
dll indeo2
out YVU9
@ -698,6 +736,7 @@ videocodec ffvc1
info "FFmpeg WVC1"
status buggy
fourcc WVC1,wvc1,WMVA
fourcc vc-1,VC-1
driver ffmpeg
dll vc1
out YV12,I420,IYUV
@ -742,6 +781,9 @@ videocodec ffodivx
fourcc SMP4,smp4 ; Samsung SMP4 video codec
fourcc VIDM ; vidm 4.01 codec
format 0x10000004 ; mpeg 4 es
fourcc m4cc,M4CC
fourcc hdx4,HDX4
fourcc FVFW,fvfw
driver ffmpeg
dll mpeg4 ;opendivx
out YV12,I420,IYUV
@ -990,6 +1032,7 @@ videocodec ffmjpeg
fourcc JPGL ; lossless JPEG (pegasus codec)
fourcc LJPG ; lossless JPEG
fourcc dmb1 ; MJPEG by Matrox Rainbow Runner
fourcc MJLS ; JPEG-LS custom FOURCC for avi - encoder
driver ffmpeg
dll mjpeg
out 444P
@ -1081,6 +1124,7 @@ videocodec m3jpeg2k
info "Morgan MJPEG2000"
status working
fourcc MJ2C
fourcc MJP2
driver vfw
dll "m3jp2k32.dll"
out YV12,I420,IYUV
@ -1181,6 +1225,7 @@ videocodec ffh263
fourcc s263,S263
fourcc D263 ; DEC H263
fourcc L263 ; Lead H263
fourcc ILVR ; ITU H263+
driver ffmpeg
dll h263
out YV12,I420,IYUV
@ -1335,6 +1380,10 @@ videocodec ffdv
fourcc dv50 ; DVCPRO 50
fourcc dv5n ; DVCPRO 50 NTSC in .mov
fourcc dv5p ; DVCPRO 50 PAL in .mov
fourcc AVdv,AVd1
fourcc dvhq,dvhp
fourcc dvh5,dvh6,dvh3
fourcc dvhd,dvsl,dv25
driver ffmpeg
dll dvvideo
out 411P,422P,YV12
@ -1350,7 +1399,9 @@ videocodec libdv
fourcc dv50 ; DVCPRO 50
fourcc dv5n ; DVCPRO 50 NTSC in .mov
fourcc dv5p ; DVCPRO 50 PAL in .mov
fourcc AVdv ; AVID DV
fourcc AVdv,AVd1 ; AVID DV
fourcc dvhq,dvhp
fourcc dvh5,dvh6,dvh3
driver libdv
dll libdv.so.2
out YUY2
@ -1884,6 +1935,7 @@ videocodec ffcavs
comment "only works with libavformat demuxer"
status working
fourcc CAVS
fourcc avs2
driver ffmpeg
dll "cavs"
out I420
@ -2966,6 +3018,8 @@ audiocodec ffdv
info "FFmpeg DV audio decoder"
status working
fourcc RADV
fourcc vdva,dvca
fourcc dvau
driver ffmpeg
dll "dvaudio"
@ -2988,6 +3042,7 @@ audiocodec ffaac
fourcc "VLB " ; Used in NSV, not really working
fourcc "AAC " ; Used in NSV
fourcc "AACP" ; Used in NSV for AACPlus
fourcc raac,racp
format 0xff
format 0x706D
driver ffmpeg
@ -3304,6 +3359,7 @@ audiocodec ffmusepack8
comment "only works with libavformat demuxer"
status working
fourcc "MPC8"
fourcc MPCK
driver ffmpeg
dll "mpc8"

View File

@ -13,32 +13,32 @@ enum PixelFormat imgfmt2pixfmt(int fmt)
case IMGFMT_BGR24:
return PIX_FMT_BGR24;
case IMGFMT_BGR16:
return PIX_FMT_BGR565;
return PIX_FMT_RGB565;
case IMGFMT_BGR15:
return PIX_FMT_BGR555;
return PIX_FMT_RGB555;
case IMGFMT_BGR8:
return PIX_FMT_BGR8;
return PIX_FMT_RGB8;
case IMGFMT_BGR4:
return PIX_FMT_BGR4;
return PIX_FMT_RGB4;
case IMGFMT_BGR1:
case IMGFMT_RGB1:
return PIX_FMT_MONOBLACK;
case IMGFMT_RG4B:
return PIX_FMT_RGB4_BYTE;
case IMGFMT_BG4B:
return PIX_FMT_BGR4_BYTE;
case IMGFMT_BG4B:
return PIX_FMT_RGB4_BYTE;
case IMGFMT_RGB32:
return PIX_FMT_BGR32;
case IMGFMT_RGB24:
return PIX_FMT_RGB24;
case IMGFMT_RGB16:
return PIX_FMT_RGB565;
return PIX_FMT_BGR565;
case IMGFMT_RGB15:
return PIX_FMT_RGB555;
return PIX_FMT_BGR555;
case IMGFMT_RGB8:
return PIX_FMT_RGB8;
return PIX_FMT_BGR8;
case IMGFMT_RGB4:
return PIX_FMT_RGB4;
return PIX_FMT_BGR4;
case IMGFMT_YUY2:
return PIX_FMT_YUYV422;
case IMGFMT_UYVY:

View File

@ -17,7 +17,11 @@
#include "ad_internal.h"
#ifdef CONFIG_LIBA52_INTERNAL
#include "liba52/a52.h"
#else
#include <a52dec/a52.h>
#endif
static int isdts = -1;
@ -97,8 +101,10 @@ static int ac3dts_fillbuff(sh_audio_t *sh_audio)
sh_audio->a_in_buffer_len = length;
// TODO: is DTS also checksummed?
#ifdef CONFIG_LIBA52_INTERNAL
if(isdts == 0 && crc16_block(sh_audio->a_in_buffer + 2, length - 2) != 0)
mp_msg(MSGT_DECAUDIO, MSGL_STATUS, "a52: CRC check failed! \n");
#endif
return length;
}

View File

@ -16,8 +16,14 @@
#include "libaf/af_format.h"
#ifdef CONFIG_LIBA52_INTERNAL
#include "liba52/a52.h"
#include "liba52/mm_accel.h"
#else
#include <a52dec/a52.h>
#include <a52dec/mm_accel.h>
int (* a52_resample) (float * _f, int16_t * s16);
#endif
static a52_state_t *a52_state;
static uint32_t a52_flags=0;
@ -79,8 +85,10 @@ while(1){
if(sh_audio->format!=0x2000)
swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8);
#ifdef CONFIG_LIBA52_INTERNAL
if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0)
mp_msg(MSGT_DECAUDIO,MSGL_STATUS,"a52: CRC check failed! \n");
#endif
return length;
}
@ -121,7 +129,11 @@ static int preinit(sh_audio_t *sh)
{
/* Dolby AC3 audio: */
/* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */
#ifdef CONFIG_LIBA52_INTERNAL
if (sh->samplesize < 2) sh->samplesize = 2;
#else
if (sh->samplesize < 4) sh->samplesize = 4;
#endif
sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6;
sh->audio_in_minsize=3840;
a52_level = 1.0;
@ -158,17 +170,26 @@ static int init(sh_audio_t *sh_audio)
sample_t level=a52_level, bias=384;
int flags=0;
/* Dolby AC3 audio:*/
#ifdef MM_ACCEL_X86_SSE
if(gCpuCaps.hasSSE) a52_accel|=MM_ACCEL_X86_SSE;
#endif
if(gCpuCaps.hasMMX) a52_accel|=MM_ACCEL_X86_MMX;
if(gCpuCaps.hasMMX2) a52_accel|=MM_ACCEL_X86_MMXEXT;
if(gCpuCaps.has3DNow) a52_accel|=MM_ACCEL_X86_3DNOW;
#ifdef MM_ACCEL_X86_3DNOWEXT
if(gCpuCaps.has3DNowExt) a52_accel|=MM_ACCEL_X86_3DNOWEXT;
#endif
#ifdef MM_ACCEL_PPC_ALTIVEC
if(gCpuCaps.hasAltiVec) a52_accel|=MM_ACCEL_PPC_ALTIVEC;
#endif
a52_state=a52_init (a52_accel);
if (a52_state == NULL) {
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n");
return 0;
}
#ifndef CONFIG_LIBA52_INTERNAL
sh_audio->sample_format = AF_FORMAT_FLOAT_NE;
#endif
if(a52_fillbuff(sh_audio)<0){
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 sync failed\n");
return 0;
@ -241,8 +262,12 @@ while(sh_audio->channels>0){
break;
}
} else
#ifdef CONFIG_LIBA52_INTERNAL
if(a52_resample_init(a52_accel,flags,sh_audio->channels)) break;
--sh_audio->channels; /* try to decrease no. of channels*/
#else
break;
#endif
}
if(sh_audio->channels<=0){
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: no resampler. try different channel setup!\n");

View File

@ -2,20 +2,21 @@
* Demuxer for avisynth
* Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This file is part of MPlayer.
*
* This library is distributed in the hope that it will be useful,
* MPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* MPlayer 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
* Library General Public License for more details.
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Lesser General Public License
* along with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>

View File

@ -5,20 +5,21 @@
* Avisynth C Interface Version 0.20
* Copyright 2003 Kevin Atkinson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This file is part of MPlayer.
*
* This library is distributed in the hope that it will be useful,
* MPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* MPlayer 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
* Library General Public License for more details.
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Lesser General Public License
* along with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_DEMUX_AVS_H

View File

@ -36,10 +36,9 @@
#include "libvo/sub.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavutil/avutil.h"
#include "libavformat/avi.h"
#include "libavcodec/opt.h"
#include "libavformat/riff.h"
#include "mp_taglists.h"

View File

@ -62,9 +62,9 @@ void mpeg2_free (void * buf)
free (*(((void **)buf) - 1));
}
void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t),
int free (void *))
void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t),
int free_func (void *))
{
malloc_hook = malloc;
free_hook = free;
malloc_hook = alloc_func;
free_hook = free_func;
}

View File

@ -20,8 +20,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ALPHA_ASM_H
#define ALPHA_ASM_H
#ifndef LIBMPEG2_ALPHA_ASM_H
#define LIBMPEG2_ALPHA_ASM_H
#include <inttypes.h>
@ -178,4 +178,4 @@ struct unaligned_long { uint64_t l; } __attribute__((packed));
#error "Unknown compiler!"
#endif
#endif /* ALPHA_ASM_H */
#endif /* LIBMPEG2_ALPHA_ASM_H */

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_ATTRIBUTES_H
#define LIBMPEG2_ATTRIBUTES_H
/* use gcc attribs to align critical data structures */
#ifdef ATTRIBUTE_ALIGNED_MAX
#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
@ -35,3 +38,5 @@
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#endif /* LIBMPEG2_ATTRIBUTES_H */

View File

@ -1,6 +1,6 @@
/*
* cpu_accel.c
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
@ -20,13 +20,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#include "config.h"
#include "cpudetect.h"
#include <inttypes.h>
@ -34,21 +33,26 @@
#include "attributes.h"
#include "mpeg2_internal.h"
#ifdef ACCEL_DETECT
#include "cpudetect.h"
#if defined(ARCH_X86) || defined(ARCH_X86_64)
/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow!
* instructions via assembly. However, it is regarded as duplicated work
* in MPlayer, so that we enforce using MPlayer's implementation.
*/
#define MPLAYER_CPUDETECT
static inline uint32_t arch_accel (void)
static inline uint32_t arch_accel (uint32_t accel)
{
#if !defined(MPLAYER_CPUDETECT)
uint32_t eax, ebx, ecx, edx;
int AMD;
uint32_t caps;
/* Use MPlayer CPU detection instead of libmpeg2 variant. */
#if 0
if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT))
accel |= MPEG2_ACCEL_X86_MMX;
if (accel & (MPEG2_ACCEL_X86_SSE2 | MPEG2_ACCEL_X86_SSE3))
accel |= MPEG2_ACCEL_X86_MMXEXT;
if (accel & (MPEG2_ACCEL_X86_SSE3))
accel |= MPEG2_ACCEL_X86_SSE2;
#ifdef ACCEL_DETECT
if (accel & MPEG2_ACCEL_DETECT) {
uint32_t eax, ebx, ecx, edx;
int AMD;
#if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__))
#define cpuid(op,eax,ebx,ecx,edx) \
@ -59,7 +63,7 @@ static inline uint32_t arch_accel (void)
"=d" (edx) \
: "a" (op) \
: "cc")
#else /* PIC version : save ebx (not needed on x86_64) */
#else /* PIC version : save ebx (not needed on x86_64) */
#define cpuid(op,eax,ebx,ecx,edx) \
__asm__ ("pushl %%ebx\n\t" \
"cpuid\n\t" \
@ -74,70 +78,79 @@ static inline uint32_t arch_accel (void)
#endif
#ifndef __x86_64__ /* x86_64 supports the cpuid op */
__asm__ ("pushf\n\t"
"pushf\n\t"
"pop %0\n\t"
"movl %0,%1\n\t"
"xorl $0x200000,%0\n\t"
"push %0\n\t"
"popf\n\t"
"pushf\n\t"
"pop %0\n\t"
"popf"
: "=r" (eax),
"=r" (ebx)
:
: "cc");
__asm__ ("pushf\n\t"
"pushf\n\t"
"pop %0\n\t"
"movl %0,%1\n\t"
"xorl $0x200000,%0\n\t"
"push %0\n\t"
"popf\n\t"
"pushf\n\t"
"pop %0\n\t"
"popf"
: "=r" (eax),
"=r" (ebx)
:
: "cc");
if (eax == ebx) /* no cpuid */
return 0;
if (eax == ebx) /* no cpuid */
return accel;
#endif
cpuid (0x00000000, eax, ebx, ecx, edx);
if (!eax) /* vendor string only */
return 0;
cpuid (0x00000000, eax, ebx, ecx, edx);
if (!eax) /* vendor string only */
return accel;
AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
AMD = (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65);
cpuid (0x00000001, eax, ebx, ecx, edx);
if (! (edx & 0x00800000)) /* no MMX */
return 0;
cpuid (0x00000001, eax, ebx, ecx, edx);
if (! (edx & 0x00800000)) /* no MMX */
return accel;
caps = MPEG2_ACCEL_X86_MMX;
if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
caps = MPEG2_ACCEL_X86_MMX | MPEG2_ACCEL_X86_MMXEXT;
accel |= MPEG2_ACCEL_X86_MMX;
if (edx & 0x02000000) /* SSE - identical to AMD MMX ext. */
accel |= MPEG2_ACCEL_X86_MMXEXT;
cpuid (0x80000000, eax, ebx, ecx, edx);
if (eax < 0x80000001) /* no extended capabilities */
return caps;
if (edx & 0x04000000) /* SSE2 */
accel |= MPEG2_ACCEL_X86_SSE2;
cpuid (0x80000001, eax, ebx, ecx, edx);
if (ecx & 0x00000001) /* SSE3 */
accel |= MPEG2_ACCEL_X86_SSE3;
if (edx & 0x80000000)
caps |= MPEG2_ACCEL_X86_3DNOW;
cpuid (0x80000000, eax, ebx, ecx, edx);
if (eax < 0x80000001) /* no extended capabilities */
return accel;
if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
caps |= MPEG2_ACCEL_X86_MMXEXT;
cpuid (0x80000001, eax, ebx, ecx, edx);
return caps;
#else /* MPLAYER_CPUDETECT: Use MPlayer's CPU capability property. */
caps = 0;
if (edx & 0x80000000)
accel |= MPEG2_ACCEL_X86_3DNOW;
if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
accel |= MPEG2_ACCEL_X86_MMXEXT;
}
#endif /* ACCEL_DETECT */
return accel;
#else /* 0 */
accel = 0;
if (gCpuCaps.hasMMX)
caps |= MPEG2_ACCEL_X86_MMX;
accel |= MPEG2_ACCEL_X86_MMX;
if (gCpuCaps.hasSSE2)
caps |= MPEG2_ACCEL_X86_SSE2;
accel |= MPEG2_ACCEL_X86_SSE2;
if (gCpuCaps.hasMMX2)
caps |= MPEG2_ACCEL_X86_MMXEXT;
accel |= MPEG2_ACCEL_X86_MMXEXT;
if (gCpuCaps.has3DNow)
caps |= MPEG2_ACCEL_X86_3DNOW;
accel |= MPEG2_ACCEL_X86_3DNOW;
return caps;
return accel;
#endif /* MPLAYER_CPUDETECT */
#endif /* 0 */
}
#endif /* ARCH_X86 || ARCH_X86_64 */
#if defined(ARCH_PPC) || defined(ARCH_SPARC)
#if defined(ACCEL_DETECT) && (defined(ARCH_PPC) || defined(ARCH_SPARC))
#include <signal.h>
#include <setjmp.h>
@ -154,96 +167,117 @@ static RETSIGTYPE sigill_handler (int sig)
canjump = 0;
siglongjmp (jmpbuf, 1);
}
#endif /* ACCEL_DETECT && (ARCH_PPC || ARCH_SPARC) */
#ifdef ARCH_PPC
static uint32_t arch_accel (void)
static uint32_t arch_accel (uint32_t accel)
{
static RETSIGTYPE (* oldsig) (int);
#ifdef ACCEL_DETECT
if ((accel & (MPEG2_ACCEL_PPC_ALTIVEC | MPEG2_ACCEL_DETECT)) ==
MPEG2_ACCEL_DETECT) {
static RETSIGTYPE (* oldsig) (int);
oldsig = signal (SIGILL, sigill_handler);
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return 0;
}
oldsig = signal (SIGILL, sigill_handler);
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return accel;
}
canjump = 1;
canjump = 1;
#if defined(__APPLE_CC__) /* apple */
#define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t"
#else /* gnu */
#else /* gnu */
#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t"
#endif
asm volatile ("mtspr 256, %0\n\t"
VAND (0, 0, 0)
:
: "r" (-1));
asm volatile ("mtspr 256, %0\n\t"
VAND (0, 0, 0)
:
: "r" (-1));
canjump = 0;
canjump = 0;
accel |= MPEG2_ACCEL_PPC_ALTIVEC;
signal (SIGILL, oldsig);
return MPEG2_ACCEL_PPC_ALTIVEC;
signal (SIGILL, oldsig);
}
#endif /* ACCEL_DETECT */
return accel;
}
#endif /* ARCH_PPC */
#ifdef ARCH_SPARC
static uint32_t arch_accel (void)
static uint32_t arch_accel (uint32_t accel)
{
static RETSIGTYPE (* oldsig) (int);
if (accel & MPEG2_ACCEL_SPARC_VIS2)
accel |= MPEG2_ACCEL_SPARC_VIS;
#ifdef ACCEL_DETECT
if ((accel & (MPEG2_ACCEL_SPARC_VIS2 | MPEG2_ACCEL_DETECT)) ==
MPEG2_ACCEL_DETECT) {
static RETSIGTYPE (* oldsig) (int);
oldsig = signal (SIGILL, sigill_handler);
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return accel;
}
canjump = 1;
/* pdist %f0, %f0, %f0 */
__asm__ __volatile__(".word\t0x81b007c0");
canjump = 0;
accel |= MPEG2_ACCEL_SPARC_VIS;
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return accel;
}
canjump = 1;
/* edge8n %g0, %g0, %g0 */
__asm__ __volatile__(".word\t0x81b00020");
canjump = 0;
accel |= MPEG2_ACCEL_SPARC_VIS2;
oldsig = signal (SIGILL, sigill_handler);
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return 0;
}
canjump = 1;
/* pdist %f0, %f0, %f0 */
__asm__ __volatile__(".word\t0x81b007c0");
canjump = 0;
if (sigsetjmp (jmpbuf, 1)) {
signal (SIGILL, oldsig);
return MPEG2_ACCEL_SPARC_VIS;
}
canjump = 1;
/* edge8n %g0, %g0, %g0 */
__asm__ __volatile__(".word\t0x81b00020");
canjump = 0;
signal (SIGILL, oldsig);
return MPEG2_ACCEL_SPARC_VIS | MPEG2_ACCEL_SPARC_VIS2;
}
#endif /* ARCH_SPARC */
#endif /* ARCH_PPC || ARCH_SPARC */
#ifdef ARCH_ALPHA
static uint32_t arch_accel (void)
{
uint64_t no_mvi;
asm volatile ("amask %1, %0"
: "=r" (no_mvi)
: "rI" (256)); /* AMASK_MVI */
return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
MPEG2_ACCEL_ALPHA_MVI);
}
#endif /* ARCH_ALPHA */
#endif /* ACCEL_DETECT */
uint32_t mpeg2_detect_accel (void)
{
uint32_t accel;
return accel;
}
#endif /* ARCH_SPARC */
#ifdef ARCH_ALPHA
static inline uint32_t arch_accel (uint32_t accel)
{
if (accel & MPEG2_ACCEL_ALPHA_MVI)
accel |= MPEG2_ACCEL_ALPHA;
accel = 0;
#ifdef ACCEL_DETECT
if (accel & MPEG2_ACCEL_DETECT) {
uint64_t no_mvi;
asm volatile ("amask %1, %0"
: "=r" (no_mvi)
: "rI" (256)); /* AMASK_MVI */
accel |= no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
MPEG2_ACCEL_ALPHA_MVI);
}
#endif /* ACCEL_DETECT */
return accel;
}
#endif /* ARCH_ALPHA */
uint32_t mpeg2_detect_accel (uint32_t accel)
{
#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
accel = arch_accel ();
#endif
accel = arch_accel (accel);
#endif
return accel;
}

View File

@ -19,10 +19,6 @@
* 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
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#include "config.h"
@ -54,7 +50,7 @@ static void state_restore_mmx (cpu_state_t * state)
#define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
#define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
#define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
#else /* gnu */
#else /* gnu */
#define LI(a,b) "li " #a "," #b "\n\t"
#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"

View File

@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
@ -135,20 +135,20 @@ static inline mpeg2_state_t seek_chunk (mpeg2dec_t * mpeg2dec)
}
mpeg2dec->bytes_since_tag += skipped;
mpeg2dec->code = mpeg2dec->buf_start[-1];
return (mpeg2_state_t)-1;
return STATE_INTERNAL_NORETURN;
}
mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec)
{
while (mpeg2dec->code != 0xb3 &&
((mpeg2dec->code != 0xb7 && mpeg2dec->code != 0xb8 &&
mpeg2dec->code) || mpeg2dec->sequence.width == (unsigned)-1))
while (!(mpeg2dec->code == 0xb3 ||
((mpeg2dec->code == 0xb7 || mpeg2dec->code == 0xb8 ||
!mpeg2dec->code) && mpeg2dec->sequence.width != (unsigned)-1)))
if (seek_chunk (mpeg2dec) == STATE_BUFFER)
return STATE_BUFFER;
mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
mpeg2dec->user_data_len = 0;
return (mpeg2dec->code ? mpeg2_parse_header (mpeg2dec) :
mpeg2_header_picture_start (mpeg2dec));
return ((mpeg2dec->code == 0xb7) ?
mpeg2_header_end (mpeg2dec) : mpeg2_parse_header (mpeg2dec));
}
#define RECEIVED(code,state) (((state) << 8) + (code))
@ -161,7 +161,7 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec)
mpeg2_state_t state;
state = mpeg2dec->action (mpeg2dec);
if ((int)state >= 0)
if ((int)state > (int)STATE_INTERNAL_NORETURN)
return state;
}
@ -200,22 +200,18 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec)
return STATE_BUFFER;
}
mpeg2dec->action = mpeg2_seek_header;
switch (mpeg2dec->code) {
case 0x00:
mpeg2dec->action = mpeg2_header_picture_start;
return mpeg2dec->state;
case 0xb7:
mpeg2dec->action = mpeg2_header_end;
break;
case 0xb3:
case 0xb7:
case 0xb8:
mpeg2dec->action = mpeg2_parse_header;
break;
return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID;
default:
mpeg2dec->action = seek_chunk;
return STATE_INVALID;
}
return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID;
}
mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
@ -262,7 +258,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
/* state transition after a sequence header */
case RECEIVED (0x00, STATE_SEQUENCE):
mpeg2dec->action = mpeg2_header_picture_start;
case RECEIVED (0xb8, STATE_SEQUENCE):
mpeg2_header_sequence_finalize (mpeg2dec);
break;
@ -270,7 +265,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
/* other legal state transitions */
case RECEIVED (0x00, STATE_GOP):
mpeg2_header_gop_finalize (mpeg2dec);
mpeg2dec->action = mpeg2_header_picture_start;
break;
case RECEIVED (0x01, STATE_PICTURE):
case RECEIVED (0x01, STATE_PICTURE_2ND):
@ -362,8 +356,8 @@ void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id)
mpeg2dec->fbuf[1]->buf[2]=buf[2];
mpeg2dec->fbuf[1]->id=NULL;
}
// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",
// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);
// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",
// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);
}
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)
@ -398,12 +392,10 @@ void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2)
uint32_t mpeg2_accel (uint32_t accel)
{
if (!mpeg2_accels) {
if (accel & MPEG2_ACCEL_DETECT)
accel |= mpeg2_detect_accel ();
mpeg2_accels = accel |= MPEG2_ACCEL_DETECT;
mpeg2_cpu_state_init (accel);
mpeg2_idct_init (accel);
mpeg2_mc_init (accel);
mpeg2_accels = mpeg2_detect_accel (accel) | MPEG2_ACCEL_DETECT;
mpeg2_cpu_state_init (mpeg2_accels);
mpeg2_idct_init (mpeg2_accels);
mpeg2_mc_init (mpeg2_accels);
}
return mpeg2_accels & ~MPEG2_ACCEL_DETECT;
}

View File

@ -21,7 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
@ -246,7 +246,7 @@ static int sequence_ext (mpeg2dec_t * mpeg2dec)
sequence->vbv_buffer_size |= buffer[4] << 21;
sequence->frame_period =
sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>2)&3)+1);
sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>5)&3)+1);
mpeg2dec->ext_state = SEQ_DISPLAY_EXT;
@ -257,12 +257,11 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec)
{
uint8_t * buffer = mpeg2dec->chunk_start;
mpeg2_sequence_t * sequence = &(mpeg2dec->new_sequence);
uint32_t flags;
flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) |
((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT));
sequence->flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) |
((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT));
if (buffer[0] & 1) {
flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
sequence->flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
sequence->colour_primaries = buffer[1];
sequence->transfer_characteristics = buffer[2];
sequence->matrix_coefficients = buffer[3];
@ -281,6 +280,17 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec)
return 0;
}
static inline void simplify (unsigned int * u, unsigned int * v)
{
unsigned int a, b, tmp;
a = *u; b = *v;
while (a) { /* find greatest common divisor */
tmp = a; a = b % tmp; b = tmp;
}
*u /= b; *v /= b;
}
static inline void finalize_sequence (mpeg2_sequence_t * sequence)
{
int width;
@ -317,8 +327,10 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence)
sequence->pixel_width = 64; sequence->pixel_height = 45; return;
case 6: /* 720x480 16:9 */
sequence->pixel_width = 32; sequence->pixel_height = 27; return;
case 12: /* 720*480 4:3 */
sequence->pixel_width = 8; sequence->pixel_height = 9; return;
case 8: /* BT.601 625 lines 4:3 */
sequence->pixel_width = 59; sequence->pixel_height = 54; return;
case 12: /* BT.601 525 lines 4:3 */
sequence->pixel_width = 10; sequence->pixel_height = 11; return;
default:
height = 88 * sequence->pixel_width + 1171;
width = 2000;
@ -327,22 +339,89 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence)
sequence->pixel_width = width;
sequence->pixel_height = height;
while (width) { /* find greatest common divisor */
int tmp = width;
width = height % tmp;
height = tmp;
}
sequence->pixel_width /= height;
sequence->pixel_height /= height;
simplify (&sequence->pixel_width, &sequence->pixel_height);
}
static void copy_matrix (mpeg2dec_t * mpeg2dec, int index)
int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
unsigned int * pixel_width,
unsigned int * pixel_height)
{
if (memcmp (mpeg2dec->quantizer_matrix[index],
mpeg2dec->new_quantizer_matrix[index], 64)) {
memcpy (mpeg2dec->quantizer_matrix[index],
mpeg2dec->new_quantizer_matrix[index], 64);
mpeg2dec->scaled[index] = -1;
static struct {
unsigned int width, height;
} video_modes[] = {
{720, 576}, /* 625 lines, 13.5 MHz (D1, DV, DVB, DVD) */
{704, 576}, /* 625 lines, 13.5 MHz (1/1 D1, DVB, DVD, 4CIF) */
{544, 576}, /* 625 lines, 10.125 MHz (DVB, laserdisc) */
{528, 576}, /* 625 lines, 10.125 MHz (3/4 D1, DVB, laserdisc) */
{480, 576}, /* 625 lines, 9 MHz (2/3 D1, DVB, SVCD) */
{352, 576}, /* 625 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVB, DVD) */
{352, 288}, /* 625 lines, 6.75 MHz, 1 field (D4, VCD, DVB, DVD, CIF) */
{176, 144}, /* 625 lines, 3.375 MHz, half field (QCIF) */
{720, 486}, /* 525 lines, 13.5 MHz (D1) */
{704, 486}, /* 525 lines, 13.5 MHz */
{720, 480}, /* 525 lines, 13.5 MHz (DV, DSS, DVD) */
{704, 480}, /* 525 lines, 13.5 MHz (1/1 D1, ATSC, DVD) */
{544, 480}, /* 525 lines. 10.125 MHz (DSS, laserdisc) */
{528, 480}, /* 525 lines. 10.125 MHz (3/4 D1, laserdisc) */
{480, 480}, /* 525 lines, 9 MHz (2/3 D1, SVCD) */
{352, 480}, /* 525 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVD) */
{352, 240} /* 525 lines. 6.75 MHz, 1 field (D4, VCD, DSS, DVD) */
};
unsigned int width, height, pix_width, pix_height, i, DAR_16_9;
*pixel_width = sequence->pixel_width;
*pixel_height = sequence->pixel_height;
width = sequence->picture_width;
height = sequence->picture_height;
for (i = 0; i < sizeof (video_modes) / sizeof (video_modes[0]); i++)
if (width == video_modes[i].width && height == video_modes[i].height)
break;
if (i == sizeof (video_modes) / sizeof (video_modes[0]) ||
(sequence->pixel_width == 1 && sequence->pixel_height == 1) ||
width != sequence->display_width || height != sequence->display_height)
return 0;
for (pix_height = 1; height * pix_height < 480; pix_height <<= 1);
height *= pix_height;
for (pix_width = 1; width * pix_width <= 352; pix_width <<= 1);
width *= pix_width;
if (! (sequence->flags & SEQ_FLAG_MPEG2)) {
static unsigned int mpeg1_check[2][2] = {{11, 54}, {27, 45}};
DAR_16_9 = (sequence->pixel_height == 27 ||
sequence->pixel_height == 45);
if (width < 704 ||
sequence->pixel_height != mpeg1_check[DAR_16_9][height == 576])
return 0;
} else {
DAR_16_9 = (3 * sequence->picture_width * sequence->pixel_width >
4 * sequence->picture_height * sequence->pixel_height);
switch (width) {
case 528: case 544: pix_width *= 4; pix_height *= 3; break;
case 480: pix_width *= 3; pix_height *= 2; break;
}
}
if (DAR_16_9) {
pix_width *= 4; pix_height *= 3;
}
if (height == 576) {
pix_width *= 59; pix_height *= 54;
} else {
pix_width *= 10; pix_height *= 11;
}
*pixel_width = pix_width;
*pixel_height = pix_height;
simplify (pixel_width, pixel_height);
return (height == 576) ? 1 : 2;
}
static void copy_matrix (mpeg2dec_t * mpeg2dec, int idx)
{
if (memcmp (mpeg2dec->quantizer_matrix[idx],
mpeg2dec->new_quantizer_matrix[idx], 64)) {
memcpy (mpeg2dec->quantizer_matrix[idx],
mpeg2dec->new_quantizer_matrix[idx], 64);
mpeg2dec->scaled[idx] = -1;
}
}
@ -392,31 +471,30 @@ void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec)
(sequence->chroma_height == sequence->height));
if (mpeg2dec->sequence.width != (unsigned)-1) {
unsigned int new_byte_rate;
/*
* According to 6.1.1.6, repeat sequence headers should be
* identical to the original. However some DVDs dont respect
* that and have different bitrates in the repeat sequence
* headers. So we'll ignore that in the comparison and still
* consider these as repeat sequence headers.
*
* However, be careful not to alter the current sequence when
* returning STATE_INVALID_END.
* identical to the original. However some encoders do not
* respect that and change various fields (including bitrate
* and aspect ratio) in the repeat sequence headers. So we
* choose to be as conservative as possible and only restart
* the decoder if the width, height, chroma_width,
* chroma_height or low_delay flag are modified.
*/
new_byte_rate = sequence->byte_rate;
sequence->byte_rate = mpeg2dec->sequence.byte_rate;
if (memcmp (&(mpeg2dec->sequence), sequence,
sizeof (mpeg2_sequence_t))) {
if (sequence->width != mpeg2dec->sequence.width ||
sequence->height != mpeg2dec->sequence.height ||
sequence->chroma_width != mpeg2dec->sequence.chroma_width ||
sequence->chroma_height != mpeg2dec->sequence.chroma_height ||
((sequence->flags ^ mpeg2dec->sequence.flags) &
SEQ_FLAG_LOW_DELAY)) {
decoder->stride_frame = sequence->width;
sequence->byte_rate = new_byte_rate;
mpeg2_header_end (mpeg2dec);
mpeg2dec->action = invalid_end_action;
mpeg2dec->state = STATE_INVALID_END;
return;
}
sequence->byte_rate = new_byte_rate;
mpeg2dec->state = STATE_SEQUENCE_REPEATED;
mpeg2dec->state = (memcmp (&(mpeg2dec->sequence), sequence,
sizeof (mpeg2_sequence_t)) ?
STATE_SEQUENCE_MODIFIED : STATE_SEQUENCE_REPEATED);
} else
decoder->stride_frame = sequence->width;
mpeg2dec->sequence = *sequence;
@ -468,34 +546,6 @@ void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type)
}
}
mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec)
{
mpeg2_picture_t * picture = &(mpeg2dec->new_picture);
mpeg2dec->state = ((mpeg2dec->state != STATE_SLICE_1ST) ?
STATE_PICTURE : STATE_PICTURE_2ND);
picture->flags = 0;
picture->tag = picture->tag2 = 0;
if (mpeg2dec->num_tags) {
if (mpeg2dec->bytes_since_tag >= 4) {
mpeg2dec->num_tags = 0;
picture->tag = mpeg2dec->tag_current;
picture->tag2 = mpeg2dec->tag2_current;
picture->flags = PIC_FLAG_TAGS;
} else if (mpeg2dec->num_tags > 1) {
mpeg2dec->num_tags = 1;
picture->tag = mpeg2dec->tag_previous;
picture->tag2 = mpeg2dec->tag2_previous;
picture->flags = PIC_FLAG_TAGS;
}
}
picture->display_offset[0].x = picture->display_offset[1].x =
picture->display_offset[2].x = mpeg2dec->display_offset_x;
picture->display_offset[0].y = picture->display_offset[1].y =
picture->display_offset[2].y = mpeg2dec->display_offset_y;
return mpeg2_parse_header (mpeg2dec);
}
int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)
{
uint8_t * buffer = mpeg2dec->chunk_start;
@ -503,13 +553,13 @@ int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)
mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);
int type;
type = (buffer [1] >> 3) & 7;
mpeg2dec->state = ((mpeg2dec->state != STATE_SLICE_1ST) ?
STATE_PICTURE : STATE_PICTURE_2ND);
mpeg2dec->ext_state = PIC_CODING_EXT;
picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
picture->flags |= type;
type = (buffer [1] >> 3) & 7;
if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B) {
/* forward_f_code and backward_f_code - used in mpeg1 only */
decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1;
@ -519,11 +569,30 @@ int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)
decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
}
picture->flags = PIC_FLAG_PROGRESSIVE_FRAME | type;
picture->tag = picture->tag2 = 0;
if (mpeg2dec->num_tags) {
if (mpeg2dec->bytes_since_tag >= mpeg2dec->chunk_ptr - buffer + 4) {
mpeg2dec->num_tags = 0;
picture->tag = mpeg2dec->tag_current;
picture->tag2 = mpeg2dec->tag2_current;
picture->flags |= PIC_FLAG_TAGS;
} else if (mpeg2dec->num_tags > 1) {
mpeg2dec->num_tags = 1;
picture->tag = mpeg2dec->tag_previous;
picture->tag2 = mpeg2dec->tag2_previous;
picture->flags |= PIC_FLAG_TAGS;
}
}
picture->nb_fields = 2;
picture->display_offset[0].x = picture->display_offset[1].x =
picture->display_offset[2].x = mpeg2dec->display_offset_x;
picture->display_offset[0].y = picture->display_offset[1].y =
picture->display_offset[2].y = mpeg2dec->display_offset_y;
/* XXXXXX decode extra_information_picture as well */
picture->nb_fields = 2;
mpeg2dec->q_scale_type = 0;
decoder->q_scale_type = 0;
decoder->intra_dc_precision = 7;
decoder->frame_pred_frame_dct = 1;
decoder->concealment_motion_vectors = 0;
@ -570,10 +639,11 @@ static int picture_coding_ext (mpeg2dec_t * mpeg2dec)
decoder->top_field_first = buffer[3] >> 7;
decoder->frame_pred_frame_dct = (buffer[3] >> 6) & 1;
decoder->concealment_motion_vectors = (buffer[3] >> 5) & 1;
mpeg2dec->q_scale_type = buffer[3] & 16;
decoder->q_scale_type = buffer[3] & 16;
decoder->intra_vlc_format = (buffer[3] >> 3) & 1;
decoder->scan = (buffer[3] & 4) ? mpeg2_scan_alt : mpeg2_scan_norm;
flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0;
if (!(buffer[4] & 0x80))
flags &= ~PIC_FLAG_PROGRESSIVE_FRAME;
if (buffer[4] & 0x40)
flags |= (((buffer[4]<<26) | (buffer[5]<<18) | (buffer[6]<<10)) &
PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY;
@ -794,7 +864,7 @@ int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec)
return 0;
}
static void prescale (mpeg2dec_t * mpeg2dec, int index)
static void prescale (mpeg2dec_t * mpeg2dec, int idx)
{
static int non_linear_scale [] = {
0, 1, 2, 3, 4, 5, 6, 7,
@ -805,14 +875,14 @@ static void prescale (mpeg2dec_t * mpeg2dec, int index)
int i, j, k;
mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);
if (mpeg2dec->scaled[index] != mpeg2dec->q_scale_type) {
mpeg2dec->scaled[index] = mpeg2dec->q_scale_type;
if (mpeg2dec->scaled[idx] != decoder->q_scale_type) {
mpeg2dec->scaled[idx] = decoder->q_scale_type;
for (i = 0; i < 32; i++) {
k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1);
k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1);
decoder->quantizer_scales[i] = k;
for (j = 0; j < 64; j++)
decoder->quantizer_prescale[index][i][j] =
k * mpeg2dec->quantizer_matrix[index][j];
decoder->quantizer_prescale[idx][i][j] =
k * mpeg2dec->quantizer_matrix[idx][j];
}
}
}
@ -864,7 +934,7 @@ mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec)
mpeg2dec->fbuf[b_type]->buf);
}
mpeg2dec->action = NULL;
return (mpeg2_state_t)-1;
return STATE_INTERNAL_NORETURN;
}
static mpeg2_state_t seek_sequence (mpeg2dec_t * mpeg2dec)

View File

@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
@ -283,8 +283,6 @@ void mpeg2_idct_init (uint32_t accel)
} else
#endif
{
extern uint8_t mpeg2_scan_norm[64];
extern uint8_t mpeg2_scan_alt[64];
int i, j;
mpeg2_idct_copy = mpeg2_idct_copy_c;

View File

@ -364,8 +364,6 @@ void mpeg2_idct_add_alpha (const int last, int16_t * block,
void mpeg2_idct_alpha_init (void)
{
extern uint8_t mpeg2_scan_norm[64];
extern uint8_t mpeg2_scan_alt[64];
int i, j;
for (i = 0; i < 64; i++) {

View File

@ -272,8 +272,6 @@ void mpeg2_idct_add_altivec (const int last, int16_t * const _block,
void mpeg2_idct_altivec_init (void)
{
extern uint8_t mpeg2_scan_norm[64];
extern uint8_t mpeg2_scan_alt[64];
int i, j;
/* the altivec idct uses a transposed input, so we patch scan tables */

View File

@ -19,10 +19,6 @@
* 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
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#include "config.h"
@ -1294,8 +1290,6 @@ void mpeg2_idct_add_mmx (const int last, int16_t * const block,
void mpeg2_idct_mmx_init (void)
{
extern uint8_t mpeg2_scan_norm[64];
extern uint8_t mpeg2_scan_alt[64];
int i, j;
/* the mmx/mmxext idct uses a reordered input, so we patch scan tables */

View File

@ -1,985 +0,0 @@
--- libmpeg2/cpu_accel.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/cpu_accel.c 2006-06-16 20:12:50.000000000 +0200
@@ -22,6 +26,7 @@
*/
#include "config.h"
+#include "cpudetect.h"
#include <inttypes.h>
@@ -30,9 +35,17 @@
#include "mpeg2_internal.h"
#ifdef ACCEL_DETECT
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
+
+/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow!
+ * instructions via assembly. However, it is regarded as duplicated work
+ * in MPlayer, so that we enforce using MPlayer's implementation.
+ */
+#define MPLAYER_CPUDETECT
+
static inline uint32_t arch_accel (void)
{
+#if !defined(MPLAYER_CPUDETECT)
uint32_t eax, ebx, ecx, edx;
int AMD;
uint32_t caps;
@@ -107,8 +120,22 @@
caps |= MPEG2_ACCEL_X86_MMXEXT;
return caps;
+#else /* MPLAYER_CPUDETECT: Use MPlayer's CPU capability property. */
+ caps = 0;
+ if (gCpuCaps.hasMMX)
+ caps |= MPEG2_ACCEL_X86_MMX;
+ if (gCpuCaps.hasSSE2)
+ caps |= MPEG2_ACCEL_X86_SSE2;
+ if (gCpuCaps.hasMMX2)
+ caps |= MPEG2_ACCEL_X86_MMXEXT;
+ if (gCpuCaps.has3DNow)
+ caps |= MPEG2_ACCEL_X86_3DNOW;
+
+ return caps;
+
+#endif /* MPLAYER_CPUDETECT */
}
-#endif /* ARCH_X86 */
+#endif /* ARCH_X86 || ARCH_X86_64 */
#if defined(ARCH_PPC) || defined(ARCH_SPARC)
#include <signal.h>
@@ -214,7 +241,7 @@
accel = 0;
#ifdef ACCEL_DETECT
-#if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
+#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
accel = arch_accel ();
#endif
#endif
--- libmpeg2/cpu_state.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/cpu_state.c 2006-06-16 20:12:50.000000000 +0200
@@ -29,14 +33,14 @@
#include "mpeg2.h"
#include "attributes.h"
#include "mpeg2_internal.h"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include "mmx.h"
#endif
void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL;
void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
static void state_restore_mmx (cpu_state_t * state)
{
emms ();
@@ -44,18 +48,18 @@
#endif
#ifdef ARCH_PPC
-#ifdef HAVE_ALTIVEC_H /* gnu */
-#define LI(a,b) "li " #a "," #b "\n\t"
-#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
-#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
-#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
-#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
-#else /* apple */
+#if defined(__APPLE_CC__) /* apple */
#define LI(a,b) "li r" #a "," #b "\n\t"
#define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
#define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
#define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
#define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
+#else /* gnu */
+#define LI(a,b) "li " #a "," #b "\n\t"
+#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
+#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
+#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
+#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
#endif
static void state_save_altivec (cpu_state_t * state)
@@ -115,7 +119,7 @@
void mpeg2_cpu_state_init (uint32_t accel)
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
if (accel & MPEG2_ACCEL_X86_MMX) {
mpeg2_cpu_state_restore = state_restore_mmx;
}
--- libmpeg2/decode.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/decode.c 2006-06-16 20:12:50.000000000 +0200
@@ -351,6 +355,15 @@
fbuf->buf[1] = buf[1];
fbuf->buf[2] = buf[2];
fbuf->id = id;
+ // HACK! FIXME! At first I frame, copy pointers to prediction frame too!
+ if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){
+ mpeg2dec->fbuf[1]->buf[0]=buf[0];
+ mpeg2dec->fbuf[1]->buf[1]=buf[1];
+ mpeg2dec->fbuf[1]->buf[2]=buf[2];
+ mpeg2dec->fbuf[1]->id=NULL;
+ }
+// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",
+// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);
}
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)
--- libmpeg2/header.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/header.c 2006-06-16 20:12:50.000000000 +0200
@@ -100,6 +104,9 @@
mpeg2dec->decoder.convert = NULL;
mpeg2dec->decoder.convert_id = NULL;
mpeg2dec->picture = mpeg2dec->pictures;
+ memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t));
+ memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t));
+ memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t));
mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf;
mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf;
mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf;
@@ -553,6 +560,7 @@
if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) {
picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
+ flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0;
} else
picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2;
break;
@@ -801,6 +809,7 @@
mpeg2dec->scaled[index] = mpeg2dec->q_scale_type;
for (i = 0; i < 32; i++) {
k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1);
+ decoder->quantizer_scales[i] = k;
for (j = 0; j < 64; j++)
decoder->quantizer_prescale[index][i][j] =
k * mpeg2dec->quantizer_matrix[index][j];
--- libmpeg2/idct.c (revision 26652)
+++ libmpeg2/idct.c (working copy)
@@ -235,30 +239,40 @@
void mpeg2_idct_init (uint32_t accel)
{
-#ifdef ARCH_X86
+#ifdef HAVE_SSE2
+ if (accel & MPEG2_ACCEL_X86_SSE2) {
+ mpeg2_idct_copy = mpeg2_idct_copy_sse2;
+ mpeg2_idct_add = mpeg2_idct_add_sse2;
+ mpeg2_idct_mmx_init ();
+ } else
+#elif HAVE_MMX2
if (accel & MPEG2_ACCEL_X86_MMXEXT) {
mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
mpeg2_idct_add = mpeg2_idct_add_mmxext;
mpeg2_idct_mmx_init ();
- } else if (accel & MPEG2_ACCEL_X86_MMX) {
+ } else
+#elif HAVE_MMX
+ if (accel & MPEG2_ACCEL_X86_MMX) {
mpeg2_idct_copy = mpeg2_idct_copy_mmx;
mpeg2_idct_add = mpeg2_idct_add_mmx;
mpeg2_idct_mmx_init ();
} else
#endif
-#ifdef ARCH_PPC
+#ifdef HAVE_ALTIVEC
if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
mpeg2_idct_copy = mpeg2_idct_copy_altivec;
mpeg2_idct_add = mpeg2_idct_add_altivec;
mpeg2_idct_altivec_init ();
} else
#endif
-#ifdef ARCH_ALPHA
+#ifdef HAVE_VIS
if (accel & MPEG2_ACCEL_ALPHA_MVI) {
mpeg2_idct_copy = mpeg2_idct_copy_mvi;
mpeg2_idct_add = mpeg2_idct_add_mvi;
mpeg2_idct_alpha_init ();
- } else if (accel & MPEG2_ACCEL_ALPHA) {
+ } else
+#elif ARCH_ALPHA
+ if (accel & MPEG2_ACCEL_ALPHA) {
int i;
mpeg2_idct_copy = mpeg2_idct_copy_alpha;
--- libmpeg2/idct_mmx.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/idct_mmx.c 2006-06-16 20:12:50.000000000 +0200
@@ -23,7 +27,7 @@
#include "config.h"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include <inttypes.h>
--- libmpeg2/motion_comp.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/motion_comp.c 2006-06-16 20:12:50.000000000 +0200
@@ -33,16 +37,22 @@
void mpeg2_mc_init (uint32_t accel)
{
-#ifdef ARCH_X86
+#ifdef HAVE_MMX2
if (accel & MPEG2_ACCEL_X86_MMXEXT)
mpeg2_mc = mpeg2_mc_mmxext;
- else if (accel & MPEG2_ACCEL_X86_3DNOW)
+ else
+#endif
+#ifdef HAVE_3DNOW
+ if (accel & MPEG2_ACCEL_X86_3DNOW)
mpeg2_mc = mpeg2_mc_3dnow;
- else if (accel & MPEG2_ACCEL_X86_MMX)
+ else
+#endif
+#ifdef HAVE_MMX
+ if (accel & MPEG2_ACCEL_X86_MMX)
mpeg2_mc = mpeg2_mc_mmx;
else
#endif
-#ifdef ARCH_PPC
+#ifdef HAVE_ALTIVEC
if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
mpeg2_mc = mpeg2_mc_altivec;
else
@@ -52,11 +62,21 @@
mpeg2_mc = mpeg2_mc_alpha;
else
#endif
-#ifdef ARCH_SPARC
+#ifdef HAVE_VIS
if (accel & MPEG2_ACCEL_SPARC_VIS)
mpeg2_mc = mpeg2_mc_vis;
else
#endif
+#ifdef ARCH_ARM
+#ifdef HAVE_IWMMXT
+ if (accel & MPEG2_ACCEL_ARM_IWMMXT)
+ mpeg2_mc = mpeg2_mc_iwmmxt;
+ else
+#endif
+ if (accel & MPEG2_ACCEL_ARM)
+ mpeg2_mc = mpeg2_mc_arm;
+ else
+#endif
mpeg2_mc = mpeg2_mc_c;
}
--- libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:50.000000000 +0200
@@ -23,7 +27,7 @@
#include "config.h"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include <inttypes.h>
--- include/mpeg2.h 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/mpeg2.h 2006-06-16 20:12:50.000000000 +0200
@@ -82,6 +86,7 @@
#define PIC_FLAG_COMPOSITE_DISPLAY 32
#define PIC_FLAG_SKIP 64
#define PIC_FLAG_TAGS 128
+#define PIC_FLAG_REPEAT_FIRST_FIELD 256
#define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
typedef struct mpeg2_picture_s {
@@ -154,11 +159,14 @@
#define MPEG2_ACCEL_X86_MMX 1
#define MPEG2_ACCEL_X86_3DNOW 2
#define MPEG2_ACCEL_X86_MMXEXT 4
+#define MPEG2_ACCEL_X86_SSE2 8
#define MPEG2_ACCEL_PPC_ALTIVEC 1
#define MPEG2_ACCEL_ALPHA 1
#define MPEG2_ACCEL_ALPHA_MVI 2
#define MPEG2_ACCEL_SPARC_VIS 1
#define MPEG2_ACCEL_SPARC_VIS2 2
+#define MPEG2_ACCEL_ARM 1
+#define MPEG2_ACCEL_ARM_IWMMXT 2
#define MPEG2_ACCEL_DETECT 0x80000000
uint32_t mpeg2_accel (uint32_t accel);
--- libmpeg2/mpeg2_internal.h 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/mpeg2_internal.h 2006-06-16 20:12:50.000000000 +0200
@@ -144,6 +148,11 @@
int second_field;
int mpeg1;
+
+ int quantizer_scales[32];
+ int quantizer_scale;
+ char* quant_store;
+ int quant_stride;
};
typedef struct {
@@ -214,6 +223,9 @@
int8_t q_scale_type, scaled[4];
uint8_t quantizer_matrix[4][64];
uint8_t new_quantizer_matrix[4][64];
+
+ unsigned char *pending_buffer;
+ int pending_length;
};
typedef struct {
@@ -298,3 +313,5 @@
extern mpeg2_mc_t mpeg2_mc_altivec;
extern mpeg2_mc_t mpeg2_mc_alpha;
extern mpeg2_mc_t mpeg2_mc_vis;
+extern mpeg2_mc_t mpeg2_mc_arm;
+extern mpeg2_mc_t mpeg2_mc_iwmmxt;
--- libmpeg2/slice.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/slice.c 2006-06-16 20:12:50.000000000 +0200
@@ -142,6 +146,7 @@
quantizer_scale_code = UBITS (bit_buf, 5);
DUMPBITS (bit_buf, bits, 5);
+ decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code];
decoder->quantizer_matrix[0] =
decoder->quantizer_prescale[0][quantizer_scale_code];
@@ -1564,6 +1569,18 @@
#define NEXT_MACROBLOCK \
do { \
+ if(decoder->quant_store) { \
+ if (decoder->picture_structure == TOP_FIELD) \
+ decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+ +(decoder->offset>>4)] = decoder->quantizer_scale; \
+ else if (decoder->picture_structure == BOTTOM_FIELD) \
+ decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+ + decoder->quant_stride \
+ +(decoder->offset>>4)] = decoder->quantizer_scale; \
+ else \
+ decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \
+ +(decoder->offset>>4)] = decoder->quantizer_scale; \
+ } \
decoder->offset += 16; \
if (decoder->offset == decoder->width) { \
do { /* just so we can use the break statement */ \
@@ -1587,6 +1604,12 @@
} \
} while (0)
+static void motion_dummy (mpeg2_decoder_t * const decoder,
+ motion_t * const motion,
+ mpeg2_mc_fct * const * const table)
+{
+}
+
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3])
{
@@ -1644,7 +1667,9 @@
if (decoder->mpeg1) {
decoder->motion_parser[0] = motion_zero_420;
+ decoder->motion_parser[MC_FIELD] = motion_dummy;
decoder->motion_parser[MC_FRAME] = motion_mp1;
+ decoder->motion_parser[MC_DMV] = motion_dummy;
decoder->motion_parser[4] = motion_reuse_420;
} else if (decoder->picture_structure == FRAME_PICTURE) {
if (decoder->chroma_format == 0) {
--- libmpeg2/idct_altivec.c 2004/08/02 11:26:43 12933
+++ libmpeg2/idct_altivec.c 2005/05/15 20:11:34 15484
@@ -41,7 +41,7 @@
typedef vector signed int vector_s32_t;
typedef vector unsigned int vector_u32_t;
-#if defined(HAVE_ALTIVEC_H) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
+#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_CC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
/* work around gcc <3.3 vec_mergel bug */
static inline vector_s16_t my_vec_mergel (vector_s16_t const A,
vector_s16_t const B)
Index: libmpeg2/motion_comp_arm.c
===================================================================
--- libmpeg2/motion_comp_arm.c (revision 0)
+++ libmpeg2/motion_comp_arm.c (revision 0)
@@ -0,0 +1,187 @@
+/*
+ * motion_comp_arm.c
+ * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ * See http://libmpeg2.sourceforge.net/ for updates.
+ *
+ * mpeg2dec 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.
+ *
+ * mpeg2dec 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
+ */
+
+#include "config.h"
+
+#ifdef ARCH_ARM
+
+#include <inttypes.h>
+
+#include "mpeg2.h"
+#include "attributes.h"
+#include "mpeg2_internal.h"
+
+#define avg2(a,b) ((a+b+1)>>1)
+#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
+
+#define predict_o(i) (ref[i])
+#define predict_x(i) (avg2 (ref[i], ref[i+1]))
+#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
+#define predict_xy(i) (avg4 (ref[i], ref[i+1], \
+ (ref+stride)[i], (ref+stride)[i+1]))
+
+#define put(predictor,i) dest[i] = predictor (i)
+#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
+
+/* mc function template */
+
+#define MC_FUNC(op,xy) \
+static void inline MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \
+ const int stride, int height) \
+{ \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ op (predict_##xy, 8); \
+ op (predict_##xy, 9); \
+ op (predict_##xy, 10); \
+ op (predict_##xy, 11); \
+ op (predict_##xy, 12); \
+ op (predict_##xy, 13); \
+ op (predict_##xy, 14); \
+ op (predict_##xy, 15); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+} \
+static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
+ const int stride, int height) \
+{ \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+} \
+/* definitions of the actual mc functions */
+
+MC_FUNC (put,o)
+MC_FUNC (avg,o)
+MC_FUNC (put,x)
+MC_FUNC (avg,x)
+MC_FUNC (put,y)
+MC_FUNC (avg,y)
+MC_FUNC (put,xy)
+MC_FUNC (avg,xy)
+
+
+extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height);
+
+extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height);
+
+
+static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_put_y_16_c(dest, ref, stride, height);
+}
+
+static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_put_xy_16_c(dest, ref, stride, height);
+}
+
+extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height);
+
+extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height);
+
+static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_put_y_8_c(dest, ref, stride, height);
+}
+
+static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_put_xy_8_c(dest, ref, stride, height);
+}
+
+static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_o_16_c(dest, ref, stride, height);
+}
+
+static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_x_16_c(dest, ref, stride, height);
+}
+
+static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_y_16_c(dest, ref, stride, height);
+}
+
+static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_xy_16_c(dest, ref, stride, height);
+}
+
+static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_o_8_c(dest, ref, stride, height);
+}
+
+static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_x_8_c(dest, ref, stride, height);
+}
+
+static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_y_8_c(dest, ref, stride, height);
+}
+
+static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref,
+ int stride, int height)
+{
+ MC_avg_xy_8_c(dest, ref, stride, height);
+}
+
+MPEG2_MC_EXTERN (arm)
+
+#endif
Index: libmpeg2/motion_comp_arm_s.S
===================================================================
--- libmpeg2/motion_comp_arm_s.S (revision 0)
+++ libmpeg2/motion_comp_arm_s.S (revision 0)
@@ -0,0 +1,322 @@
+@ motion_comp_arm_s.S
+@ Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+@
+@ This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+@ See http://libmpeg2.sourceforge.net/ for updates.
+@
+@ mpeg2dec 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.
+@
+@ mpeg2dec 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
+
+ .text
+
+@ ----------------------------------------------------------------
+ .align
+ .global MC_put_o_16_arm
+MC_put_o_16_arm:
+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ pld [r1]
+ stmfd sp!, {r4-r11, lr} @ R14 is also called LR
+ and r4, r1, #3
+ adr r5, MC_put_o_16_arm_align_jt
+ add r5, r5, r4, lsl #2
+ ldr pc, [r5]
+
+MC_put_o_16_arm_align0:
+ ldmia r1, {r4-r7}
+ add r1, r1, r2
+ pld [r1]
+ stmia r0, {r4-r7}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne MC_put_o_16_arm_align0
+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
+
+.macro PROC shift
+ ldmia r1, {r4-r8}
+ add r1, r1, r2
+ mov r9, r4, lsr #(\shift)
+ pld [r1]
+ mov r10, r5, lsr #(\shift)
+ orr r9, r9, r5, lsl #(32-\shift)
+ mov r11, r6, lsr #(\shift)
+ orr r10, r10, r6, lsl #(32-\shift)
+ mov r12, r7, lsr #(\shift)
+ orr r11, r11, r7, lsl #(32-\shift)
+ orr r12, r12, r8, lsl #(32-\shift)
+ stmia r0, {r9-r12}
+ subs r3, r3, #1
+ add r0, r0, r2
+.endm
+
+MC_put_o_16_arm_align1:
+ and r1, r1, #0xFFFFFFFC
+1: PROC(8)
+ bne 1b
+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
+MC_put_o_16_arm_align2:
+ and r1, r1, #0xFFFFFFFC
+1: PROC(16)
+ bne 1b
+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
+MC_put_o_16_arm_align3:
+ and r1, r1, #0xFFFFFFFC
+1: PROC(24)
+ bne 1b
+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
+MC_put_o_16_arm_align_jt:
+ .word MC_put_o_16_arm_align0
+ .word MC_put_o_16_arm_align1
+ .word MC_put_o_16_arm_align2
+ .word MC_put_o_16_arm_align3
+
+@ ----------------------------------------------------------------
+ .align
+ .global MC_put_o_8_arm
+MC_put_o_8_arm:
+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ pld [r1]
+ stmfd sp!, {r4-r10, lr} @ R14 is also called LR
+ and r4, r1, #3
+ adr r5, MC_put_o_8_arm_align_jt
+ add r5, r5, r4, lsl #2
+ ldr pc, [r5]
+MC_put_o_8_arm_align0:
+ ldmia r1, {r4-r5}
+ add r1, r1, r2
+ pld [r1]
+ stmia r0, {r4-r5}
+ add r0, r0, r2
+ subs r3, r3, #1
+ bne MC_put_o_8_arm_align0
+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
+
+.macro PROC8 shift
+ ldmia r1, {r4-r6}
+ add r1, r1, r2
+ mov r9, r4, lsr #(\shift)
+ pld [r1]
+ mov r10, r5, lsr #(\shift)
+ orr r9, r9, r5, lsl #(32-\shift)
+ orr r10, r10, r6, lsl #(32-\shift)
+ stmia r0, {r9-r10}
+ subs r3, r3, #1
+ add r0, r0, r2
+.endm
+
+MC_put_o_8_arm_align1:
+ and r1, r1, #0xFFFFFFFC
+1: PROC8(8)
+ bne 1b
+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
+
+MC_put_o_8_arm_align2:
+ and r1, r1, #0xFFFFFFFC
+1: PROC8(16)
+ bne 1b
+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
+
+MC_put_o_8_arm_align3:
+ and r1, r1, #0xFFFFFFFC
+1: PROC8(24)
+ bne 1b
+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
+
+MC_put_o_8_arm_align_jt:
+ .word MC_put_o_8_arm_align0
+ .word MC_put_o_8_arm_align1
+ .word MC_put_o_8_arm_align2
+ .word MC_put_o_8_arm_align3
+
+@ ----------------------------------------------------------------
+.macro AVG_PW rW1, rW2
+ mov \rW2, \rW2, lsl #24
+ orr \rW2, \rW2, \rW1, lsr #8
+ eor r9, \rW1, \rW2
+ and \rW2, \rW1, \rW2
+ and r10, r9, r12
+ add \rW2, \rW2, r10, lsr #1
+ and r10, r9, r11
+ add \rW2, \rW2, r10
+.endm
+
+ .align
+ .global MC_put_x_16_arm
+MC_put_x_16_arm:
+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ pld [r1]
+ stmfd sp!, {r4-r11,lr} @ R14 is also called LR
+ and r4, r1, #3
+ adr r5, MC_put_x_16_arm_align_jt
+ ldr r11, [r5]
+ mvn r12, r11
+ add r5, r5, r4, lsl #2
+ ldr pc, [r5, #4]
+
+.macro ADJ_ALIGN_QW shift, R0, R1, R2, R3, R4
+ mov \R0, \R0, lsr #(\shift)
+ orr \R0, \R0, \R1, lsl #(32 - \shift)
+ mov \R1, \R1, lsr #(\shift)
+ orr \R1, \R1, \R2, lsl #(32 - \shift)
+ mov \R2, \R2, lsr #(\shift)
+ orr \R2, \R2, \R3, lsl #(32 - \shift)
+ mov \R3, \R3, lsr #(\shift)
+ orr \R3, \R3, \R4, lsl #(32 - \shift)
+ mov \R4, \R4, lsr #(\shift)
+@ and \R4, \R4, #0xFF
+.endm
+
+MC_put_x_16_arm_align0:
+ ldmia r1, {r4-r8}
+ add r1, r1, r2
+ pld [r1]
+ AVG_PW r7, r8
+ AVG_PW r6, r7
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r8}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne MC_put_x_16_arm_align0
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_16_arm_align1:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r8}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_QW 8, r4, r5, r6, r7, r8
+ AVG_PW r7, r8
+ AVG_PW r6, r7
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r8}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_16_arm_align2:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r8}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_QW 16, r4, r5, r6, r7, r8
+ AVG_PW r7, r8
+ AVG_PW r6, r7
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r8}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_16_arm_align3:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r8}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_QW 24, r4, r5, r6, r7, r8
+ AVG_PW r7, r8
+ AVG_PW r6, r7
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r8}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_16_arm_align_jt:
+ .word 0x01010101
+ .word MC_put_x_16_arm_align0
+ .word MC_put_x_16_arm_align1
+ .word MC_put_x_16_arm_align2
+ .word MC_put_x_16_arm_align3
+
+@ ----------------------------------------------------------------
+ .align
+ .global MC_put_x_8_arm
+MC_put_x_8_arm:
+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ pld [r1]
+ stmfd sp!, {r4-r11,lr} @ R14 is also called LR
+ and r4, r1, #3
+ adr r5, MC_put_x_8_arm_align_jt
+ ldr r11, [r5]
+ mvn r12, r11
+ add r5, r5, r4, lsl #2
+ ldr pc, [r5, #4]
+
+.macro ADJ_ALIGN_DW shift, R0, R1, R2
+ mov \R0, \R0, lsr #(\shift)
+ orr \R0, \R0, \R1, lsl #(32 - \shift)
+ mov \R1, \R1, lsr #(\shift)
+ orr \R1, \R1, \R2, lsl #(32 - \shift)
+ mov \R2, \R2, lsr #(\shift)
+@ and \R4, \R4, #0xFF
+.endm
+
+MC_put_x_8_arm_align0:
+ ldmia r1, {r4-r6}
+ add r1, r1, r2
+ pld [r1]
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r6}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne MC_put_x_8_arm_align0
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_8_arm_align1:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r6}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_DW 8, r4, r5, r6
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r6}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_8_arm_align2:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r6}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_DW 16, r4, r5, r6
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r6}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_8_arm_align3:
+ and r1, r1, #0xFFFFFFFC
+1: ldmia r1, {r4-r6}
+ add r1, r1, r2
+ pld [r1]
+ ADJ_ALIGN_DW 24, r4, r5, r6
+ AVG_PW r5, r6
+ AVG_PW r4, r5
+ stmia r0, {r5-r6}
+ subs r3, r3, #1
+ add r0, r0, r2
+ bne 1b
+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
+MC_put_x_8_arm_align_jt:
+ .word 0x01010101
+ .word MC_put_x_8_arm_align0
+ .word MC_put_x_8_arm_align1
+ .word MC_put_x_8_arm_align2
+ .word MC_put_x_8_arm_align3
Index: libmpeg2/motion_comp_iwmmxt.c
===================================================================
--- libmpeg2/motion_comp_iwmmxt.c (revision 0)
+++ libmpeg2/motion_comp_iwmmxt.c (revision 0)
@@ -0,0 +1,59 @@
+/*
+ * motion_comp_iwmmxt.c
+ * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ * See http://libmpeg2.sourceforge.net/ for updates.
+ *
+ * mpeg2dec 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.
+ *
+ * mpeg2dec 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
+ */
+
+#include "config.h"
+
+#if defined(ARCH_ARM) && defined(HAVE_IWMMXT)
+
+#include <inttypes.h>
+
+#include "mpeg2.h"
+#include "attributes.h"
+#include "mpeg2_internal.h"
+
+/* defined in libavcodec */
+
+extern void put_pixels16_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+
+mpeg2_mc_t mpeg2_mc_iwmmxt = {
+ {put_pixels16_iwmmxt, put_pixels16_x2_iwmmxt, put_pixels16_y2_iwmmxt, put_pixels16_xy2_iwmmxt,
+ put_pixels8_iwmmxt, put_pixels8_x2_iwmmxt, put_pixels8_y2_iwmmxt, put_pixels8_xy2_iwmmxt}, \
+ {avg_pixels16_iwmmxt, avg_pixels16_x2_iwmmxt, avg_pixels16_y2_iwmmxt, avg_pixels16_xy2_iwmmxt,
+ avg_pixels8_iwmmxt, avg_pixels8_x2_iwmmxt, avg_pixels8_y2_iwmmxt, avg_pixels8_xy2_iwmmxt}, \
+};
+
+#endif /* defined(ARCH_ARM) && defined(HAVE_IWMMXT) */

View File

@ -0,0 +1,318 @@
--- libmpeg2/cpu_accel.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/cpu_accel.c 2006-06-16 20:12:50.000000000 +0200
@@ -29,9 +33,13 @@
#include "attributes.h"
#include "mpeg2_internal.h"
+#include "cpudetect.h"
+
#if defined(ARCH_X86) || defined(ARCH_X86_64)
static inline uint32_t arch_accel (uint32_t accel)
{
+/* Use MPlayer CPU detection instead of libmpeg2 variant. */
+#if 0
if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT))
accel |= MPEG2_ACCEL_X86_MMX;
@@ -124,6 +132,21 @@
#endif /* ACCEL_DETECT */
return accel;
+
+#else /* 0 */
+ accel = 0;
+ if (gCpuCaps.hasMMX)
+ accel |= MPEG2_ACCEL_X86_MMX;
+ if (gCpuCaps.hasSSE2)
+ accel |= MPEG2_ACCEL_X86_SSE2;
+ if (gCpuCaps.hasMMX2)
+ accel |= MPEG2_ACCEL_X86_MMXEXT;
+ if (gCpuCaps.has3DNow)
+ accel |= MPEG2_ACCEL_X86_3DNOW;
+
+ return accel;
+
+#endif /* 0 */
}
#endif /* ARCH_X86 || ARCH_X86_64 */
--- libmpeg2/decode.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/decode.c 2006-06-16 20:12:50.000000000 +0200
@@ -345,6 +349,15 @@
fbuf->buf[1] = buf[1];
fbuf->buf[2] = buf[2];
fbuf->id = id;
+ // HACK! FIXME! At first I frame, copy pointers to prediction frame too!
+ if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){
+ mpeg2dec->fbuf[1]->buf[0]=buf[0];
+ mpeg2dec->fbuf[1]->buf[1]=buf[1];
+ mpeg2dec->fbuf[1]->buf[2]=buf[2];
+ mpeg2dec->fbuf[1]->id=NULL;
+ }
+// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",
+// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);
}
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)
--- libmpeg2/header.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/header.c 2006-06-16 20:12:50.000000000 +0200
@@ -100,6 +104,9 @@
mpeg2dec->decoder.convert = NULL;
mpeg2dec->decoder.convert_id = NULL;
mpeg2dec->picture = mpeg2dec->pictures;
+ memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t));
+ memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t));
+ memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t));
mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf;
mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf;
mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf;
@@ -872,6 +879,7 @@
mpeg2dec->scaled[idx] = decoder->q_scale_type;
for (i = 0; i < 32; i++) {
k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1);
+ decoder->quantizer_scales[i] = k;
for (j = 0; j < 64; j++)
decoder->quantizer_prescale[idx][i][j] =
k * mpeg2dec->quantizer_matrix[idx][j];
--- libmpeg2/idct.c (revision 26652)
+++ libmpeg2/idct.c (working copy)
@@ -235,34 +239,40 @@
void mpeg2_idct_init (uint32_t accel)
{
-#ifdef ARCH_X86
+#ifdef HAVE_SSE2
if (accel & MPEG2_ACCEL_X86_SSE2) {
mpeg2_idct_copy = mpeg2_idct_copy_sse2;
mpeg2_idct_add = mpeg2_idct_add_sse2;
mpeg2_idct_mmx_init ();
- } else if (accel & MPEG2_ACCEL_X86_MMXEXT) {
+ } else
+#elif HAVE_MMX2
+ if (accel & MPEG2_ACCEL_X86_MMXEXT) {
mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
mpeg2_idct_add = mpeg2_idct_add_mmxext;
mpeg2_idct_mmx_init ();
- } else if (accel & MPEG2_ACCEL_X86_MMX) {
+ } else
+#elif HAVE_MMX
+ if (accel & MPEG2_ACCEL_X86_MMX) {
mpeg2_idct_copy = mpeg2_idct_copy_mmx;
mpeg2_idct_add = mpeg2_idct_add_mmx;
mpeg2_idct_mmx_init ();
} else
#endif
-#ifdef ARCH_PPC
+#ifdef HAVE_ALTIVEC
if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
mpeg2_idct_copy = mpeg2_idct_copy_altivec;
mpeg2_idct_add = mpeg2_idct_add_altivec;
mpeg2_idct_altivec_init ();
} else
#endif
-#ifdef ARCH_ALPHA
+#ifdef HAVE_VIS
if (accel & MPEG2_ACCEL_ALPHA_MVI) {
mpeg2_idct_copy = mpeg2_idct_copy_mvi;
mpeg2_idct_add = mpeg2_idct_add_mvi;
mpeg2_idct_alpha_init ();
- } else if (accel & MPEG2_ACCEL_ALPHA) {
+ } else
+#elif ARCH_ALPHA
+ if (accel & MPEG2_ACCEL_ALPHA) {
int i;
mpeg2_idct_copy = mpeg2_idct_copy_alpha;
--- libmpeg2/motion_comp.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/motion_comp.c 2006-06-16 20:12:50.000000000 +0200
@@ -33,16 +37,22 @@
void mpeg2_mc_init (uint32_t accel)
{
-#ifdef ARCH_X86
+#ifdef HAVE_MMX2
if (accel & MPEG2_ACCEL_X86_MMXEXT)
mpeg2_mc = mpeg2_mc_mmxext;
- else if (accel & MPEG2_ACCEL_X86_3DNOW)
+ else
+#endif
+#ifdef HAVE_3DNOW
+ if (accel & MPEG2_ACCEL_X86_3DNOW)
mpeg2_mc = mpeg2_mc_3dnow;
- else if (accel & MPEG2_ACCEL_X86_MMX)
+ else
+#endif
+#ifdef HAVE_MMX
+ if (accel & MPEG2_ACCEL_X86_MMX)
mpeg2_mc = mpeg2_mc_mmx;
else
#endif
-#ifdef ARCH_PPC
+#ifdef HAVE_ALTIVEC
if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
mpeg2_mc = mpeg2_mc_altivec;
else
@@ -52,15 +62,20 @@
mpeg2_mc = mpeg2_mc_alpha;
else
#endif
-#ifdef ARCH_SPARC
+#ifdef HAVE_VIS
if (accel & MPEG2_ACCEL_SPARC_VIS)
mpeg2_mc = mpeg2_mc_vis;
else
#endif
#ifdef ARCH_ARM
- if (accel & MPEG2_ACCEL_ARM) {
+#ifdef HAVE_IWMMXT
+ if (accel & MPEG2_ACCEL_ARM_IWMMXT)
+ mpeg2_mc = mpeg2_mc_iwmmxt;
+ else
+#endif
+ if (accel & MPEG2_ACCEL_ARM)
mpeg2_mc = mpeg2_mc_arm;
- } else
+ else
#endif
mpeg2_mc = mpeg2_mc_c;
}
--- include/mpeg2.h 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/mpeg2.h 2006-06-16 20:12:50.000000000 +0200
@@ -164,6 +168,7 @@
#define MPEG2_ACCEL_SPARC_VIS 1
#define MPEG2_ACCEL_SPARC_VIS2 2
#define MPEG2_ACCEL_ARM 1
+#define MPEG2_ACCEL_ARM_IWMMXT 2
#define MPEG2_ACCEL_DETECT 0x80000000
uint32_t mpeg2_accel (uint32_t accel);
--- libmpeg2/mpeg2_internal.h 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/mpeg2_internal.h 2006-06-16 20:12:50.000000000 +0200
@@ -152,6 +156,11 @@
/* XXX: stuff due to xine shit */
int8_t q_scale_type;
+
+ int quantizer_scales[32];
+ int quantizer_scale;
+ char* quant_store;
+ int quant_stride;
};
typedef struct {
@@ -223,6 +232,9 @@
//int8_t q_scale_type, scaled[4];
uint8_t quantizer_matrix[4][64];
uint8_t new_quantizer_matrix[4][64];
+
+ unsigned char *pending_buffer;
+ int pending_length;
};
typedef struct {
@@ -313,5 +325,6 @@
extern mpeg2_mc_t mpeg2_mc_alpha;
extern mpeg2_mc_t mpeg2_mc_vis;
extern mpeg2_mc_t mpeg2_mc_arm;
+extern mpeg2_mc_t mpeg2_mc_iwmmxt;
#endif /* LIBMPEG2_MPEG2_INTERNAL_H */
--- libmpeg2/slice.c 2006-06-16 20:12:26.000000000 +0200
+++ libmpeg2/slice.c 2006-06-16 20:12:50.000000000 +0200
@@ -142,6 +146,7 @@
quantizer_scale_code = UBITS (bit_buf, 5);
DUMPBITS (bit_buf, bits, 5);
+ decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code];
decoder->quantizer_matrix[0] =
decoder->quantizer_prescale[0][quantizer_scale_code];
@@ -1564,6 +1569,24 @@
#define NEXT_MACROBLOCK \
do { \
+ if(decoder->quant_store) { \
+ if (decoder->picture_structure == TOP_FIELD) \
+ decoder->quant_store[2 * decoder->quant_stride \
+ * (decoder->v_offset >> 4) \
+ + (decoder->offset >> 4)] \
+ = decoder->quantizer_scale; \
+ else if (decoder->picture_structure == BOTTOM_FIELD) \
+ decoder->quant_store[2 * decoder->quant_stride \
+ * (decoder->v_offset >> 4) \
+ + decoder->quant_stride \
+ + (decoder->offset >> 4)] \
+ = decoder->quantizer_scale; \
+ else \
+ decoder->quant_store[decoder->quant_stride \
+ * (decoder->v_offset >> 4) \
+ + (decoder->offset >> 4)] \
+ = decoder->quantizer_scale; \
+ } \
decoder->offset += 16; \
if (decoder->offset == decoder->width) { \
do { /* just so we can use the break statement */ \
Index: libmpeg2/motion_comp_iwmmxt.c
===================================================================
--- libmpeg2/motion_comp_iwmmxt.c (revision 0)
+++ libmpeg2/motion_comp_iwmmxt.c (revision 0)
@@ -0,0 +1,59 @@
+/*
+ * motion_comp_iwmmxt.c
+ * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ * See http://libmpeg2.sourceforge.net/ for updates.
+ *
+ * mpeg2dec 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.
+ *
+ * mpeg2dec 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
+ */
+
+#include "config.h"
+
+#if defined(ARCH_ARM) && defined(HAVE_IWMMXT)
+
+#include <inttypes.h>
+
+#include "mpeg2.h"
+#include "attributes.h"
+#include "mpeg2_internal.h"
+
+/* defined in libavcodec */
+
+extern void put_pixels16_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels16_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void put_pixels8_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels16_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_x2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_y2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+extern void avg_pixels8_xy2_iwmmxt(uint8_t * dest, const uint8_t * ref, const int stride, int height);
+
+mpeg2_mc_t mpeg2_mc_iwmmxt = {
+ {put_pixels16_iwmmxt, put_pixels16_x2_iwmmxt, put_pixels16_y2_iwmmxt, put_pixels16_xy2_iwmmxt,
+ put_pixels8_iwmmxt, put_pixels8_x2_iwmmxt, put_pixels8_y2_iwmmxt, put_pixels8_xy2_iwmmxt}, \
+ {avg_pixels16_iwmmxt, avg_pixels16_x2_iwmmxt, avg_pixels16_y2_iwmmxt, avg_pixels16_xy2_iwmmxt,
+ avg_pixels8_iwmmxt, avg_pixels8_x2_iwmmxt, avg_pixels8_y2_iwmmxt, avg_pixels8_xy2_iwmmxt}, \
+};
+
+#endif /* defined(ARCH_ARM) && defined(HAVE_IWMMXT) */

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_MMX_H
#define LIBMPEG2_MMX_H
/*
* The type of an value that fits in an MMX register (note that long
* long constant values MUST be suffixed by LL and unsigned long long
@ -285,3 +288,5 @@ typedef union {
#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm)
#define sfence() __asm__ __volatile__ ("sfence\n\t")
#endif /* LIBMPEG2_MMX_H */

View File

@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/

View File

@ -16,7 +16,7 @@
* 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
* along with mpeg2dec; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@ -30,12 +30,12 @@
#include "attributes.h"
#include "mpeg2_internal.h"
#define avg2(a,b) ((a+b+1)>>1)
#define avg2(a,b) ((a+b+1)>>1)
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
#define predict_o(i) (ref[i])
#define predict_x(i) (avg2 (ref[i], ref[i+1]))
#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
#define predict_o(i) (ref[i])
#define predict_x(i) (avg2 (ref[i], ref[i+1]))
#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
#define predict_xy(i) (avg4 (ref[i], ref[i+1], \
(ref+stride)[i], (ref+stride)[i+1]))
@ -67,7 +67,7 @@ static void inline MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \
op (predict_##xy, 15); \
ref += stride; \
dest += stride; \
} while (--height); \
} while (--height); \
} \
static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
const int stride, int height) \
@ -83,13 +83,11 @@ static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
op (predict_##xy, 7); \
ref += stride; \
dest += stride; \
} while (--height); \
} while (--height); \
} \
/* definitions of the actual mc functions */
MC_FUNC (put,o)
MC_FUNC (avg,o)
MC_FUNC (put,x)
MC_FUNC (avg,x)
MC_FUNC (put,y)
MC_FUNC (avg,y)
@ -117,7 +115,7 @@ static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref,
}
extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref,
int stride, int height);
int stride, int height);
extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref,
int stride, int height);

View File

@ -15,9 +15,10 @@
@ 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
@ along with mpeg2dec; if not, write to the Free Software
@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
.text
@ ----------------------------------------------------------------

View File

@ -19,10 +19,6 @@
* 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
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#include "config.h"
@ -67,7 +63,7 @@ static mmx_t round4 = {0x0002000200020002LL};
* unrolling will help
*/
static inline void mmx_zero_reg ()
static inline void mmx_zero_reg (void)
{
/* load 0 into mm0 */
pxor_r2r (mm0, mm0);

View File

@ -1,6 +1,6 @@
/*
* mpeg2.h
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
@ -20,16 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#ifndef MPEG2_H
#define MPEG2_H
#ifndef LIBMPEG2_MPEG2_H
#define LIBMPEG2_MPEG2_H
#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
#define MPEG2_RELEASE MPEG2_VERSION (0, 4, 1) /* 0.4.1 */
#define MPEG2_RELEASE MPEG2_VERSION (0, 5, 1) /* 0.5.1 */
#define SEQ_FLAG_MPEG2 1
#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
@ -132,7 +132,8 @@ typedef enum {
STATE_SLICE = 7,
STATE_END = 8,
STATE_INVALID = 9,
STATE_INVALID_END = 10
STATE_INVALID_END = 10,
STATE_SEQUENCE_MODIFIED = 11
} mpeg2_state_t;
typedef struct mpeg2_convert_init_s {
@ -160,6 +161,7 @@ void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf);
#define MPEG2_ACCEL_X86_3DNOW 2
#define MPEG2_ACCEL_X86_MMXEXT 4
#define MPEG2_ACCEL_X86_SSE2 8
#define MPEG2_ACCEL_X86_SSE3 16
#define MPEG2_ACCEL_PPC_ALTIVEC 1
#define MPEG2_ACCEL_ALPHA 1
#define MPEG2_ACCEL_ALPHA_MVI 2
@ -187,6 +189,9 @@ void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2);
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]);
void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer);
int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
unsigned int * pixel_width,
unsigned int * pixel_height);
typedef enum {
MPEG2_ALLOC_MPEG2DEC = 0,
@ -201,4 +206,4 @@ void mpeg2_free (void * buf);
void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t),
int free (void *));
#endif /* MPEG2_H */
#endif /* LIBMPEG2_MPEG2_H */

View File

@ -20,11 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
#ifndef LIBMPEG2_MPEG2_INTERNAL_H
#define LIBMPEG2_MPEG2_INTERNAL_H
#define STATE_INTERNAL_NORETURN ((mpeg2_state_t)-1)
/* macroblock modes */
#define MACROBLOCK_INTRA 1
#define MACROBLOCK_PATTERN 2
@ -149,6 +154,9 @@ struct mpeg2_decoder_s {
int mpeg1;
/* XXX: stuff due to xine shit */
int8_t q_scale_type;
int quantizer_scales[32];
int quantizer_scale;
char* quant_store;
@ -220,7 +228,8 @@ struct mpeg2dec_s {
int16_t display_offset_x, display_offset_y;
int copy_matrix;
int8_t q_scale_type, scaled[4];
int8_t scaled[4]; /* XXX: MOVED */
//int8_t q_scale_type, scaled[4];
uint8_t quantizer_matrix[4][64];
uint8_t new_quantizer_matrix[4][64];
@ -236,7 +245,7 @@ typedef struct {
} cpu_state_t;
/* cpu_accel.c */
uint32_t mpeg2_detect_accel (void);
uint32_t mpeg2_detect_accel (uint32_t accel);
/* cpu_state.c */
void mpeg2_cpu_state_init (uint32_t accel);
@ -262,7 +271,9 @@ mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);
void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);
/* idct.c */
void mpeg2_idct_init (uint32_t accel);
extern void mpeg2_idct_init (uint32_t accel);
extern uint8_t mpeg2_scan_norm[64];
extern uint8_t mpeg2_scan_alt[64];
/* idct_mmx.c */
void mpeg2_idct_copy_sse2 (int16_t * block, uint8_t * dest, int stride);
@ -315,3 +326,5 @@ extern mpeg2_mc_t mpeg2_mc_alpha;
extern mpeg2_mc_t mpeg2_mc_vis;
extern mpeg2_mc_t mpeg2_mc_arm;
extern mpeg2_mc_t mpeg2_mc_iwmmxt;
#endif /* LIBMPEG2_MPEG2_INTERNAL_H */

View File

@ -21,7 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.
* Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id$
*/
@ -450,7 +450,7 @@ static void get_intra_block_B14 (mpeg2_decoder_t * const decoder,
break; /* illegal, check needed to avoid buffer overflow */
}
dest[63] ^= mismatch & 16;
DUMPBITS (bit_buf, bits, 2); /* dump end of block code */
DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
decoder->bitstream_buf = bit_buf;
decoder->bitstream_bits = bits;
decoder->bitstream_ptr = bit_ptr;
@ -508,7 +508,7 @@ static void get_intra_block_B15 (mpeg2_decoder_t * const decoder,
} else {
/* end of block. I commented out this code because if we */
/* dont exit here we will still exit at the later test :) */
/* do not exit here we will still exit at the later test :) */
/* if (i >= 128) break; */ /* end of block */
@ -560,7 +560,7 @@ static void get_intra_block_B15 (mpeg2_decoder_t * const decoder,
break; /* illegal, check needed to avoid buffer overflow */
}
dest[63] ^= mismatch & 16;
DUMPBITS (bit_buf, bits, 4); /* dump end of block code */
DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
decoder->bitstream_buf = bit_buf;
decoder->bitstream_bits = bits;
decoder->bitstream_ptr = bit_ptr;
@ -681,7 +681,7 @@ static int get_non_intra_block (mpeg2_decoder_t * const decoder,
break; /* illegal, check needed to avoid buffer overflow */
}
dest[63] ^= mismatch & 16;
DUMPBITS (bit_buf, bits, 2); /* dump end of block code */
DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
decoder->bitstream_buf = bit_buf;
decoder->bitstream_bits = bits;
decoder->bitstream_ptr = bit_ptr;
@ -799,7 +799,7 @@ static void get_mpeg1_intra_block (mpeg2_decoder_t * const decoder)
}
break; /* illegal, check needed to avoid buffer overflow */
}
DUMPBITS (bit_buf, bits, 2); /* dump end of block code */
DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
decoder->bitstream_buf = bit_buf;
decoder->bitstream_bits = bits;
decoder->bitstream_ptr = bit_ptr;
@ -926,7 +926,7 @@ static int get_mpeg1_non_intra_block (mpeg2_decoder_t * const decoder)
}
break; /* illegal, check needed to avoid buffer overflow */
}
DUMPBITS (bit_buf, bits, 2); /* dump end of block code */
DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
decoder->bitstream_buf = bit_buf;
decoder->bitstream_bits = bits;
decoder->bitstream_ptr = bit_ptr;
@ -1569,18 +1569,24 @@ do { \
#define NEXT_MACROBLOCK \
do { \
if(decoder->quant_store) { \
if (decoder->picture_structure == TOP_FIELD) \
decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+(decoder->offset>>4)] = decoder->quantizer_scale; \
else if (decoder->picture_structure == BOTTOM_FIELD) \
decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+ decoder->quant_stride \
+(decoder->offset>>4)] = decoder->quantizer_scale; \
else \
decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \
+(decoder->offset>>4)] = decoder->quantizer_scale; \
} \
if(decoder->quant_store) { \
if (decoder->picture_structure == TOP_FIELD) \
decoder->quant_store[2 * decoder->quant_stride \
* (decoder->v_offset >> 4) \
+ (decoder->offset >> 4)] \
= decoder->quantizer_scale; \
else if (decoder->picture_structure == BOTTOM_FIELD) \
decoder->quant_store[2 * decoder->quant_stride \
* (decoder->v_offset >> 4) \
+ decoder->quant_stride \
+ (decoder->offset >> 4)] \
= decoder->quantizer_scale; \
else \
decoder->quant_store[decoder->quant_stride \
* (decoder->v_offset >> 4) \
+ (decoder->offset >> 4)] \
= decoder->quantizer_scale; \
} \
decoder->offset += 16; \
if (decoder->offset == decoder->width) { \
do { /* just so we can use the break statement */ \
@ -1604,6 +1610,10 @@ do { \
} \
} while (0)
/**
* Dummy motion decoding function, to avoid calling NULL in
* case of malformed streams.
*/
static void motion_dummy (mpeg2_decoder_t * const decoder,
motion_t * const motion,
mpeg2_mc_fct * const * const table)
@ -1668,7 +1678,7 @@ void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
if (decoder->mpeg1) {
decoder->motion_parser[0] = motion_zero_420;
decoder->motion_parser[MC_FIELD] = motion_dummy;
decoder->motion_parser[MC_FRAME] = motion_mp1;
decoder->motion_parser[MC_FRAME] = motion_mp1;
decoder->motion_parser[MC_DMV] = motion_dummy;
decoder->motion_parser[4] = motion_reuse_420;
} else if (decoder->picture_structure == FRAME_PICTURE) {
@ -1894,6 +1904,14 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
motion_parser_t * parser;
if ( ((macroblock_modes >> MOTION_TYPE_SHIFT) < 0)
|| ((macroblock_modes >> MOTION_TYPE_SHIFT) >=
(int)(sizeof(decoder->motion_parser)
/ sizeof(decoder->motion_parser[0])))
) {
break; // Illegal !
}
parser =
decoder->motion_parser[macroblock_modes >> MOTION_TYPE_SHIFT];
MOTION_CALL (parser, macroblock_modes);

View File

@ -41,6 +41,9 @@
* the assembler to keep the binary from becoming tainted.
*/
#ifndef LIBMPEG2_VIS_H
#define LIBMPEG2_VIS_H
#define vis_opc_base ((0x1 << 31) | (0x36 << 19))
#define vis_opf(X) ((X) << 5)
#define vis_sreg(X) (X)
@ -326,3 +329,5 @@ static inline void vis_alignaddrl_g0(void *_ptr)
/* Pixel component distance. */
#define vis_pdist(rs1,rs2,rd) vis_dd2d(0x3e, rs1, rs2, rd)
#endif /* LIBMPEG2_VIS_H */

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_VLC_H
#define LIBMPEG2_VLC_H
#define GETWORD(bit_buf,shift,bit_ptr) \
do { \
bit_buf |= ((bit_ptr[0] << 8) | bit_ptr[1]) << (shift); \
@ -121,7 +124,7 @@ static const MBtab MB_P [] = {
#define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD
static const MBtab MB_B [] = {
{0, 0}, {INTRA|QUANT, 6},
{0, 6}, {INTRA|QUANT, 6},
{BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6},
{INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5},
{INTRA, 5}, {INTRA, 5},
@ -201,7 +204,7 @@ static const CBPtab CBP_7 [] = {
};
static const CBPtab CBP_9 [] = {
{0, 0}, {0x00, 9}, {0x39, 9}, {0x36, 9},
{0, 9}, {0x00, 9}, {0x39, 9}, {0x36, 9},
{0x37, 9}, {0x3b, 9}, {0x3d, 9}, {0x3e, 9},
{0x17, 8}, {0x17, 8}, {0x1b, 8}, {0x1b, 8},
{0x1d, 8}, {0x1d, 8}, {0x1e, 8}, {0x1e, 8},
@ -289,7 +292,7 @@ static const DCTtab DCT_B14_10 [] = {
};
static const DCTtab DCT_B14_8 [] = {
{ 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
{ 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12},
{ 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7},
{ 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7},
{ 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6},
@ -326,7 +329,7 @@ static const DCTtab DCT_B15_10 [] = {
};
static const DCTtab DCT_B15_8 [] = {
{ 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
{ 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12},
{ 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7},
{ 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7},
{ 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6},
@ -427,3 +430,5 @@ static const MBAtab MBA_11 [] = {
{ 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
{ 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}
};
#endif /* LIBMPEG2_VLC_H */

View File

@ -116,6 +116,7 @@ unsigned swscale_version(void)
|| (x)==PIX_FMT_RGB555 \
|| (x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_YUV410P \
|| (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
|| (x)==PIX_FMT_YUV444P \
@ -127,6 +128,8 @@ unsigned swscale_version(void)
|| (x)==PIX_FMT_BGR4_BYTE \
|| (x)==PIX_FMT_RGB4_BYTE \
|| (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_MONOWHITE \
|| (x)==PIX_FMT_MONOBLACK \
)
#define isSupportedOut(x) ( \
(x)==PIX_FMT_YUV420P \
@ -143,6 +146,7 @@ unsigned swscale_version(void)
|| (x)==PIX_FMT_GRAY16LE \
|| (x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_YUV410P \
|| (x)==PIX_FMT_YUV440P \
)
#define isPacked(x) ( \
(x)==PIX_FMT_PAL8 \
@ -153,15 +157,15 @@ unsigned swscale_version(void)
)
#define RGB2YUV_SHIFT 15
#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
#define BY ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define BV (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define BU ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GY ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GV (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define GU (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RY ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
extern const int32_t Inverse_Table_6_9[8][4];
@ -258,11 +262,112 @@ static unsigned char clip_table[768];
static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b);
extern const uint8_t dither_2x2_4[2][8];
extern const uint8_t dither_2x2_8[2][8];
extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={
{ 1, 3, 1, 3, 1, 3, 1, 3, },
{ 2, 0, 2, 0, 2, 0, 2, 0, },
};
const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8]={
{ 6, 2, 6, 2, 6, 2, 6, 2, },
{ 0, 4, 0, 4, 0, 4, 0, 4, },
};
const uint8_t __attribute__((aligned(8))) dither_8x8_32[8][8]={
{ 17, 9, 23, 15, 16, 8, 22, 14, },
{ 5, 29, 3, 27, 4, 28, 2, 26, },
{ 21, 13, 19, 11, 20, 12, 18, 10, },
{ 0, 24, 6, 30, 1, 25, 7, 31, },
{ 16, 8, 22, 14, 17, 9, 23, 15, },
{ 4, 28, 2, 26, 5, 29, 3, 27, },
{ 20, 12, 18, 10, 21, 13, 19, 11, },
{ 1, 25, 7, 31, 0, 24, 6, 30, },
};
#if 0
const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8]={
{ 0, 48, 12, 60, 3, 51, 15, 63, },
{ 32, 16, 44, 28, 35, 19, 47, 31, },
{ 8, 56, 4, 52, 11, 59, 7, 55, },
{ 40, 24, 36, 20, 43, 27, 39, 23, },
{ 2, 50, 14, 62, 1, 49, 13, 61, },
{ 34, 18, 46, 30, 33, 17, 45, 29, },
{ 10, 58, 6, 54, 9, 57, 5, 53, },
{ 42, 26, 38, 22, 41, 25, 37, 21, },
};
#endif
const uint8_t __attribute__((aligned(8))) dither_8x8_73[8][8]={
{ 0, 55, 14, 68, 3, 58, 17, 72, },
{ 37, 18, 50, 32, 40, 22, 54, 35, },
{ 9, 64, 5, 59, 13, 67, 8, 63, },
{ 46, 27, 41, 23, 49, 31, 44, 26, },
{ 2, 57, 16, 71, 1, 56, 15, 70, },
{ 39, 21, 52, 34, 38, 19, 51, 33, },
{ 11, 66, 7, 62, 10, 65, 6, 60, },
{ 48, 30, 43, 25, 47, 29, 42, 24, },
};
#if 0
const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8]={
{ 68, 36, 92, 60, 66, 34, 90, 58, },
{ 20, 116, 12, 108, 18, 114, 10, 106, },
{ 84, 52, 76, 44, 82, 50, 74, 42, },
{ 0, 96, 24, 120, 6, 102, 30, 126, },
{ 64, 32, 88, 56, 70, 38, 94, 62, },
{ 16, 112, 8, 104, 22, 118, 14, 110, },
{ 80, 48, 72, 40, 86, 54, 78, 46, },
{ 4, 100, 28, 124, 2, 98, 26, 122, },
};
#endif
#if 1
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{117, 62, 158, 103, 113, 58, 155, 100, },
{ 34, 199, 21, 186, 31, 196, 17, 182, },
{144, 89, 131, 76, 141, 86, 127, 72, },
{ 0, 165, 41, 206, 10, 175, 52, 217, },
{110, 55, 151, 96, 120, 65, 162, 107, },
{ 28, 193, 14, 179, 38, 203, 24, 189, },
{138, 83, 124, 69, 148, 93, 134, 79, },
{ 7, 172, 48, 213, 3, 168, 45, 210, },
};
#elif 1
// tries to correct a gamma of 1.5
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 143, 18, 200, 2, 156, 25, 215, },
{ 78, 28, 125, 64, 89, 36, 138, 74, },
{ 10, 180, 3, 161, 16, 195, 8, 175, },
{109, 51, 93, 38, 121, 60, 105, 47, },
{ 1, 152, 23, 210, 0, 147, 20, 205, },
{ 85, 33, 134, 71, 81, 30, 130, 67, },
{ 14, 190, 6, 171, 12, 185, 5, 166, },
{117, 57, 101, 44, 113, 54, 97, 41, },
};
#elif 1
// tries to correct a gamma of 2.0
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 124, 8, 193, 0, 140, 12, 213, },
{ 55, 14, 104, 42, 66, 19, 119, 52, },
{ 3, 168, 1, 145, 6, 187, 3, 162, },
{ 86, 31, 70, 21, 99, 39, 82, 28, },
{ 0, 134, 11, 206, 0, 129, 9, 200, },
{ 62, 17, 114, 48, 58, 16, 109, 45, },
{ 5, 181, 2, 157, 4, 175, 1, 151, },
{ 95, 36, 78, 26, 90, 34, 74, 24, },
};
#else
// tries to correct a gamma of 2.5
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 107, 3, 187, 0, 125, 6, 212, },
{ 39, 7, 86, 28, 49, 11, 102, 36, },
{ 1, 158, 0, 131, 3, 180, 1, 151, },
{ 68, 19, 52, 12, 81, 25, 64, 17, },
{ 0, 119, 5, 203, 0, 113, 4, 195, },
{ 45, 9, 96, 33, 42, 8, 91, 30, },
{ 2, 172, 1, 144, 2, 165, 0, 137, },
{ 77, 23, 60, 15, 72, 21, 56, 14, },
};
#endif
const char *sws_format_name(enum PixelFormat format)
{
@ -434,7 +539,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}
}
#define YSCALE_YUV_2_PACKEDX_C(type) \
#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type) \
for (i=0; i<(dstW>>1); i++){\
int j;\
int Y1 = 1<<18;\
@ -458,6 +563,9 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
Y2>>=19;\
U >>=19;\
V >>=19;\
#define YSCALE_YUV_2_PACKEDX_C(type) \
YSCALE_YUV_2_PACKEDX_NOCLIP_C(type)\
if ((Y1|Y2|U|V)&256)\
{\
if (Y1>255) Y1=255; \
@ -470,14 +578,51 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
else if (V<0) V=0; \
}
#define YSCALE_YUV_2_GRAY16_C(type) \
#define YSCALE_YUV_2_PACKEDX_FULL_C \
for (i=0; i<dstW; i++){\
int j;\
int Y = 0;\
int U = -128<<19;\
int V = -128<<19;\
int R,G,B;\
\
for (j=0; j<lumFilterSize; j++){\
Y += lumSrc[j][i ] * lumFilter[j];\
}\
for (j=0; j<chrFilterSize; j++){\
U += chrSrc[j][i ] * chrFilter[j];\
V += chrSrc[j][i+VOFW] * chrFilter[j];\
}\
Y >>=10;\
U >>=10;\
V >>=10;\
#define YSCALE_YUV_2_RGBX_FULL_C(rnd) \
YSCALE_YUV_2_PACKEDX_FULL_C\
Y-= c->yuv2rgb_y_offset;\
Y*= c->yuv2rgb_y_coeff;\
Y+= rnd;\
R= Y + V*c->yuv2rgb_v2r_coeff;\
G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\
B= Y + U*c->yuv2rgb_u2b_coeff;\
if ((R|G|B)&(0xC0000000)){\
if (R>=(256<<22)) R=(256<<22)-1; \
else if (R<0)R=0; \
if (G>=(256<<22)) G=(256<<22)-1; \
else if (G<0)G=0; \
if (B>=(256<<22)) B=(256<<22)-1; \
else if (B<0)B=0; \
}\
#define YSCALE_YUV_2_GRAY16_C \
for (i=0; i<(dstW>>1); i++){\
int j;\
int Y1 = 1<<18;\
int Y2 = 1<<18;\
int U = 1<<18;\
int V = 1<<18;\
type av_unused *r, *b, *g;\
\
const int i2= 2*i;\
\
for (j=0; j<lumFilterSize; j++)\
@ -496,7 +641,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}
#define YSCALE_YUV_2_RGBX_C(type) \
YSCALE_YUV_2_PACKEDX_C(type) \
YSCALE_YUV_2_PACKEDX_C(type) /* FIXME fix tables so that cliping is not needed and then use _NOCLIP*/\
r = (type *)c->table_rV[V]; \
g = (type *)(c->table_gU[U] + c->table_gV[V]); \
b = (type *)c->table_bU[U]; \
@ -558,7 +703,57 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
g = (type *)(c->table_gU[U] + c->table_gV[V]);\
b = (type *)c->table_bU[U];\
#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16)\
#define YSCALE_YUV_2_MONO2_C \
const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\
for (i=0; i<dstW-7; i+=8){\
int acc;\
acc = g[((buf0[i ]*yalpha1+buf1[i ]*yalpha)>>19) + d128[0]];\
acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\
acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\
acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\
acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\
acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
dest++;\
}\
#define YSCALE_YUV_2_MONOX_C \
const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\
int acc=0;\
for (i=0; i<dstW-1; i+=2){\
int j;\
int Y1=1<<18;\
int Y2=1<<18;\
\
for (j=0; j<lumFilterSize; j++)\
{\
Y1 += lumSrc[j][i] * lumFilter[j];\
Y2 += lumSrc[j][i+1] * lumFilter[j];\
}\
Y1>>=19;\
Y2>>=19;\
if ((Y1|Y2)&256)\
{\
if (Y1>255) Y1=255;\
else if (Y1<0)Y1=0;\
if (Y2>255) Y2=255;\
else if (Y2<0)Y2=0;\
}\
acc+= acc + g[Y1+d128[(i+0)&7]];\
acc+= acc + g[Y2+d128[(i+1)&7]];\
if ((i&7)==6){\
((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
dest++;\
}\
}
#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)\
switch(c->dstFormat)\
{\
case PIX_FMT_RGB32:\
@ -656,67 +851,9 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
break;\
case PIX_FMT_MONOBLACK:\
case PIX_FMT_MONOWHITE:\
{\
const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\
for (i=0; i<dstW-7; i+=8){\
int acc;\
acc = g[((buf0[i ]*yalpha1+buf1[i ]*yalpha)>>19) + d128[0]];\
acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\
acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\
acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\
acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\
acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
((uint8_t*)dest)[0]= acc;\
dest++;\
}\
\
/*\
((uint8_t*)dest)-= dstW>>4;\
{\
int acc=0;\
int left=0;\
static int top[1024];\
static int last_new[1024][1024];\
static int last_in3[1024][1024];\
static int drift[1024][1024];\
int topLeft=0;\
int shift=0;\
int count=0;\
const uint8_t * const d128=dither_8x8_220[y&7];\
int error_new=0;\
int error_in3=0;\
int f=0;\
\
for (i=dstW>>1; i<dstW; i++){\
int in= ((buf0[i ]*yalpha1+buf1[i ]*yalpha)>>19);\
int in2 = (76309 * (in - 16) + 32768) >> 16;\
int in3 = (in2 < 0) ? 0 : ((in2 > 255) ? 255 : in2);\
int old= (left*7 + topLeft + top[i]*5 + top[i+1]*3)/20 + in3\
+ (last_new[y][i] - in3)*f/256;\
int new= old> 128 ? 255 : 0;\
\
error_new+= FFABS(last_new[y][i] - new);\
error_in3+= FFABS(last_in3[y][i] - in3);\
f= error_new - error_in3*4;\
if (f<0) f=0;\
if (f>256) f=256;\
\
topLeft= top[i];\
left= top[i]= old - new;\
last_new[y][i]= new;\
last_in3[y][i]= in3;\
\
acc+= acc + (new&1);\
if ((i&7)==6){\
((uint8_t*)dest)[0]= acc;\
((uint8_t*)dest)++;\
}\
}\
}\
*/\
func_monoblack\
}\
break;\
case PIX_FMT_YUYV422:\
@ -759,170 +896,50 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
uint8_t *dest, int dstW, int y)
{
int i;
switch(c->dstFormat)
{
case PIX_FMT_BGR32:
case PIX_FMT_RGB32:
case PIX_FMT_BGR32_1:
case PIX_FMT_RGB32_1:
YSCALE_YUV_2_RGBX_C(uint32_t)
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];
}
break;
case PIX_FMT_RGB24:
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[0]= r[Y1];
((uint8_t*)dest)[1]= g[Y1];
((uint8_t*)dest)[2]= b[Y1];
((uint8_t*)dest)[3]= r[Y2];
((uint8_t*)dest)[4]= g[Y2];
((uint8_t*)dest)[5]= b[Y2];
dest+=6;
}
break;
case PIX_FMT_BGR24:
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[0]= b[Y1];
((uint8_t*)dest)[1]= g[Y1];
((uint8_t*)dest)[2]= r[Y1];
((uint8_t*)dest)[3]= b[Y2];
((uint8_t*)dest)[4]= g[Y2];
((uint8_t*)dest)[5]= r[Y2];
dest+=6;
}
break;
case PIX_FMT_RGB565:
case PIX_FMT_BGR565:
{
const int dr1= dither_2x2_8[y&1 ][0];
const int dg1= dither_2x2_4[y&1 ][0];
const int db1= dither_2x2_8[(y&1)^1][0];
const int dr2= dither_2x2_8[y&1 ][1];
const int dg2= dither_2x2_4[y&1 ][1];
const int db2= dither_2x2_8[(y&1)^1][1];
YSCALE_YUV_2_RGBX_C(uint16_t)
((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
}
}
break;
case PIX_FMT_RGB555:
case PIX_FMT_BGR555:
{
const int dr1= dither_2x2_8[y&1 ][0];
const int dg1= dither_2x2_8[y&1 ][1];
const int db1= dither_2x2_8[(y&1)^1][0];
const int dr2= dither_2x2_8[y&1 ][1];
const int dg2= dither_2x2_8[y&1 ][0];
const int db2= dither_2x2_8[(y&1)^1][1];
YSCALE_YUV_2_RGBX_C(uint16_t)
((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
}
}
break;
case PIX_FMT_RGB8:
case PIX_FMT_BGR8:
{
const uint8_t * const d64= dither_8x8_73[y&7];
const uint8_t * const d32= dither_8x8_32[y&7];
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]];
((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]];
}
}
break;
case PIX_FMT_RGB4:
case PIX_FMT_BGR4:
{
const uint8_t * const d64= dither_8x8_73 [y&7];
const uint8_t * const d128=dither_8x8_220[y&7];
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]
+((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4);
}
}
break;
case PIX_FMT_RGB4_BYTE:
case PIX_FMT_BGR4_BYTE:
{
const uint8_t * const d64= dither_8x8_73 [y&7];
const uint8_t * const d128=dither_8x8_220[y&7];
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[i2+0]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]];
((uint8_t*)dest)[i2+1]= r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]];
}
}
break;
case PIX_FMT_MONOBLACK:
{
const uint8_t * const d128=dither_8x8_220[y&7];
uint8_t *g= c->table_gU[128] + c->table_gV[128];
int acc=0;
for (i=0; i<dstW-1; i+=2){
int j;
int Y1=1<<18;
int Y2=1<<18;
for (j=0; j<lumFilterSize; j++)
{
Y1 += lumSrc[j][i] * lumFilter[j];
Y2 += lumSrc[j][i+1] * lumFilter[j];
}
Y1>>=19;
Y2>>=19;
if ((Y1|Y2)&256)
{
if (Y1>255) Y1=255;
else if (Y1<0)Y1=0;
if (Y2>255) Y2=255;
else if (Y2<0)Y2=0;
}
acc+= acc + g[Y1+d128[(i+0)&7]];
acc+= acc + g[Y2+d128[(i+1)&7]];
if ((i&7)==6){
((uint8_t*)dest)[0]= acc;
dest++;
}
}
}
break;
case PIX_FMT_YUYV422:
YSCALE_YUV_2_PACKEDX_C(void)
((uint8_t*)dest)[2*i2+0]= Y1;
((uint8_t*)dest)[2*i2+1]= U;
((uint8_t*)dest)[2*i2+2]= Y2;
((uint8_t*)dest)[2*i2+3]= V;
}
break;
case PIX_FMT_UYVY422:
YSCALE_YUV_2_PACKEDX_C(void)
((uint8_t*)dest)[2*i2+0]= U;
((uint8_t*)dest)[2*i2+1]= Y1;
((uint8_t*)dest)[2*i2+2]= V;
((uint8_t*)dest)[2*i2+3]= Y2;
}
break;
case PIX_FMT_GRAY16BE:
YSCALE_YUV_2_GRAY16_C(void)
((uint8_t*)dest)[2*i2+0]= Y1>>8;
((uint8_t*)dest)[2*i2+1]= Y1;
((uint8_t*)dest)[2*i2+2]= Y2>>8;
((uint8_t*)dest)[2*i2+3]= Y2;
}
break;
case PIX_FMT_GRAY16LE:
YSCALE_YUV_2_GRAY16_C(void)
((uint8_t*)dest)[2*i2+0]= Y1;
((uint8_t*)dest)[2*i2+1]= Y1>>8;
((uint8_t*)dest)[2*i2+2]= Y2;
((uint8_t*)dest)[2*i2+3]= Y2>>8;
}
break;
}
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C)
}
static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, int dstW, int y)
{
int i;
int step= fmt_depth(c->dstFormat)/8;
int aidx= 3;
switch(c->dstFormat){
case PIX_FMT_ARGB:
dest++;
aidx= 0;
case PIX_FMT_RGB24:
aidx--;
case PIX_FMT_RGBA:
YSCALE_YUV_2_RGBX_FULL_C(1<<21)
dest[aidx]= 0;
dest[0]= R>>22;
dest[1]= G>>22;
dest[2]= B>>22;
dest+= step;
}
break;
case PIX_FMT_ABGR:
dest++;
aidx= 0;
case PIX_FMT_BGR24:
aidx--;
case PIX_FMT_BGRA:
YSCALE_YUV_2_RGBX_FULL_C(1<<21)
dest[aidx]= 0;
dest[0]= B>>22;
dest[1]= G>>22;
dest[2]= R>>22;
dest+= step;
}
break;
default:
assert(0);
}
}
//Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
//Plain C versions
@ -1036,8 +1053,9 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int filterSize;
int filter2Size;
int minFilterSize;
double *filter=NULL;
double *filter2=NULL;
int64_t *filter=NULL;
int64_t *filter2=NULL;
const int64_t fone= 1LL<<54;
int ret= -1;
#if defined(ARCH_X86)
if (flags & SWS_CPU_CAPS_MMX)
@ -1051,12 +1069,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
{
int i;
filterSize= 1;
filter= av_malloc(dstW*sizeof(double)*filterSize);
for (i=0; i<dstW*filterSize; i++) filter[i]=0;
filter= av_mallocz(dstW*sizeof(*filter)*filterSize);
for (i=0; i<dstW; i++)
{
filter[i*filterSize]=1;
filter[i*filterSize]= fone;
(*filterPos)[i]=i;
}
@ -1066,7 +1083,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int i;
int xDstInSrc;
filterSize= 1;
filter= av_malloc(dstW*sizeof(double)*filterSize);
filter= av_malloc(dstW*sizeof(*filter)*filterSize);
xDstInSrc= xInc/2 - 0x8000;
for (i=0; i<dstW; i++)
@ -1074,7 +1091,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
(*filterPos)[i]= xx;
filter[i]= 1.0;
filter[i]= fone;
xDstInSrc+= xInc;
}
}
@ -1085,7 +1102,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
if (flags&SWS_BICUBIC) filterSize= 4;
else if (flags&SWS_X ) filterSize= 4;
else filterSize= 2; // SWS_BILINEAR / SWS_AREA
filter= av_malloc(dstW*sizeof(double)*filterSize);
filter= av_malloc(dstW*sizeof(*filter)*filterSize);
xDstInSrc= xInc/2 - 0x8000;
for (i=0; i<dstW; i++)
@ -1097,8 +1114,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
//Bilinear upscale / linear interpolate / Area averaging
for (j=0; j<filterSize; j++)
{
double d= FFABS((xx<<16) - xDstInSrc)/(double)(1<<16);
double coeff= 1.0 - d;
int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16);
if (coeff<0) coeff=0;
filter[i*filterSize + j]= coeff;
xx++;
@ -1108,52 +1124,59 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
}
else
{
double xDstInSrc;
double sizeFactor, filterSizeInSrc;
const double xInc1= (double)xInc / (double)(1<<16);
int xDstInSrc;
int sizeFactor;
if (flags&SWS_BICUBIC) sizeFactor= 4.0;
else if (flags&SWS_X) sizeFactor= 8.0;
else if (flags&SWS_AREA) sizeFactor= 1.0; //downscale only, for upscale it is bilinear
else if (flags&SWS_GAUSS) sizeFactor= 8.0; // infinite ;)
else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? 2.0*param[0] : 6.0;
else if (flags&SWS_SINC) sizeFactor= 20.0; // infinite ;)
else if (flags&SWS_SPLINE) sizeFactor= 20.0; // infinite ;)
else if (flags&SWS_BILINEAR) sizeFactor= 2.0;
if (flags&SWS_BICUBIC) sizeFactor= 4;
else if (flags&SWS_X) sizeFactor= 8;
else if (flags&SWS_AREA) sizeFactor= 1; //downscale only, for upscale it is bilinear
else if (flags&SWS_GAUSS) sizeFactor= 8; // infinite ;)
else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? ceil(2*param[0]) : 6;
else if (flags&SWS_SINC) sizeFactor= 20; // infinite ;)
else if (flags&SWS_SPLINE) sizeFactor= 20; // infinite ;)
else if (flags&SWS_BILINEAR) sizeFactor= 2;
else {
sizeFactor= 0.0; //GCC warning killer
sizeFactor= 0; //GCC warning killer
assert(0);
}
if (xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale
else filterSizeInSrc= sizeFactor*srcW / (double)dstW;
if (xInc <= 1<<16) filterSize= 1 + sizeFactor; // upscale
else filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
filterSize= (int)ceil(1 + filterSizeInSrc); // will be reduced later if possible
if (filterSize > srcW-2) filterSize=srcW-2;
filter= av_malloc(dstW*sizeof(double)*filterSize);
filter= av_malloc(dstW*sizeof(*filter)*filterSize);
xDstInSrc= xInc1 / 2.0 - 0.5;
xDstInSrc= xInc - 0x10000;
for (i=0; i<dstW; i++)
{
int xx= (int)(xDstInSrc - (filterSize-1)*0.5 + 0.5);
int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17);
int j;
(*filterPos)[i]= xx;
for (j=0; j<filterSize; j++)
{
double d= FFABS(xx - xDstInSrc)/filterSizeInSrc*sizeFactor;
double coeff;
int64_t d= ((int64_t)FFABS((xx<<17) - xDstInSrc))<<13;
double floatd;
int64_t coeff;
if (xInc > 1<<16)
d= d*dstW/srcW;
floatd= d * (1.0/(1<<30));
if (flags & SWS_BICUBIC)
{
double B= param[0] != SWS_PARAM_DEFAULT ? param[0] : 0.0;
double C= param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6;
int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24);
int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24);
int64_t dd = ( d*d)>>30;
int64_t ddd= (dd*d)>>30;
if (d<1.0)
coeff = (12-9*B-6*C)*d*d*d + (-18+12*B+6*C)*d*d + 6-2*B;
else if (d<2.0)
coeff = (-B-6*C)*d*d*d + (6*B+30*C)*d*d + (-12*B-48*C)*d +8*B+24*C;
if (d < 1LL<<30)
coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30);
else if (d < 1LL<<31)
coeff = (-B-6*C)*ddd + (6*B+30*C)*dd + (-12*B-48*C)*d + (8*B+24*C)*(1<<30);
else
coeff=0.0;
coeff *= fone>>(30+24);
}
/* else if (flags & SWS_X)
{
@ -1164,46 +1187,49 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
else if (flags & SWS_X)
{
double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
double c;
if (d<1.0)
coeff = cos(d*PI);
if (floatd<1.0)
c = cos(floatd*PI);
else
coeff=-1.0;
if (coeff<0.0) coeff= -pow(-coeff, A);
else coeff= pow( coeff, A);
coeff= coeff*0.5 + 0.5;
c=-1.0;
if (c<0.0) c= -pow(-c, A);
else c= pow( c, A);
coeff= (c*0.5 + 0.5)*fone;
}
else if (flags & SWS_AREA)
{
double srcPixelSize= 1.0/xInc1;
if (d + srcPixelSize/2 < 0.5) coeff= 1.0;
else if (d - srcPixelSize/2 < 0.5) coeff= (0.5-d)/srcPixelSize + 0.5;
int64_t d2= d - (1<<29);
if (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16));
else if (d2*xInc < (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16));
else coeff=0.0;
coeff *= fone>>(30+16);
}
else if (flags & SWS_GAUSS)
{
double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = pow(2.0, - p*d*d);
coeff = (pow(2.0, - p*floatd*floatd))*fone;
}
else if (flags & SWS_SINC)
{
coeff = d ? sin(d*PI)/(d*PI) : 1.0;
coeff = (d ? sin(floatd*PI)/(floatd*PI) : 1.0)*fone;
}
else if (flags & SWS_LANCZOS)
{
double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = d ? sin(d*PI)*sin(d*PI/p)/(d*d*PI*PI/p) : 1.0;
if (d>p) coeff=0;
coeff = (d ? sin(floatd*PI)*sin(floatd*PI/p)/(floatd*floatd*PI*PI/p) : 1.0)*fone;
if (floatd>p) coeff=0;
}
else if (flags & SWS_BILINEAR)
{
coeff= 1.0 - d;
coeff= (1<<30) - d;
if (coeff<0) coeff=0;
coeff *= fone >> 30;
}
else if (flags & SWS_SPLINE)
{
double p=-2.196152422706632;
coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, d);
coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, d) * fone;
}
else {
coeff= 0.0; //GCC warning killer
@ -1213,7 +1239,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
filter[i*filterSize + j]= coeff;
xx++;
}
xDstInSrc+= xInc1;
xDstInSrc+= 2*xInc;
}
}
@ -1225,31 +1251,24 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
if (srcFilter) filter2Size+= srcFilter->length - 1;
if (dstFilter) filter2Size+= dstFilter->length - 1;
assert(filter2Size>0);
filter2= av_malloc(filter2Size*dstW*sizeof(double));
filter2= av_mallocz(filter2Size*dstW*sizeof(*filter2));
for (i=0; i<dstW; i++)
{
int j;
SwsVector scaleFilter;
SwsVector *outVec;
int j, k;
scaleFilter.coeff= filter + i*filterSize;
scaleFilter.length= filterSize;
if (srcFilter) outVec= sws_getConvVec(srcFilter, &scaleFilter);
else outVec= &scaleFilter;
assert(outVec->length == filter2Size);
if(srcFilter){
for (k=0; k<srcFilter->length; k++){
for (j=0; j<filterSize; j++)
filter2[i*filter2Size + k + j] += srcFilter->coeff[k]*filter[i*filterSize + j];
}
}else{
for (j=0; j<filterSize; j++)
filter2[i*filter2Size + j]= filter[i*filterSize + j];
}
//FIXME dstFilter
for (j=0; j<outVec->length; j++)
{
filter2[i*filter2Size + j]= outVec->coeff[j];
}
(*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2;
if (outVec != &scaleFilter) sws_freeVec(outVec);
}
av_freep(&filter);
@ -1260,7 +1279,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
{
int min= filter2Size;
int j;
double cutOff=0.0;
int64_t cutOff=0.0;
/* get rid off near zero elements on the left by shifting left */
for (j=0; j<filter2Size; j++)
@ -1268,7 +1287,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int k;
cutOff += FFABS(filter2[i*filter2Size]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF) break;
if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
/* preserve monotonicity because the core can't handle the filter otherwise */
if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
@ -1276,17 +1295,17 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
// Move filter coeffs left
for (k=1; k<filter2Size; k++)
filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
filter2[i*filter2Size + k - 1]= 0.0;
filter2[i*filter2Size + k - 1]= 0;
(*filterPos)[i]++;
}
cutOff=0.0;
cutOff=0;
/* count near zeros on the right */
for (j=filter2Size-1; j>0; j--)
{
cutOff += FFABS(filter2[i*filter2Size + j]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF) break;
if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
min--;
}
@ -1317,7 +1336,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
assert(minFilterSize > 0);
filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
assert(filterSize > 0);
filter= av_malloc(filterSize*dstW*sizeof(double));
filter= av_malloc(filterSize*dstW*sizeof(*filter));
if (filterSize >= MAX_FILTER_SIZE*16/((flags&SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
goto error;
*outFilterSize= filterSize;
@ -1331,8 +1350,10 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
for (j=0; j<filterSize; j++)
{
if (j>=filter2Size) filter[i*filterSize + j]= 0.0;
if (j>=filter2Size) filter[i*filterSize + j]= 0;
else filter[i*filterSize + j]= filter2[i*filter2Size + j];
if((flags & SWS_BITEXACT) && j>=minFilterSize)
filter[i*filterSize + j]= 0;
}
}
@ -1377,21 +1398,20 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
for (i=0; i<dstW; i++)
{
int j;
double error=0;
double sum=0;
double scale= one;
int64_t error=0;
int64_t sum=0;
for (j=0; j<filterSize; j++)
{
sum+= filter[i*filterSize + j];
}
scale/= sum;
sum= (sum + one/2)/ one;
for (j=0; j<*outFilterSize; j++)
{
double v= filter[i*filterSize + j]*scale + error;
int intV= floor(v + 0.5);
int64_t v= filter[i*filterSize + j] + error;
int intV= ROUNDED_DIV(v, sum);
(*outFilter)[i*(*outFilterSize) + j]= intV;
error = v - intV;
error= v - intV*sum;
}
}
@ -2047,6 +2067,13 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;
c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;
c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13);
c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);
c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);
c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
//FIXME factorize
@ -2161,7 +2188,6 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
return NULL;
}
/* sanity check */
if (srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
{
@ -2248,19 +2274,20 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
}
#ifdef CONFIG_GPL
/* yuv2bgr */
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat))
&& !(flags & SWS_ACCURATE_RND))
{
c->swScale= yuv2rgb_get_func_ptr(c);
}
#endif
if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P)
if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_BITEXACT))
{
c->swScale= yvu9toyv12Wrapper;
}
/* bgr24toYV12 */
if (srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P)
if (srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_ACCURATE_RND))
c->swScale= bgr24toyv12Wrapper;
/* rgb/bgr -> rgb/bgr (no dither needed forms) */
@ -2273,6 +2300,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
&& srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
&& srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
&& srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
&& srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
&& dstFormat != PIX_FMT_RGB32_1
&& dstFormat != PIX_FMT_BGR32_1
&& (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
@ -2434,11 +2462,11 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
1;
initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
srcH , dstH, filterAlign, (1<<12)-4,
srcH , dstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags,
srcFilter->lumV, dstFilter->lumV, c->param);
initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
c->chrSrcH, c->chrDstH, filterAlign, (1<<12)-4,
c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrV, dstFilter->chrV, c->param);

View File

@ -75,6 +75,7 @@ unsigned swscale_version(void);
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_BITEXACT 0x80000
#define SWS_CPU_CAPS_MMX 0x80000000
#define SWS_CPU_CAPS_MMX2 0x20000000

View File

@ -53,6 +53,7 @@ static const AVOption options[] = {
{ "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" },
{ "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INT, INT_MIN, INT_MAX, VE, "sws_flags" },
{ "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INP, INT_MIN, INT_MAX, VE, "sws_flags" },
{ "bitexact", "", 0 , FF_OPT_TYPE_CONST, SWS_BITEXACT, INT_MIN, INT_MAX, VE, "sws_flags" },
{ NULL }
};

View File

@ -126,6 +126,12 @@ typedef struct SwsContext{
int srcColorspaceTable[4];
int dstColorspaceTable[4];
int srcRange, dstRange;
int yuv2rgb_y_offset;
int yuv2rgb_y_coeff;
int yuv2rgb_v2r_coeff;
int yuv2rgb_v2g_coeff;
int yuv2rgb_u2g_coeff;
int yuv2rgb_u2b_coeff;
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
@ -248,6 +254,7 @@ const char *sws_format_name(int format);
|| (x)==PIX_FMT_RGB4 \
|| (x)==PIX_FMT_RGB4_BYTE \
|| (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \
)
#define isBGR(x) ( \
(x)==PIX_FMT_BGR32 \
@ -259,6 +266,7 @@ const char *sws_format_name(int format);
|| (x)==PIX_FMT_BGR4 \
|| (x)==PIX_FMT_BGR4_BYTE \
|| (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \
)
static inline int fmt_depth(int fmt)
@ -289,6 +297,7 @@ static inline int fmt_depth(int fmt)
case PIX_FMT_RGB4_BYTE:
return 4;
case PIX_FMT_MONOBLACK:
case PIX_FMT_MONOWHITE:
return 1;
default:
return 0;

File diff suppressed because it is too large Load Diff

View File

@ -41,112 +41,11 @@
#define DITHER1XBPP // only for MMX
const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={
{ 1, 3, 1, 3, 1, 3, 1, 3, },
{ 2, 0, 2, 0, 2, 0, 2, 0, },
};
const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8]={
{ 6, 2, 6, 2, 6, 2, 6, 2, },
{ 0, 4, 0, 4, 0, 4, 0, 4, },
};
const uint8_t __attribute__((aligned(8))) dither_8x8_32[8][8]={
{ 17, 9, 23, 15, 16, 8, 22, 14, },
{ 5, 29, 3, 27, 4, 28, 2, 26, },
{ 21, 13, 19, 11, 20, 12, 18, 10, },
{ 0, 24, 6, 30, 1, 25, 7, 31, },
{ 16, 8, 22, 14, 17, 9, 23, 15, },
{ 4, 28, 2, 26, 5, 29, 3, 27, },
{ 20, 12, 18, 10, 21, 13, 19, 11, },
{ 1, 25, 7, 31, 0, 24, 6, 30, },
};
#if 0
const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8]={
{ 0, 48, 12, 60, 3, 51, 15, 63, },
{ 32, 16, 44, 28, 35, 19, 47, 31, },
{ 8, 56, 4, 52, 11, 59, 7, 55, },
{ 40, 24, 36, 20, 43, 27, 39, 23, },
{ 2, 50, 14, 62, 1, 49, 13, 61, },
{ 34, 18, 46, 30, 33, 17, 45, 29, },
{ 10, 58, 6, 54, 9, 57, 5, 53, },
{ 42, 26, 38, 22, 41, 25, 37, 21, },
};
#endif
const uint8_t __attribute__((aligned(8))) dither_8x8_73[8][8]={
{ 0, 55, 14, 68, 3, 58, 17, 72, },
{ 37, 18, 50, 32, 40, 22, 54, 35, },
{ 9, 64, 5, 59, 13, 67, 8, 63, },
{ 46, 27, 41, 23, 49, 31, 44, 26, },
{ 2, 57, 16, 71, 1, 56, 15, 70, },
{ 39, 21, 52, 34, 38, 19, 51, 33, },
{ 11, 66, 7, 62, 10, 65, 6, 60, },
{ 48, 30, 43, 25, 47, 29, 42, 24, },
};
#if 0
const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8]={
{ 68, 36, 92, 60, 66, 34, 90, 58, },
{ 20, 116, 12, 108, 18, 114, 10, 106, },
{ 84, 52, 76, 44, 82, 50, 74, 42, },
{ 0, 96, 24, 120, 6, 102, 30, 126, },
{ 64, 32, 88, 56, 70, 38, 94, 62, },
{ 16, 112, 8, 104, 22, 118, 14, 110, },
{ 80, 48, 72, 40, 86, 54, 78, 46, },
{ 4, 100, 28, 124, 2, 98, 26, 122, },
};
#endif
#if 1
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{117, 62, 158, 103, 113, 58, 155, 100, },
{ 34, 199, 21, 186, 31, 196, 17, 182, },
{144, 89, 131, 76, 141, 86, 127, 72, },
{ 0, 165, 41, 206, 10, 175, 52, 217, },
{110, 55, 151, 96, 120, 65, 162, 107, },
{ 28, 193, 14, 179, 38, 203, 24, 189, },
{138, 83, 124, 69, 148, 93, 134, 79, },
{ 7, 172, 48, 213, 3, 168, 45, 210, },
};
#elif 1
// tries to correct a gamma of 1.5
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 143, 18, 200, 2, 156, 25, 215, },
{ 78, 28, 125, 64, 89, 36, 138, 74, },
{ 10, 180, 3, 161, 16, 195, 8, 175, },
{109, 51, 93, 38, 121, 60, 105, 47, },
{ 1, 152, 23, 210, 0, 147, 20, 205, },
{ 85, 33, 134, 71, 81, 30, 130, 67, },
{ 14, 190, 6, 171, 12, 185, 5, 166, },
{117, 57, 101, 44, 113, 54, 97, 41, },
};
#elif 1
// tries to correct a gamma of 2.0
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 124, 8, 193, 0, 140, 12, 213, },
{ 55, 14, 104, 42, 66, 19, 119, 52, },
{ 3, 168, 1, 145, 6, 187, 3, 162, },
{ 86, 31, 70, 21, 99, 39, 82, 28, },
{ 0, 134, 11, 206, 0, 129, 9, 200, },
{ 62, 17, 114, 48, 58, 16, 109, 45, },
{ 5, 181, 2, 157, 4, 175, 1, 151, },
{ 95, 36, 78, 26, 90, 34, 74, 24, },
};
#else
// tries to correct a gamma of 2.5
const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
{ 0, 107, 3, 187, 0, 125, 6, 212, },
{ 39, 7, 86, 28, 49, 11, 102, 36, },
{ 1, 158, 0, 131, 3, 180, 1, 151, },
{ 68, 19, 52, 12, 81, 25, 64, 17, },
{ 0, 119, 5, 203, 0, 113, 4, 195, },
{ 45, 9, 96, 33, 42, 8, 91, 30, },
{ 2, 172, 1, 144, 2, 165, 0, 137, },
{ 77, 23, 60, 15, 72, 21, 56, 14, },
};
#endif
extern const uint8_t dither_2x2_4[2][8];
extern const uint8_t dither_2x2_8[2][8];
extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
#ifdef HAVE_MMX
@ -880,10 +779,10 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
}
for (i = 0; i < 256; i++) {
c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), 76309);
c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), 76309);
c->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);
c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), 76309);
c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), cy);
c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), cy);
c->table_gV[i] = entry_size * div_round (cgv * (i-128), cy);
c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), cy);
}
av_free(c->yuvTable);

View File

@ -1,26 +1,25 @@
/*
MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550
Copyright (C) 2002-2005 Ville Syrjala <syrjala@sci.fi>
Originally based on vo_directfb.c by
Jiri Svoboda <Jiri.Svoboda@seznam.cz>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
*/
* MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550
*
* copyright (C) 2002-2008 Ville Syrjala <syrjala@sci.fi>
* Originally based on vo_directfb.c by Jiri Svoboda <Jiri.Svoboda@seznam.cz>.
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* MPlayer 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* directfb includes */
#include <directfb.h>
@ -50,16 +49,9 @@ static const vo_info_t info = {
const LIBVO_EXTERN(dfbmga)
/******************************
* directfb *
******************************/
/*
* (Globals)
*/
static IDirectFB *dfb;
static IDirectFBDisplayLayer *primary;
static IDirectFBDisplayLayer *crtc1;
static IDirectFBDisplayLayer *bes;
static IDirectFBDisplayLayer *crtc2;
static IDirectFBDisplayLayer *spic;
@ -73,6 +65,7 @@ static IDirectFBSurface *frame;
static IDirectFBSurface *subframe;
static IDirectFBSurface *besframe;
static IDirectFBSurface *c1frame;
static IDirectFBSurface *c2frame;
static IDirectFBSurface *spicframe;
@ -80,6 +73,7 @@ static DFBSurfacePixelFormat frame_format;
static DFBSurfacePixelFormat subframe_format;
static DFBRectangle besrect;
static DFBRectangle c1rect;
static DFBRectangle c2rect;
static DFBRectangle *subrect;
@ -88,9 +82,11 @@ static IDirectFBInputDevice *remote;
static IDirectFBEventBuffer *buffer;
static int blit_done;
static int stretch;
static int c1stretch;
static int c2stretch;
static int use_bes;
static int use_crtc1;
static int use_crtc2;
static int use_spic;
static int use_input;
@ -107,10 +103,6 @@ static int osd_max;
static int is_g200;
/******************************
* vo_dfbmga *
******************************/
#if DIRECTFBVERSION < DFB_VERSION(0,9,18)
#define DSPF_ALUT44 DSPF_LUT8
#define DLBM_TRIPLE ~0
@ -137,22 +129,20 @@ pixelformat_name( DFBSurfacePixelFormat format )
return "ARGB";
case DSPF_RGB32:
return "RGB32";
case DSPF_RGB24:
return "RGB24";
case DSPF_RGB16:
return "RGB16";
return "RGB16";
case DSPF_ARGB1555:
return "ARGB1555";
return "ARGB1555";
case DSPF_YUY2:
return "YUY2";
return "YUY2";
case DSPF_UYVY:
return "UYVY";
return "UYVY";
case DSPF_YV12:
return "YV12";
return "YV12";
case DSPF_I420:
return "I420";
return "I420";
case DSPF_ALUT44:
return "ALUT44";
return "ALUT44";
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
return "NV12";
@ -160,7 +150,7 @@ pixelformat_name( DFBSurfacePixelFormat format )
return "NV21";
#endif
default:
return "Unknown pixel format";
return "Unknown pixel format";
}
}
@ -169,19 +159,17 @@ imgfmt_to_pixelformat( uint32_t format )
{
switch (format) {
case IMGFMT_BGR32:
return DSPF_RGB32;
case IMGFMT_BGR24:
return DSPF_RGB24;
return DSPF_RGB32;
case IMGFMT_BGR16:
return DSPF_RGB16;
return DSPF_RGB16;
case IMGFMT_BGR15:
return DSPF_ARGB1555;
return DSPF_ARGB1555;
case IMGFMT_YUY2:
return DSPF_YUY2;
return DSPF_YUY2;
case IMGFMT_UYVY:
return DSPF_UYVY;
return DSPF_UYVY;
case IMGFMT_YV12:
return DSPF_YV12;
return DSPF_YV12;
case IMGFMT_I420:
case IMGFMT_IYUV:
return DSPF_I420;
@ -192,7 +180,7 @@ imgfmt_to_pixelformat( uint32_t format )
return DSPF_NV21;
#endif
default:
return DSPF_UNKNOWN;
return DSPF_UNKNOWN;
}
}
@ -236,6 +224,7 @@ preinit( const char *arg )
/* Some defaults */
use_bes = 0;
use_crtc1 = 0;
use_crtc2 = 1;
use_spic = 1;
field_parity = -1;
@ -259,6 +248,10 @@ preinit( const char *arg )
use_bes = !opt_no;
vo_subdevice += 3;
opt_no = 0;
} else if (!strncmp(vo_subdevice, "crtc1", 5)) {
use_crtc1 = !opt_no;
vo_subdevice += 5;
opt_no = 0;
} else if (!strncmp(vo_subdevice, "crtc2", 5)) {
use_crtc2 = !opt_no;
vo_subdevice += 5;
@ -356,13 +349,14 @@ preinit( const char *arg )
show_help = 1;
break;
}
}
}
if (show_help) {
mp_msg( MSGT_VO, MSGL_ERR,
"\nvo_dfbmga command line help:\n"
"Example: mplayer -vo dfbmga:nocrtc2:bes:buffermode=single\n"
"\nOptions (use 'no' prefix to disable):\n"
" bes Use Backend Scaler\n"
" crtc1 Use CRTC1\n"
" crtc2 Use CRTC2\n"
" spic Use hardware sub-picture for OSD\n"
" input Use DirectFB for keyboard input\n"
@ -383,62 +377,66 @@ preinit( const char *arg )
return -1;
}
}
if (!use_bes && !use_crtc2) {
mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" );
if (!use_bes && !use_crtc1 && !use_crtc2) {
mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" );
return -1;
}
if (use_bes && use_crtc1) {
mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" );
return -1;
}
if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: DirectFBInit() failed - %s\n",
DirectFBErrorString( res ) );
return -1;
}
if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: DirectFBInit() failed - %s\n",
DirectFBErrorString( res ) );
return -1;
}
switch (tvnorm) {
case 0:
DirectFBSetOption( "matrox-tv-standard", "pal" );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" );
break;
case 1:
switch (tvnorm) {
case 0:
DirectFBSetOption( "matrox-tv-standard", "pal" );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" );
break;
case 1:
DirectFBSetOption( "matrox-tv-standard", "ntsc" );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" );
break;
case 2:
if (vo_fps > 27) {
DirectFBSetOption( "matrox-tv-standard", "ntsc" );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" );
break;
case 2:
if (vo_fps > 27) {
DirectFBSetOption( "matrox-tv-standard", "ntsc" );
mp_msg( MSGT_VO, MSGL_INFO,
"vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" );
} else {
DirectFBSetOption( "matrox-tv-standard", "pal" );
mp_msg( MSGT_VO, MSGL_INFO,
"vo_dfbmga: Selected TV standard based upon FPS: PAL\n" );
}
break;
mp_msg( MSGT_VO, MSGL_INFO,
"vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" );
} else {
DirectFBSetOption( "matrox-tv-standard", "pal" );
mp_msg( MSGT_VO, MSGL_INFO,
"vo_dfbmga: Selected TV standard based upon FPS: PAL\n" );
}
break;
}
if ((res = DirectFBCreate( &dfb )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: DirectFBCreate() failed - %s\n",
DirectFBErrorString( res ) );
return -1;
}
if ((res = DirectFBCreate( &dfb )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: DirectFBCreate() failed - %s\n",
DirectFBErrorString( res ) );
return -1;
}
if (use_bes) {
if (use_crtc1 || use_bes) {
struct layer_enum l = {
"FBDev Primary Layer",
&primary,
&crtc1,
DFB_UNSUPPORTED
};
dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
if (l.res != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get primary layer - %s\n",
mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get CRTC1 layer - %s\n",
DirectFBErrorString( l.res ) );
uninit();
return -1;
}
if ((res = primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to primary layer - %s\n",
if ((res = crtc1->SetCooperativeLevel( crtc1, DLSCL_EXCLUSIVE )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC1 layer - %s\n",
DirectFBErrorString( res ) );
uninit();
return -1;
@ -547,7 +545,7 @@ preinit( const char *arg )
return -1;
}
}
return 0;
}
@ -559,6 +557,8 @@ static void release_config( void )
spic->Release( spic );
if (c2frame)
c2frame->Release( c2frame );
if (c1frame)
c1frame->Release( c1frame );
if (besframe)
besframe->Release( besframe );
if (bufs[0])
@ -567,10 +567,11 @@ static void release_config( void )
bufs[1]->Release( bufs[1] );
if (bufs[2])
bufs[2]->Release( bufs[2] );
spicframe = NULL;
spic = NULL;
c2frame = NULL;
c1frame = NULL;
besframe = NULL;
bufs[0] = NULL;
bufs[1] = NULL;
@ -582,7 +583,7 @@ config( uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
uint32_t flags,
char *title,
uint32_t format )
uint32_t format )
{
DFBResult res;
@ -654,11 +655,7 @@ config( uint32_t width, uint32_t height,
dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
dlc.width = besrect.w + besrect.x * 2;
dlc.height = besrect.h + besrect.y * 2;
if (use_crtc2)
dlc.buffermode = DLBM_FRONTONLY;
else
dlc.buffermode = buffermode;
dlc.buffermode = buffermode;
if ((res = bes->TestConfiguration( bes, &dlc, &failed )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
@ -689,6 +686,63 @@ config( uint32_t width, uint32_t height,
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: BES surface %dx%d %s\n", dlc.width, dlc.height, pixelformat_name( dlc.pixelformat ) );
}
/*
* CRTC1
*/
if (use_crtc1) {
dlc.flags = DLCONF_BUFFERMODE;
dlc.buffermode = buffermode;
if ((res = crtc1->TestConfiguration( crtc1, &dlc, &failed )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: Invalid CRTC1 configuration - %s!\n",
DirectFBErrorString( res ) );
return -1;
}
if ((res = crtc1->SetConfiguration( crtc1, &dlc )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: CRTC1 configuration failed - %s!\n",
DirectFBErrorString( res ) );
return -1;
}
if ((res = crtc1->GetConfiguration( crtc1, &dlc )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
"vo_dfbmga: Getting CRTC1 configuration failed - %s!\n",
DirectFBErrorString( res ) );
return -1;
}
crtc1->GetSurface( crtc1, &c1frame );
c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX );
c1frame->SetColor( c1frame, 0, 0, 0, 0xff );
c1frame->GetSize( c1frame, &screen_width, &screen_height );
aspect_save_screenres( screen_width, screen_height );
aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM );
if (in_width != out_width || in_height != out_height)
c1stretch = 1;
else
c1stretch = 0;
c1rect.x = (screen_width - out_width) / 2;
c1rect.y = (screen_height - out_height) / 2;
c1rect.w = out_width;
c1rect.h = out_height;
c1frame->Clear( c1frame, 0, 0, 0, 0xff );
c1frame->Flip( c1frame, NULL, 0 );
c1frame->Clear( c1frame, 0, 0, 0, 0xff );
c1frame->Flip( c1frame, NULL, 0 );
c1frame->Clear( c1frame, 0, 0, 0, 0xff );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 using %s buffering\n",
dlc.buffermode == DLBM_TRIPLE ? "triple" :
dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 surface %dx%d %s\n", screen_width, screen_height, pixelformat_name( dlc.pixelformat ) );
}
/*
* CRTC2
*/
@ -773,9 +827,9 @@ config( uint32_t width, uint32_t height,
if (in_width != out_width ||
in_height != out_height)
stretch = 1;
c2stretch = 1;
else
stretch = 0;
c2stretch = 0;
c2rect.x = (screen_width - out_width) / 2;
c2rect.y = (screen_height - out_height) / 2;
@ -870,6 +924,10 @@ config( uint32_t width, uint32_t height,
/* Draw OSD to CRTC2 surface */
subframe = c2frame;
subrect = &c2rect;
} else if (use_crtc1) {
/* Draw OSD to CRTC1 surface */
subframe = c1frame;
subrect = &c1rect;
} else {
/* Draw OSD to BES surface */
subframe = besframe;
@ -881,7 +939,8 @@ config( uint32_t width, uint32_t height,
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Sub-picture surface %dx%d %s (%s)\n",
sub_width, sub_height,
pixelformat_name( subframe_format ),
use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") : "BES" );
use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") :
use_crtc1 ? "CRTC1" : "BES" );
osd_dirty = 0;
osd_current = 1;
@ -894,27 +953,33 @@ static int
query_format( uint32_t format )
{
switch (format) {
case IMGFMT_BGR32:
case IMGFMT_BGR24:
case IMGFMT_BGR16:
case IMGFMT_BGR15:
case IMGFMT_UYVY:
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
if (is_g200)
return 0;
case IMGFMT_YUY2:
break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case IMGFMT_NV12:
case IMGFMT_NV21:
if (!use_bes || use_crtc2)
return 0;
break;
#endif
default:
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
if (is_g200 || use_crtc1)
return 0;
break;
case IMGFMT_BGR32:
case IMGFMT_BGR16:
case IMGFMT_BGR15:
if (is_g200 && use_bes)
return 0;
break;
case IMGFMT_UYVY:
if (is_g200)
return 0;
break;
case IMGFMT_YUY2:
break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case IMGFMT_NV12:
case IMGFMT_NV21:
if (use_crtc1 || use_crtc2)
return 0;
break;
#endif
default:
return 0;
}
return VFCAP_HWSCALE_UP |
@ -926,11 +991,11 @@ query_format( uint32_t format )
static void
vo_draw_alpha_alut44( int w, int h,
unsigned char* src,
unsigned char *srca,
int srcstride,
unsigned char* dst,
int dststride )
unsigned char* src,
unsigned char *srca,
int srcstride,
unsigned char* dst,
int dststride )
{
int x;
@ -957,10 +1022,11 @@ static void
draw_alpha( int x0, int y0,
int w, int h,
unsigned char *src,
unsigned char *srca,
unsigned char *srca,
int stride )
{
void *dst;
uint8_t *dst;
void *ptr;
int pitch;
if (use_spic) {
@ -975,56 +1041,52 @@ draw_alpha( int x0, int y0,
osd_dirty |= osd_current;
}
if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &dst, &pitch ) != DFB_OK)
if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
return;
dst = ptr;
switch (subframe_format) {
case DSPF_ALUT44:
vo_draw_alpha_alut44( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + x0,
pitch );
dst + pitch * y0 + x0,
pitch );
break;
case DSPF_RGB32:
case DSPF_ARGB:
vo_draw_alpha_rgb32( w, h, src, srca, stride,
(( uint8_t *) dst) + pitch * y0 + 4 * x0,
vo_draw_alpha_rgb32( w, h, src, srca, stride,
dst + pitch * y0 + 4 * x0,
pitch );
break;
case DSPF_RGB24:
vo_draw_alpha_rgb24( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 3 * x0,
pitch );
break;
break;
case DSPF_RGB16:
vo_draw_alpha_rgb16( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0,
vo_draw_alpha_rgb16( w, h, src, srca, stride,
dst + pitch * y0 + 2 * x0,
pitch );
break;
break;
case DSPF_ARGB1555:
vo_draw_alpha_rgb15( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0,
vo_draw_alpha_rgb15( w, h, src, srca, stride,
dst + pitch * y0 + 2 * x0,
pitch );
break;
break;
case DSPF_YUY2:
vo_draw_alpha_yuy2( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0,
vo_draw_alpha_yuy2( w, h, src, srca, stride,
dst + pitch * y0 + 2 * x0,
pitch );
break;
break;
case DSPF_UYVY:
vo_draw_alpha_yuy2( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
vo_draw_alpha_yuy2( w, h, src, srca, stride,
dst + pitch * y0 + 2 * x0 + 1,
pitch );
break;
break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
case DSPF_NV21:
#endif
case DSPF_I420:
case DSPF_YV12:
vo_draw_alpha_yv12( w, h, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + x0,
vo_draw_alpha_yv12( w, h, src, srca, stride,
dst + pitch * y0 + x0,
pitch );
break;
break;
}
subframe->Unlock( subframe );
@ -1039,11 +1101,13 @@ draw_frame( uint8_t * src[] )
static int
draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
{
void *dst;
uint8_t *dst;
void *ptr;
int pitch;
if (frame->Lock( frame, DSLF_WRITE, &dst, &pitch ) != DFB_OK)
if (frame->Lock( frame, DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
return VO_FALSE;
dst = ptr;
memcpy_pic( dst + pitch * y + x, src[0],
w, h, pitch, stride[0] );
@ -1060,25 +1124,25 @@ draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
} else
#endif
{
x /= 2;
w /= 2;
pitch /= 2;
x /= 2;
w /= 2;
pitch /= 2;
if (frame_format == DSPF_I420 )
memcpy_pic( dst + pitch * y + x, src[1],
w, h, pitch, stride[1] );
else
memcpy_pic( dst + pitch * y + x, src[2],
w, h, pitch, stride[2] );
if (frame_format == DSPF_I420 )
memcpy_pic( dst + pitch * y + x, src[1],
w, h, pitch, stride[1] );
else
memcpy_pic( dst + pitch * y + x, src[2],
w, h, pitch, stride[2] );
dst += pitch * buf_height / 2;
dst += pitch * buf_height / 2;
if (frame_format == DSPF_I420 )
memcpy_pic( dst + pitch * y + x, src[2],
w, h, pitch, stride[2] );
else
memcpy_pic( dst + pitch * y + x, src[1],
w, h, pitch, stride[1] );
if (frame_format == DSPF_I420 )
memcpy_pic( dst + pitch * y + x, src[2],
w, h, pitch, stride[2] );
else
memcpy_pic( dst + pitch * y + x, src[1],
w, h, pitch, stride[1] );
}
frame->Unlock( frame );
@ -1094,7 +1158,7 @@ blit_to_screen( void )
if (use_bes) {
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping && !use_crtc2)
if (vo_vsync && !flipping)
bes->WaitForSync( bes );
#endif
@ -1103,15 +1167,27 @@ blit_to_screen( void )
srect = &besrect;
}
if (use_crtc1) {
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping)
crtc1->WaitForSync( crtc1 );
#endif
if (c1stretch)
c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect );
else
c1frame->Blit( c1frame, blitsrc, srect, c1rect.x, c1rect.y );
}
if (use_crtc2) {
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping)
crtc2->WaitForSync( crtc2 );
#endif
if (stretch)
if (c2stretch)
c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect );
else
else
c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y );
}
}
@ -1145,8 +1221,8 @@ draw_osd( void )
osd_dirty &= ~osd_current;
}
blit_to_screen();
blit_done = 1;
blit_to_screen();
blit_done = 1;
vo_remove_text( sub_width, sub_height, clear_alpha );
vo_draw_text( sub_width, sub_height, draw_alpha );
@ -1162,13 +1238,15 @@ draw_osd( void )
static void
flip_page( void )
{
if (!blit_done)
blit_to_screen();
if (!blit_done)
blit_to_screen();
if (flipping) {
if (use_crtc2)
c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
else
if (use_crtc1)
c1frame->Flip( c1frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
if (use_bes)
besframe->Flip( besframe, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
if (!use_spic) {
@ -1197,8 +1275,8 @@ uninit( void )
crtc2->Release( crtc2 );
if (bes)
bes->Release( bes );
if (primary)
primary->Release( primary );
if (crtc1)
crtc1->Release( crtc1 );
if (dfb)
dfb->Release( dfb );
@ -1207,7 +1285,7 @@ uninit( void )
keyboard = NULL;
crtc2 = NULL;
bes = NULL;
primary = NULL;
crtc1 = NULL;
dfb = NULL;
}
@ -1215,7 +1293,8 @@ static uint32_t
get_image( mp_image_t *mpi )
{
int buf = current_buf;
void *dst;
uint8_t *dst;
void *ptr;
int pitch;
if (mpi->flags & MP_IMGFLAG_READABLE &&
@ -1238,8 +1317,9 @@ get_image( mp_image_t *mpi )
/* Always use DSLF_READ to preserve system memory copy */
if (frame->Lock( frame, DSLF_WRITE | DSLF_READ,
&dst, &pitch ) != DFB_OK)
&ptr, &pitch ) != DFB_OK)
return VO_FALSE;
dst = ptr;
if ((mpi->width == pitch) ||
(mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))) {
@ -1250,17 +1330,17 @@ get_image( mp_image_t *mpi )
if (mpi->flags & MP_IMGFLAG_PLANAR) {
if (mpi->num_planes > 2) {
mpi->stride[1] = mpi->stride[2] = pitch / 2;
mpi->stride[1] = mpi->stride[2] = pitch / 2;
if (mpi->flags & MP_IMGFLAG_SWAPPED) {
/* I420 */
mpi->planes[1] = dst + buf_height * pitch;
mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
} else {
/* YV12 */
mpi->planes[2] = dst + buf_height * pitch;
mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
}
if (mpi->flags & MP_IMGFLAG_SWAPPED) {
/* I420 */
mpi->planes[1] = dst + buf_height * pitch;
mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
} else {
/* YV12 */
mpi->planes[2] = dst + buf_height * pitch;
mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
}
} else {
/* NV12/NV21 */
mpi->stride[1] = pitch;
@ -1339,6 +1419,8 @@ set_equalizer( char *data, int value )
/* Prefer CRTC2 over BES */
if (use_crtc2)
res = crtc2->SetColorAdjustment( crtc2, &ca );
else if (use_crtc1)
res = crtc1->SetColorAdjustment( crtc1, &ca );
else
res = bes->SetColorAdjustment( bes, &ca );
@ -1358,12 +1440,14 @@ get_equalizer( char *data, int *value )
/* Prefer CRTC2 over BES */
if (use_crtc2)
res = crtc2->GetColorAdjustment( crtc2, &ca );
else if (use_crtc1)
res = crtc1->GetColorAdjustment( crtc1, &ca );
else
res = bes->GetColorAdjustment( bes, &ca );
if (res != DFB_OK)
return VO_FALSE;
if (!strcasecmp( data, "brightness" ) &&
(ca.flags & DCAF_BRIGHTNESS))
*value = (ca.brightness - 0x8000) * factor;
@ -1389,7 +1473,7 @@ control( uint32_t request, void *data)
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format( *((uint32_t *) data) );
return query_format( *((uint32_t *) data) );
case VOCTRL_GET_IMAGE:
return get_image( data );
@ -1490,7 +1574,7 @@ check_events( void )
mplayer_put_key( KEY_PREV );
break;
case DIKS_VOLUME_UP:
mplayer_put_key( KEY_VOLUME_UP );
mplayer_put_key( KEY_VOLUME_UP );
break;
case DIKS_VOLUME_DOWN:
mplayer_put_key( KEY_VOLUME_DOWN );

View File

@ -1,25 +1,26 @@
/*
MPlayer video driver for DirectFramebuffer device
(C) 2002
Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
*/
* MPlayer video driver for DirectFramebuffer device
*
* copyright (C) 2002 Jiri Svoboda <Jiri.Svoboda@seznam.cz>
*
* based on vo_directfb2.c
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* MPlayer 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// directfb includes

View File

@ -1,26 +1,25 @@
/*
MPlayer video driver for animated gif output
(C) 2002
Written by Joey Parrish <joey@nicewarrior.org>
Based on vo_directfb2.c
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
*/
* MPlayer video driver for animated GIF output
*
* copyright (C) 2002 Joey Parrish <joey@nicewarrior.org>
* based on vo_directfb2.c
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* MPlayer 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Notes:
* when setting output framerate, frames will be ignored as needed

View File

@ -9,16 +9,16 @@
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 2.1 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

View File

@ -111,14 +111,11 @@ void vo_x11_ewmh_fullscreen(struct vo_x11_state *x11, int action)
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.message_type = XInternAtom(x11->display,
"_NET_WM_STATE", False);
xev.xclient.message_type = x11->XA_NET_WM_STATE;
xev.xclient.window = x11->window;
xev.xclient.format = 32;
xev.xclient.data.l[0] = action;
xev.xclient.data.l[1] = XInternAtom(x11->display,
"_NET_WM_STATE_FULLSCREEN",
False);
xev.xclient.data.l[1] = x11->XA_NET_WM_STATE_FULLSCREEN;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
@ -301,20 +298,6 @@ static int vo_wm_detect(struct vo *vo)
for (i = 0; i < nitems; i++)
wm |= net_wm_support_state_test(vo->x11, args[i]);
XFree(args);
#if 0
// ugly hack for broken OpenBox _NET_WM_STATE_FULLSCREEN support
// (in their implementation it only changes internal window state, nothing more!!!)
if (wm & vo_wm_FULLSCREEN)
{
if (x11_get_property(x11, x11->XA_BLACKBOX_PID, &args, &nitems))
{
mp_msg(MSGT_VO, MSGL_V,
"[x11] Detected wm is a broken OpenBox.\n");
wm ^= vo_wm_FULLSCREEN;
}
XFree(args);
}
#endif
}
if (wm == 0)
@ -335,7 +318,6 @@ static void init_atoms(struct vo_x11_state *x11)
XA_INIT(_WIN_PROTOCOLS);
XA_INIT(_WIN_LAYER);
XA_INIT(_WIN_HINTS);
XA_INIT(_BLACKBOX_PID);
XA_INIT(WM_PROTOCOLS);
XA_INIT(WM_DELETE_WINDOW);
}

View File

@ -54,7 +54,6 @@ struct vo_x11_state {
Atom XA_WIN_PROTOCOLS;
Atom XA_WIN_LAYER;
Atom XA_WIN_HINTS;
Atom XA_BLACKBOX_PID;
Atom XAWM_PROTOCOLS;
Atom XAWM_DELETE_WINDOW;
};

View File

@ -873,7 +873,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
mp_msg(MSGT_IDENTIFY, MSGL_V, "%02X", discid[i]);
mp_msg(MSGT_IDENTIFY, MSGL_V, "\n");
}
if (DVDUDFVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0)
if (DVDUDFVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0 || DVDISOVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0)
mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_DVD_VOLUME_ID=%s\n", volid);
}
/**