From 46974cdb45230919540581ea85c9a239c4002c93 Mon Sep 17 00:00:00 2001 From: Gabrov Date: Mon, 13 Jul 2009 13:05:00 +0000 Subject: [PATCH 01/38] synced with r39413 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29418 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/hu/mplayer.1 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/DOCS/man/hu/mplayer.1 b/DOCS/man/hu/mplayer.1 index 6d49d7fd92..a63c5af287 100644 --- a/DOCS/man/hu/mplayer.1 +++ b/DOCS/man/hu/mplayer.1 @@ -1,4 +1,4 @@ -.\" Synced with r29305 +.\" Synced with r29413 .\" MPlayer (C) 2000-2009 MPlayer Team .\" Ezt a man oldalt Gabucino, Diego Biurrun és Jonas Jermann készíti/készítette .\" Karbantartó: Gabrov @@ -33,7 +33,7 @@ .\" Név .\" -------------------------------------------------------------------------- . -.TH MPlayer 1 "2009. 05. 24." "MPlayer Project" "A film lejátszó" +.TH MPlayer 1 "2009. 07. 13." "MPlayer Project" "A film lejátszó" . .SH NÉV mplayer \- film lejátszó @@ -7361,6 +7361,26 @@ A pixelek sz Határérték, mely alatt egy pixel feketének minősül (alapértelmezett: 32). .RE . +.TP +.B gradfun[=erősség[:sugár]] +Megszünteti a banding mellékhatásait, amik néha a színmélység 8 bitre történő +csökkentésekor jelentkeznek a sima területeken. +Interpolálja a szögeket, amik a sávok helyére kell, hogy kerüljenek és +árnyalja őket. +.sp 1 +Ez a szűrő a lejátszáshoz lett tervezve. +Ne használd veszteséges tömörítés előtt, mert a tömörítés elveszti az +árnyalást és visszahozza a sávokat. +.RSs +.IPs +A maximum érték, amennyivel a szűrő megváltoztat egy pixelt. +Valamint ez a küszöbérték a majdnem sima területek azonosításához is (alapértelmezett: 1.2). +.IPs +A szomszédság, melyhez a szögnek illeszkednie kell. +A nagyobb sugár simább szögeket ad, de megakadályozza a szűrőt a részletesebb +területek közelében lévő pixelek módosításában (alapértelmezett: 16). +.RE +. . . .SH "ÁLTALÁNOS KÓDOLÁSI OPCIÓK (CSAK MENCODER)" From 7f6cfb7935cd8317a3a850e413f307dfb8ed9f7c Mon Sep 17 00:00:00 2001 From: cehoyos Date: Fri, 17 Jul 2009 09:55:23 +0000 Subject: [PATCH 02/38] Assume HAVE_ATTRIBUTE_PACKED. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29419 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index c8d076612c..8e164f36db 100755 --- a/configure +++ b/configure @@ -8864,6 +8864,7 @@ $def_yasm #define HAVE_POLL_H 1 #define HAVE_PPC4XX 0 #define HAVE_VIRTUALALLOC 0 +#define HAVE_ATTRIBUTE_PACKED 1 /* Some FFmpeg codecs depend on these. Enable them unconditionally for now. */ #define CONFIG_AANDCT 1 From 4ce671eb4457f9ce23b86ab7e57242df904d6a3c Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 17 Jul 2009 13:58:07 +0000 Subject: [PATCH 03/38] Remove CONFIG_LIBAMR_NB_FIXED #define, which no longer exists in FFmpeg. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29420 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 8e164f36db..2d5f25b57d 100755 --- a/configure +++ b/configure @@ -8851,7 +8851,6 @@ $def_yasm #define CONFIG_GPL 1 #define CONFIG_GRAY 0 #define CONFIG_HARDCODED_TABLES 0 -#define CONFIG_LIBAMR_NB_FIXED 0 #define CONFIG_LIBVORBIS 0 #define CONFIG_POWERPC_PERF 0 #define CONFIG_SMALL 0 From c266aa7c21d736b23b6fa31886b577ac22149be4 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Fri, 17 Jul 2009 17:43:08 +0000 Subject: [PATCH 04/38] Restore alphabetic order for HAVE_ defines. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29421 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 2d5f25b57d..f4fab73de9 100755 --- a/configure +++ b/configure @@ -8857,13 +8857,13 @@ $def_yasm #define CONFIG_SWSCALE 1 #define CONFIG_SWSCALE_ALPHA 1 +#define HAVE_ATTRIBUTE_PACKED 1 #define HAVE_GETHRTIME 0 #define HAVE_INLINE_ASM 0 #define HAVE_LDBRX 0 #define HAVE_POLL_H 1 #define HAVE_PPC4XX 0 #define HAVE_VIRTUALALLOC 0 -#define HAVE_ATTRIBUTE_PACKED 1 /* Some FFmpeg codecs depend on these. Enable them unconditionally for now. */ #define CONFIG_AANDCT 1 From b96296d6afadb73d8e79a8310770f99868eacd38 Mon Sep 17 00:00:00 2001 From: jrash Date: Sat, 18 Jul 2009 04:31:55 +0000 Subject: [PATCH 05/38] sync with en/mplayer.1 r29413 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29422 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/zh_CN/mplayer.1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index 78a0e2bbcc..874548068e 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 r29252 +.\" sync with en/mplayer.1 r29413 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -6852,6 +6852,23 @@ h参数值。 决定像素值低于多少就被认作是黑色的阈值(默认值:32)。 .RE . +.TP +.B gradfun[=strength[:radius]] +消除有时候因为将色深降至 8 比特后,在颜色近似不变的区域造成的带状损伤。 +通过插值在带状区域产生变化坡度,从而使其颜色产生抖动效果。 +.sp 1 +设计该滤镜仅为播放目的。 +不要在有损压缩步骤前使用该滤镜,因为压缩过程容易丢失抖动效果,从而恢复带状损伤。 +.RSs +.IPs +滤镜改变单个像素的最大程度。 +同时也是侦测颜色近似不变区域的阈值(默认值:1.2)。 +.IPs +应用变化坡度的周边区域大小。 +较大的 radius 值带来较平缓的变化坡度,但同时使滤镜不能修改靠近颜色变化丰富区域 +的像素(默认值:16)。 +.RE. +. . . .SH "通用编码选项(仅用于MENCODER)" From 9dc9f1a77ddc29524d9e0a91649f20a0e054896e Mon Sep 17 00:00:00 2001 From: eugeni Date: Sat, 18 Jul 2009 11:32:58 +0000 Subject: [PATCH 06/38] Fix read after the end of allocated buffer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29423 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass.h | 2 ++ libass/ass_render.c | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/libass/ass.h b/libass/ass.h index e98b4264b7..12f16fef5d 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -34,6 +34,8 @@ typedef struct ass_image_s { int w, h; // bitmap width/height int stride; // bitmap stride unsigned char* bitmap; // 1bpp stride*h alpha buffer + // Actual bitmap size may be as low as + // stride * (h-1) + w uint32_t color; // RGBA int dst_x, dst_y; // bitmap placement inside the video frame diff --git a/libass/ass_render.c b/libass/ass_render.c index f13f76661e..ae54a0f1bc 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -407,6 +407,21 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c return tail; } +/** + * \brief Replaces the bitmap buffer in ass_image_t with its copy. + * + * @param img Image to operate on. + * @return Address of the old buffer. + */ +static unsigned char* clone_bitmap_data(ass_image_t* img) +{ + unsigned char* old_bitmap = img->bitmap; + int size = img->stride * (img->h - 1) + img->w; + img->bitmap = malloc(size); + memcpy(img->bitmap, old_bitmap, size); + return old_bitmap; +} + /** * \brief Calculate overlapping area of two consecutive bitmaps and in case they * overlap, composite them together @@ -474,12 +489,8 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h } // Allocate new bitmaps and copy over data - a = (*last_tail)->bitmap; - b = (*tail)->bitmap; - (*last_tail)->bitmap = malloc(as*ah); - (*tail)->bitmap = malloc(bs*bh); - memcpy((*last_tail)->bitmap, a, as*ah); - memcpy((*tail)->bitmap, b, bs*bh); + a = clone_bitmap_data(*last_tail); + b = clone_bitmap_data(*tail); // Composite overlapping area for (y=0; y Date: Sat, 18 Jul 2009 11:33:00 +0000 Subject: [PATCH 07/38] Cosmetics: make some variables constant to signify their intended use and, therefore, improve code readability. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29424 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index ae54a0f1bc..f64908c8a0 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -346,19 +346,18 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c // color = color left of brk // color2 = color right of brk int b_x0, b_y0, b_x1, b_y1; // visible part of the bitmap - int clip_x0, clip_y0, clip_x1, clip_y1; int tmp; ass_image_t* img; + const int clip_x0 = render_context.clip_x0; + const int clip_y0 = render_context.clip_y0; + const int clip_x1 = render_context.clip_x1; + const int clip_y1 = render_context.clip_y1; + dst_x += bm->left; dst_y += bm->top; brk -= bm->left; - // clipping - clip_x0 = render_context.clip_x0; - clip_y0 = render_context.clip_y0; - clip_x1 = render_context.clip_x1; - clip_y1 = render_context.clip_y1; b_x0 = 0; b_y0 = 0; b_x1 = bm->w; From bad51c711f9d10f567732a5665e7e88d2a675150 Mon Sep 17 00:00:00 2001 From: eugeni Date: Sat, 18 Jul 2009 11:33:03 +0000 Subject: [PATCH 08/38] Make sure clip coordinates are inside the screen area. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29425 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 11 +++++++++++ libmpcodecs/vf_ass.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/libass/ass_render.c b/libass/ass_render.c index f64908c8a0..e4c06f7885 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -317,6 +317,11 @@ static ass_image_t* my_draw_bitmap(unsigned char* bitmap, int bitmap_w, int bitm { ass_image_t* img = calloc(1, sizeof(ass_image_t)); + assert(dst_x >= 0); + assert(dst_y >= 0); + assert(dst_x + bitmap_w < frame_context.width); + assert(dst_y + bitmap_h < frame_context.height); + img->w = bitmap_w; img->h = bitmap_h; img->stride = stride; @@ -598,6 +603,7 @@ static double x2scr_pos(double x) { return x*frame_context.orig_width / frame_context.track->PlayResX + global_settings->left_margin; } + /** * \brief Mapping between script and screen coordinates */ @@ -2148,6 +2154,11 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images) render_context.clip_y1 = y2scr_pos(render_context.clip_y1); } + render_context.clip_x0 = FFMIN(FFMAX(render_context.clip_x0, 0), frame_context.width); + render_context.clip_x1 = FFMIN(FFMAX(render_context.clip_x1, 0), frame_context.width); + render_context.clip_y0 = FFMIN(FFMAX(render_context.clip_y0, 0), frame_context.height); + render_context.clip_y1 = FFMIN(FFMAX(render_context.clip_y1, 0), frame_context.height); + // calculate rotation parameters { FT_Vector center; diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index b88e7b37df..2068383926 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -219,6 +219,10 @@ static void copy_from_image(struct vf_instance_s* vf, int first_row, int last_ro last_row += (last_row % 2); chroma_rows = (last_row - first_row) / 2; + assert(first_row >= 0); + assert(first_row <= last_row); + assert(last_row < vf->priv->outh); + for (pl = 1; pl < 3; ++pl) { int dst_stride = vf->priv->outw; int src_stride = vf->dmpi->stride[pl]; From e2ae312a37f5dffe7ac66346299eaaea9e2a3386 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 18 Jul 2009 15:07:26 +0000 Subject: [PATCH 09/38] Change libamr support to libopencore-amr support. libamr support was removed from FFmpeg. based on a patch by Andrew Wason, rectalogic rectalogic com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29426 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 98 ++++++++++++++++++++++++------------------------- etc/codecs.conf | 4 +- 2 files changed, 49 insertions(+), 53 deletions(-) diff --git a/configure b/configure index f4fab73de9..48b15232ad 100755 --- a/configure +++ b/configure @@ -341,8 +341,8 @@ Codecs: --disable-liba52-internal disable builtin liba52 [autodetect] --disable-libmpeg2 disable builtin libmpeg2 [autodetect] --disable-musepack disable musepack support [autodetect] - --disable-libamr_nb disable libamr narrowband [autodetect] - --disable-libamr_wb disable libamr wideband [autodetect] + --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect] + --disable-libopencore_amrwb disable libopencore_amr wideband [autodetect] --disable-decoder=DECODER disable specified FFmpeg decoder --enable-decoder=DECODER enable specified FFmpeg decoder --disable-encoder=ENCODER disable specified FFmpeg encoder @@ -535,8 +535,8 @@ _prefix="/usr/local" _libavutil_a=auto _libavutil_so=auto _libavcodec_a=auto -_libamr_nb=auto -_libamr_wb=auto +_libopencore_amrnb=auto +_libopencore_amrwb=auto _libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') _libavdecoders=$(echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//) _libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') @@ -1145,10 +1145,10 @@ for ac_option do --disable-libavcodec_a) _libavcodec_a=no ;; --enable-libavcodec_so) _libavcodec_so=yes ;; --disable-libavcodec_so) _libavcodec_so=no ;; - --enable-libamr_nb) _libamr_nb=yes ;; - --disable-libamr_nb) _libamr_nb=no ;; - --enable-libamr_wb) _libamr_wb=yes ;; - --disable-libamr_wb) _libamr_wb=no ;; + --enable-libopencore_amrnb) _libopencore_amrnb=yes ;; + --disable-libopencore_amrnb) _libopencore_amrnb=no ;; + --enable-libopencore_amrwb) _libopencore_amrwb=yes ;; + --disable-libopencore_amrwb) _libopencore_amrwb=no ;; --enable-decoder=*) _libavdecoders="$_libavdecoders $(echo $ac_option | cut -d '=' -f 2)" ;; --disable-decoder=*) _libavdecoders=$(echo $_libavdecoders | sed "s/$(echo $ac_option | cut -d '=' -f 2)//g") ;; --enable-encoder=*) _libavencoders="$_libavencoders $(echo $ac_option | cut -d '=' -f 2)" ;; @@ -7061,60 +7061,58 @@ test "$_libswscale_so" = yes \ && def_libswscale_so='#define CONFIG_LIBSWSCALE_SO 1' echores "$_libswscale" -echocheck "libamr narrowband" -if test "$_libamr_nb" = auto ; then - _libamr_nb=no +echocheck "libopencore_amr narrowband" +if test "$_libopencore_amrnb" = auto ; then + _libopencore_amrnb=no cat > $TMPC << EOF -#include -int main(void) { Speech_Decode_Frame_init(); return 0; } +#include +int main(void) { Decoder_Interface_init(); return 0; } EOF - cc_check -lamrnb && _libamr_nb=yes + cc_check -lopencore-amrnb && _libopencore_amrnb=yes if test "$_libavcodec_a" != yes ; then - _libamr_nb=no - _res_comment="libavcodec (static) is required by libamr_nb, sorry" + _libopencore_amrnb=no + _res_comment="libavcodec (static) is required by libopencore_amrnb, sorry" fi fi -if test "$_libamr_nb" = yes ; then - _libamr=yes - extra_ldflags="$extra_ldflags -lamrnb" - def_libamr='#define CONFIG_LIBAMR 1' - def_libamr_nb='#define CONFIG_LIBAMR_NB 1' - _libavdecoders="$_libavdecoders LIBAMR_NB_DECODER" - _libavencoders="$_libavencoders LIBAMR_NB_ENCODER" - _codecmodules="libamr_nb $_codecmodules" +if test "$_libopencore_amrnb" = yes ; then + _libopencore_amr=yes + extra_ldflags="$extra_ldflags -lopencore-amrnb" + def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 1' + _libavdecoders="$_libavdecoders LIBOPENCORE_AMRNB_DECODER" + _libavencoders="$_libavencoders LIBOPENCORE_AMRNB_DECODER" + _codecmodules="libopencore_amrnb $_codecmodules" else - def_libamr_nb='#define CONFIG_LIBAMR_NB 0' - _nocodecmodules="libamr_nb $_nocodecmodules" + def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 0' + _nocodecmodules="libopencore_amrnb $_nocodecmodules" fi -echores "$_libamr_nb" +echores "$_libopencore_amrnb" -echocheck "libamr wideband" -if test "$_libamr_wb" = auto ; then - _libamr_wb=no +echocheck "libopencore_amr wideband" +if test "$_libopencore_amrwb" = auto ; then + _libopencore_amrwb=no cat > $TMPC << EOF -#include +#include int main(void) { D_IF_init(); return 0; } EOF - cc_check -lamrwb && _libamr_wb=yes + cc_check -lopencore-amrwb && _libopencore_amrwb=yes if test "$_libavcodec_a" != yes ; then - _libamr_wb=no - _res_comment="libavcodec (static) is required by libamr_wb, sorry" + _libopencore_amrwb=no + _res_comment="libavcodec (static) is required by libopencore_amrwb, sorry" fi fi -if test "$_libamr_wb" = yes ; then - _libamr=yes - extra_ldflags="$extra_ldflags -lamrwb" - def_libamr='#define CONFIG_LIBAMR 1' - def_libamr_wb='#define CONFIG_LIBAMR_WB 1' - _libavdecoders="$_libavdecoders LIBAMR_WB_DECODER" - _libavencoders="$_libavencoders LIBAMR_WB_ENCODER" - _codecmodules="libamr_wb $_codecmodules" +if test "$_libopencore_amrwb" = yes ; then + _libopencore_amr=yes + extra_ldflags="$extra_ldflags -lopencore-amrwb" + def_libopencore_amrwb='#define CONFIG_LIBOPENCORE_AMRWB 1' + _libavdecoders="$_libavdecoders LIBOPENCORE_AMRWB_DECODER" + _libavencoders="$_libavencoders LIBOPENCORE_AMRWB_DECODER" + _codecmodules="libopencore_amrwb $_codecmodules" else - def_libamr_wb='#define CONFIG_LIBAMR_WB 0' - _nocodecmodules="libamr_wb $_nocodecmodules" + def_libopencore_amrwb='#define LIBOPENCORE_AMRWB 0' + _nocodecmodules="libopencore_amrwb $_nocodecmodules" fi -echores "$_libamr_wb" +echores "$_libopencore_amrwb" echocheck "libdv-0.9.5+" if test "$_libdv" = auto ; then @@ -8393,12 +8391,11 @@ CONFIG_RDFT=yes CONFIG_BZLIB=$bzlib CONFIG_ENCODERS=yes CONFIG_GPL=yes -CONFIG_LIBAMR=$_libamr -CONFIG_LIBAMR_NB=$_libamr_nb -CONFIG_LIBAMR_WB=$_libamr_wb CONFIG_LIBDIRAC=$_libdirac_lavc CONFIG_LIBFAAC=$_faac_lavc CONFIG_LIBMP3LAME=$_mp3lame_lavc +CONFIG_LIBOPENCORE_AMRNB=$_libopencore_amrnb +CONFIG_LIBOPENCORE_AMRWB=$_libopencore_amrwb CONFIG_LIBSCHROEDINGER=$_libschroedinger_lavc CONFIG_LIBVORBIS=$_libvorbis CONFIG_LIBX264=$_x264_lavc @@ -8882,10 +8879,9 @@ $def_yasm /* External libraries used through libavcodec. */ $def_faac_lavc -$def_libamr -$def_libamr_nb -$def_libamr_wb $def_libdirac_lavc +$def_libopencore_amrnb +$def_libopencore_amrwb $def_libschroedinger_lavc $def_mp3lame_lavc $def_x264_lavc diff --git a/etc/codecs.conf b/etc/codecs.conf index f5aeee3eea..103955c322 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -3840,7 +3840,7 @@ audiocodec ffamrnb fourcc samr format 0x57 ;amr in avi driver ffmpeg - dll "libamr_nb" + dll "libopencore_amrnb" audiocodec ffamrwb info "AMR Wideband" @@ -3848,7 +3848,7 @@ audiocodec ffamrwb fourcc sawb format 0x58 ;amr in avi driver ffmpeg - dll "libamr_wb" + dll "libopencore_amrwb" audiocodec ffadcpmswf info "FFmpeg's ADPCM Flash-variant" From f6c25fd5c50bf1048f7c280312f6b920fe822edf Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 19 Jul 2009 09:55:29 +0000 Subject: [PATCH 10/38] Fix 24bit audio playback. The reordering channels code had reoccurring bug where in switch(samplesize) block the case 3 (3 bytes) doesn't end with break; leading to execution of the next case 4 too. This mangles the already processed data and causes massive memory corruption. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29427 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libaf/reorder_ch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libaf/reorder_ch.c b/libaf/reorder_ch.c index 1ef05f4838..fa0c2373bb 100644 --- a/libaf/reorder_ch.c +++ b/libaf/reorder_ch.c @@ -453,6 +453,7 @@ static int reorder_self_3(void *src, unsigned int samples, src_8[i+s2*3+1] = tmp1; src_8[i+s2*3+2] = tmp2; } + break; } case 4: { @@ -547,6 +548,7 @@ static int reorder_self_4_step_1(void *src, unsigned int samples, src_8[i+s3*3+1] = tmp1; src_8[i+s3*3+2] = tmp2; } + break; } case 4: { @@ -695,6 +697,7 @@ static int reorder_self_5_step_1(void *src, unsigned int samples, src_8[i+s4*3+1] = tmp1; src_8[i+s4*3+2] = tmp2; } + break; } case 4: { @@ -787,6 +790,7 @@ static int reorder_self_2_3(void *src, unsigned int samples, src_8[i+s4*3+1] = tmp1; src_8[i+s4*3+2] = tmp2; } + break; } case 4: { @@ -873,6 +877,7 @@ static int reorder_self_3_3(void *src, unsigned int samples, src_8[i+s5*3+1] = tmp1; src_8[i+s5*3+2] = tmp2; } + break; } case 4: { @@ -959,6 +964,7 @@ static int reorder_self_2_4(void *src, unsigned int samples, src_8[i+s5*3+1] = tmp1; src_8[i+s5*3+2] = tmp2; } + break; } case 4: { From 968a51cfef19c0dd390001de742d775410ef3071 Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 19 Jul 2009 10:26:48 +0000 Subject: [PATCH 11/38] Handle 24bit audio formats natively by ALSA. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29428 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 5e848446f2..581fb36c29 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -392,6 +392,18 @@ static int init(int rate_hz, int channels, int format, int flags) case AF_FORMAT_S32_BE: alsa_format = SND_PCM_FORMAT_S32_BE; break; + case AF_FORMAT_U24_LE: + alsa_format = SND_PCM_FORMAT_U24_LE; + break; + case AF_FORMAT_U24_BE: + alsa_format = SND_PCM_FORMAT_U24_BE; + break; + case AF_FORMAT_S24_LE: + alsa_format = SND_PCM_FORMAT_S24_LE; + break; + case AF_FORMAT_S24_BE: + alsa_format = SND_PCM_FORMAT_S24_BE; + break; case AF_FORMAT_FLOAT_LE: alsa_format = SND_PCM_FORMAT_FLOAT_LE; break; From e696ba4ba07fe01886dd91fe96ac0250cd58071c Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 19 Jul 2009 17:03:28 +0000 Subject: [PATCH 12/38] The ivtv vo driver and the ivtv VIDIX driver are unrelated; do not disable the VIDIX driver when the ivtv vo driver has been disabled. patch by Martin Dauskardt, martin.dauskardt gmx de git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29429 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 48b15232ad..177a1dce2e 100755 --- a/configure +++ b/configure @@ -4525,7 +4525,6 @@ if test "$_vidix" = yes ; then def_vidix='#define CONFIG_VIDIX 1' _vomodules="cvidix $_vomodules" test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome" - test $_ivtv = "yes" || _vidix_drivers=$(echo $_vidix_drivers | sed s/ivtv//) # some vidix drivers are architecture and os specific, discard them elsewhere x86 || _vidix_drivers=$(echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//) From 944f7811c5d85d59a12858286eec3dde0df39180 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 19 Jul 2009 17:05:42 +0000 Subject: [PATCH 13/38] Remove redundant ivtv VIDIX driver variable declarations. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29430 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure b/configure index 177a1dce2e..06ea5d1f13 100755 --- a/configure +++ b/configure @@ -4487,8 +4487,6 @@ def_vidix_drv_cyberblade='#undef CONFIG_VIDIX_DRV_CYBERBLADE' _vidix_drv_cyberblade=no def_vidix_drv_ivtv='#undef CONFIG_VIDIX_DRV_IVTV' _vidix_drv_ivtv=no -def_vidix_drv_ivtv='#undef CONFIG_VIDIX_DRV_IVTV' -_vidix_drv_ivtv=no def_vidix_drv_mach64='#undef CONFIG_VIDIX_DRV_MACH64' _vidix_drv_mach64=no def_vidix_drv_mga='#undef CONFIG_VIDIX_DRV_MGA' From b91c49e4b0adee6625314b0a0230b68856c56e07 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 19 Jul 2009 20:59:32 +0000 Subject: [PATCH 14/38] Move some variable declarations up to avoid the warnings: vidix/ivtv_vid.c: In function 'ivtv_probe': vidix/ivtv_vid.c:305: warning: ISO C90 forbids mixed declarations and code vidix/ivtv_vid.c: In function 'ivtv_query_fourcc': vidix/ivtv_vid.c:405: warning: ISO C90 forbids mixed declarations and code git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29431 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/ivtv_vid.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vidix/ivtv_vid.c b/vidix/ivtv_vid.c index 5cfc7a7e19..16e44928af 100644 --- a/vidix/ivtv_vid.c +++ b/vidix/ivtv_vid.c @@ -231,6 +231,8 @@ int ivtv_probe(int verbose, int force) pciinfo_t lst[MAX_PCI_DEVICES]; int err = 0; unsigned int i, num_pci = 0; + unsigned char yuv_device_number = 48, yuv_device = 48 + fb_number; + char yuv_device_name[] = "/dev/videoXXX\0"; if(verbose) printf(IVTV_MSG"probe\n"); @@ -302,9 +304,6 @@ card_found: } /* Try to find YUV device */ - unsigned char yuv_device_number = 48, yuv_device = 48 + fb_number; - char yuv_device_name[] = "/dev/videoXXX\0"; - do { sprintf(yuv_device_name, "/dev/video%u", yuv_device); yuvdev = open(yuv_device_name, O_RDWR); @@ -399,10 +398,11 @@ int ivtv_get_caps(vidix_capability_t *to) int ivtv_query_fourcc(vidix_fourcc_t *to) { + int supports = 0; + if(ivtv_verbose) printf(IVTV_MSG"query fourcc (%x)\n", to->fourcc); - int supports = 0; switch(to->fourcc) { case IMGFMT_YV12: From bcd7541f4e9d646a140aa9020d4daa64b7764d25 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 19 Jul 2009 21:09:00 +0000 Subject: [PATCH 15/38] The Makefile variable names for external libraries in FFmpeg changed. Adapt their names in config.mak, closes Bugzilla #1513. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29432 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 06ea5d1f13..d225730e1e 100755 --- a/configure +++ b/configure @@ -8388,15 +8388,18 @@ CONFIG_RDFT=yes CONFIG_BZLIB=$bzlib CONFIG_ENCODERS=yes CONFIG_GPL=yes -CONFIG_LIBDIRAC=$_libdirac_lavc -CONFIG_LIBFAAC=$_faac_lavc -CONFIG_LIBMP3LAME=$_mp3lame_lavc -CONFIG_LIBOPENCORE_AMRNB=$_libopencore_amrnb -CONFIG_LIBOPENCORE_AMRWB=$_libopencore_amrwb -CONFIG_LIBSCHROEDINGER=$_libschroedinger_lavc -CONFIG_LIBVORBIS=$_libvorbis -CONFIG_LIBX264=$_x264_lavc -CONFIG_LIBXVID=$_xvid_lavc +CONFIG_LIBDIRAC_DECODER=$_libdirac_lavc +CONFIG_LIBDIRAC_ENCODER=$_libdirac_lavc +CONFIG_LIBFAAC_ENCODER=$_faac_lavc +CONFIG_LIBMP3LAME_ENCODER=$_mp3lame_lavc +CONFIG_LIBOPENCORE_AMRNB_DECODER=$_libopencore_amrnb +CONFIG_LIBOPENCORE_AMRNB_ENCODER=$_libopencore_amrnb +CONFIG_LIBOPENCORE_AMRWB_DECODER=$_libopencore_amrwb +CONFIG_LIBSCHROEDINGER_DECODER=$_libschroedinger_lavc +CONFIG_LIBSCHROEDINGER_ENCODER=$_libschroedinger_lavc +CONFIG_LIBVORBIS_ENCODER=$_libvorbis +CONFIG_LIBX264_ENCODER=$_x264_lavc +CONFIG_LIBXVID_ENCODER=$_xvid_lavc CONFIG_MLIB = $_mlib CONFIG_MUXERS=$_mencoder CONFIG_POSTPROC = yes From 4593633f5896bbd7d55a0bbfafc8adbfaa4a62ba Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 19 Jul 2009 21:24:45 +0000 Subject: [PATCH 16/38] Bandaid compilation fix: Disable ivtv VIDIX driver until a proper test exists. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29433 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d225730e1e..41cc989538 100755 --- a/configure +++ b/configure @@ -4522,7 +4522,9 @@ echores "$_vidix" if test "$_vidix" = yes ; then def_vidix='#define CONFIG_VIDIX 1' _vomodules="cvidix $_vomodules" - test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome" + # FIXME: ivtv driver temporarily disabled until we have a proper test + #test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome" + test "$_vidix_drivers" || _vidix_drivers="cyberblade mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome" # some vidix drivers are architecture and os specific, discard them elsewhere x86 || _vidix_drivers=$(echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//) From dc8bb7837a122ed2cd99adb76c98a59160abc728 Mon Sep 17 00:00:00 2001 From: cladisch Date: Tue, 21 Jul 2009 08:20:22 +0000 Subject: [PATCH 17/38] Use correct ALSA sample format for 24-bit samples packed in three bytes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29434 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 581fb36c29..3bb10eddd0 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -393,16 +393,16 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_format = SND_PCM_FORMAT_S32_BE; break; case AF_FORMAT_U24_LE: - alsa_format = SND_PCM_FORMAT_U24_LE; + alsa_format = SND_PCM_FORMAT_U24_3LE; break; case AF_FORMAT_U24_BE: - alsa_format = SND_PCM_FORMAT_U24_BE; + alsa_format = SND_PCM_FORMAT_U24_3BE; break; case AF_FORMAT_S24_LE: - alsa_format = SND_PCM_FORMAT_S24_LE; + alsa_format = SND_PCM_FORMAT_S24_3LE; break; case AF_FORMAT_S24_BE: - alsa_format = SND_PCM_FORMAT_S24_BE; + alsa_format = SND_PCM_FORMAT_S24_3BE; break; case AF_FORMAT_FLOAT_LE: alsa_format = SND_PCM_FORMAT_FLOAT_LE; From 3490d7cbfa13ae61720dbba47105ec92f0d6262f Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 21 Jul 2009 20:17:15 +0000 Subject: [PATCH 18/38] Remove unused variables. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29435 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 3 --- libswscale/swscale_internal.h | 1 - 2 files changed, 4 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 31cf36ae05..64c4e2b63e 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2683,9 +2683,6 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d c->param[1] = SWS_PARAM_DEFAULT; } - c->chrIntHSubSample= c->chrDstHSubSample; - c->chrIntVSubSample= c->chrSrcVSubSample; - // Note the -((-x)>>y) is so that we always round toward +inf. c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample); c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample); diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 871575e437..50cf304b1f 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -82,7 +82,6 @@ typedef struct SwsContext{ enum PixelFormat dstFormat, srcFormat; ///< format 4:2:0 type is always YV12 int origDstFormat, origSrcFormat; ///< format int chrSrcHSubSample, chrSrcVSubSample; - int chrIntHSubSample, chrIntVSubSample; int chrDstHSubSample, chrDstVSubSample; int vChrDrop; int sliceDir; From b1666a747d6497651d4d7a4684e97902fd0e69c8 Mon Sep 17 00:00:00 2001 From: ptt Date: Wed, 22 Jul 2009 19:32:17 +0000 Subject: [PATCH 19/38] grammar and sentence fix git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29436 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/it/mplayer.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DOCS/man/it/mplayer.1 b/DOCS/man/it/mplayer.1 index 3d942fee2b..7232894625 100644 --- a/DOCS/man/it/mplayer.1 +++ b/DOCS/man/it/mplayer.1 @@ -1280,7 +1280,7 @@ Disabilita la cache. . .TP .B \-cache\-min -La riproduzione comincerŕ appena la cache verrŕ riempirŕ almeno a +La riproduzione comincerŕ appena la cache sarŕ piena fino alla del totale. . .TP From 623a2c32b98afeff9f513aeb531f250cd719608a Mon Sep 17 00:00:00 2001 From: mru Date: Thu, 23 Jul 2009 15:23:03 +0000 Subject: [PATCH 20/38] Remove unnecessary #include git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29437 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 64c4e2b63e..bbeef61dba 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -59,7 +59,6 @@ untested special converters #include #include #include -#include #include "config.h" #include #if HAVE_SYS_MMAN_H From de3d544c4362f04e46f1e85283a3b7d7401229e3 Mon Sep 17 00:00:00 2001 From: cladisch Date: Fri, 24 Jul 2009 10:35:22 +0000 Subject: [PATCH 21/38] Use the correct OSS format, where possible, for mplayer's packed 24-bit format (AFMT_x24_xE would be 32-bit aligned). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29438 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_oss.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 4666c400e9..a28d5d9ad6 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -70,17 +70,8 @@ static int format2oss(int format) case AF_FORMAT_U16_BE: return AFMT_U16_BE; case AF_FORMAT_S16_LE: return AFMT_S16_LE; case AF_FORMAT_S16_BE: return AFMT_S16_BE; -#ifdef AFMT_U24_LE - case AF_FORMAT_U24_LE: return AFMT_U24_LE; -#endif -#ifdef AFMT_U24_BE - case AF_FORMAT_U24_BE: return AFMT_U24_BE; -#endif -#ifdef AFMT_S24_LE - case AF_FORMAT_S24_LE: return AFMT_S24_LE; -#endif -#ifdef AFMT_S24_BE - case AF_FORMAT_S24_BE: return AFMT_S24_BE; +#ifdef AFMT_S24_PACKED + case AF_FORMAT_S24_LE: return AFMT_S24_PACKED; #endif #ifdef AFMT_U32_LE case AF_FORMAT_U32_LE: return AFMT_U32_LE; @@ -122,17 +113,8 @@ static int oss2format(int format) case AFMT_U16_BE: return AF_FORMAT_U16_BE; case AFMT_S16_LE: return AF_FORMAT_S16_LE; case AFMT_S16_BE: return AF_FORMAT_S16_BE; -#ifdef AFMT_U24_LE - case AFMT_U24_LE: return AF_FORMAT_U24_LE; -#endif -#ifdef AFMT_U24_BE - case AFMT_U24_BE: return AF_FORMAT_U24_BE; -#endif -#ifdef AFMT_S24_LE - case AFMT_S24_LE: return AF_FORMAT_S24_LE; -#endif -#ifdef AFMT_S24_BE - case AFMT_S24_BE: return AF_FORMAT_S24_BE; +#ifdef AFMT_S24_PACKED + case AFMT_S24_PACKED: return AF_FORMAT_S24_LE; #endif #ifdef AFMT_U32_LE case AFMT_U32_LE: return AF_FORMAT_U32_LE; From b3186ed071dc514391e06e85e9dd6c96d1295aea Mon Sep 17 00:00:00 2001 From: mru Date: Sun, 26 Jul 2009 12:26:32 +0000 Subject: [PATCH 22/38] Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29439 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/rgb2rgb.c | 8 ++++---- libswscale/rgb2rgb_template.c | 12 ++++++------ libswscale/swscale.c | 9 ++++----- libswscale/swscale_internal.h | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 59b8e30a63..7aeb2a3ac2 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -275,7 +275,7 @@ void rgb32to24(const uint8_t *src, uint8_t *dst, long src_size) long num_pixels = src_size >> 2; for (i=0; i BGR24 (= B,G,R) */ dst[3*i + 0] = src[4*i + 1]; dst[3*i + 1] = src[4*i + 2]; @@ -293,7 +293,7 @@ void rgb24to32(const uint8_t *src, uint8_t *dst, long src_size) long i; for (i=0; 3*i BGR32 (= A,R,G,B) */ dst[4*i + 0] = 255; dst[4*i + 1] = src[3*i + 0]; @@ -318,7 +318,7 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size) { register uint16_t bgr; bgr = *s++; - #ifdef WORDS_BIGENDIAN + #if HAVE_BIGENDIAN *d++ = 255; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x7E0)>>3; @@ -382,7 +382,7 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size) { register uint16_t bgr; bgr = *s++; - #ifdef WORDS_BIGENDIAN + #if HAVE_BIGENDIAN *d++ = 255; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x3E0)>>2; diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 56c9426430..cd7fbae292 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -115,7 +115,7 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long s #endif while (s < end) { - #ifdef WORDS_BIGENDIAN + #if HAVE_BIGENDIAN /* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */ *dest++ = 255; *dest++ = s[2]; @@ -201,7 +201,7 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long s #endif while (s < end) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */ s++; dest[2] = *s++; @@ -1264,7 +1264,7 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_ #else register uint16_t bgr; bgr = *s++; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN *d++ = 255; *d++ = (bgr&0x7C00)>>7; *d++ = (bgr&0x3E0)>>2; @@ -1321,7 +1321,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ { register uint16_t bgr; bgr = *s++; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN *d++ = 255; *d++ = (bgr&0xF800)>>8; *d++ = (bgr&0x7E0)>>3; @@ -1581,7 +1581,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++){ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN *idst++ = (yc[0] << 24)+ (uc[0] << 16) + (yc[1] << 8) + (vc[0] << 0); #else @@ -1687,7 +1687,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++){ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else diff --git a/libswscale/swscale.c b/libswscale/swscale.c index bbeef61dba..b1592dadf8 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -89,7 +89,6 @@ unsigned swscale_version(void) //#define HAVE_AMD3DNOW //#undef HAVE_MMX //#undef ARCH_X86 -//#define WORDS_BIGENDIAN #define DITHER1XBPP #define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit @@ -3161,25 +3160,25 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, switch(c->dstFormat) { case PIX_FMT_BGR32: -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN case PIX_FMT_RGB24: #endif c->pal_rgb[i]= r + (g<<8) + (b<<16); break; case PIX_FMT_BGR32_1: -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case PIX_FMT_BGR24: #endif c->pal_rgb[i]= (r + (g<<8) + (b<<16)) << 8; break; case PIX_FMT_RGB32_1: -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case PIX_FMT_RGB24: #endif c->pal_rgb[i]= (b + (g<<8) + (r<<16)) << 8; break; case PIX_FMT_RGB32: -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN case PIX_FMT_BGR24: #endif default: diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 50cf304b1f..85e07c0af1 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -41,7 +41,7 @@ #define VOF (VOFW*2) -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define ALT32_CORR (-1) #else #define ALT32_CORR 1 From 06c122f00190a40969501ad7bc79c4b7d095136a Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sun, 26 Jul 2009 14:40:05 +0000 Subject: [PATCH 23/38] Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29440 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 41cc989538..24eb4b4c64 100755 --- a/configure +++ b/configure @@ -2361,10 +2361,10 @@ EOF fi if test "$_big_endian" = yes ; then _byte_order='big-endian' - def_words_endian='#define WORDS_BIGENDIAN 1' + def_words_endian='#define HAVE_BIGENDIAN 1' else _byte_order='little-endian' - def_words_endian='#undef WORDS_BIGENDIAN' + def_words_endian='#define HAVE_BIGENDIAN 0' fi echores "$_byte_order" From f9dcd2a235817781fefdbd1eda809b4d3386e4f0 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 26 Jul 2009 17:43:06 +0000 Subject: [PATCH 24/38] Set both HAVE_BIGENDIAN and WORDS_BIGENDIAN. Both definitions are used in different places. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29441 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 24eb4b4c64..1795e08d68 100755 --- a/configure +++ b/configure @@ -2361,10 +2361,12 @@ EOF fi if test "$_big_endian" = yes ; then _byte_order='big-endian' - def_words_endian='#define HAVE_BIGENDIAN 1' + def_words_endian='#define WORDS_BIGENDIAN 1' + def_bigendian='#define HAVE_BIGENDIAN 1' else _byte_order='little-endian' - def_words_endian='#define HAVE_BIGENDIAN 0' + def_words_endian='#undef WORDS_BIGENDIAN' + def_bigendian='#define HAVE_BIGENDIAN 0' fi echores "$_byte_order" @@ -8582,6 +8584,7 @@ $def_pthread_cache /* CPU stuff */ #define __CPU__ $iproc $def_words_endian +$def_bigendian $(ff_config_enable "$_arch_all" "$_arch" "ARCH") $(ff_config_enable "$_cpuexts_all" "$_cpuexts" "HAVE") From c242fdbfd9242873aae85be9f841f1f3caf9633f Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 26 Jul 2009 19:38:22 +0000 Subject: [PATCH 25/38] Make diff apply cleanly to our tree again. The GPL modification notices were dropped, same as for the other diffs we store. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29442 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libfaad2/local_changes.diff | 96 +++++-------------------------------- 1 file changed, 12 insertions(+), 84 deletions(-) diff --git a/libfaad2/local_changes.diff b/libfaad2/local_changes.diff index 56d584093e..11610c6e8a 100644 --- a/libfaad2/local_changes.diff +++ b/libfaad2/local_changes.diff @@ -1,16 +1,5 @@ --- libfaad2.orig/bits.h 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/bits.h 2006-03-16 20:37:21.000000000 +0100 -@@ -22,7 +22,10 @@ - ** Commercial non-GPL licensing of this software is possible. - ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. - ** -+** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 - ** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -+** local_changes.diff contains the exact changes to this file. - **/ - - #ifndef __BITS_H__ @@ -58,7 +61,7 @@ #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) @@ -22,18 +11,7 @@ #define BSWAP(a) \ --- libfaad2.orig/common.h 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/common.h 2006-03-16 20:56:56.000000000 +0100 -@@ -22,7 +22,10 @@ - ** Commercial non-GPL licensing of this software is possible. - ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. - ** -+** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 - ** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -+** local_changes.diff contains the exact changes to this file. - **/ - - #ifndef __COMMON_H__ -@@ -32,8 +35,13 @@ +@@ -32,8 +37,13 @@ #ifdef HAVE_CONFIG_H # include "../config.h" @@ -47,7 +25,7 @@ #define INLINE __inline #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) #define ALIGN __declspec(align(16)) -@@ -61,7 +67,7 @@ +@@ -61,7 +69,7 @@ /* Use if target platform has address generators with autoincrement */ //#define PREFER_POINTERS @@ -56,7 +34,7 @@ #define FIXED_POINT #endif -@@ -117,6 +123,9 @@ +@@ -117,6 +125,9 @@ # ifdef MAIN_DEC # undef MAIN_DEC # endif @@ -66,7 +44,7 @@ #endif // FIXED_POINT #ifdef DRM -@@ -151,6 +160,7 @@ +@@ -151,6 +162,7 @@ #include @@ -74,7 +52,7 @@ typedef unsigned __int64 uint64_t; typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; -@@ -159,5 +169,9 @@ +@@ -159,5 +171,9 @@ typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; @@ -84,7 +62,7 @@ + typedef float float32_t; -@@ -289,7 +319,7 @@ +@@ -289,7 +305,7 @@ } @@ -93,7 +71,7 @@ #define HAS_LRINTF static INLINE int lrintf(float f) { -@@ -301,7 +331,7 @@ +@@ -301,7 +317,7 @@ } return i; } @@ -102,17 +80,17 @@ #define HAS_LRINTF // from http://www.stereopsis.com/FPU.html static INLINE int lrintf(float f) -@@ -330,7 +360,7 @@ +@@ -330,6 +346,8 @@ #else +#include + -#ifdef HAVE_LRINTF --#if HAVE_LRINTF ++#if HAVE_LRINTF # define HAS_LRINTF # define _ISOC9X_SOURCE 1 -@@ -338,8 +370,6 @@ +@@ -338,8 +356,6 @@ # define __USE_ISOC99 1 #endif @@ -123,20 +101,6 @@ #error --- libfaad2.orig/output.c 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/output.c 2006-04-18 19:50:26.000000000 +0200 -@@ -19,10 +19,9 @@ - ** Any non-GPL usage of this software or parts of this software is strictly - ** forbidden. - ** --** Commercial non-GPL licensing of this software is possible. --** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. --** --** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $ -+** Initially modified for use with MPlayer by Rich Felker on 2005/03/29 -+** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - **/ - - #include "common.h" @@ -463,7 +462,7 @@ } } @@ -200,17 +164,6 @@ #endif --- libfaad2.orig/ps_dec.c 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/ps_dec.c 2006-04-18 20:29:38.000000000 +0200 -@@ -22,7 +22,10 @@ - ** Commercial non-GPL licensing of this software is possible. - ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. - ** -+** Initially modified for use with MPlayer on 2005/12/05 - ** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -+** local_changes.diff contains the exact changes to this file. - **/ - - #include "common.h" @@ -159,7 +162,7 @@ /* static function declarations */ @@ -242,17 +195,6 @@ ps_data_decode(ps); --- libfaad2.orig/sbr_dec.c 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/sbr_dec.c 2006-04-18 20:33:57.000000000 +0200 -@@ -22,7 +22,10 @@ - ** Commercial non-GPL licensing of this software is possible. - ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. - ** -+** Initially modified for use with MPlayer on 2005/12/05 - ** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -+** local_changes.diff contains the exact changes to this file. - **/ - - @@ -526,8 +529,8 @@ uint8_t l, k; uint8_t dont_process = 0; @@ -266,20 +208,6 @@ return 20; --- libfaad2.orig/specrec.c 2006-03-16 20:15:04.000000000 +0100 +++ libfaad2/specrec.c 2006-04-18 20:38:09.000000000 +0200 -@@ -19,10 +19,10 @@ - ** Any non-GPL usage of this software or parts of this software is strictly - ** forbidden. - ** --** Commercial non-GPL licensing of this software is possible. --** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. --** -+** Initially modified for use with MPlayer on 2006/04/18 - ** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $ -+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -+** local_changes.diff contains the exact changes to this file. - **/ - - /* @@ -673,29 +673,19 @@ /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) @@ -386,7 +314,7 @@ retval = allocate_single_channel(hDecoder, sce->channel, output_channels); if (retval > 0) return retval; -@@ -1026,11 +994,10 @@ +@@ -1026,11 +995,10 @@ { return 23; } @@ -399,7 +327,7 @@ { uint8_t ele = hDecoder->fr_ch_ele; uint8_t ch = sce->channel; -@@ -1040,6 +1007,7 @@ +@@ -1040,6 +1008,7 @@ memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); } #endif From e5751ced4f16fe75f835b70e37ecf48a2032506b Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 26 Jul 2009 19:53:00 +0000 Subject: [PATCH 26/38] Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29443 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/colorspaces.txt | 2 +- gui/bitmap.c | 2 +- gui/wm/ws.c | 2 +- liba52/bitstream.h | 2 +- liba52/liba52_changes.diff | 2 +- libaf/af_format.c | 4 ++-- libaf/af_format.h | 4 ++-- libaf/af_lavcac3enc.c | 2 +- libao2/ao_alsa.c | 4 ++-- libao2/ao_alsa5.c | 4 ++-- libao2/ao_coreaudio.c | 4 ++-- libao2/ao_dxr2.c | 2 +- libao2/ao_oss.c | 2 +- libao2/ao_pcm.c | 2 +- libfaad2/common.h | 2 +- libfaad2/local_changes.diff | 9 +++++++++ libmpcodecs/ad_hwac3.c | 4 ++-- libmpcodecs/img_format.h | 2 +- libmpcodecs/vd_ffmpeg.c | 2 +- libmpcodecs/vf.c | 2 +- libmpcodecs/vf_scale.c | 2 +- libmpdemux/asf.h | 6 +++--- libmpdemux/aviheader.h | 4 ++-- libmpdemux/demux_xmms.c | 2 +- libmpdemux/demuxer.h | 2 +- libmpdemux/ms_hdr.h | 2 +- libvo/osd_template.c | 2 +- libvo/vo_svga.c | 2 +- libvo/vo_tga.c | 2 +- libvo/vo_x11.c | 4 ++-- mp3lib/decod386.c | 4 ++-- stream/stream_cdda.c | 2 +- tremor/misc.h | 2 +- tremor/tremor.diff | 2 +- vidix/radeon_vid.c | 2 +- 35 files changed, 54 insertions(+), 45 deletions(-) diff --git a/DOCS/tech/colorspaces.txt b/DOCS/tech/colorspaces.txt index dc00fd388d..291a435f30 100644 --- a/DOCS/tech/colorspaces.txt +++ b/DOCS/tech/colorspaces.txt @@ -154,5 +154,5 @@ order followed by the number 32, the portable way to access it is to load the pixel into an integer and use bitmasks. When the above portable access methods are not used, you will need to write -2 versions of your code, and use #ifdef WORDS_BIGENDIAN to choose the correct +2 versions of your code, and use #if HAVE_BIGENDIAN to choose the correct one. diff --git a/gui/bitmap.c b/gui/bitmap.c index 6cf7d35d60..148998865a 100644 --- a/gui/bitmap.c +++ b/gui/bitmap.c @@ -108,7 +108,7 @@ static int conv24to32( txSample * bf ) static void Normalize( txSample * bf ) { int i; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; #else for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0; diff --git a/gui/wm/ws.c b/gui/wm/ws.c index 27749be53b..8133baab09 100644 --- a/gui/wm/ws.c +++ b/gui/wm/ws.c @@ -1082,7 +1082,7 @@ int wsGetDepthOnScreen( void ) wsRedMask=mXImage->red_mask; wsGreenMask=mXImage->green_mask; wsBlueMask=mXImage->blue_mask; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN wsNonNativeOrder = mXImage->byte_order == LSBFirst; #else wsNonNativeOrder = mXImage->byte_order == MSBFirst; diff --git a/liba52/bitstream.h b/liba52/bitstream.h index e894f16781..76f5556ea9 100644 --- a/liba52/bitstream.h +++ b/liba52/bitstream.h @@ -62,7 +62,7 @@ static inline uint32_t unaligned32(const void *v) { #endif /* (stolen from the kernel) */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN # define swab32(x) (x) diff --git a/liba52/liba52_changes.diff b/liba52/liba52_changes.diff index 1b3574f043..e44b84a84d 100644 --- a/liba52/liba52_changes.diff +++ b/liba52/liba52_changes.diff @@ -116,7 +116,7 @@ +#endif + /* (stolen from the kernel) */ - #ifdef WORDS_BIGENDIAN + #if HAVE_BIGENDIAN @@ -28,7 +68,7 @@ diff --git a/libaf/af_format.c b/libaf/af_format.c index faeae02efc..64acbbb9b6 100644 --- a/libaf/af_format.c +++ b/libaf/af_format.c @@ -332,7 +332,7 @@ af_info_t af_info_format = { }; static inline uint32_t load24bit(void* data, int pos) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN return (((uint32_t)((uint8_t*)data)[3*pos])<<24) | (((uint32_t)((uint8_t*)data)[3*pos+1])<<16) | (((uint32_t)((uint8_t*)data)[3*pos+2])<<8); @@ -344,7 +344,7 @@ static inline uint32_t load24bit(void* data, int pos) { } static inline void store24bit(void* data, int pos, uint32_t expanded_value) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN ((uint8_t*)data)[3*pos]=expanded_value>>24; ((uint8_t*)data)[3*pos+1]=expanded_value>>16; ((uint8_t*)data)[3*pos+2]=expanded_value>>8; diff --git a/libaf/af_format.h b/libaf/af_format.h index 553d18d962..66a74c901e 100644 --- a/libaf/af_format.h +++ b/libaf/af_format.h @@ -30,7 +30,7 @@ #define AF_FORMAT_LE (1<<0) // Little Endian #define AF_FORMAT_END_MASK (1<<0) -#ifdef WORDS_BIGENDIAN // Native endian of cpu +#if HAVE_BIGENDIAN // Native endian of cpu #define AF_FORMAT_NE AF_FORMAT_BE #else #define AF_FORMAT_NE AF_FORMAT_LE @@ -83,7 +83,7 @@ #define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE) #define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE) -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define AF_FORMAT_U16_NE AF_FORMAT_U16_BE #define AF_FORMAT_S16_NE AF_FORMAT_S16_BE #define AF_FORMAT_U24_NE AF_FORMAT_U24_BE diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c index 36a19dad60..f89302f4a6 100644 --- a/libaf/af_lavcac3enc.c +++ b/libaf/af_lavcac3enc.c @@ -238,7 +238,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) int16_t *out = (int16_t *)buf; int bsmod = dest[5] & 0x7; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN int i; char tmp; for (i = 0; i < len; i += 2) { diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 3bb10eddd0..cc80b0ded3 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -368,13 +368,13 @@ static int init(int rate_hz, int channels, int format, int flags) case AF_FORMAT_U16_BE: alsa_format = SND_PCM_FORMAT_U16_BE; break; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN case AF_FORMAT_AC3: #endif case AF_FORMAT_S16_LE: alsa_format = SND_PCM_FORMAT_S16_LE; break; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case AF_FORMAT_AC3: #endif case AF_FORMAT_S16_BE: diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index feb2919f1d..96c951a92a 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -101,13 +101,13 @@ static int init(int rate_hz, int channels, int format, int flags) case AF_FORMAT_U16_BE: alsa_format.format = SND_PCM_SFMT_U16_BE; break; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN case AF_FORMAT_AC3: #endif case AF_FORMAT_S16_LE: alsa_format.format = SND_PCM_SFMT_S16_LE; break; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case AF_FORMAT_AC3: #endif case AF_FORMAT_S16_BE: diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index 76cb9174be..ad17773fbd 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -345,7 +345,7 @@ int b_alive; } if ((format & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3) { // Currently ac3 input (comes from hwac3) is always in native byte-order. -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN inDesc.mFormatFlags |= kAudioFormatFlagIsBigEndian; #endif } @@ -669,7 +669,7 @@ static int OpenSPDIF(void) /* FIXME: If output stream is not native byte-order, we need change endian somewhere. */ /* Although there's no such case reported. */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN if (!(ao->stream_format.mFormatFlags & kAudioFormatFlagIsBigEndian)) #else if (ao->stream_format.mFormatFlags & kAudioFormatFlagIsBigEndian) diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c index 136efd1a9e..1a0a3e6135 100644 --- a/libao2/ao_dxr2.c +++ b/libao2/ao_dxr2.c @@ -207,7 +207,7 @@ static int play(void* data,int len,int flags){ int i; //unsigned short *s=data; uint16_t *s=data; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN for(i=0;ia_in_buffer[5] & 0x7) << 8; // bsmod buf16[3] = len << 3; // number of bits in payload -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN memcpy(buf + 8, sh_audio->a_in_buffer, len); #else swab(sh_audio->a_in_buffer, buf + 8, len); @@ -524,7 +524,7 @@ static int decode_audio_dts(unsigned char *indata_ptr, int len, unsigned char *b buf16[3] = fsize << 3; if (!convert_16bits) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN /* BE stream */ if (indata_ptr[0] == 0x1f || indata_ptr[0] == 0x7f) #else diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h index 3922fdc5f3..559501fb89 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h @@ -25,7 +25,7 @@ #define IMGFMT_BGR24 (IMGFMT_BGR|24) #define IMGFMT_BGR32 (IMGFMT_BGR|32) -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define IMGFMT_ABGR IMGFMT_RGB32 #define IMGFMT_BGRA (IMGFMT_RGB32|64) #define IMGFMT_ARGB IMGFMT_BGR32 diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 244e6495b3..68e7c3aa17 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -896,7 +896,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ mpi->stride[2]*=2; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN // FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE if (mpi->bpp == 8) swap_palette(mpi->planes[1]); diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 08d0b130c1..6192ffda20 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -233,7 +233,7 @@ void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){ unsigned int* p=(unsigned int*) dst; int size=(mpi->bpp>>3)*w/4; int i; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define CLEAR_PACKEDYUV_PATTERN 0x00800080 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000 #else diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 6c741cfad9..ccd0c1c96e 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -322,7 +322,7 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES], int y, int h, uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){ uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2]}; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN uint32_t pal2[256]; if (src[1] && !src[2]){ int i; diff --git a/libmpdemux/asf.h b/libmpdemux/asf.h index b8cd4374ff..a1e29a942f 100644 --- a/libmpdemux/asf.h +++ b/libmpdemux/asf.h @@ -19,7 +19,7 @@ #ifndef MPLAYER_ASF_H #define MPLAYER_ASF_H -//#include "config.h" /* for WORDS_BIGENDIAN */ +//#include "config.h" /* for HAVE_BIGENDIAN */ #include #include "libavutil/common.h" #include "mpbswap.h" @@ -105,7 +105,7 @@ typedef struct __attribute__((packed)) { } ASF_stream_chunck_t; // Definition of the stream type -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define ASF_STREAMING_CLEAR 0x2443 // $C #define ASF_STREAMING_DATA 0x2444 // $D #define ASF_STREAMING_END_TRANS 0x2445 // $E @@ -140,7 +140,7 @@ typedef struct { * Some macros to swap little endian structures read from an ASF file * into machine endian format */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define le2me_ASF_obj_header_t(h) { \ (h)->size = le2me_64((h)->size); \ } diff --git a/libmpdemux/aviheader.h b/libmpdemux/aviheader.h index 0dd915fc5d..a06ef711ac 100644 --- a/libmpdemux/aviheader.h +++ b/libmpdemux/aviheader.h @@ -21,7 +21,7 @@ #include #include -#include "config.h" /* get correct definition of WORDS_BIGENDIAN */ +#include "config.h" /* get correct definition of HAVE_BIGENDIAN */ #include "libavutil/common.h" #include "mpbswap.h" @@ -227,7 +227,7 @@ typedef enum { * Some macros to swap little endian structures read from an AVI file * into machine endian format */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define le2me_MainAVIHeader(h) { \ (h)->dwMicroSecPerFrame = le2me_32((h)->dwMicroSecPerFrame); \ (h)->dwMaxBytesPerSec = le2me_32((h)->dwMaxBytesPerSec); \ diff --git a/libmpdemux/demux_xmms.c b/libmpdemux/demux_xmms.c index 9263621a0b..8edbc2fe28 100644 --- a/libmpdemux/demux_xmms.c +++ b/libmpdemux/demux_xmms.c @@ -101,7 +101,7 @@ static int disk_open(AFormat fmt, int rate, int nch) { xmms_afmt=AF_FORMAT_U16_LE; break; case FMT_U16_NE: -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN xmms_afmt=AF_FORMAT_U16_BE; #else xmms_afmt=AF_FORMAT_U16_LE; diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 8035fd24e8..77b20e1bcf 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -384,7 +384,7 @@ stream_t* new_ds_stream(demux_stream_t *ds); static inline int avi_stream_id(unsigned int id){ unsigned char *p=(unsigned char *)&id; unsigned char a,b; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN a=p[3]-'0'; b=p[2]-'0'; #else a=p[0]-'0'; b=p[1]-'0'; diff --git a/libmpdemux/ms_hdr.h b/libmpdemux/ms_hdr.h index 87d0bf6e58..aaeffa6ef3 100644 --- a/libmpdemux/ms_hdr.h +++ b/libmpdemux/ms_hdr.h @@ -68,7 +68,7 @@ typedef struct { #endif #ifndef le2me_BITMAPINFOHEADER -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define le2me_BITMAPINFOHEADER(h) { \ (h)->biSize = le2me_32((h)->biSize); \ (h)->biWidth = le2me_32((h)->biWidth); \ diff --git a/libvo/osd_template.c b/libvo/osd_template.c index e59b4e5681..6d8305a3c5 100644 --- a/libvo/osd_template.c +++ b/libvo/osd_template.c @@ -320,7 +320,7 @@ static inline void RENAME(vo_draw_alpha_rgb24)(int w,int h, unsigned char* src, static inline void RENAME(vo_draw_alpha_rgb32)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ int y; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN dstbase++; #endif #if HAVE_MMX diff --git a/libvo/vo_svga.c b/libvo/vo_svga.c index 2dcaf6401f..606d02c7d3 100644 --- a/libvo/vo_svga.c +++ b/libvo/vo_svga.c @@ -660,7 +660,7 @@ static int query_format(uint32_t format) { if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0; // Reject different endian -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN if (IMGFMT_IS_BGR(format)) return 0; #else if (IMGFMT_IS_RGB(format)) return 0; diff --git a/libvo/vo_tga.c b/libvo/vo_tga.c index 0b338f994c..dad6b960a9 100644 --- a/libvo/vo_tga.c +++ b/libvo/vo_tga.c @@ -138,7 +138,7 @@ static int write_tga( char *file, int bpp, int dx, int dy, uint8_t *buf, int str s = buf; d = line_buff; for(x = 0; x < dx; x++) { - #ifdef WORDS_BIGENDIAN + #if HAVE_BIGENDIAN d[0] = s[3]; d[1] = s[2]; d[2] = s[1]; diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index 1d5b2b55a0..05762e5bbe 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -267,7 +267,7 @@ static void freeMyXImage(void) ImageData = NULL; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define BO_NATIVE MSBFirst #define BO_NONNATIVE LSBFirst #else @@ -457,7 +457,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, // we can easily "emulate" them. if (out_format & 64 && (IMGFMT_IS_RGB(out_format) || IMGFMT_IS_BGR(out_format))) { out_format &= ~64; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN out_offset = 1; #else out_offset = -1; diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c index 4b6d69bc4d..a2cfb56ce8 100644 --- a/mp3lib/decod386.c +++ b/mp3lib/decod386.c @@ -50,11 +50,11 @@ * On a SPARC cpu, we fetch the low-order 32-bit from the second 32-bit * word of the double fp value stored in memory. On an x86 cpu, we fetch it * from the first 32-bit word. - * I'm not sure if the WORDS_BIGENDIAN feature test covers all possible memory + * I'm not sure if the HAVE_BIGENDIAN feature test covers all possible memory * layouts of double floating point values an all cpu architectures. If * it doesn't work for you, just enable the "old WRITE_SAMPLE" macro. */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define MANTISSA_OFFSET 1 #else #define MANTISSA_OFFSET 0 diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index 2403e85cd4..12063e53d8 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -346,7 +346,7 @@ static int fill_buffer(stream_t* s, char* buffer, int max_len) { if (!buf) return 0; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN for(i=0;i #include "config.h" -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN union magic { struct { ogg_int32_t lo; diff --git a/tremor/tremor.diff b/tremor/tremor.diff index 09838bc250..61e31c751a 100644 --- a/tremor/tremor.diff +++ b/tremor/tremor.diff @@ -7,7 +7,7 @@ +#include "config.h" -#if BYTE_ORDER==LITTLE_ENDIAN -+#ifndef WORDS_BIGENDIAN ++#if !HAVE_BIGENDIAN union magic { struct { ogg_int32_t lo; diff --git a/vidix/radeon_vid.c b/vidix/radeon_vid.c index 7a9d9d086d..ee8aa23109 100644 --- a/vidix/radeon_vid.c +++ b/vidix/radeon_vid.c @@ -831,7 +831,7 @@ static void radeon_engine_restore( void ) (pitch64 << 22)); radeon_fifo_wait(1); -#if defined(WORDS_BIGENDIAN) +#if HAVE_BIGENDIAN OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); #else From a7c8120418d573ea7906d1bda7ab8c643f45f60b Mon Sep 17 00:00:00 2001 From: ramiro Date: Mon, 27 Jul 2009 06:20:17 +0000 Subject: [PATCH 27/38] Fix assembly comments for x86 fast_bilinear so they match the C code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29444 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 279cab034b..af69886261 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2330,32 +2330,32 @@ FUNNY_Y_CODE __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx - "xorl %%ecx, %%ecx \n\t" // 2*xalpha + "xorl %%ecx, %%ecx \n\t" // xalpha ASMALIGN(4) "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha + "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) + "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" - "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF - "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry + "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF + "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha + "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) + "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" - "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF - "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry + "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF + "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry "add $2, %%"REG_a" \n\t" @@ -2538,16 +2538,16 @@ FUNNY_UV_CODE __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx - "xorl %%ecx, %%ecx \n\t" // 2*xalpha + "xorl %%ecx, %%ecx \n\t" // xalpha ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha + "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) + "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" @@ -2555,15 +2555,15 @@ FUNNY_UV_CODE "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha + "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) + "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" - "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF - "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry + "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF + "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" From d7a50940f77167c05c8517ecc01be4750b9e887f Mon Sep 17 00:00:00 2001 From: ramiro Date: Mon, 27 Jul 2009 06:22:00 +0000 Subject: [PATCH 28/38] Factorize x86 fast_bilinear assembly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29445 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 36 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index af69886261..e14daa3f6e 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2199,6 +2199,14 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in #endif /* HAVE_MMX */ } +#define FAST_BILINEAR_X86 \ + "subl %%edi, %%esi \n\t" /* src[xx+1] - src[xx] */ \ + "imull %%ecx, %%esi \n\t" /* (src[xx+1] - src[xx])*xalpha */ \ + "shll $16, %%edi \n\t" \ + "addl %%edi, %%esi \n\t" /* src[xx+1]*xalpha + src[xx]*(1-xalpha) */ \ + "mov %1, %%"REG_D"\n\t" \ + "shrl $9, %%esi \n\t" \ + static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc) @@ -2335,24 +2343,14 @@ FUNNY_Y_CODE "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] - "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha - "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) - "mov %1, %%"REG_D" \n\t" - "shrl $9, %%esi \n\t" + FAST_BILINEAR_X86 "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] - "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha - "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) - "mov %1, %%"REG_D" \n\t" - "shrl $9, %%esi \n\t" + FAST_BILINEAR_X86 "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry @@ -2544,22 +2542,12 @@ FUNNY_UV_CODE "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1] - "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha - "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) - "mov %1, %%"REG_D" \n\t" - "shrl $9, %%esi \n\t" + FAST_BILINEAR_X86 "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1] - "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] - "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*xalpha - "shll $16, %%edi \n\t" - "addl %%edi, %%esi \n\t" //src[xx+1]*xalpha + src[xx]*(1-xalpha) - "mov %1, %%"REG_D" \n\t" - "shrl $9, %%esi \n\t" + FAST_BILINEAR_X86 "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF From 53d51201523e56a2b01cb956c161097b28aa60a5 Mon Sep 17 00:00:00 2001 From: ramiro Date: Mon, 27 Jul 2009 06:47:41 +0000 Subject: [PATCH 29/38] Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them instead. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29446 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 70 ++++++++++++-------------- libswscale/swscale_template.c | 94 +++++++++++++++++------------------ 2 files changed, 79 insertions(+), 85 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b1592dadf8..4d3b893b45 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1324,14 +1324,10 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin #endif #endif //ARCH_X86 -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_AMD3DNOW -#undef HAVE_ALTIVEC -#define HAVE_MMX 0 -#define HAVE_MMX2 0 -#define HAVE_AMD3DNOW 0 -#define HAVE_ALTIVEC 0 +#define COMPILE_TEMPLATE_MMX 0 +#define COMPILE_TEMPLATE_MMX2 0 +#define COMPILE_TEMPLATE_AMD3DNOW 0 +#define COMPILE_TEMPLATE_ALTIVEC 0 #ifdef COMPILE_C #define RENAME(a) a ## _C @@ -1340,8 +1336,8 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin #ifdef COMPILE_ALTIVEC #undef RENAME -#undef HAVE_ALTIVEC -#define HAVE_ALTIVEC 1 +#undef COMPILE_TEMPLATE_ALTIVEC +#define COMPILE_TEMPLATE_ALTIVEC 1 #define RENAME(a) a ## _altivec #include "swscale_template.c" #endif @@ -1351,12 +1347,12 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin //MMX versions #ifdef COMPILE_MMX #undef RENAME -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_AMD3DNOW -#define HAVE_MMX 1 -#define HAVE_MMX2 0 -#define HAVE_AMD3DNOW 0 +#undef COMPILE_TEMPLATE_MMX +#undef COMPILE_TEMPLATE_MMX2 +#undef COMPILE_TEMPLATE_AMD3DNOW +#define COMPILE_TEMPLATE_MMX 1 +#define COMPILE_TEMPLATE_MMX2 0 +#define COMPILE_TEMPLATE_AMD3DNOW 0 #define RENAME(a) a ## _MMX #include "swscale_template.c" #endif @@ -1364,12 +1360,12 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin //MMX2 versions #ifdef COMPILE_MMX2 #undef RENAME -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_AMD3DNOW -#define HAVE_MMX 1 -#define HAVE_MMX2 1 -#define HAVE_AMD3DNOW 0 +#undef COMPILE_TEMPLATE_MMX +#undef COMPILE_TEMPLATE_MMX2 +#undef COMPILE_TEMPLATE_AMD3DNOW +#define COMPILE_TEMPLATE_MMX 1 +#define COMPILE_TEMPLATE_MMX2 1 +#define COMPILE_TEMPLATE_AMD3DNOW 0 #define RENAME(a) a ## _MMX2 #include "swscale_template.c" #endif @@ -1377,20 +1373,18 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin //3DNOW versions #ifdef COMPILE_3DNOW #undef RENAME -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_AMD3DNOW -#define HAVE_MMX 1 -#define HAVE_MMX2 0 -#define HAVE_AMD3DNOW 1 +#undef COMPILE_TEMPLATE_MMX +#undef COMPILE_TEMPLATE_MMX2 +#undef COMPILE_TEMPLATE_AMD3DNOW +#define COMPILE_TEMPLATE_MMX 1 +#define COMPILE_TEMPLATE_MMX2 0 +#define COMPILE_TEMPLATE_AMD3DNOW 1 #define RENAME(a) a ## _3DNow #include "swscale_template.c" #endif #endif //ARCH_X86 -// minor note: the HAVE_xyz are messed up after this line so don't use them - static double getSplineCoeff(double a, double b, double c, double d, double dist) { // printf("%f %f %f %f %f\n", a,b,c,d,dist); @@ -2003,16 +1997,16 @@ static SwsFunc getSwsFunc(SwsContext *c) return swScale_C; #endif /* ARCH_X86 && CONFIG_GPL */ #else //CONFIG_RUNTIME_CPUDETECT -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 sws_init_swScale_MMX2(c); return swScale_MMX2; -#elif HAVE_AMD3DNOW +#elif COMPILE_TEMPLATE_AMD3DNOW sws_init_swScale_3DNow(c); return swScale_3DNow; -#elif HAVE_MMX +#elif COMPILE_TEMPLATE_MMX sws_init_swScale_MMX(c); return swScale_MMX; -#elif HAVE_ALTIVEC +#elif COMPILE_TEMPLATE_ALTIVEC sws_init_swScale_altivec(c); return swScale_altivec; #else @@ -2565,13 +2559,13 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d #if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; -#elif HAVE_AMD3DNOW +#elif COMPILE_TEMPLATE_AMD3DNOW flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; -#elif HAVE_MMX +#elif COMPILE_TEMPLATE_MMX flags |= SWS_CPU_CAPS_MMX; -#elif HAVE_ALTIVEC +#elif COMPILE_TEMPLATE_ALTIVEC flags |= SWS_CPU_CAPS_ALTIVEC; #elif ARCH_BFIN flags |= SWS_CPU_CAPS_BFIN; diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index e14daa3f6e..f700b6f2b4 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -27,10 +27,10 @@ #undef PREFETCH #undef PREFETCHW -#if HAVE_AMD3DNOW +#if COMPILE_TEMPLATE_AMD3DNOW #define PREFETCH "prefetch" #define PREFETCHW "prefetchw" -#elif HAVE_MMX2 +#elif COMPILE_TEMPLATE_MMX2 #define PREFETCH "prefetchnta" #define PREFETCHW "prefetcht0" #else @@ -38,20 +38,20 @@ #define PREFETCHW " # nop" #endif -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" -#elif HAVE_AMD3DNOW +#elif COMPILE_TEMPLATE_AMD3DNOW #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" #endif -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t" #else #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t" #endif #define MOVNTQ(a,b) REAL_MOVNTQ(a,b) -#if HAVE_ALTIVEC +#if COMPILE_TEMPLATE_ALTIVEC #include "ppc/swscale_altivec_template.c" #endif @@ -875,7 +875,7 @@ "cmp "#dstw", "#index" \n\t"\ " jb 1b \n\t" -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 #undef WRITEBGR24 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index) #else @@ -905,7 +905,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, con const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)){ if (c->flags & SWS_ACCURATE_RND){ if (uDest){ @@ -931,15 +931,15 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, con return; } #endif -#if HAVE_ALTIVEC +#if COMPILE_TEMPLATE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); -#else //HAVE_ALTIVEC +#else //COMPILE_TEMPLATE_ALTIVEC yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); -#endif //!HAVE_ALTIVEC +#endif //!COMPILE_TEMPLATE_ALTIVEC } static inline void RENAME(yuv2nv12X)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, @@ -955,7 +955,7 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW) { int i; -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)){ long p= 4; uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; @@ -1032,7 +1032,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, long dstW, long dstY) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX x86_reg dummy=0; if(!(c->flags & SWS_BITEXACT)){ if (c->flags & SWS_ACCURATE_RND){ @@ -1193,8 +1193,8 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, } } } -#endif /* HAVE_MMX */ -#if HAVE_ALTIVEC +#endif /* COMPILE_TEMPLATE_MMX */ +#if COMPILE_TEMPLATE_ALTIVEC /* The following list of supported dstFormat values should match what's found in the body of ff_yuv2packedX_altivec() */ if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf && @@ -1221,7 +1221,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, cons int uvalpha1=4095-uvalpha; int i; -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)){ switch(c->dstFormat) { @@ -1357,7 +1357,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, cons default: break; } } -#endif //HAVE_MMX +#endif //COMPILE_TEMPLATE_MMX YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C(void,0), YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C) } @@ -1379,7 +1379,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons return; } -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX if(!(flags & SWS_BITEXACT)){ if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster { @@ -1600,7 +1600,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons } } } -#endif /* HAVE_MMX */ +#endif /* COMPILE_TEMPLATE_MMX */ if (uvalpha < 2048) { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) @@ -1613,7 +1613,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons static inline void RENAME(yuy2ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm2 \n\t" "mov %0, %%"REG_a" \n\t" @@ -1638,7 +1638,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, const uint8_t *src, long width, static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" @@ -1673,7 +1673,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "mov %0, %%"REG_a" \n\t" "1: \n\t" @@ -1708,7 +1708,7 @@ static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */ static inline void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "mov %0, %%"REG_a" \n\t" "1: \n\t" @@ -1732,7 +1732,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src, long width, static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" @@ -1767,7 +1767,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" @@ -1799,7 +1799,7 @@ static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s #endif } -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, int srcFormat) { @@ -1914,7 +1914,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); #else int i; @@ -1926,12 +1926,12 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); } -#endif /* HAVE_MMX */ +#endif /* COMPILE_TEMPLATE_MMX */ } static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); #else int i; @@ -1944,7 +1944,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } -#endif /* HAVE_MMX */ +#endif /* COMPILE_TEMPLATE_MMX */ assert(src1 == src2); } @@ -1965,7 +1965,7 @@ static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const ui static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24); #else int i; @@ -1982,7 +1982,7 @@ static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else @@ -2020,7 +2020,7 @@ static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const ui static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc, const int16_t *filter, const int16_t *filterPos, long filterSize) { -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX assert(filterSize % 4 == 0 && filterSize>0); if (filterSize==4) // Always true for upscaling, sometimes for down, too. { @@ -2176,7 +2176,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in ); } #else -#if HAVE_ALTIVEC +#if COMPILE_TEMPLATE_ALTIVEC hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); #else int i; @@ -2195,8 +2195,8 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ... //dst[i] = val>>7; } -#endif /* HAVE_ALTIVEC */ -#endif /* HAVE_MMX */ +#endif /* COMPILE_ALTIVEC */ +#endif /* COMPILE_MMX */ } #define FAST_BILINEAR_X86 \ @@ -2251,7 +2251,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, src= formatConvBuffer; } -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else @@ -2263,7 +2263,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, else // fast bilinear upscale / crap downscale { #if ARCH_X86 && CONFIG_GPL -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 int i; #if defined(PIC) DECLARE_ALIGNED(8, uint64_t, ebxsave); @@ -2331,7 +2331,7 @@ FUNNY_Y_CODE } else { -#endif /* HAVE_MMX2 */ +#endif /* COMPILE_TEMPLATE_MMX2 */ x86_reg xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; //NO MMX just normal asm ... @@ -2364,7 +2364,7 @@ FUNNY_Y_CODE :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 } //if MMX2 can't be used #endif #else @@ -2436,7 +2436,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, src2= formatConvBuffer+VOFW; } -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else @@ -2449,7 +2449,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, else // fast bilinear upscale / crap downscale { #if ARCH_X86 && CONFIG_GPL -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 int i; #if defined(PIC) DECLARE_ALIGNED(8, uint64_t, ebxsave); @@ -2530,7 +2530,7 @@ FUNNY_UV_CODE } else { -#endif /* HAVE_MMX2 */ +#endif /* COMPILE_TEMPLATE_MMX2 */ x86_reg xInc_shr16 = (x86_reg) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; __asm__ volatile( @@ -2566,7 +2566,7 @@ FUNNY_UV_CODE "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); -#if HAVE_MMX2 +#if COMPILE_TEMPLATE_MMX2 } //if MMX2 can't be used #endif #else @@ -2807,7 +2807,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s break; //we can't output a dstY line so let's try with the next slice } -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX c->blueDither= ff_dither8[dstY&1]; if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555) c->greenDither= ff_dither8[dstY&1]; @@ -2820,7 +2820,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX int i; if (flags & SWS_ACCURATE_RND){ int s= APCK_SIZE / 8; @@ -2993,7 +2993,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf) fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255); -#if HAVE_MMX +#if COMPILE_TEMPLATE_MMX 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"); From 4dc235eb7cf07d124229e6d6f55ba5910353f986 Mon Sep 17 00:00:00 2001 From: uau Date: Mon, 27 Jul 2009 16:53:48 +0000 Subject: [PATCH 30/38] stream/realrtsp/real.c: Fix integer overflow Pointed-out-by: tixxDZ - DZCORE Labs, Algeria git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29447 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/realrtsp/real.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index 9f01a5dfb0..2e2b8cd9ca 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -386,6 +386,8 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char **buffer, int rdt_rawdata) { return (n <= 0) ? 0 : n; } rmff_dump_pheader(&ph, *buffer); + if (size < 12) + return 0; size-=12; n=rtsp_read_data(rtsp_session, (*buffer)+12, size); From 9cd56d5e40ae30ce886c3ee2838aa05b0110821f Mon Sep 17 00:00:00 2001 From: eugeni Date: Mon, 27 Jul 2009 19:39:23 +0000 Subject: [PATCH 31/38] Fix stupid, off-by-one, mistakes in assert() expressions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29448 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 4 ++-- libmpcodecs/vf_ass.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index e4c06f7885..3048a2a233 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -319,8 +319,8 @@ static ass_image_t* my_draw_bitmap(unsigned char* bitmap, int bitmap_w, int bitm assert(dst_x >= 0); assert(dst_y >= 0); - assert(dst_x + bitmap_w < frame_context.width); - assert(dst_y + bitmap_h < frame_context.height); + assert(dst_x + bitmap_w <= frame_context.width); + assert(dst_y + bitmap_h <= frame_context.height); img->w = bitmap_w; img->h = bitmap_h; diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index 2068383926..8d88e44f1b 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -221,7 +221,7 @@ static void copy_from_image(struct vf_instance_s* vf, int first_row, int last_ro assert(first_row >= 0); assert(first_row <= last_row); - assert(last_row < vf->priv->outh); + assert(last_row <= vf->priv->outh); for (pl = 1; pl < 3; ++pl) { int dst_stride = vf->priv->outw; From deb168fc3440cb7913c1e857cdb4c1063e333077 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 04:46:39 +0000 Subject: [PATCH 32/38] Remove useless code. flags can never be any other kind of scaling algorithm inside this if(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29449 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 4d3b893b45..6a85a52f35 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1450,9 +1450,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF { int i; int xDstInSrc; - if (flags&SWS_BICUBIC) filterSize= 4; - else if (flags&SWS_X ) filterSize= 4; - else filterSize= 2; // SWS_BILINEAR / SWS_AREA + filterSize= 2; filter= av_malloc(dstW*sizeof(*filter)*filterSize); xDstInSrc= xInc/2 - 0x8000; From ddbb0bc0db515d7559dc549ab42480aee054d270 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 05:13:36 +0000 Subject: [PATCH 33/38] Remove duplicate horizontal scaling when there aren't enough lines in a slice to output the dstY line. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29450 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 67 ++++++++--------------------------- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index f700b6f2b4..adc456fe24 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2700,8 +2700,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input - const int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input - const int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input + int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input + int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input + int enough_lines; //printf("dstY:%d dstH:%d firstLumSrcY:%d lastInLumBuf:%d vLumBufSize: %d vChrBufSize: %d slice: %d %d vLumFilterSize: %d firstChrSrcY: %d vChrFilterSize: %d c->chrSrcVSubSample: %d\n", // dstY, dstH, firstLumSrcY, lastInLumBuf, vLumBufSize, vChrBufSize, srcSliceY, srcSliceH, vLumFilterSize, firstChrSrcY, vChrFilterSize, c->chrSrcVSubSample); @@ -2713,8 +2714,17 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1); // Do we have enough lines in this slice to output the dstY line - if (lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample)) - { + enough_lines = lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample); + if (!enough_lines) { + lastLumSrcY = srcSliceY + srcSliceH - 1; + lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1; + } + + /* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n", + firstChrSrcY,firstLumSrcY,lastChrSrcY,lastLumSrcY, + lastInChrBuf,lastInLumBuf,chrBufIndex,lumBufIndex,dstY,vChrFilterSize,vLumFilterSize, + vChrBufSize, vLumBufSize);*/ + //Do horizontal scaling while(lastInLumBuf < lastLumSrcY) { @@ -2757,55 +2767,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s //wrap buf index around to stay inside the ring buffer if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; - } - else // not enough lines left in this slice -> load the rest in the buffer - { - /* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n", - firstChrSrcY,firstLumSrcY,lastChrSrcY,lastLumSrcY, - lastInChrBuf,lastInLumBuf,chrBufIndex,lumBufIndex,dstY,vChrFilterSize,vLumFilterSize, - vChrBufSize, vLumBufSize);*/ - - //Do horizontal scaling - while(lastInLumBuf+1 < srcSliceY + srcSliceH) - { - uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; - uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; - lumBufIndex++; - assert(lumBufIndex < 2*vLumBufSize); - assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); - assert(lastInLumBuf + 1 - srcSliceY >= 0); - RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, - flags, hLumFilter, hLumFilterPos, hLumFilterSize, - c->srcFormat, formatConvBuffer, - pal, 0); - if (CONFIG_SWSCALE_ALPHA && alpPixBuf) - RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, - flags, hLumFilter, hLumFilterPos, hLumFilterSize, - c->srcFormat, formatConvBuffer, - pal, 1); - lastInLumBuf++; - } - while(lastInChrBuf+1 < (chrSrcSliceY + chrSrcSliceH)) - { - uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; - uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; - chrBufIndex++; - assert(chrBufIndex < 2*vChrBufSize); - assert(lastInChrBuf + 1 - chrSrcSliceY < chrSrcSliceH); - assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); - - if (!(isGray(srcFormat) || isGray(dstFormat))) - RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, - flags, hChrFilter, hChrFilterPos, hChrFilterSize, - c->srcFormat, formatConvBuffer, - pal); - lastInChrBuf++; - } - //wrap buf index around to stay inside the ring buffer - if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; - if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; + if (!enough_lines) break; //we can't output a dstY line so let's try with the next slice - } #if COMPILE_TEMPLATE_MMX c->blueDither= ff_dither8[dstY&1]; From e0af29f2c3f93d424c0982d7f64101dd416d4ed8 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 05:14:47 +0000 Subject: [PATCH 34/38] Indent. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29451 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 88 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index adc456fe24..e7c68469a8 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2720,54 +2720,54 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1; } - /* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n", - firstChrSrcY,firstLumSrcY,lastChrSrcY,lastLumSrcY, - lastInChrBuf,lastInLumBuf,chrBufIndex,lumBufIndex,dstY,vChrFilterSize,vLumFilterSize, - vChrBufSize, vLumBufSize);*/ + /* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n", + firstChrSrcY,firstLumSrcY,lastChrSrcY,lastLumSrcY, + lastInChrBuf,lastInLumBuf,chrBufIndex,lumBufIndex,dstY,vChrFilterSize,vLumFilterSize, + vChrBufSize, vLumBufSize);*/ - //Do horizontal scaling - while(lastInLumBuf < lastLumSrcY) - { - uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; - uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; - lumBufIndex++; - //printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY); - assert(lumBufIndex < 2*vLumBufSize); - assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); - assert(lastInLumBuf + 1 - srcSliceY >= 0); - //printf("%d %d\n", lumBufIndex, vLumBufSize); - RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, + //Do horizontal scaling + while(lastInLumBuf < lastLumSrcY) + { + uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; + uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; + lumBufIndex++; + //printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY); + assert(lumBufIndex < 2*vLumBufSize); + assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); + assert(lastInLumBuf + 1 - srcSliceY >= 0); + //printf("%d %d\n", lumBufIndex, vLumBufSize); + RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, + flags, hLumFilter, hLumFilterPos, hLumFilterSize, + c->srcFormat, formatConvBuffer, + pal, 0); + if (CONFIG_SWSCALE_ALPHA && alpPixBuf) + RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, flags, hLumFilter, hLumFilterPos, hLumFilterSize, c->srcFormat, formatConvBuffer, - pal, 0); - if (CONFIG_SWSCALE_ALPHA && alpPixBuf) - RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, - flags, hLumFilter, hLumFilterPos, hLumFilterSize, - c->srcFormat, formatConvBuffer, - pal, 1); - lastInLumBuf++; - } - while(lastInChrBuf < lastChrSrcY) - { - uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; - uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; - chrBufIndex++; - assert(chrBufIndex < 2*vChrBufSize); - assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); - assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); - //FIXME replace parameters through context struct (some at least) + pal, 1); + lastInLumBuf++; + } + while(lastInChrBuf < lastChrSrcY) + { + uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; + uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; + chrBufIndex++; + assert(chrBufIndex < 2*vChrBufSize); + assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); + assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); + //FIXME replace parameters through context struct (some at least) - if (!(isGray(srcFormat) || isGray(dstFormat))) - RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, - flags, hChrFilter, hChrFilterPos, hChrFilterSize, - c->srcFormat, formatConvBuffer, - pal); - lastInChrBuf++; - } - //wrap buf index around to stay inside the ring buffer - if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; - if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; - if (!enough_lines) + if (!(isGray(srcFormat) || isGray(dstFormat))) + RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, + flags, hChrFilter, hChrFilterPos, hChrFilterSize, + c->srcFormat, formatConvBuffer, + pal); + lastInChrBuf++; + } + //wrap buf index around to stay inside the ring buffer + if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; + if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; + if (!enough_lines) break; //we can't output a dstY line so let's try with the next slice #if COMPILE_TEMPLATE_MMX From 7b6fecc8b3f143d8731f7b0cb5fdc3a9dc22b533 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 05:41:22 +0000 Subject: [PATCH 35/38] MMX2 scaler: add variable to ease factorization of initMMX2Scaler(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29452 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 6a85a52f35..ab8c6759c9 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1888,6 +1888,7 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil int b=((xpos+xInc)>>16) - xx; int c=((xpos+xInc*2)>>16) - xx; int d=((xpos+xInc*3)>>16) - xx; + int inc = (d+1<4); filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9; filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9; @@ -1897,17 +1898,17 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil if (d+1<4) { - int maxShift= 3-(d+1); + int maxShift= 3-(d+inc); int shift=0; memcpy(funnyCode + fragmentPos, fragmentB, fragmentLengthB); funnyCode[fragmentPos + imm8OfPShufW1B]= - (a+1) | ((b+1)<<2) | ((c+1)<<4) | ((d+1)<<6); + (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); funnyCode[fragmentPos + imm8OfPShufW2B]= a | (b<<2) | (c<<4) | (d<<6); - if (i+3>=dstW) shift=maxShift; //avoid overread + if (i+4-inc>=dstW) shift=maxShift; //avoid overread else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align if (shift && i>=shift) From 878623ad28e99fb3356d3e70834edc0172d4a6a5 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 05:42:46 +0000 Subject: [PATCH 36/38] MMX2 scaler: factorize initMMX2Scaler(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29453 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index ab8c6759c9..8cd61bd9e2 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1889,6 +1889,10 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil int c=((xpos+xInc*2)>>16) - xx; int d=((xpos+xInc*3)>>16) - xx; int inc = (d+1<4); + uint8_t *fragment = (d+1<4) ? fragmentB : fragmentA; + x86_reg imm8OfPShufW1 = (d+1<4) ? imm8OfPShufW1B : imm8OfPShufW1A; + x86_reg imm8OfPShufW2 = (d+1<4) ? imm8OfPShufW2B : imm8OfPShufW2A; + x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA; filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9; filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9; @@ -1896,16 +1900,15 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9; filterPos[i/2]= xx; - if (d+1<4) { int maxShift= 3-(d+inc); int shift=0; - memcpy(funnyCode + fragmentPos, fragmentB, fragmentLengthB); + memcpy(funnyCode + fragmentPos, fragment, fragmentLength); - funnyCode[fragmentPos + imm8OfPShufW1B]= + funnyCode[fragmentPos + imm8OfPShufW1]= (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); - funnyCode[fragmentPos + imm8OfPShufW2B]= + funnyCode[fragmentPos + imm8OfPShufW2]= a | (b<<2) | (c<<4) | (d<<6); if (i+4-inc>=dstW) shift=maxShift; //avoid overread @@ -1913,35 +1916,12 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil if (shift && i>=shift) { - funnyCode[fragmentPos + imm8OfPShufW1B]+= 0x55*shift; - funnyCode[fragmentPos + imm8OfPShufW2B]+= 0x55*shift; + funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift; + funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift; filterPos[i/2]-=shift; } - fragmentPos+= fragmentLengthB; - } - else - { - int maxShift= 3-d; - int shift=0; - - memcpy(funnyCode + fragmentPos, fragmentA, fragmentLengthA); - - funnyCode[fragmentPos + imm8OfPShufW1A]= - funnyCode[fragmentPos + imm8OfPShufW2A]= - a | (b<<2) | (c<<4) | (d<<6); - - if (i+4>=dstW) shift=maxShift; //avoid overread - else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //partial align - - if (shift && i>=shift) - { - funnyCode[fragmentPos + imm8OfPShufW1A]+= 0x55*shift; - funnyCode[fragmentPos + imm8OfPShufW2A]+= 0x55*shift; - filterPos[i/2]-=shift; - } - - fragmentPos+= fragmentLengthA; + fragmentPos+= fragmentLength; } funnyCode[fragmentPos]= RET; From 7c240e02684ac934bc9d00a98fba845d9dce1ba2 Mon Sep 17 00:00:00 2001 From: ramiro Date: Tue, 28 Jul 2009 05:45:47 +0000 Subject: [PATCH 37/38] MMX2 scaler: Remove {} block leftover from factorization in initMMX2Scaler(). Merge variable declarations to previous {} block and indent. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29454 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 8cd61bd9e2..59d4d841fe 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1893,6 +1893,8 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil x86_reg imm8OfPShufW1 = (d+1<4) ? imm8OfPShufW1B : imm8OfPShufW1A; x86_reg imm8OfPShufW2 = (d+1<4) ? imm8OfPShufW2B : imm8OfPShufW2A; x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA; + int maxShift= 3-(d+inc); + int shift=0; filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9; filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9; @@ -1900,30 +1902,25 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9; filterPos[i/2]= xx; + memcpy(funnyCode + fragmentPos, fragment, fragmentLength); + + funnyCode[fragmentPos + imm8OfPShufW1]= + (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); + funnyCode[fragmentPos + imm8OfPShufW2]= + a | (b<<2) | (c<<4) | (d<<6); + + if (i+4-inc>=dstW) shift=maxShift; //avoid overread + else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align + + if (shift && i>=shift) { - int maxShift= 3-(d+inc); - int shift=0; - - memcpy(funnyCode + fragmentPos, fragment, fragmentLength); - - funnyCode[fragmentPos + imm8OfPShufW1]= - (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6); - funnyCode[fragmentPos + imm8OfPShufW2]= - a | (b<<2) | (c<<4) | (d<<6); - - if (i+4-inc>=dstW) shift=maxShift; //avoid overread - else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align - - if (shift && i>=shift) - { - funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift; - funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift; - filterPos[i/2]-=shift; - } - - fragmentPos+= fragmentLength; + funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift; + funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift; + filterPos[i/2]-=shift; } + fragmentPos+= fragmentLength; + funnyCode[fragmentPos]= RET; } xpos+=xInc; From 45b7b9374bb2a772baa34a52d1abac11c939de15 Mon Sep 17 00:00:00 2001 From: uau Date: Tue, 28 Jul 2009 16:25:03 +0000 Subject: [PATCH 38/38] stream/realrtsp/real.c: Fix another integer overflow git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29455 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/realrtsp/real.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index 2e2b8cd9ca..5b9fabe7f7 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -382,6 +382,8 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char **buffer, int rdt_rawdata) { ph.flags=0; *buffer = xbuffer_ensure_size(*buffer, 12+size); if(rdt_rawdata) { + if (size < 12) + return 0; n=rtsp_read_data(rtsp_session, *buffer, size-12); return (n <= 0) ? 0 : n; }