Mercurial > mplayer.hg
comparison libvo/osd.c @ 326:f6b5c2dbc88e
OSD alpha renderers moved to osd.c
author | arpi_esp |
---|---|
date | Tue, 10 Apr 2001 02:29:38 +0000 |
parents | |
children | 6737025afed0 |
comparison
equal
deleted
inserted
replaced
325:b2fd5c172f80 | 326:f6b5c2dbc88e |
---|---|
1 // Generic alpha renderers for all YUV modes and RGB depths. | |
2 // These are "reference implementations", should be optimized later (MMX, etc) | |
3 | |
4 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
5 int y; | |
6 for(y=0;y<h;y++){ | |
7 register int x; | |
8 for(x=0;x<w;x++){ | |
9 if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; | |
10 } | |
11 src+=srcstride; | |
12 srca+=srcstride; | |
13 dstbase+=dststride; | |
14 } | |
15 return; | |
16 } | |
17 | |
18 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
19 int y; | |
20 for(y=0;y<h;y++){ | |
21 register int x; | |
22 for(x=0;x<w;x++){ | |
23 if(srca[x]) dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x]; | |
24 } | |
25 src+=srcstride; | |
26 srca+=srcstride; | |
27 dstbase+=dststride; | |
28 } | |
29 return; | |
30 } | |
31 | |
32 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
33 int y; | |
34 for(y=0;y<h;y++){ | |
35 register unsigned char *dst = dstbase; | |
36 register int x; | |
37 for(x=0;x<w;x++){ | |
38 if(srca[x]){ | |
39 dst[0]=((dst[0]*srca[x])>>8)+src[x]; | |
40 dst[1]=((dst[1]*srca[x])>>8)+src[x]; | |
41 dst[2]=((dst[2]*srca[x])>>8)+src[x]; | |
42 } | |
43 dst+=3; // 24bpp | |
44 } | |
45 src+=srcstride; | |
46 srca+=srcstride; | |
47 dstbase+=dststride; | |
48 } | |
49 return; | |
50 } | |
51 | |
52 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
53 int y; | |
54 for(y=0;y<h;y++){ | |
55 register int x; | |
56 for(x=0;x<w;x++){ | |
57 if(srca[x]){ | |
58 dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x]; | |
59 dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x]; | |
60 dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x]; | |
61 } | |
62 } | |
63 src+=srcstride; | |
64 srca+=srcstride; | |
65 dstbase+=dststride; | |
66 } | |
67 return; | |
68 } | |
69 | |
70 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
71 int y; | |
72 for(y=0;y<h;y++){ | |
73 register unsigned short *dst = (unsigned short*) dstbase; | |
74 register int x; | |
75 for(x=0;x<w;x++){ | |
76 if(srca[x]){ | |
77 unsigned char r=dst[x]&0x1F; | |
78 unsigned char g=(dst[x]>>5)&0x1F; | |
79 unsigned char b=(dst[x]>>10)&0x1F; | |
80 r=(((r*srca[x])>>5)+src[x])>>3; | |
81 g=(((g*srca[x])>>5)+src[x])>>3; | |
82 b=(((b*srca[x])>>5)+src[x])>>3; | |
83 dst[x]=(b<<10)|(g<<5)|r; | |
84 } | |
85 } | |
86 src+=srcstride; | |
87 srca+=srcstride; | |
88 dstbase+=dststride; | |
89 } | |
90 return; | |
91 } | |
92 | |
93 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
94 int y; | |
95 for(y=0;y<h;y++){ | |
96 register unsigned short *dst = (unsigned short*) dstbase; | |
97 register int x; | |
98 for(x=0;x<w;x++){ | |
99 if(srca[x]){ | |
100 unsigned char r=dst[x]&0x1F; | |
101 unsigned char g=(dst[x]>>5)&0x3F; | |
102 unsigned char b=(dst[x]>>11)&0x1F; | |
103 r=(((r*srca[x])>>5)+src[x])>>3; | |
104 g=(((g*srca[x])>>6)+src[x])>>2; | |
105 b=(((b*srca[x])>>5)+src[x])>>3; | |
106 dst[x]=(b<<11)|(g<<5)|r; | |
107 } | |
108 } | |
109 src+=srcstride; | |
110 srca+=srcstride; | |
111 dstbase+=dststride; | |
112 } | |
113 return; | |
114 } | |
115 |