1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

OSD/SUB image quality & speed improvement

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@250 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-03-29 16:06:36 +00:00
parent c7e505508a
commit 4eff90e380
4 changed files with 29 additions and 12 deletions

View File

@ -199,7 +199,8 @@ for(i=0;i<=fontdb;i++){
printf("font: Missing bitmap(s) for sub-font #%d\n",i);
return NULL;
}
if(factor!=1.0f){
//if(factor!=1.0f)
{
// re-sample alpha
int f=factor*256.0f;
int size=desc->pic_a[i]->w*desc->pic_a[i]->h;
@ -209,11 +210,20 @@ for(i=0;i<=fontdb;i++){
int x=desc->pic_a[i]->bmp[j];
int y=desc->pic_b[i]->bmp[j];
x=((x*f*(255-y))>>16)+y;
x=((x*f)>>8); // scale
if(x<0) x=0; else if(x>255) x=255;
x^=255; // invert
if(x+y>255) x=255-y; // to avoid overflows
//x=0;
//x=((x*f*(255-y))>>16);
//x=((x*f*(255-y))>>16)+y;
//x=(x*f)>>8;if(x<y) x=y;
if(x<0) x=0; else
if(x>255) x=255;
if(x<1) x=1; else
if(x>=252) x=0;
desc->pic_a[i]->bmp[j]=x;
}
printf("DONE!\n");

View File

@ -18,7 +18,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
for(x=0;x<w;x++){
// dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
if(srca[x])
dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[x]=((dst[x]*srca[x])>>8)+src[x];
//dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
}
src+=stride;
srca+=stride;
@ -31,7 +32,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
for(x=0;x<w;x++){
// dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
if(srca[x])
dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[2*x]=((dst[2*x]*srca[x])>>8)+src[x];
//dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
}
src+=stride;
srca+=stride;

View File

@ -392,9 +392,12 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
for(x=0;x<w;x++){
// dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
if(srca[x]){
dst[0]=(dst[0]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[1]=(dst[1]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[2]=(dst[2]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[0]=((dst[0]*srca[x])>>8)+src[x];
dst[1]=((dst[1]*srca[x])>>8)+src[x];
dst[2]=((dst[2]*srca[x])>>8)+src[x];
//dst[0]=(dst[0]*(srca[x]^255)+src[x]*(srca[x]))>>8;
//dst[1]=(dst[1]*(srca[x]^255)+src[x]*(srca[x]))>>8;
//dst[2]=(dst[2]*(srca[x]^255)+src[x]*(srca[x]))>>8;
}
dst+=dbpp;
}

View File

@ -264,7 +264,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
for(x=0;x<w;x++){
// dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
if(srca[x])
dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
// dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[x]=((dst[x]*srca[x])>>8)+src[x];
}
src+=stride;
srca+=stride;
@ -277,7 +278,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
for(x=0;x<w;x++){
// dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
if(srca[x])
dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
// dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
dst[2*x]=((dst[2*x]*srca[x])>>8)+src[x];
}
src+=stride;
srca+=stride;