diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-23 21:00:52 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-23 21:00:52 +0200 |
commit | 66f6f9f0768de5b003fc1b0fa9b1ea428466308a (patch) | |
tree | 157b98be78b0cd1e99b3dd51979bc97792d11642 | |
parent | ebb541c6553af10203b2c2f5bcead6118a44f5be (diff) | |
parent | 30aa2383cadb2f879e02dca9df293c01119a3111 (diff) |
Merge svn changes up to r28712
-rw-r--r-- | Changelog | 3 | ||||
-rw-r--r-- | DOCS/man/en/mplayer.1 | 7 | ||||
-rw-r--r-- | DOCS/man/ru/mplayer.1 | 11 | ||||
-rw-r--r-- | DOCS/xml/en/cd-dvd.xml | 14 | ||||
-rw-r--r-- | DOCS/xml/en/faq.xml | 2 | ||||
-rw-r--r-- | DOCS/xml/ru/cd-dvd.xml | 18 | ||||
-rw-r--r-- | DOCS/xml/ru/faq.xml | 4 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | configure | 107 | ||||
-rw-r--r-- | cpudetect.c | 41 | ||||
-rw-r--r-- | cputable.h | 549 | ||||
-rw-r--r-- | etc/codecs.conf | 4 | ||||
-rw-r--r-- | libaf/af.c | 3 | ||||
-rw-r--r-- | libaf/af_stats.c | 159 | ||||
-rw-r--r-- | libmpcodecs/ae_lavc.c | 2 | ||||
-rw-r--r-- | libswscale/Makefile | 3 | ||||
-rw-r--r-- | libswscale/swscale.c | 2 | ||||
-rw-r--r-- | libswscale/swscale.h | 2 | ||||
-rw-r--r-- | libswscale/yuv2rgb2.c | 683 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 197 | ||||
-rw-r--r-- | mplayer.c | 3 | ||||
-rw-r--r-- | stream/dvbin.h | 9 |
22 files changed, 1159 insertions, 665 deletions
@@ -62,6 +62,7 @@ MPlayer (1.0) * change vf_screenshot dependency from libpng to lavc * add af_scaletempo which maintains audio pitch when changing playback speed * fix multi-channel reordering + * af_stats, filter to print information about the audio stream Streaming: * tv:// support for Windows @@ -130,6 +131,8 @@ MPlayer (1.0) * vo_macosx can now be compiled in 64-bits mode * OpenGL support for unmodified MinGW64 + SWScaler: + * new LGPLed YUV to RGB tables generator rc2try2: diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 927678e3d9..81ebd0cbec 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -5484,6 +5484,13 @@ Changing playback speed, would change pitch, leaving audio tempo at 1.2x. .RE .PD 1 . +.TP +.B "stats\ \ " +Collects and prints statistics about the audio stream, especially the volume. +These statistics are especially intended to help adjusting the volume while +avoiding clipping. +The volumes are printed in dB and compatible with the volume audio filter. +. . . .SH "VIDEO FILTERS" diff --git a/DOCS/man/ru/mplayer.1 b/DOCS/man/ru/mplayer.1 index 19c7cb468d..28efcf0fb4 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 r28670 +.\" synced with r28704 . .\" -------------------------------------------------------------------------- .\" @@ -5554,6 +5554,15 @@ scale . .RE .PD 1 . +.TP +.B "stats\ \ " + , +. + + . + + volume. +. . . .SH " " diff --git a/DOCS/xml/en/cd-dvd.xml b/DOCS/xml/en/cd-dvd.xml index fafc76410d..535f62fe08 100644 --- a/DOCS/xml/en/cd-dvd.xml +++ b/DOCS/xml/en/cd-dvd.xml @@ -53,7 +53,7 @@ If you set it to too high, the drive will continuously spin up and down, and will dramatically decrease the performance. It is recommended that you also tune your CD-ROM drive with <command>hdparm</command>: -<screen>hdparm -d1 -a8 -u1 <replaceable>[cdrom device]</replaceable></screen> +<screen>hdparm -d1 -a256 -u1 <replaceable>[cdrom device]</replaceable></screen> </para> <para> @@ -68,8 +68,16 @@ for fine-tuning your CD-ROM. </para> <para> -SCSI drives do not have a uniform way of setting these parameters (Do you know -one? Tell us!) There is a tool that works for +You may tweak the speed of SCSI CD-ROM drives with +<command>sdparm</command>, you need version 1.03 or higher: +<screen>sdparm --command=speed=<replaceable>[speed in kB/s]</replaceable> <replaceable>[cdrom device]</replaceable></screen> +Speed must be specified in kilobytes per second, the drive will +round it as appropriate. Please refer to the sdparm man page for +details. +</para> + +<para> +There is also a dedicated tool that works for <ulink url="http://das.ist.org/~georg/">Plextor SCSI drives</ulink>. </para> </sect2> diff --git a/DOCS/xml/en/faq.xml b/DOCS/xml/en/faq.xml index 0173cb8c95..83989dbf3a 100644 --- a/DOCS/xml/en/faq.xml +++ b/DOCS/xml/en/faq.xml @@ -590,7 +590,7 @@ It works normal when i run it as a user. <answer><para> This is again a power management effect (see above). Plug the external power connector in <emphasis role="bold">before</emphasis> you power on your notebook -or use the <option>-nortc</option> option. +or make sure you do not use the <option>-rtc</option> option. </para></answer> </qandaentry> diff --git a/DOCS/xml/ru/cd-dvd.xml b/DOCS/xml/ru/cd-dvd.xml index bc1ad4d82e..2fc96328d3 100644 --- a/DOCS/xml/ru/cd-dvd.xml +++ b/DOCS/xml/ru/cd-dvd.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- synced with r26990 --> +<!-- synced with r28706 --> <chapter id="cd-dvd"> <title>Использование CD/DVD</title> @@ -54,7 +54,7 @@ дисках с царапинами). Если поставить слишком большое значение, то постоянный запуск и остановка вращения диска ужасно снизят эффективность. Рекомендуется также подстроить привод, используя <command>hdparm</command>: -<screen>hdparm -d1 -a8 -u1 <replaceable>[устройство cdrom]</replaceable></screen> +<screen>hdparm -d1 -a256 -u1 <replaceable>[устройство cdrom]</replaceable></screen> </para> <para> @@ -70,9 +70,17 @@ </para> <para> -У SCSI приводов нет общего способа выставить эти параметры (Вы знаете -какой-нибудь? Расскажите нам!) Существует программа для -<ulink url="http://das.ist.org/~georg/">Plextor SCSI приводов</ulink>. +Вы можете настроить скорость SCSI CD-ROM приводов с помощью +<command>sdparm</command>, необходима версия 1.03 или выше: +<screen>sdparm --command=speed=<replaceable>[скорость в кБ/с]</replaceable> <replaceable>[устройство cdrom]</replaceable></screen> +Скорость должна быть указана в килобайтах в секунду, привод +округлит её надлежащим образом. Пожалуйста, обратитесь с странице +руководства sdparm для деталей. +</para> + +<para> +There is also a dedicated tool that works for +<ulink url="http://das.ist.org/~georg/">Plextor SCSI drives</ulink>. </para> </sect2> diff --git a/DOCS/xml/ru/faq.xml b/DOCS/xml/ru/faq.xml index 99c87172c0..7addcabb2e 100644 --- a/DOCS/xml/ru/faq.xml +++ b/DOCS/xml/ru/faq.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- synced with r28660 --> +<!-- synced with r28707 --> <chapter id="faq" xreflabel="FAQ"> <title>Часто Задаваемые вопросы</title> @@ -578,7 +578,7 @@ Windows Media 9.) <answer><para> Это тоже эффект системы управления энергопотреблением (смотрите выше). Подсоедините разъем внешнего питания <emphasis role="bold">до</emphasis> -включения ноутбука либо используйте опцию <option>-nortc</option>. +включения ноутбука либо убедитесь, что не используется опция <option>-rtc</option>. </para></answer> </qandaentry> @@ -70,6 +70,7 @@ SRCS_COMMON = asxparser.c \ libaf/af_resample.c \ libaf/af_scaletempo.c \ libaf/af_sinesuppress.c \ + libaf/af_stats.c \ libaf/af_sub.c \ libaf/af_surround.c \ libaf/af_sweep.c \ @@ -159,7 +159,7 @@ ppc() { alpha() { case "$host_arch" in - alpha) return 0;; + alpha*) return 0;; *) return 1;; esac } @@ -2188,7 +2188,7 @@ EOF ;; - alpha) + alpha*) _arch='ALPHA' _target_arch='ARCH_ALPHA = yes' iproc='alpha' @@ -2404,6 +2404,7 @@ elif test -z "$CFLAGS" ; then CFLAGS="-O2 $_march $_mcpu $_pipe" else CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer" + _ld_extra="$_ld_extra -ffast-math" fi else _warn_CFLAGS=yes @@ -7881,52 +7882,6 @@ fi echores "$_maemo" fi -#this must be the last test to be performed or the ones following it will likely fail -#because libdvdnavmini is intentionally not linked against libdvdread (to permit mplayer -# to use its own copy of the library) -echocheck "DVD support (libdvdnav)" -if test "$_dvdread_internal" = yes && test ! -f "libdvdnav/dvdnav.c" ; then - _dvdnav=no -fi -dvdnav_internal=no -if test "$_dvdnav" = auto ; then - if test "$_dvdread_internal" = yes ; then - _dvdnav=yes - dvdnav_internal=yes - _res_comment="internal" - else - $_dvdnavconfig --version --minilibs >> $TMPLOG 2>&1 || _dvdnav=no - fi -fi -if test "$_dvdnav" = auto ; then - cat > $TMPC <<EOF -#include <inttypes.h> -#include <dvdnav/dvdnav.h> -int main(void) { dvdnav_t *dvd=0; return 0; } -EOF - _dvdnav=no - _dvdnavdir=`$_dvdnavconfig --cflags` - _dvdnavlibs=`$_dvdnavconfig --libs` - cc_check $_dvdnavdir $_dvdnavlibs $_ld_dl $_ld_pthread && _dvdnav=yes -fi -if test "$_dvdnav" = yes ; then - _largefiles=yes - def_dvdnav='#define CONFIG_DVDNAV 1' - if test "$dvdnav_internal" = yes ; then - _inc_extra="$_inc_extra -Ilibdvdnav" - _inputmodules="dvdnav(internal) $_inputmodules" - else - _inc_extra="$_inc_extra `$_dvdnavconfig --cflags`" - _ld_extra="$_ld_extra `$_dvdnavconfig --minilibs`" - _inputmodules="dvdnav $_inputmodules" - fi -else - def_dvdnav='#undef CONFIG_DVDNAV' - _noinputmodules="dvdnav $_noinputmodules" -fi -echores "$_dvdnav" - - ############################################################################# # On OS/2 nm supports only a.out. So the -Zomf compiler option to generate @@ -7989,11 +7944,61 @@ else CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS" fi +cc_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer" + +# This must be the last test to be performed. Any other tests following it +# could fail due to linker errors. libdvdnavmini is intentionally not linked +# against libdvdread (to permit MPlayer to use its own copy of the library). +# So any compilation using the flags added here but not linking against +# libdvdread can fail. +echocheck "DVD support (libdvdnav)" +if test "$_dvdread_internal" = yes && test ! -f "libdvdnav/dvdnav.c" ; then + _dvdnav=no +fi +dvdnav_internal=no +if test "$_dvdnav" = auto ; then + if test "$_dvdread_internal" = yes ; then + _dvdnav=yes + dvdnav_internal=yes + _res_comment="internal" + else + $_dvdnavconfig --version --minilibs >> $TMPLOG 2>&1 || _dvdnav=no + fi +fi +if test "$_dvdnav" = auto ; then + cat > $TMPC <<EOF +#include <inttypes.h> +#include <dvdnav/dvdnav.h> +int main(void) { dvdnav_t *dvd=0; return 0; } +EOF + _dvdnav=no + _dvdnavdir=`$_dvdnavconfig --cflags` + _dvdnavlibs=`$_dvdnavconfig --libs` + cc_check $_dvdnavdir $_dvdnavlibs $_ld_dl $_ld_pthread && _dvdnav=yes +fi +if test "$_dvdnav" = yes ; then + _largefiles=yes + def_dvdnav='#define CONFIG_DVDNAV 1' + if test "$dvdnav_internal" = yes ; then + _inc_extra="$_inc_extra -Ilibdvdnav" + _inputmodules="dvdnav(internal) $_inputmodules" + else + _inc_extra="$_inc_extra `$_dvdnavconfig --cflags`" + _ld_extra="$_ld_extra `$_dvdnavconfig --minilibs`" + _inputmodules="dvdnav $_inputmodules" + fi +else + def_dvdnav='#undef CONFIG_DVDNAV' + _noinputmodules="dvdnav $_noinputmodules" +fi +echores "$_dvdnav" + +# DO NOT ADD ANY TESTS THAT USE LINKER FLAGS HERE (like cc_check). +# Read dvdnav comment above. + CFLAGS_FFMPEG="-I../.. $CFLAGS" CFLAGS="-Iffmpeg $CFLAGS" -cc_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer" - ############################################################################# echo "Creating config.mak" cat > config.mak << EOF @@ -8723,6 +8728,8 @@ $def_yasm #define CONFIG_SMALL 0 #define CONFIG_SWSCALE 1 +#define HAVE_GETHRTIME 0 +#define HAVE_INLINE_ASM 0 #define HAVE_POLL_H 1 #define HAVE_PPC4XX 0 diff --git a/cpudetect.c b/cpudetect.c index 8d306b1c3b..5da169dfc0 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -229,16 +229,7 @@ void GetCpuCaps( CpuCaps *caps) #endif // RUNTIME_CPUDETECT } - -#define CPUID_EXTFAMILY ((regs2[0] >> 20)&0xFF) /* 27..20 */ -#define CPUID_EXTMODEL ((regs2[0] >> 16)&0x0F) /* 19..16 */ -#define CPUID_TYPE ((regs2[0] >> 12)&0x04) /* 13..12 */ -#define CPUID_FAMILY ((regs2[0] >> 8)&0x0F) /* 11..08 */ -#define CPUID_MODEL ((regs2[0] >> 4)&0x0F) /* 07..04 */ -#define CPUID_STEPPING ((regs2[0] >> 0)&0x0F) /* 03..00 */ - char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ -#include "cputable.h" /* get cpuname and cpuvendors */ char vendor[13]; char *retname; int i; @@ -247,6 +238,7 @@ char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ mp_msg(MSGT_CPUDETECT,MSGL_FATAL,"Error: GetCpuFriendlyName() not enough memory\n"); exit(1); } + retname[0] = '\0'; sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2)); @@ -254,46 +246,15 @@ char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ if (regs[0] >= 0x80000004) { // CPU has built-in namestring - retname[0] = '\0'; for (i = 0x80000002; i <= 0x80000004; i++) { do_cpuid(i, regs); strncat(retname, (char*)regs, 16); } - return retname; - } - - for(i=0; i<MAX_VENDORS; i++){ - if(!strcmp(cpuvendors[i].string,vendor)){ - if(cpuname[i][CPUID_FAMILY][CPUID_MODEL]){ - snprintf(retname,255,"%s %s",cpuvendors[i].name,cpuname[i][CPUID_FAMILY][CPUID_MODEL]); - } else { - snprintf(retname,255,"unknown %s %d. Generation CPU",cpuvendors[i].name,CPUID_FAMILY); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"unknown %s CPU:\n",cpuvendors[i].name); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Vendor: %s\n",cpuvendors[i].string); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Type: %d\n",CPUID_TYPE); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Family: %d (ext: %d)\n",CPUID_FAMILY,CPUID_EXTFAMILY); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Model: %d (ext: %d)\n",CPUID_MODEL,CPUID_EXTMODEL); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Stepping: %d\n",CPUID_STEPPING); - mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Please send the above info along with the exact CPU name" - "to the MPlayer-Developers, so we can add it to the list!\n"); - } - } } - retname[255] = 0; - - //printf("Detected CPU: %s\n", retname); return retname; } -#undef CPUID_EXTFAMILY -#undef CPUID_EXTMODEL -#undef CPUID_TYPE -#undef CPUID_FAMILY -#undef CPUID_MODEL -#undef CPUID_STEPPING - - #if defined(__linux__) && defined(_POSIX_SOURCE) && !ARCH_X86_64 static void sigill_handler_sse( int signal, struct sigcontext sc ) { diff --git a/cputable.h b/cputable.h deleted file mode 100644 index 2f5ce20182..0000000000 --- a/cputable.h +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Map CPUID to real CPU name. - * Family F codenames owe much thanks to Neil Phillips, author of x86test. - * - * Copyright (C) 2001 Felix Buenemann <atmosfear at users.sourceforge.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. - */ - -#ifndef MPLAYER_CPUTABLE_H -#define MPLAYER_CPUTABLE_H - -#define MAX_VENDORS 8 /* Number of CPU Vendors */ - -//#define N_UNKNOWN "unknown" -//#define N_UNKNOWNEXT "unknown extended model" -#define N_UNKNOWN "" -#define N_UNKNOWNEXT "" - -#define F_UNKNOWN { \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN \ -} - -static const char *cpuname - /* Vendor */ [MAX_VENDORS] - /* Family */ [16] - /* Model */ [16] - ={ - /* Intel Corporation, "GenuineIntel" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 i386 */ F_UNKNOWN, /* XXX new 386 chips may support CPUID! */ - /* 4 i486 */ { - /* 0 */ "i486DX-25/33", /* only few of these */ - /* 1 */ "i486DX-50", /* support CPUID! */ - /* 2 */ "i486SX", - /* 3 */ "i486DX2", /* CPUID only on new chips! */ - /* 4 */ "i486SL", - /* 5 */ "i486SX2", - /* 6 */ N_UNKNOWN, - /* 7 */ "i486DX2/write-back", /* returns 3 in write-through mode */ - /* 8 */ "i486DX4", - /* 9 */ "i486DX4/write-back", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 5 i586 */ { - /* 0 */ "Pentium P5 A-step", - /* 1 */ "Pentium P5", - /* 2 */ "Pentium P54C", - /* 3 */ "Pentium OverDrive P24T", - /* 4 */ "Pentium MMX P55C", - /* 5 */ N_UNKNOWN, /* XXX DX4 OverDrive? */ - /* 6 */ N_UNKNOWN, /* XXX P5 OverDrive? */ - /* 7 */ "Pentium P54C (new)", - /* 8 */ "Pentium MMX P55C (new)", - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 6 i686 */ { - /* 0 */ "PentiumPro A-step", - /* 1 */ "PentiumPro", - /* 2 */ N_UNKNOWN, - /* 3 */ "Pentium II Klamath/Pentium II OverDrive", - /* 4 */ N_UNKNOWN, /* XXX P55CT - OverDrive for P54? */ - /* 5 */ "Celeron Covington/Pentium II Deschutes,Tonga/Pentium II Xeon", - /* 6 */ "Celeron A Mendocino/Pentium II Dixon", - /* 7 */ "Pentium III Katmai/Pentium III Xeon Tanner", - /* 8 */ "Celeron 2/Pentium III Coppermine,Geyserville", - /* 9 */ "Pentium M Banias", /* XXX check */ - /* A */ "Pentium III Xeon Cascades", - /* B */ "Celeron 2/Pentium III Tualatin", - /* C */ N_UNKNOWN, - /* D */ "Pentium M Dothan", - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 7 Itanium */ { /* XXX check */ - /* 0 */ "Itanium Merced", - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F extended family (P4/new IA-64)*/ { - /* 0 */ "Pentium 4 Willamette; Xeon Foster", - /* 1 */ "Pentium 4 Willamette; Xeon Foster", - /* 2 */ "Pentium 4/Celeron 4 Northwood; Pentium 4 EE/Xeon Prestonia,Gallatin", - /* 3 */ "Pentium 4/Celeron D Prescott; Xeon Nocona", - /* 4 */ "Pentium 4/Celeron D Prescott; Pentium D/XE Smithfield; Xeon Nocona,Irwindale", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - } - #if 0 /* out of table index boundaries */ - /* 1F Itanium 2 */ { /* XXX check */ - /* 0 */ "Itanium 2 McKinley", - /* 1 */ "Itanium 2 Madison", /* I coded on that :-) */ - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - #endif - }, - /* United Microelectronics Corporation, "UMC UMC UMC " */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 486 (U5) */ { - /* 0 */ N_UNKNOWN, - /* 1 */ "486DX U5D", - /* 2 */ "486SX U5S", - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 5 */ F_UNKNOWN, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Advanced Micro Devices, "AuthenticAMD" (very rare: "AMD ISBETTER") */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 486/5x86 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ "486DX2", - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ "486DX2/write-back", - /* 8 */ "486DX4/5x86", - /* 9 */ "486DX4/write-back", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ "5x86", - /* F */ "5x86/write-back" - }, - /* 5 K5/K6 */ { - /* 0 */ "K5 SSA5 (PR75,PR90,PR100)", - /* 1 */ "K5 5k86 (PR120,PR133)", - /* 2 */ "K5 5k86 (PR166)", - /* 3 */ "K5 5k86 (PR200)", - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ "K6", - /* 7 */ "K6 Little Foot", - /* 8 */ "K6-2", - /* 9 */ "K6-III Chomper", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ "K6-2+/K6-III+ Sharptooth", - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 K7 */ { - /* 0 */ N_UNKNOWN, /* Argon? */ - /* 1 */ "Athlon K7", - /* 2 */ "Athlon K75 Pluto,Orion", - /* 3 */ "Duron Spitfire", - /* 4 */ "Athlon Thunderbird", - /* 5 */ N_UNKNOWN, - /* 6 */ "Duron/Athlon 4/MP/XP Palomino", - /* 7 */ "Duron Morgan,Camaro", - /* 8 */ "Sempron/Athlon MP/XP Thoroughbred; Duron Applebred", - /* 9 */ N_UNKNOWN, - /* A */ "Sempron/Athlon MP/XP/XP-M Barton,Thorton", - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F K8 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ "Opteron Egypt,Italy,Denmark", - /* 2 */ N_UNKNOWN, - /* 3 */ "Athlon 64 X2 Manchester,Toledo", - /* 4 */ "Athlon 64 Clawhammer; Athlon 64 X2 Toledo; Turion Newark,Lancaster", - /* 5 */ "Athlon 64 FX/Opteron Sledgehammer,Athens,Troy,Venus", - /* 6 */ N_UNKNOWN, - /* 7 */ "Athlon 64/FX Sledgehammer,San Diego,Venice", - /* 8 */ "Mobile Athlon 64 Newcastle; Mobile Sempron Dublin", - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ "Athlon 64 Newcastle; Athlon 64 X2 Manchester", - /* E */ N_UNKNOWN, - /* C */ "Athlon 64 Newcastle,Odesssa,Oakville,Venice; Sempron Palermo,Paris,Dublin", - /* D */ N_UNKNOWN, - /* F */ "Athlon 64 Newcastle,Winchester,San Diego,Venice; Sempron Palermo" - } - - }, - /* Cyrix Corp./VIA Inc., "CyrixInstead" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 5x86 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "MediaGX", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ "5x86", /* CPUID maybe only on newer chips */ - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 5 M1 */ { - /* 0 */ "M1 test-sample", /*?*/ - /* 1 */ N_UNKNOWN, - /* 2 */ "6x86 M1", - /* 3 */ "6x86L M1", - /* 4 */ "GXm", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 M2 */ { - /* 0 */ "6x86MX M2/M-II", - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ "Cyrix III Joshua (M2 core)", - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* NexGen Inc., "NexGenDriven" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 Nx586 */ { - /* 0 */ "Nx586/Nx586FPU", /* only newer ones support CPUID! */ - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* IDT/Centaur/VIA, "CentaurHauls" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 IDT C6 WinChip */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "WinChip C6", - /* 5 */ N_UNKNOWN, - /* 6 */ "Samuel", - /* 7 */ N_UNKNOWN, - /* 8 */ "WinChip 2 C6+,W2,W2A,W2B", - /* 9 */ "WinChip 3 W3", - /* A */ "WinChip 4 W4A", /* XXX check */ - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 VIA C3 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ "Cyrix III Samuel (WinChip C5A core)", - /* 7 */ "C3 Samuel 2 (WinChip C5B core)/C3 Ezra", - /* 8 */ "C3 Ezra-T", - /* 9 */ "C3 Nehemiah", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Rise, "RiseRiseRise" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 mP6 */ { - /* 0 */ "mP6 iDragon 6401,6441 Kirin", - /* 1 */ "mP6 iDragon 6510 Lynx", - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ "mP6 iDragon II", - /* 9 */ "mP6 iDragon II (new)", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Transmeta, "GenuineTMx86" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 Crusoe */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "Crusoe TM3x00,TM5x00", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - } -}; - -#undef N_UNKNOWNEXT -#undef N_UNKNOWN -#undef F_UNKNOWN - -static const struct { - char string[13]; - char name[48]; -} cpuvendors[MAX_VENDORS] ={ - {"GenuineIntel","Intel"}, - {"UMC UMC UMC ","United Microelectronics Corporation"}, - {"AuthenticAMD","Advanced Micro Devices"}, - {"CyrixInstead","Cyrix/VIA"}, - {"NexGenDriven","NexGen"}, - {"CentaurHauls","IDT/Centaur/VIA"}, - {"RiseRiseRise","Rise"}, - {"GenuineTMx86","Transmeta"} -}; - -#endif /* MPLAYER_CPUTABLE_H */ diff --git a/etc/codecs.conf b/etc/codecs.conf index 8c2d4a6506..11d0a01e18 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -809,7 +809,7 @@ videocodec ffwmv3 videocodec ffwmv3vdpau info "FFmpeg WMV3/WMV9 (VDPAU)" - status working + status buggy fourcc WMV3,wmv3 driver ffmpeg dll wmv3_vdpau @@ -826,7 +826,7 @@ videocodec ffvc1 videocodec ffvc1vdpau info "FFmpeg WVC1 (VDPAU)" - status working + status buggy fourcc WVC1,wvc1,WMVA fourcc vc-1,VC-1 driver ffmpeg diff --git a/libaf/af.c b/libaf/af.c index 7333896882..1f7a1b0be8 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -16,6 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -51,6 +52,7 @@ extern af_info_t af_info_center; extern af_info_t af_info_sinesuppress; extern af_info_t af_info_karaoke; extern af_info_t af_info_scaletempo; +extern af_info_t af_info_stats; static af_info_t* filter_list[]={ &af_info_dummy, @@ -85,6 +87,7 @@ static af_info_t* filter_list[]={ &af_info_sinesuppress, &af_info_karaoke, &af_info_scaletempo, + &af_info_stats, NULL }; diff --git a/libaf/af_stats.c b/libaf/af_stats.c new file mode 100644 index 0000000000..3d78f72faa --- /dev/null +++ b/libaf/af_stats.c @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2009 Nicolas George <nicolas.george@normalesup.org> + * + * 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <inttypes.h> +#include <math.h> + +#include "af.h" + +#define MAX_DB 80 +#define MIN_VAL 1E-8 + +struct af_stats { + long long n_samples; + double tsquare; + int max; + long long histogram[65536]; +}; + +static inline int logdb(double v) +{ + if (v > 1) + return 0; + if (v <= MIN_VAL) + return MAX_DB - 1; + return log(v) / -0.23025850929940456840179914546843642076; +} + +static int stats_init(af_instance_t *af, struct af_stats *s, af_data_t *data) +{ + int i; + + if (!data) + return AF_ERROR; + *(af->data) = *data; + af->data->format = AF_FORMAT_S16_NE; + af->data->bps = 2; + s->n_samples = 0; + s->tsquare = 0; + s->max = 0; + for (i = 0; i < 65536; i++) + s->histogram[i] = 0; + return af_test_output(af, data); +} + +static void stats_print(struct af_stats *s) +{ + int i; + long long sum; + float v; + long long h[MAX_DB]; + + s->tsquare /= 32768 * 32768; + mp_msg(MSGT_AFILTER, MSGL_INFO, "stats: n_samples: %lld\n", s->n_samples); + if (s->n_samples == 0) + return; + mp_msg(MSGT_AFILTER, MSGL_INFO, "stats: mean_volume: -%d dB\n", + logdb(s->tsquare / s->n_samples)); + mp_msg(MSGT_AFILTER, MSGL_INFO, "stats: max_volume: -%d dB\n", + logdb(s->max / (32768.0 * 32768.0))); + for (i = 0; i < MAX_DB; i++) + h[i] = 0; + for (i = 0; i < 65536; i++) { + v = (i - 32768) / 32768.0; + h[logdb(v * v)] += s->histogram[i]; + } + for (i = 0; i < MAX_DB; i++) + if (h[i] != 0) + break; + sum = 0; + for (; i < MAX_DB; i++) { + sum += h[i]; + mp_msg(MSGT_AFILTER, MSGL_INFO, "stats: histogram_%ddb: %lld\n", + i, h[i]); + if (sum > s->n_samples / 1000) + break; + } +} + +static int control(struct af_instance_s *af, int cmd, void *arg) +{ + struct af_stats *s = af->setup; + + switch(cmd) { + case AF_CONTROL_REINIT: + return stats_init(af, s, arg); + + case AF_CONTROL_PRE_DESTROY: + stats_print(s); + return AF_OK; + } + return AF_UNKNOWN; +} + +static void uninit(struct af_instance_s *af) +{ + free(af->data); + free(af->setup); +} + +static af_data_t *play(struct af_instance_s *af, af_data_t *data) +{ + struct af_stats *s = af->setup; + int16_t *a, *aend; + int v, v2; + + a = data->audio; + aend = (int16_t *)((char *)data->audio + data->len); + s->n_samples += aend - a; + for (; a < aend; a++) { + v = *a; + v2 = v * v; + s->tsquare += v2; + s->histogram[v + 32768]++; + if (v2 > s->max) + s->max = v2; + } + return data; +} + +static int af_open(af_instance_t *af) +{ + af->control = control; + af->uninit = uninit; + af->play = play; + af->mul = 1; + af->data = malloc(sizeof(af_data_t)); + af->setup = malloc(sizeof(struct af_stats)); + if (af->data == NULL || af->setup == NULL) + return AF_ERROR; + return AF_OK; +} + +af_info_t af_info_stats = { + "Statistics audio filter", + "stats", + "Nicolas George", + "", + 0, + af_open +}; diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c index b31eb62fce..3b07d6a963 100644 --- a/libmpcodecs/ae_lavc.c +++ b/libmpcodecs/ae_lavc.c @@ -206,6 +206,8 @@ int mpae_init_lavc(audio_encoder_t *encoder) // put sample parameters lavc_actx->channels = encoder->params.channels; lavc_actx->sample_rate = encoder->params.sample_rate; + lavc_actx->time_base.num = 1; + lavc_actx->time_base.den = encoder->params.sample_rate; if(lavc_param_abitrate<1000) lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate * 1000; else diff --git a/libswscale/Makefile b/libswscale/Makefile index a959661b51..9ebe825266 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -5,10 +5,9 @@ FFLIBS = avutil HEADERS = swscale.h -OBJS = rgb2rgb.o swscale.o swscale_avoption.o +OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb2.o OBJS-$(ARCH_BFIN) += internal_bfin.o swscale_bfin.o yuv2rgb_bfin.o -OBJS-$(CONFIG_GPL) += yuv2rgb.o OBJS-$(CONFIG_MLIB) += yuv2rgb_mlib.o OBJS-$(HAVE_ALTIVEC) += yuv2rgb_altivec.o OBJS-$(HAVE_VIS) += yuv2rgb_vis.o diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 6ba56bcb96..2982857209 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2331,14 +2331,12 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d { c->swScale= PlanarToNV12Wrapper; } -#if CONFIG_GPL /* yuv2bgr */ if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)) && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) { c->swScale= sws_yuv2rgb_get_func_ptr(c); } -#endif if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_BITEXACT)) { diff --git a/libswscale/swscale.h b/libswscale/swscale.h index f73a5bfe52..6efd90fcda 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -31,7 +31,7 @@ #define LIBSWSCALE_VERSION_MAJOR 0 #define LIBSWSCALE_VERSION_MINOR 7 -#define LIBSWSCALE_VERSION_MICRO 0 +#define LIBSWSCALE_VERSION_MICRO 1 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ diff --git a/libswscale/yuv2rgb2.c b/libswscale/yuv2rgb2.c new file mode 100644 index 0000000000..53a0d4e7b8 --- /dev/null +++ b/libswscale/yuv2rgb2.c @@ -0,0 +1,683 @@ +/* + * software YUV to RGB converter + * + * Copyright (C) 2009 Konstantin Shishkov + * + * MMX/MMX2 template stuff (needed for fast movntq support), + * 1,4,8bpp support and context / deglobalize stuff + * by Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdio.h> +#include <stdlib.h> +#include <inttypes.h> +#include <assert.h> + +#include "config.h" +#include "rgb2rgb.h" +#include "swscale.h" +#include "swscale_internal.h" + +#define DITHER1XBPP // only for MMX + +extern const uint8_t dither_8x8_32[8][8]; +extern const uint8_t dither_8x8_73[8][8]; +extern const uint8_t dither_8x8_220[8][8]; + +#if HAVE_MMX && CONFIG_GPL + +/* hope these constant values are cache line aligned */ +DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL; +DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL; +DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL; + +//MMX versions +#undef RENAME +#undef HAVE_MMX2 +#undef HAVE_AMD3DNOW +#define HAVE_MMX2 0 +#define HAVE_AMD3DNOW 0 +#define RENAME(a) a ## _MMX +#include "yuv2rgb_template.c" + +//MMX2 versions +#undef RENAME +#undef HAVE_MMX2 +#define HAVE_MMX2 1 +#define RENAME(a) a ## _MMX2 +#include "yuv2rgb_template.c" + +#endif /* HAVE_MMX && CONFIG_GPL */ + +const int32_t ff_yuv2rgb_coeffs[8][4] = { + {117504, 138453, 13954, 34903}, /* no sequence_display_extension */ + {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */ + {104597, 132201, 25675, 53279}, /* unspecified */ + {104597, 132201, 25675, 53279}, /* reserved */ + {104448, 132798, 24759, 53109}, /* FCC */ + {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */ + {104597, 132201, 25675, 53279}, /* SMPTE 170M */ + {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */ +}; + +#define LOADCHROMA(i) \ + U = pu[i]; \ + V = pv[i]; \ + r = (void *)c->table_rV[V]; \ + g = (void *)(c->table_gU[U] + c->table_gV[V]); \ + b = (void *)c->table_bU[U]; + +#define PUTRGB(dst,src,i,o) \ + Y = src[2*i+o]; \ + dst[2*i ] = r[Y] + g[Y] + b[Y]; \ + Y = src[2*i+1-o]; \ + dst[2*i+1] = r[Y] + g[Y] + b[Y]; + +#define PUTRGB24(dst,src,i) \ + Y = src[2*i]; \ + dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \ + Y = src[2*i+1]; \ + dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y]; + +#define PUTBGR24(dst,src,i) \ + Y = src[2*i]; \ + dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \ + Y = src[2*i+1]; \ + dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y]; + +#define YUV2RGBFUNC(func_name, dst_type) \ +static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ + int srcSliceH, uint8_t* dst[], int dstStride[]){\ + int y;\ +\ + if (c->srcFormat == PIX_FMT_YUV422P) {\ + srcStride[1] *= 2;\ + srcStride[2] *= 2;\ + }\ + for (y=0; y<srcSliceH; y+=2) {\ + dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\ + dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\ + dst_type av_unused *r, *b;\ + dst_type *g;\ + uint8_t *py_1 = src[0] + y*srcStride[0];\ + uint8_t *py_2 = py_1 + srcStride[0];\ + uint8_t *pu = src[1] + (y>>1)*srcStride[1];\ + uint8_t *pv = src[2] + (y>>1)*srcStride[2];\ + unsigned int h_size = c->dstW>>3;\ + while (h_size--) {\ + int av_unused U, V;\ + int Y;\ + +#define ENDYUV2RGBLINE(dst_delta)\ + pu += 4;\ + pv += 4;\ + py_1 += 8;\ + py_2 += 8;\ + dst_1 += dst_delta;\ + dst_2 += dst_delta;\ + }\ + if (c->dstW & 4) {\ + int av_unused Y, U, V;\ + +#define ENDYUV2RGBFUNC()\ + }\ + }\ + return srcSliceH;\ +} + +#define CLOSEYUV2RGBFUNC(dst_delta)\ + ENDYUV2RGBLINE(dst_delta)\ + ENDYUV2RGBFUNC() + +YUV2RGBFUNC(yuv2rgb_c_32, uint32_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +ENDYUV2RGBLINE(8) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); +ENDYUV2RGBFUNC() + +YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t) + LOADCHROMA(0); + PUTRGB24(dst_1,py_1,0); + PUTRGB24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTRGB24(dst_2,py_2,1); + PUTRGB24(dst_1,py_1,1); + + LOADCHROMA(2); + PUTRGB24(dst_1,py_1,2); + PUTRGB24(dst_2,py_2,2); + + LOADCHROMA(3); + PUTRGB24(dst_2,py_2,3); + PUTRGB24(dst_1,py_1,3); +ENDYUV2RGBLINE(24) + LOADCHROMA(0); + PUTRGB24(dst_1,py_1,0); + PUTRGB24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTRGB24(dst_2,py_2,1); + PUTRGB24(dst_1,py_1,1); +ENDYUV2RGBFUNC() + +// only trivial mods from yuv2rgb_c_24_rgb +YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t) + LOADCHROMA(0); + PUTBGR24(dst_1,py_1,0); + PUTBGR24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTBGR24(dst_2,py_2,1); + PUTBGR24(dst_1,py_1,1); + + LOADCHROMA(2); + PUTBGR24(dst_1,py_1,2); + PUTBGR24(dst_2,py_2,2); + + LOADCHROMA(3); + PUTBGR24(dst_2,py_2,3); + PUTBGR24(dst_1,py_1,3); +ENDYUV2RGBLINE(24) + LOADCHROMA(0); + PUTBGR24(dst_1,py_1,0); + PUTBGR24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTBGR24(dst_2,py_2,1); + PUTBGR24(dst_1,py_1,1); +ENDYUV2RGBFUNC() + +// This is exactly the same code as yuv2rgb_c_32 except for the types of +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_16, uint16_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) + +// This is exactly the same code as yuv2rgb_c_32 except for the types of +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_8, uint8_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) + +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t) + const uint8_t *d32 = dither_8x8_32[y&7]; + const uint8_t *d64 = dither_8x8_73[y&7]; +#define PUTRGB8(dst,src,i,o) \ + Y = src[2*i]; \ + dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \ + Y = src[2*i+1]; \ + dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]]; + + LOADCHROMA(0); + PUTRGB8(dst_1,py_1,0,0); + PUTRGB8(dst_2,py_2,0,0+8); + + LOADCHROMA(1); + PUTRGB8(dst_2,py_2,1,2+8); + PUTRGB8(dst_1,py_1,1,2); + + LOADCHROMA(2); + PUTRGB8(dst_1,py_1,2,4); + PUTRGB8(dst_2,py_2,2,4+8); + + LOADCHROMA(3); + PUTRGB8(dst_2,py_2,3,6+8); + PUTRGB8(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(8) + + +// This is exactly the same code as yuv2rgb_c_32 except for the types of +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_4, uint8_t) + int acc; +#define PUTRGB4(dst,src,i) \ + Y = src[2*i]; \ + acc = r[Y] + g[Y] + b[Y]; \ + Y = src[2*i+1]; \ + acc |= (r[Y] + g[Y] + b[Y])<<4; \ + dst[i] = acc; + + LOADCHROMA(0); + PUTRGB4(dst_1,py_1,0); + PUTRGB4(dst_2,py_2,0); + + LOADCHROMA(1); + PUTRGB4(dst_2,py_2,1); + PUTRGB4(dst_1,py_1,1); + + LOADCHROMA(2); + PUTRGB4(dst_1,py_1,2); + PUTRGB4(dst_2,py_2,2); + + LOADCHROMA(3); + PUTRGB4(dst_2,py_2,3); + PUTRGB4(dst_1,py_1,3); +CLOSEYUV2RGBFUNC(4) + +YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t) + const uint8_t *d64 = dither_8x8_73[y&7]; + const uint8_t *d128 = dither_8x8_220[y&7]; + int acc; + +#define PUTRGB4D(dst,src,i,o) \ + Y = src[2*i]; \ + acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ + Y = src[2*i+1]; \ + acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \ + dst[i]= acc; + + LOADCHROMA(0); + PUTRGB4D(dst_1,py_1,0,0); + PUTRGB4D(dst_2,py_2,0,0+8); + + LOADCHROMA(1); + PUTRGB4D(dst_2,py_2,1,2+8); + PUTRGB4D(dst_1,py_1,1,2); + + LOADCHROMA(2); + PUTRGB4D(dst_1,py_1,2,4); + PUTRGB4D(dst_2,py_2,2,4+8); + + LOADCHROMA(3); + PUTRGB4D(dst_2,py_2,3,6+8); + PUTRGB4D(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(4) + +// This is exactly the same code as yuv2rgb_c_32 except for the types of +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) + +YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t) + const uint8_t *d64 = dither_8x8_73[y&7]; + const uint8_t *d128 = dither_8x8_220[y&7]; + +#define PUTRGB4DB(dst,src,i,o) \ + Y = src[2*i]; \ + dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ + Y = src[2*i+1]; \ + dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]]; + + LOADCHROMA(0); + PUTRGB4DB(dst_1,py_1,0,0); + PUTRGB4DB(dst_2,py_2,0,0+8); + + LOADCHROMA(1); + PUTRGB4DB(dst_2,py_2,1,2+8); + PUTRGB4DB(dst_1,py_1,1,2); + + LOADCHROMA(2); + PUTRGB4DB(dst_1,py_1,2,4); + PUTRGB4DB(dst_2,py_2,2,4+8); + + LOADCHROMA(3); + PUTRGB4DB(dst_2,py_2,3,6+8); + PUTRGB4DB(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(8) + +YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t) + const uint8_t *d128 = dither_8x8_220[y&7]; + char out_1 = 0, out_2 = 0; + g= c->table_gU[128] + c->table_gV[128]; + +#define PUTRGB1(out,src,i,o) \ + Y = src[2*i]; \ + out+= out + g[Y+d128[0+o]]; \ + Y = src[2*i+1]; \ + out+= out + g[Y+d128[1+o]]; + + PUTRGB1(out_1,py_1,0,0); + PUTRGB1(out_2,py_2,0,0+8); + + PUTRGB1(out_2,py_2,1,2+8); + PUTRGB1(out_1,py_1,1,2); + + PUTRGB1(out_1,py_1,2,4); + PUTRGB1(out_2,py_2,2,4+8); + + PUTRGB1(out_2,py_2,3,6+8); + PUTRGB1(out_1,py_1,3,6); + + dst_1[0]= out_1; + dst_2[0]= out_2; +CLOSEYUV2RGBFUNC(1) + +SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) +{ + SwsFunc t = NULL; +#if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL + if (c->flags & SWS_CPU_CAPS_MMX2) { + switch (c->dstFormat) { + case PIX_FMT_RGB32: return yuv420_rgb32_MMX2; + case PIX_FMT_BGR24: return yuv420_rgb24_MMX2; + case PIX_FMT_RGB565: return yuv420_rgb16_MMX2; + case PIX_FMT_RGB555: return yuv420_rgb15_MMX2; + } + } + if (c->flags & SWS_CPU_CAPS_MMX) { + switch (c->dstFormat) { + case PIX_FMT_RGB32: return yuv420_rgb32_MMX; + case PIX_FMT_BGR24: return yuv420_rgb24_MMX; + case PIX_FMT_RGB565: return yuv420_rgb16_MMX; + case PIX_FMT_RGB555: return yuv420_rgb15_MMX; + } + } +#endif +#if HAVE_VIS + t = sws_yuv2rgb_init_vis(c); +#endif +#if CONFIG_MLIB + t = sws_yuv2rgb_init_mlib(c); +#endif +#if HAVE_ALTIVEC && CONFIG_GPL + if (c->flags & SWS_CPU_CAPS_ALTIVEC) + t = sws_yuv2rgb_init_altivec(c); +#endif + +#if ARCH_BFIN + if (c->flags & SWS_CPU_CAPS_BFIN) + t = sws_ff_bfin_yuv2rgb_get_func_ptr(c); +#endif + + if (t) + return t; + + av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found.\n"); + + switch (c->dstFormat) { + case PIX_FMT_BGR32_1: + case PIX_FMT_RGB32_1: + case PIX_FMT_BGR32: + case PIX_FMT_RGB32: return yuv2rgb_c_32; + case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb; + case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr; + case PIX_FMT_RGB565: + case PIX_FMT_BGR565: + case PIX_FMT_RGB555: + case PIX_FMT_BGR555: return yuv2rgb_c_16; + case PIX_FMT_RGB8: + case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither; + case PIX_FMT_RGB4: + case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither; + case PIX_FMT_RGB4_BYTE: + case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither; + case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither; + default: + assert(0); + } + return NULL; +} + +static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table) +{ + int i; + int64_t cb = 0; + + y_table -= elemsize * (inc >> 9); + + for (i = 0; i < 256; i++) { + table[i] = y_table + elemsize * (cb >> 16); + cb += inc; + } +} + +static void fill_gv_table(int table[256], const int elemsize, const int inc) +{ + int i; + int64_t cb = 0; + int off = -(inc >> 9); + + for (i = 0; i < 256; i++) { + table[i] = elemsize * (off + (cb >> 16)); + cb += inc; + } +} + +av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, + int brightness, int contrast, int saturation) +{ + const int isRgb = c->dstFormat==PIX_FMT_RGB32 + || c->dstFormat==PIX_FMT_RGB32_1 + || c->dstFormat==PIX_FMT_BGR24 + || c->dstFormat==PIX_FMT_RGB565 + || c->dstFormat==PIX_FMT_RGB555 + || c->dstFormat==PIX_FMT_RGB8 + || c->dstFormat==PIX_FMT_RGB4 + || c->dstFormat==PIX_FMT_RGB4_BYTE + || c->dstFormat==PIX_FMT_MONOBLACK; + const int bpp = fmt_depth(c->dstFormat); + uint8_t *y_table; + uint16_t *y_table16; + uint32_t *y_table32; + int i, base, rbase, gbase, bbase; + const int yoffs = fullRange ? 384 : 326; + + int64_t crv = inv_table[0]; + int64_t cbu = inv_table[1]; + int64_t cgu = -inv_table[2]; + int64_t cgv = -inv_table[3]; + int64_t cy = 1<<16; + int64_t oy = 0; + + int64_t yb = 0; + + if (!fullRange) { + cy = (cy*255) / 219; + oy = 16<<16; + } else { + crv = (crv*224) / 255; + cbu = (cbu*224) / 255; + cgu = (cgu*224) / 255; + cgv = (cgv*224) / 255; + } + + cy = (cy *contrast ) >> 16; + crv = (crv*contrast * saturation) >> 32; + cbu = (cbu*contrast * saturation) >> 32; + cgu = (cgu*contrast * saturation) >> 32; + cgv = (cgv*contrast * saturation) >> 32; + oy -= 256*brightness; + + //scale coefficients by cy + crv = ((crv << 16) + 0x8000) / cy; + cbu = ((cbu << 16) + 0x8000) / cy; + cgu = ((cgu << 16) + 0x8000) / cy; + cgv = ((cgv << 16) + 0x8000) / cy; + + av_free(c->yuvTable); + + switch (bpp) { + case 1: + c->yuvTable = av_malloc(1024); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-110; i++) { + y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7; + yb += cy; + } + fill_table(c->table_gU, 1, cgu, y_table + yoffs); + fill_gv_table(c->table_gV, 1, cgv); + break; + case 4: + case 4|128: + rbase = isRgb ? 3 : 0; + gbase = 1; + bbase = isRgb ? 0 : 3; + c->yuvTable = av_malloc(1024*3); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-110; i++) { + int yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table[i+110 ] = (yval >> 7) << rbase; + y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase; + y_table[i+110+2048] = (yval >> 7) << bbase; + yb += cy; + } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); + fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); + fill_gv_table(c->table_gV, 1, cgv); + break; + case 8: + rbase = isRgb ? 5 : 0; + gbase = isRgb ? 2 : 3; + bbase = isRgb ? 0 : 6; + c->yuvTable = av_malloc(1024*3); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-38; i++) { + int yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table[i+16 ] = ((yval + 18) / 36) << rbase; + y_table[i+16+1024] = ((yval + 18) / 36) << gbase; + y_table[i+37+2048] = ((yval + 43) / 85) << bbase; + yb += cy; + } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); + fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); + fill_gv_table(c->table_gV, 1, cgv); + break; + case 15: + case 16: + rbase = isRgb ? bpp - 5 : 0; + gbase = 5; + bbase = isRgb ? 0 : (bpp - 5); + c->yuvTable = av_malloc(1024*3*2); + y_table16 = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table16[i ] = (yval >> 3) << rbase; + y_table16[i+1024] = (yval >> (18 - bpp)) << gbase; + y_table16[i+2048] = (yval >> 3) << bbase; + yb += cy; + } + fill_table(c->table_rV, 2, crv, y_table16 + yoffs); + fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); + fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); + fill_gv_table(c->table_gV, 2, cgv); + break; + case 24: + c->yuvTable = av_malloc(1024); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + y_table[i] = av_clip_uint8((yb + 0x8000) >> 16); + yb += cy; + } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs); + fill_table(c->table_bU, 1, cbu, y_table + yoffs); + fill_gv_table(c->table_gV, 1, cgv); + break; + case 32: + base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0; + rbase = base + (isRgb ? 16 : 0); + gbase = base + 8; + bbase = base + (isRgb ? 0 : 16); + c->yuvTable = av_malloc(1024*3*4); + y_table32 = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table32[i ] = yval << rbase; + y_table32[i+1024] = yval << gbase; + y_table32[i+2048] = yval << bbase; + yb += cy; + } + fill_table(c->table_rV, 4, crv, y_table32 + yoffs); + fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024); + fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048); + fill_gv_table(c->table_gV, 4, cgv); + break; + default: + c->yuvTable = NULL; + av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); + return -1; + } + return 0; +} diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 738fc64055..d0f6ac07f4 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -50,6 +50,9 @@ #include "libavutil/common.h" +#include "libass/ass.h" +#include "libass/ass_mp.h" + static vo_info_t info = { "VDPAU with X11", "vdpau", @@ -78,6 +81,9 @@ LIBVO_EXTERN(vdpau) /* number of palette entries */ #define PALETTE_SIZE 256 +/* Initial maximum number of EOSD surfaces */ +#define EOSD_SURFACES_INITIAL 512 + /* * Global variable declaration - VDPAU specific */ @@ -125,6 +131,11 @@ static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_ /* output_surfaces[2] is used in composite-picture. */ static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; +static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; + +static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create; +static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy; +static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native; static VdpDecoderCreate *vdp_decoder_create; static VdpDecoderDestroy *vdp_decoder_destroy; @@ -159,6 +170,26 @@ static unsigned char *index_data; static int index_data_size; static uint32_t palette[PALETTE_SIZE]; +// EOSD +// Pool of surfaces +struct { + VdpBitmapSurface surface; + int w; + int h; + char in_use; +} *eosd_surfaces; + +// List of surfaces to be rendered +struct { + VdpBitmapSurface surface; + VdpRect source; + VdpRect dest; + VdpColor color; +} *eosd_targets; + +static int eosd_render_count; +static int eosd_surface_count; + /* * X11 specific */ @@ -286,6 +317,12 @@ static int win_x11_init_vdpau_procs(void) {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, + {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create}, + {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy}, + {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, + &vdp_bitmap_surface_putbits_native}, + {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, + &vdp_output_surface_render_bitmap_surface}, {0, NULL} }; @@ -330,9 +367,9 @@ static int create_vdp_mixer(VdpChromaType vdp_chroma_type) { int feature_count = 0; VdpVideoMixerFeature features[MAX_NUM_FEATURES]; VdpBool feature_enables[MAX_NUM_FEATURES]; - static const denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL}; + static const VdpVideoMixerAttribute denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL}; const void * const denoise_value[] = {&denoise}; - static const sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL}; + static const VdpVideoMixerAttribute sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL}; const void * const sharpen_value[] = {&sharpen}; static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, @@ -390,9 +427,10 @@ static void free_video_specific(void) { surface_render[i].surface = VDP_INVALID_HANDLE; } - if (video_mixer != VDP_INVALID_HANDLE) + if (video_mixer != VDP_INVALID_HANDLE) { vdp_st = vdp_video_mixer_destroy(video_mixer); - CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") + CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") + } video_mixer = VDP_INVALID_HANDLE; } @@ -563,10 +601,125 @@ static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src, CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") } +static void draw_eosd(void) { + VdpStatus vdp_st; + VdpOutputSurface output_surface = output_surfaces[surface_num]; + VdpOutputSurfaceRenderBlendState blend_state; + int i; + + blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; + blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; + blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; + blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; + blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; + blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; + + for (i=0; i<eosd_render_count; i++) { + vdp_st = vdp_output_surface_render_bitmap_surface( + output_surface, &eosd_targets[i].dest, + eosd_targets[i].surface, &eosd_targets[i].source, + &eosd_targets[i].color, &blend_state, + VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + CHECK_ST_WARNING("EOSD: Error when rendering") + } +} + +static void generate_eosd(mp_eosd_images_t *imgs) { + VdpStatus vdp_st; + VdpRect destRect; + int j, found; + ass_image_t *img = imgs->imgs; + ass_image_t *i; + + // Nothing changed, no need to redraw + if (imgs->changed == 0) + return; + eosd_render_count = 0; + // There's nothing to render! + if (!img) + return; + + if (imgs->changed == 1) + goto eosd_skip_upload; + + for (j=0; j<eosd_surface_count; j++) + eosd_surfaces[j].in_use = 0; + + for (i = img; i; i = i->next) { + // Try to reuse a suitable surface + found = -1; + for (j=0; j<eosd_surface_count; j++) { + if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && + eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { + found = j; + break; + } + } + // None found, allocate a new surface + if (found < 0) { + for (j=0; j<eosd_surface_count; j++) { + if (!eosd_surfaces[j].in_use) { + if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE) + vdp_bitmap_surface_destroy(eosd_surfaces[j].surface); + found = j; + break; + } + } + // Allocate new space for surface/target arrays + if (found < 0) { + j = found = eosd_surface_count; + eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL; + eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces)); + eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets)); + for(j=found; j<eosd_surface_count; j++) { + eosd_surfaces[j].surface = VDP_INVALID_HANDLE; + eosd_surfaces[j].in_use = 0; + } + } + vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8, + i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface); + CHECK_ST_WARNING("EOSD: error when creating surface") + eosd_surfaces[found].w = i->w; + eosd_surfaces[found].h = i->h; + } + eosd_surfaces[found].in_use = 1; + eosd_targets[eosd_render_count].surface = eosd_surfaces[found].surface; + destRect.x0 = 0; + destRect.y0 = 0; + destRect.x1 = i->w; + destRect.y1 = i->h; + vdp_st = vdp_bitmap_surface_putbits_native(eosd_targets[eosd_render_count].surface, + (const void *) &i->bitmap, &i->stride, &destRect); + CHECK_ST_WARNING("EOSD: putbits failed") + eosd_render_count++; + } + +eosd_skip_upload: + eosd_render_count = 0; + for (i = img; i; i = i->next) { + // Render dest, color, etc. + eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; + eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; + eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; + eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; + eosd_targets[eosd_render_count].dest.x0 = i->dst_x; + eosd_targets[eosd_render_count].dest.y0 = i->dst_y; + eosd_targets[eosd_render_count].dest.x1 = i->w + i->dst_x; + eosd_targets[eosd_render_count].dest.y1 = i->h + i->dst_y; + eosd_targets[eosd_render_count].source.x0 = 0; + eosd_targets[eosd_render_count].source.y0 = 0; + eosd_targets[eosd_render_count].source.x1 = i->w; + eosd_targets[eosd_render_count].source.y1 = i->h; + eosd_render_count++; + } +} + static void draw_osd(void) { mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); + draw_eosd(); vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y, vid_width, vid_height, draw_osd_I8A8); } @@ -695,7 +848,7 @@ static uint32_t get_image(mp_image_t *mpi) static int query_format(uint32_t format) { - int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD; + int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED; switch (format) { case IMGFMT_YV12: return default_flags | VOCAP_NOSLICES; @@ -728,6 +881,14 @@ static void DestroyVdpauObjects(void) CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") } + for (i = 0; i<eosd_surface_count; i++) { + if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) { + vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface); + CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy") + } + eosd_surfaces[i].surface = VDP_INVALID_HANDLE; + } + vdp_st = vdp_device_destroy(vdp_device); CHECK_ST_WARNING("Error when calling vdp_device_destroy") } @@ -744,6 +905,11 @@ static void uninit(void) free(index_data); index_data = NULL; + free(eosd_surfaces); + eosd_surfaces = NULL; + free(eosd_targets); + eosd_targets = NULL; + #ifdef CONFIG_XF86VM vo_vm_close(); #endif @@ -821,6 +987,10 @@ static int preinit(const char *arg) index_data = NULL; index_data_size = 0; + eosd_surface_count = eosd_render_count = 0; + eosd_surfaces = NULL; + eosd_targets = NULL; + return 0; } @@ -867,6 +1037,23 @@ static int control(uint32_t request, void *data) case VOCTRL_UPDATE_SCREENINFO: update_xinerama_info(); return VO_TRUE; + case VOCTRL_DRAW_EOSD: + if (!data) + return VO_FALSE; + generate_eosd(data); + return VO_TRUE; + case VOCTRL_GET_EOSD_RES: { + mp_eosd_res_t *r = data; + r->mt = r->mb = r->ml = r->mr = 0; + if (vo_fs) { + r->w = vo_screenwidth; + r->h = vo_screenheight; + r->ml = r->mr = border_x; + r->mt = r->mb = border_y; + } else + r->w = vo_dwidth; r->h = vo_dheight; + return VO_TRUE; + } } return VO_NOTIMPL; } @@ -2562,7 +2562,6 @@ int gui_no_filename=0; // Preparse the command line m_config_preparse_command_line(mpctx->mconfig,argc,argv); - print_version("MPlayer"); #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) set_path_env(); #endif @@ -2610,6 +2609,8 @@ int gui_no_filename=0; } mpctx->key_fifo = mp_fifo_create(opts); + print_version("MPlayer"); + #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI) void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); if(runningmplayer && mpctx->filename && use_gui){ diff --git a/stream/dvbin.h b/stream/dvbin.h index 84c9d2c625..dcb22ce238 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -38,9 +38,16 @@ #undef DVB_ATSC #if defined(DVB_API_VERSION_MINOR) -#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1 + +/* kernel headers >=2.6.28 have version 5. + * + * FIXME: are there any real differences between 3.1 and 5? + */ + +#if (DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1) || DVB_API_VERSION == 5 #define DVB_ATSC 1 #endif + #endif |