diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-04-02 23:53:54 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-04-02 23:55:13 +0300 |
commit | d136cf68827382ad710adb74d02e50364052f430 (patch) | |
tree | df40e0284c9275bb185bc098cc3ed039bb765692 | |
parent | cf9edda1d370d39bc8a3d020a9c2bc4090d2457e (diff) | |
parent | 83c2df3565c19931b01c3ed75a0e08aca1fb24f2 (diff) |
Merge svn changes up to r29134
35 files changed, 378 insertions, 198 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 667873c7c4..cf0bf92963 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3296,7 +3296,7 @@ This option is not suitable to only set the startup screen (because it will always display on the given screen in fullscreen mode), \-geometry is the best that is available for that purpose currently. -Supported by the gl, gl2, x11, and xv video output drivers. +Supported by at least the direct3d, gl, gl2, x11 and xv video output drivers. . .TP .B \-zrbw (\-vo zr only) @@ -5056,6 +5056,23 @@ Reasonable values are around 0.001. .PD 1 . .TP +.B bs2b[=option1:option2] +Bauer stereophonic to binaural transformation using libbs2b. +Improves the headphone listening experience by making the sound +similar to that from loudspeakers, allowing each ear to hear both +channels and taking into account the distance difference and the +head shadowing effect. +It is applicable only to 2 channel audio. +.PD 0 +.RSs +.IPs level=<1\-3> +Set cross feed level, higher level means stronger effect (default: 3). +.IPs profile=<0\-1> +Select cross feed profile to use, 1 provides softer sound than 0 (default: 1). +.RE +.PD 1 +. +.TP .B hrtf[=flag] Head-related transfer function: Converts multichannel audio to 2 channel output for headphones, preserving the spatiality of the sound. @@ -343,6 +343,7 @@ SRCS_COMMON-$(LIBAVCODEC_A) += libaf/af_lavcac3enc.c \ libmpcodecs/vf_uspp.c \ SRCS_COMMON-$(LIBAVFORMAT) += libmpdemux/demux_lavf.c +SRCS_COMMON-$(LIBBS2B) += libaf/af_bs2b.c SRCS_COMMON-$(LIBDCA) += libmpcodecs/ad_libdca.c SRCS_COMMON-$(LIBDV) += libmpcodecs/ad_libdv.c \ libmpcodecs/vd_libdv.c \ @@ -748,6 +749,12 @@ DIRS = . \ ffmpeg/libavcodec/sparc \ ffmpeg/libavformat \ ffmpeg/libavutil \ + ffmpeg/libavutil/arm \ + ffmpeg/libavutil/bfin \ + ffmpeg/libavutil/bfin \ + ffmpeg/libavutil/ppc \ + ffmpeg/libavutil/sh4 \ + ffmpeg/libavutil/x86 \ libdvdcss \ libdvdnav \ libdvdnav/vm \ @@ -760,6 +767,11 @@ DIRS = . \ libmpeg2 \ ffmpeg/libpostproc \ libswscale \ + libswscale/bfin \ + libswscale/mlib \ + libswscale/ppc \ + libswscale/sparc \ + libswscale/x86 \ libvo \ loader \ loader/dshow \ @@ -326,6 +326,7 @@ Codecs: --disable-faac disable support for FAAC (AAC encoder) [autodetect] --disable-faac-lavc disable support for FAAC in libavcodec [autodetect] --disable-ladspa disable LADSPA plugin support [autodetect] + --disable-libbs2b disable libbs2b audio filter support [autodetect] --disable-libdv disable libdv 0.9.5 en/decoding support [autodetect] --disable-mad disable libmad (MPEG audio) support [autodetect] --disable-mp3lame disable LAME MP3 encoding support [autodetect] @@ -616,6 +617,7 @@ _faad_fixed=no _faac=auto _faac_lavc=auto _ladspa=auto +_libbs2b=auto _xmms=no _dvdnav=auto _dvdnavconfig=dvdnav-config @@ -1013,6 +1015,8 @@ for ac_option do --disable-faac-lavc) _faac_lavc=no ;; --enable-ladspa) _ladspa=yes ;; --disable-ladspa) _ladspa=no ;; + --enable-libbs2b) _libbs2b=yes ;; + --disable-libbs2b) _libbs2b=no ;; --enable-xmms) _xmms=yes ;; --disable-xmms) _xmms=no ;; --enable-dvdread) _dvdread=yes ;; @@ -6606,6 +6610,43 @@ fi echores "$_ladspa" +echocheck "libbs2b audio filter support" +if test "$_libbs2b" = auto ; then + cat > $TMPC <<EOF +#include <bs2b.h> +#if BS2B_VERSION_MAJOR < 3 +#error Please use libbs2b >= 3.0.0, older versions are not supported. +#endif +int main(void) { + t_bs2bdp filter; + filter=bs2b_open(); + bs2b_close(filter); + return 0; +} +EOF + _libbs2b=no + if $_pkg_config --exists libbs2b ; then + _inc_tmp=$($_pkg_config --cflags libbs2b) + _ld_tmp=$($_pkg_config --libs libbs2b) + cc_check $_inc_tmp $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && + extra_cflags="$extra_cflags $_inc_tmp" && _libbs2b=yes + else + for _inc_tmp in "" -I/usr/include/bs2b -I/usr/local/include \ + -I/usr/local/include/bs2b ; do + if cc_check $_inc_tmp $_ld_lm -lbs2b ; then + extra_ldflags="$extra_ldflags -lbs2b" + extra_cflags="$extra_cflags $_inc_tmp" + _libbs2b=yes + break + fi + done + fi +fi +def_libbs2b="#undef CONFIG_LIBBS2B" +test "$_libbs2b" = yes && def_libbs2b="#define CONFIG_LIBBS2B" +echores "$_libbs2b" + + if test -z "$_codecsdir" ; then for dir in "$_libdir/codecs" "$_libdir/win32" /usr/local/lib/codecs \ /usr/lib/codecs /usr/local/lib/win32 /usr/lib/win32 ; do @@ -8198,6 +8239,7 @@ LADSPA = $_ladspa LIBA52 = $_liba52 LIBA52_INTERNAL = $_liba52_internal LIBASS = $_ass +LIBBS2B = $_libbs2b LIBDCA = $_libdca LIBDV = $_libdv LIBDVDCSS_INTERNAL = $_libdvdcss_internal @@ -8619,6 +8661,7 @@ $def_sunaudio $def_win32waveout $def_ladspa +$def_libbs2b /* input */ @@ -8834,6 +8877,11 @@ $def_xvid_lavc `ff_config_enable "$_libavprotocols_all" "$_libavprotocols"` `ff_config_enable "$_libavbsfs_all" "$_libavbsfs"` +#define CONFIG_H263_VAAPI_HWACCEL 0 +#define CONFIG_MPEG2_VAAPI_HWACCEL 0 +#define CONFIG_MPEG4_VAAPI_HWACCEL 0 +#define CONFIG_H264_VAAPI_HWACCEL 0 + #endif /* MPLAYER_CONFIG_H */ EOF diff --git a/cpudetect.c b/cpudetect.c index 62afe5895e..b5eb47e970 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -4,9 +4,6 @@ CpuCaps gCpuCaps; -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <stdlib.h> #if ARCH_X86 diff --git a/libaf/af.c b/libaf/af.c index 33819c71a5..987b7e548f 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -21,10 +21,6 @@ #include <stdlib.h> #include <string.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "af.h" // Static list of filters @@ -53,6 +49,7 @@ 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; +extern af_info_t af_info_bs2b; static af_info_t* filter_list[]={ &af_info_dummy, @@ -88,6 +85,9 @@ static af_info_t* filter_list[]={ &af_info_karaoke, &af_info_scaletempo, &af_info_stats, +#ifdef CONFIG_LIBBS2B + &af_info_bs2b, +#endif NULL }; diff --git a/libaf/af_bs2b.c b/libaf/af_bs2b.c new file mode 100644 index 0000000000..4899fcc070 --- /dev/null +++ b/libaf/af_bs2b.c @@ -0,0 +1,212 @@ +/* + * The Bauer stereophonic-to-binaural DSP using bs2b library: + * http://bs2b.sourceforge.net/ + * + * Copyright (c) 2009 Andrew Savchenko + * + * 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 <bs2b.h> +#include <inttypes.h> +#include <stdlib.h> + +#include "af.h" +#include "subopt-helper.h" + +/// Internal specific data of the filter +struct af_bs2b { + int level; ///< crossfeed level + int profile; ///< profile (easy or normal) + t_bs2bdp filter; ///< instance of a library filter +}; + +#define PLAY(name,type) \ +static af_data_t *play_##name(struct af_instance_s *af, af_data_t *data) \ +{ \ + /* filter is called for all pairs of samples available in the buffer */ \ + bs2b_cross_feed_##name(((struct af_bs2b*)(af->setup))->filter, \ + (type*)(data->audio), data->len/data->bps/2); \ +\ + return data; \ +} + +PLAY(f,float) +PLAY(fbe,float) +PLAY(fle,float) +PLAY(s32be,int32_t) +PLAY(s32le,int32_t) +PLAY(s24be,bs2b_int24_t) +PLAY(s24le,bs2b_int24_t) +PLAY(s16be,int16_t) +PLAY(s16le,int16_t) +PLAY(s8,int8_t) +PLAY(u8,uint8_t) + +/// Sanity check for level value +static int test_level(void *par) +{ + const int val = *(int*)par; + if (val >= 1 && val <= BS2B_CLEVELS) + return 1; + + mp_msg(MSGT_AFILTER,MSGL_ERR, "[bs2b] Level must be in range 1..%i, but " + "current value is %i.\n", BS2B_CLEVELS, val); + return 0; +} + +/// Sanity check for profile value +static int test_profile(void *par) +{ + const int val = *(int*)par; + if (val >= 0 && val <= 1) + return 1; + + mp_msg(MSGT_AFILTER,MSGL_ERR, "[bs2b] Profile must be either 0 or 1, but " + "current value is %i.\n", val); + return 0; +} + +/// Initialization and runtime control +static int control(struct af_instance_s *af, int cmd, void *arg) +{ + struct af_bs2b *s = af->setup; + + switch (cmd) { + case AF_CONTROL_REINIT: { + int format; + char buf[256]; + // Sanity check + if (!arg) return AF_ERROR; + + format = ((af_data_t*)arg)->format; + af->data->rate = ((af_data_t*)arg)->rate; + af->data->nch = 2; // bs2b is useful only for 2ch audio + af->data->bps = ((af_data_t*)arg)->bps; + af->data->format = format; + + /* check for formats supported by libbs2b + and assign corresponding handlers */ + switch (format) { + case AF_FORMAT_FLOAT_BE: + af->play = play_fbe; + break; + case AF_FORMAT_FLOAT_LE: + af->play = play_fle; + break; + case AF_FORMAT_S32_BE: + af->play = play_s32be; + break; + case AF_FORMAT_S32_LE: + af->play = play_s32le; + break; + case AF_FORMAT_S24_BE: + af->play = play_s24be; + break; + case AF_FORMAT_S24_LE: + af->play = play_s24le; + break; + case AF_FORMAT_S16_BE: + af->play = play_s16be; + break; + case AF_FORMAT_S16_LE: + af->play = play_s16le; + break; + case AF_FORMAT_S8: + af->play = play_s8; + break; + case AF_FORMAT_U8: + af->play = play_u8; + break; + default: + af->play = play_f; + af->data->format = AF_FORMAT_FLOAT_NE; + af->data->bps=4; + break; + } + + bs2b_set_srate(s->filter, (long)af->data->rate); + mp_msg(MSGT_AFILTER,MSGL_V, "[bs2b] using format %s\n", + af_fmt2str(af->data->format,buf,256)); + + return af_test_output(af,(af_data_t*)arg); + } + case AF_CONTROL_COMMAND_LINE: { + const opt_t subopts[] = { + {"level", OPT_ARG_INT, &s->level, test_level}, + {"profile", OPT_ARG_INT, &s->profile, test_profile}, + {NULL} + }; + if (subopt_parse(arg, subopts) != 0) { + mp_msg(MSGT_AFILTER,MSGL_ERR, "[bs2b] Invalid option specified.\n"); + return AF_ERROR; + } + + bs2b_set_level(s->filter, s->level + s->profile ? BS2B_CLEVELS : 0); + mp_msg(MSGT_AFILTER,MSGL_V, "[bs2b] using profile %i, level %i\n", + s->profile, s->level); + return AF_OK; + } + } + return AF_UNKNOWN; +} + +/// Deallocate memory and close library +static void uninit(struct af_instance_s *af) +{ + struct af_bs2b *s = af->setup; + free(af->data); + if (s && s->filter) + bs2b_close(s->filter); + free(s); +} + +/// Allocate memory, set function pointers and init library +static int af_open(af_instance_t *af) +{ + struct af_bs2b *s; + af->control = control; + af->uninit = uninit; + af->mul = 1; + if (!(af->data = calloc(1,sizeof(af_data_t)))) + return AF_ERROR; + if (!(af->setup = s = calloc(1,sizeof(struct af_bs2b)))) { + free(af->data); + return AF_ERROR; + } + + // NULL means failed initialization + if (!(s->filter = bs2b_open())) { + free(af->data); + free(af->setup); + return AF_ERROR; + } + // Set defaults the same as in the library: + s->level = 3; + s->profile = 1; + return AF_OK; +} + +/// Description of this filter +af_info_t af_info_bs2b = { + "Bauer stereophonic-to-binaural audio filter", + "bs2b", + "Andrew Savchenko", + "", + AF_FLAGS_REENTRANT, + af_open +}; diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c index 5112586e48..6ce0c37fd8 100644 --- a/libmenu/vf_menu.c +++ b/libmenu/vf_menu.c @@ -24,10 +24,6 @@ #include <stdlib.h> #include <string.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "mplayer.h" #include "mp_msg.h" diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 79073d03e3..a15640c552 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -19,10 +19,6 @@ #include "libaf/af.h" -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #ifdef CONFIG_DYNAMIC_PLUGINS #include <dlfcn.h> #endif diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 7faf2ac396..95297b2117 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -2,9 +2,6 @@ #include "options.h" #include <stdio.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <stdlib.h> #include <stdbool.h> #include <unistd.h> diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c index 58d6c42f18..8b2cab2d9b 100644 --- a/libmpcodecs/vf_boxblur.c +++ b/libmpcodecs/vf_boxblur.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <assert.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index c9ce73c9cd..842dc6691c 100644 --- a/libmpcodecs/vf_delogo.c +++ b/libmpcodecs/vf_delogo.c @@ -26,14 +26,8 @@ #include <inttypes.h> #include <math.h> -#include "config.h" #include "mp_msg.h" #include "cpudetect.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c index 7451715012..fc9924cbe9 100644 --- a/libmpcodecs/vf_denoise3d.c +++ b/libmpcodecs/vf_denoise3d.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <math.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index a72699d2d2..b281453c82 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -42,11 +42,6 @@ #include "mp_msg.h" #include "cpudetect.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c index cfd491503b..acd24e6100 100644 --- a/libmpcodecs/vf_hqdn3d.c +++ b/libmpcodecs/vf_hqdn3d.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <math.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c index b37c50a66c..de99c8a224 100644 --- a/libmpcodecs/vf_il.c +++ b/libmpcodecs/vf_il.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <assert.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c index f90f430315..359dfb9469 100644 --- a/libmpcodecs/vf_kerndeint.c +++ b/libmpcodecs/vf_kerndeint.c @@ -25,13 +25,7 @@ #include <inttypes.h> #include <math.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c index 1c589847aa..63e22cac8d 100644 --- a/libmpcodecs/vf_mcdeint.c +++ b/libmpcodecs/vf_mcdeint.c @@ -51,8 +51,6 @@ Known Issues: #include <inttypes.h> #include <math.h> -#include "config.h" - #include "mp_msg.h" #include "cpudetect.h" @@ -65,10 +63,6 @@ Known Issues: #undef free #undef malloc -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c index d2717e130a..eba1ad673e 100644 --- a/libmpcodecs/vf_ow.c +++ b/libmpcodecs/vf_ow.c @@ -32,14 +32,7 @@ #include <inttypes.h> #include <math.h> -#include "config.h" - #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c index 4287ed66bc..a06bc05e31 100644 --- a/libmpcodecs/vf_qp.c +++ b/libmpcodecs/vf_qp.c @@ -24,8 +24,6 @@ #include <math.h> #include <inttypes.h> -#include "config.h" - #include "mp_msg.h" #include "cpudetect.h" #include "img_format.h" @@ -36,10 +34,6 @@ #include "libavcodec/avcodec.h" #include "libavcodec/eval.h" -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - struct vf_priv_s { char eq[200]; diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index a420bf109c..3f7cd9abe0 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <assert.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "libavutil/avutil.h" #include "img_format.h" #include "mp_image.h" diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c index a18df801a3..01a3d87bdf 100644 --- a/libmpcodecs/vf_spp.c +++ b/libmpcodecs/vf_spp.c @@ -46,10 +46,6 @@ #undef free #undef malloc -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c index e25e744daf..667019c670 100644 --- a/libmpcodecs/vf_swapuv.c +++ b/libmpcodecs/vf_swapuv.c @@ -24,13 +24,7 @@ #include <inttypes.h> #include <assert.h> -#include "config.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c index e1e6a443c4..863b3921fc 100644 --- a/libmpcodecs/vf_uspp.c +++ b/libmpcodecs/vf_uspp.c @@ -32,10 +32,6 @@ #include "libavcodec/avcodec.h" -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c index 82ffe21412..8c73ebacef 100644 --- a/libmpcodecs/vf_yadif.c +++ b/libmpcodecs/vf_yadif.c @@ -29,11 +29,6 @@ #include "options.h" #include "mp_msg.h" - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - #include "img_format.h" #include "mp_image.h" #include "vf.h" diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 047315e74c..e977255fea 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -42,7 +42,7 @@ #include "mp_taglists.h" -#define PROBE_BUF_SIZE 2048 +#define PROBE_BUF_SIZE (32*1024) static unsigned int opt_probesize = 0; static unsigned int opt_analyzeduration = 0; diff --git a/libmpdemux/mp_taglists.c b/libmpdemux/mp_taglists.c index 98564b5916..eda322d210 100644 --- a/libmpdemux/mp_taglists.c +++ b/libmpdemux/mp_taglists.c @@ -60,6 +60,8 @@ static const AVCodecTag mp_wav_override_tags[] = { { CODEC_ID_PCM_S16LE, 1}, { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, { CODEC_ID_PCM_S24LE, 1}, + { CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2')}, + { CODEC_ID_PCM_S32LE, 1}, { 0, 0 }, }; diff --git a/libmpdemux/parse_mp4.c b/libmpdemux/parse_mp4.c index 82b00a060c..c9f9ff2e80 100644 --- a/libmpdemux/parse_mp4.c +++ b/libmpdemux/parse_mp4.c @@ -23,9 +23,6 @@ #include <stdio.h> #include <inttypes.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <stdlib.h> #include "parse_mp4.h" #include "mp_msg.h" diff --git a/libswscale/Makefile b/libswscale/Makefile index bf75b64959..ce0f7cebc1 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -24,8 +24,3 @@ TESTPROGS = colorspace DIRS = bfin mlib ppc sparc x86 include $(SUBDIR)../subdir.mak - -$(SUBDIR)colorspace-test$(EXESUF): $(SUBDIR)colorspace-test.o $(SUBDIR)$(LIBNAME) - -$(SUBDIR)swscale-example$(EXESUF): $(SUBDIR)swscale-example.o $(SUBDIR)$(LIBNAME) -$(SUBDIR)swscale-example$(EXESUF): EXTRALIBS += -lm diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index ecf5c10131..4562866b7b 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -26,15 +26,6 @@ #undef PAVGB #undef PREFETCH #undef PREFETCHW -#undef EMMS -#undef SFENCE - -#if HAVE_AMD3DNOW -/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ -#define EMMS "femms" -#else -#define EMMS "emms" -#endif #if HAVE_AMD3DNOW #define PREFETCH "prefetch" @@ -48,12 +39,6 @@ #endif #if HAVE_MMX2 -#define SFENCE "sfence" -#else -#define SFENCE " # nop" -#endif - -#if HAVE_MMX2 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" #elif HAVE_AMD3DNOW #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" @@ -2258,13 +2243,34 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW #endif /* HAVE_ALTIVEC */ #endif /* HAVE_MMX */ } + +static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, + int dstWidth, uint8_t *src, int srcW, + int xInc) +{ + int i; + unsigned int xpos=0; + for (i=0;i<dstWidth;i++) + { + register unsigned int xx=xpos>>16; + register unsigned int xalpha=(xpos&0xFFFF)>>9; + dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; + xpos+=xInc; + } +} + // *** horizontal scale Y line to temp buffer static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, - int flags, int canMMX2BeUsed, int16_t *hLumFilter, - int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, - int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, - int32_t *mmx2FilterPos, uint32_t *pal, int isAlpha) + int flags, int16_t *hLumFilter, + int16_t *hLumFilterPos, int hLumFilterSize, + int srcFormat, uint8_t *formatConvBuffer, + uint32_t *pal, int isAlpha) { + int32_t *mmx2FilterPos = c->lumMmx2FilterPos; + int16_t *mmx2Filter = c->lumMmx2Filter; + int canMMX2BeUsed = c->canMMX2BeUsed; + void *funnyYCode = c->funnyYCode; + if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { RENAME(yuy2ToY)(formatConvBuffer, src, srcW, pal); @@ -2480,15 +2486,7 @@ FUNNY_Y_CODE } //if MMX2 can't be used #endif #else - int i; - unsigned int xpos=0; - for (i=0;i<dstWidth;i++) - { - register unsigned int xx=xpos>>16; - register unsigned int xalpha=(xpos&0xFFFF)>>9; - dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; - xpos+=xInc; - } + RENAME(hyscale_fast)(c, dst, dstWidth, src, srcW, xInc); #endif /* ARCH_X86 */ } @@ -2506,12 +2504,37 @@ FUNNY_Y_CODE } } +static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, + int dstWidth, uint8_t *src1, + uint8_t *src2, int srcW, int xInc) +{ + int i; + unsigned int xpos=0; + for (i=0;i<dstWidth;i++) + { + register unsigned int xx=xpos>>16; + register unsigned int xalpha=(xpos&0xFFFF)>>9; + dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); + dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); + /* slower + dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha; + dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha; + */ + xpos+=xInc; + } +} + inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, - int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, - int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, - int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, - int32_t *mmx2FilterPos, uint32_t *pal) + int srcW, int xInc, int flags, int16_t *hChrFilter, + int16_t *hChrFilterPos, int hChrFilterSize, + int srcFormat, uint8_t *formatConvBuffer, + uint32_t *pal) { + int32_t *mmx2FilterPos = c->chrMmx2FilterPos; + int16_t *mmx2Filter = c->chrMmx2Filter; + int canMMX2BeUsed = c->canMMX2BeUsed; + void *funnyUVCode = c->funnyUVCode; + if (srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); @@ -2769,20 +2792,7 @@ FUNNY_UV_CODE } //if MMX2 can't be used #endif #else - int i; - unsigned int xpos=0; - for (i=0;i<dstWidth;i++) - { - register unsigned int xx=xpos>>16; - register unsigned int xalpha=(xpos&0xFFFF)>>9; - dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); - dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); - /* slower - dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha; - dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha; - */ - xpos+=xInc; - } + RENAME(hcscale_fast)(c, dst, dstWidth, src1, src2, srcW, xInc); #endif /* ARCH_X86 */ } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ @@ -2817,7 +2827,6 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s const int dstFormat= c->dstFormat; const int srcFormat= c->srcFormat; const int flags= c->flags; - const int canMMX2BeUsed= c->canMMX2BeUsed; int16_t *vLumFilterPos= c->vLumFilterPos; int16_t *vChrFilterPos= c->vChrFilterPos; int16_t *hLumFilterPos= c->hLumFilterPos; @@ -2838,8 +2847,6 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s int16_t **alpPixBuf= c->alpPixBuf; const int vLumBufSize= c->vLumBufSize; const int vChrBufSize= c->vChrBufSize; - uint8_t *funnyYCode= c->funnyYCode; - uint8_t *funnyUVCode= c->funnyUVCode; uint8_t *formatConvBuffer= c->formatConvBuffer; const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample; const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample); @@ -2942,14 +2949,14 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s assert(lastInLumBuf + 1 - srcSliceY >= 0); //printf("%d %d\n", lumBufIndex, vLumBufSize); RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, - flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, - c->lumMmx2Filter, c->lumMmx2FilterPos, pal, 0); + flags, hLumFilter, hLumFilterPos, hLumFilterSize, + c->srcFormat, formatConvBuffer, + pal, 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, - flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, - c->lumMmx2Filter, c->lumMmx2FilterPos, pal, 1); + flags, hLumFilter, hLumFilterPos, hLumFilterSize, + c->srcFormat, formatConvBuffer, + pal, 1); lastInLumBuf++; } while(lastInChrBuf < lastChrSrcY) @@ -2964,9 +2971,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s if (!(isGray(srcFormat) || isGray(dstFormat))) RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, - flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize, - funnyUVCode, c->srcFormat, formatConvBuffer, - c->chrMmx2Filter, c->chrMmx2FilterPos, pal); + flags, hChrFilter, hChrFilterPos, hChrFilterSize, + c->srcFormat, formatConvBuffer, + pal); lastInChrBuf++; } //wrap buf index around to stay inside the ring buffer @@ -2990,14 +2997,14 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); assert(lastInLumBuf + 1 - srcSliceY >= 0); RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, - flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, - c->lumMmx2Filter, c->lumMmx2FilterPos, pal, 0); + flags, hLumFilter, hLumFilterPos, hLumFilterSize, + c->srcFormat, formatConvBuffer, + pal, 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, - flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, - c->lumMmx2Filter, c->lumMmx2FilterPos, pal, 1); + flags, hLumFilter, hLumFilterPos, hLumFilterSize, + c->srcFormat, formatConvBuffer, + pal, 1); lastInLumBuf++; } while(lastInChrBuf+1 < (chrSrcSliceY + chrSrcSliceH)) @@ -3011,9 +3018,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s if (!(isGray(srcFormat) || isGray(dstFormat))) RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, - flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize, - funnyUVCode, c->srcFormat, formatConvBuffer, - c->chrMmx2Filter, c->chrMmx2FilterPos, pal); + flags, hChrFilter, hChrFilterPos, hChrFilterSize, + c->srcFormat, formatConvBuffer, + pal); lastInChrBuf++; } //wrap buf index around to stay inside the ring buffer @@ -3209,8 +3216,10 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255); #if HAVE_MMX - __asm__ volatile(SFENCE:::"memory"); - __asm__ volatile(EMMS:::"memory"); + if (flags & SWS_CPU_CAPS_MMX2 ) __asm__ volatile("sfence":::"memory"); + /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ + if (flags & SWS_CPU_CAPS_3DNOW) __asm__ volatile("femms" :::"memory"); + else __asm__ volatile("emms" :::"memory"); #endif /* store changed local vars back in the context */ c->dstY= dstY; diff --git a/libvo/video_out.c b/libvo/video_out.c index eb348dd086..efd2963252 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -162,12 +162,12 @@ const struct vo_driver *video_out_drivers[] = #ifdef CONFIG_3DFX &video_out_3dfx, #endif -#ifdef CONFIG_XV - &video_out_xv, -#endif #if CONFIG_VDPAU &video_out_vdpau, #endif +#ifdef CONFIG_XV + &video_out_xv, +#endif #ifdef CONFIG_X11 &video_out_x11, &video_out_xover, diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c index e9474a0eb2..9893e80fb0 100644 --- a/libvo/vo_dxr3.c +++ b/libvo/vo_dxr3.c @@ -37,9 +37,6 @@ #include "config.h" #include "mp_msg.h" #include "help_mp.h" -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include "fastmemcpy.h" #include "video_out.h" diff --git a/loader/drv.c b/loader/drv.c index e3fb4da116..43d9485646 100644 --- a/loader/drv.c +++ b/loader/drv.c @@ -7,9 +7,6 @@ #include "debug.h" #include <stdio.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <stdlib.h> #ifdef __FreeBSD__ #include <sys/time.h> diff --git a/loader/ext.c b/loader/ext.c index 0486f7c09b..b57eed674b 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -14,9 +14,6 @@ #include "config.h" #include <stdio.h> #include <stdlib.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <unistd.h> #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> diff --git a/loader/win32.c b/loader/win32.c index 3aded84674..4287c5b0b1 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -53,9 +53,6 @@ for DLL to know too much about its environment. #include <ctype.h> #include <pthread.h> #include <errno.h> -#if HAVE_MALLOC_H -#include <malloc.h> -#endif #include <time.h> #include <math.h> #include <unistd.h> diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 2f00b083ae..8897361717 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -1094,7 +1094,6 @@ fail: static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_format) { - char *ext; char* filename; struct stream_priv_s *spriv; int len = strlen(stream->url); |