diff options
78 files changed, 2008 insertions, 3480 deletions
@@ -808,7 +808,7 @@ Ulion <ulion2002 gmail.com> Urpala, Uoti (uau) <uoti.urpala@pp1.inet.fi> * A/V sync fixes -Vajna, Miklós (VMiklos) <mamajom@axelero.hu> +Vajna, Miklós (VMiklos) <vmiklos@frugalware.org> * TOOLS/divx2svcd author * TOOLS/ directory documentation @@ -37,6 +37,7 @@ MPlayer (1.0) * Brooktree YUV 4:1:1 Raw (Y41P) via binary DLL * many rare/obscure fourccs for known formats added * lower priority for binary Linux rv3040 codecs due to bugs + * remove native NuppelVideo decoder, use lavc instead Demuxers: * -lavfdopts cryptokey allows decrypting MXF and ASF files @@ -55,6 +56,7 @@ MPlayer (1.0) * support seeking in multirate RealMedia files * FLAC speedup in lavf demuxer * MNG demuxer + * remove native NuppelVideo demuxer, use lavf demuxer instead Filters: * vf_ow new overcomplete wavelet denoiser @@ -146,6 +148,7 @@ MPlayer (1.0) * removed unnecessary code from vo x11, xv, xvmc * add OS/2 DART audio driver (-ao dart) * add VDPAU video output + * add OS/2 KVA video driver (-vo kva) MEncoder: * check for system-wide configuration file in MEncoder @@ -166,6 +169,8 @@ MPlayer (1.0) * libdvdcss updated to 1.2.10, now same as upstream version * fix -endchapter support again for -dump* options * add startup volume option + * add option to disable default key binds + * change default OSD and subtitle font size to a smaller default libass: * various fixes and updates to match VSFilter renderer @@ -9,22 +9,24 @@ from several external sources: Name: FFmpeg Version: Subversion HEAD -Homepage: http://www.ffmpeg.org +URL: http://www.ffmpeg.org Directory: libavcodec, libavformat, libavutil, libpostproc Copyright: Many, see individual files for copyright notices. License: GNU Lesser General Public License, some parts GNU General Public License, GNU General Public License when combined + Name: FAAD2 Version: 2.1 beta (20040915 CVS snapshot) + fixes and portability patches -Homepage: http://www.audiocoding.com +URL: http://www.audiocoding.com Directory: libfaad2 Copyright: 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com License: GNU General Public License + Name: GSM 06.10 library Version: patchlevel 10 -Homepage: http://kbs.cs.tu-berlin.de/~jutta/toast.html +URL: http://kbs.cs.tu-berlin.de/~jutta/toast.html Directory: libmpcodecs/native/ Copyright: 1992 by Jutta Degener and Carsten Bormann, TU Berlin License: permissive, see libmpcodecs/native/xa_gsm.c @@ -32,7 +34,7 @@ License: permissive, see libmpcodecs/native/xa_gsm.c Name: liba52 Version: 0.7.4 + patches -Homepage: http://liba52.sourceforge.net/ +URL: http://liba52.sourceforge.net/ Directory: liba52 Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 2000-2001 Michel Lespinasse <walken@zoy.org> @@ -41,28 +43,41 @@ Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 2004 Romain Dolbeau <romain@dolbeau.org> License: GNU General Public License + Name: libdvdcss Version: 1.2.10 -Homepage: http://developers.videolan.org/libdvdcss/ +URL: http://developers.videolan.org/libdvdcss/ Directory: libdvdcss Copyright: 1998-2008 VideoLAN License: GNU General Public License + Name: libdvdread -Version: 0.9.7 + patches -Homepage: http://www.dtek.chalmers.se/groups/dvd/development.shtml -Directory: libdvdread +Version: Subversion HEAD +URL: svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread/src +Directory: libdvdread4 Copyright: 1998, 1999 Eric Smith <eric@brouhaha.com> 1999 Christian Wolff for convergence integrated media - 2000-2001 Billy Biggs <vektor@dumbterm.net>, + 2000-2004 Billy Biggs <vektor@dumbterm.net>, 2001-2002 Samuel Hocevar <sam@zoy.org>, - 2000-2003 Björn Englund <d4bjorn@dtek.chalmers.se>, - 2000-2003 Håkan Hjort <d95hjort@dtek.chalmers.se> + 2000-2004 Björn Englund <d4bjorn@dtek.chalmers.se>, + 2000-2004 Håkan Hjort <d95hjort@dtek.chalmers.se> License: GNU General Public License + +Name: libdvdnav +Version: Subversion HEAD from +URL: svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdnav/src +Directory: libdvdnav +Copyright: 2000, 2001 Martin Norbäck, Håkan Hjort + 2000-2004 Rich Wareham <richwareham@users.sourceforge.net> + 2001-2004 the dvdnav project +License: GNU General Public License + + Name: libmpeg2 Version: 0.5.1 + patches -Homepage: http://libmpeg2.sourceforge.net/ +URL: http://libmpeg2.sourceforge.net/ Directory: libmpeg2 Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 2000-2004 Michel Lespinasse <walken@zoy.org> @@ -72,25 +87,28 @@ Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 2003 Peter Gubanov <peter@elecard.net.ru> License: GNU General Public License + Name: mpg123 Version: 0.59s + significant changes -Homepage: http://www.mpg123.de/ +URL: http://www.mpg123.de/ Directory: mp3lib Copyright: 1995-1999 by Michael Hipp 2004 Romain Dolbeau <romain@dolbeau.org> 2006 Zuxy Meng <zuxy.meng@gmail.com License: GNU General Public License + Name: Tremor Version: 1.0 + parts CVS from December 2004 + patches -Homepage: http://xiph.org/ +URL: http://xiph.org/ Directory: tremor Copyright: 1994-2002, Xiph.org Foundation http://www.xiph.org/ License: BSD-like, see tremor/COPYING + Name: avifile DLL loader Version: 0.47 + patches + CVS updates -Homepage: http://avifile.sourceforge.net/ +URL: http://avifile.sourceforge.net/ Directory: loader/ Copyright: 1993 Robert J. Amstadt 1994 Eric Youndale & Erik Bos @@ -101,68 +119,77 @@ Copyright: 1993 Robert J. Amstadt 2000-2001 Eugene Kuznetsov (divx@euro.ru) License: GNU General Public License + Name: dvbstream Version: 0.4.3-pre3 (CVS checkout) -Homepage: http://sourceforge.net/projects/dvbtools/ +URL: http://sourceforge.net/projects/dvbtools/ Directory: stream/dvbin.h stream/rtp.[ch] stream/stream_dvb.c Copyright: 2001-2002 Dave Chapman <dave@dchapman.com> License: GNU General Public License + Name: librtsp Version: xine CVS 2003/04/10 + patches -Homepage: http://www.xinehq.de +URL: http://www.xinehq.de Directory: stream/librtsp/ Copyright: 2000-2002 the xine project License: GNU General Public License + Name: realrtsp Version: xine CVS 2003/04/17 + patches -Homepage: http://www.xinehq.de +URL: http://www.xinehq.de Directory: stream/realrtsp/ Copyright: 2002 the xine project License: GNU General Public License + Name: pnm protocol implementation Version: xine CVS 2002/12/26 + patches -Homepage: http://www.xinehq.de +URL: http://www.xinehq.de Directory: stream/pnm.[ch] Copyright: 2000-2002 the xine project License: GNU General Public License + Name: id3edit Version: 1.9 + patches -Homepage: http://id3edit.sourceforge.net/ +URL: http://id3edit.sourceforge.net/ Directory: libmpdemux/genres.h Copyright: 2001 Jason Carter License: GNU General Public License + Name: FreeSDP Version: 0.4.1 -Homepage: https://savannah.nongnu.org/projects/freesdp/ +URL: https://savannah.nongnu.org/projects/freesdp/ Directory: stream/freesdp/ Copyright: 2001-2003 Federico Montesino Pouzols <fedemp@suidzer0.org> License: GNU General Public License + Name: MJPEG Tools Version: post 2001-12-03 release or CVS snapshot -Homepage: http://mjpeg.sourceforge.net/ +URL: http://mjpeg.sourceforge.net/ Directory: libmpdemux/yuv4mpeg* Copyright: 2001 Matthew J. Marjanovic <maddog@mir.com> 2001 Andrew Stevens <andrew.stevens@philips.com> License: GNU General Public License + Name: NuppelVideo / RTJPEG Version: 0.52a + patches -Homepage: http://web.archive.org/web/20060219034716/http://frost.htu.tuwien.ac.at/~roman/nuppelvideo/ -Directory: libmpcodecs/native/rtjpegn.[ch] libmpdemux/nuppelvideo.h +URL: http://web.archive.org/web/20060219034716/http://frost.htu.tuwien.ac.at/~roman/nuppelvideo/ +Directory: libmpcodecs/native/rtjpegn.[ch] Copyright: 1998 Justin Schoeman (justin@suntiger.ee.up.ac.za) 1998, 1999 Joerg Walter <trouble@moes.pmnet.uni-oldenburg.de> 1999 Wim Taymans <wim.taymans@tvd.be> License: GNU General Public License + Name: ReactOS Version: r25937 -Homepage: http://www.reactos.org/ +URL: http://www.reactos.org/ Directory: vidix/dhahelperwin/ntverp.h vidix/dhahelperwin/common.ver Copyright: Alex Ionescu (alex.ionescu@reactos.org) License: GNU General Public License diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 3f250fced5..3b6c1873d8 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -960,6 +960,8 @@ Device to be used for Apple IR Remote (default is autodetected, Linux only). Delay in milliseconds before we start to autorepeat a key (0 to disable). .IPs ar-rate Number of key presses to generate per second on autorepeat. +.IPs (no)default-binds +Use the key bindings that MPlayer ships with by default. .IPs keylist Prints all keys that can be bound to commands. .IPs cmdlist @@ -1131,6 +1133,8 @@ by a newline (\\n) from stdin. .I NOTE: See \-input cmdlist for a list of slave commands and DOCS/tech/slave.txt for their description. +Also, this is not intended to disable other inputs, e.g. via the video window, +use some other method like \-input nodefault\-binds:conf=/dev/null for that. . .TP .B \-softsleep @@ -2249,14 +2253,14 @@ Use this if commas in subtitles are shown at the start of a sentence instead of at the end. . .TP -.B \-font <path to font.desc file> +.B \-font <path to font.desc file, path to font (FreeType), font pattern (Fontconfig)> Search for the OSD/\:SUB fonts in an alternative directory (default for normal fonts: ~/\:.mplayer/\:font/\:font.desc, default for FreeType fonts: ~/.mplayer/\:subfont.ttf). .br .I NOTE: With FreeType, this option determines the path to the text font file. -With fontconfig, this option determines the fontconfig font name. +With Fontconfig, this option determines the Fontconfig font pattern. .sp 1 .I EXAMPLE: .PD 0 @@ -2266,6 +2270,8 @@ With fontconfig, this option determines the fontconfig font name. \-font ~/\:.mplayer/\:arialuni.ttf .br \-font 'Bitstream Vera Sans' +.br +\-font 'Bitstream Vera Sans:style=Bold' .RE .PD 1 . @@ -2504,8 +2510,8 @@ Currently useless. Same as \-audiofile, but for subtitle streams (OggDS?). . .TP -.B \-subfont <filename> (FreeType only) -Sets the subtitle font. +.B \-subfont <path to font (FreeType), font pattern (Fontconfig)> (FreeType only) +Sets the subtitle font (see \-font). If no \-subfont is given, \-font is used. . .TP @@ -3449,6 +3455,9 @@ Apply a noise reduction algorithm to the video (default: 0, no noise reduction). .IPs deint=<0\-4> Chooses the deinterlacer (default: 0). All modes > 0 respect \-field\-dominance. +.br +.I NOTE: +Values > 2 delay the video output by one frame. .RSss .IPs 0 No deinterlacing. @@ -3587,6 +3596,23 @@ Try this option if you have display problems. .PD 1 . .TP +.B kva (OS/2 only) +Video output driver that uses the libkva interface. +.PD 0 +.RSs +.IPs snap +Force SNAP mode. +.IPs wo +Force WarpOverlay! mode. +.IPs dive +Force DIVE mode. +.IPs (no)t23 +Enable/disable workaround for T23 laptop (default: \-not23). +Try to enable this option if your video card supports upscaling only. +.RE +.PD 1 +. +.TP .B quartz (Mac OS X only) Mac OS X Quartz video output driver. Under some circumstances, it might be more efficient to force a diff --git a/DOCS/man/fr/mplayer.1 b/DOCS/man/fr/mplayer.1 index d042125311..13f233964f 100644 --- a/DOCS/man/fr/mplayer.1 +++ b/DOCS/man/fr/mplayer.1 @@ -1,4 +1,4 @@ -.\" synced with r28807 +.\" synced with r28950 .\" Encoding: iso-8859-1 .\" MPlayer (C) 2000-2009 MPlayer Team .\" The English man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann @@ -1009,6 +1009,8 @@ d'une touche (0 pour dsactiver). .IPs ar-rate Combien de frappes par seconde pendant la rptition automatique. +.IPs (no)default-binds +Rpond aux touches de contrle par dfaut de MPlayer. .IPs keylist Affiche toutes les touches pouvant tre attaches. .IPs cmdlist @@ -1193,6 +1195,9 @@ commandes spares par un retour chariot (\\n) via l'entre stdin. .I NOTE\ : Voir \-input cmdlist pour une liste des commandes esclaves, et DOCS/tech/slave.txt pour leur description. +De plus, cette option n'est pas voue dsactiver les autres entres, +comme via la fentre vido\ ; pour cela, utilisez d'autres mthodes, comme +\-input nodefault\-binds:conf=/dev/null. . .TP .B \-softsleep @@ -2354,14 +2359,14 @@ les sous-titres. phrases au lieu de la fin. . .TP -.B \-font <chemin vers le fichier font.desc> +.B \-font <chemin vers le fichier font.desc, la police (FreeType), motif de police (Fontconfig)> Recherche les polices OSD/\:SUB dans un rpertoire particulier (par dfaut pour les polices normales: ~/\:.mplayer/\:font/\:font.desc, pour les polices FreeType: ~/.mplayer/\:subfont.ttf). .br .I NOTE: Avec FreeType, cette option dtermine le chemin vers le fichier de polices. -Avec Fontconfig, cette option dtermine le nom de police fontconfig. +Avec Fontconfig, cette option dtermine le motif de police Fontconfig. .sp 1 .I EXEMPLE: .PD 0 @@ -2370,7 +2375,9 @@ Avec Fontconfig, cette option dtermine le nom de police fontconfig. .br \-font ~/\:.mplayer/\:arialuni.ttf .br -\-font 'Bitstream Vera Sans' +\-font 'Bitstream Vera Sans:style' +.br +\-font 'Bitstream Vera Sans:style=Bold' .RE .PD 1 . @@ -2615,8 +2622,8 @@ Inutile actuellement. Identique \-audiofile, mais pour les flux de sous-titres (OggDS ?). . .TP -.B \-subfont <filename> (FreeType uniquement) -Spcifie la police des sous-titres. +.B \-subfont <chemin vers la police (FreeType), motif de police (Fontconfig)> (FreeType uniquement) +Spcifie la police des sous-titres (voir \-font). Si \-subfont n'est pas spcifi, \-font est utilis. . .TP @@ -3640,6 +3647,9 @@ rduction de bruit) .IPs deint=<0\-4> Slectionne un dsentrelaceur (par dfaut\ : 0) Tous les modes > 0 respectent \-field\-dominance. +.br +.I NOTE\ : +Les valeurs > 2 retardent la sortie vido d'une image. .RSss .IPs 0 pas de dsentrelacement @@ -3768,6 +3778,24 @@ Essayez cette option si vous avez des problmes d'affichage. .PD 1 . .TP +.B kva (OS/2 uniquement) +Pilote de sortie vido utilisant l'interface libkva. +.PD 0 +.RSs +.IPs snap +Force le mode SNAP. +.IPs wo +Force le mode WarpOverlay!. +.IPs dive +Force le mode DIVE. +.IPs (no)t23 +Active le contournement pour les bugs de l'ordinateur portable T23. +Essayez d'activer cette option si votre carte vido ne gre que +l'agrandissement d'image (upscaling). +.RE +.PD 1 +. +.TP .B quartz (Mac OS X uniquement) Pilote de sortie vido Quartz pour Mac OS X. Dans certains cas, il est prfrable de forcer le format de sortie packed YUV, diff --git a/DOCS/man/hu/mplayer.1 b/DOCS/man/hu/mplayer.1 index f0185ad174..415a7141b3 100644 --- a/DOCS/man/hu/mplayer.1 +++ b/DOCS/man/hu/mplayer.1 @@ -1,4 +1,4 @@ -.\" Synced with r28807 +.\" Synced with r28895 .\" MPlayer (C) 2000-2009 MPlayer Team .\" Ezt a man oldalt Gabucino, Diego Biurrun s Jonas Jermann kszti/ksztette .\" Karbantart: Gabrov @@ -33,7 +33,7 @@ .\" Nv .\" -------------------------------------------------------------------------- . -.TH MPlayer 1 "2009. 03. 05." "MPlayer Project" "A film lejtsz" +.TH MPlayer 1 "2009. 03. 09." "MPlayer Project" "A film lejtsz" . .SH NV mplayer \- film lejtsz @@ -958,6 +958,8 @@ Az Apple IR tvirnythoz hasznlt eszkz (alaprtelmezetten automatikus detekt Egy gomb automatikus ismtlse eltti ksleltets miliszekundumban (0: kikapcsols). .IPs ar-rate Billenty/msodperc rtk megadsa autorepeat hasznlata esetn. +.IPs (no)default-binds +Az alaprtelmezetten MPlayerbe ptett billenty-hozzrendelseket hasznlja. .IPs keylist Az sszes hasznlhat billenty listjnak kirsa. .IPs cmdlist @@ -1134,6 +1136,8 @@ parancsokat olvas az stdin-rl. .I MEGJEGYZS: A \-input cmdlist kapcsol kilistzza a szolga mdban hasznlhat parancsokat, a DOCS/tech/slave.txt fjlban megtallod a lersukat. +Ez nem a tbbi, pl. a vide ablakon keresztl rkez input letiltsra kszlt, +arra hasznlj mst, mint a \-input nodefault\-binds:conf=/dev/null. . .TP .B \-softsleep @@ -2258,14 +2262,14 @@ Akkor hasznld, ha a feliratban lv vesszk a mondat elejn ltszdnak s nem a vgn. . .TP -.B \-font <tvonal a font.desc fjlhoz> +.B \-font <tvonal a font.desc fjlhoz, tvonal a bettpushoz (FreeType), bettpus minta (Fontconfig)> Az OSD/\:SUB bettipusok megadott knyvtrban trtn keresse (norml fontoknl alaprtelmezett: ~/\:.mplayer/\:font/\:font.desc, FreeType fontokhoz: ~/.mplayer/\:subfont.ttf). .br .I MEGJEGYZS: FreeType-pal ez az opci a szveges bettpus fjlok elrsi tjt hatrozza meg. -A fontconfig-gal ez az opci a fontconfig bettpus nevt hatrozza meg. +A fontconfig-gal ez az opci a Fontconfig bettpus mintjt hatrozza meg. .sp 1 .I PLDA: .PD 0 @@ -2275,6 +2279,8 @@ A fontconfig-gal ez az opci a fontconfig bettpus nevt hatrozza meg. \-font ~/\:.mplayer/\:arialuni.ttf .br \-font 'Bitstream Vera Sans' +.br +\-font 'Bitstream Vera Sans:style=Bold' .RE .PD 1 . @@ -2514,9 +2520,9 @@ Jelenleg haszontalan. Ugyan az, mint az \-audiofile, de felirat folyamokra (OggDS?). . .TP -.B \-subfont <fjlnv> (csak FreeType) -Belltja a felirat bettpust. -Ha nincs megafva a \-subfont, a \-font lesz hasznlva. +.B \-subfont <tvonal a bettpushoz (FreeType), bettpus minta (Fontconfig)> (csak FreeType) +Belltja a felirat bettpust (lsd \-font). +Ha nincs megadva a \-subfont, a \-font lesz hasznlva. . .TP .B \-subfont\-autoscale <0\-3> (csak FreeType) diff --git a/DOCS/man/ru/mplayer.1 b/DOCS/man/ru/mplayer.1 index bc062259b8..a47e8a5eac 100644 --- a/DOCS/man/ru/mplayer.1 +++ b/DOCS/man/ru/mplayer.1 @@ -2,7 +2,7 @@ .\" This man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann .\" Translated by Vladimir Voroshilov <voroshil@gmail.com> .\" Encoding: koi8-r -.\" synced with r28807 +.\" synced with r28895 . .\" -------------------------------------------------------------------------- .\" @@ -922,6 +922,8 @@ mplayer \-heartbeat\-cmd "gnome\-screensaver\-command \-p" file (0 ). .IPs ar\-rate , . +.IPs (no)default-binds + , MPlayer . .IPs keylist , . .IPs cmdlist @@ -1085,17 +1087,18 @@ FIXME: . . .TP .B \-slave ( \-input) - "" , MPlayer . + , MPlayer . , MPlayer , (\\n). .br .I : \-input cmdlist DOCS/tech/slave.txt. + , + ; +, , \-input nodefault\-binds:conf=/dev/null. . .TP .B \-softsleep -.\" FIXME is translation correct? -.\" Time frames by repeatedly checking the current time instead of asking the , , MPlayer . , RTC. @@ -2217,14 +2220,14 @@ SubViewer (SRT). . . .TP -.B \-font < font.desc> +.B \-font < font.desc, (FreeType), (Fontconfig))> OSD/\:SUB ( : ~/\:.mplayer/\:font/\:font.desc, FreeType : ~/.mplayer/\:subfont.ttf). .br .I : FreeType, . - fontconfig, fontconfig. + Fontconfig, fontconfig. .sp 1 .I : .PD 0 @@ -2234,6 +2237,8 @@ SubViewer (SRT). \-font ~/\:.mplayer/\:arialuni.ttf .br \-font 'Bitstream Vera Sans' +.br +\-font 'Bitstream Vera Sans:style=Bold' .RE .PD 1 . @@ -2475,8 +2480,8 @@ cp1250, . , \-audiofile, (OggDS?). . .TP -.B \-subfont < > ( FreeType) - . +.B \-subfont < (FreeType), (Fontconfig)> ( FreeType) + (. \-font). \-subfont , \-font. . .TP diff --git a/DOCS/tech/MAINTAINERS b/DOCS/tech/MAINTAINERS index 087d566212..68b0768bc4 100644 --- a/DOCS/tech/MAINTAINERS +++ b/DOCS/tech/MAINTAINERS @@ -116,7 +116,6 @@ demuxers: * demux_rtp* - Ross Finlayson * demux_mpg and demux_ts - Nico Sabbi * demux_mpc.c - Reimar Döffinger - * demux_nuv.c - Reimar Döffinger muxers: * muxer_lavf.c - Michael Niedermayer diff --git a/DOCS/tech/codecs-in.html b/DOCS/tech/codecs-in.html index c4b29aa99c..488512d286 100644 --- a/DOCS/tech/codecs-in.html +++ b/DOCS/tech/codecs-in.html @@ -6,19 +6,15 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body text="#000000" link="#666666" vlink="#666666" alink="#666666"> -<table width=750 border="0"> - <tr> - <td align="right"> - <p> </p> - <p><b>Status of codecs support</b></p> - </td> - </tr> - <tr> - <td> - <p><a href="#vc">Video codecs</a><br><a href="#ac">Audio codecs</a><br></p> - </td> - </tr> +<h1>Status of codecs support</h1> + +<ul> + <li><a href="#vc">Video codecs</a></li> + <li><a href="#ac">Audio codecs</a></li> +</ul> + +<table width=750 border="0"> <tr> <td align="center"> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="5"><a name="vc">Video codecs:</a></font></b><br><br> @@ -31,7 +27,7 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">fourcc</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> <td width=40 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">out</font></b></td> <td align=center colspan=2><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> @@ -51,8 +47,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">fourcc</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %4 --> <tr> @@ -69,8 +65,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">fourcc</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %2 --> <tr> @@ -87,8 +83,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">fourcc</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %3 --> <tr> @@ -111,7 +107,7 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">format</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> <td align=center colspan=3><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %5 --> @@ -129,8 +125,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">format</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %9 --> <tr> @@ -147,8 +143,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">format</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %7 --> <tr> @@ -165,8 +161,8 @@ <tr> <td width=150 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codec name</font></b></td> <td width=70 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">format</font></b></td> - <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">codecfile</font></b></td> - <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">problem</font></b></td> + <td width=120 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">driver name</font></b></td> + <td colspan=3 align=center><b><font color="#AAAAAA" face="Verdana, Arial, Helvetica, sans-serif" size="2">comments</font></b></td> </tr> <!-- %8 --> <tr> diff --git a/DOCS/tech/mingw-crosscompile.txt b/DOCS/tech/mingw-crosscompile.txt new file mode 100644 index 0000000000..e4e2dbee0e --- /dev/null +++ b/DOCS/tech/mingw-crosscompile.txt @@ -0,0 +1,32 @@ +Due to a lack of Windows developers, it is a good idea to allow Linux +developers to do at least some basic check of their code. +This HOWTO explains how to set up MinGW cross-compilation under Debian. + +First, you need to install the "mingw32" package and get a MPlayer SVN +checkout. + +Next, you need quite a lot of dependencies. Since this is for testing and +not actually use, the easiest way is to use this package: +http://natsuki.mplayerhq.hu/~reimar/mpl_mingw32.tar.bz2 +NOTE that this is likely to be quite out-dated and might include packages +with security issues, so do not use it to build binaries for real use. + +After extracting this package into the MPlayer source-tree, +you only need to run the included linux-mingw.sh to configure (it just runs +./configure --host-cc=cc --target=i686-mingw32msvc --cc=i586-mingw32msvc-cc +--windres=i586-mingw32msvc-windres --ranlib=i586-mingw32msvc-ranlib +--with-extraincdir="$PWD/osdep/mingw32" +--with-extralibdir="$PWD/osdep/mingw32" +--with-freetype-config="$PWD/osdep/mingw32/ftconf") and then run make. + +You should be able to run the generated binary with Wine, if you want to. + +The steps as command-lines: + +sudo apt-get install mingw32 +svn co svn://svn.mplayerhq.hu/mplayer/trunk MPlayer-mingw +cd MPlayer-mingw +wget http://natsuki.mplayerhq.hu/~reimar/mpl_mingw32.tar.bz2 +tar -xjf mpl_mingw32.tar.bz2 +sh linux-mingw.sh +make diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index 2ad276defd..df23826c3c 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -30,6 +30,8 @@ As a temporary hack, there is also the _experimental_ "pausing_keep_force " prefix, with which MPlayer will not exit the pause loop at all. Like this you can avoid the "frame stepping" effect of "pausing_keep " but most commands will either not work at all or behave in unexpected ways. +For "set_mouse_pos" and "key_down_event", "pausing_keep_force" is the default +since other values do not make much sense for them. Available commands ('mplayer -input cmdlist' will print a list): diff --git a/DOCS/tech/win32-codec-howto.txt b/DOCS/tech/win32-codec-howto.txt index 81dfafca83..3346de47bb 100644 --- a/DOCS/tech/win32-codec-howto.txt +++ b/DOCS/tech/win32-codec-howto.txt @@ -25,17 +25,36 @@ Cannot find codec matching selected -vo and video format 0x55594648. It means your AVI is encoded with a codec which has the HFYU fourcc (HFYU = HuffYUV codec, DIV3 = DivX Low Motion, etc.). Now that you know this, you -have to find out which DLL Windows loads in order to play this file. In our -case, the 'system.ini' contains this information in a line that reads: +have to find out which DLL Windows loads in order to play this file. +You can find the vfw codec by searching the internet for e.g. VIDC.HFYU. + +In our case, the 'system.ini' also contains this information in a line that reads: VIDC.HFYU=huffyuv.dll -So you need the 'huffyuv.dll' file. Note that the audio codecs are -specified by the MSACM prefix: +So you need the 'huffyuv.dll' file. + + + +ACM Codecs: +~~~~~~~~~~~~ +MPlayer may fail at playing the audio in your file with this message: + +Cannot find codec for audio format 0x55. +Read DOCS/HTML/en/codecs.html! +Audio: no sound + +MPlayer calls this the TwoCC format identifier. From the TwoCC list we find: + +0x0055 MPEG-1 Layer 3 (MP3) + +If you are lucky, you can then just search the internet for "codec acm" +e.g. "mp3 acm". Or if the codec is already installed on Windows, +it will show up in the system.ini as: msacm.l3acm=L3codeca.acm -This is the MP3 codec. +Note that the audio codecs are specified by the MSACM prefix: @@ -53,7 +72,7 @@ New Method: Using Microsoft GraphEdit (fast) -- Get GraphEdit from either DirectX SDK or doom9. +- Get GraphEdit from the Microsoft SDK, DirectX SDK or doom9. - Start 'graphedit.exe'. - From the menu select "Graph -> Insert Filters". - Expand item "DirectShow Filters". @@ -86,3 +105,15 @@ Take a deep breath and start searching the registry... If searching fails, try enabling all the checkboxes. You may have false hits, but you may get lucky... + + + +Tips: +~~~~~~~ +If you get an error loading a new codec, it may need some more files to work. +Start the filemon utility before loading MPlayer to find out which dlls are +trying to be loaded. + +Your codec may load some external .dll libraries. If the codec is already +installed in Windows, run listdlls wmplayer.exe while Windows Media +Player is playing your file to find out which. diff --git a/DOCS/xml/html-common.xsl b/DOCS/xml/html-common.xsl index dc3cb14cea..d803b3d1d4 100644 --- a/DOCS/xml/html-common.xsl +++ b/DOCS/xml/html-common.xsl @@ -2,7 +2,9 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -<xsl:output method="html" indent="no"/> +<xsl:output method="html" indent="no" + doctype-system="http://www.w3.org/TR/html4/loose.dtd" + doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/> <!-- ************** Set parameters @@ -94,8 +94,6 @@ SRCS_COMMON = asxparser.c \ libmpcodecs/dec_video.c \ libmpcodecs/img_format.c \ libmpcodecs/mp_image.c \ - libmpcodecs/native/nuppelvideo.c \ - libmpcodecs/native/rtjpegn.c \ libmpcodecs/native/xa_gsm.c \ libmpcodecs/pullup.c \ libmpcodecs/vd.c \ @@ -104,7 +102,6 @@ SRCS_COMMON = asxparser.c \ libmpcodecs/vd_mpegpes.c \ libmpcodecs/vd_mtga.c \ libmpcodecs/vd_null.c \ - libmpcodecs/vd_nuv.c \ libmpcodecs/vd_raw.c \ libmpcodecs/vd_sgi.c \ libmpcodecs/vf.c \ @@ -189,7 +186,6 @@ SRCS_COMMON = asxparser.c \ libmpdemux/demux_mov.c \ libmpdemux/demux_mpg.c \ libmpdemux/demux_nsv.c \ - libmpdemux/demux_nuv.c \ libmpdemux/demux_pva.c \ libmpdemux/demux_rawaudio.c \ libmpdemux/demux_rawvideo.c \ @@ -603,6 +599,7 @@ SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c SRCS_MPLAYER-$(JOYSTICK) += input/joystick.c SRCS_MPLAYER-$(JPEG) += libvo/vo_jpeg.c +SRCS_MPLAYER-$(KVA) += libvo/vo_kva.c SRCS_MPLAYER-$(LIBMENU) += libmenu/menu.c \ libmenu/menu_chapsel.c \ libmenu/menu_cmdlist.c \ @@ -691,7 +688,7 @@ SRCS_MENCODER-$(FAAC) += libmpcodecs/ae_faac.c SRCS_MENCODER-$(LIBAVCODEC) += libmpcodecs/ae_lavc.c libmpcodecs/ve_lavc.c SRCS_MENCODER-$(LIBAVFORMAT) += libmpdemux/muxer_lavf.c SRCS_MENCODER-$(LIBDV) += libmpcodecs/ve_libdv.c -SRCS_MENCODER-$(LIBLZO) += libmpcodecs/ve_nuv.c +SRCS_MENCODER-$(LIBLZO) += libmpcodecs/ve_nuv.c libmpcodecs/native/rtjpegn.c SRCS_MENCODER-$(MP3LAME) += libmpcodecs/ae_lame.c SRCS_MENCODER-$(QTX_CODECS_WIN32) += libmpcodecs/ve_qtvideo.c SRCS_MENCODER-$(TOOLAME) += libmpcodecs/ae_toolame.c @@ -999,7 +996,7 @@ testsclean: TOOLS = $(addprefix TOOLS/,alaw-gen asfinfo avi-fix avisubdump compare dump_mp4 movinfo netstream subrip vivodump) ifdef ARCH_X86 -TOOLS += TOOLS/modify_reg +TOOLS += TOOLS/fastmemcpybench TOOLS/modify_reg endif ALLTOOLS = $(TOOLS) TOOLS/bmovl-test TOOLS/vfw2menc @@ -1009,7 +1006,7 @@ alltools: $(addsuffix $(EXESUF),$(ALLTOOLS)) toolsclean: -rm -f $(foreach file,$(ALLTOOLS),$(call ADD_ALL_EXESUFS,$(file))) - -rm -f TOOLS/fastmem*-* TOOLS/realcodecs/*.so.6.0 + -rm -f TOOLS/realcodecs/*.so.6.0 TOOLS/bmovl-test$(EXESUF): -lSDL_image @@ -1026,22 +1023,11 @@ TOOLS/vivodump$(EXESUF): TOOLS/vivodump.c TOOLS/netstream$(EXESUF) TOOLS/vivodump$(EXESUF): $(subst mplayer.o,mplayer-nomain.o,$(OBJS_MPLAYER)) $(filter-out %mencoder.o,$(OBJS_MENCODER)) $(OBJS_COMMON) $(COMMON_LIBS) $(CC) $(CFLAGS) -o $@ $^ $(EXTRALIBS_MPLAYER) $(EXTRALIBS_MENCODER) $(COMMON_LDFLAGS) -fastmemcpybench: TOOLS/fastmemcpybench.c - $(CC) $(CFLAGS) $< -o TOOLS/fastmem-mmx$(EXESUF) -DNAME=\"mmx\" -DHAVE_MMX - $(CC) $(CFLAGS) $< -o TOOLS/fastmem-k6$(EXESUF) -DNAME=\"k6\ \" -DHAVE_MMX -DHAVE_AMD3DNOW - $(CC) $(CFLAGS) $< -o TOOLS/fastmem-k7$(EXESUF) -DNAME=\"k7\ \" -DHAVE_MMX -DHAVE_AMD3DNOW -DHAVE_MMX2 - $(CC) $(CFLAGS) $< -o TOOLS/fastmem-sse$(EXESUF) -DNAME=\"sse\" -DHAVE_MMX -DHAVE_SSE -DHAVE_MMX2 - $(CC) $(CFLAGS) $< -o TOOLS/fastmem2-mmx$(EXESUF) -DNAME=\"mga-mmx\" -DCONFIG_MGA -DHAVE_MMX - $(CC) $(CFLAGS) $< -o TOOLS/fastmem2-k6$(EXESUF) -DNAME=\"mga-k6\ \" -DCONFIG_MGA -DHAVE_MMX -DHAVE_AMD3DNOW - $(CC) $(CFLAGS) $< -o TOOLS/fastmem2-k7$(EXESUF) -DNAME=\"mga-k7\ \" -DCONFIG_MGA -DHAVE_MMX -DHAVE_AMD3DNOW -DHAVE_MMX2 - $(CC) $(CFLAGS) $< -o TOOLS/fastmem2-sse$(EXESUF) -DNAME=\"mga-sse\" -DCONFIG_MGA -DHAVE_MMX -DHAVE_SSE -DHAVE_MMX2 - REAL_SRCS = $(wildcard TOOLS/realcodecs/*.c) REAL_TARGETS = $(REAL_SRCS:.c=.so.6.0) realcodecs: $(REAL_TARGETS) - -fastmemcpybench realcodecs: CFLAGS += -g +realcodecs: CFLAGS += -g %.so.6.0: %.o ld -shared -o $@ $< -ldl -lc diff --git a/TOOLS/fastmemcpybench.c b/TOOLS/fastmemcpybench.c index 2d8ac2b03d..35946d8b02 100644 --- a/TOOLS/fastmemcpybench.c +++ b/TOOLS/fastmemcpybench.c @@ -1,14 +1,12 @@ /* - fastmemcpybench.c used to benchmark fastmemcpy.h code from libvo. - - Note: this code can not be used on PentMMX-PII because they contain - a bug in rdtsc. For Intel processors since P6(PII) rdpmc should be used - instead. For PIII it's disputable and seems bug was fixed but I don't - tested it. + * benchmark tool for fast_memcpy code from libvo + * + * NOTE: This code can not be used on Pentium MMX / II because they contain + * a bug in rdtsc. For Intel processors since P6(PII) rdpmc should be used + * instead. For PIII it's disputable and it seems the bug was fixed but this + * was not confirmed through testing. */ -/* According to Uoti this code is broken. */ - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -19,6 +17,92 @@ #include <sys/time.h> #include <inttypes.h> +#include "config.h" +#include "cpudetect.h" + +#define BLOCK_SIZE 4096 +#define CONFUSION_FACTOR 0 + +#if HAVE_MMX +#define COMPILE_MMX +#endif + +#if HAVE_MMX2 +#define COMPILE_MMX2 +#endif + +#if HAVE_AMD3DNOW +#define COMPILE_AMD3DNOW +#endif + +#if HAVE_SSE +#define COMPILE_SSE +#endif + +#ifdef COMPILE_MMX +#undef RENAME +#undef HAVE_MMX +#undef HAVE_MMX2 +#undef HAVE_AMD3DNOW +#undef HAVE_SSE +#undef HAVE_SSE2 +#define HAVE_MMX 1 +#define HAVE_MMX2 0 +#define HAVE_AMD3DNOW 0 +#define HAVE_SSE 0 +#define HAVE_SSE2 0 +#define RENAME(a) a ## _MMX +#include "libvo/aclib_template.c" +#endif + +#ifdef COMPILE_MMX2 +#undef RENAME +#undef HAVE_MMX +#undef HAVE_MMX2 +#undef HAVE_AMD3DNOW +#undef HAVE_SSE +#undef HAVE_SSE2 +#define HAVE_MMX 1 +#define HAVE_MMX2 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_SSE 0 +#define HAVE_SSE2 0 +#define RENAME(a) a ## _MMX2 +#include "libvo/aclib_template.c" +#endif + +#ifdef COMPILE_AMD3DNOW +#undef RENAME +#undef HAVE_MMX +#undef HAVE_MMX2 +#undef HAVE_AMD3DNOW +#undef HAVE_SSE +#undef HAVE_SSE2 +#define HAVE_MMX 1 +#define HAVE_MMX2 0 +#define HAVE_AMD3DNOW 1 +#define HAVE_SSE 0 +#define HAVE_SSE2 0 +#define RENAME(a) a ## _3DNow +#include "libvo/aclib_template.c" +#endif + +#ifdef COMPILE_SSE +#undef RENAME +#undef HAVE_MMX +#undef HAVE_MMX2 +#undef HAVE_AMD3DNOW +#undef HAVE_SSE +#undef HAVE_SSE2 +#define HAVE_MMX 1 +#define HAVE_MMX2 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_SSE 1 +#define HAVE_SSE2 1 +#define RENAME(a) a ## _SSE +#include "libvo/aclib_template.c" +#endif + //#define ARR_SIZE 100000 #define ARR_SIZE (1024*768*2) @@ -27,50 +111,48 @@ #include "drivers/mga_vid.h" static mga_vid_config_t mga_vid_config; -static unsigned char* frame=NULL; +static unsigned char* frame = NULL; static int f; static int mga_init(void) { - f = open("/dev/mga_vid",O_RDWR); - if(f == -1) - { - fprintf(stderr,"Couldn't open /dev/mga_vid\n"); - return -1; - } - - mga_vid_config.num_frames=1; - mga_vid_config.frame_size=ARR_SIZE; - mga_vid_config.format=MGA_VID_FORMAT_YUY2; - - mga_vid_config.colkey_on=0; - mga_vid_config.src_width = 640; - mga_vid_config.src_height= 480; - mga_vid_config.dest_width = 320; - mga_vid_config.dest_height= 200; - mga_vid_config.x_org= 0; - mga_vid_config.y_org= 0; - - mga_vid_config.version=MGA_VID_VERSION; - if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config)) - { - perror("Error in mga_vid_config ioctl()"); - printf("Your mga_vid driver version is incompatible with this MPlayer version!\n"); - exit(1); - } - ioctl(f,MGA_VID_ON,0); - - frame = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0); - if(!frame){ - printf("Can't mmap mga frame\n"); - exit(1); - } - - //clear the buffer - //memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames); - - return 0; - + f = open("/dev/mga_vid", O_RDWR); + if (f == -1) { + fprintf(stderr, "Couldn't open /dev/mga_vid.\n"); + return -1; + } + + mga_vid_config.num_frames = 1; + mga_vid_config.frame_size = ARR_SIZE; + mga_vid_config.format = MGA_VID_FORMAT_YUY2; + + mga_vid_config.colkey_on = 0; + mga_vid_config.src_width = 640; + mga_vid_config.src_height = 480; + mga_vid_config.dest_width = 320; + mga_vid_config.dest_height = 200; + mga_vid_config.x_org = 0; + mga_vid_config.y_org = 0; + + mga_vid_config.version = MGA_VID_VERSION; + if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config)) { + perror("Error in mga_vid_config ioctl()"); + printf("Your mga_vid driver version is incompatible with this MPlayer version!\n"); + exit(1); + } + ioctl(f, MGA_VID_ON, 0); + + frame = (char*)mmap(0, mga_vid_config.frame_size*mga_vid_config.num_frames, + PROT_WRITE,MAP_SHARED, f, 0); + if (!frame) { + printf("Can't mmap MGA frame.\n"); + exit(1); + } + + //clear the buffer + //memset(frames[0], 0x80, mga_vid_config.frame_size*mga_vid_config.num_frames); + + return 0; } #endif @@ -78,45 +160,68 @@ static int mga_init(void) // Returns current time in microseconds static unsigned int GetTimer(void) { - struct timeval tv; - struct timezone tz; -// float s; - gettimeofday(&tv,&tz); -// s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec; - return tv.tv_sec * 1000000 + tv.tv_usec; -} - -static inline unsigned long long int read_tsc( void ) + struct timeval tv; + struct timezone tz; + //float s; + gettimeofday(&tv, &tz); + //s = tv.tv_usec; s *= 0.000001; s += tv.tv_sec; + return tv.tv_sec * 1000000 + tv.tv_usec; +} + +static inline unsigned long long int read_tsc(void) { - unsigned long long int retval; - __asm__ volatile ("rdtsc":"=A"(retval)::"memory"); - return retval; + unsigned long long int retval; + __asm__ volatile ("rdtsc":"=A" (retval)::"memory"); + return retval; } -unsigned char __attribute__((aligned(4096)))arr1[ARR_SIZE],arr2[ARR_SIZE]; +unsigned char __attribute__((aligned(4096)))arr1[ARR_SIZE], arr2[ARR_SIZE]; -int main( void ) +int main(void) { - unsigned long long int v1,v2; - unsigned char * marr1,*marr2; - int i; - unsigned int t; + unsigned long long int v1, v2; + unsigned char *marr1, *marr2; + int i; + unsigned int t; #ifdef CONFIG_MGA - mga_init(); - marr1 = &frame[3]; + mga_init(); + marr1 = &frame[3]; #else - marr1 = &arr1[3]; + marr1 = &arr1[0]; +#endif + marr2 = &arr2[0]; + + for (i = 0; i < ARR_SIZE - 16; i++) + marr1[i] = marr2[i] = i; + +#define testblock(func, name) \ + t = GetTimer(); \ + v1 = read_tsc(); \ + for (i = 0; i < 100; i++) \ + func(marr1, marr2, ARR_SIZE - 16); \ + v2 = read_tsc(); \ + t = GetTimer() - t; \ + /* ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t */ \ + printf(name "CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, \ + 100000000.0f / (float)t, (float)ARR_SIZE*95.36743f / (float)t); + + testblock(memcpy, "libc: "); + +#if HAVE_MMX + testblock(fast_memcpy_MMX, "MMX: "); #endif - marr2 = &arr2[9]; - - for(i=0; i<ARR_SIZE-16; i++) marr1[i] = marr2[i] = i; - - t=GetTimer(); - v1 = read_tsc(); - for(i=0;i<100;i++) memcpy(marr1,marr2,ARR_SIZE-16); - v2 = read_tsc(); - t=GetTimer()-t; - // ARR_SIZE*100/(1024*1024)/(t/1000000) = ARR_SIZE*95.36743/t - printf(NAME": cpu clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n",v2-v1,t,100000000.0f/(float)t,(float)ARR_SIZE*95.36743f/(float)t); - return 0; + +#if HAVE_AMD3DNOW + testblock(fast_memcpy_3DNow, "3DNow!: "); +#endif + +#if HAVE_MMX2 + testblock(fast_memcpy_MMX2, "MMX2: "); +#endif + +#if HAVE_SSE + testblock(fast_memcpy_SSE, "SSE: "); +#endif + + return 0; } @@ -366,6 +366,7 @@ Video output: --enable-vesa enable VESA video output [autodetect] --enable-svga enable SVGAlib video output [autodetect] --enable-sdl enable SDL video output [autodetect] + --enable-kva enable KVA video output [autodetect] --enable-aa enable AAlib video output [autodetect] --enable-caca enable CACA video output [autodetect] --enable-ggi enable GGI video output [autodetect] @@ -556,6 +557,7 @@ _xv=auto _xvmc=no #auto when complete _vdpau=auto _sdl=auto +_kva=auto _direct3d=auto _directx=auto _win32waveout=auto @@ -888,6 +890,8 @@ for ac_option do --disable-vdpau) _vdpau=no ;; --enable-sdl) _sdl=yes ;; --disable-sdl) _sdl=no ;; + --enable-kva) _kva=yes ;; + --disable-kva) _kva=no ;; --enable-direct3d) _direct3d=yes ;; --disable-direct3d) _direct3d=no ;; --enable-directx) _directx=yes ;; @@ -4156,7 +4160,8 @@ echocheck "X11 headers presence" fi done if test $_cross_compile = no; then - for I in /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/openwin/include ; do + for I in /usr/X11/include /usr/X11R7/include /usr/X11R6/include \ + /usr/include/X11R6 /usr/openwin/include ; do if test -f "$I/X11/Xlib.h" ; then _inc_extra="$_inc_extra -I$I" _x11_headers="yes" @@ -4175,8 +4180,9 @@ if test "$_x11" = auto && test "$_x11_headers" = yes ; then #include <X11/Xutil.h> int main(void) { (void) XCreateWindow(0,0,0,0,0,0,0,0,0,0,0,0); return 0; } EOF - for I in "" -L/usr/X11R6/lib -L/usr/lib/X11R6 -L/usr/X11/lib \ - -L/usr/lib32 -L/usr/openwin/lib -L/usr/X11R6/lib64 -L/usr/lib ; do + for I in "" -L/usr/X11R7/lib -L/usr/X11R6/lib -L/usr/lib/X11R6 \ + -L/usr/X11/lib -L/usr/lib32 -L/usr/openwin/lib -L/usr/X11R6/lib64 \ + -L/usr/lib ; do if netbsd; then _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R`echo $I | sed s/^-L//`" else @@ -5101,6 +5107,29 @@ fi echores "$_sdl" +if os2 ; then +echocheck "KVA (SNAP/WarpOverlay!/DIVE)" +if test "$_kva" = auto; then + cat > $TMPC << EOF +#include <os2.h> +#include <kva.h> +int main( void ) { return 0; } +EOF + _kva=no; + cc_check -lkva && _kva=yes +fi +if test "$_kva" = yes ; then + def_kva='#define CONFIG_KVA 1' + _libs_mplayer="$_libs_mplayer -lkva" + _vomodules="kva $_vomodules" +else + def_kva='#undef CONFIG_KVA' + _novomodules="kva $_novomodules" +fi +echores "$_kva" +fi #if os2 + + if win32; then echocheck "Windows waveout" @@ -7777,13 +7806,11 @@ fi #if test "$_gui" # --------------- GUI specific tests end ------------------- -if test "$_charset" = "noconv" ; then - _charset="" -fi -if test "$_charset" ; then +if test "$_charset" != "noconv" ; then def_charset="#define MSG_CHARSET \"$_charset\"" else def_charset="#undef MSG_CHARSET" + _charset="UTF-8" fi if test -n "$_charset" && test "$_charset" != "UTF-8" ; then @@ -8160,6 +8187,7 @@ IVTV = $_ivtv JACK = $_jack JOYSTICK = $_joystick JPEG = $_jpeg +KVA = $_kva LADSPA = $_ladspa LIBA52 = $_liba52 LIBA52_INTERNAL = $_liba52_internal @@ -8662,6 +8690,7 @@ $def_gl $def_gl_win32 $def_ivtv $def_jpeg +$def_kva $def_md5sum $def_mga $def_mng diff --git a/cpudetect.c b/cpudetect.c index 5da169dfc0..84ae527089 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -143,6 +143,7 @@ void GetCpuCaps( CpuCaps *caps) caps->hasMMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 caps->hasSSE = (regs2[3] & (1 << 25 )) >> 25; // 0x2000000 caps->hasSSE2 = (regs2[3] & (1 << 26 )) >> 26; // 0x4000000 + caps->hasSSE3 = (regs2[2] & 1); // 0x0000001 caps->hasSSSE3 = (regs2[2] & (1 << 9 )) >> 9; // 0x0000200 caps->hasMMX2 = caps->hasSSE; // SSE cpus supports mmxext too cl_size = ((regs2[1] >> 8) & 0xFF)*8; @@ -458,6 +459,7 @@ void GetCpuCaps( CpuCaps *caps) caps->has3DNowExt=0; caps->hasSSE=0; caps->hasSSE2=0; + caps->hasSSE3=0; caps->hasSSSE3=0; caps->hasSSE4a=0; caps->isX86=0; diff --git a/cpudetect.h b/cpudetect.h index 2cc99d47eb..f31bf07dff 100644 --- a/cpudetect.h +++ b/cpudetect.h @@ -46,6 +46,7 @@ typedef struct cpucaps_s { int has3DNowExt; int hasSSE; int hasSSE2; + int hasSSE3; int hasSSSE3; int hasSSE4a; int isX86; diff --git a/defaultopts.c b/defaultopts.c index 10505f4ea5..2f77b16fcd 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -46,6 +46,7 @@ void set_default_mplayer_options(struct MPOpts *opts) #else .use_ar = 0, #endif + .default_binds = 1, } }; } diff --git a/etc/codecs.conf b/etc/codecs.conf index 11d0a01e18..1b7dd58d22 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -3,7 +3,7 @@ ; Before editing this file, please read DOCS/tech/codecs.conf.txt ! ;============================================================================= -release 20070930 +release 20090308 ;============================================================================= ; VIDEO CODECS @@ -319,14 +319,6 @@ videocodec ffnuv dll nuv out I420 -videocodec nuv - info "NuppelVideo" - status working - fourcc NUV1 ; NUV1 is an internal MPlayer FOURCC - fourcc RJPG - driver nuv - out I420,IYUV - videocodec ffbmp info "FFmpeg BMP" status working @@ -533,6 +525,15 @@ videocodec theora ;WIN32: +videocodec smartsight + info "Verint Video Manager" + status working + fourcc SN40 + fourcc SN41,SJPG ; untested + driver vfw + dll "SN4Codec.dll" + out BGR24 flip + videocodec msuscls info "MSU Screen Capture Lossless Codec" status working @@ -891,7 +892,7 @@ videocodec ffodivx fourcc FFDS fourcc DCOD,MVXM,EM4A,PM4V fourcc M4T3,DMK2,DIGI,INMC - fourcc EPHV + fourcc EPHV,SN40 driver ffmpeg dll mpeg4 ;opendivx out YV12,I420,IYUV @@ -942,7 +943,7 @@ videocodec xvid fourcc FFDS fourcc DCOD,MVXM,EM4A,PM4V fourcc M4T3,DMK2,DIGI,INMC - fourcc EPHV + fourcc EPHV,SN40 format 0x10000004 ; mpeg 4 es driver xvid out YV12 diff --git a/help/help_mp-hu.h b/help/help_mp-hu.h index dac9dd29e7..770c552b88 100644 --- a/help/help_mp-hu.h +++ b/help/help_mp-hu.h @@ -3,7 +3,7 @@ //... Okay enough of the hw, now send the other two! // // Updated by: Gabrov <gabrov@freemail.hu> -// Sync'ed with help_mp-en.h r28122 (2008. 12. 17.) +// Sync'ed with help_mp-en.h r28860 (2009. 03. 09.) // ========================= MPlayer help =========================== diff --git a/help/help_mp-uk.h b/help/help_mp-uk.h index 359e74d4aa..bebc874970 100644 --- a/help/help_mp-uk.h +++ b/help/help_mp-uk.h @@ -947,6 +947,128 @@ static const char help_text[]= #define MSGTR_LIBVO_MGA_ResolutionTooHigh "[MGA] Розширення джерела, у крайньому випадку в одному вимірі, більше ніж 1023x1023.\n[MGA] Перемасштабуйте програмно або викорстайте -lavdopts lowres=1.\n" #define MSGTR_LIBVO_MGA_mgavidVersionMismatch "[MGA] версія драйверу mga_vid ядра (%u) та MPlayer (%u) не співпадають\n" +// vo_null.c +#define MSGTR_LIBVO_NULL_UnknownSubdevice "[VO_NULL] Невідомий підпристрій: %s.\n" + +// vo_png.c +#define MSGTR_LIBVO_PNG_Warning1 "[VO_PNG] Попередження: рівень стиснення встановлено 0, стиснення вимкнено!\n" +#define MSGTR_LIBVO_PNG_Warning2 "[VO_PNG] Інфо: Використайте -vo png:z=<n> щоб встановити рівень стиснення з 0 до 9.\n" +#define MSGTR_LIBVO_PNG_Warning3 "[VO_PNG] Інфо: (0 = без стиснення, 1 = найшвидша, найповільніша - 9 але найкраще стиснення)\n" +#define MSGTR_LIBVO_PNG_ErrorOpeningForWriting "\n[VO_PNG] Помилка при відкритті '%s' для запису!\n" +#define MSGTR_LIBVO_PNG_ErrorInCreatePng "[VO_PNG] Помилка при створенні png.\n" + +// vo_pnm.c +#define MSGTR_VO_PNM_ASCIIMode "Режим ASCII увімкнено." +#define MSGTR_VO_PNM_RawMode "Режим Raw увімкнено." +#define MSGTR_VO_PNM_PPMType "Запише файли PPM." +#define MSGTR_VO_PNM_PGMType "Запише файли PGM." +#define MSGTR_VO_PNM_PGMYUVType "Запише файли PGMYUV." + +// vo_sdl.c +#define MSGTR_LIBVO_SDL_CouldntGetAnyAcceptableSDLModeForOutput "[VO_SDL] Не можу вивести прийнятний SDL Mode.\n" +#define MSGTR_LIBVO_SDL_SetVideoModeFailed "[VO_SDL] set_video_mode: Збій SDL_SetVideoMode: %s.\n" +#define MSGTR_LIBVO_SDL_SetVideoModeFailedFull "[VO_SDL] Set_fullmode: Збій SDL_SetVideoMode: %s.\n" +#define MSGTR_LIBVO_SDL_MappingI420ToIYUV "[VO_SDL] Показую I420 у IYUV.\n" +#define MSGTR_LIBVO_SDL_UnsupportedImageFormat "[VO_SDL] Формат картинки не підтримується (0x%X).\n" +#define MSGTR_LIBVO_SDL_InfoPleaseUseVmOrZoom "[VO_SDL] Інфо - спробуйте -vm чи -zoom щоб перейти до найкращої роздільної здатності.\n" +#define MSGTR_LIBVO_SDL_FailedToSetVideoMode "[VO_SDL] Не вдалося встановити відео режим: %s.\n" +#define MSGTR_LIBVO_SDL_CouldntCreateAYUVOverlay "[VO_SDL] Не вдалося створити оверлей YUV: %s.\n" +#define MSGTR_LIBVO_SDL_CouldntCreateARGBSurface "[VO_SDL] Не вдалося створити поверхню RGB: %s.\n" +#define MSGTR_LIBVO_SDL_UsingDepthColorspaceConversion "[VO_SDL] Використовую перетворення глибини/кольорового простору, це уповільнить протікання процесу (%ibpp -> %ibpp).\n" +#define MSGTR_LIBVO_SDL_UnsupportedImageFormatInDrawslice "[VO_SDL] Формат картинки не підтримується у draw_slice, повідомте розробників MPlayer!\n" +#define MSGTR_LIBVO_SDL_BlitFailed "[VO_SDL] Збій Blit: %s.\n" +#define MSGTR_LIBVO_SDL_InitializationFailed "[VO_SDL] Ініціялізація SDL не вдалася: %s.\n" +#define MSGTR_LIBVO_SDL_UsingDriver "[VO_SDL] Використовую драйвер: %s.\n" + +// vo_svga.c +#define MSGTR_LIBVO_SVGA_ForcedVidmodeNotAvailable "[VO_SVGA] Форсований vid_mode %d (%s) не доступний.\n" +#define MSGTR_LIBVO_SVGA_ForcedVidmodeTooSmall "[VO_SVGA] Форсований vid_mode %d (%s) замалий.\n" +#define MSGTR_LIBVO_SVGA_Vidmode "[VO_SVGA] Vid_mode: %d, %dx%d %dbpp.\n" +#define MSGTR_LIBVO_SVGA_VgasetmodeFailed "[VO_SVGA] Збій Vga_setmode(%d).\n" +#define MSGTR_LIBVO_SVGA_VideoModeIsLinearAndMemcpyCouldBeUsed "[VO_SVGA] Режим Відео лінійний та для передачі зображення може бути\nвикористаний memcpy.\n" +#define MSGTR_LIBVO_SVGA_VideoModeHasHardwareAcceleration "[VO_SVGA] Режим Відео має апаратне прискорення тому може бути кокористаний put_image.\n" +#define MSGTR_LIBVO_SVGA_IfItWorksForYouIWouldLikeToKnow "[VO_SVGA] Якщо це працює у вас, дайте мені знати.\n[VO_SVGA] (надішліть лоґ з `mplayer test.avi -v -v -v -v &> svga.log`). Дякую!\n" +#define MSGTR_LIBVO_SVGA_VideoModeHas "[VO_SVGA] Режим Відео має %d сторінку(ок/ки).\n" +#define MSGTR_LIBVO_SVGA_CenteringImageStartAt "[VO_SVGA] Centering image. Starting at (%d,%d)\n" +#define MSGTR_LIBVO_SVGA_UsingVidix "[VO_SVGA] Використовую VIDIX. w=%i h=%i mw=%i mh=%i\n" + +// vo_tdfx_vid.c +#define MSGTR_LIBVO_TDFXVID_Move "[VO_TDXVID] Переміщую %d(%d) x %d => %d.\n" +#define MSGTR_LIBVO_TDFXVID_AGPMoveFailedToClearTheScreen "[VO_TDFXVID] Переміщення AGP не вдалося очистити екран.\n" +#define MSGTR_LIBVO_TDFXVID_BlitFailed "[VO_TDFXVID] Збій Blit.\n" +#define MSGTR_LIBVO_TDFXVID_NonNativeOverlayFormatNeedConversion "[VO_TDFXVID] Нестандартний формат оверлею потребує перетворення.\n" +#define MSGTR_LIBVO_TDFXVID_UnsupportedInputFormat "[VO_TDFXVID] Формат вводу 0x%x не підтримується.\n" +#define MSGTR_LIBVO_TDFXVID_OverlaySetupFailed "[VO_TDFXVID] Встановлення оверлею не вдалося.\n" +#define MSGTR_LIBVO_TDFXVID_OverlayOnFailed "[VO_TDFXVID] Помилка оверлею.\n" +#define MSGTR_LIBVO_TDFXVID_OverlayReady "[VO_TDFXVID] Оверлей готовий: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n" +#define MSGTR_LIBVO_TDFXVID_TextureBlitReady "[VO_TDFXVID] Blit текстур готовий: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n" +#define MSGTR_LIBVO_TDFXVID_OverlayOffFailed "[VO_TDFXVID] Ввимкнення оверлею не вдолося\n" +#define MSGTR_LIBVO_TDFXVID_CantOpen "[VO_TDFXVID] Не можу відкрити %s: %s.\n" +#define MSGTR_LIBVO_TDFXVID_CantGetCurrentCfg "[VO_TDFXVID] Не можу отримати поточну конфігурацію: %s.\n" +#define MSGTR_LIBVO_TDFXVID_MemmapFailed "[VO_TDFXVID] Збій memmap !!!!!\n" +#define MSGTR_LIBVO_TDFXVID_GetImageTodo "Треба доробити картинку.\n" +#define MSGTR_LIBVO_TDFXVID_AgpMoveFailed "[VO_TDFXVID] Переміщення AGP не вдалося.\n" +#define MSGTR_LIBVO_TDFXVID_SetYuvFailed "[VO_TDFXVID] Встановлення YUV не вдалося.\n" +#define MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnYPlane "[VO_TDFXVID] Переміщення AGP не вдалося на проєкції Y.\n" +#define MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnUPlane "[VO_TDFXVID] Переміщення AGP не вдалося на проєкції U.\n" +#define MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnVPlane "[VO_TDFXVID] Переміщення AGP не вдалося на проєкції V.\n" +#define MSGTR_LIBVO_TDFXVID_UnknownFormat "[VO_TDFXVID] невідомий формат: 0x%x.\n" + +// vo_tdfxfb.c +#define MSGTR_LIBVO_TDFXFB_CantOpen "[VO_TDFXFB] Не можу відкрити %s: %s.\n" +#define MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetFscreenInfo "[VO_TDFXFB] Проблема з FBITGET_FSCREENINFO ioctl: %s.\n" +#define MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetVscreenInfo "[VO_TDFXFB] Проблема з FBITGET_VSCREENINFO ioctl: %s.\n" +#define MSGTR_LIBVO_TDFXFB_ThisDriverOnlySupports "[VO_TDFXFB] Це драйвер підтримує тільки 3Dfx Banshee, Voodoo3 та Voodoo 5.\n" +#define MSGTR_LIBVO_TDFXFB_OutputIsNotSupported "[VO_TDFXFB] %d вивід bpp не підтримується.\n" +#define MSGTR_LIBVO_TDFXFB_CouldntMapMemoryAreas "[VO_TDFXFB] Не можу показати частини пам'яті: %s.\n" +#define MSGTR_LIBVO_TDFXFB_BppOutputIsNotSupported "[VO_TDFXFB] %d вивід bpp не підтримується (Цього зовсім не повинно траплятися).\n" +#define MSGTR_LIBVO_TDFXFB_SomethingIsWrongWithControl "[VO_TDFXFB] Ой! Щось сталося з control().\n" +#define MSGTR_LIBVO_TDFXFB_NotEnoughVideoMemoryToPlay "[VO_TDFXFB] Не достатньо пам'яті щоб програти це відео. Спробуйте меншу роздільну здатність.\n" +#define MSGTR_LIBVO_TDFXFB_ScreenIs "[VO_TDFXFB] Екран %dx%d на %d bpp, у %dx%d на %d bpp, режим %dx%d.\n" + +// vo_tga.c +#define MSGTR_LIBVO_TGA_UnknownSubdevice "[VO_TGA] Невідомий підпристрій: %s.\n" + +// vo_vesa.c +#define MSGTR_LIBVO_VESA_FatalErrorOccurred "[VO_VESA] Виникла фатально помилка! Не можу продовжити.\n" +#define MSGTR_LIBVO_VESA_UnknownSubdevice "[VO_VESA] невідомий підпристрій: '%s'.\n" +#define MSGTR_LIBVO_VESA_YouHaveTooLittleVideoMemory "[VO_VESA] Замало відео пам'яті для цього режиму:\n[VO_VESA] Потребує: %08lX є: %08lX.\n" +#define MSGTR_LIBVO_VESA_YouHaveToSpecifyTheCapabilitiesOfTheMonitor "[VO_VESA] Ви маєте вказати можливості монітора. Не змінюю частому оновлення.\n" +#define MSGTR_LIBVO_VESA_UnableToFitTheMode "[VO_VESA] Режим не відповідає обмеженням монітора. Не змінюю частому оновлення.\n" +#define MSGTR_LIBVO_VESA_DetectedInternalFatalError "[VO_VESA] Виявлена фатальна внутрішня помилка: init викликаний перед preinit.\n" +#define MSGTR_LIBVO_VESA_SwitchFlipIsNotSupported "[VO_VESA] Опція -flip не підтримується.\n" +#define MSGTR_LIBVO_VESA_PossibleReasonNoVbe2BiosFound "[VO_VESA] Можлива причина: Не знайдено VBE2 BIOS.\n" +#define MSGTR_LIBVO_VESA_FoundVesaVbeBiosVersion "[VO_VESA] Знайдено VESA VBE BIOS, версія %x.%x ревізія: %x.\n" +#define MSGTR_LIBVO_VESA_VideoMemory "[VO_VESA] Відео пам'ять: %u Кб.\n" +#define MSGTR_LIBVO_VESA_Capabilites "[VO_VESA] Можливості VESA: %s %s %s %s %s.\n" +#define MSGTR_LIBVO_VESA_BelowWillBePrintedOemInfo "[VO_VESA] !!! OEM інформація буде виведена нище !!!\n" +#define MSGTR_LIBVO_VESA_YouShouldSee5OemRelatedLines "[VO_VESA] Ви повинні бачити 5 рядків інфо про OEM нище; Якщо ні, у вас поламана vm86.\n" +#define MSGTR_LIBVO_VESA_OemInfo "[VO_VESA] OEM інфо: %s.\n" +#define MSGTR_LIBVO_VESA_OemRevision "[VO_VESA] OEM ревізія: %x.\n" +#define MSGTR_LIBVO_VESA_OemVendor "[VO_VESA] OEM постачальник: %s.\n" +#define MSGTR_LIBVO_VESA_OemProductName "[VO_VESA] Назва продукту OEM: %s.\n" +#define MSGTR_LIBVO_VESA_OemProductRev "[VO_VESA] Ревізія продукту OEM: %s.\n" +#define MSGTR_LIBVO_VESA_Hint "[VO_VESA] Підказка: Для роботи ТБ-виходу вам необхідно підключити ТБ роз'єм\n"\ +"[VO_VESA] перед завантаженням як VESA BIOS ініціялізує себе протягом POST.\n" +#define MSGTR_LIBVO_VESA_UsingVesaMode "[VO_VESA] Використовую режим VESA (%u) = %x [%ux%u@%u]\n" +#define MSGTR_LIBVO_VESA_CantInitializeSwscaler "[VO_VESA] Не можу ініціялізувати програмне масштабування.\n" +#define MSGTR_LIBVO_VESA_CantUseDga "[VO_VESA] Не можу використовувати DGA. Форсую режим комутації сегментів. :(\n" +#define MSGTR_LIBVO_VESA_UsingDga "[VO_VESA] Використовую DGA (фізичні ресурси: %08lXh, %08lXh)" +#define MSGTR_LIBVO_VESA_CantUseDoubleBuffering "[VO_VESA] Не можу використати подвійну буферизацію: не достатньо відео пам'яті.\n" +#define MSGTR_LIBVO_VESA_CantFindNeitherDga "[VO_VESA] Не можу знайти ні DGA ні переміщуваного фрейму вікна.\n" +#define MSGTR_LIBVO_VESA_YouveForcedDga "[VO_VESA] Ви форсували DGA. Виходжу\n" +#define MSGTR_LIBVO_VESA_CantFindValidWindowAddress "[VO_VESA] Не можу знайти правильну адресу вікна.\n" +#define MSGTR_LIBVO_VESA_UsingBankSwitchingMode "[VO_VESA] Використовую режим комутації сегментів (фізичні ресурси: %08lXh, %08lXh).\n" +#define MSGTR_LIBVO_VESA_CantAllocateTemporaryBuffer "[VO_VESA] Не можу виділити тимчасовий буфер.\n" +#define MSGTR_LIBVO_VESA_SorryUnsupportedMode "[VO_VESA] Вибачте, режим не підтримується -- спробуйте -x 640 -zoom.\n" +#define MSGTR_LIBVO_VESA_OhYouReallyHavePictureOnTv "[VO_VESA] О, ви справді маєте картинку на ТБ!\n" +#define MSGTR_LIBVO_VESA_CantInitialozeLinuxVideoOverlay "[VO_VESA] Не можу ініціялізувати Відео оверлей Linux.\n" +#define MSGTR_LIBVO_VESA_UsingVideoOverlay "[VO_VESA] Використовую відео оверлей: %s.\n" +#define MSGTR_LIBVO_VESA_CantInitializeVidixDriver "[VO_VESA] Не можу ініціялізувати драйвер VIDIX.\n" +#define MSGTR_LIBVO_VESA_UsingVidix "[VO_VESA] Використовую VIDIX.\n" +#define MSGTR_LIBVO_VESA_CantFindModeFor "[VO_VESA] Не можу знайти режим для: %ux%u@%u.\n" +#define MSGTR_LIBVO_VESA_InitializationComplete "[VO_VESA] Ініціялізація VESA завершена.\n" + // open.c, stream.c: #define MSGTR_CdDevNotfound "Компактовід \"%s\" не знайдений!\n" #define MSGTR_ErrTrackSelect "Помилка вибору треку на VCD!" diff --git a/input/input.c b/input/input.c index 1f1d4a6ebf..66c245071d 100644 --- a/input/input.c +++ b/input/input.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <stdbool.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> @@ -582,6 +583,7 @@ struct input_ctx { unsigned int num_key_down; unsigned int last_key_down; + bool default_binds; // List of command binding sections mp_cmd_bind_section_t *cmd_bind_sections; // Name of currently used command section @@ -621,6 +623,8 @@ static const m_option_t input_conf[] = { OPT_STRING("js-dev", input.js_dev, CONF_GLOBAL), OPT_STRING("ar-dev", input.ar_dev, CONF_GLOBAL), OPT_STRING("file", input.in_file, CONF_GLOBAL), + OPT_FLAG_ON("default-binds", input.default_binds, CONF_GLOBAL), + OPT_FLAG_OFF("nodefault-binds", input.default_binds, CONF_GLOBAL), { NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -1059,7 +1063,7 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys, cmd = find_bind_for_key(ictx->cmd_binds, n, keys); if (ictx->cmd_binds_default && cmd == NULL) cmd = find_bind_for_key(ictx->cmd_binds_default, n, keys); - if(cmd == NULL) + if (ictx->default_binds && cmd == NULL) cmd = find_bind_for_key(def_cmd_binds,n,keys); if(cmd == NULL) { @@ -1694,6 +1698,7 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui) .ar_state = -1, .ar_delay = input_conf->ar_delay, .ar_rate = input_conf->ar_rate, + .default_binds = input_conf->default_binds, }; char* file; diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c index e861d08aed..494d44aa19 100644 --- a/libao2/ao_jack.c +++ b/libao2/ao_jack.c @@ -36,7 +36,7 @@ #include "osdep/timer.h" #include "subopt-helper.h" -#include "libvo/fastmemcpy.h" +#include "libavutil/fifo.h" #include <jack/jack.h> @@ -68,47 +68,10 @@ static volatile float callback_time = 0; #define CHUNK_SIZE (16 * 1024) //! number of "virtual" chunks the buffer consists of #define NUM_CHUNKS 8 -// This type of ring buffer may never fill up completely, at least -// one byte must always be unused. -// For performance reasons (alignment etc.) one whole chunk always stays -// empty, not only one byte. -#define BUFFSIZE ((NUM_CHUNKS + 1) * CHUNK_SIZE) +#define BUFFSIZE (NUM_CHUNKS * CHUNK_SIZE) //! buffer for audio data -static unsigned char *buffer = NULL; - -//! buffer read position, may only be modified by playback thread or while it is stopped -static volatile int read_pos; -//! buffer write position, may only be modified by MPlayer's thread -static volatile int write_pos; - -/** - * \brief get the number of free bytes in the buffer - * \return number of free bytes in buffer - * - * may only be called by MPlayer's thread - * return value may change between immediately following two calls, - * and the real number of free bytes might be larger! - */ -static int buf_free(void) { - int free = read_pos - write_pos - CHUNK_SIZE; - if (free < 0) free += BUFFSIZE; - return free; -} - -/** - * \brief get amount of data available in the buffer - * \return number of bytes available in buffer - * - * may only be called by the playback thread - * return value may change between immediately following two calls, - * and the real number of buffered bytes might be larger! - */ -static int buf_used(void) { - int used = write_pos - read_pos; - if (used < 0) used += BUFFSIZE; - return used; -} +static AVFifoBuffer *buffer; /** * \brief insert len bytes into buffer @@ -119,22 +82,34 @@ static int buf_used(void) { * If there is not enough room, the buffer is filled up */ static int write_buffer(unsigned char* data, int len) { - int first_len = BUFFSIZE - write_pos; - int free = buf_free(); + int free = BUFFSIZE - av_fifo_size(buffer); if (len > free) len = free; - if (first_len > len) first_len = len; - // till end of buffer - fast_memcpy (&buffer[write_pos], data, first_len); - if (len > first_len) { // we have to wrap around - // remaining part from beginning of buffer - fast_memcpy (buffer, &data[first_len], len - first_len); - } - write_pos = (write_pos + len) % BUFFSIZE; - return len; + return av_fifo_generic_write(buffer, data, len, NULL); } static void silence(float **bufs, int cnt, int num_bufs); +struct deinterleave { + float **bufs; + int num_bufs; + int cur_buf; + int pos; +}; + +static void deinterleave(void *info, void *src, int len) { + struct deinterleave *di = info; + float *s = src; + int i; + len /= sizeof(float); + for (i = 0; i < len; i++) { + di->bufs[di->cur_buf++][di->pos] = s[i]; + if (di->cur_buf >= di->num_bufs) { + di->cur_buf = 0; + di->pos++; + } + } +} + /** * \brief read data from buffer and splitting it into channels * \param bufs num_bufs float buffers, each will contain the data of one channel @@ -149,18 +124,13 @@ static void silence(float **bufs, int cnt, int num_bufs); * with silence. */ static int read_buffer(float **bufs, int cnt, int num_bufs) { - int buffered = buf_used(); - int i, j; + struct deinterleave di = {bufs, num_bufs, 0, 0}; + int buffered = av_fifo_size(buffer); if (cnt * sizeof(float) * num_bufs > buffered) { silence(bufs, cnt, num_bufs); cnt = buffered / sizeof(float) / num_bufs; } - for (i = 0; i < cnt; i++) { - for (j = 0; j < num_bufs; j++) { - bufs[j][i] = *(float *)&buffer[read_pos]; - read_pos = (read_pos + sizeof(float)) % BUFFSIZE; - } - } + av_fifo_generic_read(buffer, &di, cnt * num_bufs * sizeof(float), deinterleave); return cnt; } @@ -268,7 +238,7 @@ static int init(int rate, int channels, int format, int flags) { mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n"); goto err_out; } - reset(); + buffer = av_fifo_alloc(BUFFSIZE); jack_set_process_callback(client, outputaudio, 0); // list matching ports @@ -308,7 +278,6 @@ static int init(int rate, int channels, int format, int flags) { jack_latency = (float)(jack_port_get_total_latency(client, ports[0]) + jack_get_buffer_size(client)) / (float)rate; callback_interval = 0; - buffer = malloc(BUFFSIZE); ao_data.channels = channels; ao_data.samplerate = rate; @@ -327,7 +296,7 @@ err_out: free(client_name); if (client) jack_client_close(client); - free(buffer); + av_fifo_free(buffer); buffer = NULL; return 0; } @@ -340,7 +309,7 @@ static void uninit(int immed) { reset(); usec_sleep(100 * 1000); jack_client_close(client); - free(buffer); + av_fifo_free(buffer); buffer = NULL; } @@ -349,8 +318,7 @@ static void uninit(int immed) { */ static void reset(void) { paused = 1; - read_pos = 0; - write_pos = 0; + av_fifo_reset(buffer); paused = 0; } @@ -369,7 +337,7 @@ static void audio_resume(void) { } static int get_space(void) { - return buf_free(); + return BUFFSIZE - av_fifo_size(buffer); } /** @@ -383,7 +351,7 @@ static int play(void *data, int len, int flags) { } static float get_delay(void) { - int buffered = BUFFSIZE - CHUNK_SIZE - buf_free(); // could be less + int buffered = av_fifo_size(buffer); // could be less float in_jack = jack_latency; if (estimate && callback_interval > 0) { float elapsed = (float)GetTimer() / 1000000.0 - callback_time; diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 31693be229..63ddec6f29 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -3,8 +3,6 @@ * * Copyleft 2001 by Felix Bünemann (atmosfear@users.sf.net) * - * Thanks to Arpi for nice ringbuffer-code! - * * This file is part of MPlayer. * * MPlayer is free software; you can redistribute it and/or modify @@ -36,7 +34,7 @@ #include <SDL.h> #include "osdep/timer.h" -#include "libvo/fastmemcpy.h" +#include "libavutil/fifo.h" static const ao_info_t info = { @@ -60,76 +58,34 @@ LIBAO_EXTERN(sdl) #define CHUNK_SIZE 4096 #define NUM_CHUNKS 8 -// This type of ring buffer may never fill up completely, at least -// one byte must always be unused. -// For performance reasons (alignment etc.) one whole chunk always stays -// empty, not only one byte. -#define BUFFSIZE ((NUM_CHUNKS + 1) * CHUNK_SIZE) - -static unsigned char *buffer; - -// may only be modified by SDL's playback thread or while it is stopped -static volatile int read_pos; -// may only be modified by mplayer's thread -static volatile int write_pos; +#define BUFFSIZE (NUM_CHUNKS * CHUNK_SIZE) + +static AVFifoBuffer *buffer; + #ifdef USE_SDL_INTERNAL_MIXER static unsigned char volume=SDL_MIX_MAXVOLUME; #endif -// may only be called by mplayer's thread -// return value may change between immediately following two calls, -// and the real number of free bytes might be larger! -static int buf_free(void) { - int free = read_pos - write_pos - CHUNK_SIZE; - if (free < 0) free += BUFFSIZE; - return free; -} - -// may only be called by SDL's playback thread -// return value may change between immediately following two calls, -// and the real number of buffered bytes might be larger! -static int buf_used(void) { - int used = write_pos - read_pos; - if (used < 0) used += BUFFSIZE; - return used; -} - static int write_buffer(unsigned char* data,int len){ - int first_len = BUFFSIZE - write_pos; - int free = buf_free(); + int free = BUFFSIZE - av_fifo_size(buffer); if (len > free) len = free; - if (first_len > len) first_len = len; - // till end of buffer - fast_memcpy (&buffer[write_pos], data, first_len); - if (len > first_len) { // we have to wrap around - // remaining part from beginning of buffer - fast_memcpy (buffer, &data[first_len], len - first_len); - } - write_pos = (write_pos + len) % BUFFSIZE; - return len; + return av_fifo_generic_write(buffer, data, len, NULL); } -static int read_buffer(unsigned char* data,int len){ - int first_len = BUFFSIZE - read_pos; - int buffered = buf_used(); - if (len > buffered) len = buffered; - if (first_len > len) first_len = len; - // till end of buffer #ifdef USE_SDL_INTERNAL_MIXER - SDL_MixAudio (data, &buffer[read_pos], first_len, volume); -#else - fast_memcpy (data, &buffer[read_pos], first_len); +static void mix_audio(void *dst, void *src, int len) { + SDL_MixAudio(dst, src, len, volume); +} #endif - if (len > first_len) { // we have to wrap around - // remaining part from beginning of buffer + +static int read_buffer(unsigned char* data,int len){ + int buffered = av_fifo_size(buffer); + if (len > buffered) len = buffered; #ifdef USE_SDL_INTERNAL_MIXER - SDL_MixAudio (&data[first_len], buffer, len - first_len, volume); + return av_fifo_generic_read(buffer, data, len, mix_audio); #else - fast_memcpy (&data[first_len], buffer, len - first_len); + return av_fifo_generic_read(buffer, data, len, NULL); #endif - } - read_pos = (read_pos + len) % BUFFSIZE; - return len; } // end ring buffer stuff @@ -175,7 +131,7 @@ static int init(int rate,int channels,int format,int flags){ SDL_AudioSpec aspec, obtained; /* Allocate ring-buffer memory */ - buffer = (unsigned char *) malloc(BUFFSIZE); + buffer = av_fifo_alloc(BUFFSIZE); mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format)); @@ -278,7 +234,6 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s ao_data.buffersize=obtained.size; ao_data.outburst = CHUNK_SIZE; - reset(); /* unsilence audio, if callback is ready */ SDL_PauseAudio(0); @@ -292,6 +247,7 @@ static void uninit(int immed){ usec_sleep(get_delay() * 1000 * 1000); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); + av_fifo_free(buffer); } // stop playing and empty buffers (for seeking/pause) @@ -301,8 +257,7 @@ static void reset(void){ SDL_PauseAudio(1); /* Reset ring-buffer state */ - read_pos = 0; - write_pos = 0; + av_fifo_reset(buffer); SDL_PauseAudio(0); } @@ -325,7 +280,7 @@ static void audio_resume(void) // return: how many bytes can be played without blocking static int get_space(void){ - return buf_free(); + return BUFFSIZE - av_fifo_size(buffer); } // plays 'len' bytes of 'data' @@ -352,7 +307,7 @@ static int play(void* data,int len,int flags){ // return: delay in seconds between first and last sample in buffer static float get_delay(void){ - int buffered = BUFFSIZE - CHUNK_SIZE - buf_free(); // could be less + int buffered = av_fifo_size(buffer); // could be less return (float)(buffered + ao_data.buffersize)/(float)ao_data.bps; } diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c index c29e05935f..b2ba0fc573 100644 --- a/libao2/ao_win32.c +++ b/libao2/ao_win32.c @@ -243,8 +243,9 @@ static void uninit(int immed) { if(!immed) usec_sleep(get_delay() * 1000 * 1000); + else waveOutReset(hWaveOut); - waveOutClose(hWaveOut); + while (waveOutClose(hWaveOut) == WAVERR_STILLPLAYING) usec_sleep(0); mp_msg(MSGT_AO, MSGL_V,"waveOut device closed\n"); free(waveBlocks); mp_msg(MSGT_AO, MSGL_V,"buffer memory freed\n"); diff --git a/libass/ass.c b/libass/ass.c index 612c8d6aae..b0c38c2ce4 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -1128,6 +1128,7 @@ long long ass_step_sub(ass_track_t* track, long long now, int movement) { ass_track_t* ass_new_track(ass_library_t* library) { ass_track_t* track = calloc(1, sizeof(ass_track_t)); track->library = library; + track->ScaledBorderAndShadow = 1; track->parser_priv = calloc(1, sizeof(parser_priv_t)); return track; } diff --git a/libass/ass_cache.c b/libass/ass_cache.c index 8b9926915f..2c8ee26f85 100644 --- a/libass/ass_cache.c +++ b/libass/ass_cache.c @@ -192,6 +192,8 @@ static int font_compare(void* key1, void* key2, size_t key_size) { return 0; if (a->italic != b->italic) return 0; + if (a->treat_family_as_pattern != b->treat_family_as_pattern) + return 0; return 1; } diff --git a/libass/ass_font.c b/libass/ass_font.c index f2214a345d..579e658f14 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -125,7 +125,7 @@ static int add_face(void* fc_priv, ass_font_t* font, uint32_t ch) if (font->n_faces == ASS_FONT_MAX_FACES) return -1; - path = fontconfig_select(fc_priv, font->desc.family, font->desc.bold, + path = fontconfig_select(fc_priv, font->desc.family, font->desc.treat_family_as_pattern, font->desc.bold, font->desc.italic, &index, ch); mem_idx = find_font(font->library, path); @@ -169,6 +169,7 @@ ass_font_t* ass_font_new(ass_library_t* library, FT_Library ftlibrary, void* fc_ font.ftlibrary = ftlibrary; font.n_faces = 0; font.desc.family = strdup(desc->family); + font.desc.treat_family_as_pattern = desc->treat_family_as_pattern; font.desc.bold = desc->bold; font.desc.italic = desc->italic; diff --git a/libass/ass_font.h b/libass/ass_font.h index 03396a6f21..520431821b 100644 --- a/libass/ass_font.h +++ b/libass/ass_font.h @@ -33,6 +33,7 @@ typedef struct ass_font_desc_s { char* family; unsigned bold; unsigned italic; + int treat_family_as_pattern; } ass_font_desc_t; #define ASS_FONT_MAX_FACES 10 diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index 9a7bddecc4..d0042dcdfd 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -66,14 +66,15 @@ struct fc_instance_s { * \brief Low-level font selection. * \param priv private data * \param family font family + * \param treat_family_as_pattern treat family as fontconfig pattern * \param bold font weight value * \param italic font slant value * \param index out: font index inside a file * \param code: the character that should be present in the font, can be 0 * \return font file path */ -static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold, unsigned italic, int* index, - uint32_t code) +static char* _select_font(fc_instance_t* priv, const char* family, int treat_family_as_pattern, + unsigned bold, unsigned italic, int* index, uint32_t code) { FcBool rc; FcResult result; @@ -89,34 +90,40 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold *index = 0; - pat = FcPatternCreate(); + if (treat_family_as_pattern) + pat = FcNameParse((const FcChar8*)family); + else + pat = FcPatternCreate(); + if (!pat) goto error; - FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)family); - - // In SSA/ASS fonts are sometimes referenced by their "full name", - // which is usually a concatenation of family name and font - // style (ex. Ottawa Bold). Full name is available from - // FontConfig pattern element FC_FULLNAME, but it is never - // used for font matching. - // Therefore, I'm removing words from the end of the name one - // by one, and adding shortened names to the pattern. It seems - // that the first value (full name in this case) has - // precedence in matching. - // An alternative approach could be to reimplement FcFontSort - // using FC_FULLNAME instead of FC_FAMILY. - family_cnt = 1; - { - char* s = strdup(family); - char* p = s + strlen(s); - while (--p > s) - if (*p == ' ' || *p == '-') { - *p = '\0'; - FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)s); - ++ family_cnt; - } - free(s); + if (!treat_family_as_pattern) { + FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)family); + + // In SSA/ASS fonts are sometimes referenced by their "full name", + // which is usually a concatenation of family name and font + // style (ex. Ottawa Bold). Full name is available from + // FontConfig pattern element FC_FULLNAME, but it is never + // used for font matching. + // Therefore, I'm removing words from the end of the name one + // by one, and adding shortened names to the pattern. It seems + // that the first value (full name in this case) has + // precedence in matching. + // An alternative approach could be to reimplement FcFontSort + // using FC_FULLNAME instead of FC_FAMILY. + family_cnt = 1; + { + char* s = strdup(family); + char* p = s + strlen(s); + while (--p > s) + if (*p == ' ' || *p == '-') { + *p = '\0'; + FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)s); + ++ family_cnt; + } + free(s); + } } FcPatternAddBool(pat, FC_OUTLINE, FcTrue); FcPatternAddInteger(pat, FC_SLANT, italic); @@ -182,7 +189,8 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold if (result != FcResultMatch) r_fullname = NULL; - if (!(r_family && strcasecmp((const char*)r_family, family) == 0) && + if (!treat_family_as_pattern && + !(r_family && strcasecmp((const char*)r_family, family) == 0) && !(r_fullname && strcasecmp((const char*)r_fullname, family) == 0)) mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, (const char*)(r_fullname ? r_fullname : r_family), family); @@ -219,14 +227,15 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold * \brief Find a font. Use default family or path if necessary. * \param priv_ private data * \param family font family + * \param treat_family_as_pattern treat family as fontconfig pattern * \param bold font weight value * \param italic font slant value * \param index out: font index inside a file * \param code: the character that should be present in the font, can be 0 * \return font file path */ -char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, unsigned italic, int* index, - uint32_t code) +char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_family_as_pattern, + unsigned bold, unsigned italic, int* index, uint32_t code) { char* res = 0; if (!priv->config) { @@ -234,9 +243,9 @@ char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, return priv->path_default; } if (family && *family) - res = _select_font(priv, family, bold, italic, index, code); + res = _select_font(priv, family, treat_family_as_pattern, bold, italic, index, code); if (!res && priv->family_default) { - res = _select_font(priv, priv->family_default, bold, italic, index, code); + res = _select_font(priv, priv->family_default, 0, bold, italic, index, code); if (res) mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily, family, bold, italic, res, *index); @@ -248,7 +257,7 @@ char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, family, bold, italic, res, *index); } if (!res) { - res = _select_font(priv, "Arial", bold, italic, index, code); + res = _select_font(priv, "Arial", 0, bold, italic, index, code); if (res) mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily, family, bold, italic, res, *index); @@ -474,8 +483,8 @@ exit: #else /* CONFIG_FONTCONFIG */ -char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, unsigned italic, int* index, - uint32_t code) +char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_family_as_pattern, + unsigned bold, unsigned italic, int* index, uint32_t code) { *index = priv->index_default; return priv->path_default; diff --git a/libass/ass_fontconfig.h b/libass/ass_fontconfig.h index e9a1ce1567..77806909cf 100644 --- a/libass/ass_fontconfig.h +++ b/libass/ass_fontconfig.h @@ -35,7 +35,7 @@ typedef struct fc_instance_s fc_instance_t; fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, const char* family, const char* path, int fc); -char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, unsigned italic, int* index, uint32_t code); +char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_family_as_pattern, unsigned bold, unsigned italic, int* index, uint32_t code); void fontconfig_done(fc_instance_t* priv); #endif /* LIBASS_FONTCONFIG_H */ diff --git a/libass/ass_mp.c b/libass/ass_mp.c index 40da63c348..7e25b8e316 100644 --- a/libass/ass_mp.c +++ b/libass/ass_mp.c @@ -94,6 +94,7 @@ ass_track_t* ass_default_track(ass_library_t* library) { style = track->styles + sid; style->Name = strdup("Default"); style->FontName = (font_fontconfig >= 0 && sub_font_name) ? strdup(sub_font_name) : (font_fontconfig >= 0 && font_name) ? strdup(font_name) : strdup("Sans"); + style->treat_fontname_as_pattern = 1; fs = track->PlayResY * text_font_scale_factor / 100.; // approximate autoscale coefficients diff --git a/libass/ass_render.c b/libass/ass_render.c index 5eb28ccff0..e52195e023 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -184,6 +184,7 @@ typedef struct render_context_s { char* family; unsigned bold; unsigned italic; + int treat_family_as_pattern; } render_context_t; @@ -423,10 +424,12 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h int ax = (*last_tail)->dst_x; int ay = (*last_tail)->dst_y; int aw = (*last_tail)->w; + int as = (*last_tail)->stride; int ah = (*last_tail)->h; int bx = (*tail)->dst_x; int by = (*tail)->dst_y; int bw = (*tail)->w; + int bs = (*tail)->stride; int bh = (*tail)->h; unsigned char* a; unsigned char* b; @@ -434,6 +437,9 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h if ((*last_tail)->bitmap == (*tail)->bitmap) return; + if ((*last_tail)->color != (*tail)->color) + return; + // Calculate overlap coordinates left = (ax > bx) ? ax : bx; top = (ay > by) ? ay : by; @@ -441,12 +447,12 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h bottom = ((ay+ah) < (by+bh)) ? (ay+ah) : (by+bh); if ((right <= left) || (bottom <= top)) return; - old_left = left-(ax); - old_top = top-(ay); + old_left = left-ax; + old_top = top-ay; w = right-left; h = bottom-top; - cur_left = left-(bx); - cur_top = top-(by); + cur_left = left-bx; + cur_top = top-by; // Query cache memcpy(&hk.a, last_hash, sizeof(*last_hash)); @@ -469,16 +475,16 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h // Allocate new bitmaps and copy over data a = (*last_tail)->bitmap; b = (*tail)->bitmap; - (*last_tail)->bitmap = malloc(aw*ah); - (*tail)->bitmap = malloc(bw*bh); - memcpy((*last_tail)->bitmap, a, aw*ah); - memcpy((*tail)->bitmap, b, bw*bh); + (*last_tail)->bitmap = malloc(as*ah); + (*tail)->bitmap = malloc(bs*bh); + memcpy((*last_tail)->bitmap, a, as*ah); + memcpy((*tail)->bitmap, b, bs*bh); // Composite overlapping area for (y=0; y<h; y++) for (x=0; x<w; x++) { - opos = (old_top+y)*(aw) + (old_left+x); - cpos = (cur_top+y)*(bw) + (cur_left+x); + opos = (old_top+y)*(as) + (old_left+x); + cpos = (cur_top+y)*(bs) + (cur_left+x); m = (a[opos] > b[cpos]) ? a[opos] : b[cpos]; (*last_tail)->bitmap[opos] = 0; (*tail)->bitmap[cpos] = m; @@ -671,6 +677,7 @@ static void update_font(void) ass_renderer_t* priv = frame_context.ass_priv; ass_font_desc_t desc; desc.family = strdup(render_context.family); + desc.treat_family_as_pattern = render_context.treat_family_as_pattern; val = render_context.bold; // 0 = normal, 1 = bold, >1 = exact weight @@ -1062,10 +1069,12 @@ static char* parse_tag(char* p, double pwr) { skip(')'); mp_msg(MSGT_ASS, MSGL_DBG2, "org(%d, %d)\n", v1, v2); // render_context.evt_type = EVENT_POSITIONED; - render_context.org_x = v1; - render_context.org_y = v2; - render_context.have_origin = 1; - render_context.detect_collisions = 0; + if (!render_context.have_origin) { + render_context.org_x = v1; + render_context.org_y = v2; + render_context.have_origin = 1; + render_context.detect_collisions = 0; + } } else if (mystrcmp(&p, "t")) { double v[3]; int v1, v2; @@ -1355,6 +1364,7 @@ static void reset_render_context(void) if (render_context.family) free(render_context.family); render_context.family = strdup(render_context.style->FontName); + render_context.treat_family_as_pattern = render_context.style->treat_fontname_as_pattern; render_context.bold = render_context.style->Bold; render_context.italic = render_context.style->Italic; update_font(); @@ -1797,75 +1807,46 @@ static void get_base_point(FT_BBox bbox, int alignment, int* bx, int* by) } /** - * \brief Multiply 4-vector by 4-matrix - * \param a 4-vector - * \param m 4-matrix] - * \param b out: 4-vector - * Calculates a * m and stores result in b + * \brief Apply transformation to outline points of a glyph + * Applies rotations given by frx, fry and frz and projects the points back + * onto the screen plane. */ -static inline void transform_point_3d(double *a, double *m, double *b) -{ - b[0] = a[0] * m[0] + a[1] * m[4] + a[2] * m[8] + a[3] * m[12]; - b[1] = a[0] * m[1] + a[1] * m[5] + a[2] * m[9] + a[3] * m[13]; - b[2] = a[0] * m[2] + a[1] * m[6] + a[2] * m[10] + a[3] * m[14]; - b[3] = a[0] * m[3] + a[1] * m[7] + a[2] * m[11] + a[3] * m[15]; -} - -/** - * \brief Apply 3d transformation to a vector - * \param v FreeType vector (2d) - * \param m 4-matrix - * Transforms v by m, projects the result back to the screen plane - * Result is returned in v. - */ -static inline void transform_vector_3d(FT_Vector* v, double *m) { - const double camera = 2500 * frame_context.border_scale; // camera distance - const double cutoff_z = 10.; - double a[4], b[4]; - a[0] = d6_to_double(v->x); - a[1] = d6_to_double(v->y); - a[2] = 0.; - a[3] = 1.; - transform_point_3d(a, m, b); - /* Apply perspective projection with the following matrix: - 2500 0 0 0 - 0 2500 0 0 - 0 0 0 0 - 0 0 8 2500 - where 2500 is camera distance, 8 - z-axis scale. - Camera is always located in (org_x, org_y, -2500). This means - that different subtitle events can be displayed at the same time - using different cameras. */ - b[0] *= camera; - b[1] *= camera; - b[3] = 8 * b[2] + camera; - if (b[3] < cutoff_z) - b[3] = cutoff_z; - v->x = double_to_d6(b[0] / b[3]); - v->y = double_to_d6(b[1] / b[3]); -} - -/** - * \brief Apply 3d transformation to a glyph - * \param glyph FreeType glyph - * \param m 4-matrix - * Transforms glyph by m, projects the result back to the screen plane - * Result is returned in glyph. - */ -static inline void transform_glyph_3d(FT_Glyph glyph, double *m, FT_Vector shift) { - int i; - FT_Outline* outline = &((FT_OutlineGlyph)glyph)->outline; +static void transform_3d_points(FT_Vector shift, FT_Glyph glyph, double frx, double fry, double frz) { + double sx = sin(frx); + double sy = sin(fry); + double sz = sin(frz); + double cx = cos(frx); + double cy = cos(fry); + double cz = cos(frz); + FT_Outline *outline = &((FT_OutlineGlyph) glyph)->outline; FT_Vector* p = outline->points; + double x, y, z, xx, yy, zz; + int i; for (i=0; i<outline->n_points; i++) { - p[i].x += shift.x; - p[i].y += shift.y; - transform_vector_3d(p + i, m); - p[i].x -= shift.x; - p[i].y -= shift.y; - } + x = p[i].x + shift.x; + y = p[i].y + shift.y; + z = 0.; + + xx = x*cz + y*sz; + yy = -(x*sz - y*cz); + zz = z; - //transform_vector_3d(&glyph->advance, m); + x = xx; + y = yy*cx + zz*sx; + z = yy*sx - zz*cx; + + xx = x*cy + z*sy; + yy = y; + zz = x*sy - z*cy; + + zz = FFMAX(zz, -19000); + + x = (xx * 20000) / (zz + 20000); + y = (yy * 20000) / (zz + 20000); + p[i].x = x - shift.x + 0.5; + p[i].y = y - shift.y + 0.5; + } } /** @@ -1880,28 +1861,18 @@ static inline void transform_glyph_3d(FT_Glyph glyph, double *m, FT_Vector shift */ static void transform_3d(FT_Vector shift, FT_Glyph* glyph, FT_Glyph* glyph2, double frx, double fry, double frz) { - fry = - fry; // FreeType's y axis goes in the opposite direction + frx = - frx; + frz = - frz; if (frx != 0. || fry != 0. || frz != 0.) { - double m[16]; - double sx = sin(frx); - double sy = sin(fry); - double sz = sin(frz); - double cx = cos(frx); - double cy = cos(fry); - double cz = cos(frz); - m[0] = cy * cz; m[1] = cy*sz; m[2] = -sy; m[3] = 0.0; - m[4] = -cx*sz + sx*sy*cz; m[5] = cx*cz + sx*sy*sz; m[6] = sx*cy; m[7] = 0.0; - m[8] = sx*sz + cx*sy*cz; m[9] = -sx*cz + cx*sy*sz; m[10] = cx*cy; m[11] = 0.0; - m[12] = 0.0; m[13] = 0.0; m[14] = 0.0; m[15] = 1.0; - if (glyph && *glyph) - transform_glyph_3d(*glyph, m, shift); + transform_3d_points(shift, *glyph, frx, fry, frz); if (glyph2 && *glyph2) - transform_glyph_3d(*glyph2, m, shift); + transform_3d_points(shift, *glyph2, frx, fry, frz); } } + /** * \brief Main ass rendering function, glues everything together * \param event event to render @@ -2145,11 +2116,11 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images) } // fix clip coordinates (they depend on alignment) - render_context.clip_x0 = x2scr(render_context.clip_x0); - render_context.clip_x1 = x2scr(render_context.clip_x1); if (render_context.evt_type == EVENT_NORMAL || render_context.evt_type == EVENT_HSCROLL || render_context.evt_type == EVENT_VSCROLL) { + render_context.clip_x0 = x2scr(render_context.clip_x0); + render_context.clip_x1 = x2scr(render_context.clip_x1); if (valign == VALIGN_TOP) { render_context.clip_y0 = y2scr_top(render_context.clip_y0); render_context.clip_y1 = y2scr_top(render_context.clip_y1); @@ -2161,8 +2132,10 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images) render_context.clip_y1 = y2scr_sub(render_context.clip_y1); } } else if (render_context.evt_type == EVENT_POSITIONED) { - render_context.clip_y0 = y2scr(render_context.clip_y0); - render_context.clip_y1 = y2scr(render_context.clip_y1); + render_context.clip_x0 = x2scr_pos(render_context.clip_x0); + render_context.clip_x1 = x2scr_pos(render_context.clip_x1); + render_context.clip_y0 = y2scr_pos(render_context.clip_y0); + render_context.clip_y1 = y2scr_pos(render_context.clip_y1); } // calculate rotation parameters diff --git a/libass/ass_types.h b/libass/ass_types.h index 52aff0fb85..01c36c5748 100644 --- a/libass/ass_types.h +++ b/libass/ass_types.h @@ -58,6 +58,7 @@ typedef struct ass_style_s { int MarginV; // int AlphaLevel; int Encoding; + int treat_fontname_as_pattern; } ass_style_t; typedef struct render_priv_s render_priv_t; diff --git a/libmpcodecs/native/nuppelvideo.c b/libmpcodecs/native/nuppelvideo.c deleted file mode 100644 index 8128f85c47..0000000000 --- a/libmpcodecs/native/nuppelvideo.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * NuppelVideo 0.05 file parser - * for MPlayer - * by Panagiotis Issaris <takis@lumumba.luc.ac.be> - * - * Reworked by alex - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -#include "config.h" -#include "mp_msg.h" -#include "mpbswap.h" - -#include "libvo/fastmemcpy.h" - -#include "libmpdemux/nuppelvideo.h" -#include "rtjpegn.h" -#include "libavutil/lzo.h" - -#define KEEP_BUFFER - -void decode_nuv( unsigned char *encoded, int encoded_size, - unsigned char *decoded, int width, int height) -{ - int r; - unsigned int out_len = width * height + ( width * height ) / 2; - struct rtframeheader *encodedh = ( struct rtframeheader* ) encoded; - static unsigned char *buffer = 0; /* for RTJpeg with LZO decompress */ -#ifdef KEEP_BUFFER - static unsigned char *previous_buffer = 0; /* to support Last-frame-copy */ -#endif - -// printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n", -// encodedh->frametype, encodedh->comptype, encoded_size, width, height); - - le2me_rtframeheader(encodedh); - switch(encodedh->frametype) - { - case 'D': /* additional data for compressors */ - { - /* tables are in encoded */ - if (encodedh->comptype == 'R') - { - RTjpeg_init_decompress ( (unsigned long *)(encoded+12), width, height ); - mp_msg(MSGT_DECVIDEO, MSGL_V, "Found RTjpeg tables (size: %d, width: %d, height: %d)\n", - encoded_size-12, width, height); - } - break; - } - case 'V': - { - int in_len = encodedh->packetlength; -#ifdef KEEP_BUFFER - if (!previous_buffer) - previous_buffer = ( unsigned char * ) malloc ( out_len + AV_LZO_OUTPUT_PADDING ); -#endif - - switch(encodedh->comptype) - { - case '0': /* raw YUV420 */ - fast_memcpy(decoded, encoded + 12, out_len); - break; - case '1': /* RTJpeg */ - RTjpeg_decompressYUV420 ( ( __s8 * ) encoded + 12, decoded ); - break; - case '2': /* RTJpeg with LZO */ - if (!buffer) - buffer = ( unsigned char * ) malloc ( out_len + AV_LZO_OUTPUT_PADDING ); - if (!buffer) - { - mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); - break; - } - r = av_lzo1x_decode ( buffer, &out_len, encoded + 12, &in_len ); - if ( r ) - { - mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); - break; - } - RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded ); - break; - case '3': /* raw YUV420 with LZO */ - r = av_lzo1x_decode ( decoded, &out_len, encoded + 12, &in_len ); - if ( r ) - { - mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n"); - break; - } - break; - case 'N': /* black frame */ - memset ( decoded, 0, width * height ); - memset ( decoded + width * height, 127, width * height / 2); - break; - case 'L': /* copy last frame */ -#ifdef KEEP_BUFFER - fast_memcpy ( decoded, previous_buffer, width*height*3/2); -#endif - break; - } - -#ifdef KEEP_BUFFER - fast_memcpy(previous_buffer, decoded, width*height*3/2); -#endif - break; - } - default: - mp_msg(MSGT_DECVIDEO, MSGL_V, "Nuppelvideo: unknwon frametype: %c\n", - encodedh->frametype); - } -} diff --git a/libmpcodecs/native/rtjpegn.c b/libmpcodecs/native/rtjpegn.c index b97e507817..0eea073b61 100644 --- a/libmpcodecs/native/rtjpegn.c +++ b/libmpcodecs/native/rtjpegn.c @@ -68,7 +68,7 @@ static const __u64 RTjpeg_aan_tab[64]={ #if !HAVE_MMX static __s32 RTjpeg_ws[64+31]; #endif -__u8 RTjpeg_alldata[2*64+4*64+4*64+4*64+4*64+32]; +static __u8 RTjpeg_alldata[2*64+4*64+4*64+4*64+4*64+32]; static __s16 *block; // rh static __s16 *RTjpeg_block; @@ -86,13 +86,12 @@ static int RTjpeg_Ysize, RTjpeg_Csize; static __s16 *RTjpeg_old=NULL; #if HAVE_MMX -mmx_t RTjpeg_lmask; -mmx_t RTjpeg_cmask; +static mmx_t RTjpeg_lmask; +static mmx_t RTjpeg_cmask; #else -__u16 RTjpeg_lmask; -__u16 RTjpeg_cmask; +static __u16 RTjpeg_lmask; +static __u16 RTjpeg_cmask; #endif -int RTjpeg_mtest=0; static const unsigned char RTjpeg_lum_quant_tbl[64] = { 16, 11, 10, 16, 24, 40, 51, 61, @@ -150,11 +149,6 @@ static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) #endif -// *strm++ = 0x10; -// *strm = 0x00; -// -// return 2; - // first byte allways written ((__u8*)strm)[0]= (__u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]); @@ -299,152 +293,6 @@ fprintf(stdout, "\n\n"); return (int)co; } -/* +++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* Stream to Block (decoding) */ -/* */ - -static int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl) -{ - int ci; - register int co; - register int i; - register unsigned char bitten; - register unsigned char bitoff; - - /* first byte always read */ - i=RTjpeg_ZZ[0]; - data[i]=((__u8)strm[0])*qtbl[i]; - - /* we start at the behind */ - - bitten = ((unsigned char)strm[1]) >> 2; - co = 63; - for(; co > bitten; co--) { - - data[RTjpeg_ZZ[co]] = 0; - - } - - if (co==0) { - ci = 2; - goto AUTOBAHN; - } - - /* we have to read the last 2 bits of the second byte */ - ci=1; - bitoff = 0; - - for(; co>0; co--) { - - bitten = ((unsigned char)strm[ci]) >> bitoff; - bitten &= 0x03; - - i=RTjpeg_ZZ[co]; - - switch( bitten ) { - case 0x03: - data[i]= -qtbl[i]; - break; - case 0x02: - goto FUSSWEG; - break; - case 0x01: - data[i]= qtbl[i]; - break; - case 0x00: - data[i]= 0; - break; - default: - break; - } - - if( bitoff == 0 ) { - bitoff = 8; - ci++; - } - bitoff -= 2; - } - /* co is 0 now */ - /* data is written properly */ - - /* if bitoff!=6 then ci is the index, but should be the byte count, so we increment by 1 */ - if (bitoff!=6) ci++; - - goto AUTOBAHN; - - -FUSSWEG: -/* correct bitoff to nibble */ - switch(bitoff){ - case 4: - case 6: - bitoff = 0; - break; - case 2: - case 0: - /* we have to read from the next byte */ - ci++; - bitoff = 4; - break; - default: - break; - } - - for(; co>0; co--) { - - bitten = ((unsigned char)strm[ci]) >> bitoff; - bitten &= 0x0f; - - i=RTjpeg_ZZ[co]; - - if( bitten == 0x08 ) { - goto STRASSE; - } - - /* the compiler cannot do sign extension for signed nibbles */ - if( bitten & 0x08 ) { - bitten |= 0xf0; - } - /* the unsigned char bitten now is a valid signed char */ - - data[i]=((signed char)bitten)*qtbl[i]; - - if( bitoff == 0 ) { - bitoff = 8; - ci++; - } - bitoff -= 4; - } - /* co is 0 */ - - /* if bitoff!=4 then ci is the index, but should be the byte count, so we increment by 1 */ - if (bitoff!=4) ci++; - - goto AUTOBAHN; - -STRASSE: - ci++; - - for(; co>0; co--) { - i=RTjpeg_ZZ[co]; - data[i]=strm[ci++]*qtbl[i]; - } - - /* ci now is the count, because it points to next element => no incrementing */ - -AUTOBAHN: - -#ifdef SHOWBLOCK -fprintf(stdout, "\nci = '%d'\n", ci); - for (i=0; i < 64; i++) { - fprintf(stdout, "%d ", data[RTjpeg_ZZ[i]]); - } -fprintf(stdout, "\n\n"); -#endif - - return ci; -} - #else static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) @@ -1542,1148 +1390,6 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) #endif } -#define FIX_1_082392200 ((__s32) 277) /* FIX(1.082392200) */ -#define FIX_1_414213562 ((__s32) 362) /* FIX(1.414213562) */ -#define FIX_1_847759065 ((__s32) 473) /* FIX(1.847759065) */ -#define FIX_2_613125930 ((__s32) 669) /* FIX(2.613125930) */ - -#define DESCALE(x) (__s16)( ((x)+4) >> 3) - -/* clip yuv to 16..235 (should be 16..240 for cr/cb but ... */ - -#define RL(x) ((x)>235) ? 235 : (((x)<16) ? 16 : (x)) -#define MULTIPLY(var,const) (((__s32) ((var) * (const)) + 128)>>8) - -static void RTjpeg_idct_init(void) -{ - int i; - - for(i=0; i<64; i++) - { - RTjpeg_liqt[i]=((__u64)RTjpeg_liqt[i]*RTjpeg_aan_tab[i])>>32; - RTjpeg_ciqt[i]=((__u64)RTjpeg_ciqt[i]*RTjpeg_aan_tab[i])>>32; - } -} - -static void RTjpeg_idct(__u8 *odata, __s16 *data, int rskip) -{ -#if HAVE_MMX - -static mmx_t fix_141 = {0x5a825a825a825a82LL}; -static mmx_t fix_184n261 = {0xcf04cf04cf04cf04LL}; -static mmx_t fix_184 = {0x7641764176417641LL}; -static mmx_t fix_n184 = {0x896f896f896f896fLL}; -static mmx_t fix_108n184 = {0xcf04cf04cf04cf04LL}; - - mmx_t workspace[64]; - mmx_t *wsptr = workspace; - register mmx_t *dataptr = (mmx_t *)odata; - mmx_t *idata = (mmx_t *)data; - - rskip = rskip>>3; -/* - * Perform inverse DCT on one block of coefficients. - */ - - /* Odd part */ - - movq_m2r(*(idata+10), mm1); // load idata[DCTSIZE*5] - - movq_m2r(*(idata+6), mm0); // load idata[DCTSIZE*3] - - movq_m2r(*(idata+2), mm3); // load idata[DCTSIZE*1] - - movq_r2r(mm1, mm2); // copy tmp6 /* phase 6 */ - - movq_m2r(*(idata+14), mm4); // load idata[DCTSIZE*7] - - paddw_r2r(mm0, mm1); // z13 = tmp6 + tmp5; - - psubw_r2r(mm0, mm2); // z10 = tmp6 - tmp5 - - psllw_i2r(2, mm2); // shift z10 - movq_r2r(mm2, mm0); // copy z10 - - pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ - movq_r2r(mm3, mm5); // copy tmp4 - - pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ - paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7; - - movq_r2r(mm3, mm6); // copy z11 /* phase 5 */ - psubw_r2r(mm4, mm5); // z12 = tmp4 - tmp7; - - psubw_r2r(mm1, mm6); // z11-z13 - psllw_i2r(2, mm5); // shift z12 - - movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part - movq_r2r(mm5, mm7); // copy z12 - - pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part - paddw_r2r(mm1, mm3); // tmp7 = z11 + z13; - - //ok - - /* Even part */ - pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ - psllw_i2r(2, mm6); - - movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2] - - paddw_r2r(mm5, mm0); // tmp10 - - paddw_r2r(mm7, mm2); // tmp12 - - pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ - psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7 - - movq_r2r(mm1, mm5); // copy tmp1 - paddw_r2r(mm4, mm1); // tmp13= tmp1 + tmp3; /* phases 5-3 */ - - psubw_r2r(mm4, mm5); // tmp1-tmp3 - psubw_r2r(mm2, mm6); // tmp5 = tmp11 - tmp6; - - movq_r2m(mm1, *(wsptr)); // save tmp13 in workspace - psllw_i2r(2, mm5); // shift tmp1-tmp3 - - movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0] - - pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5; - - movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4] - - psubw_r2r(mm1, mm5); // tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ - - movq_r2m(mm0, *(wsptr+4)); // save tmp4 in workspace - movq_r2r(mm7, mm1); // copy tmp0 /* phase 3 */ - - movq_r2m(mm5, *(wsptr+2)); // save tmp12 in workspace - psubw_r2r(mm4, mm1); // tmp11 = tmp0 - tmp2; - - paddw_r2r(mm4, mm7); // tmp10 = tmp0 + tmp2; - movq_r2r(mm1, mm5); // copy tmp11 - - paddw_m2r(*(wsptr+2), mm1); // tmp1 = tmp11 + tmp12; - movq_r2r(mm7, mm4); // copy tmp10 /* phase 2 */ - - paddw_m2r(*(wsptr), mm7); // tmp0 = tmp10 + tmp13; - - psubw_m2r(*(wsptr), mm4); // tmp3 = tmp10 - tmp13; - movq_r2r(mm7, mm0); // copy tmp0 - - psubw_m2r(*(wsptr+2), mm5); // tmp2 = tmp11 - tmp12; - paddw_r2r(mm3, mm7); // wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); - - psubw_r2r(mm3, mm0); // wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); - - movq_r2m(mm7, *(wsptr)); // wsptr[DCTSIZE*0] - movq_r2r(mm1, mm3); // copy tmp1 - - movq_r2m(mm0, *(wsptr+14)); // wsptr[DCTSIZE*7] - paddw_r2r(mm2, mm1); // wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); - - psubw_r2r(mm2, mm3); // wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); - - movq_r2m(mm1, *(wsptr+2)); // wsptr[DCTSIZE*1] - movq_r2r(mm4, mm1); // copy tmp3 - - movq_r2m(mm3, *(wsptr+12)); // wsptr[DCTSIZE*6] - - paddw_m2r(*(wsptr+4), mm4); // wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); - - psubw_m2r(*(wsptr+4), mm1); // wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); - - movq_r2m(mm4, *(wsptr+8)); - movq_r2r(mm5, mm7); // copy tmp2 - - paddw_r2r(mm6, mm5); // wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) - - movq_r2m(mm1, *(wsptr+6)); - psubw_r2r(mm6, mm7); // wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); - - movq_r2m(mm5, *(wsptr+4)); - - movq_r2m(mm7, *(wsptr+10)); - - //ok - - -/*****************************************************************/ - - idata++; - wsptr++; - -/*****************************************************************/ - - movq_m2r(*(idata+10), mm1); // load idata[DCTSIZE*5] - - movq_m2r(*(idata+6), mm0); // load idata[DCTSIZE*3] - - movq_m2r(*(idata+2), mm3); // load idata[DCTSIZE*1] - movq_r2r(mm1, mm2); // copy tmp6 /* phase 6 */ - - movq_m2r(*(idata+14), mm4); // load idata[DCTSIZE*7] - paddw_r2r(mm0, mm1); // z13 = tmp6 + tmp5; - - psubw_r2r(mm0, mm2); // z10 = tmp6 - tmp5 - - psllw_i2r(2, mm2); // shift z10 - movq_r2r(mm2, mm0); // copy z10 - - pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ - movq_r2r(mm3, mm5); // copy tmp4 - - pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ - paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7; - - movq_r2r(mm3, mm6); // copy z11 /* phase 5 */ - psubw_r2r(mm4, mm5); // z12 = tmp4 - tmp7; - - psubw_r2r(mm1, mm6); // z11-z13 - psllw_i2r(2, mm5); // shift z12 - - movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part - movq_r2r(mm5, mm7); // copy z12 - - pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part - paddw_r2r(mm1, mm3); // tmp7 = z11 + z13; - - //ok - - /* Even part */ - pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ - psllw_i2r(2, mm6); - - movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2] - - paddw_r2r(mm5, mm0); // tmp10 - - paddw_r2r(mm7, mm2); // tmp12 - - pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ - psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7 - - movq_r2r(mm1, mm5); // copy tmp1 - paddw_r2r(mm4, mm1); // tmp13= tmp1 + tmp3; /* phases 5-3 */ - - psubw_r2r(mm4, mm5); // tmp1-tmp3 - psubw_r2r(mm2, mm6); // tmp5 = tmp11 - tmp6; - - movq_r2m(mm1, *(wsptr)); // save tmp13 in workspace - psllw_i2r(2, mm5); // shift tmp1-tmp3 - - movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0] - paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5; - - pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - - movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4] - - psubw_r2r(mm1, mm5); // tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ - - movq_r2m(mm0, *(wsptr+4)); // save tmp4 in workspace - movq_r2r(mm7, mm1); // copy tmp0 /* phase 3 */ - - movq_r2m(mm5, *(wsptr+2)); // save tmp12 in workspace - psubw_r2r(mm4, mm1); // tmp11 = tmp0 - tmp2; - - paddw_r2r(mm4, mm7); // tmp10 = tmp0 + tmp2; - movq_r2r(mm1, mm5); // copy tmp11 - - paddw_m2r(*(wsptr+2), mm1); // tmp1 = tmp11 + tmp12; - movq_r2r(mm7, mm4); // copy tmp10 /* phase 2 */ - - paddw_m2r(*(wsptr), mm7); // tmp0 = tmp10 + tmp13; - - psubw_m2r(*(wsptr), mm4); // tmp3 = tmp10 - tmp13; - movq_r2r(mm7, mm0); // copy tmp0 - - psubw_m2r(*(wsptr+2), mm5); // tmp2 = tmp11 - tmp12; - paddw_r2r(mm3, mm7); // wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); - - psubw_r2r(mm3, mm0); // wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); - - movq_r2m(mm7, *(wsptr)); // wsptr[DCTSIZE*0] - movq_r2r(mm1, mm3); // copy tmp1 - - movq_r2m(mm0, *(wsptr+14)); // wsptr[DCTSIZE*7] - paddw_r2r(mm2, mm1); // wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); - - psubw_r2r(mm2, mm3); // wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); - - movq_r2m(mm1, *(wsptr+2)); // wsptr[DCTSIZE*1] - movq_r2r(mm4, mm1); // copy tmp3 - - movq_r2m(mm3, *(wsptr+12)); // wsptr[DCTSIZE*6] - - paddw_m2r(*(wsptr+4), mm4); // wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); - - psubw_m2r(*(wsptr+4), mm1); // wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); - - movq_r2m(mm4, *(wsptr+8)); - movq_r2r(mm5, mm7); // copy tmp2 - - paddw_r2r(mm6, mm5); // wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) - - movq_r2m(mm1, *(wsptr+6)); - psubw_r2r(mm6, mm7); // wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); - - movq_r2m(mm5, *(wsptr+4)); - - movq_r2m(mm7, *(wsptr+10)); - -/*****************************************************************/ - - /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - -/*****************************************************************/ - /* Even part */ - - wsptr--; - -// tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); -// tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); -// tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); -// tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); - movq_m2r(*(wsptr), mm0); // wsptr[0,0],[0,1],[0,2],[0,3] - - movq_m2r(*(wsptr+1), mm1); // wsptr[0,4],[0,5],[0,6],[0,7] - movq_r2r(mm0, mm2); - - movq_m2r(*(wsptr+2), mm3); // wsptr[1,0],[1,1],[1,2],[1,3] - paddw_r2r(mm1, mm0); // wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] - - movq_m2r(*(wsptr+3), mm4); // wsptr[1,4],[1,5],[1,6],[1,7] - psubw_r2r(mm1, mm2); // wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] - - movq_r2r(mm0, mm6); - movq_r2r(mm3, mm5); - - paddw_r2r(mm4, mm3); // wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] - movq_r2r(mm2, mm1); - - psubw_r2r(mm4, mm5); // wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] - punpcklwd_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] - - movq_m2r(*(wsptr+7), mm7); // wsptr[3,4],[3,5],[3,6],[3,7] - punpckhwd_r2r(mm3, mm6); // wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] - - movq_m2r(*(wsptr+4), mm3); // wsptr[2,0],[2,1],[2,2],[2,3] - punpckldq_r2r(mm6, mm0); // wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] - - punpcklwd_r2r(mm5, mm1); // wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] - movq_r2r(mm3, mm4); - - movq_m2r(*(wsptr+6), mm6); // wsptr[3,0],[3,1],[3,2],[3,3] - punpckhwd_r2r(mm5, mm2); // wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] - - movq_m2r(*(wsptr+5), mm5); // wsptr[2,4],[2,5],[2,6],[2,7] - punpckldq_r2r(mm2, mm1); // wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] - - - paddw_r2r(mm5, mm3); // wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] - movq_r2r(mm6, mm2); - - psubw_r2r(mm5, mm4); // wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] - paddw_r2r(mm7, mm6); // wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] - - movq_r2r(mm3, mm5); - punpcklwd_r2r(mm6, mm3); // wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] - - psubw_r2r(mm7, mm2); // wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] - punpckhwd_r2r(mm6, mm5); // wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] - - movq_r2r(mm4, mm7); - punpckldq_r2r(mm5, mm3); // wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] - - punpcklwd_r2r(mm2, mm4); // wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] - - punpckhwd_r2r(mm2, mm7); // wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] - - punpckldq_r2r(mm7, mm4); // wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] - movq_r2r(mm1, mm6); - - //ok - -// mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] -// mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] - - - movq_r2r(mm0, mm2); - punpckhdq_r2r(mm4, mm6); // wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] - - punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] - psllw_i2r(2, mm6); - - pmulhw_m2r(fix_141, mm6); - punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] - - punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] - movq_r2r(mm0, mm7); - -// tmp0 = tmp10 + tmp13; -// tmp3 = tmp10 - tmp13; - paddw_r2r(mm2, mm0); // [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] - psubw_r2r(mm2, mm7); // [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] - -// tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; - psubw_r2r(mm2, mm6); // wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] -// tmp1 = tmp11 + tmp12; -// tmp2 = tmp11 - tmp12; - movq_r2r(mm1, mm5); - - //OK - - /* Odd part */ - -// z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; -// z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; -// z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; -// z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; - movq_m2r(*(wsptr), mm3); // wsptr[0,0],[0,1],[0,2],[0,3] - paddw_r2r(mm6, mm1); // [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] - - movq_m2r(*(wsptr+1), mm4); // wsptr[0,4],[0,5],[0,6],[0,7] - psubw_r2r(mm6, mm5); // [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] - - movq_r2r(mm3, mm6); - punpckldq_r2r(mm4, mm3); // wsptr[0,0],[0,1],[0,4],[0,5] - - punpckhdq_r2r(mm6, mm4); // wsptr[0,6],[0,7],[0,2],[0,3] - movq_r2r(mm3, mm2); - -//Save tmp0 and tmp1 in wsptr - movq_r2m(mm0, *(wsptr)); // save tmp0 - paddw_r2r(mm4, mm2); // wsptr[xxx],[0,z11],[xxx],[0,z13] - - -//Continue with z10 --- z13 - movq_m2r(*(wsptr+2), mm6); // wsptr[1,0],[1,1],[1,2],[1,3] - psubw_r2r(mm4, mm3); // wsptr[xxx],[0,z12],[xxx],[0,z10] - - movq_m2r(*(wsptr+3), mm0); // wsptr[1,4],[1,5],[1,6],[1,7] - movq_r2r(mm6, mm4); - - movq_r2m(mm1, *(wsptr+1)); // save tmp1 - punpckldq_r2r(mm0, mm6); // wsptr[1,0],[1,1],[1,4],[1,5] - - punpckhdq_r2r(mm4, mm0); // wsptr[1,6],[1,7],[1,2],[1,3] - movq_r2r(mm6, mm1); - -//Save tmp2 and tmp3 in wsptr - paddw_r2r(mm0, mm6); // wsptr[xxx],[1,z11],[xxx],[1,z13] - movq_r2r(mm2, mm4); - -//Continue with z10 --- z13 - movq_r2m(mm5, *(wsptr+2)); // save tmp2 - punpcklwd_r2r(mm6, mm2); // wsptr[xxx],[xxx],[0,z11],[1,z11] - - psubw_r2r(mm0, mm1); // wsptr[xxx],[1,z12],[xxx],[1,z10] - punpckhwd_r2r(mm6, mm4); // wsptr[xxx],[xxx],[0,z13],[1,z13] - - movq_r2r(mm3, mm0); - punpcklwd_r2r(mm1, mm3); // wsptr[xxx],[xxx],[0,z12],[1,z12] - - movq_r2m(mm7, *(wsptr+3)); // save tmp3 - punpckhwd_r2r(mm1, mm0); // wsptr[xxx],[xxx],[0,z10],[1,z10] - - movq_m2r(*(wsptr+4), mm6); // wsptr[2,0],[2,1],[2,2],[2,3] - punpckhdq_r2r(mm2, mm0); // wsptr[0,z10],[1,z10],[0,z11],[1,z11] - - movq_m2r(*(wsptr+5), mm7); // wsptr[2,4],[2,5],[2,6],[2,7] - punpckhdq_r2r(mm4, mm3); // wsptr[0,z12],[1,z12],[0,z13],[1,z13] - - movq_m2r(*(wsptr+6), mm1); // wsptr[3,0],[3,1],[3,2],[3,3] - movq_r2r(mm6, mm4); - - punpckldq_r2r(mm7, mm6); // wsptr[2,0],[2,1],[2,4],[2,5] - movq_r2r(mm1, mm5); - - punpckhdq_r2r(mm4, mm7); // wsptr[2,6],[2,7],[2,2],[2,3] - movq_r2r(mm6, mm2); - - movq_m2r(*(wsptr+7), mm4); // wsptr[3,4],[3,5],[3,6],[3,7] - paddw_r2r(mm7, mm6); // wsptr[xxx],[2,z11],[xxx],[2,z13] - - psubw_r2r(mm7, mm2); // wsptr[xxx],[2,z12],[xxx],[2,z10] - punpckldq_r2r(mm4, mm1); // wsptr[3,0],[3,1],[3,4],[3,5] - - punpckhdq_r2r(mm5, mm4); // wsptr[3,6],[3,7],[3,2],[3,3] - movq_r2r(mm1, mm7); - - paddw_r2r(mm4, mm1); // wsptr[xxx],[3,z11],[xxx],[3,z13] - psubw_r2r(mm4, mm7); // wsptr[xxx],[3,z12],[xxx],[3,z10] - - movq_r2r(mm6, mm5); - punpcklwd_r2r(mm1, mm6); // wsptr[xxx],[xxx],[2,z11],[3,z11] - - punpckhwd_r2r(mm1, mm5); // wsptr[xxx],[xxx],[2,z13],[3,z13] - movq_r2r(mm2, mm4); - - punpcklwd_r2r(mm7, mm2); // wsptr[xxx],[xxx],[2,z12],[3,z12] - - punpckhwd_r2r(mm7, mm4); // wsptr[xxx],[xxx],[2,z10],[3,z10] - - punpckhdq_r2r(mm6, mm4); /// wsptr[2,z10],[3,z10],[2,z11],[3,z11] - - punpckhdq_r2r(mm5, mm2); // wsptr[2,z12],[3,z12],[2,z13],[3,z13] - movq_r2r(mm0, mm5); - - punpckldq_r2r(mm4, mm0); // wsptr[0,z10],[1,z10],[2,z10],[3,z10] - - punpckhdq_r2r(mm4, mm5); // wsptr[0,z11],[1,z11],[2,z11],[3,z11] - movq_r2r(mm3, mm4); - - punpckhdq_r2r(mm2, mm4); // wsptr[0,z13],[1,z13],[2,z13],[3,z13] - movq_r2r(mm5, mm1); - - punpckldq_r2r(mm2, mm3); // wsptr[0,z12],[1,z12],[2,z12],[3,z12] -// tmp7 = z11 + z13; /* phase 5 */ -// tmp8 = z11 - z13; /* phase 5 */ - psubw_r2r(mm4, mm1); // tmp8 - - paddw_r2r(mm4, mm5); // tmp7 -// tmp21 = MULTIPLY(tmp8, FIX_1_414213562); /* 2*c4 */ - psllw_i2r(2, mm1); - - psllw_i2r(2, mm0); - - pmulhw_m2r(fix_141, mm1); // tmp21 -// tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */ -// + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */ - psllw_i2r(2, mm3); - movq_r2r(mm0, mm7); - - pmulhw_m2r(fix_n184, mm7); - movq_r2r(mm3, mm6); - - movq_m2r(*(wsptr), mm2); // tmp0,final1 - - pmulhw_m2r(fix_108n184, mm6); -// tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ -// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ - movq_r2r(mm2, mm4); // final1 - - pmulhw_m2r(fix_184n261, mm0); - paddw_r2r(mm5, mm2); // tmp0+tmp7,final1 - - pmulhw_m2r(fix_184, mm3); - psubw_r2r(mm5, mm4); // tmp0-tmp7,final1 - -// tmp6 = tmp22 - tmp7; /* phase 2 */ - psraw_i2r(3, mm2); // outptr[0,0],[1,0],[2,0],[3,0],final1 - - paddw_r2r(mm6, mm7); // tmp20 - psraw_i2r(3, mm4); // outptr[0,7],[1,7],[2,7],[3,7],final1 - - paddw_r2r(mm0, mm3); // tmp22 - -// tmp5 = tmp21 - tmp6; - psubw_r2r(mm5, mm3); // tmp6 - -// tmp4 = tmp20 + tmp5; - movq_m2r(*(wsptr+1), mm0); // tmp1,final2 - psubw_r2r(mm3, mm1); // tmp5 - - movq_r2r(mm0, mm6); // final2 - paddw_r2r(mm3, mm0); // tmp1+tmp6,final2 - - /* Final output stage: scale down by a factor of 8 and range-limit */ - - -// outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) -// & RANGE_MASK]; final1 - - -// outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) -// & RANGE_MASK]; final2 - psubw_r2r(mm3, mm6); // tmp1-tmp6,final2 - psraw_i2r(3, mm0); // outptr[0,1],[1,1],[2,1],[3,1] - - psraw_i2r(3, mm6); // outptr[0,6],[1,6],[2,6],[3,6] - - packuswb_r2r(mm4, mm0); // out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] - - movq_m2r(*(wsptr+2), mm5); // tmp2,final3 - packuswb_r2r(mm6, mm2); // out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] - -// outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) -// & RANGE_MASK]; final3 - paddw_r2r(mm1, mm7); // tmp4 - movq_r2r(mm5, mm3); - - paddw_r2r(mm1, mm5); // tmp2+tmp5 - psubw_r2r(mm1, mm3); // tmp2-tmp5 - - psraw_i2r(3, mm5); // outptr[0,2],[1,2],[2,2],[3,2] - - movq_m2r(*(wsptr+3), mm4); // tmp3,final4 - psraw_i2r(3, mm3); // outptr[0,5],[1,5],[2,5],[3,5] - - - -// outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) -// & RANGE_MASK]; final4 - movq_r2r(mm4, mm6); - paddw_r2r(mm7, mm4); // tmp3+tmp4 - - psubw_r2r(mm7, mm6); // tmp3-tmp4 - psraw_i2r(3, mm4); // outptr[0,4],[1,4],[2,4],[3,4] - - // mov ecx, [dataptr] - - psraw_i2r(3, mm6); // outptr[0,3],[1,3],[2,3],[3,3] - - packuswb_r2r(mm4, mm5); // out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] - - packuswb_r2r(mm3, mm6); // out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] - movq_r2r(mm2, mm4); - - movq_r2r(mm5, mm7); - punpcklbw_r2r(mm0, mm2); // out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] - - punpckhbw_r2r(mm0, mm4); // out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] - movq_r2r(mm2, mm1); - - punpcklbw_r2r(mm6, mm5); // out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] - - // add dataptr, 4 - - punpckhbw_r2r(mm6, mm7); // out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] - - punpcklwd_r2r(mm5, mm2); // out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] - - // add ecx, output_col - - movq_r2r(mm7, mm6); - punpckhwd_r2r(mm5, mm1); // out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] - - movq_r2r(mm2, mm0); - punpcklwd_r2r(mm4, mm6); // out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] - - // mov idata, [dataptr] - - punpckldq_r2r(mm6, mm2); // out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] - - // add dataptr, 4 - - movq_r2r(mm1, mm3); - - // add idata, output_col - - punpckhwd_r2r(mm4, mm7); // out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] - - movq_r2m(mm2, *(dataptr)); - - punpckhdq_r2r(mm6, mm0); // out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] - - dataptr += rskip; - movq_r2m(mm0, *(dataptr)); - - punpckldq_r2r(mm7, mm1); // out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] - punpckhdq_r2r(mm7, mm3); // out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] - - dataptr += rskip; - movq_r2m(mm1, *(dataptr)); - - dataptr += rskip; - movq_r2m(mm3, *(dataptr)); - -/*******************************************************************/ - - wsptr += 8; - -/*******************************************************************/ - -// tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); -// tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); -// tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); -// tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); - movq_m2r(*(wsptr), mm0); // wsptr[0,0],[0,1],[0,2],[0,3] - - movq_m2r(*(wsptr+1), mm1); // wsptr[0,4],[0,5],[0,6],[0,7] - movq_r2r(mm0, mm2); - - movq_m2r(*(wsptr+2), mm3); // wsptr[1,0],[1,1],[1,2],[1,3] - paddw_r2r(mm1, mm0); // wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] - - movq_m2r(*(wsptr+3), mm4); // wsptr[1,4],[1,5],[1,6],[1,7] - psubw_r2r(mm1, mm2); // wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] - - movq_r2r(mm0, mm6); - movq_r2r(mm3, mm5); - - paddw_r2r(mm4, mm3); // wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] - movq_r2r(mm2, mm1); - - psubw_r2r(mm4, mm5); // wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] - punpcklwd_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] - - movq_m2r(*(wsptr+7), mm7); // wsptr[3,4],[3,5],[3,6],[3,7] - punpckhwd_r2r(mm3, mm6); // wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] - - movq_m2r(*(wsptr+4), mm3); // wsptr[2,0],[2,1],[2,2],[2,3] - punpckldq_r2r(mm6, mm0); // wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] - - punpcklwd_r2r(mm5, mm1); // wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] - movq_r2r(mm3, mm4); - - movq_m2r(*(wsptr+6), mm6); // wsptr[3,0],[3,1],[3,2],[3,3] - punpckhwd_r2r(mm5, mm2); // wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] - - movq_m2r(*(wsptr+5), mm5); // wsptr[2,4],[2,5],[2,6],[2,7] - punpckldq_r2r(mm2, mm1); // wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] - - paddw_r2r(mm5, mm3); // wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] - movq_r2r(mm6, mm2); - - psubw_r2r(mm5, mm4); // wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] - paddw_r2r(mm7, mm6); // wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] - - movq_r2r(mm3, mm5); - punpcklwd_r2r(mm6, mm3); // wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] - - psubw_r2r(mm7, mm2); // wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] - punpckhwd_r2r(mm6, mm5); // wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] - - movq_r2r(mm4, mm7); - punpckldq_r2r(mm5, mm3); // wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] - - punpcklwd_r2r(mm2, mm4); // wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] - - punpckhwd_r2r(mm2, mm7); // wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] - - punpckldq_r2r(mm7, mm4); // wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] - movq_r2r(mm1, mm6); - - //OK - -// mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] -// mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] - - movq_r2r(mm0, mm2); - punpckhdq_r2r(mm4, mm6); // wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] - - punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] - psllw_i2r(2, mm6); - - pmulhw_m2r(fix_141, mm6); - punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] - - punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] - movq_r2r(mm0, mm7); - -// tmp0 = tmp10 + tmp13; -// tmp3 = tmp10 - tmp13; - paddw_r2r(mm2, mm0); // [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] - psubw_r2r(mm2, mm7); // [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] - -// tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; - psubw_r2r(mm2, mm6); // wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] -// tmp1 = tmp11 + tmp12; -// tmp2 = tmp11 - tmp12; - movq_r2r(mm1, mm5); - - //OK - - - /* Odd part */ - -// z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; -// z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; -// z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; -// z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; - movq_m2r(*(wsptr), mm3); // wsptr[0,0],[0,1],[0,2],[0,3] - paddw_r2r(mm6, mm1); // [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] - - movq_m2r(*(wsptr+1), mm4); // wsptr[0,4],[0,5],[0,6],[0,7] - psubw_r2r(mm6, mm5); // [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] - - movq_r2r(mm3, mm6); - punpckldq_r2r(mm4, mm3); // wsptr[0,0],[0,1],[0,4],[0,5] - - punpckhdq_r2r(mm6, mm4); // wsptr[0,6],[0,7],[0,2],[0,3] - movq_r2r(mm3, mm2); - -//Save tmp0 and tmp1 in wsptr - movq_r2m(mm0, *(wsptr)); // save tmp0 - paddw_r2r(mm4, mm2); // wsptr[xxx],[0,z11],[xxx],[0,z13] - - -//Continue with z10 --- z13 - movq_m2r(*(wsptr+2), mm6); // wsptr[1,0],[1,1],[1,2],[1,3] - psubw_r2r(mm4, mm3); // wsptr[xxx],[0,z12],[xxx],[0,z10] - - movq_m2r(*(wsptr+3), mm0); // wsptr[1,4],[1,5],[1,6],[1,7] - movq_r2r(mm6, mm4); - - movq_r2m(mm1, *(wsptr+1)); // save tmp1 - punpckldq_r2r(mm0, mm6); // wsptr[1,0],[1,1],[1,4],[1,5] - - punpckhdq_r2r(mm4, mm0); // wsptr[1,6],[1,7],[1,2],[1,3] - movq_r2r(mm6, mm1); - -//Save tmp2 and tmp3 in wsptr - paddw_r2r(mm0, mm6); // wsptr[xxx],[1,z11],[xxx],[1,z13] - movq_r2r(mm2, mm4); - -//Continue with z10 --- z13 - movq_r2m(mm5, *(wsptr+2)); // save tmp2 - punpcklwd_r2r(mm6, mm2); // wsptr[xxx],[xxx],[0,z11],[1,z11] - - psubw_r2r(mm0, mm1); // wsptr[xxx],[1,z12],[xxx],[1,z10] - punpckhwd_r2r(mm6, mm4); // wsptr[xxx],[xxx],[0,z13],[1,z13] - - movq_r2r(mm3, mm0); - punpcklwd_r2r(mm1, mm3); // wsptr[xxx],[xxx],[0,z12],[1,z12] - - movq_r2m(mm7, *(wsptr+3)); // save tmp3 - punpckhwd_r2r(mm1, mm0); // wsptr[xxx],[xxx],[0,z10],[1,z10] - - movq_m2r(*(wsptr+4), mm6); // wsptr[2,0],[2,1],[2,2],[2,3] - punpckhdq_r2r(mm2, mm0); // wsptr[0,z10],[1,z10],[0,z11],[1,z11] - - movq_m2r(*(wsptr+5), mm7); // wsptr[2,4],[2,5],[2,6],[2,7] - punpckhdq_r2r(mm4, mm3); // wsptr[0,z12],[1,z12],[0,z13],[1,z13] - - movq_m2r(*(wsptr+6), mm1); // wsptr[3,0],[3,1],[3,2],[3,3] - movq_r2r(mm6, mm4); - - punpckldq_r2r(mm7, mm6); // wsptr[2,0],[2,1],[2,4],[2,5] - movq_r2r(mm1, mm5); - - punpckhdq_r2r(mm4, mm7); // wsptr[2,6],[2,7],[2,2],[2,3] - movq_r2r(mm6, mm2); - - movq_m2r(*(wsptr+7), mm4); // wsptr[3,4],[3,5],[3,6],[3,7] - paddw_r2r(mm7, mm6); // wsptr[xxx],[2,z11],[xxx],[2,z13] - - psubw_r2r(mm7, mm2); // wsptr[xxx],[2,z12],[xxx],[2,z10] - punpckldq_r2r(mm4, mm1); // wsptr[3,0],[3,1],[3,4],[3,5] - - punpckhdq_r2r(mm5, mm4); // wsptr[3,6],[3,7],[3,2],[3,3] - movq_r2r(mm1, mm7); - - paddw_r2r(mm4, mm1); // wsptr[xxx],[3,z11],[xxx],[3,z13] - psubw_r2r(mm4, mm7); // wsptr[xxx],[3,z12],[xxx],[3,z10] - - movq_r2r(mm6, mm5); - punpcklwd_r2r(mm1, mm6); // wsptr[xxx],[xxx],[2,z11],[3,z11] - - punpckhwd_r2r(mm1, mm5); // wsptr[xxx],[xxx],[2,z13],[3,z13] - movq_r2r(mm2, mm4); - - punpcklwd_r2r(mm7, mm2); // wsptr[xxx],[xxx],[2,z12],[3,z12] - - punpckhwd_r2r(mm7, mm4); // wsptr[xxx],[xxx],[2,z10],[3,z10] - - punpckhdq_r2r(mm6, mm4); // wsptr[2,z10],[3,z10],[2,z11],[3,z11] - - punpckhdq_r2r(mm5, mm2); // wsptr[2,z12],[3,z12],[2,z13],[3,z13] - movq_r2r(mm0, mm5); - - punpckldq_r2r(mm4, mm0); // wsptr[0,z10],[1,z10],[2,z10],[3,z10] - - punpckhdq_r2r(mm4, mm5); // wsptr[0,z11],[1,z11],[2,z11],[3,z11] - movq_r2r(mm3, mm4); - - punpckhdq_r2r(mm2, mm4); // wsptr[0,z13],[1,z13],[2,z13],[3,z13] - movq_r2r(mm5, mm1); - - punpckldq_r2r(mm2, mm3); // wsptr[0,z12],[1,z12],[2,z12],[3,z12] -// tmp7 = z11 + z13; /* phase 5 */ -// tmp8 = z11 - z13; /* phase 5 */ - psubw_r2r(mm4, mm1); // tmp8 - - paddw_r2r(mm4, mm5); // tmp7 -// tmp21 = MULTIPLY(tmp8, FIX_1_414213562); /* 2*c4 */ - psllw_i2r(2, mm1); - - psllw_i2r(2, mm0); - - pmulhw_m2r(fix_141, mm1); // tmp21 -// tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */ -// + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */ - psllw_i2r(2, mm3); - movq_r2r(mm0, mm7); - - pmulhw_m2r(fix_n184, mm7); - movq_r2r(mm3, mm6); - - movq_m2r(*(wsptr), mm2); // tmp0,final1 - - pmulhw_m2r(fix_108n184, mm6); -// tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ -// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ - movq_r2r(mm2, mm4); // final1 - - pmulhw_m2r(fix_184n261, mm0); - paddw_r2r(mm5, mm2); // tmp0+tmp7,final1 - - pmulhw_m2r(fix_184, mm3); - psubw_r2r(mm5, mm4); // tmp0-tmp7,final1 - -// tmp6 = tmp22 - tmp7; /* phase 2 */ - psraw_i2r(3, mm2); // outptr[0,0],[1,0],[2,0],[3,0],final1 - - paddw_r2r(mm6, mm7); // tmp20 - psraw_i2r(3, mm4); // outptr[0,7],[1,7],[2,7],[3,7],final1 - - paddw_r2r(mm0, mm3); // tmp22 - -// tmp5 = tmp21 - tmp6; - psubw_r2r(mm5, mm3); // tmp6 - -// tmp4 = tmp20 + tmp5; - movq_m2r(*(wsptr+1), mm0); // tmp1,final2 - psubw_r2r(mm3, mm1); // tmp5 - - movq_r2r(mm0, mm6); // final2 - paddw_r2r(mm3, mm0); // tmp1+tmp6,final2 - - /* Final output stage: scale down by a factor of 8 and range-limit */ - -// outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) -// & RANGE_MASK]; final1 - - -// outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) -// & RANGE_MASK]; final2 - psubw_r2r(mm3, mm6); // tmp1-tmp6,final2 - psraw_i2r(3, mm0); // outptr[0,1],[1,1],[2,1],[3,1] - - psraw_i2r(3, mm6); // outptr[0,6],[1,6],[2,6],[3,6] - - packuswb_r2r(mm4, mm0); // out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] - - movq_m2r(*(wsptr+2), mm5); // tmp2,final3 - packuswb_r2r(mm6, mm2); // out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] - -// outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) -// & RANGE_MASK]; final3 - paddw_r2r(mm1, mm7); // tmp4 - movq_r2r(mm5, mm3); - - paddw_r2r(mm1, mm5); // tmp2+tmp5 - psubw_r2r(mm1, mm3); // tmp2-tmp5 - - psraw_i2r(3, mm5); // outptr[0,2],[1,2],[2,2],[3,2] - - movq_m2r(*(wsptr+3), mm4); // tmp3,final4 - psraw_i2r(3, mm3); // outptr[0,5],[1,5],[2,5],[3,5] - - - -// outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) -// & RANGE_MASK]; -// outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) -// & RANGE_MASK]; final4 - movq_r2r(mm4, mm6); - paddw_r2r(mm7, mm4); // tmp3+tmp4 - - psubw_r2r(mm7, mm6); // tmp3-tmp4 - psraw_i2r(3, mm4); // outptr[0,4],[1,4],[2,4],[3,4] - - psraw_i2r(3, mm6); // outptr[0,3],[1,3],[2,3],[3,3] - - /* - movq_r2m(mm4, *dummy); - fprintf(stderr, "3-4 %016llx\n", dummy); - movq_r2m(mm4, *dummy); - fprintf(stderr, "3+4 %016llx\n", dummy); - */ - - - packuswb_r2r(mm4, mm5); // out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] - - packuswb_r2r(mm3, mm6); // out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] - movq_r2r(mm2, mm4); - - movq_r2r(mm5, mm7); - punpcklbw_r2r(mm0, mm2); // out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] - - punpckhbw_r2r(mm0, mm4); // out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] - movq_r2r(mm2, mm1); - - punpcklbw_r2r(mm6, mm5); // out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] - - punpckhbw_r2r(mm6, mm7); // out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] - - punpcklwd_r2r(mm5, mm2); // out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] - - movq_r2r(mm7, mm6); - punpckhwd_r2r(mm5, mm1); // out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] - - movq_r2r(mm2, mm0); - punpcklwd_r2r(mm4, mm6); // out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] - - punpckldq_r2r(mm6, mm2); // out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] - - movq_r2r(mm1, mm3); - - punpckhwd_r2r(mm4, mm7); // out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] - - dataptr += rskip; - movq_r2m(mm2, *(dataptr)); - - punpckhdq_r2r(mm6, mm0); // out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] - - dataptr += rskip; - movq_r2m(mm0, *(dataptr)); - - punpckldq_r2r(mm7, mm1); // out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] - - punpckhdq_r2r(mm7, mm3); // out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] - - dataptr += rskip; - movq_r2m(mm1, *(dataptr)); - - dataptr += rskip; - movq_r2m(mm3, *(dataptr)); - -#else - __s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - __s32 tmp10, tmp11, tmp12, tmp13; - __s32 z5, z10, z11, z12, z13; - __s16 *inptr; - __s32 *wsptr; - __u8 *outptr; - int ctr; - __s32 dcval; - __s32 workspace[64]; - - inptr = data; - wsptr = workspace; - for (ctr = 8; ctr > 0; ctr--) { - - if ((inptr[8] | inptr[16] | inptr[24] | - inptr[32] | inptr[40] | inptr[48] | inptr[56]) == 0) { - dcval = inptr[0]; - wsptr[0] = dcval; - wsptr[8] = dcval; - wsptr[16] = dcval; - wsptr[24] = dcval; - wsptr[32] = dcval; - wsptr[40] = dcval; - wsptr[48] = dcval; - wsptr[56] = dcval; - - inptr++; - wsptr++; - continue; - } - - tmp0 = inptr[0]; - tmp1 = inptr[16]; - tmp2 = inptr[32]; - tmp3 = inptr[48]; - - tmp10 = tmp0 + tmp2; - tmp11 = tmp0 - tmp2; - - tmp13 = tmp1 + tmp3; - tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; - - tmp0 = tmp10 + tmp13; - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - tmp4 = inptr[8]; - tmp5 = inptr[24]; - tmp6 = inptr[40]; - tmp7 = inptr[56]; - - z13 = tmp6 + tmp5; - z10 = tmp6 - tmp5; - z11 = tmp4 + tmp7; - z12 = tmp4 - tmp7; - - tmp7 = z11 + z13; - tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); - - z5 = MULTIPLY(z10 + z12, FIX_1_847759065); - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; - - tmp6 = tmp12 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - wsptr[0] = (__s32) (tmp0 + tmp7); - wsptr[56] = (__s32) (tmp0 - tmp7); - wsptr[8] = (__s32) (tmp1 + tmp6); - wsptr[48] = (__s32) (tmp1 - tmp6); - wsptr[16] = (__s32) (tmp2 + tmp5); - wsptr[40] = (__s32) (tmp2 - tmp5); - wsptr[32] = (__s32) (tmp3 + tmp4); - wsptr[24] = (__s32) (tmp3 - tmp4); - - inptr++; - wsptr++; - } - - wsptr = workspace; - for (ctr = 0; ctr < 8; ctr++) { - outptr = &(odata[ctr*rskip]); - - tmp10 = wsptr[0] + wsptr[4]; - tmp11 = wsptr[0] - wsptr[4]; - - tmp13 = wsptr[2] + wsptr[6]; - tmp12 = MULTIPLY(wsptr[2] - wsptr[6], FIX_1_414213562) - tmp13; - - tmp0 = tmp10 + tmp13; - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - z13 = wsptr[5] + wsptr[3]; - z10 = wsptr[5] - wsptr[3]; - z11 = wsptr[1] + wsptr[7]; - z12 = wsptr[1] - wsptr[7]; - - tmp7 = z11 + z13; - tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); - - z5 = MULTIPLY(z10 + z12, FIX_1_847759065); - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; - - tmp6 = tmp12 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - outptr[0] = RL(DESCALE(tmp0 + tmp7)); - outptr[7] = RL(DESCALE(tmp0 - tmp7)); - outptr[1] = RL(DESCALE(tmp1 + tmp6)); - outptr[6] = RL(DESCALE(tmp1 - tmp6)); - outptr[2] = RL(DESCALE(tmp2 + tmp5)); - outptr[5] = RL(DESCALE(tmp2 - tmp5)); - outptr[4] = RL(DESCALE(tmp3 + tmp4)); - outptr[3] = RL(DESCALE(tmp3 - tmp4)); - - wsptr += 8; - } -#endif -} /* Main Routines @@ -2733,7 +1439,7 @@ Input: buf -> pointer to 128 ints for quant values store to pass back to Q -> quality factor (192=best, 32=worst) */ -void RTjpeg_init_Q(__u8 Q) +static void RTjpeg_init_Q(__u8 Q) { int i; __u64 qual; @@ -2760,7 +1466,6 @@ void RTjpeg_init_Q(__u8 Q) RTjpeg_cb8--; RTjpeg_dct_init(); - RTjpeg_idct_init(); RTjpeg_quant_init(); } @@ -2822,37 +1527,6 @@ void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q) buf[64+i]=le2me_32(RTjpeg_ciqt[i]); } -void RTjpeg_init_decompress(__u32 *buf, int width, int height) -{ - int i; - - RTjpeg_init_data(); - - RTjpeg_width=width; - RTjpeg_height=height; - RTjpeg_Ywidth = RTjpeg_width>>3; - RTjpeg_Ysize=width * height; - RTjpeg_Cwidth = RTjpeg_width>>4; - RTjpeg_Csize= (width>>1) * height; - - for(i=0; i<64; i++) - { - RTjpeg_liqt[i]=le2me_32(buf[i]); - RTjpeg_ciqt[i]=le2me_32(buf[i+64]); - } - - RTjpeg_lb8=0; - while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8); - RTjpeg_lb8--; - RTjpeg_cb8=0; - while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8); - RTjpeg_cb8--; - - RTjpeg_idct_init(); - -// RTjpeg_color_init(); -} - int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp) { __s8 * sb; @@ -2907,210 +1581,6 @@ int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp) return (sp-sb); } -int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp) -{ - __s8 * sb; - register __s8 * bp2 = bp + RTjpeg_Ysize; - register __s8 * bp3 = bp2 + RTjpeg_Csize; - register int i, j, k; - -#if HAVE_MMX - emms(); -#endif - sb=sp; -/* Y */ - for(i=RTjpeg_height; i; i-=8) - { - for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8) - { - RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - - RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - - RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_cqt); - sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); - - RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_cqt); - sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); - - } - bp+=RTjpeg_width<<3; - bp2+=RTjpeg_width<<2; - bp3+=RTjpeg_width<<2; - - } -#if HAVE_MMX - emms(); -#endif - return (sp-sb); -} - -int RTjpeg_compress8(__s8 *sp, unsigned char *bp) -{ - __s8 * sb; - int i, j; - -#if HAVE_MMX - emms(); -#endif - - sb=sp; -/* Y */ - for(i=0; i<RTjpeg_height; i+=8) - { - for(j=0; j<RTjpeg_width; j+=8) - { - RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - } - bp+=RTjpeg_width; - } - -#if HAVE_MMX - emms(); -#endif - return (sp-sb); -} - -void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp) -{ - register __s8 * bp2 = bp + RTjpeg_Ysize; - register __s8 * bp3 = bp2 + (RTjpeg_Csize); - int i, j,k; - -#if HAVE_MMX - emms(); -#endif - -/* Y */ - for(i=RTjpeg_height; i; i-=8) - { - for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) { - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt); - RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt); - RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1); - } - } - bp+=RTjpeg_width<<3; - bp2+=RTjpeg_width<<2; - bp3+=RTjpeg_width<<2; - } -#if HAVE_MMX - emms(); -#endif -} - -void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp) -{ - register __s8 * bp1 = bp + (RTjpeg_width<<3); - register __s8 * bp2 = bp + RTjpeg_Ysize; - register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1); - int i, j,k; - -#if HAVE_MMX - emms(); -#endif - -/* Y */ - for(i=RTjpeg_height>>1; i; i-=8) - { - for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) { - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp1+j, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp1+j+8, RTjpeg_block, RTjpeg_width); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt); - RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1); - } - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt); - RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1); - } - } - bp+=RTjpeg_width<<4; - bp1+=RTjpeg_width<<4; - bp2+=RTjpeg_width<<2; - bp3+=RTjpeg_width<<2; - } -#if HAVE_MMX - emms(); -#endif -} - -void RTjpeg_decompress8(__s8 *sp, __u8 *bp) -{ - int i, j; - -#if HAVE_MMX - emms(); -#endif - -/* Y */ - for(i=0; i<RTjpeg_height; i+=8) - { - for(j=0; j<RTjpeg_width; j+=8) - if(*sp==-1)sp++; - else - { - sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt); - RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width); - } - bp+=RTjpeg_width<<3; - } -} - /* External Function @@ -3177,11 +1647,8 @@ static int RTjpeg_bcomp(__s16 *old, mmx_t *mask) if(result.q) { -// if(!RTjpeg_mtest) -// for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i]; return 0; } -// printf("."); return 1; } @@ -3193,7 +1660,6 @@ static int RTjpeg_bcomp(__s16 *old, __u16 *mask) for(i=0; i<64; i++) if(abs(old[i]-RTjpeg_block[i])>*mask) { - if(!RTjpeg_mtest) for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i]; return 0; } @@ -3201,15 +1667,9 @@ static int RTjpeg_bcomp(__s16 *old, __u16 *mask) } #endif -void RTjpeg_set_test(int i) -{ - RTjpeg_mtest=i; -} - int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask) { __s8 * sb; -//rh __s16 *block; register __s8 * bp1 = bp + (RTjpeg_width<<3); register __s8 * bp2 = bp + RTjpeg_Ysize; register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1); @@ -3296,498 +1756,3 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask #endif return (sp-sb); } - - -int RTjpeg_mcompressYUV422(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask) -{ - __s8 * sb; - __s16 *block; - register __s8 * bp2; - register __s8 * bp3; - register int i, j, k; - -#if HAVE_MMX - emms(); - RTjpeg_lmask.uq=((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask; - RTjpeg_cmask.uq=((__u64)cmask<<48)|((__u64)cmask<<32)|((__u64)cmask<<16)|cmask; -#else - RTjpeg_lmask=lmask; - RTjpeg_cmask=cmask; -#endif - - bp = bp - RTjpeg_width*0; - bp2 = bp + RTjpeg_Ysize-RTjpeg_width*0; - bp3 = bp2 + RTjpeg_Csize; - - sb=sp; - block=RTjpeg_old; -/* Y */ - for(i=RTjpeg_height; i; i-=8) - { - for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8) - { - RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - if(RTjpeg_bcomp(block, &RTjpeg_lmask)) - { - *((__u8 *)sp++)=255; - } - else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - block+=64; - - RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - if(RTjpeg_bcomp(block, &RTjpeg_lmask)) - { - *((__u8 *)sp++)=255; - } - else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - block+=64; - - RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_cqt); - if(RTjpeg_bcomp(block, &RTjpeg_cmask)) - { - *((__u8 *)sp++)=255; - } - else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); - block+=64; - - RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth); - RTjpeg_quant(RTjpeg_block, RTjpeg_cqt); - if(RTjpeg_bcomp(block, &RTjpeg_cmask)) - { - *((__u8 *)sp++)=255; - } - else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); - block+=64; - - } - bp+=RTjpeg_width<<3; - bp2+=RTjpeg_width<<2; - bp3+=RTjpeg_width<<2; - } - printf ("%d\n", block - RTjpeg_old); -#if HAVE_MMX - emms(); -#endif - return (sp-sb); -} - -int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask) -{ - __s8 * sb; - __s16 *block; - int i, j; - -#if HAVE_MMX - emms(); - RTjpeg_lmask.uq=((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask; -#else - RTjpeg_lmask=lmask; -#endif - - - sb=sp; - block=RTjpeg_old; -/* Y */ - for(i=0; i<RTjpeg_height; i+=8) - { - for(j=0; j<RTjpeg_width; j+=8) - { - RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width); - RTjpeg_quant(RTjpeg_block, RTjpeg_lqt); - if(RTjpeg_bcomp(block, &RTjpeg_lmask)) - { - *((__u8 *)sp++)=255; -// printf("* %d ", sp[-1]); - } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); - block+=64; - } - bp+=RTjpeg_width<<3; - } -#if HAVE_MMX - emms(); -#endif - return (sp-sb); -} - -#define KcrR 76284 -#define KcrG 53281 -#define KcbG 25625 -#define KcbB 132252 -#define Ky 76284 - -void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb, int stride) -{ - int tmp; - int i, j; - __s32 y, crR, crG, cbG, cbB; - __u8 *bufcr, *bufcb, *bufy, *bufoute; - int yskip; - - yskip=RTjpeg_width; - - bufcb=&buf[RTjpeg_width*RTjpeg_height]; - bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2]; - bufy=&buf[0]; - bufoute=rgb; - - for(i=0; i<(RTjpeg_height); i++) - { - for(j=0; j<RTjpeg_width; j+=2) - { - crR=(*bufcr-128)*KcrR; - crG=(*(bufcr++)-128)*KcrG; - cbG=(*bufcb-128)*KcbG; - cbB=(*(bufcb++)-128)*KcbB; - - y=(bufy[j]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+1]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - } - bufy+=yskip; - } -} - - -void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb, int stride) -{ - int tmp; - int i, j; - __s32 y, crR, crG, cbG, cbB; - __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto; - int oskip, yskip; - - if(stride==0) - oskip=RTjpeg_width*3; - else - oskip=2*stride-RTjpeg_width*3; - - yskip=RTjpeg_width; - - bufcb=&buf[RTjpeg_width*RTjpeg_height]; - bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4]; - bufy=&buf[0]; - bufoute=rgb; - bufouto=rgb+RTjpeg_width*3; - - for(i=0; i<(RTjpeg_height>>1); i++) - { - for(j=0; j<RTjpeg_width; j+=2) - { - crR=(*bufcr-128)*KcrR; - crG=(*(bufcr++)-128)*KcrG; - cbG=(*bufcb-128)*KcbG; - cbB=(*(bufcb++)-128)*KcbB; - - y=(bufy[j]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+1]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+yskip]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+1+yskip]-16)*Ky; - - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - - } - bufoute+=oskip; - bufouto+=oskip; - bufy+=yskip<<1; - } -} - - -void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb, int stride) -{ - int tmp; - int i, j; - __s32 y, crR, crG, cbG, cbB; - __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto; - int oskip, yskip; - - if(stride==0) - oskip=RTjpeg_width*4; - else - oskip = 2*stride-RTjpeg_width*4; - yskip=RTjpeg_width; - - bufcb=&buf[RTjpeg_width*RTjpeg_height]; - bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2]; - bufy=&buf[0]; - bufoute=rgb; - bufouto=rgb+RTjpeg_width*4; - - for(i=0; i<(RTjpeg_height>>1); i++) - { - for(j=0; j<RTjpeg_width; j+=2) - { - crR=(*bufcr-128)*KcrR; - crG=(*(bufcr++)-128)*KcrG; - cbG=(*bufcb-128)*KcbG; - cbB=(*(bufcb++)-128)*KcbB; - - y=(bufy[j]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - bufoute++; - - y=(bufy[j+1]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - bufoute++; - - y=(bufy[j+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - bufouto++; - - y=(bufy[j+1+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - bufouto++; - - } - bufoute+=oskip; - bufouto+=oskip; - bufy+=yskip<<1; - } -} - -void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb, int stride) -{ - int tmp; - int i, j; - __s32 y, crR, crG, cbG, cbB; - __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto; - int oskip, yskip; - - if(stride==0) - oskip=RTjpeg_width*3; - else - oskip=2*stride - RTjpeg_width*3; - - yskip=RTjpeg_width; - - bufcb=&buf[RTjpeg_width*RTjpeg_height]; - bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4]; - bufy=&buf[0]; - bufoute=rgb; - bufouto=rgb+RTjpeg_width*3; - - for(i=0; i<(RTjpeg_height>>1); i++) - { - for(j=0; j<RTjpeg_width; j+=2) - { - crR=(*bufcr-128)*KcrR; - crG=(*(bufcr++)-128)*KcrG; - cbG=(*bufcb-128)*KcbG; - cbB=(*(bufcb++)-128)*KcbB; - - y=(bufy[j]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+1]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - - y=(bufy[j+1+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp); - - } - bufoute+=oskip; - bufouto+=oskip; - bufy+=yskip<<1; - } -} - -void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb, int stride) -{ - int tmp; - int i, j; - __s32 y, crR, crG, cbG, cbB; - __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto; - int oskip, yskip; - unsigned char r, g, b; - - if(stride==0) - oskip=RTjpeg_width*2; - else - oskip=2*stride-RTjpeg_width*2; - - yskip=RTjpeg_width; - - bufcb=&buf[RTjpeg_width*RTjpeg_height]; - bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4]; - bufy=&buf[0]; - bufoute=rgb; - bufouto=rgb+RTjpeg_width*2; - - for(i=0; i<(RTjpeg_height>>1); i++) - { - for(j=0; j<RTjpeg_width; j+=2) - { - crR=(*bufcr-128)*KcrR; - crG=(*(bufcr++)-128)*KcrG; - cbG=(*bufcb-128)*KcbG; - cbB=(*(bufcb++)-128)*KcbB; - - y=(bufy[j]-16)*Ky; - - tmp=(y+cbB)>>16; - b=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - g=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - r=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(int)((int)b >> 3); - tmp|=(int)(((int)g >> 2) << 5); - tmp|=(int)(((int)r >> 3) << 11); - *(bufoute++)=tmp&0xff; - *(bufoute++)=tmp>>8; - - - y=(bufy[j+1]-16)*Ky; - - tmp=(y+cbB)>>16; - b=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - g=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - r=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(int)((int)b >> 3); - tmp|=(int)(((int)g >> 2) << 5); - tmp|=(int)(((int)r >> 3) << 11); - *(bufoute++)=tmp&0xff; - *(bufoute++)=tmp>>8; - - y=(bufy[j+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - b=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - g=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - r=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(int)((int)b >> 3); - tmp|=(int)(((int)g >> 2) << 5); - tmp|=(int)(((int)r >> 3) << 11); - *(bufouto++)=tmp&0xff; - *(bufouto++)=tmp>>8; - - y=(bufy[j+1+yskip]-16)*Ky; - - tmp=(y+cbB)>>16; - b=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y-crG-cbG)>>16; - g=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(y+crR)>>16; - r=(tmp>255)?255:((tmp<0)?0:tmp); - tmp=(int)((int)b >> 3); - tmp|=(int)(((int)g >> 2) << 5); - tmp|=(int)(((int)r >> 3) << 11); - *(bufouto++)=tmp&0xff; - *(bufouto++)=tmp>>8; - - } - bufoute+=oskip; - bufouto+=oskip; - bufy+=yskip<<1; - } -} - -/* fix stride */ - -void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb, int stride) -{ - memcpy(rgb, buf, RTjpeg_width*RTjpeg_height); -} - diff --git a/libmpcodecs/native/rtjpegn.h b/libmpcodecs/native/rtjpegn.h index a854818e2f..859b8238f8 100644 --- a/libmpcodecs/native/rtjpegn.h +++ b/libmpcodecs/native/rtjpegn.h @@ -35,27 +35,10 @@ #define __s32 int32_t #define __s64 int64_t -extern void RTjpeg_init_Q(__u8 Q); -extern void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q); -extern void RTjpeg_init_decompress(__u32 *buf, int width, int height); -extern int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp); -extern int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp); -extern void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp); -extern void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp); -extern int RTjpeg_compress8(__s8 *sp, unsigned char *bp); -extern void RTjpeg_decompress8(__s8 *sp, __u8 *bp); - -extern void RTjpeg_init_mcompress(void); -extern int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask); -extern int RTjpeg_mcompressYUV422(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask); -extern int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask); -extern void RTjpeg_set_test(int i); - -extern void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb, int stride); -extern void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb, int stride); -extern void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb, int stride); -extern void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb, int stride); -extern void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb, int stride); -extern void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb, int stride); +void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q); +int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp); + +void RTjpeg_init_mcompress(void); +int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask); #endif /* MPLAYER_RTJPEGN_H */ diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 22bdddc909..e585d75078 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -29,7 +29,6 @@ extern const vd_functions_t mpcodecs_vd_vfwex; extern const vd_functions_t mpcodecs_vd_raw; extern const vd_functions_t mpcodecs_vd_hmblck; extern const vd_functions_t mpcodecs_vd_xanim; -extern const vd_functions_t mpcodecs_vd_nuv; extern const vd_functions_t mpcodecs_vd_mpng; extern const vd_functions_t mpcodecs_vd_ijpg; extern const vd_functions_t mpcodecs_vd_mtga; @@ -64,7 +63,6 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = { &mpcodecs_vd_lzo, &mpcodecs_vd_raw, &mpcodecs_vd_hmblck, - &mpcodecs_vd_nuv, #ifdef CONFIG_XANIM &mpcodecs_vd_xanim, #endif diff --git a/libmpcodecs/vd_nuv.c b/libmpcodecs/vd_nuv.c deleted file mode 100644 index 21ed42ec1d..0000000000 --- a/libmpcodecs/vd_nuv.c +++ /dev/null @@ -1,54 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "mp_msg.h" - -#include "vd_internal.h" - -static const vd_info_t info = { - "NuppelVideo decoder", - "nuv", - "A'rpi", - "Alex & Panagiotis Issaris <takis@lumumba.luc.ac.be>", - "native codecs" -}; - -LIBVD_EXTERN(nuv) - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420); -} - -// uninit driver -static void uninit(sh_video_t *sh){ -} - -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - -void decode_nuv( - unsigned char *encoded, - int encoded_size, - unsigned char *decoded, - int width, - int height); - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - if(len<=0) return NULL; // skipped frame - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0, - sh->disp_w, sh->disp_h); - if(!mpi) return NULL; - - decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h); - - return mpi; -} diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 91473627da..7131d19278 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -19,13 +19,12 @@ #include "mp_image.h" #include "vf.h" -#include "libmpdemux/nuppelvideo.h" +#include "libavutil/intreadwrite.h" #include <lzo/lzo1x.h> #include "native/rtjpegn.h" #define LZO_AL(size) (((size) + (sizeof(long) - 1)) / sizeof(long)) -#define LZO_IN_LEN (1024*1024L) -#define LZO_OUT_LEN (LZO_IN_LEN + LZO_IN_LEN / 64 + 16 + 3) +#define LZO_OUT_LEN(in) ((in) + (in) / 64 + 16 + 3) //===========================================================================// @@ -68,6 +67,9 @@ m_option_t nuvopts_conf[]={ //===========================================================================// +#define COMPDATASIZE (128*4) +#define FRAMEHEADERSIZE 12 + static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ @@ -75,14 +77,16 @@ static int config(struct vf_instance* vf, // We need a buffer wich can holda header and a whole YV12 picture // or a RTJpeg table vf->priv->buf_size = width*height*3/2+FRAMEHEADERSIZE; - if(vf->priv->buf_size < (int)(128*sizeof(long int) + FRAMEHEADERSIZE)) - vf->priv->buf_size = 128*sizeof(long int) + FRAMEHEADERSIZE; + if(vf->priv->buf_size < COMPDATASIZE + FRAMEHEADERSIZE) + vf->priv->buf_size = COMPDATASIZE + FRAMEHEADERSIZE; mux_v->bih->biWidth=width; mux_v->bih->biHeight=height; mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); mux_v->aspect = (float)d_width/d_height; vf->priv->buffer = realloc(vf->priv->buffer,vf->priv->buf_size); + if (vf->priv->lzo) + vf->priv->zbuffer = realloc(vf->priv->zbuffer, FRAMEHEADERSIZE + LZO_OUT_LEN(vf->priv->buf_size)); vf->priv->tbl_wrote = 0; return 1; @@ -99,29 +103,29 @@ static int query_format(struct vf_instance* vf, unsigned int fmt){ } static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ - struct rtframeheader* ench = (struct rtframeheader*)vf->priv->buffer; + uint8_t *header = vf->priv->buffer; uint8_t* data = vf->priv->buffer + FRAMEHEADERSIZE; uint8_t* zdata = vf->priv->zbuffer + FRAMEHEADERSIZE; - int len = 0, zlen = 0,r; + int len = 0, r; + size_t zlen = 0; - memset(vf->priv->buffer,0,FRAMEHEADERSIZE); // Reset the header + memset(header, 0, FRAMEHEADERSIZE); // Reset the header if(vf->priv->lzo) memset(vf->priv->zbuffer,0,FRAMEHEADERSIZE); // This has to be don here otherwise tv with sound doesn't work if(!vf->priv->tbl_wrote) { - RTjpeg_init_compress((long int*)data,mpi->width,mpi->height,vf->priv->q); + RTjpeg_init_compress((uint32_t *)data,mpi->width,mpi->height,vf->priv->q); RTjpeg_init_mcompress(); - ench->frametype = 'D'; // compressor data - ench->comptype = 'R'; // compressor data for RTjpeg - ench->packetlength = 128*sizeof(long int); + header[0] = 'D'; // frametype: compressor data + header[1] = 'R'; // comptype: compressor data for RTjpeg + AV_WL32(header + 8, COMPDATASIZE); // packetlength - le2me_rtframeheader(ench); mux_v->buffer=vf->priv->buffer; - muxer_write_chunk(mux_v,FRAMEHEADERSIZE + 128*sizeof(long int), 0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + muxer_write_chunk(mux_v,FRAMEHEADERSIZE + COMPDATASIZE, 0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); vf->priv->tbl_wrote = 1; - memset(ench,0,FRAMEHEADERSIZE); // Reset the header + memset(header, 0, FRAMEHEADERSIZE); // Reset the header } // Raw picture @@ -129,7 +133,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ len = mpi->width*mpi->height*3/2; // Try lzo ??? if(vf->priv->lzo) { - r = lzo1x_1_compress(mpi->planes[0],mpi->width*mpi->height*3/2, + r = lzo1x_1_compress(mpi->planes[0],len, zdata,&zlen,vf->priv->zmem); if(r != LZO_E_OK) { mp_msg(MSGT_VFILTER,MSGL_ERR,"LZO compress error\n"); @@ -139,10 +143,10 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ if(zlen <= 0 || zlen > len) { memcpy(data,mpi->planes[0],len); - ench->comptype = '0'; + header[1] = '0'; // comptype: uncompressed } else { // Use lzo only if it's littler - ench = (struct rtframeheader*)vf->priv->zbuffer; - ench->comptype = '3'; + header = vf->priv->zbuffer; + header[1] = '3'; //comptype: lzo len = zlen; } @@ -163,19 +167,18 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } if(zlen <= 0 || zlen > len) - ench->comptype = '1'; + header[1] = '1'; // comptype: RTjpeg else { - ench = (struct rtframeheader*)vf->priv->zbuffer; - ench->comptype = '2'; + header = vf->priv->zbuffer; + header[1] = '2'; // comptype: RTjpeg + LZO len = zlen; } } - ench->frametype = 'V'; // video frame - ench->packetlength = len; - le2me_rtframeheader(ench); - mux_v->buffer=(void*)ench; + header[0] = 'V'; // frametype: video frame + AV_WL32(header + 8, len); // packetlength + mux_v->buffer = header; muxer_write_chunk(mux_v, len + FRAMEHEADERSIZE, 0x10, pts, pts); return 1; } @@ -216,8 +219,7 @@ static int vf_open(vf_instance_t *vf, char* args){ if(lzo_init() != LZO_E_OK) { mp_msg(MSGT_VFILTER,MSGL_WARN,"LZO init failed: no lzo compression\n"); vf->priv->lzo = 0; - } - vf->priv->zbuffer = (lzo_bytep)malloc(FRAMEHEADERSIZE + LZO_OUT_LEN); + } else vf->priv->zmem = malloc(sizeof(long)*LZO_AL(LZO1X_1_MEM_COMPRESS)); } diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c index 36afff3b7d..f8961e9a09 100644 --- a/libmpcodecs/vf_decimate.c +++ b/libmpcodecs/vf_decimate.c @@ -19,7 +19,7 @@ struct vf_priv_s { int max, last, cnt; }; -#if HAVE_MMX +#if HAVE_MMX && HAVE_EBX_AVAILABLE static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) { volatile short out[4]; @@ -55,7 +55,7 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) "emms \n\t" : : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "memory" + : "%ecx", "memory" ); return out[0]+out[1]+out[2]+out[3]; } @@ -164,7 +164,7 @@ static int open(vf_instance_t *vf, char* args) p->frac = 0.33; if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); diff = diff_C; -#if HAVE_MMX +#if HAVE_MMX && HAVE_EBX_AVAILABLE if(gCpuCaps.hasMMX) diff = diff_MMX; #endif return 1; diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c index f70d4802ec..baaeb3ef57 100644 --- a/libmpcodecs/vf_divtc.c +++ b/libmpcodecs/vf_divtc.c @@ -33,7 +33,7 @@ struct vf_priv_s * diff_MMX and diff_C stolen from vf_decimate.c */ -#if HAVE_MMX +#if HAVE_MMX && HAVE_EBX_AVAILABLE static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) { volatile short out[4]; @@ -69,7 +69,7 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) "emms \n\t" : : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "memory" + : "%ecx", "memory" ); return out[0]+out[1]+out[2]+out[3]; } @@ -682,11 +682,10 @@ static int open(vf_instance_t *vf, char* args) if(!(p->history=calloc(sizeof *p->history, p->window))) goto nomem; - diff= -#if HAVE_MMX - gCpuCaps.hasMMX?diff_MMX: + diff = diff_C; +#if HAVE_MMX && HAVE_EBX_AVAILABLE + if(gCpuCaps.hasMMX) diff = diff_MMX; #endif - diff_C; free(args); return 1; diff --git a/libmpdemux/demux_mov.c b/libmpdemux/demux_mov.c index fb271e1e49..ecc23f2cc5 100644 --- a/libmpdemux/demux_mov.c +++ b/libmpdemux/demux_mov.c @@ -2193,7 +2193,6 @@ if(trak->pos==0 && trak->stream_header_len>0){ if (samplenr < 0) vo_sub = NULL; else if (samplenr != priv->current_sub) { - av_unused sh_sub_t *sh = demuxer->sub->sh; off_t pos = trak->samples[samplenr].pos; int len = trak->samples[samplenr].size; double subpts = (double)trak->samples[samplenr].pts / (double)trak->timescale; diff --git a/libmpdemux/demux_nuv.c b/libmpdemux/demux_nuv.c deleted file mode 100644 index 2ca1d2b452..0000000000 --- a/libmpdemux/demux_nuv.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * NuppelVideo 0.05 file parser - * for MPlayer - * by Panagiotis Issaris <takis@lumumba.luc.ac.be> - * - * Reworked by alex - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "config.h" -#include "mp_msg.h" -#include "help_mp.h" -#include "stream/stream.h" -#include "demuxer.h" -#include "stheader.h" -#include "nuppelvideo.h" - - -struct nuv_signature -{ - char finfo[12]; /* "NuppelVideo" + \0 */ - char version[5]; /* "0.05" + \0 */ -}; - -typedef struct nuv_position_t nuv_position_t; - -struct nuv_position_t -{ - off_t offset; - float time; - int frame; - nuv_position_t* next; -}; - -typedef struct nuv_info_t -{ - int current_audio_frame; - int current_video_frame; - nuv_position_t *index_list; - nuv_position_t *current_position; -} nuv_priv_t; - -/** - * \brief find best matching bitrate (in kbps) out of a table - * \param bitrate bitrate to find best match for - * \return best match from table - */ -static int nearestBitrate(int bitrate) { - const int rates[17] = {8000, 16000, 24000, 32000, 40000, 48000, 56000, - 64000, 80000, 96000, 112000, 128000, 160000, - 192000, 224000, 256000, 320000}; - int i; - for (i = 0; i < 16; i++) { - if ((rates[i] + rates[i + 1]) / 2 > bitrate) - break; - } - return rates[i]; -} - -/** - * Seek to a position relative to the current position, indicated in time. - */ -static void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags ) -{ -#define MAX_TIME 1000000 - nuv_priv_t* priv = demuxer->priv; - struct rtframeheader rtjpeg_frameheader; - off_t orig_pos; - off_t curr_pos; - float current_time = 0; - float start_time = MAX_TIME; - float target_time = start_time + rel_seek_secs * 1000; /* target_time, start_time are ms, rel_seek_secs s */ - - orig_pos = stream_tell ( demuxer->stream ); - - if ( rel_seek_secs > 0 ) - { - /* Seeking forward */ - - - while(current_time < target_time ) - { - if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader)) - return; /* EOF */ - le2me_rtframeheader(&rtjpeg_frameheader); - - if ( rtjpeg_frameheader.frametype == 'V' ) - { - priv->current_position->next = (nuv_position_t*) malloc ( sizeof ( nuv_position_t ) ); - priv->current_position = priv->current_position->next; - priv->current_position->frame = priv->current_video_frame++; - priv->current_position->time = rtjpeg_frameheader.timecode; - priv->current_position->offset = orig_pos; - priv->current_position->next = NULL; - - if ( start_time == MAX_TIME ) - { - start_time = rtjpeg_frameheader.timecode; - /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs*1000; - } - - current_time = rtjpeg_frameheader.timecode; - - curr_pos = stream_tell ( demuxer->stream ); - stream_seek ( demuxer->stream, curr_pos + rtjpeg_frameheader.packetlength ); - - /* Adjust current sequence pointer */ - } - else if ( rtjpeg_frameheader.frametype == 'A' ) - { - if ( start_time == MAX_TIME ) - { - start_time = rtjpeg_frameheader.timecode; - /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs * 1000; - } - current_time = rtjpeg_frameheader.timecode; - - - curr_pos = stream_tell ( demuxer->stream ); - stream_seek ( demuxer->stream, curr_pos + rtjpeg_frameheader.packetlength ); - } - } - } - else - { - /* Seeking backward */ - nuv_position_t* p; - start_time = priv->current_position->time; - - /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs * 1000; - - - if(target_time < 0) - target_time = 0; - - // Search the target time in the index list, get the offset - // and go to that offset. - p = priv->index_list; - while ( ( p->next != NULL ) && ( p->time < target_time ) ) - { - p = p->next; - } - stream_seek ( demuxer->stream, p->offset ); - priv->current_video_frame = p->frame; - } -} - - -static int demux_nuv_fill_buffer ( demuxer_t *demuxer, demux_stream_t *ds ) -{ - struct rtframeheader rtjpeg_frameheader; - off_t orig_pos; - nuv_priv_t* priv = demuxer->priv; - int want_audio = (demuxer->audio)&&(demuxer->audio->id!=-2); - - demuxer->filepos = orig_pos = stream_tell ( demuxer->stream ); - if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader)) - return 0; /* EOF */ - le2me_rtframeheader(&rtjpeg_frameheader); - -#if 0 - printf("NUV frame: frametype: %c, comptype: %c, packetlength: %d\n", - rtjpeg_frameheader.frametype, rtjpeg_frameheader.comptype, - rtjpeg_frameheader.packetlength); -#endif - - /* Skip Seekpoint, Extended header and Sync for now */ - if ((rtjpeg_frameheader.frametype == 'R') || - (rtjpeg_frameheader.frametype == 'X') || - (rtjpeg_frameheader.frametype == 'S')) - return 1; - - /* Skip seektable and text (these have a payload) */ - if ((rtjpeg_frameheader.frametype == 'Q') || - (rtjpeg_frameheader.frametype == 'T')) { - stream_skip(demuxer->stream, rtjpeg_frameheader.packetlength); - return 1; - } - - if (((rtjpeg_frameheader.frametype == 'D') && - (rtjpeg_frameheader.comptype == 'R')) || - (rtjpeg_frameheader.frametype == 'V')) - { - if ( rtjpeg_frameheader.frametype == 'V' ) - { - priv->current_video_frame++; - priv->current_position->next = (nuv_position_t*) malloc(sizeof(nuv_position_t)); - priv->current_position = priv->current_position->next; - priv->current_position->frame = priv->current_video_frame; - priv->current_position->time = rtjpeg_frameheader.timecode; - priv->current_position->offset = orig_pos; - priv->current_position->next = NULL; - } - /* put RTjpeg tables, Video info to video buffer */ - stream_seek ( demuxer->stream, orig_pos ); - ds_read_packet ( demuxer->video, demuxer->stream, rtjpeg_frameheader.packetlength + 12, - rtjpeg_frameheader.timecode*0.001, orig_pos, 0 ); - - - } else - if (demuxer->audio && (rtjpeg_frameheader.frametype == 'A')) - { - priv->current_audio_frame++; - if (want_audio) { - /* put Audio to audio buffer */ - ds_read_packet ( demuxer->audio, demuxer->stream, - rtjpeg_frameheader.packetlength, - rtjpeg_frameheader.timecode*0.001, - orig_pos + 12, 0 ); - } else { - /* skip audio block */ - stream_skip ( demuxer->stream, - rtjpeg_frameheader.packetlength ); - } - } - - return 1; -} - -/* Scan for the extended data in MythTV nuv streams */ -static int demux_xscan_nuv(demuxer_t* demuxer, int width, int height) { - int i; - off_t orig_pos = stream_tell(demuxer->stream); - struct rtframeheader rtjpeg_frameheader; - struct extendeddata ext; - sh_video_t* sh_video = demuxer->video->sh; - sh_audio_t* sh_audio = demuxer->audio->sh; - - for (i = 0; i < 2; ++i) { - if (stream_read(demuxer->stream, (char*)&rtjpeg_frameheader, - sizeof(rtjpeg_frameheader)) < sizeof(rtjpeg_frameheader)) - goto out; - le2me_rtframeheader(&rtjpeg_frameheader); - - if (rtjpeg_frameheader.frametype != 'X') - stream_skip(demuxer->stream, rtjpeg_frameheader.packetlength); - } - - if ( rtjpeg_frameheader.frametype != 'X' ) - goto out; - - if (rtjpeg_frameheader.packetlength != sizeof(ext)) { - mp_msg(MSGT_DEMUXER, MSGL_WARN, - "NUV extended frame does not have expected length, ignoring\n"); - goto out; - } - - if (stream_read(demuxer->stream, (char*)&ext, sizeof(ext)) < sizeof(ext)) - goto out; - le2me_extendeddata(&ext); - - if (ext.version != 1) { - mp_msg(MSGT_DEMUXER, MSGL_WARN, - "NUV extended frame has unknown version number (%d), ignoring\n", - ext.version); - goto out; - } - - mp_msg(MSGT_DEMUXER, MSGL_V, "Detected MythTV stream\n"); - - /* Video parameters */ - mp_msg(MSGT_DEMUXER, MSGL_V, "FOURCC: %c%c%c%c\n", - (ext.video_fourcc >> 24) & 0xff, - (ext.video_fourcc >> 16) & 0xff, - (ext.video_fourcc >> 8) & 0xff, - (ext.video_fourcc) & 0xff); - sh_video->format = ext.video_fourcc; - sh_video->i_bps = ext.lavc_bitrate; - - /* Audio parameters */ - if (ext.audio_fourcc == mmioFOURCC('L', 'A', 'M', 'E')) { - sh_audio->format = 0x55; - } else if (ext.audio_fourcc == mmioFOURCC('R', 'A', 'W', 'A')) { - sh_audio->format = 0x1; - } else { - mp_msg(MSGT_DEMUXER, MSGL_WARN, - "Unknown audio format 0x%x\n", ext.audio_fourcc); - } - - sh_audio->channels = ext.audio_channels; - sh_audio->samplerate = ext.audio_sample_rate; - sh_audio->i_bps = sh_audio->channels * sh_audio->samplerate * - ext.audio_bits_per_sample; - if (sh_audio->format != 0x1) - sh_audio->i_bps = nearestBitrate(sh_audio->i_bps / - ext.audio_compression_ratio); - sh_audio->wf->wFormatTag = sh_audio->format; - sh_audio->wf->nChannels = sh_audio->channels; - sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; - sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps / 8; - sh_audio->wf->nBlockAlign = sh_audio->channels * 2; - sh_audio->wf->wBitsPerSample = ext.audio_bits_per_sample; - sh_audio->wf->cbSize = 0; - - mp_msg(MSGT_DEMUXER, MSGL_V, - "channels=%d bitspersample=%d samplerate=%d compression_ratio=%d\n", - ext.audio_channels, ext.audio_bits_per_sample, - ext.audio_sample_rate, ext.audio_compression_ratio); - return 1; -out: - stream_reset(demuxer->stream); - stream_seek(demuxer->stream, orig_pos); - return 0; -} - -static demuxer_t* demux_open_nuv ( demuxer_t* demuxer ) -{ - sh_video_t *sh_video = NULL; - sh_audio_t *sh_audio = NULL; - struct rtfileheader rtjpeg_fileheader; - nuv_priv_t* priv = (nuv_priv_t*) malloc ( sizeof ( nuv_priv_t) ); - demuxer->priv = priv; - priv->current_audio_frame = 0; - priv->current_video_frame = 0; - - - /* Go to the start */ - stream_reset(demuxer->stream); - stream_seek(demuxer->stream, 0); - - stream_read ( demuxer->stream, (char*)& rtjpeg_fileheader, sizeof(rtjpeg_fileheader) ); - le2me_rtfileheader(&rtjpeg_fileheader); - - /* no video */ - if (rtjpeg_fileheader.videoblocks == 0) - { - mp_msg(MSGT_DEMUXER, MSGL_INFO, MSGTR_MPDEMUX_NUV_NoVideoBlocksInFile); - return NULL; - } - - /* Create a new video stream header */ - sh_video = new_sh_video ( demuxer, 0 ); - - /* Make sure the demuxer knows about the new video stream header - * (even though new_sh_video() ought to take care of it) - */ - demuxer->video->sh = sh_video; - - /* Make sure that the video demuxer stream header knows about its - * parent video demuxer stream (this is getting wacky), or else - * video_read_properties() will choke - */ - sh_video->ds = demuxer->video; - - /* Custom fourcc for internal MPlayer use */ - sh_video->format = mmioFOURCC('N', 'U', 'V', '1'); - - sh_video->disp_w = rtjpeg_fileheader.width; - sh_video->disp_h = rtjpeg_fileheader.height; - - /* NuppelVideo uses pixel aspect ratio - here display aspect ratio is used. - For the moment NuppelVideo only supports 1.0 thus - 1.33 == 4:3 aspect ratio. - */ - if(rtjpeg_fileheader.aspect == 1.0) - sh_video->aspect = (float) 4.0f/3.0f; - - /* Get the FPS */ - sh_video->fps = rtjpeg_fileheader.fps; - sh_video->frametime = 1 / sh_video->fps; - - if (rtjpeg_fileheader.audioblocks != 0) - { - sh_audio = new_sh_audio(demuxer, 0); - demuxer->audio->id = 0; - demuxer->audio->sh = sh_audio; - sh_audio->ds = demuxer->audio; - sh_audio->format = 0x1; - sh_audio->channels = 2; - sh_audio->samplerate = 44100; - - sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); - memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); - sh_audio->wf->wFormatTag = sh_audio->format; - sh_audio->wf->nChannels = sh_audio->channels; - sh_audio->wf->wBitsPerSample = 16; - sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; - sh_audio->wf->nAvgBytesPerSec = sh_audio->wf->nChannels* - sh_audio->wf->wBitsPerSample*sh_audio->wf->nSamplesPerSec/8; - sh_audio->wf->nBlockAlign = sh_audio->channels * 2; - sh_audio->wf->cbSize = 0; - } - - /* Check for extended data (X frame) and read settings from it */ - if (!demux_xscan_nuv(demuxer, rtjpeg_fileheader.width, - rtjpeg_fileheader.height)) - /* Otherwise assume defaults */ - mp_msg(MSGT_DEMUXER, MSGL_V, "No NUV extended frame, using defaults\n"); - - - priv->index_list = (nuv_position_t*) malloc(sizeof(nuv_position_t)); - priv->index_list->frame = 0; - priv->index_list->time = 0; - priv->index_list->offset = stream_tell ( demuxer->stream ); - priv->index_list->next = NULL; - priv->current_position = priv->index_list; - - return demuxer; -} - -static int nuv_check_file ( demuxer_t* demuxer ) -{ - struct nuv_signature ns; - - /* Store original position */ - off_t orig_pos = stream_tell(demuxer->stream); - - mp_msg ( MSGT_DEMUX, MSGL_V, "Checking for NuppelVideo\n" ); - - if(stream_read(demuxer->stream,(char*)&ns,sizeof(ns)) != sizeof(ns)) - return 0; - - if ( strncmp ( ns.finfo, "NuppelVideo", 12 ) && - strncmp ( ns.finfo, "MythTVVideo", 12 ) ) - return 0; /* Not a NuppelVideo file */ - if ( strncmp ( ns.version, "0.05", 5 ) && - strncmp ( ns.version, "0.06", 5 ) && - strncmp ( ns.version, "0.07", 5 ) ) - return 0; /* Wrong version NuppelVideo file */ - - /* Return to original position */ - stream_seek ( demuxer->stream, orig_pos ); - return DEMUXER_TYPE_NUV; -} - -static void demux_close_nuv(demuxer_t* demuxer) { - nuv_priv_t* priv = demuxer->priv; - nuv_position_t* pos; - if(!priv) - return; - for(pos = priv->index_list ; pos != NULL ; ) { - nuv_position_t* p = pos; - pos = pos->next; - free(p); - } - free(priv); -} - - -const demuxer_desc_t demuxer_desc_nuv = { - "NuppelVideo demuxer", - "nuv", - "NuppelVideo", - "Panagiotis Issaris", - "", - DEMUXER_TYPE_NUV, - 1, // safe autodetect - nuv_check_file, - demux_nuv_fill_buffer, - demux_open_nuv, - demux_close_nuv, - demux_seek_nuv, - NULL -}; diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 6c3792b1d9..4347feee0b 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -46,7 +46,6 @@ extern const demuxer_desc_t demuxer_desc_mf; extern const demuxer_desc_t demuxer_desc_avi; extern const demuxer_desc_t demuxer_desc_y4m; extern const demuxer_desc_t demuxer_desc_asf; -extern const demuxer_desc_t demuxer_desc_nuv; extern const demuxer_desc_t demuxer_desc_real; extern const demuxer_desc_t demuxer_desc_smjpeg; extern const demuxer_desc_t demuxer_desc_matroska; @@ -101,7 +100,6 @@ const demuxer_desc_t *const demuxer_list[] = { &demuxer_desc_y4m, &demuxer_desc_asf, &demuxer_desc_nsv, - &demuxer_desc_nuv, &demuxer_desc_real, &demuxer_desc_smjpeg, &demuxer_desc_matroska, diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index f7f69a9fb7..4815c8b7d9 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -34,7 +34,6 @@ struct MPOpts; #define DEMUXER_TYPE_FLI 10 #define DEMUXER_TYPE_REAL 11 #define DEMUXER_TYPE_Y4M 12 -#define DEMUXER_TYPE_NUV 13 #define DEMUXER_TYPE_FILM 14 #define DEMUXER_TYPE_ROQ 15 #define DEMUXER_TYPE_MF 16 diff --git a/libmpdemux/nuppelvideo.h b/libmpdemux/nuppelvideo.h deleted file mode 100644 index e12c1eb325..0000000000 --- a/libmpdemux/nuppelvideo.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - nuppelvideo.h taken from NuppelVideo, by - (c) Roman Hochleitner roman@mars.tuwien.ac.at - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef MPLAYER_NUPPELVIDEO_H -#define MPLAYER_NUPPELVIDEO_H - -#include "libavutil/intfloat_readwrite.h" - -typedef struct __attribute__((packed)) rtfileheader -{ - char finfo[12]; // "NuppelVideo" + \0 - char version[5]; // "0.05" + \0 - char pad1[3]; - int width; - int height; - int desiredwidth; // 0 .. as it is - int desiredheight; // 0 .. as it is - char pimode; // P .. progressive - // I .. interlaced (2 half pics) [NI] - char pad2[3]; - double aspect; // 1.0 .. square pixel (1.5 .. e.g. width=480: width*1.5=720 - // for capturing for svcd material - double fps; - int videoblocks; // count of video-blocks -1 .. unknown 0 .. no video - int audioblocks; // count of audio-blocks -1 .. unknown 0 .. no audio - int textsblocks; // count of text-blocks -1 .. unknown 0 .. no text - int keyframedist; -} rtfileheader; - -typedef struct __attribute__((packed)) rtframeheader -{ - char frametype; // A .. Audio, V .. Video, S .. Sync, T .. Text - // R .. Seekpoint: String RTjjjjjjjj (use full packet) - // D .. Addition Data for Compressors - // ct: R .. RTjpeg Tables - - char comptype; // V: 0 .. Uncompressed [NI] - // 1 .. RTJpeg - // 2 .. RTJpeg with lzo afterwards - // N .. black frame - // L .. simply copy last frame (if lost frames) - // A: 0 .. Uncompressed (44100/sec 16bit 2ch) - // 1 .. lzo compression [NI] - // 2 .. layer2 (packet) [NI] - // 3 .. layer3 (packet) [NI] - // F .. flac (lossless) [NI] - // S .. shorten (lossless) [NI] - // N .. null frame loudless - // L .. simply copy last frame (may sound bad) NI - // S: B .. Audio and Video sync point [NI] - // A .. Audio Sync Information - // timecode == effective dsp-frequency*100 - // when reaching this audio sync point - // because many cheap soundcards are unexact - // and have a range from 44000 to 44250 - // instead of the expected exact 44100 S./sec - // V .. Next Video Sync - // timecode == next video framenumber - // S .. Audio,Video,Text Correlation [NI] - char keyframe; // 0 .. keyframe - // 1 .. nr of frame in gop => no keyframe - - char filters; // Every bit stands for one type of filter - // 1 .. Gauss 5 Pixel (8*m+2*l+2*r+2*a+2*b)/16 [NYI] - // 2 .. Gauss 5 Pixel (8*m+1*l+1*r+1*a+1*b)/12 [NYI] - // 4 .. Cartoon Filter [NI] - // 8 .. Reserverd Filter [NI] - // 16 .. Reserverd Filter [NI] - // 32 .. Reserverd Filter [NI] - // 64 .. Reserverd Filter [NI] - // 128 .. Reserverd Filter [NI] - - int timecode; // Timecodeinformation sec*1000 + msecs - - int packetlength; // V,A,T: length of following data in stream - // S: length of packet correl. information [NI] - // R: do not use here! (fixed 'RTjjjjjjjjjjjjjj') -} rtframeheader; - -/* for MythTV */ -typedef struct __attribute__((packed)) extendeddata -{ - int version; // yes, this is repeated from the file header - int video_fourcc; // video encoding method used - int audio_fourcc; // audio encoding method used - // generic data - int audio_sample_rate; - int audio_bits_per_sample; - int audio_channels; - // codec specific - // mp3lame - int audio_compression_ratio; - int audio_quality; - // rtjpeg - int rtjpeg_quality; - int rtjpeg_luma_filter; - int rtjpeg_chroma_filter; - // libavcodec - int lavc_bitrate; - int lavc_qmin; - int lavc_qmax; - int lavc_maxqdiff; - // unused for later -- total size of 128 integers. - // new fields must be added at the end, above this comment. - int expansion[113]; -} extendeddata; - -#define FRAMEHEADERSIZE sizeof(rtframeheader) -#define FILEHEADERSIZE sizeof(rtfileheader) - -typedef struct vidbuffertype -{ - int sample; - int timecode; - int freeToEncode; - int freeToBuffer; - unsigned char *buffer_offset; -} vidbuffertyp; - -typedef struct audbuffertype -{ - int sample; - int timecode; - int freeToEncode; - int freeToBuffer; - unsigned char *buffer_offset; -} audbuffertyp; - -#define le2me_rtfileheader(h) { \ - (h)->width = le2me_32((h)->width); \ - (h)->height = le2me_32((h)->height); \ - (h)->desiredwidth = le2me_32((h)->desiredwidth); \ - (h)->desiredheight = le2me_32((h)->desiredheight); \ - (h)->aspect = av_int2dbl(le2me_64(*(uint64_t *)&(h)->aspect));\ - (h)->fps = av_int2dbl(le2me_64(*(uint64_t *)&(h)->fps)); \ - (h)->videoblocks = le2me_32((h)->videoblocks); \ - (h)->audioblocks = le2me_32((h)->audioblocks); \ - (h)->textsblocks = le2me_32((h)->textsblocks); \ - (h)->keyframedist = le2me_32((h)->keyframedist); \ - } -#define le2me_rtframeheader(h) { \ - (h)->timecode = le2me_32((h)->timecode); \ - (h)->packetlength = le2me_32((h)->packetlength); \ - } -#define le2me_extendeddata(h) { \ - (h)->version = le2me_32((h)->version); \ - (h)->video_fourcc = le2me_32((h)->video_fourcc); \ - (h)->audio_fourcc = le2me_32((h)->audio_fourcc); \ - (h)->audio_sample_rate = le2me_32((h)->audio_sample_rate); \ - (h)->audio_bits_per_sample = le2me_32((h)->audio_bits_per_sample);\ - (h)->audio_channels = le2me_32((h)->audio_channels); \ - (h)->audio_compression_ratio = le2me_32((h)->audio_compression_ratio);\ - (h)->audio_quality = le2me_32((h)->audio_quality); \ - (h)->rtjpeg_quality = le2me_32((h)->rtjpeg_quality); \ - (h)->rtjpeg_luma_filter = le2me_32((h)->rtjpeg_luma_filter); \ - (h)->rtjpeg_chroma_filter = le2me_32((h)->rtjpeg_chroma_filter);\ - (h)->lavc_bitrate = le2me_32((h)->lavc_bitrate); \ - (h)->lavc_qmin = le2me_32((h)->lavc_qmin); \ - (h)->lavc_qmax = le2me_32((h)->lavc_qmax); \ - (h)->lavc_maxqdiff = le2me_32((h)->lavc_maxqdiff); \ - } - -#endif /* MPLAYER_NUPPELVIDEO_H */ diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c0f4b97684..c6012c15b7 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1622,7 +1622,7 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil } xpos+=xInc; } - filterPos[i/2]= xpos>>16; // needed to jump to the next part + filterPos[((i/2)+1)&(~1)]= xpos>>16; // needed to jump to the next part } #endif /* COMPILE_MMX2 */ @@ -2726,7 +2726,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ int i; - uint8_t* src2[4]= {src[0], src[1], src[2]}; + uint8_t* src2[4]= {src[0], src[1], src[2], src[3]}; if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); @@ -2800,21 +2800,23 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, // copy strides, so they can safely be modified if (c->sliceDir == 1) { // slices go from top to bottom - int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2]}; - int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2]}; + int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2], srcStride[3]}; + int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]}; return c->swScale(c, src2, srcStride2, srcSliceY, srcSliceH, dst, dstStride2); } else { // slices go from bottom to top => we flip the image internally uint8_t* dst2[4]= {dst[0] + (c->dstH-1)*dstStride[0], dst[1] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1], - dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2]}; - int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2]}; - int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2]}; + dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2], + dst[3] + (c->dstH-1)*dstStride[3]}; + int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3]}; + int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3]}; src2[0] += (srcSliceH-1)*srcStride[0]; if (!usePal(c->srcFormat)) src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1]; src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2]; + src2[3] += (srcSliceH-1)*srcStride[3]; return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); } diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index cdf3754d14..13b9609060 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -228,6 +228,7 @@ const char *sws_format_name(int format); #define isPlanarYUV(x) ( \ (x)==PIX_FMT_YUV410P \ || (x)==PIX_FMT_YUV420P \ + || (x)==PIX_FMT_YUVA420P \ || (x)==PIX_FMT_YUV411P \ || (x)==PIX_FMT_YUV422P \ || (x)==PIX_FMT_YUV444P \ diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 6f2e243052..80704f6eb6 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -230,28 +230,28 @@ "test %%"REG_S", %%"REG_S" \n\t"\ " jnz 2b \n\t"\ -#define YSCALEYUV2PACKEDX_YA(offset) \ +#define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \ "lea "offset"(%0), %%"REG_d" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\ - "movq "VROUNDER_OFFSET"(%0), %%mm1 \n\t"\ - "movq %%mm1, %%mm7 \n\t"\ + "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\ + "movq "#dst1", "#dst2" \n\t"\ ASMALIGN(4)\ "2: \n\t"\ - "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\ - "movq (%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* Y1srcData */\ - "movq 8(%%"REG_S", %%"REG_a", 2), %%mm5 \n\t" /* Y2srcData */\ + "movq 8(%%"REG_d"), "#coeff" \n\t" /* filterCoeff */\ + "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" /* Y1srcData */\ + "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" /* Y2srcData */\ "add $16, %%"REG_d" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\ - "pmulhw %%mm0, %%mm2 \n\t"\ - "pmulhw %%mm0, %%mm5 \n\t"\ - "paddw %%mm2, %%mm1 \n\t"\ - "paddw %%mm5, %%mm7 \n\t"\ + "pmulhw "#coeff", "#src1" \n\t"\ + "pmulhw "#coeff", "#src2" \n\t"\ + "paddw "#src1", "#dst1" \n\t"\ + "paddw "#src2", "#dst2" \n\t"\ "test %%"REG_S", %%"REG_S" \n\t"\ " jnz 2b \n\t"\ #define YSCALEYUV2PACKEDX \ YSCALEYUV2PACKEDX_UV \ - YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET) \ + YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \ #define YSCALEYUV2PACKEDX_END \ :: "r" (&c->redDither), \ @@ -458,11 +458,11 @@ "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\ /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ -#define REAL_YSCALEYUV2RGB_YA(index, c) \ - "movq (%0, "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ - "movq (%1, "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ - "movq 8(%0, "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ - "movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ +#define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \ + "movq ("#b1", "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ + "movq ("#b2", "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ + "movq 8("#b1", "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ + "movq 8("#b2", "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\ "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\ "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ @@ -501,11 +501,11 @@ "packuswb %%mm6, %%mm5 \n\t"\ "packuswb %%mm3, %%mm4 \n\t"\ -#define YSCALEYUV2RGB_YA(index, c) REAL_YSCALEYUV2RGB_YA(index, c) +#define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) #define YSCALEYUV2RGB(index, c) \ REAL_YSCALEYUV2RGB_UV(index, c) \ - REAL_YSCALEYUV2RGB_YA(index, c) \ + REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \ REAL_YSCALEYUV2RGB_COEFF(c) #define REAL_YSCALEYUV2PACKED1(index, c) \ @@ -1663,7 +1663,7 @@ static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, uint8_t * {\ int pix0= ((type*)src)[2*i+0];\ int pix1= ((type*)src)[2*i+1];\ - int g= (pix0&(maskg|maska))+(pix1&(maskg|maska));\ + int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\ int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\ int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\ g&= maskg|(2*maskg);\ diff --git a/libvo/fastmemcpy.h b/libvo/fastmemcpy.h index fa736b62f0..16767d9842 100644 --- a/libvo/fastmemcpy.h +++ b/libvo/fastmemcpy.h @@ -23,20 +23,13 @@ #include <inttypes.h> #include <string.h> -#ifdef CONFIG_FASTMEMCPY -#if HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW \ -/* || HAVE_SSE || HAVE_SSE2 */ +#if defined(CONFIG_FASTMEMCPY) && (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */) #include <stddef.h> void * fast_memcpy(void * to, const void * from, size_t len); void * mem2agpcpy(void * to, const void * from, size_t len); -#else /* HAVE_MMX/MMX2/3DNOW/SSE/SSE2 */ -#define mem2agpcpy(a,b,c) memcpy(a,b,c) -#define fast_memcpy(a,b,c) memcpy(a,b,c) -#endif - -#else /* CONFIG_FASTMEMCPY */ +#else #define mem2agpcpy(a,b,c) memcpy(a,b,c) #define fast_memcpy(a,b,c) memcpy(a,b,c) #endif diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c index ac9bcbfa75..38b6178e5c 100644 --- a/libvo/font_load_ft.c +++ b/libvo/font_load_ft.c @@ -56,8 +56,8 @@ #endif char *subtitle_font_encoding = NULL; -float text_font_scale_factor = 5.0; -float osd_font_scale_factor = 6.0; +float text_font_scale_factor = 3.5; +float osd_font_scale_factor = 4.0; float subtitle_font_radius = 2.0; float subtitle_font_thickness = 2.0; // 0 = no autoscale diff --git a/libvo/video_out.c b/libvo/video_out.c index 2791ba54b3..eb348dd086 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -100,6 +100,7 @@ extern struct vo_driver video_out_mpegpes; extern struct vo_driver video_out_yuv4mpeg; extern struct vo_driver video_out_direct3d; extern struct vo_driver video_out_directx; +extern struct vo_driver video_out_kva; extern struct vo_driver video_out_dxr2; extern struct vo_driver video_out_dxr3; extern struct vo_driver video_out_ivtv; @@ -134,6 +135,9 @@ const struct vo_driver *video_out_drivers[] = #ifdef CONFIG_DIRECT3D &video_out_direct3d, #endif +#ifdef CONFIG_KVA + &video_out_kva, +#endif #ifdef CONFIG_COREVIDEO &video_out_macosx, #endif diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c index d0807dc132..48b9f2f2ad 100644 --- a/libvo/vo_aa.c +++ b/libvo/vo_aa.c @@ -575,19 +575,19 @@ static int parse_suboptions(const char *arg) { char *pseudoargv[4], *osdcolor = NULL, *subcolor = NULL, **strings, *helpmsg = NULL; int pseudoargc, displayhelp = 0, *booleans; - opt_t extra_opts[] = { + const opt_t extra_opts[] = { {"osdcolor", OPT_ARG_MSTRZ, &osdcolor, NULL, 0}, {"subcolor", OPT_ARG_MSTRZ, &subcolor, NULL, 0}, {"help", OPT_ARG_BOOL, &displayhelp, NULL, 0} }; opt_t *subopts = NULL, *p; - char *strings_list[] = {"-driver", "-kbddriver", "-mousedriver", "-font", + char * const strings_list[] = {"-driver", "-kbddriver", "-mousedriver", "-font", "-width", "-height", "-minwidth", "-minheight", "-maxwidth", "-maxheight", "-recwidth", "-recheight", "-bright", "-contrast", "-gamma", "-dimmul", "-boldmul", "-random" }; - char *booleans_list[] = {"-dim", "-bold", "-reverse", "-normal", + char * const booleans_list[] = {"-dim", "-bold", "-reverse", "-normal", "-boldfont", "-inverse", "-extended", "-eight", "-dither", "-floyd_steinberg", "-error_distribution"}; - char *nobooleans_list[] = {"-nodim", "-nobold", "-noreverse", "-nonormal", + char * const nobooleans_list[] = {"-nodim", "-nobold", "-noreverse", "-nonormal", "-noboldfont", "-noinverse", "-noextended", "-noeight", "-nodither", "-nofloyd_steinberg", "-noerror_distribution"}; const int nstrings = sizeof(strings_list) / sizeof(char*); diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index 9124ad5dd0..caff687d02 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -175,7 +175,7 @@ static int preinit(const char *arg) strarg_t mode_str = {0, NULL}; strarg_t par_str = {0, NULL}; strarg_t dfb_params = {0, NULL}; - opt_t subopts[] = { + const opt_t subopts[] = { {"input", OPT_ARG_BOOL, &use_input, NULL}, {"buffermode", OPT_ARG_STR, &mode_str, check_mode}, {"fieldparity", OPT_ARG_STR, &par_str, check_parity}, diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c index c51e303a7b..78dd5249fd 100644 --- a/libvo/vo_gif89a.c +++ b/libvo/vo_gif89a.c @@ -104,7 +104,7 @@ static char *gif_filename = NULL; // the default output filename #define DEFAULT_FILE "out.gif" -static opt_t subopts[] = { +static const opt_t subopts[] = { {"output", OPT_ARG_MSTRZ, &gif_filename, NULL, 0}, {"fps", OPT_ARG_FLOAT, &target_fps, NULL, 0}, {NULL, 0, NULL, NULL, 0} diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 2c9f48d0e1..2e85163833 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -973,7 +973,7 @@ uninit(void) vo_uninit(); } -static opt_t subopts[] = { +static const opt_t subopts[] = { {"manyfmts", OPT_ARG_BOOL, &many_fmts, NULL}, {"osd", OPT_ARG_BOOL, &use_osd, NULL}, {"scaled-osd", OPT_ARG_BOOL, &scaled_osd, NULL}, diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 66099e16d0..382994e318 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -844,7 +844,7 @@ uninit(void) vo_uninit(); } -static opt_t subopts[] = { +static const opt_t subopts[] = { {"yuv", OPT_ARG_INT, &use_yuv, (opt_test_f)int_non_neg}, {"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL}, {NULL} diff --git a/libvo/vo_ivtv.c b/libvo/vo_ivtv.c index 38b9ee7f4e..94daaa577b 100644 --- a/libvo/vo_ivtv.c +++ b/libvo/vo_ivtv.c @@ -59,7 +59,7 @@ static vo_mpegpes_t *pes; static int output = -1; static char *device = NULL; -static opt_t subopts[] = { +static const opt_t subopts[] = { {"output", OPT_ARG_INT, &output, (opt_test_f)int_non_neg}, {"device", OPT_ARG_MSTRZ, &device, NULL}, {NULL} diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index 3d8fcc77f0..cd6a83a938 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -339,7 +339,7 @@ static int int_zero_hundred(int *val) static int preinit(const char *arg) { - opt_t subopts[] = { + const opt_t subopts[] = { {"progressive", OPT_ARG_BOOL, &jpeg_progressive_mode, NULL, 0}, {"baseline", OPT_ARG_BOOL, &jpeg_baseline, NULL, 0}, {"optimize", OPT_ARG_INT, &jpeg_optimize, diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c new file mode 100644 index 0000000000..6b126ed592 --- /dev/null +++ b/libvo/vo_kva.c @@ -0,0 +1,1075 @@ +/* + * OS/2 video output driver + * + * Copyright (c) 2007-2009 by KO Myung-Hun (komh@chollian.net) + * + * This file is part of MPlayer. + * + * MPlayer 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. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU 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. + */ + +#define INCL_WIN +#define INCL_GPI +#define INCL_DOS +#include <os2.h> + +#include <mmioos2.h> +#include <fourcc.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <float.h> + +#include <kva.h> + +#include "config.h" +#include "mp_msg.h" +#include "help_mp.h" +#include "video_out.h" +#include "video_out_internal.h" +#include "aspect.h" + +#include "fastmemcpy.h" +#include "mp_fifo.h" +#include "osdep/keycodes.h" +#include "input/input.h" +#include "input/mouse.h" +#include "subopt-helper.h" +#include "sub.h" + +#include "cpudetect.h" +#include "libswscale/swscale.h" +#include "libmpcodecs/vf_scale.h" + +static const vo_info_t info = { + "SNAP/WarpOverlay!/DIVE video output", + "kva", + "KO Myung-Hun <komh@chollian.net>", + "" +}; + +LIBVO_EXTERN(kva) + +#define WC_MPLAYER "WC_MPLAYER" + +#define SRC_WIDTH m_int.kvas.szlSrcSize.cx +#define SRC_HEIGHT m_int.kvas.szlSrcSize.cy + +#define HWNDFROMWINID(wid) ((wid) + 0x80000000UL) + +static const struct keymap m_vk_map[] = { + {VK_NEWLINE, KEY_ENTER}, {VK_TAB, KEY_TAB}, {VK_SPACE, ' '}, + + // control keys + {VK_CTRL, KEY_CTRL}, {VK_BACKSPACE, KEY_BS}, + {VK_DELETE, KEY_DELETE}, {VK_INSERT, KEY_INSERT}, + {VK_HOME, KEY_HOME}, {VK_END, KEY_END}, + {VK_PAGEUP, KEY_PAGE_UP}, {VK_PAGEDOWN, KEY_PAGE_DOWN}, + {VK_ESC, KEY_ESC}, + + // cursor keys + {VK_RIGHT, KEY_RIGHT}, {VK_LEFT, KEY_LEFT}, + {VK_DOWN, KEY_DOWN}, {VK_UP, KEY_UP}, + + // function keys + {VK_F1, KEY_F+1}, {VK_F2, KEY_F+2}, {VK_F3, KEY_F+3}, {VK_F4, KEY_F+4}, + {VK_F5, KEY_F+5}, {VK_F6, KEY_F+6}, {VK_F7, KEY_F+7}, {VK_F8, KEY_F+8}, + {VK_F9, KEY_F+9}, {VK_F10, KEY_F+10}, {VK_F11, KEY_F+11}, {VK_F12, KEY_F+12}, + + {0, 0} +}; + +static const struct keymap m_keypad_map[] = { + // keypad keys + {0x52, KEY_KP0}, {0x4F, KEY_KP1}, {0x50, KEY_KP2}, {0x51, KEY_KP3}, + {0x4B, KEY_KP4}, {0x4C, KEY_KP5}, {0x4D, KEY_KP6}, {0x47, KEY_KP7}, + {0x48, KEY_KP8}, {0x49, KEY_KP9}, {0x53, KEY_KPDEC}, {0x5A, KEY_KPENTER}, + + {0, 0} +}; + +static const struct keymap m_mouse_map[] = { + {WM_BUTTON1DOWN, MOUSE_BTN0}, + {WM_BUTTON3DOWN, MOUSE_BTN1}, + {WM_BUTTON2DOWN, MOUSE_BTN2}, + {WM_BUTTON1DBLCLK, MOUSE_BTN0_DBL}, + {WM_BUTTON3DBLCLK, MOUSE_BTN1_DBL}, + {WM_BUTTON2DBLCLK, MOUSE_BTN2_DBL}, + + {0, 0} +}; + +struct { + HAB hab; + HMQ hmq; + HWND hwndFrame; + HWND hwndClient; + HWND hwndSysMenu; + HWND hwndTitleBar; + HWND hwndMinMax; + FOURCC fcc; + int iImageFormat; + int nChromaShift; + KVASETUP kvas; + KVACAPS kvac; + RECTL rclDst; + int bpp; + LONG lStride; + PBYTE pbImage; + BOOL fFixT23; + PFNWP pfnwpOldFrame; + uint8_t *planes[3]; // y = 0, u = 1, v = 2 + int stride[3]; + BOOL fHWAccel; + RECTL rclParent; + struct SwsContext *sws; +} m_int; + +static inline void setAspectRatio(ULONG ulRatio) +{ + m_int.kvas.ulRatio = ulRatio; + kvaSetup(&m_int.kvas); +} + +static int query_format_info(int format, PBOOL pfHWAccel, PFOURCC pfcc, + int *pbpp, int *pnChromaShift) +{ + BOOL fHWAccel; + FOURCC fcc; + INT bpp; + INT nChromaShift; + + switch (format) { + case IMGFMT_YV12: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YV12; + fcc = FOURCC_YV12; + bpp = 1; + nChromaShift = 1; + break; + + case IMGFMT_YUY2: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YUY2; + fcc = FOURCC_Y422; + bpp = 2; + nChromaShift = 0; + break; + + case IMGFMT_YVU9: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YVU9; + fcc = FOURCC_YVU9; + bpp = 1; + nChromaShift = 2; + break; + + case IMGFMT_BGR24: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR24; + fcc = FOURCC_BGR3; + bpp = 3; + nChromaShift = 0; + break; + + case IMGFMT_BGR16: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR16; + fcc = FOURCC_R565; + bpp = 2; + nChromaShift = 0; + break; + + case IMGFMT_BGR15: + fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR15; + fcc = FOURCC_R555; + bpp = 2; + nChromaShift = 0; + break; + + default: + return 1; + } + + if (pfHWAccel) + *pfHWAccel = fHWAccel; + + if (pfcc) + *pfcc = fcc; + + if (pbpp) + *pbpp = bpp; + + if (pnChromaShift) + *pnChromaShift = nChromaShift; + + return 0; +} + +static void imgCreate(void) +{ + int size = SRC_HEIGHT * m_int.lStride;; + + switch (m_int.iImageFormat) { + case IMGFMT_YV12: + size += size / 2; + break; + + case IMGFMT_YVU9: + size += size / 8; + break; + } + + m_int.pbImage = malloc(size); + + m_int.planes[0] = m_int.pbImage; + m_int.stride[0] = m_int.lStride; + + // YV12 or YVU9 ? + if (m_int.nChromaShift) { + m_int.planes[1] = m_int.planes[0] + SRC_HEIGHT * m_int.stride[0]; + m_int.stride[1] = m_int.stride[0] >> m_int.nChromaShift; + + m_int.planes[2] = m_int.planes[1] + + (SRC_HEIGHT >> m_int.nChromaShift) * m_int.stride[1]; + m_int.stride[2] = m_int.stride[1]; + } +} + +static void imgFree(void) +{ + free(m_int.pbImage); + + m_int.pbImage = NULL; +} + +static void imgDisplay(void) +{ + PVOID pBuffer; + ULONG ulBPL; + + if (!kvaLockBuffer(&pBuffer, &ulBPL)) { + uint8_t *dst[3]; + int dstStride[3]; + + // Get packed or Y + dst[0] = pBuffer; + dstStride[0] = ulBPL; + + // YV12 or YVU9 ? + if (m_int.nChromaShift) { + // Get V + dst[2] = dst[0] + SRC_HEIGHT * dstStride[0]; + dstStride[2] = dstStride[0] >> m_int.nChromaShift; + + // Get U + dst[1] = dst[2] + + (SRC_HEIGHT >> m_int.nChromaShift ) * dstStride[2]; + dstStride[1] = dstStride[2]; + } + + if (m_int.fHWAccel) { + int w, h; + + w = m_int.stride[0]; + h = SRC_HEIGHT; + + // Copy packed or Y + mem2agpcpy_pic(dst[0], m_int.planes[0], w, h, + dstStride[0], m_int.stride[0]); + + // YV12 or YVU9 ? + if (m_int.nChromaShift) { + w >>= m_int.nChromaShift; h >>= m_int.nChromaShift; + + // Copy U + mem2agpcpy_pic(dst[1], m_int.planes[1], w, h, + dstStride[1], m_int.stride[1]); + + // Copy V + mem2agpcpy_pic(dst[2], m_int.planes[2], w, h, + dstStride[2], m_int.stride[2]); + } + } else { + sws_scale(m_int.sws, m_int.planes, m_int.stride, 0, SRC_HEIGHT, + dst, dstStride); + } + + kvaUnlockBuffer(); + } +} + +// Frame window procedure to work around T23 laptop with S3 video card, +// which supports upscaling only. +static MRESULT EXPENTRY NewFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, + MPARAM mp2) +{ + switch (msg) { + case WM_QUERYTRACKINFO: + { + PTRACKINFO pti = (PTRACKINFO)mp2; + RECTL rcl; + + if (vo_fs) + break; + + m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2); + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = SRC_WIDTH + 1; + rcl.yTop = SRC_HEIGHT + 1; + + WinCalcFrameRect(hwnd, &rcl, FALSE); + + pti->ptlMinTrackSize.x = rcl.xRight - rcl.xLeft; + pti->ptlMinTrackSize.y = rcl.yTop - rcl.yBottom; + + pti->ptlMaxTrackSize.x = vo_screenwidth; + pti->ptlMaxTrackSize.y = vo_screenheight; + + return (MRESULT)TRUE; + } + + case WM_ADJUSTWINDOWPOS: + { + PSWP pswp = (PSWP)mp1; + RECTL rcl; + + if (vo_fs) + break; + + if (pswp->fl & SWP_SIZE) { + rcl.xLeft = pswp->x; + rcl.yBottom = pswp->y; + rcl.xRight = rcl.xLeft + pswp->cx; + rcl.yTop = rcl.yBottom + pswp->cy; + + WinCalcFrameRect(hwnd, &rcl, TRUE); + + if (rcl.xRight - rcl.xLeft <= SRC_WIDTH) + rcl.xRight = rcl.xLeft + (SRC_WIDTH + 1); + + if (rcl.yTop - rcl.yBottom <= SRC_HEIGHT) + rcl.yTop = rcl.yBottom + (SRC_HEIGHT + 1); + + WinCalcFrameRect(hwnd, &rcl, FALSE); + + if (rcl.xRight - rcl.xLeft > vo_screenwidth) { + rcl.xLeft = 0; + rcl.xRight = vo_screenwidth; + } + + if (rcl.yTop - rcl.yBottom > vo_screenheight) { + rcl.yBottom = 0; + rcl.yTop = vo_screenheight; + } + + pswp->fl |= SWP_MOVE; + pswp->x = rcl.xLeft; + pswp->y = rcl.yBottom; + pswp->cx = rcl.xRight - rcl.xLeft; + pswp->cy = rcl.yTop - rcl.yBottom; + } + break; + } + } + + return m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2); +} + +static MRESULT EXPENTRY WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) +{ + // if slave mode, ignore mouse events and deliver them to a parent window + if (WinID != -1 && + ((msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) || + (msg >= WM_EXTMOUSEFIRST && msg <= WM_EXTMOUSELAST))) { + WinPostMsg(HWNDFROMWINID(WinID), msg, mp1, mp2); + + return (MRESULT)TRUE; + } + + switch (msg) { + case WM_CLOSE: + mplayer_put_key(KEY_CLOSE_WIN); + + return 0; + + case WM_CHAR: + { + USHORT fsFlags = SHORT1FROMMP(mp1); + UCHAR uchScan = CHAR4FROMMP(mp1); + USHORT usCh = SHORT1FROMMP(mp2); + USHORT usVk = SHORT2FROMMP(mp2); + int mpkey; + + if (fsFlags & KC_KEYUP) + break; + + if (fsFlags & KC_SCANCODE) { + mpkey = lookup_keymap_table(m_keypad_map, uchScan); + if (mpkey) { + // distinguish KEY_KP0 and KEY_KPINS + if (mpkey == KEY_KP0 && usCh != '0') + mpkey = KEY_KPINS; + + // distinguish KEY_KPDEC and KEY_KPDEL + if (mpkey == KEY_KPDEC && usCh != '.') + mpkey = KEY_KPDEL; + + mplayer_put_key(mpkey); + + return (MRESULT)TRUE; + } + } + + if (fsFlags & KC_VIRTUALKEY) { + mpkey = lookup_keymap_table(m_vk_map, usVk); + if (mpkey) { + mplayer_put_key(mpkey); + + return (MRESULT)TRUE; + } + } + + if ((fsFlags & KC_CHAR) && !HIBYTE(usCh)) + mplayer_put_key(usCh); + + return (MRESULT)TRUE; + } + + case WM_BUTTON1DOWN: + case WM_BUTTON3DOWN: + case WM_BUTTON2DOWN: + case WM_BUTTON1DBLCLK: + case WM_BUTTON3DBLCLK: + case WM_BUTTON2DBLCLK: + if (WinQueryFocus(HWND_DESKTOP) != hwnd) + WinSetFocus(HWND_DESKTOP, hwnd); + else if (!vo_nomouse_input) + mplayer_put_key(lookup_keymap_table(m_mouse_map, msg)); + + return (MRESULT)TRUE; + + case WM_PAINT: + { + HPS hps; + RECTL rcl, rclDst; + PRECTL prcl = NULL; + HRGN hrgn, hrgnDst; + RGNRECT rgnCtl; + + // get a current movie area + kvaAdjustDstRect(&m_int.kvas.rclSrcRect, &rclDst); + + // get a current invalidated area + hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl); + + // create a region for an invalidated area + hrgn = GpiCreateRegion(hps, 1, &rcl); + // create a region for a movie area + hrgnDst = GpiCreateRegion(hps, 1, &rclDst); + + // exclude a movie area from an invalidated area + GpiCombineRegion(hps, hrgn, hrgn, hrgnDst, CRGN_DIFF); + + // get rectangles from the region + rgnCtl.ircStart = 1; + rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT; + GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL); + + if (rgnCtl.crcReturned > 0) { + rgnCtl.crc = rgnCtl.crcReturned; + prcl = malloc(sizeof(RECTL) * rgnCtl.crcReturned); + } + + // draw black bar if needed + if (prcl && GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prcl)) { + int i; + + for (i = 0; i < rgnCtl.crcReturned; i++) + WinFillRect(hps, &prcl[i], CLR_BLACK); + } + + free(prcl); + + GpiDestroyRegion(hps, hrgnDst); + GpiDestroyRegion(hps, hrgn); + + WinEndPaint(hps); + + return 0; + } + } + + return WinDefWindowProc(hwnd, msg, mp1, mp2); +} + +// Change process type from VIO to PM to use PM APIs. +static void morphToPM(void) +{ + PPIB pib; + + DosGetInfoBlocks(NULL, &pib); + + // Change flag from VIO to PM: + if (pib->pib_ultype == 2) + pib->pib_ultype = 3; +} + +static int preinit(const char *arg) +{ + HWND hwndParent; + ULONG flFrameFlags; + ULONG kvaMode = 0; + + int fUseSnap = 0; + int fUseWO = 0; + int fUseDive = 0; + int fFixT23 = 0; + + const opt_t subopts[] = { + {"snap", OPT_ARG_BOOL, &fUseSnap, NULL}, + {"wo", OPT_ARG_BOOL, &fUseWO, NULL}, + {"dive", OPT_ARG_BOOL, &fUseDive, NULL}, + {"t23", OPT_ARG_BOOL, &fFixT23, NULL}, + {NULL, 0, NULL, NULL} + }; + + PCSZ pcszVideoModeStr[3] = {"DIVE", "WarpOverlay!", "SNAP"}; + + if (subopt_parse(arg, subopts) != 0) + return -1; + + morphToPM(); + + memset(&m_int, 0, sizeof(m_int)); + + m_int.hab = WinInitialize(0); + m_int.hmq = WinCreateMsgQueue(m_int.hab, 0); + + WinRegisterClass(m_int.hab, + WC_MPLAYER, + WndProc, + CS_SIZEREDRAW | CS_MOVENOTIFY, + sizeof(PVOID)); + + if (WinID == -1) { + hwndParent = HWND_DESKTOP; + flFrameFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX | + FCF_SIZEBORDER | FCF_TASKLIST; + } else { + hwndParent = HWNDFROMWINID(WinID); + flFrameFlags = 0; + } + + m_int.hwndFrame = + WinCreateStdWindow(hwndParent, // parent window handle + WS_VISIBLE, // frame window style + &flFrameFlags, // window style + WC_MPLAYER, // class name + "", // window title + 0L, // default client style + NULLHANDLE, // resource in exe file + 1, // frame window id + &m_int.hwndClient); // client window handle + + if (m_int.hwndFrame == NULLHANDLE) + return -1; + + m_int.hwndSysMenu = WinWindowFromID(m_int.hwndFrame, FID_SYSMENU); + m_int.hwndTitleBar = WinWindowFromID(m_int.hwndFrame, FID_TITLEBAR); + m_int.hwndMinMax = WinWindowFromID(m_int.hwndFrame, FID_MINMAX); + + m_int.fFixT23 = fFixT23; + + if (m_int.fFixT23) + m_int.pfnwpOldFrame = WinSubclassWindow(m_int.hwndFrame, + NewFrameWndProc); + + if (!!fUseSnap + !!fUseWO + !!fUseDive > 1) + mp_msg(MSGT_VO, MSGL_WARN,"KVA: Multiple mode specified!!!\n"); + + if (fUseSnap) + kvaMode = KVAM_SNAP; + else if (fUseWO) + kvaMode = KVAM_WO; + else if (fUseDive) + kvaMode = KVAM_DIVE; + else + kvaMode = KVAM_AUTO; + + if (kvaInit(kvaMode, m_int.hwndClient, vo_colorkey)) { + mp_msg(MSGT_VO, MSGL_ERR, "KVA: Init failed!!!\n"); + + return -1; + } + + kvaCaps(&m_int.kvac); + + mp_msg(MSGT_VO, MSGL_V, "KVA: Selected video mode = %s\n", + pcszVideoModeStr[m_int.kvac.ulMode - 1]); + + kvaDisableScreenSaver(); + + // Might cause PM DLLs to be loaded which incorrectly enable SIG_FPE, + // so mask off all floating-point exceptions. + _control87(MCW_EM, MCW_EM); + + return 0; +} + +static void uninit(void) +{ + kvaEnableScreenSaver(); + + imgFree(); + + sws_freeContext(m_int.sws); + + if (m_int.hwndFrame != NULLHANDLE) { + kvaResetAttr(); + kvaDone(); + + if (m_int.fFixT23) + WinSubclassWindow(m_int.hwndFrame, m_int.pfnwpOldFrame); + + WinDestroyWindow(m_int.hwndFrame); + } + + WinDestroyMsgQueue(m_int.hmq); + WinTerminate(m_int.hab); +} + +static int config(uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, + uint32_t flags, char *title, uint32_t format) +{ + RECTL rcl; + + mp_msg(MSGT_VO, MSGL_V, + "KVA: Using 0x%X (%s) image format, vo_config_count = %d\n", + format, vo_format_name(format), vo_config_count); + + imgFree(); + + if (query_format_info(format, &m_int.fHWAccel, &m_int.fcc, &m_int.bpp, + &m_int.nChromaShift)) + return 1; + + m_int.iImageFormat = format; + + // if there is no hw accel for given format, + // try any format supported by hw accel + if (!m_int.fHWAccel) { + int dstFormat = 0; + + sws_freeContext(m_int.sws); + + if (m_int.kvac.ulInputFormatFlags & KVAF_YV12) + dstFormat = IMGFMT_YV12; + else if (m_int.kvac.ulInputFormatFlags & KVAF_YUY2) + dstFormat = IMGFMT_YUY2; + else if (m_int.kvac.ulInputFormatFlags & KVAF_YVU9) + dstFormat = IMGFMT_YVU9; + else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR24) + dstFormat = IMGFMT_BGR24; + else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR16) + dstFormat = IMGFMT_BGR16; + else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR15) + dstFormat = IMGFMT_BGR15; + + if (query_format_info(dstFormat, NULL, &m_int.fcc, NULL, NULL)) + return 1; + + m_int.sws = sws_getContextFromCmdLine(width, height, format, + width, height, dstFormat); + } + + mp_msg(MSGT_VO, MSGL_V, "KVA: Selected FOURCC = %.4s\n", (char *)&m_int.fcc); + + m_int.kvas.ulLength = sizeof(KVASETUP); + m_int.kvas.szlSrcSize.cx = width; + m_int.kvas.szlSrcSize.cy = height; + m_int.kvas.rclSrcRect.xLeft = 0; + m_int.kvas.rclSrcRect.yTop = 0; + m_int.kvas.rclSrcRect.xRight = width; + m_int.kvas.rclSrcRect.yBottom = height; + m_int.kvas.ulRatio = vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE; + m_int.kvas.ulAspectWidth = d_width; + m_int.kvas.ulAspectHeight = d_height; + m_int.kvas.fccSrcColor = m_int.fcc; + m_int.kvas.fDither = TRUE; + + if (kvaSetup(&m_int.kvas)) { + mp_msg(MSGT_VO, MSGL_ERR, "KVA: Setup failed!!!\n"); + + return 1; + } + + m_int.lStride = width * m_int.bpp; + + imgCreate(); + + if (WinID == -1) { + WinSetWindowText(m_int.hwndFrame, title); + + // initialize 'vo_fs' only once at first config() call + if (vo_config_count == 0) + vo_fs = flags & VOFLAG_FULLSCREEN; + + // workaround for T23 laptop with S3 Video by Franz Bakan + if (!vo_fs && m_int.fFixT23) { + d_width++; + d_height++; + } + + m_int.rclDst.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2; + m_int.rclDst.yBottom = ((LONG)vo_screenheight - (LONG)d_height) / 2; + m_int.rclDst.xRight = m_int.rclDst.xLeft + d_width; + m_int.rclDst.yTop = m_int.rclDst.yBottom + d_height; + + if (vo_fs) { + d_width = vo_screenwidth; + d_height = vo_screenheight; + + // when -fs option is used without this, title bar is not highlighted + WinSetActiveWindow(HWND_DESKTOP, m_int.hwndFrame); + + WinSetParent(m_int.hwndSysMenu, HWND_OBJECT, FALSE); + WinSetParent(m_int.hwndTitleBar, HWND_OBJECT, FALSE); + WinSetParent(m_int.hwndMinMax, HWND_OBJECT, FALSE); + + setAspectRatio(KVAR_FORCEANY); + } + + rcl.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2; + rcl.yBottom = ((LONG)vo_screenheight - (LONG)d_height) /2 ; + rcl.xRight = rcl.xLeft + d_width; + rcl.yTop = rcl.yBottom + d_height; + } else { + vo_fs = 0; + + WinQueryWindowRect(HWNDFROMWINID(WinID), &m_int.rclDst); + rcl = m_int.rclDst; + } + + WinCalcFrameRect(m_int.hwndFrame, &rcl, FALSE); + + WinSetWindowPos(m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | + (WinID == -1 ? SWP_ACTIVATE : 0)); + + WinInvalidateRect(m_int.hwndFrame, NULL, TRUE); + + return 0; +} + +static uint32_t get_image(mp_image_t *mpi) +{ + if (m_int.iImageFormat != mpi->imgfmt) + return VO_FALSE; + + if (mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) { + if (mpi->flags & MP_IMGFLAG_PLANAR) { + mpi->planes[1] = m_int.planes[1]; + mpi->planes[2] = m_int.planes[2]; + + mpi->stride[1] = m_int.stride[1]; + mpi->stride[2] = m_int.stride[2]; + } + + mpi->planes[0] = m_int.planes[0]; + mpi->stride[0] = m_int.stride[0]; + mpi->flags |= MP_IMGFLAG_DIRECT; + + return VO_TRUE; + } + + return VO_FALSE; +} + +static uint32_t draw_image(mp_image_t *mpi) +{ + // if -dr or -slices then do nothing: + if (mpi->flags & (MP_IMGFLAG_DIRECT | MP_IMGFLAG_DRAW_CALLBACK)) + return VO_TRUE; + + draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, mpi->x, mpi->y); + + return VO_TRUE; +} + +static int query_format(uint32_t format) +{ + BOOL fHWAccel; + int res; + + if (query_format_info(format, &fHWAccel, NULL, NULL, NULL)) + return 0; + + res = VFCAP_CSP_SUPPORTED | VFCAP_OSD; + if (fHWAccel) { + res |= VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP; + + if (!m_int.fFixT23) + res |= VFCAP_HWSCALE_DOWN; + } + + return res; +} + +static int fs_toggle(void) +{ + RECTL rcl; + + vo_fs = !vo_fs; + + if (vo_fs) { + SWP swp; + + WinQueryWindowPos(m_int.hwndFrame, &swp); + m_int.rclDst.xLeft = swp.x; + m_int.rclDst.yBottom = swp.y; + m_int.rclDst.xRight = m_int.rclDst.xLeft + swp.cx; + m_int.rclDst.yTop = m_int.rclDst.yBottom + swp.cy; + WinCalcFrameRect(m_int.hwndFrame, &m_int.rclDst, TRUE); + + if (WinID != -1) + WinSetParent(m_int.hwndFrame, HWND_DESKTOP, FALSE); + + WinSetParent(m_int.hwndSysMenu, HWND_OBJECT, FALSE); + WinSetParent(m_int.hwndTitleBar, HWND_OBJECT, FALSE); + WinSetParent(m_int.hwndMinMax, HWND_OBJECT, FALSE); + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = vo_screenwidth; + rcl.yTop = vo_screenheight; + + setAspectRatio(KVAR_FORCEANY); + } else { + if (WinID != -1) + WinSetParent(m_int.hwndFrame, HWNDFROMWINID(WinID), TRUE); + + WinSetParent(m_int.hwndSysMenu, m_int.hwndFrame, FALSE); + WinSetParent(m_int.hwndTitleBar, m_int.hwndFrame, FALSE); + WinSetParent(m_int.hwndMinMax, m_int.hwndFrame, FALSE); + + rcl = m_int.rclDst; + + setAspectRatio(vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE); + } + + WinCalcFrameRect(m_int.hwndFrame, &rcl, FALSE); + + WinSetWindowPos(m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | + (WinID == -1 ? SWP_ACTIVATE : 0)); + + return VO_TRUE; +} + +static int color_ctrl_set(char *what, int value) +{ + ULONG ulAttr; + ULONG ulValue; + + if (!strcmp(what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if (!strcmp(what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if (!strcmp(what, "hue")) + ulAttr = KVAA_HUE; + else if (!strcmp(what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + ulValue = (value + 100) * 255 / 200; + + if (kvaSetAttr(ulAttr, &ulValue)) + return VO_NOTIMPL; + + return VO_TRUE; +} + +static int color_ctrl_get(char *what, int *value) +{ + ULONG ulAttr; + ULONG ulValue; + + if (!strcmp(what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if (!strcmp(what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if (!strcmp(what, "hue")) + ulAttr = KVAA_HUE; + else if (!strcmp(what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + if (kvaQueryAttr(ulAttr, &ulValue)) + return VO_NOTIMPL; + + // add 1 to adjust range + *value = ((ulValue + 1) * 200 / 255) - 100; + + return VO_TRUE; +} + +static int control(uint32_t request, void *data) +{ + switch (request) { + case VOCTRL_GET_IMAGE: + return get_image(data); + + case VOCTRL_DRAW_IMAGE: + return draw_image(data); + + case VOCTRL_QUERY_FORMAT: + return query_format(*(uint32_t *)data); + + case VOCTRL_FULLSCREEN: + return fs_toggle(); + + case VOCTRL_SET_EQUALIZER: + { + struct voctrl_set_equalizer_args *args = data; + color_ctrl_set(args->name, args->value); + } + + case VOCTRL_GET_EQUALIZER: + { + struct voctrl_get_equalizer_args *args = data; + return color_ctrl_get(args->name, args->valueptr); + } + + case VOCTRL_UPDATE_SCREENINFO: + vo_screenwidth = m_int.kvac.cxScreen; + vo_screenheight = m_int.kvac.cyScreen; + + aspect_save_screenres(vo_screenwidth, vo_screenheight); + + return VO_TRUE; + } + + return VO_NOTIMPL; +} + +static int draw_frame(uint8_t *src[]) +{ + return VO_ERROR; +} + +static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) +{ + uint8_t *s; + uint8_t *d; + + // copy packed or Y + d = m_int.planes[0] + m_int.stride[0] * y + x; + s = src[0]; + mem2agpcpy_pic(d, s, w * m_int.bpp, h, m_int.stride[0], stride[0]); + + // YV12 or YVU9 + if (m_int.nChromaShift) { + w >>= m_int.nChromaShift; h >>= m_int.nChromaShift; + x >>= m_int.nChromaShift; y >>= m_int.nChromaShift; + + // copy U + d = m_int.planes[1] + m_int.stride[1] * y + x; + s = src[1]; + mem2agpcpy_pic(d, s, w, h, m_int.stride[1], stride[1]); + + // copy V + d = m_int.planes[2] + m_int.stride[2] * y + x; + s = src[2]; + mem2agpcpy_pic(d, s, w, h, m_int.stride[2], stride[2]); + } + + return 0; +} + +#define vo_draw_alpha(imgfmt) \ + vo_draw_alpha_##imgfmt(w, h, src, srca, stride, \ + m_int.planes[0] + m_int.stride[0] * y0 + m_int.bpp * x0, \ + m_int.stride[0]) + +static void draw_alpha(int x0, int y0, int w, int h, + unsigned char *src, unsigned char *srca, int stride) +{ + switch (m_int.iImageFormat) { + case IMGFMT_YV12: + case IMGFMT_YVU9: + vo_draw_alpha(yv12); + break; + + case IMGFMT_YUY2: + vo_draw_alpha(yuy2); + break; + + case IMGFMT_BGR24: + vo_draw_alpha(rgb24); + break; + + case IMGFMT_BGR16: + vo_draw_alpha(rgb16); + break; + + case IMGFMT_BGR15: + vo_draw_alpha(rgb15); + break; + } +} + +static void draw_osd(void) +{ + vo_draw_text(SRC_WIDTH, SRC_HEIGHT, draw_alpha); +} + +static void flip_page(void) +{ + imgDisplay(); +} + +static void check_events(void) +{ + QMSG qm; + + // On slave mode, we need to change our window size according to a + // parent window size + if (WinID != -1) { + RECTL rcl; + + WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl); + + if (rcl.xLeft != m_int.rclParent.xLeft || + rcl.yBottom != m_int.rclParent.yBottom || + rcl.xRight != m_int.rclParent.xRight || + rcl.yTop != m_int.rclParent.yTop) { + WinSetWindowPos(m_int.hwndFrame, NULLHANDLE, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE); + + m_int.rclParent = rcl; + } + } + + while (WinPeekMsg(m_int.hab, &qm, NULLHANDLE, 0, 0, PM_REMOVE)) + WinDispatchMsg(m_int.hab, &qm); +} diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index 2c7bed9e53..eaa08c3316 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -1,4 +1,7 @@ /* + * Mac OS X video output driver + * Copyright (c) 2005 Nicolas Plourde <nicolasplourde@gmail.com> + * * This file is part of MPlayer. * * MPlayer is free software; you can redistribute it and/or modify @@ -16,14 +19,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* - vo_macosx.m - by Nicolas Plourde <nicolasplourde@gmail.com> - - MPlayer Mac OSX video out module. - Copyright (c) Nicolas Plourde - 2005 -*/ - #import "vo_macosx.h" #include <sys/types.h> #include <sys/ipc.h> @@ -99,7 +94,7 @@ static BOOL isLeopardOrLater; static vo_info_t info = { - "Mac OSX Core Video", + "Mac OS X Core Video", "macosx", "Nicolas Plourde <nicolas.plourde@gmail.com>", "" @@ -131,7 +126,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ } else { - mp_msg(MSGT_VO, MSGL_FATAL, "Get device error: Device ID %d do not exist, falling back to main device.\n", screen_id); + mp_msg(MSGT_VO, MSGL_FATAL, "Get device error: Device ID %d does not exist, falling back to main device.\n", screen_id); screen_handle = [screen_array objectAtIndex:0]; screen_id = -1; } @@ -216,7 +211,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ return 1; } - //connnect to mplayerosx + //connect to mplayerosx mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:[NSString stringWithCString:buffer_name] host:nil]; if ([mplayerosxProxy conformsToProtocol:@protocol(MPlayerOSXVOProto)]) { [mplayerosxProxy setProtocolForProxy:@protocol(MPlayerOSXVOProto)]; @@ -361,7 +356,7 @@ static int preinit(const char *arg) "Example: mplayer -vo macosx:device_id=1:shared_buffer:buffer_name=mybuff\n" "\nOptions:\n" " device_id=<0-...>\n" - " Set screen device id for fullscreen.\n" + " Set screen device ID for fullscreen.\n" " shared_buffer\n" " Write output to a shared memory buffer instead of displaying it.\n" " buffer_name=<name>\n" @@ -812,7 +807,7 @@ static int control(uint32_t request, void *data) curTime = TickCount()/60; - //auto hide mouse cursor (and future on-screen control?) + //automatically hide mouse cursor (and future on-screen control?) if(isFullscreen && !mouseHide && !isRootwin) { if( ((curTime - lastMouseHide) >= 5) || (lastMouseHide == 0) ) @@ -963,8 +958,8 @@ static int control(uint32_t request, void *data) return; [NSApp sendEvent:event]; // Without SDL's bootstrap code (include SDL.h in mplayer.c), - // on Leopard, we got trouble to get the play window auto focused - // when app is actived. Following code fix this problem. + // on Leopard, we have trouble to get the play window automatically focused + // when the app is actived. The Following code fix this problem. #ifndef CONFIG_SDL if (isLeopardOrLater && [event type] == NSAppKitDefined && [event subtype] == NSApplicationActivatedEventType) { diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c index be325f133a..c0996354e5 100644 --- a/libvo/vo_md5sum.c +++ b/libvo/vo_md5sum.c @@ -107,7 +107,7 @@ static void md5sum_write_error(void) { static int preinit(const char *arg) { - opt_t subopts[] = { + const opt_t subopts[] = { {"outfile", OPT_ARG_MSTRZ, &md5sum_outfile, NULL, 0}, {NULL, 0, NULL, NULL, 0} }; diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 0e28b0e2e0..608a9a63c0 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -229,7 +229,7 @@ static int int_zero_to_nine(int *sh) return 1; } -static opt_t subopts[] = { +static const opt_t subopts[] = { {"alpha", OPT_ARG_BOOL, &use_alpha, NULL, 0}, {"z", OPT_ARG_INT, &z_compression, (opt_test_f)int_zero_to_nine}, {NULL} diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index a6e4431331..2defb37ba5 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -120,7 +120,7 @@ static int preinit(const char *arg) { int ppm_type = 0, pgm_type = 0, pgmyuv_type = 0, raw_mode = 0, ascii_mode = 0; - opt_t subopts[] = { + const opt_t subopts[] = { {"ppm", OPT_ARG_BOOL, &ppm_type, NULL, 0}, {"pgm", OPT_ARG_BOOL, &pgm_type, NULL, 0}, {"pgmyuv", OPT_ARG_BOOL, &pgmyuv_type, NULL, 0}, diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index ab9ab8935e..d4c0e75041 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -1526,7 +1526,7 @@ static int preinit(const char *arg) char * sdl_driver = NULL; int sdl_hwaccel; int sdl_forcexv; - opt_t subopts[] = { + const opt_t subopts[] = { {"forcexv", OPT_ARG_BOOL, &sdl_forcexv, NULL, 0}, {"hwaccel", OPT_ARG_BOOL, &sdl_hwaccel, NULL, 0}, {"driver", OPT_ARG_MSTRZ, &sdl_driver, NULL, 0}, diff --git a/libvo/vo_v4l2.c b/libvo/vo_v4l2.c index 7157c68430..633612743c 100644 --- a/libvo/vo_v4l2.c +++ b/libvo/vo_v4l2.c @@ -53,7 +53,7 @@ static vo_mpegpes_t *pes; static int output = -1; static char *device = NULL; -static opt_t subopts[] = { +static const opt_t subopts[] = { {"output", OPT_ARG_INT, &output, (opt_test_f)int_non_neg}, {"device", OPT_ARG_MSTRZ, &device, NULL}, {NULL} diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index fec166c78e..085dfb4156 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -786,6 +786,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w, int h, break; case IMGFMT_VDPAU_H264: vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; + mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs); break; case IMGFMT_VDPAU_WMV3: vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; @@ -949,7 +950,7 @@ static void uninit(void) dlclose(vdpau_lib_handle); } -static opt_t subopts[] = { +static const opt_t subopts[] = { {"deint", OPT_ARG_INT, &deint, (opt_test_f)int_non_neg}, {"pullup", OPT_ARG_BOOL, &pullup, NULL}, {"denoise", OPT_ARG_FLOAT, &denoise, NULL}, diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index fc6f0b99d9..178c9c4ca9 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -317,8 +317,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, ctx->current_buf = 0; ctx->current_ip_buf = 0; - if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) - vo_fs = 1; resize(vo); @@ -682,7 +680,7 @@ static int preinit(struct vo *vo, const char *arg) struct vo_x11_state *x11 = vo->x11; int xv_adaptor = -1; - opt_t subopts[] = { + const opt_t subopts[] = { /* name arg type arg var test */ {"port", OPT_ARG_INT, &x11->xv_port, (opt_test_f) int_pos}, {"adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f) int_non_neg}, diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 6212f94c19..696fc682ba 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -379,7 +379,7 @@ static int preinit(const char *arg){ int mc_ver,mc_rev; strarg_t ck_src_arg = { 0, NULL }; strarg_t ck_method_arg = { 0, NULL }; - opt_t subopts [] = + const opt_t subopts [] = { /* name arg type arg var test */ { "port", OPT_ARG_INT, &xv_port_request, (opt_test_f)int_pos }, @@ -664,8 +664,6 @@ skip_surface_allocation: #endif } - if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; - //end vo_xv /* store image dimesions for displaying */ diff --git a/libvo/vo_yuv4mpeg.c b/libvo/vo_yuv4mpeg.c index bd4300eee6..3a7a9a9d5c 100644 --- a/libvo/vo_yuv4mpeg.c +++ b/libvo/vo_yuv4mpeg.c @@ -513,7 +513,7 @@ static void check_events(void) static int preinit(const char *arg) { int il, il_bf; - opt_t subopts[] = { + const opt_t subopts[] = { {"interlaced", OPT_ARG_BOOL, &il, NULL}, {"interlaced_bf", OPT_ARG_BOOL, &il_bf, NULL}, {"file", OPT_ARG_MSTRZ, &yuv_filename, NULL}, diff --git a/libvo/vo_zr2.c b/libvo/vo_zr2.c index d14a8d4d39..d3fe6604de 100644 --- a/libvo/vo_zr2.c +++ b/libvo/vo_zr2.c @@ -209,7 +209,7 @@ static int preinit(const char *arg) { const char *dev = NULL; char *dev_arg = NULL, *norm_arg = NULL; int norm = VIDEO_MODE_AUTO, prebuf = 0; - opt_t subopts[] = { /* don't want warnings with -Wall... */ + const opt_t subopts[] = { /* don't want warnings with -Wall... */ { "dev", OPT_ARG_MSTRZ, &dev_arg, NULL, 0 }, { "prebuf", OPT_ARG_BOOL, &prebuf, (opt_test_f)pbc, 0 }, { "norm", OPT_ARG_MSTRZ, &norm_arg, (opt_test_f)nc, 0 }, diff --git a/mp3lib/decode_mmx.c b/mp3lib/decode_mmx.c index 55dc6a9081..67a7cdb510 100644 --- a/mp3lib/decode_mmx.c +++ b/mp3lib/decode_mmx.c @@ -12,9 +12,9 @@ #define real float /* ugly - but only way */ extern void (*dct64_MMX_func)(short*, short*, real*); -static unsigned long long attribute_used __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL; -static unsigned long long attribute_used __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL; -unsigned int __attribute__((aligned(16))) costab_mmx[] = +static const unsigned long long attribute_used __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL; +static const unsigned long long attribute_used __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL; +const unsigned int __attribute__((aligned(16))) costab_mmx[] = { 1056974725, 1057056395, @@ -54,7 +54,7 @@ unsigned int __attribute__((aligned(16))) costab_mmx[] = make_decode_tables_MMX(32768), which had been implemented in (deleted since r23383) tabinit_MMX.c. */ -static short __attribute__((aligned(8))) mp3lib_decwins[] = +static const short __attribute__((aligned(8))) mp3lib_decwins[] = { 0, 7, 54, 114, 510, 1288, 1644, 9372, 18760, -9373, 1644, -1289, 510, -115, 54, -8, @@ -191,7 +191,7 @@ int synth_1to1_MMX(real *bandPtr, int channel, short *samples) static short buffs[2][2][0x110] __attribute__((aligned(8))); static int bo = 1; short *b0, (*buf)[0x110], *a, *b; - short* window; + const short* window; int bo1, i = 8; if (channel == 0) { diff --git a/mp3lib/layer3.c b/mp3lib/layer3.c index 3511c70f3a..71dec48663 100644 --- a/mp3lib/layer3.c +++ b/mp3lib/layer3.c @@ -44,16 +44,16 @@ static real cos9[3],cos18[3]; #endif struct bandInfoStruct { - int longIdx[23]; - int longDiff[22]; - int shortIdx[14]; - int shortDiff[13]; + uint16_t longIdx[23]; + uint8_t longDiff[22]; + uint16_t shortIdx[14]; + uint8_t shortDiff[13]; }; static int longLimit[9][23]; static int shortLimit[9][14]; -static struct bandInfoStruct bandInfo[9] = { +static const struct bandInfoStruct bandInfo[9] = { /* MPEG 1.0 */ { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, @@ -132,7 +132,7 @@ static void init_layer3(int down_sample_sblimit) for (i=0;i<8;i++) { - static double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; + static const double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; double sq=sqrt(1.0+Ci[i]*Ci[i]); aa_cs[i] = 1.0/sq; aa_ca[i] = Ci[i]/sq; @@ -180,7 +180,7 @@ static void init_layer3(int down_sample_sblimit) } for(j=0;j<4;j++) { - static int len[4] = { 36,36,12,36 }; + static const int len[4] = { 36,36,12,36 }; for(i=0;i<len[j];i+=2) win1[j][i] = + win[j][i]; for(i=1;i<len[j];i+=2) @@ -213,10 +213,10 @@ static void init_layer3(int down_sample_sblimit) for(j=0;j<9;j++) { - struct bandInfoStruct *bi = &bandInfo[j]; + const struct bandInfoStruct *bi = &bandInfo[j]; int *mp; int cb,lwin; - int *bdf; + const uint8_t *bdf; mp = map[j][0] = mapbuf0[j]; bdf = bi->longDiff; @@ -984,7 +984,7 @@ static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT],int *scalefac, struct gr_info_s *gr_info,int sfreq,int ms_stereo,int lsf) { real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf; - struct bandInfoStruct *bi = &bandInfo[sfreq]; + const struct bandInfoStruct *bi = &bandInfo[sfreq]; const real *tab1,*tab2; @@ -70,6 +70,7 @@ typedef struct MPOpts { int use_lirc; int use_lircc; int use_ar; // apple remote + int default_binds; } input; } MPOpts; diff --git a/stream/freesdp/parser.c b/stream/freesdp/parser.c index c17041b7ba..bf6f985e94 100644 --- a/stream/freesdp/parser.c +++ b/stream/freesdp/parser.c @@ -1644,7 +1644,7 @@ const char * fsdp_get_media_format (const fsdp_media_description_t * dsc, unsigned int index) { - if (!dsc || (index < dsc->formats_count)) + if (!dsc || (index < dsc->formats_count - 1)) return NULL; return dsc->formats[index]; } diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c index 0c00e5b454..66c7be4a36 100644 --- a/stream/librtsp/rtsp_rtp.c +++ b/stream/librtsp/rtsp_rtp.c @@ -507,7 +507,8 @@ rtp_setup_and_play (rtsp_t *rtsp_session) } /* only MPEG-TS is supported at the moment */ - if (!strstr (fsdp_get_media_format (med_dsc, 0), + if (!fsdp_get_media_format (med_dsc, 0) || + !strstr (fsdp_get_media_format (med_dsc, 0), RTSP_MEDIA_CONTAINER_MPEG_TS)) { fsdp_description_delete (dsc); |