From 53a3e8ee6978658247b8001b72d967cd5e97d816 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 10 Sep 2008 22:41:55 +0000 Subject: 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 -- cgit v1.2.3 From d351b78abdfc155915fdabf86f56b6542b5044c0 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 10 Sep 2008 23:23:47 +0000 Subject: 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); -- cgit v1.2.3 From fd6cd1c95cb22124e0c812e9af44a62525891693 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 00:09:01 +0000 Subject: 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); -- cgit v1.2.3 From 4abaf837d95ec7c4b4667424f427994d5879cb08 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 01:49:35 +0000 Subject: 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: 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) } } -- cgit v1.2.3 From 3ea1657e650653c323230af1c862f3dce09d9118 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 03:22:39 +0000 Subject: 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]; \ -- cgit v1.2.3 From 6009a04a231b1c6d80605a407730c27b27f2f1ee Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:39:12 +0000 Subject: 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); + } } } } -- cgit v1.2.3 From 42643629cd217dea92468b37e1447201134755c4 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:40:29 +0000 Subject: 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 -- cgit v1.2.3 From 6d7e7200096d9444050e8cb525675f9342dceb24 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 14:47:18 +0000 Subject: 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); -- cgit v1.2.3 From fa93e449fc1cfdc29c3e6a926db8192d3bf88f5a Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 11 Sep 2008 22:02:15 +0000 Subject: 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" -- cgit v1.2.3 From cc3ec5b4f215a988c2d18080e55e157cb49e2dc0 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 02:05:37 +0000 Subject: 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); } -- cgit v1.2.3 From 229dec600dbcb4abb7022fe112ef87a28acdd08d Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 04:40:51 +0000 Subject: 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) */ -- cgit v1.2.3 From fc855e63d2621f31818fbc72eb278094279570b4 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 16:01:17 +0000 Subject: 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) } } -- cgit v1.2.3 From 296ccc70eafbee2821a391fa281927403f707c94 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 16:46:38 +0000 Subject: 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; } -- cgit v1.2.3 From d28a3ad668d982b0bb09fd6bf12c59b923f856e2 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 17:28:36 +0000 Subject: 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; } -- cgit v1.2.3 From 02da3e1bf989b494bbf92903a1655e585658fb0b Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 17:51:13 +0000 Subject: 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 \ -- cgit v1.2.3 From df44f03e48729ed1e72485af4a0893b2ec65f005 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 18:05:57 +0000 Subject: 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; } } -- cgit v1.2.3 From e5f0ead24f5f24b9ed57584167f93b8f5ccf16d2 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 21:25:42 +0000 Subject: 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]; \ -- cgit v1.2.3 From d8bf925d4cb6233ffda813be39c6f443199388aa Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 21:46:53 +0000 Subject: 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 } }; -- cgit v1.2.3 From 68de5a33c96b4ce5e9607548996eda0f6ead11de Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 22:29:21 +0000 Subject: 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 */ -- cgit v1.2.3 From 57db6892cfbcdd1cd460cc5282563b81e8bb1c3c Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Sep 2008 23:52:37 +0000 Subject: 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; } -- cgit v1.2.3 From 07fd651300ec7888333d41446afdc6a2edafa569 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 02:04:10 +0000 Subject: 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; } } -- cgit v1.2.3 From 6869e4a7a453f829239eb46f83066c39000f0cee Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 02:18:12 +0000 Subject: 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" -- cgit v1.2.3 From 79c5484c9fc699a58717b84f223647caf088eb9f Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 03:12:15 +0000 Subject: 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) { -- cgit v1.2.3 From 5f97d37455cb991f870235772e1ea70009e5702d Mon Sep 17 00:00:00 2001 From: compn Date: Sat, 13 Sep 2008 03:28:15 +0000 Subject: 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?) -- cgit v1.2.3 From f5a4bd86cbfba940df19df2322c4a79c7bf64edc Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 13 Sep 2008 11:52:03 +0000 Subject: 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" -- cgit v1.2.3 From b726d73ed14e80d1d