From 53a3e8ee6978658247b8001b72d967cd5e97d816 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 10 Sep 2008 22:41:55 +0000 Subject: [PATCH 01/76] Make the 2point linear interpolation coefficients correct even for the nearly never occurring 0.0, 1.0. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27574 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 6048bfc90b..d11e130f1c 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1204,8 +1204,8 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ static inline void RENAME(yuv2packed2)(SwsContext *c, uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { - int yalpha1=yalpha^4095; - int uvalpha1=uvalpha^4095; + int yalpha1=4095- yalpha; + int uvalpha1=4095-uvalpha; int i; #if 0 //isn't used From d351b78abdfc155915fdabf86f56b6542b5044c0 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 10 Sep 2008 23:23:47 +0000 Subject: [PATCH 02/76] Correct normalization constant for the vertical filter. I am not completely sure why this was at such an incorrect value, but I could not find any problems when it was set correctly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27575 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 52d235960b..b55d4d21bb 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2434,11 +2434,11 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH 1; initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, - srcH , dstH, filterAlign, (1<<12)-4, + srcH , dstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, srcFilter->lumV, dstFilter->lumV, c->param); initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, - c->chrSrcH, c->chrDstH, filterAlign, (1<<12)-4, + c->chrSrcH, c->chrDstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, srcFilter->chrV, dstFilter->chrV, c->param); From fd6cd1c95cb22124e0c812e9af44a62525891693 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 00:09:01 +0000 Subject: [PATCH 03/76] Fix chroma yuv->rgb tables for jpeg style yuv, this was missed as it only affects the C code while mmx uses different tables. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27576 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 5aa42c046c..e4937a2145 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -880,10 +880,10 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, } for (i = 0; i < 256; i++) { - c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), 76309); - c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), 76309); - c->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309); - c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), 76309); + c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), cy); + c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), cy); + c->table_gV[i] = entry_size * div_round (cgv * (i-128), cy); + c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), cy); } av_free(c->yuvTable); From 4abaf837d95ec7c4b4667424f427994d5879cb08 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 01:49:35 +0000 Subject: [PATCH 04/76] Set rgb2yuv constants more accurately, makes no real difference though. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27577 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b55d4d21bb..646885d5bd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -153,15 +153,15 @@ unsigned swscale_version(void) ) #define RGB2YUV_SHIFT 15 -#define BY ((int)( 0.098*(1< Date: Thu, 11 Sep 2008 02:36:51 +0000 Subject: [PATCH 05/76] Factorize yuv2packedXinC(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27578 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 280 +++++++--------------------------- libswscale/swscale_template.c | 6 +- 2 files changed, 58 insertions(+), 228 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 646885d5bd..e2b997ca19 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -470,14 +470,14 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil else if (V<0) V=0; \ } -#define YSCALE_YUV_2_GRAY16_C(type) \ +#define YSCALE_YUV_2_GRAY16_C \ for (i=0; i<(dstW>>1); i++){\ int j;\ int Y1 = 1<<18;\ int Y2 = 1<<18;\ int U = 1<<18;\ int V = 1<<18;\ - type av_unused *r, *b, *g;\ + \ const int i2= 2*i;\ \ for (j=0; jtable_gU[U] + c->table_gV[V]);\ b = (type *)c->table_bU[U];\ -#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16)\ +#define YSCALE_YUV_2_MONOBLACK2_C \ + const uint8_t * const d128=dither_8x8_220[y&7];\ + uint8_t *g= c->table_gU[128] + c->table_gV[128];\ + for (i=0; i>19) + d128[0]];\ + acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\ + acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\ + acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\ + acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\ + acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\ + acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\ + acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\ + ((uint8_t*)dest)[0]= acc;\ + dest++;\ + }\ + + +#define YSCALE_YUV_2_MONOBLACKX_C \ + const uint8_t * const d128=dither_8x8_220[y&7];\ + uint8_t *g= c->table_gU[128] + c->table_gV[128];\ + int acc=0;\ + for (i=0; i>=19;\ + Y2>>=19;\ + if ((Y1|Y2)&256)\ + {\ + if (Y1>255) Y1=255;\ + else if (Y1<0)Y1=0;\ + if (Y2>255) Y2=255;\ + else if (Y2<0)Y2=0;\ + }\ + acc+= acc + g[Y1+d128[(i+0)&7]];\ + acc+= acc + g[Y2+d128[(i+1)&7]];\ + if ((i&7)==6){\ + ((uint8_t*)dest)[0]= acc;\ + dest++;\ + }\ + } + + +#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)\ switch(c->dstFormat)\ {\ case PIX_FMT_RGB32:\ @@ -657,66 +707,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil break;\ case PIX_FMT_MONOBLACK:\ {\ - const uint8_t * const d128=dither_8x8_220[y&7];\ - uint8_t *g= c->table_gU[128] + c->table_gV[128];\ - for (i=0; i>19) + d128[0]];\ - acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\ - acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\ - acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\ - acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\ - acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\ - acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\ - acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\ - ((uint8_t*)dest)[0]= acc;\ - dest++;\ - }\ -\ -/*\ -((uint8_t*)dest)-= dstW>>4;\ -{\ - int acc=0;\ - int left=0;\ - static int top[1024];\ - static int last_new[1024][1024];\ - static int last_in3[1024][1024];\ - static int drift[1024][1024];\ - int topLeft=0;\ - int shift=0;\ - int count=0;\ - const uint8_t * const d128=dither_8x8_220[y&7];\ - int error_new=0;\ - int error_in3=0;\ - int f=0;\ - \ - for (i=dstW>>1; i>19);\ - int in2 = (76309 * (in - 16) + 32768) >> 16;\ - int in3 = (in2 < 0) ? 0 : ((in2 > 255) ? 255 : in2);\ - int old= (left*7 + topLeft + top[i]*5 + top[i+1]*3)/20 + in3\ - + (last_new[y][i] - in3)*f/256;\ - int new= old> 128 ? 255 : 0;\ -\ - error_new+= FFABS(last_new[y][i] - new);\ - error_in3+= FFABS(last_in3[y][i] - in3);\ - f= error_new - error_in3*4;\ - if (f<0) f=0;\ - if (f>256) f=256;\ -\ - topLeft= top[i];\ - left= top[i]= old - new;\ - last_new[y][i]= new;\ - last_in3[y][i]= in3;\ -\ - acc+= acc + (new&1);\ - if ((i&7)==6){\ - ((uint8_t*)dest)[0]= acc;\ - ((uint8_t*)dest)++;\ - }\ - }\ -}\ -*/\ + func_monoblack\ }\ break;\ case PIX_FMT_YUYV422:\ @@ -759,168 +750,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l uint8_t *dest, int dstW, int y) { int i; - switch(c->dstFormat) - { - case PIX_FMT_BGR32: - case PIX_FMT_RGB32: - case PIX_FMT_BGR32_1: - case PIX_FMT_RGB32_1: - YSCALE_YUV_2_RGBX_C(uint32_t) - ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1]; - ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2]; - } - break; - case PIX_FMT_RGB24: - YSCALE_YUV_2_RGBX_C(uint8_t) - ((uint8_t*)dest)[0]= r[Y1]; - ((uint8_t*)dest)[1]= g[Y1]; - ((uint8_t*)dest)[2]= b[Y1]; - ((uint8_t*)dest)[3]= r[Y2]; - ((uint8_t*)dest)[4]= g[Y2]; - ((uint8_t*)dest)[5]= b[Y2]; - dest+=6; - } - break; - case PIX_FMT_BGR24: - YSCALE_YUV_2_RGBX_C(uint8_t) - ((uint8_t*)dest)[0]= b[Y1]; - ((uint8_t*)dest)[1]= g[Y1]; - ((uint8_t*)dest)[2]= r[Y1]; - ((uint8_t*)dest)[3]= b[Y2]; - ((uint8_t*)dest)[4]= g[Y2]; - ((uint8_t*)dest)[5]= r[Y2]; - dest+=6; - } - break; - case PIX_FMT_RGB565: - case PIX_FMT_BGR565: - { - const int dr1= dither_2x2_8[y&1 ][0]; - const int dg1= dither_2x2_4[y&1 ][0]; - const int db1= dither_2x2_8[(y&1)^1][0]; - const int dr2= dither_2x2_8[y&1 ][1]; - const int dg2= dither_2x2_4[y&1 ][1]; - const int db2= dither_2x2_8[(y&1)^1][1]; - YSCALE_YUV_2_RGBX_C(uint16_t) - ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1]; - ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2]; - } - } - break; - case PIX_FMT_RGB555: - case PIX_FMT_BGR555: - { - const int dr1= dither_2x2_8[y&1 ][0]; - const int dg1= dither_2x2_8[y&1 ][1]; - const int db1= dither_2x2_8[(y&1)^1][0]; - const int dr2= dither_2x2_8[y&1 ][1]; - const int dg2= dither_2x2_8[y&1 ][0]; - const int db2= dither_2x2_8[(y&1)^1][1]; - YSCALE_YUV_2_RGBX_C(uint16_t) - ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1]; - ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2]; - } - } - break; - case PIX_FMT_RGB8: - case PIX_FMT_BGR8: - { - const uint8_t * const d64= dither_8x8_73[y&7]; - const uint8_t * const d32= dither_8x8_32[y&7]; - YSCALE_YUV_2_RGBX_C(uint8_t) - ((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]]; - ((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]]; - } - } - break; - case PIX_FMT_RGB4: - case PIX_FMT_BGR4: - { - const uint8_t * const d64= dither_8x8_73 [y&7]; - const uint8_t * const d128=dither_8x8_220[y&7]; - YSCALE_YUV_2_RGBX_C(uint8_t) - ((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]] - +((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4); - } - } - break; - case PIX_FMT_RGB4_BYTE: - case PIX_FMT_BGR4_BYTE: - { - const uint8_t * const d64= dither_8x8_73 [y&7]; - const uint8_t * const d128=dither_8x8_220[y&7]; - YSCALE_YUV_2_RGBX_C(uint8_t) - ((uint8_t*)dest)[i2+0]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]; - ((uint8_t*)dest)[i2+1]= r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]]; - } - } - break; - case PIX_FMT_MONOBLACK: - { - const uint8_t * const d128=dither_8x8_220[y&7]; - uint8_t *g= c->table_gU[128] + c->table_gV[128]; - int acc=0; - for (i=0; i>=19; - Y2>>=19; - if ((Y1|Y2)&256) - { - if (Y1>255) Y1=255; - else if (Y1<0)Y1=0; - if (Y2>255) Y2=255; - else if (Y2<0)Y2=0; - } - acc+= acc + g[Y1+d128[(i+0)&7]]; - acc+= acc + g[Y2+d128[(i+1)&7]]; - if ((i&7)==6){ - ((uint8_t*)dest)[0]= acc; - dest++; - } - } - } - break; - case PIX_FMT_YUYV422: - YSCALE_YUV_2_PACKEDX_C(void) - ((uint8_t*)dest)[2*i2+0]= Y1; - ((uint8_t*)dest)[2*i2+1]= U; - ((uint8_t*)dest)[2*i2+2]= Y2; - ((uint8_t*)dest)[2*i2+3]= V; - } - break; - case PIX_FMT_UYVY422: - YSCALE_YUV_2_PACKEDX_C(void) - ((uint8_t*)dest)[2*i2+0]= U; - ((uint8_t*)dest)[2*i2+1]= Y1; - ((uint8_t*)dest)[2*i2+2]= V; - ((uint8_t*)dest)[2*i2+3]= Y2; - } - break; - case PIX_FMT_GRAY16BE: - YSCALE_YUV_2_GRAY16_C(void) - ((uint8_t*)dest)[2*i2+0]= Y1>>8; - ((uint8_t*)dest)[2*i2+1]= Y1; - ((uint8_t*)dest)[2*i2+2]= Y2>>8; - ((uint8_t*)dest)[2*i2+3]= Y2; - } - break; - case PIX_FMT_GRAY16LE: - YSCALE_YUV_2_GRAY16_C(void) - ((uint8_t*)dest)[2*i2+0]= Y1; - ((uint8_t*)dest)[2*i2+1]= Y1>>8; - ((uint8_t*)dest)[2*i2+2]= Y2; - ((uint8_t*)dest)[2*i2+3]= Y2>>8; - } - break; - } + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOBLACKX_C) } diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index d11e130f1c..b76dbdd51f 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1511,7 +1511,7 @@ FULL_YSCALEYUV2RGB default: break; } #endif //HAVE_MMX -YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C) +YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONOBLACK2_C) } /** @@ -1714,9 +1714,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * #endif /* HAVE_MMX */ if (uvalpha < 2048) { - YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C) + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) }else{ - YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C) + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) } } From 3ea1657e650653c323230af1c862f3dce09d9118 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 03:22:39 +0000 Subject: [PATCH 06/76] Do not do unneeded clipping in YSCALE_YUV_2_PACKEDX_C. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27579 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index e2b997ca19..a1b0497f14 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -434,7 +434,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil } } -#define YSCALE_YUV_2_PACKEDX_C(type) \ +#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type) \ for (i=0; i<(dstW>>1); i++){\ int j;\ int Y1 = 1<<18;\ @@ -458,6 +458,9 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil Y2>>=19;\ U >>=19;\ V >>=19;\ + +#define YSCALE_YUV_2_PACKEDX_C(type) \ + YSCALE_YUV_2_PACKEDX_NOCLIP_C(type)\ if ((Y1|Y2|U|V)&256)\ {\ if (Y1>255) Y1=255; \ @@ -496,7 +499,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil } #define YSCALE_YUV_2_RGBX_C(type) \ - YSCALE_YUV_2_PACKEDX_C(type) \ + YSCALE_YUV_2_PACKEDX_NOCLIP_C(type) \ r = (type *)c->table_rV[V]; \ g = (type *)(c->table_gU[U] + c->table_gV[V]); \ b = (type *)c->table_bU[U]; \ From 6009a04a231b1c6d80605a407730c27b27f2f1ee Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:39:12 +0000 Subject: [PATCH 07/76] Implement full horizontal chroma for rgb/bgr24/32 output. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27580 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 88 ++++++++++++++++++++++++++++++++++- libswscale/swscale_template.c | 28 +++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index a1b0497f14..1f2bb62bb8 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -473,6 +473,43 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil else if (V<0) V=0; \ } +#define YSCALE_YUV_2_PACKEDX_FULL_C \ + for (i=0; i>=10;\ + U >>=10;\ + V >>=10;\ + +#define YSCALE_YUV_2_RGBX_FULL_C(rnd) \ + YSCALE_YUV_2_PACKEDX_FULL_C\ + Y-= c->oy;\ + Y*= c->cy;\ + Y+= rnd;\ + R= Y + V*c->cvr;\ + G= Y + V*c->cvg + U*c->cug;\ + B= Y + U*c->cub;\ + if ((R|G|B)&(0xC0000000)){\ + if (R>=(256<<22)) R=(256<<22)-1; \ + else if (R<0)R=0; \ + if (G>=(256<<22)) G=(256<<22)-1; \ + else if (G<0)G=0; \ + if (B>=(256<<22)) B=(256<<22)-1; \ + else if (B<0)B=0; \ + }\ + + #define YSCALE_YUV_2_GRAY16_C \ for (i=0; i<(dstW>>1); i++){\ int j;\ @@ -756,6 +793,42 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOBLACKX_C) } +static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, + int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, + uint8_t *dest, int dstW, int y) +{ + int i; + int step= fmt_depth(c->dstFormat)/8; + + switch(c->dstFormat){ + case PIX_FMT_ARGB: + dest++; + case PIX_FMT_RGB24: + case PIX_FMT_RGBA: + YSCALE_YUV_2_RGBX_FULL_C(1<<21) + dest[0]= R>>22; + dest[1]= G>>22; + dest[2]= B>>22; + dest[3]= 0; + dest+= step; + } + break; + case PIX_FMT_ABGR: + dest++; + case PIX_FMT_BGR24: + case PIX_FMT_BGRA: + YSCALE_YUV_2_RGBX_FULL_C(1<<21) + dest[0]= B>>22; + dest[1]= G>>22; + dest[2]= R>>22; + dest[3]= 0; + dest+= step; + } + break; + default: + assert(0); + } +} //Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one //Plain C versions @@ -1880,6 +1953,13 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; + c->cy = (int16_t)roundToInt16(cy <<13); + c->oy = (int16_t)roundToInt16(oy <<9); + c->cvr= (int16_t)roundToInt16(crv<<13); + c->cvg= (int16_t)roundToInt16(cgv<<13); + c->cug= (int16_t)roundToInt16(cgu<<13); + c->cub= (int16_t)roundToInt16(cbu<<13); + yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); //FIXME factorize @@ -1993,7 +2073,13 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be choosen\n"); return NULL; } - +if( dstFormat != PIX_FMT_RGB32 //HACK + && dstFormat != PIX_FMT_RGB32_1 + && dstFormat != PIX_FMT_RGB24 + && dstFormat != PIX_FMT_BGR24 + && dstFormat != PIX_FMT_BGR32 + && dstFormat != PIX_FMT_BGR32_1) + flags &= ~SWS_FULL_CHR_H_INT; /* sanity check */ if (srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index b76dbdd51f..a52dfd55d9 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -3132,8 +3132,15 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s if (vLumFilterSize == 1 && vChrFilterSize == 2) //unscaled RGB { int chrAlpha= vChrFilter[2*dstY+1]; + if(flags & SWS_FULL_CHR_H_INT){ + yuv2rgbXinC_full(c, //FIXME write a packed1_full function + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); + }else{ RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), dest, dstW, chrAlpha, dstFormat, flags, dstY); + } } else if (vLumFilterSize == 2 && vChrFilterSize == 2) //bilinear upscale RGB { @@ -3143,15 +3150,29 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001; chrMmxFilter[2]= chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; + if(flags & SWS_FULL_CHR_H_INT){ + yuv2rgbXinC_full(c, //FIXME write a packed2_full function + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); + }else{ RENAME(yuv2packed2)(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), dest, dstW, lumAlpha, chrAlpha, dstY); + } } else //general RGB { + if(flags & SWS_FULL_CHR_H_INT){ + yuv2rgbXinC_full(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); + }else{ RENAME(yuv2packedX)(c, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); + } } } } @@ -3180,10 +3201,17 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s { assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); + if(flags & SWS_FULL_CHR_H_INT){ + yuv2rgbXinC_full(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); + }else{ yuv2packedXinC(c, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); + } } } } From 42643629cd217dea92468b37e1447201134755c4 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:40:29 +0000 Subject: [PATCH 08/76] Remove mistakely commited code i used for testing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27581 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 1f2bb62bb8..83373fcffe 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2073,13 +2073,6 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be choosen\n"); return NULL; } -if( dstFormat != PIX_FMT_RGB32 //HACK - && dstFormat != PIX_FMT_RGB32_1 - && dstFormat != PIX_FMT_RGB24 - && dstFormat != PIX_FMT_BGR24 - && dstFormat != PIX_FMT_BGR32 - && dstFormat != PIX_FMT_BGR32_1) - flags &= ~SWS_FULL_CHR_H_INT; /* sanity check */ if (srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code From 6d7e7200096d9444050e8cb525675f9342dceb24 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:47:18 +0000 Subject: [PATCH 09/76] Fix typo that lead to averaging of the same pixel in rgb24ToUV_half(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27582 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index a52dfd55d9..c7f278bb89 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2109,9 +2109,9 @@ static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, uint8_t assert(src1==src2); for (i=0; i>(RGB2YUV_SHIFT+1); dstV[i]= (RV*r + GV*g + BV*b + (257<>(RGB2YUV_SHIFT+1); From fa93e449fc1cfdc29c3e6a926db8192d3bf88f5a Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 22:02:15 +0000 Subject: [PATCH 10/76] 100000000000000l, forgot to commit header change for r27580. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27583 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index f4011d3de3..a401175a26 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -126,6 +126,7 @@ typedef struct SwsContext{ int srcColorspaceTable[4]; int dstColorspaceTable[4]; int srcRange, dstRange; + int oy,cy,cvr,cvg,cug,cub; #define RED_DITHER "0*8" #define GREEN_DITHER "1*8" From cc3ec5b4f215a988c2d18080e55e157cb49e2dc0 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 02:05:37 +0000 Subject: [PATCH 11/76] Do not use the unscaled yuv->rgb converters if SWS_ACCURATE_RND is set, because they do not accurately round. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27584 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 83373fcffe..9dcb6f93e4 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2160,7 +2160,8 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH } #ifdef CONFIG_GPL /* yuv2bgr */ - if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat))) + if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)) + && !(flags & SWS_ACCURATE_RND)) { c->swScale= yuv2rgb_get_func_ptr(c); } From 229dec600dbcb4abb7022fe112ef87a28acdd08d Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 04:40:51 +0000 Subject: [PATCH 12/76] rgb24toyv12 is not accurately rounding, so disable it as well when the user asks for accurate rounding. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27585 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 9dcb6f93e4..ff4738a1c6 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2173,7 +2173,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH } /* bgr24toYV12 */ - if (srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P) + if (srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_ACCURATE_RND)) c->swScale= bgr24toyv12Wrapper; /* rgb/bgr -> rgb/bgr (no dither needed forms) */ From fc855e63d2621f31818fbc72eb278094279570b4 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 16:01:17 +0000 Subject: [PATCH 13/76] Add support for PIX_FMT_MONOWHITE as output format. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27586 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 12 +++++++----- libswscale/swscale_internal.h | 3 +++ libswscale/swscale_template.c | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index ff4738a1c6..2f9d306757 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -598,7 +598,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil g = (type *)(c->table_gU[U] + c->table_gV[V]);\ b = (type *)c->table_bU[U];\ -#define YSCALE_YUV_2_MONOBLACK2_C \ +#define YSCALE_YUV_2_MONO2_C \ const uint8_t * const d128=dither_8x8_220[y&7];\ uint8_t *g= c->table_gU[128] + c->table_gV[128];\ for (i=0; i>19) + d128[5]];\ acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\ acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\ - ((uint8_t*)dest)[0]= acc;\ + ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\ dest++;\ }\ -#define YSCALE_YUV_2_MONOBLACKX_C \ +#define YSCALE_YUV_2_MONOX_C \ const uint8_t * const d128=dither_8x8_220[y&7];\ uint8_t *g= c->table_gU[128] + c->table_gV[128];\ int acc=0;\ @@ -642,7 +642,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil acc+= acc + g[Y1+d128[(i+0)&7]];\ acc+= acc + g[Y2+d128[(i+1)&7]];\ if ((i&7)==6){\ - ((uint8_t*)dest)[0]= acc;\ + ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\ dest++;\ }\ } @@ -746,6 +746,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil }\ break;\ case PIX_FMT_MONOBLACK:\ + case PIX_FMT_MONOWHITE:\ {\ func_monoblack\ }\ @@ -790,7 +791,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l uint8_t *dest, int dstW, int y) { int i; - YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOBLACKX_C) + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C) } static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, @@ -2186,6 +2187,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK + && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_RGB32_1 && dstFormat != PIX_FMT_BGR32_1 && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)))) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index a401175a26..9d82662483 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -249,6 +249,7 @@ const char *sws_format_name(int format); || (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4_BYTE \ || (x)==PIX_FMT_MONOBLACK \ + || (x)==PIX_FMT_MONOWHITE \ ) #define isBGR(x) ( \ (x)==PIX_FMT_BGR32 \ @@ -260,6 +261,7 @@ const char *sws_format_name(int format); || (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4_BYTE \ || (x)==PIX_FMT_MONOBLACK \ + || (x)==PIX_FMT_MONOWHITE \ ) static inline int fmt_depth(int fmt) @@ -290,6 +292,7 @@ static inline int fmt_depth(int fmt) case PIX_FMT_RGB4_BYTE: return 4; case PIX_FMT_MONOBLACK: + case PIX_FMT_MONOWHITE: return 1; default: return 0; diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index c7f278bb89..9b3a4dccfa 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1511,7 +1511,7 @@ FULL_YSCALEYUV2RGB default: break; } #endif //HAVE_MMX -YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONOBLACK2_C) +YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C) } /** @@ -1714,9 +1714,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * #endif /* HAVE_MMX */ if (uvalpha < 2048) { - YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) }else{ - YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) + YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } } From 296ccc70eafbee2821a391fa281927403f707c94 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 16:46:38 +0000 Subject: [PATCH 14/76] Support mono as input format. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27587 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 ++ libswscale/swscale_template.c | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 2f9d306757..c938306cad 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -127,6 +127,8 @@ unsigned swscale_version(void) || (x)==PIX_FMT_BGR4_BYTE \ || (x)==PIX_FMT_RGB4_BYTE \ || (x)==PIX_FMT_YUV440P \ + || (x)==PIX_FMT_MONOWHITE \ + || (x)==PIX_FMT_MONOBLACK \ ) #define isSupportedOut(x) ( \ (x)==PIX_FMT_YUV420P \ diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 9b3a4dccfa..3ff9c2bbe2 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2143,6 +2143,16 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, } } +static inline void RENAME(mono2Y)(uint8_t *dst, uint8_t *src, long width, int format) +{ + int i, j; + for (i=0; i=0; j--) + dst[i]= ((d>>j)&1)*255; + } +} + // bilinear / bicubic scaling static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, int16_t *filter, int16_t *filterPos, long filterSize) @@ -2398,6 +2408,11 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); src= formatConvBuffer; } + else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE) + { + RENAME(mono2Y)(formatConvBuffer, src, srcW, srcFormat); + src= formatConvBuffer; + } #ifdef HAVE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). @@ -2660,7 +2675,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } - else if (isGray(srcFormat)) + else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } From d28a3ad668d982b0bb09fd6bf12c59b923f856e2 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 17:28:36 +0000 Subject: [PATCH 15/76] 10000l PIX_FMT_MONOWHITE check was really a || 1. Thats what happens when one does not do the full set of tests before each commit and just quickly goes over the diff thinking, "hey it is a trivial change". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27588 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 3ff9c2bbe2..1dec7b8751 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2675,7 +2675,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } - else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) + else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE) { return; } From 02da3e1bf989b494bbf92903a1655e585658fb0b Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 17:51:13 +0000 Subject: [PATCH 16/76] Add support for PIX_FMT_YUV440P. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27589 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c938306cad..b0ce120cfd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -116,6 +116,7 @@ unsigned swscale_version(void) || (x)==PIX_FMT_RGB555 \ || (x)==PIX_FMT_GRAY8 \ || (x)==PIX_FMT_YUV410P \ + || (x)==PIX_FMT_YUV440P \ || (x)==PIX_FMT_GRAY16BE \ || (x)==PIX_FMT_GRAY16LE \ || (x)==PIX_FMT_YUV444P \ @@ -145,6 +146,7 @@ unsigned swscale_version(void) || (x)==PIX_FMT_GRAY16LE \ || (x)==PIX_FMT_GRAY8 \ || (x)==PIX_FMT_YUV410P \ + || (x)==PIX_FMT_YUV440P \ ) #define isPacked(x) ( \ (x)==PIX_FMT_PAL8 \ From df44f03e48729ed1e72485af4a0893b2ec65f005 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 18:05:57 +0000 Subject: [PATCH 17/76] Fix another 1000l bug in the mono input code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27590 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 1dec7b8751..bccead88df 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2148,8 +2148,8 @@ static inline void RENAME(mono2Y)(uint8_t *dst, uint8_t *src, long width, int fo int i, j; for (i=0; i=0; j--) - dst[i]= ((d>>j)&1)*255; + for(j=0; j<8; j++) + dst[8*i+j]= ((d>>(7-j))&1)*255; } } From e5f0ead24f5f24b9ed57584167f93b8f5ccf16d2 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 21:25:42 +0000 Subject: [PATCH 18/76] The yuv->rgb tables are too small for cliping to be avoidable, thus revert the respective optimization. The table generator code has to be rewritten anyway one day by some volunteer because its not LGPL, fixing the GPL table generator thus seems like wasted time. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27591 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b0ce120cfd..81cc945f1a 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -540,7 +540,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil } #define YSCALE_YUV_2_RGBX_C(type) \ - YSCALE_YUV_2_PACKEDX_NOCLIP_C(type) \ + YSCALE_YUV_2_PACKEDX_C(type) /* FIXME fix tables so that cliping is not needed and then use _NOCLIP*/\ r = (type *)c->table_rV[V]; \ g = (type *)(c->table_gU[U] + c->table_gV[V]); \ b = (type *)c->table_bU[U]; \ From d8bf925d4cb6233ffda813be39c6f443199388aa Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 21:46:53 +0000 Subject: [PATCH 19/76] Add bitexact flag. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27592 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.h | 1 + libswscale/swscale_avoption.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 98e9b2ee0e..95ff4f1770 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -75,6 +75,7 @@ unsigned swscale_version(void); #define SWS_FULL_CHR_H_INP 0x4000 #define SWS_DIRECT_BGR 0x8000 #define SWS_ACCURATE_RND 0x40000 +#define SWS_BITEXACT 0x80000 #define SWS_CPU_CAPS_MMX 0x80000000 #define SWS_CPU_CAPS_MMX2 0x20000000 diff --git a/libswscale/swscale_avoption.c b/libswscale/swscale_avoption.c index 1878b4ea8f..996843df1d 100644 --- a/libswscale/swscale_avoption.c +++ b/libswscale/swscale_avoption.c @@ -53,6 +53,7 @@ static const AVOption options[] = { { "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" }, { "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INT, INT_MIN, INT_MAX, VE, "sws_flags" }, { "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INP, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "bitexact", "", 0 , FF_OPT_TYPE_CONST, SWS_BITEXACT, INT_MIN, INT_MAX, VE, "sws_flags" }, { NULL } }; From 68de5a33c96b4ce5e9607548996eda0f6ead11de Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 22:29:21 +0000 Subject: [PATCH 20/76] Make the horizontal C scaler code clip only against INT16_MAX not 0, this decreases the difference between C and MMX, its also faster. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27593 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index bccead88df..4bcb6054fd 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2330,7 +2330,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW val += ((int)src[srcPos + j])*filter[filterSize*i + j]; } //filter += hFilterSize; - dst[i] = av_clip(val>>7, 0, (1<<15)-1); // the cubic equation does overflow ... + dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ... //dst[i] = val>>7; } #endif /* HAVE_ALTIVEC */ From 57db6892cfbcdd1cd460cc5282563b81e8bb1c3c Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 23:52:37 +0000 Subject: [PATCH 21/76] yvu9toyv12Wrapper is not bitexact so disable it when the user wants bitexactness to C. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27594 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 81cc945f1a..6285f4f117 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2172,7 +2172,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH } #endif - if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P) + if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_BITEXACT)) { c->swScale= yvu9toyv12Wrapper; } From 07fd651300ec7888333d41446afdc6a2edafa569 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 02:04:10 +0000 Subject: [PATCH 22/76] Ensure that additional filter coeffs that exist due to alignment are 0 if bitexact mode is requested. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27595 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 6285f4f117..d9eadfed8f 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1244,6 +1244,8 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF { if (j>=filter2Size) filter[i*filterSize + j]= 0.0; else filter[i*filterSize + j]= filter2[i*filter2Size + j]; + if((flags & SWS_BITEXACT) && j>=minFilterSize) + filter[i*filterSize + j]= 0.0; } } From 6869e4a7a453f829239eb46f83066c39000f0cee Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 02:18:12 +0000 Subject: [PATCH 23/76] Make horizontal mmx scaling code match C code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27596 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 4bcb6054fd..f78d1bb83a 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2170,7 +2170,6 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" - "movq "MANGLE(w02)", %%mm6 \n\t" "push %%"REG_BP" \n\t" // we use 7 regs here ... "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) @@ -2185,10 +2184,11 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" - "psrad $8, %%mm0 \n\t" - "psrad $8, %%mm3 \n\t" - "packssdw %%mm3, %%mm0 \n\t" - "pmaddwd %%mm6, %%mm0 \n\t" + "movq %%mm0, %%mm4 \n\t" + "punpckldq %%mm3, %%mm0 \n\t" + "punpckhdq %%mm3, %%mm4 \n\t" + "paddd %%mm4, %%mm0 \n\t" + "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" @@ -2216,7 +2216,6 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" - "movq "MANGLE(w02)", %%mm6 \n\t" "push %%"REG_BP" \n\t" // we use 7 regs here ... "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) @@ -2242,11 +2241,11 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "pmaddwd %%mm2, %%mm5 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm5, %%mm3 \n\t" - - "psrad $8, %%mm0 \n\t" - "psrad $8, %%mm3 \n\t" - "packssdw %%mm3, %%mm0 \n\t" - "pmaddwd %%mm6, %%mm0 \n\t" + "movq %%mm0, %%mm4 \n\t" + "punpckldq %%mm3, %%mm0 \n\t" + "punpckhdq %%mm3, %%mm4 \n\t" + "paddd %%mm4, %%mm0 \n\t" + "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" @@ -2272,7 +2271,6 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW dst-= counter/2; asm volatile( "pxor %%mm7, %%mm7 \n\t" - "movq "MANGLE(w02)", %%mm6 \n\t" ASMALIGN(4) "1: \n\t" "mov %2, %%"REG_c" \n\t" @@ -2297,10 +2295,11 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "cmp %4, %%"REG_c" \n\t" " jb 2b \n\t" "add %6, %1 \n\t" - "psrad $8, %%mm4 \n\t" - "psrad $8, %%mm5 \n\t" - "packssdw %%mm5, %%mm4 \n\t" - "pmaddwd %%mm6, %%mm4 \n\t" + "movq %%mm4, %%mm0 \n\t" + "punpckldq %%mm5, %%mm4 \n\t" + "punpckhdq %%mm5, %%mm0 \n\t" + "paddd %%mm0, %%mm4 \n\t" + "psrad $7, %%mm4 \n\t" "packssdw %%mm4, %%mm4 \n\t" "mov %3, %%"REG_a" \n\t" "movd %%mm4, (%%"REG_a", %0) \n\t" From 79c5484c9fc699a58717b84f223647caf088eb9f Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 03:12:15 +0000 Subject: [PATCH 24/76] Disable mmx routines that are not bitexact when the user wants bitexact ones. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27597 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index f78d1bb83a..319edb89d0 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -950,6 +950,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t * uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX + if(!(c->flags & SWS_BITEXACT)){ if (c->flags & SWS_ACCURATE_RND){ if (uDest){ YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) @@ -965,7 +966,9 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t * YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } -#else + return; + } +#endif #ifdef HAVE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, @@ -975,7 +978,6 @@ yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #endif //!HAVE_ALTIVEC -#endif /* HAVE_MMX */ } static inline void RENAME(yuv2nv12X)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, @@ -990,7 +992,9 @@ yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize, static inline void RENAME(yuv2yuv1)(SwsContext *c, int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { + int i; #ifdef HAVE_MMX + if(!(c->flags & SWS_BITEXACT)){ long p= uDest ? 3 : 1; uint8_t *src[3]= {lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; uint8_t *dst[3]= {dest, uDest, vDest}; @@ -1015,9 +1019,9 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, int16_t *lumSrc, int16_t *chr ); } } - -#else - int i; + return; + } +#endif for (i=0; i>7; @@ -1046,7 +1050,6 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, int16_t *lumSrc, int16_t *chr uDest[i]= u; vDest[i]= v; } -#endif } @@ -1059,6 +1062,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ { #ifdef HAVE_MMX long dummy=0; + if(!(c->flags & SWS_BITEXACT)){ if (c->flags & SWS_ACCURATE_RND){ switch(c->dstFormat){ case PIX_FMT_RGB32: @@ -1181,6 +1185,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ return; } } + } #endif /* HAVE_MMX */ #ifdef HAVE_ALTIVEC /* The following list of supported dstFormat values should @@ -1424,6 +1429,7 @@ FULL_YSCALEYUV2RGB { #endif // if 0 #ifdef HAVE_MMX + if(!(c->flags & SWS_BITEXACT)){ switch(c->dstFormat) { //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( @@ -1510,6 +1516,7 @@ FULL_YSCALEYUV2RGB return; default: break; } + } #endif //HAVE_MMX YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C) } @@ -1533,6 +1540,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * } #ifdef HAVE_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 { switch(dstFormat) @@ -1711,6 +1719,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * return; } } + } #endif /* HAVE_MMX */ if (uvalpha < 2048) { From 5f97d37455cb991f870235772e1ea70009e5702d Mon Sep 17 00:00:00 2001 From: compn Date: Sat, 13 Sep 2008 03:28:15 +0000 Subject: [PATCH 25/76] multiple locales in mplayer wish git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27598 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/wishlist | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DOCS/tech/wishlist b/DOCS/tech/wishlist index 37f256c338..c5fe84b932 100644 --- a/DOCS/tech/wishlist +++ b/DOCS/tech/wishlist @@ -23,6 +23,8 @@ Documentation: * document channels.conf syntax + * ability for multiple languages/locales in one binary + Small improvements: * vo_mga should completely blank the screen like fbdev and tdfxfb @@ -87,7 +89,7 @@ Filters: * xinerama video filter that splits movie to 2 screens (like zr) - * mixing of multiple videos (picture in picture, ...) + * mixing of multiple videos (picture in picture, review shmem patch) * video watermark/logo filter (apply vf_overlay patch?) From f5a4bd86cbfba940df19df2322c4a79c7bf64edc Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 11:52:03 +0000 Subject: [PATCH 26/76] Rename yuv2rgb variables to avoid name clashes with the ones used by bfin asm. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27599 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 22 +++++++++++----------- libswscale/swscale_internal.h | 7 ++++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index d9eadfed8f..e8fd0d1727 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -498,12 +498,12 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil #define YSCALE_YUV_2_RGBX_FULL_C(rnd) \ YSCALE_YUV_2_PACKEDX_FULL_C\ - Y-= c->oy;\ - Y*= c->cy;\ + Y-= c->yuv2rgb_y_offset;\ + Y*= c->yuv2rgb_y_coeff;\ Y+= rnd;\ - R= Y + V*c->cvr;\ - G= Y + V*c->cvg + U*c->cug;\ - B= Y + U*c->cub;\ + R= Y + V*c->yuv2rgb_v2r_coeff;\ + G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\ + B= Y + U*c->yuv2rgb_u2b_coeff;\ if ((R|G|B)&(0xC0000000)){\ if (R>=(256<<22)) R=(256<<22)-1; \ else if (R<0)R=0; \ @@ -1960,12 +1960,12 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; - c->cy = (int16_t)roundToInt16(cy <<13); - c->oy = (int16_t)roundToInt16(oy <<9); - c->cvr= (int16_t)roundToInt16(crv<<13); - c->cvg= (int16_t)roundToInt16(cgv<<13); - c->cug= (int16_t)roundToInt16(cgu<<13); - c->cub= (int16_t)roundToInt16(cbu<<13); + c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13); + c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9); + c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13); + c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13); + c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); + c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); //FIXME factorize diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 9d82662483..8290c04ade 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -126,7 +126,12 @@ typedef struct SwsContext{ int srcColorspaceTable[4]; int dstColorspaceTable[4]; int srcRange, dstRange; - int oy,cy,cvr,cvg,cug,cub; + int yuv2rgb_y_offset; + int yuv2rgb_y_coeff; + int yuv2rgb_v2r_coeff; + int yuv2rgb_v2g_coeff; + int yuv2rgb_u2g_coeff; + int yuv2rgb_u2b_coeff; #define RED_DITHER "0*8" #define GREEN_DITHER "1*8" From b726d73ed14e80d1d833dbb95b6777a1173957c1 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 13:41:47 +0000 Subject: [PATCH 27/76] Fix indention. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27600 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 608 +++++++++++++++++----------------- 1 file changed, 304 insertions(+), 304 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 319edb89d0..c2a6ab1991 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -951,21 +951,21 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t * { #ifdef HAVE_MMX if(!(c->flags & SWS_BITEXACT)){ - if (c->flags & SWS_ACCURATE_RND){ - if (uDest){ - YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) - YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) - } + if (c->flags & SWS_ACCURATE_RND){ + if (uDest){ + YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) + YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) + } - YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) - }else{ - if (uDest){ - YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) - YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) - } + YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) + }else{ + if (uDest){ + YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) + YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) + } - YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) - } + YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) + } return; } #endif @@ -995,30 +995,30 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, int16_t *lumSrc, int16_t *chr int i; #ifdef HAVE_MMX if(!(c->flags & SWS_BITEXACT)){ - long p= uDest ? 3 : 1; - uint8_t *src[3]= {lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; - uint8_t *dst[3]= {dest, uDest, vDest}; - long counter[3] = {dstW, chrDstW, chrDstW}; + long p= uDest ? 3 : 1; + uint8_t *src[3]= {lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; + uint8_t *dst[3]= {dest, uDest, vDest}; + long counter[3] = {dstW, chrDstW, chrDstW}; - if (c->flags & SWS_ACCURATE_RND){ - while(p--){ - asm volatile( - YSCALEYUV2YV121_ACCURATE - :: "r" (src[p]), "r" (dst[p] + counter[p]), - "g" (-counter[p]) - : "%"REG_a - ); + if (c->flags & SWS_ACCURATE_RND){ + while(p--){ + asm volatile( + YSCALEYUV2YV121_ACCURATE + :: "r" (src[p]), "r" (dst[p] + counter[p]), + "g" (-counter[p]) + : "%"REG_a + ); + } + }else{ + while(p--){ + asm volatile( + YSCALEYUV2YV121 + :: "r" (src[p]), "r" (dst[p] + counter[p]), + "g" (-counter[p]) + : "%"REG_a + ); + } } - }else{ - while(p--){ - asm volatile( - YSCALEYUV2YV121 - :: "r" (src[p]), "r" (dst[p] + counter[p]), - "g" (-counter[p]) - : "%"REG_a - ); - } - } return; } #endif @@ -1063,129 +1063,129 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ #ifdef HAVE_MMX long dummy=0; if(!(c->flags & SWS_BITEXACT)){ - if (c->flags & SWS_ACCURATE_RND){ - switch(c->dstFormat){ - case PIX_FMT_RGB32: - YSCALEYUV2PACKEDX_ACCURATE - YSCALEYUV2RGBX - WRITEBGR32(%4, %5, %%REGa) + if (c->flags & SWS_ACCURATE_RND){ + switch(c->dstFormat){ + case PIX_FMT_RGB32: + YSCALEYUV2PACKEDX_ACCURATE + YSCALEYUV2RGBX + WRITEBGR32(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_BGR24: - YSCALEYUV2PACKEDX_ACCURATE - YSCALEYUV2RGBX - "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize - "add %4, %%"REG_c" \n\t" - WRITEBGR24(%%REGc, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_BGR24: + YSCALEYUV2PACKEDX_ACCURATE + YSCALEYUV2RGBX + "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize + "add %4, %%"REG_c" \n\t" + WRITEBGR24(%%REGc, %5, %%REGa) - :: "r" (&c->redDither), - "m" (dummy), "m" (dummy), "m" (dummy), - "r" (dest), "m" (dstW) - : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S - ); - return; - case PIX_FMT_RGB555: - YSCALEYUV2PACKEDX_ACCURATE - YSCALEYUV2RGBX - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "r" (&c->redDither), + "m" (dummy), "m" (dummy), "m" (dummy), + "r" (dest), "m" (dstW) + : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S + ); + return; + case PIX_FMT_RGB555: + YSCALEYUV2PACKEDX_ACCURATE + YSCALEYUV2RGBX + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2\n\t" - "paddusb "MANGLE(g5Dither)", %%mm4\n\t" - "paddusb "MANGLE(r5Dither)", %%mm5\n\t" + "paddusb "MANGLE(b5Dither)", %%mm2\n\t" + "paddusb "MANGLE(g5Dither)", %%mm4\n\t" + "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif - WRITERGB15(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_RGB565: - YSCALEYUV2PACKEDX_ACCURATE - YSCALEYUV2RGBX - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + WRITERGB15(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_RGB565: + YSCALEYUV2PACKEDX_ACCURATE + YSCALEYUV2RGBX + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2\n\t" - "paddusb "MANGLE(g6Dither)", %%mm4\n\t" - "paddusb "MANGLE(r5Dither)", %%mm5\n\t" + "paddusb "MANGLE(b5Dither)", %%mm2\n\t" + "paddusb "MANGLE(g6Dither)", %%mm4\n\t" + "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif - WRITERGB16(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_YUYV422: - YSCALEYUV2PACKEDX_ACCURATE - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + WRITERGB16(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_YUYV422: + YSCALEYUV2PACKEDX_ACCURATE + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ - "psraw $3, %%mm3 \n\t" - "psraw $3, %%mm4 \n\t" - "psraw $3, %%mm1 \n\t" - "psraw $3, %%mm7 \n\t" - WRITEYUY2(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - } - }else{ - switch(c->dstFormat) - { - case PIX_FMT_RGB32: - YSCALEYUV2PACKEDX - YSCALEYUV2RGBX - WRITEBGR32(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_BGR24: - YSCALEYUV2PACKEDX - YSCALEYUV2RGBX - "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize - "add %4, %%"REG_c" \n\t" - WRITEBGR24(%%REGc, %5, %%REGa) + "psraw $3, %%mm3 \n\t" + "psraw $3, %%mm4 \n\t" + "psraw $3, %%mm1 \n\t" + "psraw $3, %%mm7 \n\t" + WRITEYUY2(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + } + }else{ + switch(c->dstFormat) + { + case PIX_FMT_RGB32: + YSCALEYUV2PACKEDX + YSCALEYUV2RGBX + WRITEBGR32(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_BGR24: + YSCALEYUV2PACKEDX + YSCALEYUV2RGBX + "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize + "add %4, %%"REG_c" \n\t" + WRITEBGR24(%%REGc, %5, %%REGa) - :: "r" (&c->redDither), - "m" (dummy), "m" (dummy), "m" (dummy), - "r" (dest), "m" (dstW) - : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S - ); - return; - case PIX_FMT_RGB555: - YSCALEYUV2PACKEDX - YSCALEYUV2RGBX - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "r" (&c->redDither), + "m" (dummy), "m" (dummy), "m" (dummy), + "r" (dest), "m" (dstW) + : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S + ); + return; + case PIX_FMT_RGB555: + YSCALEYUV2PACKEDX + YSCALEYUV2RGBX + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB15(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_RGB565: - YSCALEYUV2PACKEDX - YSCALEYUV2RGBX - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + WRITERGB15(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_RGB565: + YSCALEYUV2PACKEDX + YSCALEYUV2RGBX + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB16(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; - case PIX_FMT_YUYV422: - YSCALEYUV2PACKEDX - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + WRITERGB16(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + case PIX_FMT_YUYV422: + YSCALEYUV2PACKEDX + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ - "psraw $3, %%mm3 \n\t" - "psraw $3, %%mm4 \n\t" - "psraw $3, %%mm1 \n\t" - "psraw $3, %%mm7 \n\t" - WRITEYUY2(%4, %5, %%REGa) - YSCALEYUV2PACKEDX_END - return; + "psraw $3, %%mm3 \n\t" + "psraw $3, %%mm4 \n\t" + "psraw $3, %%mm1 \n\t" + "psraw $3, %%mm7 \n\t" + WRITEYUY2(%4, %5, %%REGa) + YSCALEYUV2PACKEDX_END + return; + } } } - } #endif /* HAVE_MMX */ #ifdef HAVE_ALTIVEC /* The following list of supported dstFormat values should @@ -1541,185 +1541,185 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * #ifdef HAVE_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 - { - switch(dstFormat) + if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster { - case PIX_FMT_RGB32: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1(%%REGBP, %5) - WRITEBGR32(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + switch(dstFormat) + { + case PIX_FMT_RGB32: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1(%%REGBP, %5) + WRITEBGR32(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_BGR24: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1(%%REGBP, %5) - WRITEBGR24(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_BGR24: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1(%%REGBP, %5) + WRITEBGR24(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_RGB555: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1(%%REGBP, %5) - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_RGB555: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1(%%REGBP, %5) + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB15(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + WRITERGB15(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_RGB565: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1(%%REGBP, %5) - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_RGB565: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1(%%REGBP, %5) + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB16(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + WRITERGB16(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_YUYV422: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2PACKED1(%%REGBP, %5) - WRITEYUY2(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_YUYV422: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2PACKED1(%%REGBP, %5) + WRITEYUY2(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + } } - } - else - { - switch(dstFormat) + else { - case PIX_FMT_RGB32: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1b(%%REGBP, %5) - WRITEBGR32(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + switch(dstFormat) + { + case PIX_FMT_RGB32: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1b(%%REGBP, %5) + WRITEBGR32(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_BGR24: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1b(%%REGBP, %5) - WRITEBGR24(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_BGR24: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1b(%%REGBP, %5) + WRITEBGR24(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_RGB555: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1b(%%REGBP, %5) - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_RGB555: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1b(%%REGBP, %5) + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB15(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + WRITERGB15(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_RGB565: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2RGB1b(%%REGBP, %5) - /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_RGB565: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2RGB1b(%%REGBP, %5) + /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP - "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" - "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" - "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" + "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" + "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" + "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif - WRITERGB16(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + WRITERGB16(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; - case PIX_FMT_YUYV422: - asm volatile( - "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" - "mov %4, %%"REG_b" \n\t" - "push %%"REG_BP" \n\t" - YSCALEYUV2PACKED1b(%%REGBP, %5) - WRITEYUY2(%%REGb, 8280(%5), %%REGBP) - "pop %%"REG_BP" \n\t" - "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + case PIX_FMT_YUYV422: + asm volatile( + "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" + "mov %4, %%"REG_b" \n\t" + "push %%"REG_BP" \n\t" + YSCALEYUV2PACKED1b(%%REGBP, %5) + WRITEYUY2(%%REGb, 8280(%5), %%REGBP) + "pop %%"REG_BP" \n\t" + "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" - :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), - "a" (&c->redDither) - ); - return; + :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), + "a" (&c->redDither) + ); + return; + } } } - } #endif /* HAVE_MMX */ if (uvalpha < 2048) { @@ -3161,8 +3161,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); }else{ - RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), - dest, dstW, chrAlpha, dstFormat, flags, dstY); + RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), + dest, dstW, chrAlpha, dstFormat, flags, dstY); } } else if (vLumFilterSize == 2 && vChrFilterSize == 2) //bilinear upscale RGB @@ -3179,8 +3179,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); }else{ - RENAME(yuv2packed2)(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), - dest, dstW, lumAlpha, chrAlpha, dstY); + RENAME(yuv2packed2)(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), + dest, dstW, lumAlpha, chrAlpha, dstY); } } else //general RGB @@ -3191,10 +3191,10 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); }else{ - RENAME(yuv2packedX)(c, - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, - dest, dstW, dstY); + RENAME(yuv2packedX)(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); } } } @@ -3230,10 +3230,10 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); }else{ - yuv2packedXinC(c, - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, - dest, dstW, dstY); + yuv2packedXinC(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, + dest, dstW, dstY); } } } From 60c05a176fcf5729c0b233626e32d7cb98e8442f Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 13 Sep 2008 14:23:45 +0000 Subject: [PATCH 28/76] Remove version string from name of local changes diff file. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27601 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpeg2/{libmpeg-0.4.1.diff => libmpeg2_changes.diff} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libmpeg2/{libmpeg-0.4.1.diff => libmpeg2_changes.diff} (100%) diff --git a/libmpeg2/libmpeg-0.4.1.diff b/libmpeg2/libmpeg2_changes.diff similarity index 100% rename from libmpeg2/libmpeg-0.4.1.diff rename to libmpeg2/libmpeg2_changes.diff From 62146f22be20db20004f683b2316fa064a8f6bf1 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 13 Sep 2008 16:13:04 +0000 Subject: [PATCH 29/76] Fix libswscale build after r27561 if --enable-runtime-cpudetection is used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27602 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index c2a6ab1991..04562a6932 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1913,7 +1913,7 @@ BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU , GU<<5, BU<< BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7) #ifdef HAVE_MMX -static inline void bgr24ToY_mmx(uint8_t *dst, uint8_t *src, long width, int srcFormat) +static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, int srcFormat) { if(srcFormat == PIX_FMT_BGR24){ @@ -1966,7 +1966,7 @@ static inline void bgr24ToY_mmx(uint8_t *dst, uint8_t *src, long width, int srcF ); } -static inline void bgr24ToUV_mmx(uint8_t *dstU, uint8_t *dstV, uint8_t *src, long width, int srcFormat) +static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, uint8_t *src, long width, int srcFormat) { asm volatile( "movq 24+%4, %%mm6 \n\t" @@ -2028,7 +2028,7 @@ static inline void bgr24ToUV_mmx(uint8_t *dstU, uint8_t *dstV, uint8_t *src, lon static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width) { #ifdef HAVE_MMX - bgr24ToY_mmx(dst, src, width, PIX_FMT_BGR24); + RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); #else int i; for (i=0; i Date: Sat, 13 Sep 2008 17:06:42 +0000 Subject: [PATCH 30/76] libmpeg-0.4.1.diff was renamed to libmpeg2_changes.diff. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27603 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpeg2/cpu_accel.c | 2 +- libmpeg2/cpu_state.c | 2 +- libmpeg2/decode.c | 2 +- libmpeg2/header.c | 2 +- libmpeg2/idct.c | 2 +- libmpeg2/idct_mmx.c | 2 +- libmpeg2/motion_comp.c | 2 +- libmpeg2/motion_comp_mmx.c | 2 +- libmpeg2/mpeg2.h | 2 +- libmpeg2/mpeg2_internal.h | 2 +- libmpeg2/slice.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libmpeg2/cpu_accel.c b/libmpeg2/cpu_accel.c index 587cf32ad3..54b57f18a2 100644 --- a/libmpeg2/cpu_accel.c +++ b/libmpeg2/cpu_accel.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/cpu_state.c b/libmpeg2/cpu_state.c index 52cb08b80c..5b773b245e 100644 --- a/libmpeg2/cpu_state.c +++ b/libmpeg2/cpu_state.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/decode.c b/libmpeg2/decode.c index ebfcaaf6f8..d9ae05c9a8 100644 --- a/libmpeg2/decode.c +++ b/libmpeg2/decode.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/header.c b/libmpeg2/header.c index 5d59b3a193..ae8b228a63 100644 --- a/libmpeg2/header.c +++ b/libmpeg2/header.c @@ -21,7 +21,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/idct.c b/libmpeg2/idct.c index 7992fd5da4..e3f88dad30 100644 --- a/libmpeg2/idct.c +++ b/libmpeg2/idct.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/idct_mmx.c b/libmpeg2/idct_mmx.c index 3d1ae46f6e..a682284dab 100644 --- a/libmpeg2/idct_mmx.c +++ b/libmpeg2/idct_mmx.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/motion_comp.c b/libmpeg2/motion_comp.c index 0d26ba321f..a1168c8069 100644 --- a/libmpeg2/motion_comp.c +++ b/libmpeg2/motion_comp.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/motion_comp_mmx.c b/libmpeg2/motion_comp_mmx.c index 4f2aacfc84..964695570a 100644 --- a/libmpeg2/motion_comp_mmx.c +++ b/libmpeg2/motion_comp_mmx.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/mpeg2.h b/libmpeg2/mpeg2.h index d27a4c9ee3..08933b5843 100644 --- a/libmpeg2/mpeg2.h +++ b/libmpeg2/mpeg2.h @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/mpeg2_internal.h b/libmpeg2/mpeg2_internal.h index 37eb61f227..04a31f6926 100644 --- a/libmpeg2/mpeg2_internal.h +++ b/libmpeg2/mpeg2_internal.h @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ diff --git a/libmpeg2/slice.c b/libmpeg2/slice.c index d0cbacb6b4..4d778a7026 100644 --- a/libmpeg2/slice.c +++ b/libmpeg2/slice.c @@ -21,7 +21,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes. + * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ * $Id$ */ From bbcccf2d197e4c127ed0de311cbcb5c0f82b4c9a Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 13 Sep 2008 17:31:45 +0000 Subject: [PATCH 31/76] Update internal libmpeg2 copy to version 0.5.1. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27604 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Changelog | 1 + Copyright | 4 +- libmpeg2/alloc.c | 8 +- libmpeg2/alpha_asm.h | 6 +- libmpeg2/attributes.h | 5 + libmpeg2/cpu_accel.c | 284 ++++++++++++++++++++--------------- libmpeg2/cpu_state.c | 6 +- libmpeg2/decode.c | 40 ++--- libmpeg2/header.c | 228 ++++++++++++++++++---------- libmpeg2/idct.c | 2 - libmpeg2/idct_alpha.c | 2 - libmpeg2/idct_altivec.c | 2 - libmpeg2/idct_mmx.c | 6 - libmpeg2/mmx.h | 5 + libmpeg2/motion_comp_arm.c | 18 +-- libmpeg2/motion_comp_arm_s.S | 3 +- libmpeg2/motion_comp_mmx.c | 6 +- libmpeg2/mpeg2.h | 17 ++- libmpeg2/mpeg2_internal.h | 19 ++- libmpeg2/slice.c | 56 ++++--- libmpeg2/vis.h | 5 + libmpeg2/vlc.h | 13 +- 22 files changed, 434 insertions(+), 302 deletions(-) diff --git a/Changelog b/Changelog index 80226b871d..f67276f635 100644 --- a/Changelog +++ b/Changelog @@ -56,6 +56,7 @@ MPlayer (1.0) libmpeg2: * enable Alpha/ARM optimizations in libmpeg2 * SSE2-optimized IDCT routines from upstream libmpeg2 + * libmpeg2 updated to version 0.5.1 Drivers: * replace PolypAudio by PulseAudio (-ao pulse) diff --git a/Copyright b/Copyright index 3589e06be9..47ae48b2d0 100644 --- a/Copyright +++ b/Copyright @@ -61,11 +61,11 @@ Copyright: 1998, 1999 Eric Smith License: GNU General Public License Name: libmpeg2 -Version: 0.4.1 + patches +Version: 0.5.1 + patches Homepage: http://libmpeg2.sourceforge.net/ Directory: libmpeg2 Copyright: 1999-2000 Aaron Holtzman - 2000-2003 Michel Lespinasse + 2000-2004 Michel Lespinasse 2002-2003 Falk Hueffner 2003 David S. Miller 2003 Regis Duchesne diff --git a/libmpeg2/alloc.c b/libmpeg2/alloc.c index 0698937bce..71bc18b692 100644 --- a/libmpeg2/alloc.c +++ b/libmpeg2/alloc.c @@ -62,9 +62,9 @@ void mpeg2_free (void * buf) free (*(((void **)buf) - 1)); } -void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t), - int free (void *)) +void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t), + int free_func (void *)) { - malloc_hook = malloc; - free_hook = free; + malloc_hook = alloc_func; + free_hook = free_func; } diff --git a/libmpeg2/alpha_asm.h b/libmpeg2/alpha_asm.h index bf1081f249..1a296301da 100644 --- a/libmpeg2/alpha_asm.h +++ b/libmpeg2/alpha_asm.h @@ -20,8 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ALPHA_ASM_H -#define ALPHA_ASM_H +#ifndef LIBMPEG2_ALPHA_ASM_H +#define LIBMPEG2_ALPHA_ASM_H #include @@ -178,4 +178,4 @@ struct unaligned_long { uint64_t l; } __attribute__((packed)); #error "Unknown compiler!" #endif -#endif /* ALPHA_ASM_H */ +#endif /* LIBMPEG2_ALPHA_ASM_H */ diff --git a/libmpeg2/attributes.h b/libmpeg2/attributes.h index eefbc0dd1b..e005eef1c3 100644 --- a/libmpeg2/attributes.h +++ b/libmpeg2/attributes.h @@ -21,6 +21,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef LIBMPEG2_ATTRIBUTES_H +#define LIBMPEG2_ATTRIBUTES_H + /* use gcc attribs to align critical data structures */ #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) @@ -35,3 +38,5 @@ #define likely(x) (x) #define unlikely(x) (x) #endif + +#endif /* LIBMPEG2_ATTRIBUTES_H */ diff --git a/libmpeg2/cpu_accel.c b/libmpeg2/cpu_accel.c index 54b57f18a2..104ac2cfdf 100644 --- a/libmpeg2/cpu_accel.c +++ b/libmpeg2/cpu_accel.c @@ -1,6 +1,6 @@ /* * cpu_accel.c - * Copyright (C) 2000-2003 Michel Lespinasse + * Copyright (C) 2000-2004 Michel Lespinasse * Copyright (C) 1999-2000 Aaron Holtzman * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. @@ -26,7 +26,6 @@ */ #include "config.h" -#include "cpudetect.h" #include @@ -34,21 +33,26 @@ #include "attributes.h" #include "mpeg2_internal.h" -#ifdef ACCEL_DETECT +#include "cpudetect.h" + #if defined(ARCH_X86) || defined(ARCH_X86_64) - -/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow! - * instructions via assembly. However, it is regarded as duplicated work - * in MPlayer, so that we enforce using MPlayer's implementation. - */ -#define MPLAYER_CPUDETECT - -static inline uint32_t arch_accel (void) +static inline uint32_t arch_accel (uint32_t accel) { -#if !defined(MPLAYER_CPUDETECT) - uint32_t eax, ebx, ecx, edx; - int AMD; - uint32_t caps; +/* Use MPlayer CPU detection instead of libmpeg2 variant. */ +#if 0 + if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT)) + accel |= MPEG2_ACCEL_X86_MMX; + + if (accel & (MPEG2_ACCEL_X86_SSE2 | MPEG2_ACCEL_X86_SSE3)) + accel |= MPEG2_ACCEL_X86_MMXEXT; + + if (accel & (MPEG2_ACCEL_X86_SSE3)) + accel |= MPEG2_ACCEL_X86_SSE2; + +#ifdef ACCEL_DETECT + if (accel & MPEG2_ACCEL_DETECT) { + uint32_t eax, ebx, ecx, edx; + int AMD; #if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__)) #define cpuid(op,eax,ebx,ecx,edx) \ @@ -59,7 +63,7 @@ static inline uint32_t arch_accel (void) "=d" (edx) \ : "a" (op) \ : "cc") -#else /* PIC version : save ebx (not needed on x86_64) */ +#else /* PIC version : save ebx (not needed on x86_64) */ #define cpuid(op,eax,ebx,ecx,edx) \ __asm__ ("pushl %%ebx\n\t" \ "cpuid\n\t" \ @@ -74,70 +78,79 @@ static inline uint32_t arch_accel (void) #endif #ifndef __x86_64__ /* x86_64 supports the cpuid op */ - __asm__ ("pushf\n\t" - "pushf\n\t" - "pop %0\n\t" - "movl %0,%1\n\t" - "xorl $0x200000,%0\n\t" - "push %0\n\t" - "popf\n\t" - "pushf\n\t" - "pop %0\n\t" - "popf" - : "=r" (eax), - "=r" (ebx) - : - : "cc"); + __asm__ ("pushf\n\t" + "pushf\n\t" + "pop %0\n\t" + "movl %0,%1\n\t" + "xorl $0x200000,%0\n\t" + "push %0\n\t" + "popf\n\t" + "pushf\n\t" + "pop %0\n\t" + "popf" + : "=r" (eax), + "=r" (ebx) + : + : "cc"); - if (eax == ebx) /* no cpuid */ - return 0; + if (eax == ebx) /* no cpuid */ + return accel; #endif - cpuid (0x00000000, eax, ebx, ecx, edx); - if (!eax) /* vendor string only */ - return 0; + cpuid (0x00000000, eax, ebx, ecx, edx); + if (!eax) /* vendor string only */ + return accel; - AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65); + AMD = (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65); - cpuid (0x00000001, eax, ebx, ecx, edx); - if (! (edx & 0x00800000)) /* no MMX */ - return 0; + cpuid (0x00000001, eax, ebx, ecx, edx); + if (! (edx & 0x00800000)) /* no MMX */ + return accel; - caps = MPEG2_ACCEL_X86_MMX; - if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */ - caps = MPEG2_ACCEL_X86_MMX | MPEG2_ACCEL_X86_MMXEXT; + accel |= MPEG2_ACCEL_X86_MMX; + if (edx & 0x02000000) /* SSE - identical to AMD MMX ext. */ + accel |= MPEG2_ACCEL_X86_MMXEXT; - cpuid (0x80000000, eax, ebx, ecx, edx); - if (eax < 0x80000001) /* no extended capabilities */ - return caps; + if (edx & 0x04000000) /* SSE2 */ + accel |= MPEG2_ACCEL_X86_SSE2; - cpuid (0x80000001, eax, ebx, ecx, edx); + if (ecx & 0x00000001) /* SSE3 */ + accel |= MPEG2_ACCEL_X86_SSE3; - if (edx & 0x80000000) - caps |= MPEG2_ACCEL_X86_3DNOW; + cpuid (0x80000000, eax, ebx, ecx, edx); + if (eax < 0x80000001) /* no extended capabilities */ + return accel; - if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */ - caps |= MPEG2_ACCEL_X86_MMXEXT; + cpuid (0x80000001, eax, ebx, ecx, edx); - return caps; -#else /* MPLAYER_CPUDETECT: Use MPlayer's CPU capability property. */ - caps = 0; + if (edx & 0x80000000) + accel |= MPEG2_ACCEL_X86_3DNOW; + + if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */ + accel |= MPEG2_ACCEL_X86_MMXEXT; + } +#endif /* ACCEL_DETECT */ + + return accel; + +#else /* 0 */ + accel = 0; if (gCpuCaps.hasMMX) - caps |= MPEG2_ACCEL_X86_MMX; + accel |= MPEG2_ACCEL_X86_MMX; if (gCpuCaps.hasSSE2) - caps |= MPEG2_ACCEL_X86_SSE2; + accel |= MPEG2_ACCEL_X86_SSE2; if (gCpuCaps.hasMMX2) - caps |= MPEG2_ACCEL_X86_MMXEXT; + accel |= MPEG2_ACCEL_X86_MMXEXT; if (gCpuCaps.has3DNow) - caps |= MPEG2_ACCEL_X86_3DNOW; + accel |= MPEG2_ACCEL_X86_3DNOW; - return caps; + return accel; -#endif /* MPLAYER_CPUDETECT */ +#endif /* 0 */ } #endif /* ARCH_X86 || ARCH_X86_64 */ -#if defined(ARCH_PPC) || defined(ARCH_SPARC) +#if defined(ACCEL_DETECT) && (defined(ARCH_PPC) || defined(ARCH_SPARC)) #include #include @@ -154,96 +167,117 @@ static RETSIGTYPE sigill_handler (int sig) canjump = 0; siglongjmp (jmpbuf, 1); } +#endif /* ACCEL_DETECT && (ARCH_PPC || ARCH_SPARC) */ #ifdef ARCH_PPC -static uint32_t arch_accel (void) +static uint32_t arch_accel (uint32_t accel) { - static RETSIGTYPE (* oldsig) (int); +#ifdef ACCEL_DETECT + if ((accel & (MPEG2_ACCEL_PPC_ALTIVEC | MPEG2_ACCEL_DETECT)) == + MPEG2_ACCEL_DETECT) { + static RETSIGTYPE (* oldsig) (int); - oldsig = signal (SIGILL, sigill_handler); - if (sigsetjmp (jmpbuf, 1)) { - signal (SIGILL, oldsig); - return 0; - } + oldsig = signal (SIGILL, sigill_handler); + if (sigsetjmp (jmpbuf, 1)) { + signal (SIGILL, oldsig); + return accel; + } - canjump = 1; + canjump = 1; #if defined(__APPLE_CC__) /* apple */ #define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t" -#else /* gnu */ +#else /* gnu */ #define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t" #endif - asm volatile ("mtspr 256, %0\n\t" - VAND (0, 0, 0) - : - : "r" (-1)); + asm volatile ("mtspr 256, %0\n\t" + VAND (0, 0, 0) + : + : "r" (-1)); - canjump = 0; + canjump = 0; + accel |= MPEG2_ACCEL_PPC_ALTIVEC; - signal (SIGILL, oldsig); - return MPEG2_ACCEL_PPC_ALTIVEC; + signal (SIGILL, oldsig); + } +#endif /* ACCEL_DETECT */ + + return accel; } #endif /* ARCH_PPC */ #ifdef ARCH_SPARC -static uint32_t arch_accel (void) +static uint32_t arch_accel (uint32_t accel) { - static RETSIGTYPE (* oldsig) (int); + if (accel & MPEG2_ACCEL_SPARC_VIS2) + accel |= MPEG2_ACCEL_SPARC_VIS; + +#ifdef ACCEL_DETECT + if ((accel & (MPEG2_ACCEL_SPARC_VIS2 | MPEG2_ACCEL_DETECT)) == + MPEG2_ACCEL_DETECT) { + static RETSIGTYPE (* oldsig) (int); + + oldsig = signal (SIGILL, sigill_handler); + if (sigsetjmp (jmpbuf, 1)) { + signal (SIGILL, oldsig); + return accel; + } + + canjump = 1; + + /* pdist %f0, %f0, %f0 */ + __asm__ __volatile__(".word\t0x81b007c0"); + + canjump = 0; + accel |= MPEG2_ACCEL_SPARC_VIS; + + if (sigsetjmp (jmpbuf, 1)) { + signal (SIGILL, oldsig); + return accel; + } + + canjump = 1; + + /* edge8n %g0, %g0, %g0 */ + __asm__ __volatile__(".word\t0x81b00020"); + + canjump = 0; + accel |= MPEG2_ACCEL_SPARC_VIS2; - oldsig = signal (SIGILL, sigill_handler); - if (sigsetjmp (jmpbuf, 1)) { signal (SIGILL, oldsig); - return 0; } - - canjump = 1; - - /* pdist %f0, %f0, %f0 */ - __asm__ __volatile__(".word\t0x81b007c0"); - - canjump = 0; - - if (sigsetjmp (jmpbuf, 1)) { - signal (SIGILL, oldsig); - return MPEG2_ACCEL_SPARC_VIS; - } - - canjump = 1; - - /* edge8n %g0, %g0, %g0 */ - __asm__ __volatile__(".word\t0x81b00020"); - - canjump = 0; - - signal (SIGILL, oldsig); - return MPEG2_ACCEL_SPARC_VIS | MPEG2_ACCEL_SPARC_VIS2; -} -#endif /* ARCH_SPARC */ -#endif /* ARCH_PPC || ARCH_SPARC */ - -#ifdef ARCH_ALPHA -static uint32_t arch_accel (void) -{ - uint64_t no_mvi; - - asm volatile ("amask %1, %0" - : "=r" (no_mvi) - : "rI" (256)); /* AMASK_MVI */ - return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | - MPEG2_ACCEL_ALPHA_MVI); -} -#endif /* ARCH_ALPHA */ #endif /* ACCEL_DETECT */ -uint32_t mpeg2_detect_accel (void) -{ - uint32_t accel; + return accel; +} +#endif /* ARCH_SPARC */ + +#ifdef ARCH_ALPHA +static inline uint32_t arch_accel (uint32_t accel) +{ + if (accel & MPEG2_ACCEL_ALPHA_MVI) + accel |= MPEG2_ACCEL_ALPHA; - accel = 0; #ifdef ACCEL_DETECT + if (accel & MPEG2_ACCEL_DETECT) { + uint64_t no_mvi; + + asm volatile ("amask %1, %0" + : "=r" (no_mvi) + : "rI" (256)); /* AMASK_MVI */ + accel |= no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | + MPEG2_ACCEL_ALPHA_MVI); + } +#endif /* ACCEL_DETECT */ + + return accel; +} +#endif /* ARCH_ALPHA */ + +uint32_t mpeg2_detect_accel (uint32_t accel) +{ #if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) - accel = arch_accel (); -#endif + accel = arch_accel (accel); #endif return accel; } diff --git a/libmpeg2/cpu_state.c b/libmpeg2/cpu_state.c index 5b773b245e..2f2f64a987 100644 --- a/libmpeg2/cpu_state.c +++ b/libmpeg2/cpu_state.c @@ -19,10 +19,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ */ #include "config.h" @@ -54,7 +50,7 @@ static void state_restore_mmx (cpu_state_t * state) #define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t" #define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t" #define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t" -#else /* gnu */ +#else /* gnu */ #define LI(a,b) "li " #a "," #b "\n\t" #define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t" #define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t" diff --git a/libmpeg2/decode.c b/libmpeg2/decode.c index d9ae05c9a8..f30b86b740 100644 --- a/libmpeg2/decode.c +++ b/libmpeg2/decode.c @@ -135,20 +135,20 @@ static inline mpeg2_state_t seek_chunk (mpeg2dec_t * mpeg2dec) } mpeg2dec->bytes_since_tag += skipped; mpeg2dec->code = mpeg2dec->buf_start[-1]; - return (mpeg2_state_t)-1; + return STATE_INTERNAL_NORETURN; } mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec) { - while (mpeg2dec->code != 0xb3 && - ((mpeg2dec->code != 0xb7 && mpeg2dec->code != 0xb8 && - mpeg2dec->code) || mpeg2dec->sequence.width == (unsigned)-1)) + while (!(mpeg2dec->code == 0xb3 || + ((mpeg2dec->code == 0xb7 || mpeg2dec->code == 0xb8 || + !mpeg2dec->code) && mpeg2dec->sequence.width != (unsigned)-1))) if (seek_chunk (mpeg2dec) == STATE_BUFFER) return STATE_BUFFER; mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; mpeg2dec->user_data_len = 0; - return (mpeg2dec->code ? mpeg2_parse_header (mpeg2dec) : - mpeg2_header_picture_start (mpeg2dec)); + return ((mpeg2dec->code == 0xb7) ? + mpeg2_header_end (mpeg2dec) : mpeg2_parse_header (mpeg2dec)); } #define RECEIVED(code,state) (((state) << 8) + (code)) @@ -161,7 +161,7 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec) mpeg2_state_t state; state = mpeg2dec->action (mpeg2dec); - if ((int)state >= 0) + if ((int)state > (int)STATE_INTERNAL_NORETURN) return state; } @@ -200,22 +200,18 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec) return STATE_BUFFER; } + mpeg2dec->action = mpeg2_seek_header; switch (mpeg2dec->code) { case 0x00: - mpeg2dec->action = mpeg2_header_picture_start; return mpeg2dec->state; - case 0xb7: - mpeg2dec->action = mpeg2_header_end; - break; case 0xb3: + case 0xb7: case 0xb8: - mpeg2dec->action = mpeg2_parse_header; - break; + return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID; default: mpeg2dec->action = seek_chunk; return STATE_INVALID; } - return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID; } mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) @@ -262,7 +258,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) /* state transition after a sequence header */ case RECEIVED (0x00, STATE_SEQUENCE): - mpeg2dec->action = mpeg2_header_picture_start; case RECEIVED (0xb8, STATE_SEQUENCE): mpeg2_header_sequence_finalize (mpeg2dec); break; @@ -270,7 +265,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) /* other legal state transitions */ case RECEIVED (0x00, STATE_GOP): mpeg2_header_gop_finalize (mpeg2dec); - mpeg2dec->action = mpeg2_header_picture_start; break; case RECEIVED (0x01, STATE_PICTURE): case RECEIVED (0x01, STATE_PICTURE_2ND): @@ -362,8 +356,8 @@ void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id) mpeg2dec->fbuf[1]->buf[2]=buf[2]; mpeg2dec->fbuf[1]->id=NULL; } -// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", -// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); +// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", +// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); } void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf) @@ -398,12 +392,10 @@ void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2) uint32_t mpeg2_accel (uint32_t accel) { if (!mpeg2_accels) { - if (accel & MPEG2_ACCEL_DETECT) - accel |= mpeg2_detect_accel (); - mpeg2_accels = accel |= MPEG2_ACCEL_DETECT; - mpeg2_cpu_state_init (accel); - mpeg2_idct_init (accel); - mpeg2_mc_init (accel); + mpeg2_accels = mpeg2_detect_accel (accel) | MPEG2_ACCEL_DETECT; + mpeg2_cpu_state_init (mpeg2_accels); + mpeg2_idct_init (mpeg2_accels); + mpeg2_mc_init (mpeg2_accels); } return mpeg2_accels & ~MPEG2_ACCEL_DETECT; } diff --git a/libmpeg2/header.c b/libmpeg2/header.c index ae8b228a63..040651d20e 100644 --- a/libmpeg2/header.c +++ b/libmpeg2/header.c @@ -246,7 +246,7 @@ static int sequence_ext (mpeg2dec_t * mpeg2dec) sequence->vbv_buffer_size |= buffer[4] << 21; sequence->frame_period = - sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>2)&3)+1); + sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>5)&3)+1); mpeg2dec->ext_state = SEQ_DISPLAY_EXT; @@ -257,12 +257,11 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec) { uint8_t * buffer = mpeg2dec->chunk_start; mpeg2_sequence_t * sequence = &(mpeg2dec->new_sequence); - uint32_t flags; - flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | - ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT)); + sequence->flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | + ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT)); if (buffer[0] & 1) { - flags |= SEQ_FLAG_COLOUR_DESCRIPTION; + sequence->flags |= SEQ_FLAG_COLOUR_DESCRIPTION; sequence->colour_primaries = buffer[1]; sequence->transfer_characteristics = buffer[2]; sequence->matrix_coefficients = buffer[3]; @@ -281,6 +280,17 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec) return 0; } +static inline void simplify (unsigned int * u, unsigned int * v) +{ + unsigned int a, b, tmp; + + a = *u; b = *v; + while (a) { /* find greatest common divisor */ + tmp = a; a = b % tmp; b = tmp; + } + *u /= b; *v /= b; +} + static inline void finalize_sequence (mpeg2_sequence_t * sequence) { int width; @@ -317,8 +327,10 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence) sequence->pixel_width = 64; sequence->pixel_height = 45; return; case 6: /* 720x480 16:9 */ sequence->pixel_width = 32; sequence->pixel_height = 27; return; - case 12: /* 720*480 4:3 */ - sequence->pixel_width = 8; sequence->pixel_height = 9; return; + case 8: /* BT.601 625 lines 4:3 */ + sequence->pixel_width = 59; sequence->pixel_height = 54; return; + case 12: /* BT.601 525 lines 4:3 */ + sequence->pixel_width = 10; sequence->pixel_height = 11; return; default: height = 88 * sequence->pixel_width + 1171; width = 2000; @@ -327,22 +339,89 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence) sequence->pixel_width = width; sequence->pixel_height = height; - while (width) { /* find greatest common divisor */ - int tmp = width; - width = height % tmp; - height = tmp; - } - sequence->pixel_width /= height; - sequence->pixel_height /= height; + simplify (&sequence->pixel_width, &sequence->pixel_height); } -static void copy_matrix (mpeg2dec_t * mpeg2dec, int index) +int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, + unsigned int * pixel_width, + unsigned int * pixel_height) { - if (memcmp (mpeg2dec->quantizer_matrix[index], - mpeg2dec->new_quantizer_matrix[index], 64)) { - memcpy (mpeg2dec->quantizer_matrix[index], - mpeg2dec->new_quantizer_matrix[index], 64); - mpeg2dec->scaled[index] = -1; + static struct { + unsigned int width, height; + } video_modes[] = { + {720, 576}, /* 625 lines, 13.5 MHz (D1, DV, DVB, DVD) */ + {704, 576}, /* 625 lines, 13.5 MHz (1/1 D1, DVB, DVD, 4CIF) */ + {544, 576}, /* 625 lines, 10.125 MHz (DVB, laserdisc) */ + {528, 576}, /* 625 lines, 10.125 MHz (3/4 D1, DVB, laserdisc) */ + {480, 576}, /* 625 lines, 9 MHz (2/3 D1, DVB, SVCD) */ + {352, 576}, /* 625 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVB, DVD) */ + {352, 288}, /* 625 lines, 6.75 MHz, 1 field (D4, VCD, DVB, DVD, CIF) */ + {176, 144}, /* 625 lines, 3.375 MHz, half field (QCIF) */ + {720, 486}, /* 525 lines, 13.5 MHz (D1) */ + {704, 486}, /* 525 lines, 13.5 MHz */ + {720, 480}, /* 525 lines, 13.5 MHz (DV, DSS, DVD) */ + {704, 480}, /* 525 lines, 13.5 MHz (1/1 D1, ATSC, DVD) */ + {544, 480}, /* 525 lines. 10.125 MHz (DSS, laserdisc) */ + {528, 480}, /* 525 lines. 10.125 MHz (3/4 D1, laserdisc) */ + {480, 480}, /* 525 lines, 9 MHz (2/3 D1, SVCD) */ + {352, 480}, /* 525 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVD) */ + {352, 240} /* 525 lines. 6.75 MHz, 1 field (D4, VCD, DSS, DVD) */ + }; + unsigned int width, height, pix_width, pix_height, i, DAR_16_9; + + *pixel_width = sequence->pixel_width; + *pixel_height = sequence->pixel_height; + width = sequence->picture_width; + height = sequence->picture_height; + for (i = 0; i < sizeof (video_modes) / sizeof (video_modes[0]); i++) + if (width == video_modes[i].width && height == video_modes[i].height) + break; + if (i == sizeof (video_modes) / sizeof (video_modes[0]) || + (sequence->pixel_width == 1 && sequence->pixel_height == 1) || + width != sequence->display_width || height != sequence->display_height) + return 0; + + for (pix_height = 1; height * pix_height < 480; pix_height <<= 1); + height *= pix_height; + for (pix_width = 1; width * pix_width <= 352; pix_width <<= 1); + width *= pix_width; + + if (! (sequence->flags & SEQ_FLAG_MPEG2)) { + static unsigned int mpeg1_check[2][2] = {{11, 54}, {27, 45}}; + DAR_16_9 = (sequence->pixel_height == 27 || + sequence->pixel_height == 45); + if (width < 704 || + sequence->pixel_height != mpeg1_check[DAR_16_9][height == 576]) + return 0; + } else { + DAR_16_9 = (3 * sequence->picture_width * sequence->pixel_width > + 4 * sequence->picture_height * sequence->pixel_height); + switch (width) { + case 528: case 544: pix_width *= 4; pix_height *= 3; break; + case 480: pix_width *= 3; pix_height *= 2; break; + } + } + if (DAR_16_9) { + pix_width *= 4; pix_height *= 3; + } + if (height == 576) { + pix_width *= 59; pix_height *= 54; + } else { + pix_width *= 10; pix_height *= 11; + } + *pixel_width = pix_width; + *pixel_height = pix_height; + simplify (pixel_width, pixel_height); + return (height == 576) ? 1 : 2; +} + +static void copy_matrix (mpeg2dec_t * mpeg2dec, int idx) +{ + if (memcmp (mpeg2dec->quantizer_matrix[idx], + mpeg2dec->new_quantizer_matrix[idx], 64)) { + memcpy (mpeg2dec->quantizer_matrix[idx], + mpeg2dec->new_quantizer_matrix[idx], 64); + mpeg2dec->scaled[idx] = -1; } } @@ -392,31 +471,30 @@ void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec) (sequence->chroma_height == sequence->height)); if (mpeg2dec->sequence.width != (unsigned)-1) { - unsigned int new_byte_rate; - /* * According to 6.1.1.6, repeat sequence headers should be - * identical to the original. However some DVDs dont respect - * that and have different bitrates in the repeat sequence - * headers. So we'll ignore that in the comparison and still - * consider these as repeat sequence headers. - * - * However, be careful not to alter the current sequence when - * returning STATE_INVALID_END. + * identical to the original. However some encoders do not + * respect that and change various fields (including bitrate + * and aspect ratio) in the repeat sequence headers. So we + * choose to be as conservative as possible and only restart + * the decoder if the width, height, chroma_width, + * chroma_height or low_delay flag are modified. */ - new_byte_rate = sequence->byte_rate; - sequence->byte_rate = mpeg2dec->sequence.byte_rate; - if (memcmp (&(mpeg2dec->sequence), sequence, - sizeof (mpeg2_sequence_t))) { + if (sequence->width != mpeg2dec->sequence.width || + sequence->height != mpeg2dec->sequence.height || + sequence->chroma_width != mpeg2dec->sequence.chroma_width || + sequence->chroma_height != mpeg2dec->sequence.chroma_height || + ((sequence->flags ^ mpeg2dec->sequence.flags) & + SEQ_FLAG_LOW_DELAY)) { decoder->stride_frame = sequence->width; - sequence->byte_rate = new_byte_rate; mpeg2_header_end (mpeg2dec); mpeg2dec->action = invalid_end_action; mpeg2dec->state = STATE_INVALID_END; return; } - sequence->byte_rate = new_byte_rate; - mpeg2dec->state = STATE_SEQUENCE_REPEATED; + mpeg2dec->state = (memcmp (&(mpeg2dec->sequence), sequence, + sizeof (mpeg2_sequence_t)) ? + STATE_SEQUENCE_MODIFIED : STATE_SEQUENCE_REPEATED); } else decoder->stride_frame = sequence->width; mpeg2dec->sequence = *sequence; @@ -468,34 +546,6 @@ void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type) } } -mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec) -{ - mpeg2_picture_t * picture = &(mpeg2dec->new_picture); - - mpeg2dec->state = ((mpeg2dec->state != STATE_SLICE_1ST) ? - STATE_PICTURE : STATE_PICTURE_2ND); - picture->flags = 0; - picture->tag = picture->tag2 = 0; - if (mpeg2dec->num_tags) { - if (mpeg2dec->bytes_since_tag >= 4) { - mpeg2dec->num_tags = 0; - picture->tag = mpeg2dec->tag_current; - picture->tag2 = mpeg2dec->tag2_current; - picture->flags = PIC_FLAG_TAGS; - } else if (mpeg2dec->num_tags > 1) { - mpeg2dec->num_tags = 1; - picture->tag = mpeg2dec->tag_previous; - picture->tag2 = mpeg2dec->tag2_previous; - picture->flags = PIC_FLAG_TAGS; - } - } - picture->display_offset[0].x = picture->display_offset[1].x = - picture->display_offset[2].x = mpeg2dec->display_offset_x; - picture->display_offset[0].y = picture->display_offset[1].y = - picture->display_offset[2].y = mpeg2dec->display_offset_y; - return mpeg2_parse_header (mpeg2dec); -} - int mpeg2_header_picture (mpeg2dec_t * mpeg2dec) { uint8_t * buffer = mpeg2dec->chunk_start; @@ -503,13 +553,13 @@ int mpeg2_header_picture (mpeg2dec_t * mpeg2dec) mpeg2_decoder_t * decoder = &(mpeg2dec->decoder); int type; - type = (buffer [1] >> 3) & 7; + mpeg2dec->state = ((mpeg2dec->state != STATE_SLICE_1ST) ? + STATE_PICTURE : STATE_PICTURE_2ND); mpeg2dec->ext_state = PIC_CODING_EXT; picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6); - picture->flags |= type; - + type = (buffer [1] >> 3) & 7; if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B) { /* forward_f_code and backward_f_code - used in mpeg1 only */ decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1; @@ -519,11 +569,30 @@ int mpeg2_header_picture (mpeg2dec_t * mpeg2dec) decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1; } + picture->flags = PIC_FLAG_PROGRESSIVE_FRAME | type; + picture->tag = picture->tag2 = 0; + if (mpeg2dec->num_tags) { + if (mpeg2dec->bytes_since_tag >= mpeg2dec->chunk_ptr - buffer + 4) { + mpeg2dec->num_tags = 0; + picture->tag = mpeg2dec->tag_current; + picture->tag2 = mpeg2dec->tag2_current; + picture->flags |= PIC_FLAG_TAGS; + } else if (mpeg2dec->num_tags > 1) { + mpeg2dec->num_tags = 1; + picture->tag = mpeg2dec->tag_previous; + picture->tag2 = mpeg2dec->tag2_previous; + picture->flags |= PIC_FLAG_TAGS; + } + } + picture->nb_fields = 2; + picture->display_offset[0].x = picture->display_offset[1].x = + picture->display_offset[2].x = mpeg2dec->display_offset_x; + picture->display_offset[0].y = picture->display_offset[1].y = + picture->display_offset[2].y = mpeg2dec->display_offset_y; + /* XXXXXX decode extra_information_picture as well */ - picture->nb_fields = 2; - - mpeg2dec->q_scale_type = 0; + decoder->q_scale_type = 0; decoder->intra_dc_precision = 7; decoder->frame_pred_frame_dct = 1; decoder->concealment_motion_vectors = 0; @@ -570,10 +639,11 @@ static int picture_coding_ext (mpeg2dec_t * mpeg2dec) decoder->top_field_first = buffer[3] >> 7; decoder->frame_pred_frame_dct = (buffer[3] >> 6) & 1; decoder->concealment_motion_vectors = (buffer[3] >> 5) & 1; - mpeg2dec->q_scale_type = buffer[3] & 16; + decoder->q_scale_type = buffer[3] & 16; decoder->intra_vlc_format = (buffer[3] >> 3) & 1; decoder->scan = (buffer[3] & 4) ? mpeg2_scan_alt : mpeg2_scan_norm; - flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0; + if (!(buffer[4] & 0x80)) + flags &= ~PIC_FLAG_PROGRESSIVE_FRAME; if (buffer[4] & 0x40) flags |= (((buffer[4]<<26) | (buffer[5]<<18) | (buffer[6]<<10)) & PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY; @@ -794,7 +864,7 @@ int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec) return 0; } -static void prescale (mpeg2dec_t * mpeg2dec, int index) +static void prescale (mpeg2dec_t * mpeg2dec, int idx) { static int non_linear_scale [] = { 0, 1, 2, 3, 4, 5, 6, 7, @@ -805,14 +875,14 @@ static void prescale (mpeg2dec_t * mpeg2dec, int index) int i, j, k; mpeg2_decoder_t * decoder = &(mpeg2dec->decoder); - if (mpeg2dec->scaled[index] != mpeg2dec->q_scale_type) { - mpeg2dec->scaled[index] = mpeg2dec->q_scale_type; + if (mpeg2dec->scaled[idx] != decoder->q_scale_type) { + mpeg2dec->scaled[idx] = decoder->q_scale_type; for (i = 0; i < 32; i++) { - k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); + k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1); decoder->quantizer_scales[i] = k; for (j = 0; j < 64; j++) - decoder->quantizer_prescale[index][i][j] = - k * mpeg2dec->quantizer_matrix[index][j]; + decoder->quantizer_prescale[idx][i][j] = + k * mpeg2dec->quantizer_matrix[idx][j]; } } } @@ -864,7 +934,7 @@ mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec) mpeg2dec->fbuf[b_type]->buf); } mpeg2dec->action = NULL; - return (mpeg2_state_t)-1; + return STATE_INTERNAL_NORETURN; } static mpeg2_state_t seek_sequence (mpeg2dec_t * mpeg2dec) diff --git a/libmpeg2/idct.c b/libmpeg2/idct.c index e3f88dad30..82049df4bc 100644 --- a/libmpeg2/idct.c +++ b/libmpeg2/idct.c @@ -283,8 +283,6 @@ void mpeg2_idct_init (uint32_t accel) } else #endif { - extern uint8_t mpeg2_scan_norm[64]; - extern uint8_t mpeg2_scan_alt[64]; int i, j; mpeg2_idct_copy = mpeg2_idct_copy_c; diff --git a/libmpeg2/idct_alpha.c b/libmpeg2/idct_alpha.c index 007185bf18..bc2f886492 100644 --- a/libmpeg2/idct_alpha.c +++ b/libmpeg2/idct_alpha.c @@ -364,8 +364,6 @@ void mpeg2_idct_add_alpha (const int last, int16_t * block, void mpeg2_idct_alpha_init (void) { - extern uint8_t mpeg2_scan_norm[64]; - extern uint8_t mpeg2_scan_alt[64]; int i, j; for (i = 0; i < 64; i++) { diff --git a/libmpeg2/idct_altivec.c b/libmpeg2/idct_altivec.c index 381ef069f0..b5b395a205 100644 --- a/libmpeg2/idct_altivec.c +++ b/libmpeg2/idct_altivec.c @@ -272,8 +272,6 @@ void mpeg2_idct_add_altivec (const int last, int16_t * const _block, void mpeg2_idct_altivec_init (void) { - extern uint8_t mpeg2_scan_norm[64]; - extern uint8_t mpeg2_scan_alt[64]; int i, j; /* the altivec idct uses a transposed input, so we patch scan tables */ diff --git a/libmpeg2/idct_mmx.c b/libmpeg2/idct_mmx.c index a682284dab..50f8f18c3e 100644 --- a/libmpeg2/idct_mmx.c +++ b/libmpeg2/idct_mmx.c @@ -19,10 +19,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ */ #include "config.h" @@ -1294,8 +1290,6 @@ void mpeg2_idct_add_mmx (const int last, int16_t * const block, void mpeg2_idct_mmx_init (void) { - extern uint8_t mpeg2_scan_norm[64]; - extern uint8_t mpeg2_scan_alt[64]; int i, j; /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */ diff --git a/libmpeg2/mmx.h b/libmpeg2/mmx.h index fcb92870d2..c62be1f581 100644 --- a/libmpeg2/mmx.h +++ b/libmpeg2/mmx.h @@ -21,6 +21,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef LIBMPEG2_MMX_H +#define LIBMPEG2_MMX_H + /* * The type of an value that fits in an MMX register (note that long * long constant values MUST be suffixed by LL and unsigned long long @@ -285,3 +288,5 @@ typedef union { #define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm) #define sfence() __asm__ __volatile__ ("sfence\n\t") + +#endif /* LIBMPEG2_MMX_H */ diff --git a/libmpeg2/motion_comp_arm.c b/libmpeg2/motion_comp_arm.c index c83d57d676..0111f7f8d3 100644 --- a/libmpeg2/motion_comp_arm.c +++ b/libmpeg2/motion_comp_arm.c @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * along with mpeg2dec; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -30,12 +30,12 @@ #include "attributes.h" #include "mpeg2_internal.h" -#define avg2(a,b) ((a+b+1)>>1) +#define avg2(a,b) ((a+b+1)>>1) #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) -#define predict_o(i) (ref[i]) -#define predict_x(i) (avg2 (ref[i], ref[i+1])) -#define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) +#define predict_o(i) (ref[i]) +#define predict_x(i) (avg2 (ref[i], ref[i+1])) +#define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) #define predict_xy(i) (avg4 (ref[i], ref[i+1], \ (ref+stride)[i], (ref+stride)[i+1])) @@ -67,7 +67,7 @@ static void inline MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \ op (predict_##xy, 15); \ ref += stride; \ dest += stride; \ - } while (--height); \ + } while (--height); \ } \ static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ const int stride, int height) \ @@ -83,13 +83,11 @@ static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ op (predict_##xy, 7); \ ref += stride; \ dest += stride; \ - } while (--height); \ + } while (--height); \ } \ /* definitions of the actual mc functions */ -MC_FUNC (put,o) MC_FUNC (avg,o) -MC_FUNC (put,x) MC_FUNC (avg,x) MC_FUNC (put,y) MC_FUNC (avg,y) @@ -117,7 +115,7 @@ static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref, } extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref, - int stride, int height); + int stride, int height); extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref, int stride, int height); diff --git a/libmpeg2/motion_comp_arm_s.S b/libmpeg2/motion_comp_arm_s.S index fd71fb3b83..f6c3d7df8e 100644 --- a/libmpeg2/motion_comp_arm_s.S +++ b/libmpeg2/motion_comp_arm_s.S @@ -15,9 +15,10 @@ @ GNU General Public License for more details. @ @ You should have received a copy of the GNU General Public License -@ along with this program; if not, write to the Free Software +@ along with mpeg2dec; if not, write to the Free Software @ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + .text @ ---------------------------------------------------------------- diff --git a/libmpeg2/motion_comp_mmx.c b/libmpeg2/motion_comp_mmx.c index 964695570a..fc265f4f99 100644 --- a/libmpeg2/motion_comp_mmx.c +++ b/libmpeg2/motion_comp_mmx.c @@ -19,10 +19,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ */ #include "config.h" @@ -67,7 +63,7 @@ static mmx_t round4 = {0x0002000200020002LL}; * unrolling will help */ -static inline void mmx_zero_reg () +static inline void mmx_zero_reg (void) { /* load 0 into mm0 */ pxor_r2r (mm0, mm0); diff --git a/libmpeg2/mpeg2.h b/libmpeg2/mpeg2.h index 08933b5843..8eef2ce716 100644 --- a/libmpeg2/mpeg2.h +++ b/libmpeg2/mpeg2.h @@ -1,6 +1,6 @@ /* * mpeg2.h - * Copyright (C) 2000-2003 Michel Lespinasse + * Copyright (C) 2000-2004 Michel Lespinasse * Copyright (C) 1999-2000 Aaron Holtzman * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. @@ -25,11 +25,11 @@ * $Id$ */ -#ifndef MPEG2_H -#define MPEG2_H +#ifndef LIBMPEG2_MPEG2_H +#define LIBMPEG2_MPEG2_H #define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) -#define MPEG2_RELEASE MPEG2_VERSION (0, 4, 1) /* 0.4.1 */ +#define MPEG2_RELEASE MPEG2_VERSION (0, 5, 1) /* 0.5.1 */ #define SEQ_FLAG_MPEG2 1 #define SEQ_FLAG_CONSTRAINED_PARAMETERS 2 @@ -132,7 +132,8 @@ typedef enum { STATE_SLICE = 7, STATE_END = 8, STATE_INVALID = 9, - STATE_INVALID_END = 10 + STATE_INVALID_END = 10, + STATE_SEQUENCE_MODIFIED = 11 } mpeg2_state_t; typedef struct mpeg2_convert_init_s { @@ -160,6 +161,7 @@ void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf); #define MPEG2_ACCEL_X86_3DNOW 2 #define MPEG2_ACCEL_X86_MMXEXT 4 #define MPEG2_ACCEL_X86_SSE2 8 +#define MPEG2_ACCEL_X86_SSE3 16 #define MPEG2_ACCEL_PPC_ALTIVEC 1 #define MPEG2_ACCEL_ALPHA 1 #define MPEG2_ACCEL_ALPHA_MVI 2 @@ -187,6 +189,9 @@ void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2); void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3], uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]); void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer); +int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, + unsigned int * pixel_width, + unsigned int * pixel_height); typedef enum { MPEG2_ALLOC_MPEG2DEC = 0, @@ -201,4 +206,4 @@ void mpeg2_free (void * buf); void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t), int free (void *)); -#endif /* MPEG2_H */ +#endif /* LIBMPEG2_MPEG2_H */ diff --git a/libmpeg2/mpeg2_internal.h b/libmpeg2/mpeg2_internal.h index 04a31f6926..ee4fc32062 100644 --- a/libmpeg2/mpeg2_internal.h +++ b/libmpeg2/mpeg2_internal.h @@ -25,6 +25,11 @@ * $Id$ */ +#ifndef LIBMPEG2_MPEG2_INTERNAL_H +#define LIBMPEG2_MPEG2_INTERNAL_H + +#define STATE_INTERNAL_NORETURN ((mpeg2_state_t)-1) + /* macroblock modes */ #define MACROBLOCK_INTRA 1 #define MACROBLOCK_PATTERN 2 @@ -149,6 +154,9 @@ struct mpeg2_decoder_s { int mpeg1; + /* XXX: stuff due to xine shit */ + int8_t q_scale_type; + int quantizer_scales[32]; int quantizer_scale; char* quant_store; @@ -220,7 +228,8 @@ struct mpeg2dec_s { int16_t display_offset_x, display_offset_y; int copy_matrix; - int8_t q_scale_type, scaled[4]; + int8_t scaled[4]; /* XXX: MOVED */ + //int8_t q_scale_type, scaled[4]; uint8_t quantizer_matrix[4][64]; uint8_t new_quantizer_matrix[4][64]; @@ -236,7 +245,7 @@ typedef struct { } cpu_state_t; /* cpu_accel.c */ -uint32_t mpeg2_detect_accel (void); +uint32_t mpeg2_detect_accel (uint32_t accel); /* cpu_state.c */ void mpeg2_cpu_state_init (uint32_t accel); @@ -262,7 +271,9 @@ mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec); void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type); /* idct.c */ -void mpeg2_idct_init (uint32_t accel); +extern void mpeg2_idct_init (uint32_t accel); +extern uint8_t mpeg2_scan_norm[64]; +extern uint8_t mpeg2_scan_alt[64]; /* idct_mmx.c */ void mpeg2_idct_copy_sse2 (int16_t * block, uint8_t * dest, int stride); @@ -315,3 +326,5 @@ extern mpeg2_mc_t mpeg2_mc_alpha; extern mpeg2_mc_t mpeg2_mc_vis; extern mpeg2_mc_t mpeg2_mc_arm; extern mpeg2_mc_t mpeg2_mc_iwmmxt; + +#endif /* LIBMPEG2_MPEG2_INTERNAL_H */ diff --git a/libmpeg2/slice.c b/libmpeg2/slice.c index 4d778a7026..99fcf95c22 100644 --- a/libmpeg2/slice.c +++ b/libmpeg2/slice.c @@ -450,7 +450,7 @@ static void get_intra_block_B14 (mpeg2_decoder_t * const decoder, break; /* illegal, check needed to avoid buffer overflow */ } dest[63] ^= mismatch & 16; - DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ + DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ decoder->bitstream_buf = bit_buf; decoder->bitstream_bits = bits; decoder->bitstream_ptr = bit_ptr; @@ -508,7 +508,7 @@ static void get_intra_block_B15 (mpeg2_decoder_t * const decoder, } else { /* end of block. I commented out this code because if we */ - /* dont exit here we will still exit at the later test :) */ + /* do not exit here we will still exit at the later test :) */ /* if (i >= 128) break; */ /* end of block */ @@ -560,7 +560,7 @@ static void get_intra_block_B15 (mpeg2_decoder_t * const decoder, break; /* illegal, check needed to avoid buffer overflow */ } dest[63] ^= mismatch & 16; - DUMPBITS (bit_buf, bits, 4); /* dump end of block code */ + DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ decoder->bitstream_buf = bit_buf; decoder->bitstream_bits = bits; decoder->bitstream_ptr = bit_ptr; @@ -681,7 +681,7 @@ static int get_non_intra_block (mpeg2_decoder_t * const decoder, break; /* illegal, check needed to avoid buffer overflow */ } dest[63] ^= mismatch & 16; - DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ + DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ decoder->bitstream_buf = bit_buf; decoder->bitstream_bits = bits; decoder->bitstream_ptr = bit_ptr; @@ -799,7 +799,7 @@ static void get_mpeg1_intra_block (mpeg2_decoder_t * const decoder) } break; /* illegal, check needed to avoid buffer overflow */ } - DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ + DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ decoder->bitstream_buf = bit_buf; decoder->bitstream_bits = bits; decoder->bitstream_ptr = bit_ptr; @@ -926,7 +926,7 @@ static int get_mpeg1_non_intra_block (mpeg2_decoder_t * const decoder) } break; /* illegal, check needed to avoid buffer overflow */ } - DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ + DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ decoder->bitstream_buf = bit_buf; decoder->bitstream_bits = bits; decoder->bitstream_ptr = bit_ptr; @@ -1569,18 +1569,24 @@ do { \ #define NEXT_MACROBLOCK \ do { \ - if(decoder->quant_store) { \ - if (decoder->picture_structure == TOP_FIELD) \ - decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ - +(decoder->offset>>4)] = decoder->quantizer_scale; \ - else if (decoder->picture_structure == BOTTOM_FIELD) \ - decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ - + decoder->quant_stride \ - +(decoder->offset>>4)] = decoder->quantizer_scale; \ - else \ - decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \ - +(decoder->offset>>4)] = decoder->quantizer_scale; \ - } \ + if(decoder->quant_store) { \ + if (decoder->picture_structure == TOP_FIELD) \ + decoder->quant_store[2 * decoder->quant_stride \ + * (decoder->v_offset >> 4) \ + + (decoder->offset >> 4)] \ + = decoder->quantizer_scale; \ + else if (decoder->picture_structure == BOTTOM_FIELD) \ + decoder->quant_store[2 * decoder->quant_stride \ + * (decoder->v_offset >> 4) \ + + decoder->quant_stride \ + + (decoder->offset >> 4)] \ + = decoder->quantizer_scale; \ + else \ + decoder->quant_store[decoder->quant_stride \ + * (decoder->v_offset >> 4) \ + + (decoder->offset >> 4)] \ + = decoder->quantizer_scale; \ + } \ decoder->offset += 16; \ if (decoder->offset == decoder->width) { \ do { /* just so we can use the break statement */ \ @@ -1604,6 +1610,10 @@ do { \ } \ } while (0) +/** + * Dummy motion decoding function, to avoid calling NULL in + * case of malformed streams. + */ static void motion_dummy (mpeg2_decoder_t * const decoder, motion_t * const motion, mpeg2_mc_fct * const * const table) @@ -1668,7 +1678,7 @@ void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3], if (decoder->mpeg1) { decoder->motion_parser[0] = motion_zero_420; decoder->motion_parser[MC_FIELD] = motion_dummy; - decoder->motion_parser[MC_FRAME] = motion_mp1; + decoder->motion_parser[MC_FRAME] = motion_mp1; decoder->motion_parser[MC_DMV] = motion_dummy; decoder->motion_parser[4] = motion_reuse_420; } else if (decoder->picture_structure == FRAME_PICTURE) { @@ -1894,6 +1904,14 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code, motion_parser_t * parser; + if ( ((macroblock_modes >> MOTION_TYPE_SHIFT) < 0) + || ((macroblock_modes >> MOTION_TYPE_SHIFT) >= + (int)(sizeof(decoder->motion_parser) + / sizeof(decoder->motion_parser[0]))) + ) { + break; // Illegal ! + } + parser = decoder->motion_parser[macroblock_modes >> MOTION_TYPE_SHIFT]; MOTION_CALL (parser, macroblock_modes); diff --git a/libmpeg2/vis.h b/libmpeg2/vis.h index 69dd49075b..8324c3eb2e 100644 --- a/libmpeg2/vis.h +++ b/libmpeg2/vis.h @@ -41,6 +41,9 @@ * the assembler to keep the binary from becoming tainted. */ +#ifndef LIBMPEG2_VIS_H +#define LIBMPEG2_VIS_H + #define vis_opc_base ((0x1 << 31) | (0x36 << 19)) #define vis_opf(X) ((X) << 5) #define vis_sreg(X) (X) @@ -326,3 +329,5 @@ static inline void vis_alignaddrl_g0(void *_ptr) /* Pixel component distance. */ #define vis_pdist(rs1,rs2,rd) vis_dd2d(0x3e, rs1, rs2, rd) + +#endif /* LIBMPEG2_VIS_H */ diff --git a/libmpeg2/vlc.h b/libmpeg2/vlc.h index 7098ee0f9b..b3a868e54b 100644 --- a/libmpeg2/vlc.h +++ b/libmpeg2/vlc.h @@ -21,6 +21,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef LIBMPEG2_VLC_H +#define LIBMPEG2_VLC_H + #define GETWORD(bit_buf,shift,bit_ptr) \ do { \ bit_buf |= ((bit_ptr[0] << 8) | bit_ptr[1]) << (shift); \ @@ -121,7 +124,7 @@ static const MBtab MB_P [] = { #define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD static const MBtab MB_B [] = { - {0, 0}, {INTRA|QUANT, 6}, + {0, 6}, {INTRA|QUANT, 6}, {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6}, {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5}, {INTRA, 5}, {INTRA, 5}, @@ -201,7 +204,7 @@ static const CBPtab CBP_7 [] = { }; static const CBPtab CBP_9 [] = { - {0, 0}, {0x00, 9}, {0x39, 9}, {0x36, 9}, + {0, 9}, {0x00, 9}, {0x39, 9}, {0x36, 9}, {0x37, 9}, {0x3b, 9}, {0x3d, 9}, {0x3e, 9}, {0x17, 8}, {0x17, 8}, {0x1b, 8}, {0x1b, 8}, {0x1d, 8}, {0x1d, 8}, {0x1e, 8}, {0x1e, 8}, @@ -289,7 +292,7 @@ static const DCTtab DCT_B14_10 [] = { }; static const DCTtab DCT_B14_8 [] = { - { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, + { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7}, { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, @@ -326,7 +329,7 @@ static const DCTtab DCT_B15_10 [] = { }; static const DCTtab DCT_B15_8 [] = { - { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, + { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7}, { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, @@ -427,3 +430,5 @@ static const MBAtab MBA_11 [] = { { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7} }; + +#endif /* LIBMPEG2_VLC_H */ From 6ed300cfcb1184a006fec9741bd61533cdb4518e Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 13 Sep 2008 17:33:04 +0000 Subject: [PATCH 32/76] Sync diff with libmpeg2 update. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27605 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpeg2/libmpeg2_changes.diff | 829 ++++----------------------------- 1 file changed, 81 insertions(+), 748 deletions(-) diff --git a/libmpeg2/libmpeg2_changes.diff b/libmpeg2/libmpeg2_changes.diff index 476cf99643..52fe7aa792 100644 --- a/libmpeg2/libmpeg2_changes.diff +++ b/libmpeg2/libmpeg2_changes.diff @@ -1,122 +1,44 @@ --- libmpeg2/cpu_accel.c 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/cpu_accel.c 2006-06-16 20:12:50.000000000 +0200 -@@ -22,6 +26,7 @@ - */ - - #include "config.h" -+#include "cpudetect.h" - - #include - -@@ -30,9 +35,17 @@ - #include "mpeg2_internal.h" - - #ifdef ACCEL_DETECT --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) -+ -+/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow! -+ * instructions via assembly. However, it is regarded as duplicated work -+ * in MPlayer, so that we enforce using MPlayer's implementation. -+ */ -+#define MPLAYER_CPUDETECT -+ - static inline uint32_t arch_accel (void) - { -+#if !defined(MPLAYER_CPUDETECT) - uint32_t eax, ebx, ecx, edx; - int AMD; - uint32_t caps; -@@ -107,8 +120,22 @@ - caps |= MPEG2_ACCEL_X86_MMXEXT; - - return caps; -+#else /* MPLAYER_CPUDETECT: Use MPlayer's CPU capability property. */ -+ caps = 0; -+ if (gCpuCaps.hasMMX) -+ caps |= MPEG2_ACCEL_X86_MMX; -+ if (gCpuCaps.hasSSE2) -+ caps |= MPEG2_ACCEL_X86_SSE2; -+ if (gCpuCaps.hasMMX2) -+ caps |= MPEG2_ACCEL_X86_MMXEXT; -+ if (gCpuCaps.has3DNow) -+ caps |= MPEG2_ACCEL_X86_3DNOW; -+ -+ return caps; -+ -+#endif /* MPLAYER_CPUDETECT */ - } --#endif /* ARCH_X86 */ -+#endif /* ARCH_X86 || ARCH_X86_64 */ - - #if defined(ARCH_PPC) || defined(ARCH_SPARC) - #include -@@ -214,7 +241,7 @@ - - accel = 0; - #ifdef ACCEL_DETECT --#if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) -+#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) - accel = arch_accel (); - #endif - #endif ---- libmpeg2/cpu_state.c 2006-06-16 20:12:26.000000000 +0200 -+++ libmpeg2/cpu_state.c 2006-06-16 20:12:50.000000000 +0200 -@@ -29,14 +33,14 @@ - #include "mpeg2.h" +@@ -29,9 +33,13 @@ #include "attributes.h" #include "mpeg2_internal.h" --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) - #include "mmx.h" - #endif - void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL; - void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL; - --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) - static void state_restore_mmx (cpu_state_t * state) ++#include "cpudetect.h" ++ + #if defined(ARCH_X86) || defined(ARCH_X86_64) + static inline uint32_t arch_accel (uint32_t accel) { - emms (); -@@ -44,18 +48,18 @@ - #endif ++/* Use MPlayer CPU detection instead of libmpeg2 variant. */ ++#if 0 + if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT)) + accel |= MPEG2_ACCEL_X86_MMX; + +@@ -124,6 +132,21 @@ + #endif /* ACCEL_DETECT */ - #ifdef ARCH_PPC --#ifdef HAVE_ALTIVEC_H /* gnu */ --#define LI(a,b) "li " #a "," #b "\n\t" --#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t" --#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t" --#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t" --#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t" --#else /* apple */ -+#if defined(__APPLE_CC__) /* apple */ - #define LI(a,b) "li r" #a "," #b "\n\t" - #define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t" - #define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t" - #define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t" - #define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t" -+#else /* gnu */ -+#define LI(a,b) "li " #a "," #b "\n\t" -+#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t" -+#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t" -+#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t" -+#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t" - #endif + return accel; ++ ++#else /* 0 */ ++ accel = 0; ++ if (gCpuCaps.hasMMX) ++ accel |= MPEG2_ACCEL_X86_MMX; ++ if (gCpuCaps.hasSSE2) ++ accel |= MPEG2_ACCEL_X86_SSE2; ++ if (gCpuCaps.hasMMX2) ++ accel |= MPEG2_ACCEL_X86_MMXEXT; ++ if (gCpuCaps.has3DNow) ++ accel |= MPEG2_ACCEL_X86_3DNOW; ++ ++ return accel; ++ ++#endif /* 0 */ + } + #endif /* ARCH_X86 || ARCH_X86_64 */ - static void state_save_altivec (cpu_state_t * state) -@@ -115,7 +119,7 @@ - - void mpeg2_cpu_state_init (uint32_t accel) - { --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) - if (accel & MPEG2_ACCEL_X86_MMX) { - mpeg2_cpu_state_restore = state_restore_mmx; - } --- libmpeg2/decode.c 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/decode.c 2006-06-16 20:12:50.000000000 +0200 -@@ -351,6 +355,15 @@ +@@ -345,6 +349,15 @@ fbuf->buf[1] = buf[1]; fbuf->buf[2] = buf[2]; fbuf->id = id; @@ -127,8 +49,8 @@ + mpeg2dec->fbuf[1]->buf[2]=buf[2]; + mpeg2dec->fbuf[1]->id=NULL; + } -+// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", -+// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); ++// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", ++// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); } void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf) @@ -144,37 +66,30 @@ mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf; mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf; mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf; -@@ -553,6 +560,7 @@ - if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) { - picture->nb_fields = (buffer[3] & 2) ? 3 : 2; - flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0; -+ flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0; - } else - picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2; - break; -@@ -801,6 +809,7 @@ - mpeg2dec->scaled[index] = mpeg2dec->q_scale_type; +@@ -872,6 +879,7 @@ + mpeg2dec->scaled[idx] = decoder->q_scale_type; for (i = 0; i < 32; i++) { - k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); + k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1); + decoder->quantizer_scales[i] = k; for (j = 0; j < 64; j++) - decoder->quantizer_prescale[index][i][j] = - k * mpeg2dec->quantizer_matrix[index][j]; + decoder->quantizer_prescale[idx][i][j] = + k * mpeg2dec->quantizer_matrix[idx][j]; --- libmpeg2/idct.c (revision 26652) +++ libmpeg2/idct.c (working copy) -@@ -235,30 +239,40 @@ +@@ -235,34 +239,40 @@ void mpeg2_idct_init (uint32_t accel) { -#ifdef ARCH_X86 +#ifdef HAVE_SSE2 -+ if (accel & MPEG2_ACCEL_X86_SSE2) { -+ mpeg2_idct_copy = mpeg2_idct_copy_sse2; -+ mpeg2_idct_add = mpeg2_idct_add_sse2; -+ mpeg2_idct_mmx_init (); + if (accel & MPEG2_ACCEL_X86_SSE2) { + mpeg2_idct_copy = mpeg2_idct_copy_sse2; + mpeg2_idct_add = mpeg2_idct_add_sse2; + mpeg2_idct_mmx_init (); +- } else if (accel & MPEG2_ACCEL_X86_MMXEXT) { + } else +#elif HAVE_MMX2 - if (accel & MPEG2_ACCEL_X86_MMXEXT) { ++ if (accel & MPEG2_ACCEL_X86_MMXEXT) { mpeg2_idct_copy = mpeg2_idct_copy_mmxext; mpeg2_idct_add = mpeg2_idct_add_mmxext; mpeg2_idct_mmx_init (); @@ -208,17 +123,6 @@ int i; mpeg2_idct_copy = mpeg2_idct_copy_alpha; ---- libmpeg2/idct_mmx.c 2006-06-16 20:12:26.000000000 +0200 -+++ libmpeg2/idct_mmx.c 2006-06-16 20:12:50.000000000 +0200 -@@ -23,7 +27,7 @@ - - #include "config.h" - --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) - - #include - --- libmpeg2/motion_comp.c 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/motion_comp.c 2006-06-16 20:12:50.000000000 +0200 @@ -33,16 +37,22 @@ @@ -248,7 +152,7 @@ if (accel & MPEG2_ACCEL_PPC_ALTIVEC) mpeg2_mc = mpeg2_mc_altivec; else -@@ -52,11 +62,21 @@ +@@ -52,15 +62,20 @@ mpeg2_mc = mpeg2_mc_alpha; else #endif @@ -258,61 +162,36 @@ mpeg2_mc = mpeg2_mc_vis; else #endif -+#ifdef ARCH_ARM + #ifdef ARCH_ARM +- if (accel & MPEG2_ACCEL_ARM) { +#ifdef HAVE_IWMMXT + if (accel & MPEG2_ACCEL_ARM_IWMMXT) + mpeg2_mc = mpeg2_mc_iwmmxt; + else +#endif + if (accel & MPEG2_ACCEL_ARM) -+ mpeg2_mc = mpeg2_mc_arm; + mpeg2_mc = mpeg2_mc_arm; +- } else + else -+#endif + #endif mpeg2_mc = mpeg2_mc_c; } - ---- libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:26.000000000 +0200 -+++ libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:50.000000000 +0200 -@@ -23,7 +27,7 @@ - - #include "config.h" - --#ifdef ARCH_X86 -+#if defined(ARCH_X86) || defined(ARCH_X86_64) - - #include - --- include/mpeg2.h 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/mpeg2.h 2006-06-16 20:12:50.000000000 +0200 -@@ -82,6 +86,7 @@ - #define PIC_FLAG_COMPOSITE_DISPLAY 32 - #define PIC_FLAG_SKIP 64 - #define PIC_FLAG_TAGS 128 -+#define PIC_FLAG_REPEAT_FIRST_FIELD 256 - #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000 - - typedef struct mpeg2_picture_s { -@@ -154,11 +159,14 @@ - #define MPEG2_ACCEL_X86_MMX 1 - #define MPEG2_ACCEL_X86_3DNOW 2 - #define MPEG2_ACCEL_X86_MMXEXT 4 -+#define MPEG2_ACCEL_X86_SSE2 8 - #define MPEG2_ACCEL_PPC_ALTIVEC 1 - #define MPEG2_ACCEL_ALPHA 1 - #define MPEG2_ACCEL_ALPHA_MVI 2 +@@ -164,6 +168,7 @@ #define MPEG2_ACCEL_SPARC_VIS 1 #define MPEG2_ACCEL_SPARC_VIS2 2 -+#define MPEG2_ACCEL_ARM 1 + #define MPEG2_ACCEL_ARM 1 +#define MPEG2_ACCEL_ARM_IWMMXT 2 #define MPEG2_ACCEL_DETECT 0x80000000 uint32_t mpeg2_accel (uint32_t accel); --- libmpeg2/mpeg2_internal.h 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/mpeg2_internal.h 2006-06-16 20:12:50.000000000 +0200 -@@ -144,6 +148,11 @@ - int second_field; +@@ -152,6 +156,11 @@ - int mpeg1; + /* XXX: stuff due to xine shit */ + int8_t q_scale_type; + + int quantizer_scales[32]; + int quantizer_scale; @@ -321,8 +200,8 @@ }; typedef struct { -@@ -214,6 +223,9 @@ - int8_t q_scale_type, scaled[4]; +@@ -223,6 +232,9 @@ + //int8_t q_scale_type, scaled[4]; uint8_t quantizer_matrix[4][64]; uint8_t new_quantizer_matrix[4][64]; + @@ -331,12 +210,13 @@ }; typedef struct { -@@ -298,3 +313,5 @@ - extern mpeg2_mc_t mpeg2_mc_altivec; +@@ -313,5 +325,6 @@ extern mpeg2_mc_t mpeg2_mc_alpha; extern mpeg2_mc_t mpeg2_mc_vis; -+extern mpeg2_mc_t mpeg2_mc_arm; + extern mpeg2_mc_t mpeg2_mc_arm; +extern mpeg2_mc_t mpeg2_mc_iwmmxt; + + #endif /* LIBMPEG2_MPEG2_INTERNAL_H */ --- libmpeg2/slice.c 2006-06-16 20:12:26.000000000 +0200 +++ libmpeg2/slice.c 2006-06-16 20:12:50.000000000 +0200 @@ -142,6 +146,7 @@ @@ -347,578 +227,31 @@ decoder->quantizer_matrix[0] = decoder->quantizer_prescale[0][quantizer_scale_code]; -@@ -1564,6 +1569,18 @@ +@@ -1564,6 +1569,24 @@ #define NEXT_MACROBLOCK \ do { \ -+ if(decoder->quant_store) { \ -+ if (decoder->picture_structure == TOP_FIELD) \ -+ decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ -+ +(decoder->offset>>4)] = decoder->quantizer_scale; \ -+ else if (decoder->picture_structure == BOTTOM_FIELD) \ -+ decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ -+ + decoder->quant_stride \ -+ +(decoder->offset>>4)] = decoder->quantizer_scale; \ -+ else \ -+ decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \ -+ +(decoder->offset>>4)] = decoder->quantizer_scale; \ -+ } \ ++ if(decoder->quant_store) { \ ++ if (decoder->picture_structure == TOP_FIELD) \ ++ decoder->quant_store[2 * decoder->quant_stride \ ++ * (decoder->v_offset >> 4) \ ++ + (decoder->offset >> 4)] \ ++ = decoder->quantizer_scale; \ ++ else if (decoder->picture_structure == BOTTOM_FIELD) \ ++ decoder->quant_store[2 * decoder->quant_stride \ ++ * (decoder->v_offset >> 4) \ ++ + decoder->quant_stride \ ++ + (decoder->offset >> 4)] \ ++ = decoder->quantizer_scale; \ ++ else \ ++ decoder->quant_store[decoder->quant_stride \ ++ * (decoder->v_offset >> 4) \ ++ + (decoder->offset >> 4)] \ ++ = decoder->quantizer_scale; \ ++ } \ decoder->offset += 16; \ if (decoder->offset == decoder->width) { \ do { /* just so we can use the break statement */ \ -@@ -1587,6 +1604,12 @@ - } \ - } while (0) - -+static void motion_dummy (mpeg2_decoder_t * const decoder, -+ motion_t * const motion, -+ mpeg2_mc_fct * const * const table) -+{ -+} -+ - void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3], - uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]) - { -@@ -1644,7 +1667,9 @@ - - if (decoder->mpeg1) { - decoder->motion_parser[0] = motion_zero_420; -+ decoder->motion_parser[MC_FIELD] = motion_dummy; - decoder->motion_parser[MC_FRAME] = motion_mp1; -+ decoder->motion_parser[MC_DMV] = motion_dummy; - decoder->motion_parser[4] = motion_reuse_420; - } else if (decoder->picture_structure == FRAME_PICTURE) { - if (decoder->chroma_format == 0) { ---- libmpeg2/idct_altivec.c 2004/08/02 11:26:43 12933 -+++ libmpeg2/idct_altivec.c 2005/05/15 20:11:34 15484 -@@ -41,7 +41,7 @@ - typedef vector signed int vector_s32_t; - typedef vector unsigned int vector_u32_t; - --#if defined(HAVE_ALTIVEC_H) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303) -+#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_CC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303) - /* work around gcc <3.3 vec_mergel bug */ - static inline vector_s16_t my_vec_mergel (vector_s16_t const A, - vector_s16_t const B) -Index: libmpeg2/motion_comp_arm.c -=================================================================== ---- libmpeg2/motion_comp_arm.c (revision 0) -+++ libmpeg2/motion_comp_arm.c (revision 0) -@@ -0,0 +1,187 @@ -+/* -+ * motion_comp_arm.c -+ * Copyright (C) 2004 AGAWA Koji -+ * -+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. -+ * See http://libmpeg2.sourceforge.net/ for updates. -+ * -+ * mpeg2dec is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * mpeg2dec is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include "config.h" -+ -+#ifdef ARCH_ARM -+ -+#include -+ -+#include "mpeg2.h" -+#include "attributes.h" -+#include "mpeg2_internal.h" -+ -+#define avg2(a,b) ((a+b+1)>>1) -+#define avg4(a,b,c,d) ((a+b+c+d+2)>>2) -+ -+#define predict_o(i) (ref[i]) -+#define predict_x(i) (avg2 (ref[i], ref[i+1])) -+#define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) -+#define predict_xy(i) (avg4 (ref[i], ref[i+1], \ -+ (ref+stride)[i], (ref+stride)[i+1])) -+ -+#define put(predictor,i) dest[i] = predictor (i) -+#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i]) -+ -+/* mc function template */ -+ -+#define MC_FUNC(op,xy) \ -+static void inline MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \ -+ const int stride, int height) \ -+{ \ -+ do { \ -+ op (predict_##xy, 0); \ -+ op (predict_##xy, 1); \ -+ op (predict_##xy, 2); \ -+ op (predict_##xy, 3); \ -+ op (predict_##xy, 4); \ -+ op (predict_##xy, 5); \ -+ op (predict_##xy, 6); \ -+ op (predict_##xy, 7); \ -+ op (predict_##xy, 8); \ -+ op (predict_##xy, 9); \ -+ op (predict_##xy, 10); \ -+ op (predict_##xy, 11); \ -+ op (predict_##xy, 12); \ -+ op (predict_##xy, 13); \ -+ op (predict_##xy, 14); \ -+ op (predict_##xy, 15); \ -+ ref += stride; \ -+ dest += stride; \ -+ } while (--height); \ -+} \ -+static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ -+ const int stride, int height) \ -+{ \ -+ do { \ -+ op (predict_##xy, 0); \ -+ op (predict_##xy, 1); \ -+ op (predict_##xy, 2); \ -+ op (predict_##xy, 3); \ -+ op (predict_##xy, 4); \ -+ op (predict_##xy, 5); \ -+ op (predict_##xy, 6); \ -+ op (predict_##xy, 7); \ -+ ref += stride; \ -+ dest += stride; \ -+ } while (--height); \ -+} \ -+/* definitions of the actual mc functions */ -+ -+MC_FUNC (put,o) -+MC_FUNC (avg,o) -+MC_FUNC (put,x) -+MC_FUNC (avg,x) -+MC_FUNC (put,y) -+MC_FUNC (avg,y) -+MC_FUNC (put,xy) -+MC_FUNC (avg,xy) -+ -+ -+extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height); -+ -+extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height); -+ -+ -+static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_put_y_16_c(dest, ref, stride, height); -+} -+ -+static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_put_xy_16_c(dest, ref, stride, height); -+} -+ -+extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height); -+ -+extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height); -+ -+static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_put_y_8_c(dest, ref, stride, height); -+} -+ -+static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_put_xy_8_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_o_16_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_x_16_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_y_16_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_xy_16_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_o_8_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_x_8_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_y_8_c(dest, ref, stride, height); -+} -+ -+static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref, -+ int stride, int height) -+{ -+ MC_avg_xy_8_c(dest, ref, stride, height); -+} -+ -+MPEG2_MC_EXTERN (arm) -+ -+#endif -Index: libmpeg2/motion_comp_arm_s.S -=================================================================== ---- libmpeg2/motion_comp_arm_s.S (revision 0) -+++ libmpeg2/motion_comp_arm_s.S (revision 0) -@@ -0,0 +1,322 @@ -+@ motion_comp_arm_s.S -+@ Copyright (C) 2004 AGAWA Koji -+@ -+@ This file is part of mpeg2dec, a free MPEG-2 video stream decoder. -+@ See http://libmpeg2.sourceforge.net/ for updates. -+@ -+@ mpeg2dec is free software; you can redistribute it and/or modify -+@ it under the terms of the GNU General Public License as published by -+@ the Free Software Foundation; either version 2 of the License, or -+@ (at your option) any later version. -+@ -+@ mpeg2dec is distributed in the hope that it will be useful, -+@ but WITHOUT ANY WARRANTY; without even the implied warranty of -+@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+@ GNU General Public License for more details. -+@ -+@ You should have received a copy of the GNU General Public License -+@ along with this program; if not, write to the Free Software -+@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ .text -+ -+@ ---------------------------------------------------------------- -+ .align -+ .global MC_put_o_16_arm -+MC_put_o_16_arm: -+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height) -+ pld [r1] -+ stmfd sp!, {r4-r11, lr} @ R14 is also called LR -+ and r4, r1, #3 -+ adr r5, MC_put_o_16_arm_align_jt -+ add r5, r5, r4, lsl #2 -+ ldr pc, [r5] -+ -+MC_put_o_16_arm_align0: -+ ldmia r1, {r4-r7} -+ add r1, r1, r2 -+ pld [r1] -+ stmia r0, {r4-r7} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne MC_put_o_16_arm_align0 -+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content. -+ -+.macro PROC shift -+ ldmia r1, {r4-r8} -+ add r1, r1, r2 -+ mov r9, r4, lsr #(\shift) -+ pld [r1] -+ mov r10, r5, lsr #(\shift) -+ orr r9, r9, r5, lsl #(32-\shift) -+ mov r11, r6, lsr #(\shift) -+ orr r10, r10, r6, lsl #(32-\shift) -+ mov r12, r7, lsr #(\shift) -+ orr r11, r11, r7, lsl #(32-\shift) -+ orr r12, r12, r8, lsl #(32-\shift) -+ stmia r0, {r9-r12} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+.endm -+ -+MC_put_o_16_arm_align1: -+ and r1, r1, #0xFFFFFFFC -+1: PROC(8) -+ bne 1b -+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content. -+MC_put_o_16_arm_align2: -+ and r1, r1, #0xFFFFFFFC -+1: PROC(16) -+ bne 1b -+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content. -+MC_put_o_16_arm_align3: -+ and r1, r1, #0xFFFFFFFC -+1: PROC(24) -+ bne 1b -+ ldmfd sp!, {r4-r11, pc} @@ update PC with LR content. -+MC_put_o_16_arm_align_jt: -+ .word MC_put_o_16_arm_align0 -+ .word MC_put_o_16_arm_align1 -+ .word MC_put_o_16_arm_align2 -+ .word MC_put_o_16_arm_align3 -+ -+@ ---------------------------------------------------------------- -+ .align -+ .global MC_put_o_8_arm -+MC_put_o_8_arm: -+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height) -+ pld [r1] -+ stmfd sp!, {r4-r10, lr} @ R14 is also called LR -+ and r4, r1, #3 -+ adr r5, MC_put_o_8_arm_align_jt -+ add r5, r5, r4, lsl #2 -+ ldr pc, [r5] -+MC_put_o_8_arm_align0: -+ ldmia r1, {r4-r5} -+ add r1, r1, r2 -+ pld [r1] -+ stmia r0, {r4-r5} -+ add r0, r0, r2 -+ subs r3, r3, #1 -+ bne MC_put_o_8_arm_align0 -+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content. -+ -+.macro PROC8 shift -+ ldmia r1, {r4-r6} -+ add r1, r1, r2 -+ mov r9, r4, lsr #(\shift) -+ pld [r1] -+ mov r10, r5, lsr #(\shift) -+ orr r9, r9, r5, lsl #(32-\shift) -+ orr r10, r10, r6, lsl #(32-\shift) -+ stmia r0, {r9-r10} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+.endm -+ -+MC_put_o_8_arm_align1: -+ and r1, r1, #0xFFFFFFFC -+1: PROC8(8) -+ bne 1b -+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content. -+ -+MC_put_o_8_arm_align2: -+ and r1, r1, #0xFFFFFFFC -+1: PROC8(16) -+ bne 1b -+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content. -+ -+MC_put_o_8_arm_align3: -+ and r1, r1, #0xFFFFFFFC -+1: PROC8(24) -+ bne 1b -+ ldmfd sp!, {r4-r10, pc} @@ update PC with LR content. -+ -+MC_put_o_8_arm_align_jt: -+ .word MC_put_o_8_arm_align0 -+ .word MC_put_o_8_arm_align1 -+ .word MC_put_o_8_arm_align2 -+ .word MC_put_o_8_arm_align3 -+ -+@ ---------------------------------------------------------------- -+.macro AVG_PW rW1, rW2 -+ mov \rW2, \rW2, lsl #24 -+ orr \rW2, \rW2, \rW1, lsr #8 -+ eor r9, \rW1, \rW2 -+ and \rW2, \rW1, \rW2 -+ and r10, r9, r12 -+ add \rW2, \rW2, r10, lsr #1 -+ and r10, r9, r11 -+ add \rW2, \rW2, r10 -+.endm -+ -+ .align -+ .global MC_put_x_16_arm -+MC_put_x_16_arm: -+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height) -+ pld [r1] -+ stmfd sp!, {r4-r11,lr} @ R14 is also called LR -+ and r4, r1, #3 -+ adr r5, MC_put_x_16_arm_align_jt -+ ldr r11, [r5] -+ mvn r12, r11 -+ add r5, r5, r4, lsl #2 -+ ldr pc, [r5, #4] -+ -+.macro ADJ_ALIGN_QW shift, R0, R1, R2, R3, R4 -+ mov \R0, \R0, lsr #(\shift) -+ orr \R0, \R0, \R1, lsl #(32 - \shift) -+ mov \R1, \R1, lsr #(\shift) -+ orr \R1, \R1, \R2, lsl #(32 - \shift) -+ mov \R2, \R2, lsr #(\shift) -+ orr \R2, \R2, \R3, lsl #(32 - \shift) -+ mov \R3, \R3, lsr #(\shift) -+ orr \R3, \R3, \R4, lsl #(32 - \shift) -+ mov \R4, \R4, lsr #(\shift) -+@ and \R4, \R4, #0xFF -+.endm -+ -+MC_put_x_16_arm_align0: -+ ldmia r1, {r4-r8} -+ add r1, r1, r2 -+ pld [r1] -+ AVG_PW r7, r8 -+ AVG_PW r6, r7 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r8} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne MC_put_x_16_arm_align0 -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_16_arm_align1: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r8} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_QW 8, r4, r5, r6, r7, r8 -+ AVG_PW r7, r8 -+ AVG_PW r6, r7 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r8} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_16_arm_align2: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r8} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_QW 16, r4, r5, r6, r7, r8 -+ AVG_PW r7, r8 -+ AVG_PW r6, r7 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r8} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_16_arm_align3: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r8} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_QW 24, r4, r5, r6, r7, r8 -+ AVG_PW r7, r8 -+ AVG_PW r6, r7 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r8} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_16_arm_align_jt: -+ .word 0x01010101 -+ .word MC_put_x_16_arm_align0 -+ .word MC_put_x_16_arm_align1 -+ .word MC_put_x_16_arm_align2 -+ .word MC_put_x_16_arm_align3 -+ -+@ ---------------------------------------------------------------- -+ .align -+ .global MC_put_x_8_arm -+MC_put_x_8_arm: -+ @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height) -+ pld [r1] -+ stmfd sp!, {r4-r11,lr} @ R14 is also called LR -+ and r4, r1, #3 -+ adr r5, MC_put_x_8_arm_align_jt -+ ldr r11, [r5] -+ mvn r12, r11 -+ add r5, r5, r4, lsl #2 -+ ldr pc, [r5, #4] -+ -+.macro ADJ_ALIGN_DW shift, R0, R1, R2 -+ mov \R0, \R0, lsr #(\shift) -+ orr \R0, \R0, \R1, lsl #(32 - \shift) -+ mov \R1, \R1, lsr #(\shift) -+ orr \R1, \R1, \R2, lsl #(32 - \shift) -+ mov \R2, \R2, lsr #(\shift) -+@ and \R4, \R4, #0xFF -+.endm -+ -+MC_put_x_8_arm_align0: -+ ldmia r1, {r4-r6} -+ add r1, r1, r2 -+ pld [r1] -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r6} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne MC_put_x_8_arm_align0 -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_8_arm_align1: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r6} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_DW 8, r4, r5, r6 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r6} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_8_arm_align2: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r6} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_DW 16, r4, r5, r6 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r6} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_8_arm_align3: -+ and r1, r1, #0xFFFFFFFC -+1: ldmia r1, {r4-r6} -+ add r1, r1, r2 -+ pld [r1] -+ ADJ_ALIGN_DW 24, r4, r5, r6 -+ AVG_PW r5, r6 -+ AVG_PW r4, r5 -+ stmia r0, {r5-r6} -+ subs r3, r3, #1 -+ add r0, r0, r2 -+ bne 1b -+ ldmfd sp!, {r4-r11,pc} @@ update PC with LR content. -+MC_put_x_8_arm_align_jt: -+ .word 0x01010101 -+ .word MC_put_x_8_arm_align0 -+ .word MC_put_x_8_arm_align1 -+ .word MC_put_x_8_arm_align2 -+ .word MC_put_x_8_arm_align3 Index: libmpeg2/motion_comp_iwmmxt.c =================================================================== --- libmpeg2/motion_comp_iwmmxt.c (revision 0) From c05694a3b462b52de8ee16e0969703ad3c3b0d21 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Sep 2008 10:17:30 +0000 Subject: [PATCH 33/76] Make -heartbeat-cmd and -stop-xscreensaver sections reference each other. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27606 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 615f33231a..e368fa3eca 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -905,7 +905,7 @@ to ensure it does not cause security problems (e.g.\& make sure to use full paths if "." is in your path like on Windows). .sp 1 This can be "misused" to disable screensavers that do not support the proper -X API. +X API (see also \-stop\-xscreensaver). If you think this is too complicated, ask the author of the screensaver program to support the proper X APIs. .sp 1 @@ -3217,6 +3217,8 @@ do not know the screen resolution like fbdev, x11 and TV-out. .TP .B \-stop\-xscreensaver (X11 only) Turns off xscreensaver at startup and turns it on again on exit. +If your screensaver supports neither the XSS nor XResetScreenSaver +API please use \-heartbeat\-cmd instead. . .TP .B "\-vm \ \ \ " From 196f2d99c6f0f036a8aa19f8b5532942f2949e49 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 14 Sep 2008 10:22:27 +0000 Subject: [PATCH 34/76] wording consistency cosmetics git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27607 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index e368fa3eca..73bed3a88e 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -905,7 +905,7 @@ to ensure it does not cause security problems (e.g.\& make sure to use full paths if "." is in your path like on Windows). .sp 1 This can be "misused" to disable screensavers that do not support the proper -X API (see also \-stop\-xscreensaver). +X API (also see \-stop\-xscreensaver). If you think this is too complicated, ask the author of the screensaver program to support the proper X APIs. .sp 1 @@ -3917,7 +3917,7 @@ Explicitly choose the Matrox device name to use (default: /dev/\:mga_vid). .PD 1 . .TP -.B s3fb (Linux only) (see also \-vf yuv2 and \-dr) +.B s3fb (Linux only) (also see \-vf yuv2 and \-dr) S3 Virge specific video output driver. This driver supports the card's YUV conversion and scaling, double buffering and direct rendering features. @@ -7891,7 +7891,7 @@ so quality may be low. motion estimation search range (default: 0 (unlimited)) . .TP -.B mbd=<0\-2> (see also *cmp, qpel) +.B mbd=<0\-2> (also see *cmp, qpel) Macroblock decision algorithm (high quality mode), encode each macro block in all modes and choose the best. This is slow but results in better quality and file size. From d3e9ce8d24f772e82be4daf3efeab4a1d3bdd4e6 Mon Sep 17 00:00:00 2001 From: Gabrov Date: Sun, 14 Sep 2008 16:10:04 +0000 Subject: [PATCH 35/76] synced with r27607 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27608 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/hu/mplayer.1 | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/DOCS/man/hu/mplayer.1 b/DOCS/man/hu/mplayer.1 index 965260bc21..7ede56e5c8 100644 --- a/DOCS/man/hu/mplayer.1 +++ b/DOCS/man/hu/mplayer.1 @@ -1,4 +1,4 @@ -.\" Synced with r27407 +.\" Synced with r27607 .\" MPlayer (C) 2000-2008 MPlayer Team .\" Ezt a man oldalt Gabucino, Diego Biurrun és Jonas Jermann készíti/készítette .\" Karbantartó: Gabrov @@ -33,7 +33,7 @@ .\" Név .\" -------------------------------------------------------------------------- . -.TH MPlayer 1 "2008. 08. 06." "MPlayer Project" "A film lejátszó" +.TH MPlayer 1 "2008. 09. 14." "MPlayer Project" "A film lejátszó" . .SH NÉV mplayer \- film lejátszó @@ -906,7 +906,7 @@ hogy ne okozzon biztons utakat használsz, ha a "." benne van az elérési utadban, mint Windows alatt). .sp 1 Ezt "ki lehet használni" az olyan képernyõvédõ letiltásához, amely nem -támogatja ehhez a megfelelõ X API-kat. +támogatja ehhez a megfelelõ X API-kat (lásd még \-stop\-xscreensaver). Ha úgy gondolod, hogy ez túl komplikált, kérd meg a képernyõvédõ szerzõjét, hogy támogassa a szükséges X API-kat. .sp 1 @@ -3230,6 +3230,8 @@ ami nem tudja a k .TP .B \-stop\-xscreensaver (csak X11) Kikapcsolja az xscreensaver-t a lejátszás indításakor, kilépéskor újraindítja. +Ha a képernyõ védõd sem az XSS, sem az XResetScreenSaver API-t nem támogatja, +használd inkább a \-heartbeat\-cmd kapcsolót. . .TP .B "\-vm \ \ \ " @@ -3474,8 +3476,9 @@ Nagyon gyors kimeneti vide .RSs .IPs Explicit kiválasztja a használni kívánt VIDIX aleszközt. -A használható aleszközök a cyberblade, mach64, -mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, sis és unichrome. +A használható aleszközök a cyberblade, ivtv, mach64, +mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, s3, sh_veu, +sis_vid és unichrome. .RE .PD 1 . @@ -7410,11 +7413,11 @@ A codec specifikus k .B \-opts . .PP -Ahol a lehet: lavc, xvidenc, lame, toolame, twolame, +Ahol a lehet: lavc, xvidenc, mp3lame, toolame, twolame, nuv, xvfw, faac, x264enc, mpeg, lavf. . . -s.SS lame (\-lameopts) +s.SS mp3lame (\-lameopts) . .TP .B "help\ \ \ " @@ -7648,6 +7651,21 @@ N .PD 1 . .TP +.B o==<érték>[,=<érték>[,...]] +AVOption átadása a libavcodec-nek +Emlékezz rá, hogy az o= kapcsolót feleslegessé tevõ, az összes ismeretlen +opciót a AVOption rendszernek átadó javítást szívesen fogadunk. +.sp 1 +.RS +.I PÉLDA: +.RE +.RSs +.PD 0 +.IPs o=bt=100k +.PD 1 +.RE +. +.TP .B acodec=<érték> audió codec (alapértelmezett: mp2) .PD 0 From 5f9a7d91b94174e15d58fd4cd15f6ac0c75119bb Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 14 Sep 2008 18:00:49 +0000 Subject: [PATCH 36/76] Move dither tables from yuv2rgb to swscale, they have been written by me and can be used under LGPL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27609 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 111 +++++++++++++++++++++++++++++++++++++++++-- libswscale/yuv2rgb.c | 111 ++----------------------------------------- 2 files changed, 111 insertions(+), 111 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index e8fd0d1727..8e74d2e297 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -262,11 +262,112 @@ static unsigned char clip_table[768]; static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b); -extern const uint8_t dither_2x2_4[2][8]; -extern const uint8_t dither_2x2_8[2][8]; -extern const uint8_t dither_8x8_32[8][8]; -extern const uint8_t dither_8x8_73[8][8]; -extern const uint8_t dither_8x8_220[8][8]; +const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={ +{ 1, 3, 1, 3, 1, 3, 1, 3, }, +{ 2, 0, 2, 0, 2, 0, 2, 0, }, +}; + +const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8]={ +{ 6, 2, 6, 2, 6, 2, 6, 2, }, +{ 0, 4, 0, 4, 0, 4, 0, 4, }, +}; + +const uint8_t __attribute__((aligned(8))) dither_8x8_32[8][8]={ +{ 17, 9, 23, 15, 16, 8, 22, 14, }, +{ 5, 29, 3, 27, 4, 28, 2, 26, }, +{ 21, 13, 19, 11, 20, 12, 18, 10, }, +{ 0, 24, 6, 30, 1, 25, 7, 31, }, +{ 16, 8, 22, 14, 17, 9, 23, 15, }, +{ 4, 28, 2, 26, 5, 29, 3, 27, }, +{ 20, 12, 18, 10, 21, 13, 19, 11, }, +{ 1, 25, 7, 31, 0, 24, 6, 30, }, +}; + +#if 0 +const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8]={ +{ 0, 48, 12, 60, 3, 51, 15, 63, }, +{ 32, 16, 44, 28, 35, 19, 47, 31, }, +{ 8, 56, 4, 52, 11, 59, 7, 55, }, +{ 40, 24, 36, 20, 43, 27, 39, 23, }, +{ 2, 50, 14, 62, 1, 49, 13, 61, }, +{ 34, 18, 46, 30, 33, 17, 45, 29, }, +{ 10, 58, 6, 54, 9, 57, 5, 53, }, +{ 42, 26, 38, 22, 41, 25, 37, 21, }, +}; +#endif + +const uint8_t __attribute__((aligned(8))) dither_8x8_73[8][8]={ +{ 0, 55, 14, 68, 3, 58, 17, 72, }, +{ 37, 18, 50, 32, 40, 22, 54, 35, }, +{ 9, 64, 5, 59, 13, 67, 8, 63, }, +{ 46, 27, 41, 23, 49, 31, 44, 26, }, +{ 2, 57, 16, 71, 1, 56, 15, 70, }, +{ 39, 21, 52, 34, 38, 19, 51, 33, }, +{ 11, 66, 7, 62, 10, 65, 6, 60, }, +{ 48, 30, 43, 25, 47, 29, 42, 24, }, +}; + +#if 0 +const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8]={ +{ 68, 36, 92, 60, 66, 34, 90, 58, }, +{ 20, 116, 12, 108, 18, 114, 10, 106, }, +{ 84, 52, 76, 44, 82, 50, 74, 42, }, +{ 0, 96, 24, 120, 6, 102, 30, 126, }, +{ 64, 32, 88, 56, 70, 38, 94, 62, }, +{ 16, 112, 8, 104, 22, 118, 14, 110, }, +{ 80, 48, 72, 40, 86, 54, 78, 46, }, +{ 4, 100, 28, 124, 2, 98, 26, 122, }, +}; +#endif + +#if 1 +const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ +{117, 62, 158, 103, 113, 58, 155, 100, }, +{ 34, 199, 21, 186, 31, 196, 17, 182, }, +{144, 89, 131, 76, 141, 86, 127, 72, }, +{ 0, 165, 41, 206, 10, 175, 52, 217, }, +{110, 55, 151, 96, 120, 65, 162, 107, }, +{ 28, 193, 14, 179, 38, 203, 24, 189, }, +{138, 83, 124, 69, 148, 93, 134, 79, }, +{ 7, 172, 48, 213, 3, 168, 45, 210, }, +}; +#elif 1 +// tries to correct a gamma of 1.5 +const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ +{ 0, 143, 18, 200, 2, 156, 25, 215, }, +{ 78, 28, 125, 64, 89, 36, 138, 74, }, +{ 10, 180, 3, 161, 16, 195, 8, 175, }, +{109, 51, 93, 38, 121, 60, 105, 47, }, +{ 1, 152, 23, 210, 0, 147, 20, 205, }, +{ 85, 33, 134, 71, 81, 30, 130, 67, }, +{ 14, 190, 6, 171, 12, 185, 5, 166, }, +{117, 57, 101, 44, 113, 54, 97, 41, }, +}; +#elif 1 +// tries to correct a gamma of 2.0 +const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ +{ 0, 124, 8, 193, 0, 140, 12, 213, }, +{ 55, 14, 104, 42, 66, 19, 119, 52, }, +{ 3, 168, 1, 145, 6, 187, 3, 162, }, +{ 86, 31, 70, 21, 99, 39, 82, 28, }, +{ 0, 134, 11, 206, 0, 129, 9, 200, }, +{ 62, 17, 114, 48, 58, 16, 109, 45, }, +{ 5, 181, 2, 157, 4, 175, 1, 151, }, +{ 95, 36, 78, 26, 90, 34, 74, 24, }, +}; +#else +// tries to correct a gamma of 2.5 +const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ +{ 0, 107, 3, 187, 0, 125, 6, 212, }, +{ 39, 7, 86, 28, 49, 11, 102, 36, }, +{ 1, 158, 0, 131, 3, 180, 1, 151, }, +{ 68, 19, 52, 12, 81, 25, 64, 17, }, +{ 0, 119, 5, 203, 0, 113, 4, 195, }, +{ 45, 9, 96, 33, 42, 8, 91, 30, }, +{ 2, 172, 1, 144, 2, 165, 0, 137, }, +{ 77, 23, 60, 15, 72, 21, 56, 14, }, +}; +#endif const char *sws_format_name(enum PixelFormat format) { diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index e4937a2145..544d608d62 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -41,112 +41,11 @@ #define DITHER1XBPP // only for MMX -const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={ -{ 1, 3, 1, 3, 1, 3, 1, 3, }, -{ 2, 0, 2, 0, 2, 0, 2, 0, }, -}; - -const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8]={ -{ 6, 2, 6, 2, 6, 2, 6, 2, }, -{ 0, 4, 0, 4, 0, 4, 0, 4, }, -}; - -const uint8_t __attribute__((aligned(8))) dither_8x8_32[8][8]={ -{ 17, 9, 23, 15, 16, 8, 22, 14, }, -{ 5, 29, 3, 27, 4, 28, 2, 26, }, -{ 21, 13, 19, 11, 20, 12, 18, 10, }, -{ 0, 24, 6, 30, 1, 25, 7, 31, }, -{ 16, 8, 22, 14, 17, 9, 23, 15, }, -{ 4, 28, 2, 26, 5, 29, 3, 27, }, -{ 20, 12, 18, 10, 21, 13, 19, 11, }, -{ 1, 25, 7, 31, 0, 24, 6, 30, }, -}; - -#if 0 -const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8]={ -{ 0, 48, 12, 60, 3, 51, 15, 63, }, -{ 32, 16, 44, 28, 35, 19, 47, 31, }, -{ 8, 56, 4, 52, 11, 59, 7, 55, }, -{ 40, 24, 36, 20, 43, 27, 39, 23, }, -{ 2, 50, 14, 62, 1, 49, 13, 61, }, -{ 34, 18, 46, 30, 33, 17, 45, 29, }, -{ 10, 58, 6, 54, 9, 57, 5, 53, }, -{ 42, 26, 38, 22, 41, 25, 37, 21, }, -}; -#endif - -const uint8_t __attribute__((aligned(8))) dither_8x8_73[8][8]={ -{ 0, 55, 14, 68, 3, 58, 17, 72, }, -{ 37, 18, 50, 32, 40, 22, 54, 35, }, -{ 9, 64, 5, 59, 13, 67, 8, 63, }, -{ 46, 27, 41, 23, 49, 31, 44, 26, }, -{ 2, 57, 16, 71, 1, 56, 15, 70, }, -{ 39, 21, 52, 34, 38, 19, 51, 33, }, -{ 11, 66, 7, 62, 10, 65, 6, 60, }, -{ 48, 30, 43, 25, 47, 29, 42, 24, }, -}; - -#if 0 -const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8]={ -{ 68, 36, 92, 60, 66, 34, 90, 58, }, -{ 20, 116, 12, 108, 18, 114, 10, 106, }, -{ 84, 52, 76, 44, 82, 50, 74, 42, }, -{ 0, 96, 24, 120, 6, 102, 30, 126, }, -{ 64, 32, 88, 56, 70, 38, 94, 62, }, -{ 16, 112, 8, 104, 22, 118, 14, 110, }, -{ 80, 48, 72, 40, 86, 54, 78, 46, }, -{ 4, 100, 28, 124, 2, 98, 26, 122, }, -}; -#endif - -#if 1 -const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ -{117, 62, 158, 103, 113, 58, 155, 100, }, -{ 34, 199, 21, 186, 31, 196, 17, 182, }, -{144, 89, 131, 76, 141, 86, 127, 72, }, -{ 0, 165, 41, 206, 10, 175, 52, 217, }, -{110, 55, 151, 96, 120, 65, 162, 107, }, -{ 28, 193, 14, 179, 38, 203, 24, 189, }, -{138, 83, 124, 69, 148, 93, 134, 79, }, -{ 7, 172, 48, 213, 3, 168, 45, 210, }, -}; -#elif 1 -// tries to correct a gamma of 1.5 -const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ -{ 0, 143, 18, 200, 2, 156, 25, 215, }, -{ 78, 28, 125, 64, 89, 36, 138, 74, }, -{ 10, 180, 3, 161, 16, 195, 8, 175, }, -{109, 51, 93, 38, 121, 60, 105, 47, }, -{ 1, 152, 23, 210, 0, 147, 20, 205, }, -{ 85, 33, 134, 71, 81, 30, 130, 67, }, -{ 14, 190, 6, 171, 12, 185, 5, 166, }, -{117, 57, 101, 44, 113, 54, 97, 41, }, -}; -#elif 1 -// tries to correct a gamma of 2.0 -const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ -{ 0, 124, 8, 193, 0, 140, 12, 213, }, -{ 55, 14, 104, 42, 66, 19, 119, 52, }, -{ 3, 168, 1, 145, 6, 187, 3, 162, }, -{ 86, 31, 70, 21, 99, 39, 82, 28, }, -{ 0, 134, 11, 206, 0, 129, 9, 200, }, -{ 62, 17, 114, 48, 58, 16, 109, 45, }, -{ 5, 181, 2, 157, 4, 175, 1, 151, }, -{ 95, 36, 78, 26, 90, 34, 74, 24, }, -}; -#else -// tries to correct a gamma of 2.5 -const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={ -{ 0, 107, 3, 187, 0, 125, 6, 212, }, -{ 39, 7, 86, 28, 49, 11, 102, 36, }, -{ 1, 158, 0, 131, 3, 180, 1, 151, }, -{ 68, 19, 52, 12, 81, 25, 64, 17, }, -{ 0, 119, 5, 203, 0, 113, 4, 195, }, -{ 45, 9, 96, 33, 42, 8, 91, 30, }, -{ 2, 172, 1, 144, 2, 165, 0, 137, }, -{ 77, 23, 60, 15, 72, 21, 56, 14, }, -}; -#endif +extern const uint8_t dither_2x2_4[2][8]; +extern const uint8_t dither_2x2_8[2][8]; +extern const uint8_t dither_8x8_32[8][8]; +extern const uint8_t dither_8x8_73[8][8]; +extern const uint8_t dither_8x8_220[8][8]; #ifdef HAVE_MMX From aee49d5e5828bec105cadf4d84eb838098f14c41 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 14 Sep 2008 19:25:16 +0000 Subject: [PATCH 37/76] Use av_mallocz() instead of for() =0; git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27610 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 8e74d2e297..337b23a1dc 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1063,8 +1063,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF { int i; filterSize= 1; - filter= av_malloc(dstW*sizeof(double)*filterSize); - for (i=0; i Date: Sun, 14 Sep 2008 19:29:14 +0000 Subject: [PATCH 38/76] Avoid some explicit types in sizeof(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27611 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 337b23a1dc..ba6bdaad9b 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1063,7 +1063,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF { int i; filterSize= 1; - filter= av_mallocz(dstW*sizeof(double)*filterSize); + filter= av_mallocz(dstW*sizeof(*filter)*filterSize); for (i=0; i srcW-2) filterSize=srcW-2; - filter= av_malloc(dstW*sizeof(double)*filterSize); + filter= av_malloc(dstW*sizeof(*filter)*filterSize); xDstInSrc= xInc1 / 2.0 - 0.5; for (i=0; ilength - 1; if (dstFilter) filter2Size+= dstFilter->length - 1; assert(filter2Size>0); - filter2= av_malloc(filter2Size*dstW*sizeof(double)); + filter2= av_malloc(filter2Size*dstW*sizeof(*filter2)); for (i=0; i 0); filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1)); assert(filterSize > 0); - filter= av_malloc(filterSize*dstW*sizeof(double)); + filter= av_malloc(filterSize*dstW*sizeof(*filter)); if (filterSize >= MAX_FILTER_SIZE*16/((flags&SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter) goto error; *outFilterSize= filterSize; From da1f355a050649e452674596244e936d0cdc733e Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 15 Sep 2008 03:33:09 +0000 Subject: [PATCH 39/76] Avoid using floating point for calculating filter coefficients. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27612 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 160 ++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index ba6bdaad9b..56a349c811 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1048,8 +1048,9 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF int filterSize; int filter2Size; int minFilterSize; - double *filter=NULL; - double *filter2=NULL; + int64_t *filter=NULL; + int64_t *filter2=NULL; + const int64_t fone= 1LL<<54; int ret= -1; #if defined(ARCH_X86) if (flags & SWS_CPU_CAPS_MMX) @@ -1067,7 +1068,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF for (i=0; i>16; (*filterPos)[i]= xx; - filter[i]= 1.0; + filter[i]= fone; xDstInSrc+= xInc; } } @@ -1108,8 +1109,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF //Bilinear upscale / linear interpolate / Area averaging for (j=0; j>16); if (coeff<0) coeff=0; filter[i*filterSize + j]= coeff; xx++; @@ -1119,52 +1119,59 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF } else { - double xDstInSrc; - double sizeFactor, filterSizeInSrc; - const double xInc1= (double)xInc / (double)(1<<16); + int xDstInSrc; + int sizeFactor; - if (flags&SWS_BICUBIC) sizeFactor= 4.0; - else if (flags&SWS_X) sizeFactor= 8.0; - else if (flags&SWS_AREA) sizeFactor= 1.0; //downscale only, for upscale it is bilinear - else if (flags&SWS_GAUSS) sizeFactor= 8.0; // infinite ;) - else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? 2.0*param[0] : 6.0; - else if (flags&SWS_SINC) sizeFactor= 20.0; // infinite ;) - else if (flags&SWS_SPLINE) sizeFactor= 20.0; // infinite ;) - else if (flags&SWS_BILINEAR) sizeFactor= 2.0; + if (flags&SWS_BICUBIC) sizeFactor= 4; + else if (flags&SWS_X) sizeFactor= 8; + else if (flags&SWS_AREA) sizeFactor= 1; //downscale only, for upscale it is bilinear + else if (flags&SWS_GAUSS) sizeFactor= 8; // infinite ;) + else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? ceil(2*param[0]) : 6; + else if (flags&SWS_SINC) sizeFactor= 20; // infinite ;) + else if (flags&SWS_SPLINE) sizeFactor= 20; // infinite ;) + else if (flags&SWS_BILINEAR) sizeFactor= 2; else { - sizeFactor= 0.0; //GCC warning killer + sizeFactor= 0; //GCC warning killer assert(0); } - if (xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale - else filterSizeInSrc= sizeFactor*srcW / (double)dstW; + if (xInc <= 1<<16) filterSize= 1 + sizeFactor; // upscale + else filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW; - filterSize= (int)ceil(1 + filterSizeInSrc); // will be reduced later if possible if (filterSize > srcW-2) filterSize=srcW-2; filter= av_malloc(dstW*sizeof(*filter)*filterSize); - xDstInSrc= xInc1 / 2.0 - 0.5; + xDstInSrc= xInc - 0x10000; for (i=0; i 1<<16) + d= d*dstW/srcW; + floatd= d * (1.0/(1<<30)); + if (flags & SWS_BICUBIC) { - double B= param[0] != SWS_PARAM_DEFAULT ? param[0] : 0.0; - double C= param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6; + int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24); + int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24); + int64_t dd = ( d*d)>>30; + int64_t ddd= (dd*d)>>30; - if (d<1.0) - coeff = (12-9*B-6*C)*d*d*d + (-18+12*B+6*C)*d*d + 6-2*B; - else if (d<2.0) - coeff = (-B-6*C)*d*d*d + (6*B+30*C)*d*d + (-12*B-48*C)*d +8*B+24*C; + if (d < 1LL<<30) + coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30); + else if (d < 1LL<<31) + coeff = (-B-6*C)*ddd + (6*B+30*C)*dd + (-12*B-48*C)*d + (8*B+24*C)*(1<<30); else coeff=0.0; + coeff *= fone>>(30+24); } /* else if (flags & SWS_X) { @@ -1175,46 +1182,49 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF else if (flags & SWS_X) { double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0; + double c; - if (d<1.0) - coeff = cos(d*PI); + if (floatd<1.0) + c = cos(floatd*PI); else - coeff=-1.0; - if (coeff<0.0) coeff= -pow(-coeff, A); - else coeff= pow( coeff, A); - coeff= coeff*0.5 + 0.5; + c=-1.0; + if (c<0.0) c= -pow(-c, A); + else c= pow( c, A); + coeff= (c*0.5 + 0.5)*fone; } else if (flags & SWS_AREA) { - double srcPixelSize= 1.0/xInc1; - if (d + srcPixelSize/2 < 0.5) coeff= 1.0; - else if (d - srcPixelSize/2 < 0.5) coeff= (0.5-d)/srcPixelSize + 0.5; + int64_t d2= d - (1<<29); + if (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16)); + else if (d2*xInc < (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16)); else coeff=0.0; + coeff *= fone>>(30+16); } else if (flags & SWS_GAUSS) { double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; - coeff = pow(2.0, - p*d*d); + coeff = (pow(2.0, - p*floatd*floatd))*fone; } else if (flags & SWS_SINC) { - coeff = d ? sin(d*PI)/(d*PI) : 1.0; + coeff = (d ? sin(floatd*PI)/(floatd*PI) : 1.0)*fone; } else if (flags & SWS_LANCZOS) { double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; - coeff = d ? sin(d*PI)*sin(d*PI/p)/(d*d*PI*PI/p) : 1.0; - if (d>p) coeff=0; + coeff = (d ? sin(floatd*PI)*sin(floatd*PI/p)/(floatd*floatd*PI*PI/p) : 1.0)*fone; + if (floatd>p) coeff=0; } else if (flags & SWS_BILINEAR) { - coeff= 1.0 - d; + coeff= (1<<30) - d; if (coeff<0) coeff=0; + coeff *= fone >> 30; } else if (flags & SWS_SPLINE) { double p=-2.196152422706632; - coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, d); + coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, d) * fone; } else { coeff= 0.0; //GCC warning killer @@ -1224,7 +1234,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF filter[i*filterSize + j]= coeff; xx++; } - xDstInSrc+= xInc1; + xDstInSrc+= 2*xInc; } } @@ -1236,31 +1246,24 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF if (srcFilter) filter2Size+= srcFilter->length - 1; if (dstFilter) filter2Size+= dstFilter->length - 1; assert(filter2Size>0); - filter2= av_malloc(filter2Size*dstW*sizeof(*filter2)); + filter2= av_mallocz(filter2Size*dstW*sizeof(*filter2)); for (i=0; ilength == filter2Size); + if(srcFilter){ + for (k=0; klength; k++){ + for (j=0; jcoeff[k]*filter[i*filterSize + j]; + } + }else{ + for (j=0; jlength; j++) - { - filter2[i*filter2Size + j]= outVec->coeff[j]; - } - (*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2; - - if (outVec != &scaleFilter) sws_freeVec(outVec); } av_freep(&filter); @@ -1271,7 +1274,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF { int min= filter2Size; int j; - double cutOff=0.0; + int64_t cutOff=0.0; /* get rid off near zero elements on the left by shifting left */ for (j=0; j SWS_MAX_REDUCE_CUTOFF) break; + if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break; /* preserve monotonicity because the core can't handle the filter otherwise */ if (i= (*filterPos)[i+1]) break; @@ -1287,17 +1290,17 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF // Move filter coeffs left for (k=1; k0; j--) { cutOff += FFABS(filter2[i*filter2Size + j]); - if (cutOff > SWS_MAX_REDUCE_CUTOFF) break; + if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break; min--; } @@ -1342,10 +1345,10 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF for (j=0; j=filter2Size) filter[i*filterSize + j]= 0.0; + if (j>=filter2Size) filter[i*filterSize + j]= 0; else filter[i*filterSize + j]= filter2[i*filter2Size + j]; if((flags & SWS_BITEXACT) && j>=minFilterSize) - filter[i*filterSize + j]= 0.0; + filter[i*filterSize + j]= 0; } } @@ -1390,21 +1393,20 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF for (i=0; i Date: Mon, 15 Sep 2008 05:19:22 +0000 Subject: [PATCH 40/76] Avoid useless line in libpostproc test. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27613 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 4c53a28572..8432290538 100755 --- a/configure +++ b/configure @@ -6562,7 +6562,6 @@ if test "$_libpostproc_a" = auto ; then elif test "$_libpostproc_so" = auto ; then _libpostproc_so=no cat > $TMPC << EOF - #define CONFIG_LIBPOSTPROC 1 #include #include int main(void) { pp_get_mode_by_name_and_quality("de", 0); return 0; } From 4ca1fa0a0835d511167017a2621a085076d9fdfa Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 15 Sep 2008 05:40:29 +0000 Subject: [PATCH 41/76] Upgrade license of LGPL 2 or later files to LGPL 2.1 or later. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27614 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/dvd2divxscript.pl | 2 +- libmpdemux/demux_avs.c | 21 ++++++++++---------- libmpdemux/demux_avs.h | 21 ++++++++++---------- libvo/vo_dfbmga.c | 43 ++++++++++++++++++++--------------------- libvo/vo_directfb2.c | 43 +++++++++++++++++++++-------------------- libvo/vo_gif89a.c | 43 ++++++++++++++++++++--------------------- libvo/vo_quartz.h | 8 ++++---- 7 files changed, 91 insertions(+), 90 deletions(-) diff --git a/TOOLS/dvd2divxscript.pl b/TOOLS/dvd2divxscript.pl index eaf55bd7e7..3c9203905c 100755 --- a/TOOLS/dvd2divxscript.pl +++ b/TOOLS/dvd2divxscript.pl @@ -15,7 +15,7 @@ # This script is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. +# version 2.1 of the License, or (at your option) any later version. # # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c index 2f8ec46bde..8d2ac82046 100644 --- a/libmpdemux/demux_avs.c +++ b/libmpdemux/demux_avs.c @@ -2,20 +2,21 @@ * Demuxer for avisynth * Copyright (c) 2005 Gianluigi Tiesi * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This file is part of MPlayer. * - * This library is distributed in the hope that it will be useful, + * MPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. + * You should have received a copy of the GNU Lesser General Public License + * along with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include diff --git a/libmpdemux/demux_avs.h b/libmpdemux/demux_avs.h index 0962146281..708ce9c70a 100644 --- a/libmpdemux/demux_avs.h +++ b/libmpdemux/demux_avs.h @@ -5,20 +5,21 @@ * Avisynth C Interface Version 0.20 * Copyright 2003 Kevin Atkinson * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This file is part of MPlayer. * - * This library is distributed in the hope that it will be useful, + * MPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. + * You should have received a copy of the GNU Lesser General Public License + * along with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef MPLAYER_DEMUX_AVS_H diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index af1e89105e..3c22145517 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -1,26 +1,25 @@ /* - MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550 - - Copyright (C) 2002-2005 Ville Syrjala - - Originally based on vo_directfb.c by - Jiri Svoboda - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. -*/ + * MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550 + * + * copyright (C) 2002-2005 Ville Syrjala + * Originally based on vo_directfb.c by Jiri Svoboda . + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ /* directfb includes */ #include diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index 86dbc9b0d2..133f46a07e 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -1,25 +1,26 @@ /* - MPlayer video driver for DirectFramebuffer device - - (C) 2002 - - Written by Jiri Svoboda - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. -*/ + * MPlayer video driver for DirectFramebuffer device + * + * copyright (C) 2002 Jiri Svoboda + * + * based on vo_directfb2.c + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ // directfb includes diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c index e3e1d6ac95..5e59a3dcef 100644 --- a/libvo/vo_gif89a.c +++ b/libvo/vo_gif89a.c @@ -1,26 +1,25 @@ /* - MPlayer video driver for animated gif output - - (C) 2002 - - Written by Joey Parrish - Based on vo_directfb2.c - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. -*/ + * MPlayer video driver for animated GIF output + * + * copyright (C) 2002 Joey Parrish + * based on vo_directfb2.c + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ /* Notes: * when setting output framerate, frames will be ignored as needed diff --git a/libvo/vo_quartz.h b/libvo/vo_quartz.h index b0e8fece46..82eb096ba0 100644 --- a/libvo/vo_quartz.h +++ b/libvo/vo_quartz.h @@ -9,16 +9,16 @@ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA From d45397dbdd99cbe83f4e297c608aecbbd77c64c2 Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 11:47:02 +0000 Subject: [PATCH 42/76] Eliminate void * arithmetic. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27615 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 3c22145517..ac968bb442 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -959,7 +959,8 @@ draw_alpha( int x0, int y0, unsigned char *srca, int stride ) { - void *dst; + uint8_t *dst; + void *ptr; int pitch; if (use_spic) { @@ -974,44 +975,45 @@ draw_alpha( int x0, int y0, osd_dirty |= osd_current; } - if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &dst, &pitch ) != DFB_OK) + if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &ptr, &pitch ) != DFB_OK) return; + dst = ptr; switch (subframe_format) { case DSPF_ALUT44: vo_draw_alpha_alut44( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + x0, + dst + pitch * y0 + x0, pitch ); break; case DSPF_RGB32: case DSPF_ARGB: vo_draw_alpha_rgb32( w, h, src, srca, stride, - (( uint8_t *) dst) + pitch * y0 + 4 * x0, + dst + pitch * y0 + 4 * x0, pitch ); break; case DSPF_RGB24: vo_draw_alpha_rgb24( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + 3 * x0, + dst + pitch * y0 + 3 * x0, pitch ); break; case DSPF_RGB16: vo_draw_alpha_rgb16( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + 2 * x0, + dst + pitch * y0 + 2 * x0, pitch ); break; case DSPF_ARGB1555: vo_draw_alpha_rgb15( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + 2 * x0, + dst + pitch * y0 + 2 * x0, pitch ); break; case DSPF_YUY2: vo_draw_alpha_yuy2( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + 2 * x0, + dst + pitch * y0 + 2 * x0, pitch ); break; case DSPF_UYVY: vo_draw_alpha_yuy2( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1, + dst + pitch * y0 + 2 * x0 + 1, pitch ); break; #if DIRECTFBVERSION > DFB_VERSION(0,9,21) @@ -1021,7 +1023,7 @@ draw_alpha( int x0, int y0, case DSPF_I420: case DSPF_YV12: vo_draw_alpha_yv12( w, h, src, srca, stride, - ((uint8_t *) dst) + pitch * y0 + x0, + dst + pitch * y0 + x0, pitch ); break; } @@ -1038,11 +1040,13 @@ draw_frame( uint8_t * src[] ) static int draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y ) { - void *dst; + uint8_t *dst; + void *ptr; int pitch; - if (frame->Lock( frame, DSLF_WRITE, &dst, &pitch ) != DFB_OK) + if (frame->Lock( frame, DSLF_WRITE, &ptr, &pitch ) != DFB_OK) return VO_FALSE; + dst = ptr; memcpy_pic( dst + pitch * y + x, src[0], w, h, pitch, stride[0] ); @@ -1214,7 +1218,8 @@ static uint32_t get_image( mp_image_t *mpi ) { int buf = current_buf; - void *dst; + uint8_t *dst; + void *ptr; int pitch; if (mpi->flags & MP_IMGFLAG_READABLE && @@ -1237,8 +1242,9 @@ get_image( mp_image_t *mpi ) /* Always use DSLF_READ to preserve system memory copy */ if (frame->Lock( frame, DSLF_WRITE | DSLF_READ, - &dst, &pitch ) != DFB_OK) + &ptr, &pitch ) != DFB_OK) return VO_FALSE; + dst = ptr; if ((mpi->width == pitch) || (mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))) { From ec0ba2f460ddaef0525060955579fc2a4532c04d Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 15 Sep 2008 15:30:06 +0000 Subject: [PATCH 43/76] riff.h and avi.h are not needed, but avio.h is. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27616 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 868b100b68..062cad7f98 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -35,10 +35,9 @@ #include "libvo/sub.h" #include "libavformat/avformat.h" +#include "libavformat/avio.h" #include "libavutil/avutil.h" -#include "libavformat/avi.h" #include "libavcodec/opt.h" -#include "libavformat/riff.h" #include "mp_taglists.h" From 1f9e0f1076c804727f54daa3cddd17405155ce88 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 15 Sep 2008 15:33:34 +0000 Subject: [PATCH 44/76] Add -I. to _inc_extra at the beginning instead of to CFLAGS at the end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27617 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 8432290538..67d1916236 100755 --- a/configure +++ b/configure @@ -1350,6 +1350,7 @@ if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then fi +_inc_extra=-I. _timer=timer-linux.c _getch=getch2.c if freebsd ; then @@ -6041,7 +6042,7 @@ EOF done if test "$_theora" = no && test "$_tremor_internal" = yes; then for _ld_theora in "`$_pkg_config --silence-errors --libs --cflags theora`" "-ltheora -logg"; do - cc_check -I. tremor/bitwise.c $_ld_theora \ + cc_check tremor/bitwise.c $_ld_theora \ && _ld_extra="$_ld_extra $_ld_theora" && theora=yes && break done fi @@ -7737,7 +7738,6 @@ if test "$_largefiles" = yes || freebsd ; then fi fi -CFLAGS="-I. $CFLAGS" CXXFLAGS=" $CFLAGS -D__STDC_LIMIT_MACROS" cat > $TMPC << EOF From 853d571d482e7cea45655c9e310f305c8637d124 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 15 Sep 2008 15:34:26 +0000 Subject: [PATCH 45/76] Use standard -I flags to compile codec-cfg. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27618 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bdf3705935..71f7b10905 100644 --- a/Makefile +++ b/Makefile @@ -752,7 +752,7 @@ mplayer$(EXESUF): $(MPLAYER_DEPS) $(CC) -o $@ $^ $(LDFLAGS_MPLAYER) codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h - $(HOST_CC) -O -I. -DCODECS2HTML -o $@ $< + $(HOST_CC) -O -DCODECS2HTML $(EXTRA_INC) -o $@ $< codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf ./$^ > $@ From d977c6e812ddb88f2a980d9ee13389836c81dae7 Mon Sep 17 00:00:00 2001 From: rathann Date: Mon, 15 Sep 2008 16:30:24 +0000 Subject: [PATCH 46/76] External liba52 support part 1 of 2. Conditionalize enabling of some the acceleration because liba52-0.7.4 doesn't support all that MPlayer's included copy does. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27619 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ad_liba52.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c index 8c32c81319..0a20e82cb2 100644 --- a/libmpcodecs/ad_liba52.c +++ b/libmpcodecs/ad_liba52.c @@ -158,12 +158,18 @@ static int init(sh_audio_t *sh_audio) sample_t level=a52_level, bias=384; int flags=0; /* Dolby AC3 audio:*/ +#ifdef MM_ACCEL_X86_SSE if(gCpuCaps.hasSSE) a52_accel|=MM_ACCEL_X86_SSE; +#endif if(gCpuCaps.hasMMX) a52_accel|=MM_ACCEL_X86_MMX; if(gCpuCaps.hasMMX2) a52_accel|=MM_ACCEL_X86_MMXEXT; if(gCpuCaps.has3DNow) a52_accel|=MM_ACCEL_X86_3DNOW; +#ifdef MM_ACCEL_X86_3DNOWEXT if(gCpuCaps.has3DNowExt) a52_accel|=MM_ACCEL_X86_3DNOWEXT; +#endif +#ifdef MM_ACCEL_PPC_ALTIVEC if(gCpuCaps.hasAltiVec) a52_accel|=MM_ACCEL_PPC_ALTIVEC; +#endif a52_state=a52_init (a52_accel); if (a52_state == NULL) { mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n"); From a5e9a8d0cac5eb5a40ce9df6f1a635a779064233 Mon Sep 17 00:00:00 2001 From: rathann Date: Mon, 15 Sep 2008 16:32:31 +0000 Subject: [PATCH 47/76] External liba52 support, part 2 of 2. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27620 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Makefile | 4 ++-- configure | 33 +++++++++++++++++++++++++++++---- libmpcodecs/ad_hwac3.c | 6 ++++++ libmpcodecs/ad_liba52.c | 19 +++++++++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 71f7b10905..8cf984c210 100644 --- a/Makefile +++ b/Makefile @@ -294,8 +294,8 @@ SRCS_COMMON-$(HAVE_SYS_MMAN_H) += libaf/af_export.c osdep/mmap_anon.c SRCS_COMMON-$(JPEG) += libmpcodecs/vd_ijpg.c SRCS_COMMON-$(LADSPA) += libaf/af_ladspa.c SRCS_COMMON-$(LIBA52) += libmpcodecs/ad_hwac3.c \ - libmpcodecs/ad_liba52.c \ - liba52/crc.c \ + libmpcodecs/ad_liba52.c +SRCS_COMMON-$(LIBA52_INTERNAL) += liba52/crc.c \ liba52/resample.c \ liba52/bit_allocate.c \ liba52/bitstream.c \ diff --git a/configure b/configure index 67d1916236..99c3e9670e 100755 --- a/configure +++ b/configure @@ -320,7 +320,8 @@ Codecs: --enable-xmms enable XMMS input plugin support [disabled] --enable-libdca enable libdca support [autodetect] --disable-mp3lib disable builtin mp3lib [enabled] - --disable-liba52 disable builtin liba52 [enabled] + --disable-liba52 disable liba52 [autodetect] + --disable-liba52-internal disable builtin liba52 [autodetect] --disable-libmpeg2 disable builtin libmpeg2 [autodetect] --disable-musepack disable musepack support [autodetect] --disable-libamr_nb disable libamr narrowband [autodetect] @@ -574,7 +575,8 @@ _libvorbis=auto _speex=auto _theora=auto _mp3lib=yes -_liba52=yes +_liba52=auto +_liba52_internal=auto _libdca=auto _libmpeg2=auto _faad=auto @@ -938,6 +940,8 @@ for ac_option do --disable-theora) _theora=no ;; --enable-mp3lib) _mp3lib=yes ;; --disable-mp3lib) _mp3lib=no ;; + --enable-liba52-internal) _liba52_internal=yes ;; + --disable-liba52-internal) _liba52_internal=no ;; --enable-liba52) _liba52=yes ;; --disable-liba52) _liba52=no ;; --enable-libdca) _libdca=yes ;; @@ -6069,12 +6073,29 @@ else fi echores "$_mp3lib" -echocheck "internal liba52 support" +echocheck "liba52 support" +if test "$_liba52_internal" = auto ; then + _liba52=yes + _liba52_internal=yes + _def_liba52_internal="#define CONFIG_LIBA52_INTERNAL 1" + _res_comment="internal" +elif test "$_liba52_internal" = no && test "$_liba52" = auto ; then + _liba52=no + cat > $TMPC << EOF +#include +#include +int main(void) { a52_state_t *testHand; testHand=a52_init(0); return 0; } +EOF + cc_check -la52 && _liba52=yes + _ld_extra="$_ld_extra -la52" + _res_comment="external" +fi if test "$_liba52" = yes ; then _def_liba52='#define CONFIG_LIBA52 1' - _codecmodules="liba52 $_codecmodules" + _codecmodules="liba52($_res_comment) $_codecmodules" else _def_liba52='#undef CONFIG_LIBA52' + _def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL" _nocodecmodules="liba52 $_nocodecmodules" fi echores "$_liba52" @@ -7823,6 +7844,7 @@ MPLAYER = $_mplayer #internal libraries LIBA52 = $_liba52 +LIBA52_INTERNAL = $_liba52_internal LIBMPEG2 = $_libmpeg2 MP3LIB = $_mp3lib TREMOR_INTERNAL = $_tremor_internal @@ -8366,6 +8388,9 @@ $_def_xvid_lavc /* Use codec libs included in mplayer CVS / source dist: */ $_def_mp3lib + +/* enable liba52 support */ +$_def_liba52_internal $_def_liba52 $_def_libmpeg2 diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c index 0cb480ddfd..1757018796 100644 --- a/libmpcodecs/ad_hwac3.c +++ b/libmpcodecs/ad_hwac3.c @@ -17,7 +17,11 @@ #include "ad_internal.h" +#ifdef CONFIG_LIBA52_INTERNAL #include "liba52/a52.h" +#else +#include +#endif static int isdts = -1; @@ -97,8 +101,10 @@ static int ac3dts_fillbuff(sh_audio_t *sh_audio) sh_audio->a_in_buffer_len = length; // TODO: is DTS also checksummed? +#ifdef CONFIG_LIBA52_INTERNAL if(isdts == 0 && crc16_block(sh_audio->a_in_buffer + 2, length - 2) != 0) mp_msg(MSGT_DECAUDIO, MSGL_STATUS, "a52: CRC check failed! \n"); +#endif return length; } diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c index 0a20e82cb2..d886ad6a6a 100644 --- a/libmpcodecs/ad_liba52.c +++ b/libmpcodecs/ad_liba52.c @@ -16,8 +16,14 @@ #include "libaf/af_format.h" +#ifdef CONFIG_LIBA52_INTERNAL #include "liba52/a52.h" #include "liba52/mm_accel.h" +#else +#include +#include +int (* a52_resample) (float * _f, int16_t * s16); +#endif static a52_state_t *a52_state; static uint32_t a52_flags=0; @@ -79,8 +85,10 @@ while(1){ if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8); +#ifdef CONFIG_LIBA52_INTERNAL if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0) mp_msg(MSGT_DECAUDIO,MSGL_STATUS,"a52: CRC check failed! \n"); +#endif return length; } @@ -121,7 +129,11 @@ static int preinit(sh_audio_t *sh) { /* Dolby AC3 audio: */ /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ +#ifdef CONFIG_LIBA52_INTERNAL if (sh->samplesize < 2) sh->samplesize = 2; +#else + if (sh->samplesize < 4) sh->samplesize = 4; +#endif sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6; sh->audio_in_minsize=3840; a52_level = 1.0; @@ -175,6 +187,9 @@ static int init(sh_audio_t *sh_audio) mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n"); return 0; } +#ifndef CONFIG_LIBA52_INTERNAL + sh_audio->sample_format = AF_FORMAT_FLOAT_NE; +#endif if(a52_fillbuff(sh_audio)<0){ mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 sync failed\n"); return 0; @@ -247,8 +262,12 @@ while(sh_audio->channels>0){ break; } } else +#ifdef CONFIG_LIBA52_INTERNAL if(a52_resample_init(a52_accel,flags,sh_audio->channels)) break; --sh_audio->channels; /* try to decrease no. of channels*/ +#else + break; +#endif } if(sh_audio->channels<=0){ mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: no resampler. try different channel setup!\n"); From 9a00106a58028aa964cdc8343793be9a394cc6bf Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:35:05 +0000 Subject: [PATCH 48/76] Remove BGR24 support since it has never worked anyway. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27621 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index ac968bb442..8192a8d0fd 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -136,8 +136,6 @@ pixelformat_name( DFBSurfacePixelFormat format ) return "ARGB"; case DSPF_RGB32: return "RGB32"; - case DSPF_RGB24: - return "RGB24"; case DSPF_RGB16: return "RGB16"; case DSPF_ARGB1555: @@ -169,8 +167,6 @@ imgfmt_to_pixelformat( uint32_t format ) switch (format) { case IMGFMT_BGR32: return DSPF_RGB32; - case IMGFMT_BGR24: - return DSPF_RGB24; case IMGFMT_BGR16: return DSPF_RGB16; case IMGFMT_BGR15: @@ -894,7 +890,6 @@ query_format( uint32_t format ) { switch (format) { case IMGFMT_BGR32: - case IMGFMT_BGR24: case IMGFMT_BGR16: case IMGFMT_BGR15: case IMGFMT_UYVY: @@ -991,11 +986,6 @@ draw_alpha( int x0, int y0, dst + pitch * y0 + 4 * x0, pitch ); break; - case DSPF_RGB24: - vo_draw_alpha_rgb24( w, h, src, srca, stride, - dst + pitch * y0 + 3 * x0, - pitch ); - break; case DSPF_RGB16: vo_draw_alpha_rgb16( w, h, src, srca, stride, dst + pitch * y0 + 2 * x0, From 654db6243721da17c20204ddcdae72efba62212f Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:39:03 +0000 Subject: [PATCH 49/76] Add CRTC1 support. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27622 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 122 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 113 insertions(+), 9 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 8192a8d0fd..898593b00d 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -72,6 +72,7 @@ static IDirectFBSurface *frame; static IDirectFBSurface *subframe; static IDirectFBSurface *besframe; +static IDirectFBSurface *c1frame; static IDirectFBSurface *c2frame; static IDirectFBSurface *spicframe; @@ -79,6 +80,7 @@ static DFBSurfacePixelFormat frame_format; static DFBSurfacePixelFormat subframe_format; static DFBRectangle besrect; +static DFBRectangle c1rect; static DFBRectangle c2rect; static DFBRectangle *subrect; @@ -87,9 +89,11 @@ static IDirectFBInputDevice *remote; static IDirectFBEventBuffer *buffer; static int blit_done; +static int c1stretch; static int stretch; static int use_bes; +static int use_crtc1; static int use_crtc2; static int use_spic; static int use_input; @@ -231,6 +235,7 @@ preinit( const char *arg ) /* Some defaults */ use_bes = 0; + use_crtc1 = 0; use_crtc2 = 1; use_spic = 1; field_parity = -1; @@ -254,6 +259,10 @@ preinit( const char *arg ) use_bes = !opt_no; vo_subdevice += 3; opt_no = 0; + } else if (!strncmp(vo_subdevice, "crtc1", 5)) { + use_crtc1 = !opt_no; + vo_subdevice += 5; + opt_no = 0; } else if (!strncmp(vo_subdevice, "crtc2", 5)) { use_crtc2 = !opt_no; vo_subdevice += 5; @@ -358,6 +367,7 @@ preinit( const char *arg ) "Example: mplayer -vo dfbmga:nocrtc2:bes:buffermode=single\n" "\nOptions (use 'no' prefix to disable):\n" " bes Use Backend Scaler\n" + " crtc1 Use CRTC1\n" " crtc2 Use CRTC2\n" " spic Use hardware sub-picture for OSD\n" " input Use DirectFB for keyboard input\n" @@ -378,10 +388,14 @@ preinit( const char *arg ) return -1; } } - if (!use_bes && !use_crtc2) { + if (!use_bes && !use_crtc1 && !use_crtc2) { mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" ); return -1; } + if (use_bes && use_crtc1) { + mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" ); + return -1; + } if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, @@ -419,7 +433,7 @@ preinit( const char *arg ) return -1; } - if (use_bes) { + if (use_crtc1 || use_bes) { struct layer_enum l = { "FBDev Primary Layer", &primary, @@ -554,6 +568,8 @@ static void release_config( void ) spic->Release( spic ); if (c2frame) c2frame->Release( c2frame ); + if (c1frame) + c1frame->Release( c1frame ); if (besframe) besframe->Release( besframe ); if (bufs[0]) @@ -566,6 +582,7 @@ static void release_config( void ) spicframe = NULL; spic = NULL; c2frame = NULL; + c1frame = NULL; besframe = NULL; bufs[0] = NULL; bufs[1] = NULL; @@ -684,6 +701,63 @@ config( uint32_t width, uint32_t height, mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: BES surface %dx%d %s\n", dlc.width, dlc.height, pixelformat_name( dlc.pixelformat ) ); } + /* + * CRTC1 + */ + if (use_crtc1) { + dlc.flags = DLCONF_BUFFERMODE; + dlc.buffermode = buffermode; + + if ((res = primary->TestConfiguration( primary, &dlc, &failed )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, + "vo_dfbmga: Invalid CRTC1 configuration - %s!\n", + DirectFBErrorString( res ) ); + return -1; + } + if ((res = primary->SetConfiguration( primary, &dlc )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, + "vo_dfbmga: CRTC1 configuration failed - %s!\n", + DirectFBErrorString( res ) ); + return -1; + } + if ((res = primary->GetConfiguration( primary, &dlc )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, + "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n", + DirectFBErrorString( res ) ); + return -1; + } + + primary->GetSurface( primary, &c1frame ); + c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX ); + c1frame->SetColor( c1frame, 0, 0, 0, 0xff ); + + c1frame->GetSize( c1frame, &screen_width, &screen_height ); + + aspect_save_screenres( screen_width, screen_height ); + aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM ); + + if (in_width != out_width || in_height != out_height) + c1stretch = 1; + else + c1stretch = 0; + + c1rect.x = (screen_width - out_width) / 2; + c1rect.y = (screen_height - out_height) / 2; + c1rect.w = out_width; + c1rect.h = out_height; + + c1frame->Clear( c1frame, 0, 0, 0, 0xff ); + c1frame->Flip( c1frame, NULL, 0 ); + c1frame->Clear( c1frame, 0, 0, 0, 0xff ); + c1frame->Flip( c1frame, NULL, 0 ); + c1frame->Clear( c1frame, 0, 0, 0, 0xff ); + + mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 using %s buffering\n", + dlc.buffermode == DLBM_TRIPLE ? "triple" : + dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" ); + mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 surface %dx%d %s\n", screen_width, screen_height, pixelformat_name( dlc.pixelformat ) ); + } + /* * CRTC2 */ @@ -865,6 +939,10 @@ config( uint32_t width, uint32_t height, /* Draw OSD to CRTC2 surface */ subframe = c2frame; subrect = &c2rect; + } else if (use_crtc1) { + /* Draw OSD to CRTC1 surface */ + subframe = c1frame; + subrect = &c1rect; } else { /* Draw OSD to BES surface */ subframe = besframe; @@ -876,7 +954,8 @@ config( uint32_t width, uint32_t height, mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Sub-picture surface %dx%d %s (%s)\n", sub_width, sub_height, pixelformat_name( subframe_format ), - use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") : "BES" ); + use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") : + use_crtc1 ? "CRTC1" : "BES" ); osd_dirty = 0; osd_current = 1; @@ -889,21 +968,28 @@ static int query_format( uint32_t format ) { switch (format) { - case IMGFMT_BGR32: - case IMGFMT_BGR16: - case IMGFMT_BGR15: - case IMGFMT_UYVY: case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: + if (is_g200 || use_crtc1) + return 0; + break; + case IMGFMT_BGR32: + case IMGFMT_BGR16: + case IMGFMT_BGR15: + if (is_g200 && use_bes) + return 0; + break; + case IMGFMT_UYVY: if (is_g200) return 0; + break; case IMGFMT_YUY2: break; #if DIRECTFBVERSION > DFB_VERSION(0,9,21) case IMGFMT_NV12: case IMGFMT_NV21: - if (!use_bes || use_crtc2) + if (use_crtc1 || use_crtc2) return 0; break; #endif @@ -1096,6 +1182,18 @@ blit_to_screen( void ) srect = &besrect; } + if (use_crtc1) { +#if DIRECTFBVERSION > DFB_VERSION(0,9,15) + if (vo_vsync && !flipping) + primary->WaitForSync( primary ); +#endif + + if (c1stretch) + c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect ); + else + c1frame->Blit( c1frame, blitsrc, srect, c1rect.x, c1rect.y ); + } + if (use_crtc2) { #if DIRECTFBVERSION > DFB_VERSION(0,9,15) if (vo_vsync && !flipping) @@ -1161,7 +1259,9 @@ flip_page( void ) if (flipping) { if (use_crtc2) c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC ); - else + if (use_crtc1) + c1frame->Flip( c1frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC ); + if (use_bes) besframe->Flip( besframe, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC ); if (!use_spic) { @@ -1334,6 +1434,8 @@ set_equalizer( char *data, int value ) /* Prefer CRTC2 over BES */ if (use_crtc2) res = crtc2->SetColorAdjustment( crtc2, &ca ); + else if (use_crtc1) + res = primary->SetColorAdjustment( primary, &ca ); else res = bes->SetColorAdjustment( bes, &ca ); @@ -1353,6 +1455,8 @@ get_equalizer( char *data, int *value ) /* Prefer CRTC2 over BES */ if (use_crtc2) res = crtc2->GetColorAdjustment( crtc2, &ca ); + else if (use_crtc1) + res = primary->GetColorAdjustment( primary, &ca ); else res = bes->GetColorAdjustment( bes, &ca ); From af709594ea4f34f1788ffc566127e54b790f2dc9 Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:41:08 +0000 Subject: [PATCH 50/76] Rename some variables and change some strings to make the CRTC1 code clearer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27623 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 898593b00d..8d22123826 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -58,7 +58,7 @@ const LIBVO_EXTERN(dfbmga) */ static IDirectFB *dfb; -static IDirectFBDisplayLayer *primary; +static IDirectFBDisplayLayer *crtc1; static IDirectFBDisplayLayer *bes; static IDirectFBDisplayLayer *crtc2; static IDirectFBDisplayLayer *spic; @@ -90,7 +90,7 @@ static IDirectFBEventBuffer *buffer; static int blit_done; static int c1stretch; -static int stretch; +static int c2stretch; static int use_bes; static int use_crtc1; @@ -436,18 +436,18 @@ preinit( const char *arg ) if (use_crtc1 || use_bes) { struct layer_enum l = { "FBDev Primary Layer", - &primary, + &crtc1, DFB_UNSUPPORTED }; dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l ); if (l.res != DFB_OK) { - mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get primary layer - %s\n", + mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get CRTC1 layer - %s\n", DirectFBErrorString( l.res ) ); uninit(); return -1; } - if ((res = primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE )) != DFB_OK) { - mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to primary layer - %s\n", + if ((res = crtc1->SetCooperativeLevel( crtc1, DLSCL_EXCLUSIVE )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC1 layer - %s\n", DirectFBErrorString( res ) ); uninit(); return -1; @@ -708,26 +708,26 @@ config( uint32_t width, uint32_t height, dlc.flags = DLCONF_BUFFERMODE; dlc.buffermode = buffermode; - if ((res = primary->TestConfiguration( primary, &dlc, &failed )) != DFB_OK) { + if ((res = crtc1->TestConfiguration( crtc1, &dlc, &failed )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Invalid CRTC1 configuration - %s!\n", DirectFBErrorString( res ) ); return -1; } - if ((res = primary->SetConfiguration( primary, &dlc )) != DFB_OK) { + if ((res = crtc1->SetConfiguration( crtc1, &dlc )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: CRTC1 configuration failed - %s!\n", DirectFBErrorString( res ) ); return -1; } - if ((res = primary->GetConfiguration( primary, &dlc )) != DFB_OK) { + if ((res = crtc1->GetConfiguration( crtc1, &dlc )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n", DirectFBErrorString( res ) ); return -1; } - primary->GetSurface( primary, &c1frame ); + crtc1->GetSurface( crtc1, &c1frame ); c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX ); c1frame->SetColor( c1frame, 0, 0, 0, 0xff ); @@ -842,9 +842,9 @@ config( uint32_t width, uint32_t height, if (in_width != out_width || in_height != out_height) - stretch = 1; + c2stretch = 1; else - stretch = 0; + c2stretch = 0; c2rect.x = (screen_width - out_width) / 2; c2rect.y = (screen_height - out_height) / 2; @@ -1185,7 +1185,7 @@ blit_to_screen( void ) if (use_crtc1) { #if DIRECTFBVERSION > DFB_VERSION(0,9,15) if (vo_vsync && !flipping) - primary->WaitForSync( primary ); + crtc1->WaitForSync( crtc1 ); #endif if (c1stretch) @@ -1200,7 +1200,7 @@ blit_to_screen( void ) crtc2->WaitForSync( crtc2 ); #endif - if (stretch) + if (c2stretch) c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect ); else c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y ); @@ -1290,8 +1290,8 @@ uninit( void ) crtc2->Release( crtc2 ); if (bes) bes->Release( bes ); - if (primary) - primary->Release( primary ); + if (crtc1) + crtc1->Release( crtc1 ); if (dfb) dfb->Release( dfb ); @@ -1300,7 +1300,7 @@ uninit( void ) keyboard = NULL; crtc2 = NULL; bes = NULL; - primary = NULL; + crtc1 = NULL; dfb = NULL; } @@ -1435,7 +1435,7 @@ set_equalizer( char *data, int value ) if (use_crtc2) res = crtc2->SetColorAdjustment( crtc2, &ca ); else if (use_crtc1) - res = primary->SetColorAdjustment( primary, &ca ); + res = crtc1->SetColorAdjustment( crtc1, &ca ); else res = bes->SetColorAdjustment( bes, &ca ); @@ -1456,7 +1456,7 @@ get_equalizer( char *data, int *value ) if (use_crtc2) res = crtc2->GetColorAdjustment( crtc2, &ca ); else if (use_crtc1) - res = primary->GetColorAdjustment( primary, &ca ); + res = crtc1->GetColorAdjustment( crtc1, &ca ); else res = bes->GetColorAdjustment( bes, &ca ); From 7c94b443089d174e37085df4f5995031faf1fd35 Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:43:24 +0000 Subject: [PATCH 51/76] Don't limit BES to non-synced single buffering when CRTC2 is used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27624 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 8d22123826..1b2e477fe9 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -666,10 +666,6 @@ config( uint32_t width, uint32_t height, dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE; dlc.width = besrect.w + besrect.x * 2; dlc.height = besrect.h + besrect.y * 2; - - if (use_crtc2) - dlc.buffermode = DLBM_FRONTONLY; - else dlc.buffermode = buffermode; if ((res = bes->TestConfiguration( bes, &dlc, &failed )) != DFB_OK) { @@ -1173,7 +1169,7 @@ blit_to_screen( void ) if (use_bes) { #if DIRECTFBVERSION > DFB_VERSION(0,9,15) - if (vo_vsync && !flipping && !use_crtc2) + if (vo_vsync && !flipping) bes->WaitForSync( bes ); #endif From b129179e5d68a6980316fc726de3d88c08560532 Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:45:17 +0000 Subject: [PATCH 52/76] Cosmetics: - Convert tabs to spaces - Remove trailing whitespace - Remove useless comments git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27625 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 277 ++++++++++++++++++++++------------------------ 1 file changed, 133 insertions(+), 144 deletions(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 1b2e477fe9..cf4528b630 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -49,13 +49,6 @@ static const vo_info_t info = { const LIBVO_EXTERN(dfbmga) -/****************************** -* directfb * -******************************/ - -/* - * (Globals) - */ static IDirectFB *dfb; static IDirectFBDisplayLayer *crtc1; @@ -110,10 +103,6 @@ static int osd_max; static int is_g200; -/****************************** -* vo_dfbmga * -******************************/ - #if DIRECTFBVERSION < DFB_VERSION(0,9,18) #define DSPF_ALUT44 DSPF_LUT8 #define DLBM_TRIPLE ~0 @@ -141,19 +130,19 @@ pixelformat_name( DFBSurfacePixelFormat format ) case DSPF_RGB32: return "RGB32"; case DSPF_RGB16: - return "RGB16"; + return "RGB16"; case DSPF_ARGB1555: - return "ARGB1555"; + return "ARGB1555"; case DSPF_YUY2: - return "YUY2"; + return "YUY2"; case DSPF_UYVY: - return "UYVY"; + return "UYVY"; case DSPF_YV12: - return "YV12"; + return "YV12"; case DSPF_I420: - return "I420"; + return "I420"; case DSPF_ALUT44: - return "ALUT44"; + return "ALUT44"; #if DIRECTFBVERSION > DFB_VERSION(0,9,21) case DSPF_NV12: return "NV12"; @@ -161,7 +150,7 @@ pixelformat_name( DFBSurfacePixelFormat format ) return "NV21"; #endif default: - return "Unknown pixel format"; + return "Unknown pixel format"; } } @@ -170,17 +159,17 @@ imgfmt_to_pixelformat( uint32_t format ) { switch (format) { case IMGFMT_BGR32: - return DSPF_RGB32; + return DSPF_RGB32; case IMGFMT_BGR16: - return DSPF_RGB16; + return DSPF_RGB16; case IMGFMT_BGR15: - return DSPF_ARGB1555; + return DSPF_ARGB1555; case IMGFMT_YUY2: - return DSPF_YUY2; + return DSPF_YUY2; case IMGFMT_UYVY: - return DSPF_UYVY; + return DSPF_UYVY; case IMGFMT_YV12: - return DSPF_YV12; + return DSPF_YV12; case IMGFMT_I420: case IMGFMT_IYUV: return DSPF_I420; @@ -191,7 +180,7 @@ imgfmt_to_pixelformat( uint32_t format ) return DSPF_NV21; #endif default: - return DSPF_UNKNOWN; + return DSPF_UNKNOWN; } } @@ -360,7 +349,7 @@ preinit( const char *arg ) show_help = 1; break; } - } + } if (show_help) { mp_msg( MSGT_VO, MSGL_ERR, "\nvo_dfbmga command line help:\n" @@ -389,49 +378,49 @@ preinit( const char *arg ) } } if (!use_bes && !use_crtc1 && !use_crtc2) { - mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" ); + mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" ); return -1; } if (use_bes && use_crtc1) { - mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" ); + mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" ); return -1; } - if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) { - mp_msg( MSGT_VO, MSGL_ERR, - "vo_dfbmga: DirectFBInit() failed - %s\n", - DirectFBErrorString( res ) ); - return -1; - } + if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, + "vo_dfbmga: DirectFBInit() failed - %s\n", + DirectFBErrorString( res ) ); + return -1; + } - switch (tvnorm) { - case 0: - DirectFBSetOption( "matrox-tv-standard", "pal" ); - mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" ); - break; - case 1: + switch (tvnorm) { + case 0: + DirectFBSetOption( "matrox-tv-standard", "pal" ); + mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" ); + break; + case 1: + DirectFBSetOption( "matrox-tv-standard", "ntsc" ); + mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" ); + break; + case 2: + if (vo_fps > 27) { DirectFBSetOption( "matrox-tv-standard", "ntsc" ); - mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" ); - break; - case 2: - if (vo_fps > 27) { - DirectFBSetOption( "matrox-tv-standard", "ntsc" ); - mp_msg( MSGT_VO, MSGL_INFO, - "vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" ); - } else { - DirectFBSetOption( "matrox-tv-standard", "pal" ); - mp_msg( MSGT_VO, MSGL_INFO, - "vo_dfbmga: Selected TV standard based upon FPS: PAL\n" ); - } - break; + mp_msg( MSGT_VO, MSGL_INFO, + "vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" ); + } else { + DirectFBSetOption( "matrox-tv-standard", "pal" ); + mp_msg( MSGT_VO, MSGL_INFO, + "vo_dfbmga: Selected TV standard based upon FPS: PAL\n" ); } + break; + } - if ((res = DirectFBCreate( &dfb )) != DFB_OK) { - mp_msg( MSGT_VO, MSGL_ERR, - "vo_dfbmga: DirectFBCreate() failed - %s\n", - DirectFBErrorString( res ) ); - return -1; - } + if ((res = DirectFBCreate( &dfb )) != DFB_OK) { + mp_msg( MSGT_VO, MSGL_ERR, + "vo_dfbmga: DirectFBCreate() failed - %s\n", + DirectFBErrorString( res ) ); + return -1; + } if (use_crtc1 || use_bes) { struct layer_enum l = { @@ -556,7 +545,7 @@ preinit( const char *arg ) return -1; } } - + return 0; } @@ -578,7 +567,7 @@ static void release_config( void ) bufs[1]->Release( bufs[1] ); if (bufs[2]) bufs[2]->Release( bufs[2] ); - + spicframe = NULL; spic = NULL; c2frame = NULL; @@ -594,7 +583,7 @@ config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, - uint32_t format ) + uint32_t format ) { DFBResult res; @@ -666,7 +655,7 @@ config( uint32_t width, uint32_t height, dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE; dlc.width = besrect.w + besrect.x * 2; dlc.height = besrect.h + besrect.y * 2; - dlc.buffermode = buffermode; + dlc.buffermode = buffermode; if ((res = bes->TestConfiguration( bes, &dlc, &failed )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, @@ -964,33 +953,33 @@ static int query_format( uint32_t format ) { switch (format) { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - if (is_g200 || use_crtc1) - return 0; - break; - case IMGFMT_BGR32: - case IMGFMT_BGR16: - case IMGFMT_BGR15: - if (is_g200 && use_bes) - return 0; - break; - case IMGFMT_UYVY: - if (is_g200) - return 0; - break; - case IMGFMT_YUY2: - break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) - case IMGFMT_NV12: - case IMGFMT_NV21: - if (use_crtc1 || use_crtc2) - return 0; - break; -#endif - default: + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + if (is_g200 || use_crtc1) return 0; + break; + case IMGFMT_BGR32: + case IMGFMT_BGR16: + case IMGFMT_BGR15: + if (is_g200 && use_bes) + return 0; + break; + case IMGFMT_UYVY: + if (is_g200) + return 0; + break; + case IMGFMT_YUY2: + break; +#if DIRECTFBVERSION > DFB_VERSION(0,9,21) + case IMGFMT_NV12: + case IMGFMT_NV21: + if (use_crtc1 || use_crtc2) + return 0; + break; +#endif + default: + return 0; } return VFCAP_HWSCALE_UP | @@ -1002,11 +991,11 @@ query_format( uint32_t format ) static void vo_draw_alpha_alut44( int w, int h, - unsigned char* src, - unsigned char *srca, - int srcstride, - unsigned char* dst, - int dststride ) + unsigned char* src, + unsigned char *srca, + int srcstride, + unsigned char* dst, + int dststride ) { int x; @@ -1033,7 +1022,7 @@ static void draw_alpha( int x0, int y0, int w, int h, unsigned char *src, - unsigned char *srca, + unsigned char *srca, int stride ) { uint8_t *dst; @@ -1060,44 +1049,44 @@ draw_alpha( int x0, int y0, case DSPF_ALUT44: vo_draw_alpha_alut44( w, h, src, srca, stride, dst + pitch * y0 + x0, - pitch ); + pitch ); break; case DSPF_RGB32: case DSPF_ARGB: - vo_draw_alpha_rgb32( w, h, src, srca, stride, + vo_draw_alpha_rgb32( w, h, src, srca, stride, dst + pitch * y0 + 4 * x0, pitch ); - break; + break; case DSPF_RGB16: - vo_draw_alpha_rgb16( w, h, src, srca, stride, + vo_draw_alpha_rgb16( w, h, src, srca, stride, dst + pitch * y0 + 2 * x0, pitch ); - break; + break; case DSPF_ARGB1555: - vo_draw_alpha_rgb15( w, h, src, srca, stride, + vo_draw_alpha_rgb15( w, h, src, srca, stride, dst + pitch * y0 + 2 * x0, pitch ); - break; + break; case DSPF_YUY2: - vo_draw_alpha_yuy2( w, h, src, srca, stride, + vo_draw_alpha_yuy2( w, h, src, srca, stride, dst + pitch * y0 + 2 * x0, pitch ); - break; + break; case DSPF_UYVY: - vo_draw_alpha_yuy2( w, h, src, srca, stride, + vo_draw_alpha_yuy2( w, h, src, srca, stride, dst + pitch * y0 + 2 * x0 + 1, pitch ); - break; + break; #if DIRECTFBVERSION > DFB_VERSION(0,9,21) case DSPF_NV12: case DSPF_NV21: #endif case DSPF_I420: case DSPF_YV12: - vo_draw_alpha_yv12( w, h, src, srca, stride, + vo_draw_alpha_yv12( w, h, src, srca, stride, dst + pitch * y0 + x0, pitch ); - break; + break; } subframe->Unlock( subframe ); @@ -1135,25 +1124,25 @@ draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y ) } else #endif { - x /= 2; - w /= 2; - pitch /= 2; + x /= 2; + w /= 2; + pitch /= 2; - if (frame_format == DSPF_I420 ) - memcpy_pic( dst + pitch * y + x, src[1], - w, h, pitch, stride[1] ); - else - memcpy_pic( dst + pitch * y + x, src[2], - w, h, pitch, stride[2] ); + if (frame_format == DSPF_I420 ) + memcpy_pic( dst + pitch * y + x, src[1], + w, h, pitch, stride[1] ); + else + memcpy_pic( dst + pitch * y + x, src[2], + w, h, pitch, stride[2] ); - dst += pitch * buf_height / 2; + dst += pitch * buf_height / 2; - if (frame_format == DSPF_I420 ) - memcpy_pic( dst + pitch * y + x, src[2], - w, h, pitch, stride[2] ); - else - memcpy_pic( dst + pitch * y + x, src[1], - w, h, pitch, stride[1] ); + if (frame_format == DSPF_I420 ) + memcpy_pic( dst + pitch * y + x, src[2], + w, h, pitch, stride[2] ); + else + memcpy_pic( dst + pitch * y + x, src[1], + w, h, pitch, stride[1] ); } frame->Unlock( frame ); @@ -1196,9 +1185,9 @@ blit_to_screen( void ) crtc2->WaitForSync( crtc2 ); #endif - if (c2stretch) + if (c2stretch) c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect ); - else + else c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y ); } } @@ -1232,8 +1221,8 @@ draw_osd( void ) osd_dirty &= ~osd_current; } - blit_to_screen(); - blit_done = 1; + blit_to_screen(); + blit_done = 1; vo_remove_text( sub_width, sub_height, clear_alpha ); vo_draw_text( sub_width, sub_height, draw_alpha ); @@ -1249,8 +1238,8 @@ draw_osd( void ) static void flip_page( void ) { - if (!blit_done) - blit_to_screen(); + if (!blit_done) + blit_to_screen(); if (flipping) { if (use_crtc2) @@ -1341,17 +1330,17 @@ get_image( mp_image_t *mpi ) if (mpi->flags & MP_IMGFLAG_PLANAR) { if (mpi->num_planes > 2) { - mpi->stride[1] = mpi->stride[2] = pitch / 2; + mpi->stride[1] = mpi->stride[2] = pitch / 2; - if (mpi->flags & MP_IMGFLAG_SWAPPED) { - /* I420 */ - mpi->planes[1] = dst + buf_height * pitch; - mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4; - } else { - /* YV12 */ - mpi->planes[2] = dst + buf_height * pitch; - mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4; - } + if (mpi->flags & MP_IMGFLAG_SWAPPED) { + /* I420 */ + mpi->planes[1] = dst + buf_height * pitch; + mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4; + } else { + /* YV12 */ + mpi->planes[2] = dst + buf_height * pitch; + mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4; + } } else { /* NV12/NV21 */ mpi->stride[1] = pitch; @@ -1458,7 +1447,7 @@ get_equalizer( char *data, int *value ) if (res != DFB_OK) return VO_FALSE; - + if (!strcasecmp( data, "brightness" ) && (ca.flags & DCAF_BRIGHTNESS)) *value = (ca.brightness - 0x8000) * factor; @@ -1484,7 +1473,7 @@ control( uint32_t request, void *data, ... ) return VO_TRUE; case VOCTRL_QUERY_FORMAT: - return query_format( *((uint32_t *) data) ); + return query_format( *((uint32_t *) data) ); case VOCTRL_GET_IMAGE: return get_image( data ); @@ -1597,7 +1586,7 @@ check_events( void ) mplayer_put_key( KEY_PREV ); break; case DIKS_VOLUME_UP: - mplayer_put_key( KEY_VOLUME_UP ); + mplayer_put_key( KEY_VOLUME_UP ); break; case DIKS_VOLUME_DOWN: mplayer_put_key( KEY_VOLUME_DOWN ); From d4471e0a095e25e2e8932cf41f8eee4a62edd14c Mon Sep 17 00:00:00 2001 From: syrjala Date: Mon, 15 Sep 2008 20:46:43 +0000 Subject: [PATCH 53/76] Update the copyright statement. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27626 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_dfbmga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index cf4528b630..fd1a3638db 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -1,7 +1,7 @@ /* * MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550 * - * copyright (C) 2002-2005 Ville Syrjala + * copyright (C) 2002-2008 Ville Syrjala * Originally based on vo_directfb.c by Jiri Svoboda . * * This file is part of MPlayer. From d17f5c5c72f9d9207db83908117e07773ac9a131 Mon Sep 17 00:00:00 2001 From: compn Date: Tue, 16 Sep 2008 02:43:02 +0000 Subject: [PATCH 54/76] yet another mpeg2 in mov fourcc xd5b, fixes XDCAMHD.mov git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27627 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index c8c06023e4..4dc66c48ff 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -85,6 +85,7 @@ videocodec mpegpes fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf + fourcc xd5b driver mpegpes out MPES @@ -119,6 +120,7 @@ videocodec ffmpeg2 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf + fourcc xd5b driver ffmpeg dll "mpeg2video" out YV12,I420,IYUV @@ -147,6 +149,7 @@ videocodec ffmpeg12 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf + fourcc xd5b driver ffmpeg dll "mpegvideo" out YV12,I420,IYUV @@ -176,6 +179,7 @@ videocodec mpeg12 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf + fourcc xd5b driver libmpeg2 ; dll "libmpeg2" out YV12,I420,IYUV @@ -203,6 +207,7 @@ videocodec ffmpeg12mc fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf + fourcc xd5b driver ffmpeg dll "mpegvideo_xvmc" out IDCT_MPEG2 From e4a71d081875ccb46e4e808b5e738f8b867df355 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 16 Sep 2008 03:49:54 +0000 Subject: [PATCH 55/76] Fix segfault with rgb24 and full_internal_chroma due to non-existing alpha byte being written after the array. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27628 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 56a349c811..a7c42c8371 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -905,29 +905,34 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t * { int i; int step= fmt_depth(c->dstFormat)/8; + int aidx= 3; switch(c->dstFormat){ case PIX_FMT_ARGB: dest++; + aidx= 0; case PIX_FMT_RGB24: + aidx--; case PIX_FMT_RGBA: YSCALE_YUV_2_RGBX_FULL_C(1<<21) + dest[aidx]= 0; dest[0]= R>>22; dest[1]= G>>22; dest[2]= B>>22; - dest[3]= 0; dest+= step; } break; case PIX_FMT_ABGR: dest++; + aidx= 0; case PIX_FMT_BGR24: + aidx--; case PIX_FMT_BGRA: YSCALE_YUV_2_RGBX_FULL_C(1<<21) + dest[aidx]= 0; dest[0]= B>>22; dest[1]= G>>22; dest[2]= R>>22; - dest[3]= 0; dest+= step; } break; From bcd214aa786d30055d2e6093e645cf4df433ef87 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 16 Sep 2008 12:44:32 +0000 Subject: [PATCH 56/76] Initialize _def_liba52 and _def_liba52_internal before the liba52 checks so that they are always set to some value. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27629 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 99c3e9670e..f82cd1bf62 100755 --- a/configure +++ b/configure @@ -6074,6 +6074,8 @@ fi echores "$_mp3lib" echocheck "liba52 support" +_def_liba52='#undef CONFIG_LIBA52' +_def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL" if test "$_liba52_internal" = auto ; then _liba52=yes _liba52_internal=yes @@ -6094,8 +6096,6 @@ if test "$_liba52" = yes ; then _def_liba52='#define CONFIG_LIBA52 1' _codecmodules="liba52($_res_comment) $_codecmodules" else - _def_liba52='#undef CONFIG_LIBA52' - _def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL" _nocodecmodules="liba52 $_nocodecmodules" fi echores "$_liba52" From e90a28f7cfbcf41f821c03cafdd3070cf9f2eec4 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 16 Sep 2008 13:15:13 +0000 Subject: [PATCH 57/76] Do not clobber _inc_extra variable when setting initial include flags. based on patch by Andrew Wason, rectalogic rectalogic com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27630 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index f82cd1bf62..29ef1f6707 100755 --- a/configure +++ b/configure @@ -1354,7 +1354,7 @@ if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then fi -_inc_extra=-I. +_inc_extra="$_inc_extra -I." _timer=timer-linux.c _getch=getch2.c if freebsd ; then From 261e389fdde9b595c2c2068708a636ce539449fb Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 16 Sep 2008 21:30:04 +0000 Subject: [PATCH 58/76] With -identify, ID_DVD_VOLUME_ID is not shown on some systems. Using DVDISOVolumeInfo instead of DVDUDFVolumeInfo fixes this. patch by Mathieu SCHROETER, mathieu.schroeter gamesover ch git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27631 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 85bb485c4f..b28cb874b7 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -873,7 +873,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { mp_msg(MSGT_IDENTIFY, MSGL_V, "%02X", discid[i]); mp_msg(MSGT_IDENTIFY, MSGL_V, "\n"); } - if (DVDUDFVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0) + if (DVDUDFVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0 || DVDISOVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0) mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_DVD_VOLUME_ID=%s\n", volid); } /** From c8d9bf0f50c40f54cc183434421dd799daa71689 Mon Sep 17 00:00:00 2001 From: rathann Date: Tue, 16 Sep 2008 22:30:22 +0000 Subject: [PATCH 59/76] Add shared libswscale support. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27632 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Makefile | 2 +- configure | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8cf984c210..81f0ee487a 100644 --- a/Makefile +++ b/Makefile @@ -634,7 +634,7 @@ COMMON_LIBS-$(LIBAVFORMAT_A) += libavformat/libavformat.a COMMON_LIBS-$(LIBAVCODEC_A) += libavcodec/libavcodec.a COMMON_LIBS-$(LIBAVUTIL_A) += libavutil/libavutil.a COMMON_LIBS-$(LIBPOSTPROC_A) += libpostproc/libpostproc.a -COMMON_LIBS = libswscale/libswscale.a +COMMON_LIBS-$(LIBSWSCALE_A) += libswscale/libswscale.a COMMON_LIBS += $(COMMON_LIBS-yes) OBJS_COMMON += $(addsuffix .o, $(basename $(SRCS_COMMON))) diff --git a/configure b/configure index 29ef1f6707..576b3b4209 100755 --- a/configure +++ b/configure @@ -293,10 +293,12 @@ Codecs: --disable-libavcodec_a disable static libavcodec [autodetect] --disable-libavformat_a disable static libavformat [autodetect] --disable-libpostproc_a disable static libpostproc [autodetect] + --disable-libswscale_a disable static libswscale [autodetect] --disable-libavutil_so disable shared libavutil [autodetect] --disable-libavcodec_so disable shared libavcodec [autodetect] --disable-libavformat_so disable shared libavformat [autodetect] --disable-libpostproc_so disable shared libpostproc [autodetect] + --disable-libswscale_so disable shared libswscale [autodetect] --disable-libavcodec_mpegaudio_hp disable high precision audio decoding in libavcodec [enabled] --disable-tremor-internal disable internal Tremor [enabled] @@ -518,6 +520,8 @@ _libavformat_a=auto _libavformat_so=auto _libpostproc_a=auto _libpostproc_so=auto +_libswscale_a=auto +_libswscale_so=auto _libavcodec_mpegaudio_hp=yes _mencoder=yes _mplayer=yes @@ -1086,6 +1090,10 @@ for ac_option do --disable-libpostproc_a) _libpostproc_a=no ;; --enable-libpostproc_so) _libpostproc_so=yes ;; --disable-libpostproc_so) _libpostproc_so=no ;; + --enable-libswscale_a) _libswscale_a=yes ;; + --disable-libswscale_a) _libswscale_a=no ;; + --enable-libswscale_so) _libswscale_so=yes ;; + --disable-libswscale_so) _libswscale_so=no ;; --enable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=yes ;; --disable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=no ;; @@ -6605,6 +6613,40 @@ test "$_libpostproc_so" = yes \ && _def_libpostproc_so='#define CONFIG_LIBPOSTPROC_SO 1' echores "$_libpostproc" +echocheck "FFmpeg libswscale" +if test "$_libswscale_a" = auto ; then + _libswscale_a=no + if test -d libswscale && test -f libswscale/swscale.h ; then + _libswscale_a='yes' + _res_comment="static" + fi +elif test "$_libswscale_so" = auto ; then + _libswscale_so=no + _res_comment="using libswscale.so, but static libswscale is recommended" + cat > $TMPC << EOF + #include + int main(void) { sws_scale(0, 0, 0, 0, 0, 0, 0); return 0; } +EOF + if $_pkg_config --exists libswscale ; then + _inc_libswscale=`$_pkg_config --cflags libswscale` + _ld_tmp=`$_pkg_config --libs libswscale` + cc_check $_inc_libswscale $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" \ + && _libswscale_so=yes + elif cc_check -lswscale ; then + _ld_extra="$_ld_extra -lswscale" + _libswscale_so=yes + fi +fi +_libswscale=no +_def_libswscale='#undef CONFIG_LIBSWSCALE' +_def_libswscale_a='#undef CONFIG_LIBSWSCALE_A' +_def_libswscale_so='#undef CONFIG_LIBSWSCALE_SO' +test "$_libswscale_a" = yes || test "$_libswscale_so" = yes && _libswscale=yes +test "$_libswscale" = yes && _def_libswscale='#define CONFIG_LIBSWSCALE 1' +test "$_libswscale_a" = yes && _def_libswscale_a='#define CONFIG_LIBSWSCALE_A 1' +test "$_libswscale_so" = yes \ + && _def_libswscale_so='#define CONFIG_LIBSWSCALE_SO 1' +echores "$_libswscale" echocheck "libamr narrowband" if test "$_libamr_nb" = auto ; then @@ -7973,6 +8015,9 @@ LIBAVFORMAT_SO = $_libavformat_so LIBPOSTPROC = $_libpostproc LIBPOSTPROC_A = $_libpostproc_a LIBPOSTPROC_SO = $_libpostproc_so +LIBSWSCALE = $_libswscale +LIBSWSCALE_A = $_libswscale_a +LIBSWSCALE_SO = $_libswscale_so BUILD_STATIC=yes SRC_PATH=.. @@ -8342,6 +8387,10 @@ $_def_libavutil $_def_libavutil_a $_def_libavutil_so +$_def_libswscale +$_def_libswscale_a +$_def_libswscale_so + /* Use libavcodec's decoders */ #define CONFIG_DECODERS 1 #define ENABLE_DECODERS 1 From 5cc8c991a47093234d6dfdbbc58efa8a63eaad5f Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 17 Sep 2008 20:23:41 +0000 Subject: [PATCH 60/76] Fix mapping between MPlayer and FFmpeg colorspaces after libswscale changes. patch by Reimar git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27633 b3059339-0415-0410-9bf9-f77b7e298cf2 --- fmt-conversion.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fmt-conversion.h b/fmt-conversion.h index b27803eea3..13035cdea7 100644 --- a/fmt-conversion.h +++ b/fmt-conversion.h @@ -13,32 +13,32 @@ enum PixelFormat imgfmt2pixfmt(int fmt) case IMGFMT_BGR24: return PIX_FMT_BGR24; case IMGFMT_BGR16: - return PIX_FMT_BGR565; + return PIX_FMT_RGB565; case IMGFMT_BGR15: - return PIX_FMT_BGR555; + return PIX_FMT_RGB555; case IMGFMT_BGR8: - return PIX_FMT_BGR8; + return PIX_FMT_RGB8; case IMGFMT_BGR4: - return PIX_FMT_BGR4; + return PIX_FMT_RGB4; case IMGFMT_BGR1: case IMGFMT_RGB1: return PIX_FMT_MONOBLACK; case IMGFMT_RG4B: - return PIX_FMT_RGB4_BYTE; - case IMGFMT_BG4B: return PIX_FMT_BGR4_BYTE; + case IMGFMT_BG4B: + return PIX_FMT_RGB4_BYTE; case IMGFMT_RGB32: return PIX_FMT_BGR32; case IMGFMT_RGB24: return PIX_FMT_RGB24; case IMGFMT_RGB16: - return PIX_FMT_RGB565; + return PIX_FMT_BGR565; case IMGFMT_RGB15: - return PIX_FMT_RGB555; + return PIX_FMT_BGR555; case IMGFMT_RGB8: - return PIX_FMT_RGB8; + return PIX_FMT_BGR8; case IMGFMT_RGB4: - return PIX_FMT_RGB4; + return PIX_FMT_BGR4; case IMGFMT_YUY2: return PIX_FMT_YUYV422; case IMGFMT_UYVY: From b1f6b965481514a7d2878db9f96043b7b5c2df81 Mon Sep 17 00:00:00 2001 From: lu_zero Date: Thu, 18 Sep 2008 00:22:53 +0000 Subject: [PATCH 61/76] Factorize unit32_t* casts for palette pointer git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27634 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 04562a6932..87ef2d94cc 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2349,7 +2349,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, int flags, int canMMX2BeUsed, int16_t *hLumFilter, int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, - int32_t *mmx2FilterPos, uint8_t *pal) + int32_t *mmx2FilterPos, uint32_t *pal) { if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { @@ -2413,7 +2413,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { - RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); + RENAME(palToY)(formatConvBuffer, src, srcW, pal); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE) @@ -2579,7 +2579,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, - int32_t *mmx2FilterPos, uint8_t *pal) + int32_t *mmx2FilterPos, uint32_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { @@ -2689,7 +2689,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { - RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal); + RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } @@ -2911,7 +2911,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample; const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample); int lastDstY; - uint8_t *pal=NULL; + uint32_t *pal=NULL; /* vars which will change and which we need to store back in the context */ int dstY= c->dstY; @@ -2921,7 +2921,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s int lastInChrBuf= c->lastInChrBuf; if (isPacked(c->srcFormat)){ - pal= src[1]; + pal= (uint32_t *)src[1]; src[0]= src[1]= src[2]= src[0]; From 3a3d1283b6e0f345fd41c2c69a2c603bfff487fc Mon Sep 17 00:00:00 2001 From: lu_zero Date: Thu, 18 Sep 2008 00:24:32 +0000 Subject: [PATCH 62/76] Split mono2Y in monowhite and monoblack git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27635 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 87ef2d94cc..fa657b383c 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2152,11 +2152,21 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, } } -static inline void RENAME(mono2Y)(uint8_t *dst, uint8_t *src, long width, int format) +static inline void RENAME(monowhite2Y)(uint8_t *dst, uint8_t *src, long width) { int i, j; for (i=0; i>(7-j))&1)*255; + } +} + +static inline void RENAME(monoblack2Y)(uint8_t *dst, uint8_t *src, long width) +{ + int i, j; + for (i=0; i>(7-j))&1)*255; } @@ -2416,9 +2426,14 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, RENAME(palToY)(formatConvBuffer, src, srcW, pal); src= formatConvBuffer; } - else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE) + else if (srcFormat==PIX_FMT_MONOBLACK) { - RENAME(mono2Y)(formatConvBuffer, src, srcW, srcFormat); + RENAME(monoblack2Y)(formatConvBuffer, src, srcW); + src= formatConvBuffer; + } + else if (srcFormat==PIX_FMT_MONOWHITE) + { + RENAME(monowhite2Y)(formatConvBuffer, src, srcW); src= formatConvBuffer; } From cec6a449ef4650925e55d24e876947f2f51f0abe Mon Sep 17 00:00:00 2001 From: lu_zero Date: Thu, 18 Sep 2008 00:26:37 +0000 Subject: [PATCH 63/76] Uniform *ToY and *ToUV function signatures git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27636 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 102 +++++++++++++++++----------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index fa657b383c..74f4c57285 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1731,7 +1731,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * //FIXME yuy2* can read up to 7 samples too much -static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width) +static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) { #ifdef HAVE_MMX asm volatile( @@ -1756,7 +1756,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width) #endif } -static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width) +static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) { #ifdef HAVE_MMX asm volatile( @@ -1793,7 +1793,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, /* This is almost identical to the previous, end exists only because * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */ -static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width) +static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) { #ifdef HAVE_MMX asm volatile( @@ -1817,7 +1817,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width) #endif } -static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width) +static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) { #ifdef HAVE_MMX asm volatile( @@ -1853,7 +1853,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, } #define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\ -static inline void RENAME(name)(uint8_t *dst, uint8_t *src, long width)\ +static inline void RENAME(name)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused)\ {\ int i;\ for (i=0; i>(S);\ }\ }\ -static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, uint8_t *src, uint8_t *dummy, long width)\ +static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, uint8_t *src, uint8_t *dummy, long width, uint32_t *unused)\ {\ int i;\ for (i=0; ichrSrcHSubSample) - RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32_1) { if(c->chrSrcHSubSample) - RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); + RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal); else - RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); + RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR24) { if(c->chrSrcHSubSample) - RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR565) { if(c->chrSrcHSubSample) - RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR555) { if(c->chrSrcHSubSample) - RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32) { if(c->chrSrcHSubSample) - RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32_1) { if(c->chrSrcHSubSample) - RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); + RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal); else - RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); + RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB24) { if(c->chrSrcHSubSample) - RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB565) { if(c->chrSrcHSubSample) - RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB555) { if(c->chrSrcHSubSample) - RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); else - RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); + RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } From f19f7625489dfa9d580b34d1d125a1d89a8eeec7 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 18 Sep 2008 15:30:23 +0000 Subject: [PATCH 64/76] Simplify cpudetect OS-support detection code, e.g. using one mp_msg to print either yes or no instead of two. Should not change code behaviour. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27637 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpudetect.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/cpudetect.c b/cpudetect.c index 7faa4e7c77..8ec1adefaa 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -382,25 +382,15 @@ static void check_os_katmai_support( void ) mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " ); ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0); - if (ret < 0 || !has_sse) { - gCpuCaps.hasSSE=0; - mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" ); - } else { - gCpuCaps.hasSSE=1; - mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" ); - } + gCpuCaps.hasSSE = ret >= 0 && has_sse; + mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" ); mib[1] = CPU_SSE2; varlen = sizeof(has_sse2); mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " ); ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0); - if (ret < 0 || !has_sse2) { - gCpuCaps.hasSSE2=0; - mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" ); - } else { - gCpuCaps.hasSSE2=1; - mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" ); - } + gCpuCaps.hasSSE2 = ret >= 0 && has_sse2; + mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE2 ? "yes.\n" : "no!\n" ); #else gCpuCaps.hasSSE = 0; mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" ); @@ -412,8 +402,7 @@ static void check_os_katmai_support( void ) exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse); __asm __volatile ("xorps %xmm0, %xmm0"); SetUnhandledExceptionFilter(exc_fil); - if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" ); - else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" ); + mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" ); } #elif defined(__OS2__) EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse }; @@ -422,8 +411,7 @@ static void check_os_katmai_support( void ) DosSetExceptionHandler( &RegRec ); __asm __volatile ("xorps %xmm0, %xmm0"); DosUnsetExceptionHandler( &RegRec ); - if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" ); - else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" ); + mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" ); } #elif defined(__linux__) #if defined(_POSIX_SOURCE) @@ -447,11 +435,7 @@ static void check_os_katmai_support( void ) // __asm __volatile ("xorps %%xmm0, %%xmm0"); __asm __volatile ("xorps %xmm0, %xmm0"); - if ( gCpuCaps.hasSSE ) { - mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" ); - } else { - mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" ); - } + mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" ); } /* Restore the original signal handlers. @@ -461,11 +445,7 @@ static void check_os_katmai_support( void ) /* If we've gotten to here and the XMM CPUID bit is still set, we're * safe to go ahead and hook out the SSE code throughout Mesa. */ - if ( gCpuCaps.hasSSE ) { - mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE passed.\n" ); - } else { - mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE failed!\n" ); - } + mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE %s\n", gCpuCaps.hasSSE ? "passed." : "failed!" ); #else /* We can't use POSIX signal handling to test the availability of * SSE, so we disable it by default. From 8b32526cbf202a7e346dd3e98605861b4971dc6c Mon Sep 17 00:00:00 2001 From: compn Date: Thu, 18 Sep 2008 19:07:33 +0000 Subject: [PATCH 65/76] add lavfopts matroska suboption git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27638 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 73bed3a88e..103757a274 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -10534,6 +10534,8 @@ MPEG-4 format MPEG-4 format with extra header flags required by Apple iPod firmware .IPs "dv\ \ \ " Sony Digital Video container +.IPs "matroska\ \ \ " +Matroska .RE .PD 1 .TP From b22ef372e3c539244b7c9941d131bc829e5a7806 Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 18:02:16 +0000 Subject: [PATCH 66/76] document lavc/lavf avoption o suboption git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27639 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 58 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 103757a274..972e3bbc90 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -4479,8 +4479,21 @@ This is not a bug, but a side effect of not decoding at full resolution. If is specified lowres decoding will be used only if the width of the video is major than or equal to . .RE -.IPs "o\ \ \ \ " -FIXME: undocumented +.B o==[,=[,...]] +Pass AVOptions to libavcodec decoder +Note, a patch to make the o= unneeded and pass all unknown options through +the AVOption system is welcome. +A full list of AVOptions can be found in FFmpeg manual. +Note that some options may conflict with MEncoder options. +.sp 1 +.RS +.I EXAMPLE: +.RE +.RSs +.PD 0 +.IPs o=debug=pict +.PD 1 +.RE .IPs "sb= (MPEG-2 only)" Skip the given number of macroblock rows at the bottom. .IPs "st= (MPEG-2 only)" @@ -7632,9 +7645,11 @@ Read the source for full details. . .TP .B o==[,=[,...]] -Pass AVOptions to libavcodec +Pass AVOptions to libavcodec encoder Note, a patch to make the o= unneeded and pass all unknown options through the AVOption system is welcome. +A full list of AVOptions can be found in FFmpeg manual. +Note that some AVOptions may conflict with MEncoder options. .sp 1 .RS .I EXAMPLE: @@ -9077,9 +9092,6 @@ FIXME: Document this. .B skip_threshold=<0\-1000000> FIXME: Document this. . -.TP -.B "o\ \ \ \ \ \ " -FIXME: undocumented . . .SS nuv (\-nuvopts) @@ -10475,8 +10487,21 @@ Maximum length in seconds to analyze the stream properties. Force a specific libavformat demuxer. . .TP -.B "o\ \ \ \ \ \ " -FIXME: undocumented +.B o==[,=[,...]] +Pass AVOptions to libavformat demuxer +Note, a patch to make the o= unneeded and pass all unknown options through +the AVOption system is welcome. +A full list of AVOptions can be found in FFmpeg manual. +Note that some options may conflict with MPlayer/MEncoder options. +.sp 1 +.RS +.I EXAMPLE: +.RE +.RSs +.PD 0 +.IPs o=ignidx +.PD 1 +.RE . .TP .B probesize= @@ -10545,8 +10570,21 @@ currently it is meaningful only for MPEG[12]. Sometimes raising it is necessary in order to avoid "buffer underflows". . .TP -.B "o\ \ \ \ \ \ " -FIXME: undocumented +.B o==[,=[,...]] +Pass AVOptions to libavformat muxer +Note, a patch to make the o= unneeded and pass all unknown options through +the AVOption system is welcome. +A full list of AVOptions can be found in FFmpeg manual. +Note that some options may conflict with MEncoder options. +.sp 1 +.RS +.I EXAMPLE: +.RE +.RSs +.PD 0 +.IPs o=packetsize=100 +.PD 1 +.RE . .TP .B packetsize= From 26b6a16cd59ca00245189aca7ff4d39b354f209a Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 18:20:31 +0000 Subject: [PATCH 67/76] add windows NUL info git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27640 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/xml/en/mencoder.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DOCS/xml/en/mencoder.xml b/DOCS/xml/en/mencoder.xml index b52ada1986..4646937345 100644 --- a/DOCS/xml/en/mencoder.xml +++ b/DOCS/xml/en/mencoder.xml @@ -326,7 +326,8 @@ The name comes from the fact that this method encodes the file twice. The first encoding (dubbed pass) creates some temporary files (*.log) with a size of few megabytes, do not delete them yet (you can delete the AVI or rather just not create any video -by redirecting it into /dev/null). +by redirecting it into /dev/null +or on Windows into NUL). In the second pass, the two pass output file is created, using the bitrate data from the temporary files. The resulting file will have much better image quality. If this is the first From d9d88dd59c5cd812874c7da3541ec38332b16b21 Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 18:50:42 +0000 Subject: [PATCH 68/76] sync with libavformat/isom.c fourcc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27641 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/etc/codecs.conf b/etc/codecs.conf index 4dc66c48ff..6b705721ae 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -85,7 +85,12 @@ videocodec mpegpes fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf - fourcc xd5b + fourcc xd5a,xd5b,xd5c + fourcc xd5d.xd5e,xd5f + fourcc xd59 + fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx3n,mx3p + fourcc AVmp driver mpegpes out MPES @@ -120,7 +125,12 @@ videocodec ffmpeg2 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf - fourcc xd5b + fourcc xd5a,xd5b,xd5c + fourcc xd5d.xd5e,xd5f + fourcc xd59 + fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx3n,mx3p + fourcc AVmp driver ffmpeg dll "mpeg2video" out YV12,I420,IYUV @@ -149,7 +159,12 @@ videocodec ffmpeg12 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf - fourcc xd5b + fourcc xd5a,xd5b,xd5c + fourcc xd5d.xd5e,xd5f + fourcc xd59 + fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx3n,mx3p + fourcc AVmp driver ffmpeg dll "mpegvideo" out YV12,I420,IYUV @@ -179,7 +194,12 @@ videocodec mpeg12 fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf - fourcc xd5b + fourcc xd5a,xd5b,xd5c + fourcc xd5d.xd5e,xd5f + fourcc xd59 + fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx3n,mx3p + fourcc AVmp driver libmpeg2 ; dll "libmpeg2" out YV12,I420,IYUV @@ -207,7 +227,12 @@ videocodec ffmpeg12mc fourcc xdv7,xdv8,xdv9 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf - fourcc xd5b + fourcc xd5a,xd5b,xd5c + fourcc xd5d.xd5e,xd5f + fourcc xd59 + fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx3n,mx3p + fourcc AVmp driver ffmpeg dll "mpegvideo_xvmc" out IDCT_MPEG2 @@ -1086,6 +1111,7 @@ videocodec m3jpeg2k info "Morgan MJPEG2000" status working fourcc MJ2C + fourcc MJP2 driver vfw dll "m3jp2k32.dll" out YV12,I420,IYUV @@ -1340,6 +1366,9 @@ videocodec ffdv fourcc dv50 ; DVCPRO 50 fourcc dv5n ; DVCPRO 50 NTSC in .mov fourcc dv5p ; DVCPRO 50 PAL in .mov + fourcc AVdv,AVd1 + fourcc dvhq,dvhp + fourcc dvh5,dvh6,dvh3 driver ffmpeg dll dvvideo out 411P,422P,YV12 @@ -1355,7 +1384,9 @@ videocodec libdv fourcc dv50 ; DVCPRO 50 fourcc dv5n ; DVCPRO 50 NTSC in .mov fourcc dv5p ; DVCPRO 50 PAL in .mov - fourcc AVdv ; AVID DV + fourcc AVdv,AVd1 ; AVID DV + fourcc dvhq,dvhp + fourcc dvh5,dvh6,dvh3 driver libdv dll libdv.so.2 out YUY2 @@ -1889,6 +1920,7 @@ videocodec ffcavs comment "only works with libavformat demuxer" status working fourcc CAVS + fourcc avs2 driver ffmpeg dll "cavs" out I420 @@ -2971,6 +3003,7 @@ audiocodec ffdv info "FFmpeg DV audio decoder" status working fourcc RADV + fourcc vdva,dvca driver ffmpeg dll "dvaudio" From 584cefe84f7515ae0acfdf0dd95855975910aff5 Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 19:16:32 +0000 Subject: [PATCH 69/76] sync with libavformat/riff.c git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27642 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index 6b705721ae..c89999fff4 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -772,6 +772,7 @@ videocodec ffodivx fourcc SMP4,smp4 ; Samsung SMP4 video codec fourcc VIDM ; vidm 4.01 codec format 0x10000004 ; mpeg 4 es + fourcc 4000,BLZ0 driver ffmpeg dll mpeg4 ;opendivx out YV12,I420,IYUV @@ -1020,6 +1021,7 @@ videocodec ffmjpeg fourcc JPGL ; lossless JPEG (pegasus codec) fourcc LJPG ; lossless JPEG fourcc dmb1 ; MJPEG by Matrox Rainbow Runner + fourcc MJLS ; JPEG-LS custom FOURCC for avi - encoder driver ffmpeg dll mjpeg out 444P @@ -1369,6 +1371,7 @@ videocodec ffdv fourcc AVdv,AVd1 fourcc dvhq,dvhp fourcc dvh5,dvh6,dvh3 + fourcc dvhd,dvsl,dv25 driver ffmpeg dll dvvideo out 411P,422P,YV12 From 04db08e9188faf366d9422abede62612aad97289 Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 19:55:25 +0000 Subject: [PATCH 70/76] sync with xine git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27643 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index c89999fff4..105bcda634 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -728,6 +728,7 @@ videocodec ffvc1 info "FFmpeg WVC1" status buggy fourcc WVC1,wvc1,WMVA + fourcc vc-1,VC-1 driver ffmpeg dll vc1 out YV12,I420,IYUV @@ -3029,6 +3030,7 @@ audiocodec ffaac fourcc "VLB " ; Used in NSV, not really working fourcc "AAC " ; Used in NSV fourcc "AACP" ; Used in NSV for AACPlus + fourcc raac,racp format 0xff format 0x706D driver ffmpeg From 4d1425c708ac2f2b9a74b2c17037f50aae554eea Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 19 Sep 2008 20:58:20 +0000 Subject: [PATCH 71/76] sync with videolan git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27644 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index 105bcda634..0577444f59 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -91,6 +91,8 @@ videocodec mpegpes fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp + fourcc mp2v,mpgv + fourcc VCR2 driver mpegpes out MPES @@ -131,6 +133,8 @@ videocodec ffmpeg2 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp + fourcc VCR2 + fourcc mp2v,mpgv driver ffmpeg dll "mpeg2video" out YV12,I420,IYUV @@ -165,6 +169,7 @@ videocodec ffmpeg12 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp + fourcc mp2v,mpgv driver ffmpeg dll "mpegvideo" out YV12,I420,IYUV @@ -200,6 +205,7 @@ videocodec mpeg12 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp + fourcc mp2v,mpgv driver libmpeg2 ; dll "libmpeg2" out YV12,I420,IYUV @@ -233,6 +239,7 @@ videocodec ffmpeg12mc fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp + fourcc mp2v,mpgv driver ffmpeg dll "mpegvideo_xvmc" out IDCT_MPEG2 @@ -647,6 +654,7 @@ videocodec ffindeo2 info "Indeo 2 native decoder" status working fourcc RT21 + fourcc IV20 driver ffmpeg dll indeo2 out YVU9 @@ -774,6 +782,9 @@ videocodec ffodivx fourcc VIDM ; vidm 4.01 codec format 0x10000004 ; mpeg 4 es fourcc 4000,BLZ0 + fourcc m4cc,M4CC + fourcc hdx4,HDX4 + fourcc FVFW,fvfw driver ffmpeg dll mpeg4 ;opendivx out YV12,I420,IYUV @@ -1215,6 +1226,7 @@ videocodec ffh263 fourcc s263,S263 fourcc D263 ; DEC H263 fourcc L263 ; Lead H263 + fourcc ILVR ; ITU H263+ driver ffmpeg dll h263 out YV12,I420,IYUV @@ -3008,6 +3020,7 @@ audiocodec ffdv status working fourcc RADV fourcc vdva,dvca + fourcc dvau driver ffmpeg dll "dvaudio" @@ -3347,6 +3360,7 @@ audiocodec ffmusepack8 comment "only works with libavformat demuxer" status working fourcc "MPC8" + fourcc MPCK driver ffmpeg dll "mpc8" From e95623cf2d422c978e3a448918d6bd907fd45dd7 Mon Sep 17 00:00:00 2001 From: compn Date: Sat, 20 Sep 2008 01:35:44 +0000 Subject: [PATCH 72/76] fix typo git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27645 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/codecs.conf b/etc/codecs.conf index 0577444f59..5fd643977d 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -86,7 +86,7 @@ videocodec mpegpes fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf fourcc xd5a,xd5b,xd5c - fourcc xd5d.xd5e,xd5f + fourcc xd5d,xd5e,xd5f fourcc xd59 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p @@ -128,7 +128,7 @@ videocodec ffmpeg2 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf fourcc xd5a,xd5b,xd5c - fourcc xd5d.xd5e,xd5f + fourcc xd5d,xd5e,xd5f fourcc xd59 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p @@ -164,7 +164,7 @@ videocodec ffmpeg12 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf fourcc xd5a,xd5b,xd5c - fourcc xd5d.xd5e,xd5f + fourcc xd5d,xd5e,xd5f fourcc xd59 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p @@ -200,7 +200,7 @@ videocodec mpeg12 fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf fourcc xd5a,xd5b,xd5c - fourcc xd5d.xd5e,xd5f + fourcc xd5d,xd5e,xd5f fourcc xd59 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p @@ -234,7 +234,7 @@ videocodec ffmpeg12mc fourcc xdva,xdvb,xdvc fourcc xdvd,xdve,xdvf fourcc xd5a,xd5b,xd5c - fourcc xd5d.xd5e,xd5f + fourcc xd5d,xd5e,xd5f fourcc xd59 fourcc mx5n,mx5p,mx4n,mx4p fourcc mx3n,mx3p From 35f4335cbcffbc49bf66be7236bee47dae7f7cce Mon Sep 17 00:00:00 2001 From: compn Date: Sat, 20 Sep 2008 01:51:23 +0000 Subject: [PATCH 73/76] duplicate fourcc spotted by uoti git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27646 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/codecs.conf b/etc/codecs.conf index 5fd643977d..d00c5401e1 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -88,7 +88,7 @@ videocodec mpegpes fourcc xd5a,xd5b,xd5c fourcc xd5d,xd5e,xd5f fourcc xd59 - fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx5n,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp fourcc mp2v,mpgv @@ -130,7 +130,7 @@ videocodec ffmpeg2 fourcc xd5a,xd5b,xd5c fourcc xd5d,xd5e,xd5f fourcc xd59 - fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx5n,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp fourcc VCR2 @@ -166,7 +166,7 @@ videocodec ffmpeg12 fourcc xd5a,xd5b,xd5c fourcc xd5d,xd5e,xd5f fourcc xd59 - fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx5n,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp fourcc mp2v,mpgv @@ -202,7 +202,7 @@ videocodec mpeg12 fourcc xd5a,xd5b,xd5c fourcc xd5d,xd5e,xd5f fourcc xd59 - fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx5n,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp fourcc mp2v,mpgv @@ -236,7 +236,7 @@ videocodec ffmpeg12mc fourcc xd5a,xd5b,xd5c fourcc xd5d,xd5e,xd5f fourcc xd59 - fourcc mx5n,mx5p,mx4n,mx4p + fourcc mx5n,mx4n,mx4p fourcc mx3n,mx3p fourcc AVmp fourcc mp2v,mpgv From 245b0aadab7d2d953e85a963639558db4603ef7d Mon Sep 17 00:00:00 2001 From: compn Date: Sat, 20 Sep 2008 01:53:45 +0000 Subject: [PATCH 74/76] another dup git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27647 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/codecs.conf b/etc/codecs.conf index d00c5401e1..40a1f90548 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -781,7 +781,6 @@ videocodec ffodivx fourcc SMP4,smp4 ; Samsung SMP4 video codec fourcc VIDM ; vidm 4.01 codec format 0x10000004 ; mpeg 4 es - fourcc 4000,BLZ0 fourcc m4cc,M4CC fourcc hdx4,HDX4 fourcc FVFW,fvfw From 0643fde0c3e40d8be813c890d5009c9d878ea83e Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 20 Sep 2008 08:14:28 +0000 Subject: [PATCH 75/76] Use already "prefetched" atoms instead of calling XInternAtom each time. Patch by Julien Danjou [ julien danjou info ] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27648 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 65b88cb307..4dac528361 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -140,14 +140,11 @@ void vo_x11_ewmh_fullscreen(int action) xev.xclient.type = ClientMessage; xev.xclient.serial = 0; xev.xclient.send_event = True; - xev.xclient.message_type = XInternAtom(mDisplay, - "_NET_WM_STATE", False); + xev.xclient.message_type = XA_NET_WM_STATE; xev.xclient.window = vo_window; xev.xclient.format = 32; xev.xclient.data.l[0] = action; - xev.xclient.data.l[1] = XInternAtom(mDisplay, - "_NET_WM_STATE_FULLSCREEN", - False); + xev.xclient.data.l[1] = XA_NET_WM_STATE_FULLSCREEN; xev.xclient.data.l[2] = 0; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; From 7756839a147ce2421cfb4e3de046364962094b60 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 20 Sep 2008 08:16:05 +0000 Subject: [PATCH 76/76] Remove already disabled and probably long obsolete code that worked around an OpenBox bug. Patch by Julien Danjou [ julien danjou info ] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27649 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 4dac528361..287e0b3a0a 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -101,7 +101,6 @@ static Atom XA_NET_WM_PID; static Atom XA_WIN_PROTOCOLS; static Atom XA_WIN_LAYER; static Atom XA_WIN_HINTS; -static Atom XA_BLACKBOX_PID; static Atom XAWM_PROTOCOLS; static Atom XAWM_DELETE_WINDOW; @@ -325,20 +324,6 @@ static int vo_wm_detect(void) for (i = 0; i < nitems; i++) wm |= net_wm_support_state_test(args[i]); XFree(args); -#if 0 - // ugly hack for broken OpenBox _NET_WM_STATE_FULLSCREEN support - // (in their implementation it only changes internal window state, nothing more!!!) - if (wm & vo_wm_FULLSCREEN) - { - if (x11_get_property(XA_BLACKBOX_PID, &args, &nitems)) - { - mp_msg(MSGT_VO, MSGL_V, - "[x11] Detected wm is a broken OpenBox.\n"); - wm ^= vo_wm_FULLSCREEN; - } - XFree(args); - } -#endif } if (wm == 0) @@ -358,7 +343,6 @@ static void init_atoms(void) XA_INIT(_WIN_PROTOCOLS); XA_INIT(_WIN_LAYER); XA_INIT(_WIN_HINTS); - XA_INIT(_BLACKBOX_PID); XA_INIT(WM_PROTOCOLS); XA_INIT(WM_DELETE_WINDOW); }