comparison libvo/mga_common.c @ 202:6ad0715dfac8

grey+alpha rendering support (for .sub)
author arpi_esp
date Sat, 24 Mar 2001 04:36:17 +0000
parents cdb2e30be421
children 2dadc379a934
comparison
equal deleted inserted replaced
201:4678d8212524 202:6ad0715dfac8
5 5
6 static mga_vid_config_t mga_vid_config; 6 static mga_vid_config_t mga_vid_config;
7 static uint8_t *vid_data, *frames[4]; 7 static uint8_t *vid_data, *frames[4];
8 static int f; 8 static int f;
9 9
10 10 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
11 static void 11 int x,y;
12 write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb) 12 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
13 { 13
14 uint8_t *dest; 14 if (mga_vid_config.format==MGA_VID_FORMAT_YV12){
15 uint32_t bespitch,h,w; 15
16 16 for(y=0;y<h;y++){
17 dest = vid_data; 17 uint8_t *dst = vid_data + bespitch * (y0+y) + x0;
18 bespitch = (mga_vid_config.src_width + 31) & ~31; 18 for(x=0;x<w;x++){
19 19 // dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
20 for(h=0; h < mga_vid_config.src_height; h++) 20 if(srca[x])
21 { 21 dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
22 memcpy(dest, y, mga_vid_config.src_width); 22 }
23 y += mga_vid_config.src_width; 23 src+=stride;
24 dest += bespitch; 24 srca+=stride;
25 } 25 }
26 26
27 for(h=0; h < mga_vid_config.src_height/2; h++) 27 } else {
28 { 28
29 for(w=0; w < mga_vid_config.src_width/2; w++) 29 for(y=0;y<h;y++){
30 { 30 uint8_t *dst = vid_data + 2*(bespitch * (y0+y) + x0);
31 *dest++ = *cb++; 31 for(x=0;x<w;x++){
32 *dest++ = *cr++; 32 // dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
33 } 33 if(srca[x])
34 dest += bespitch - mga_vid_config.src_width; 34 dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
35 } 35 }
36 } 36 src+=stride;
37 37 srca+=stride;
38 static void 38 }
39 write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb) 39
40 { 40 }
41 uint8_t *dest; 41
42 uint32_t bespitch,h; 42 }
43 43
44 dest = vid_data;
45 bespitch = (mga_vid_config.src_width + 31) & ~31;
46
47 for(h=0; h < mga_vid_config.src_height; h++)
48 {
49 memcpy(dest, y, mga_vid_config.src_width);
50 y += mga_vid_config.src_width;
51 dest += bespitch;
52 }
53
54 for(h=0; h < mga_vid_config.src_height/2; h++)
55 {
56 memcpy(dest, cb, mga_vid_config.src_width/2);
57 cb += mga_vid_config.src_width/2;
58 dest += bespitch/2;
59 }
60
61 for(h=0; h < mga_vid_config.src_height/2; h++)
62 {
63 memcpy(dest, cr, mga_vid_config.src_width/2);
64 cr += mga_vid_config.src_width/2;
65 dest += bespitch/2;
66 }
67 }
68 44
69 //static void 45 //static void
70 //write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num) 46 //write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num)
71 47
72 static void 48 static void
198 static uint32_t 174 static uint32_t
199 draw_frame(uint8_t *src[]) 175 draw_frame(uint8_t *src[])
200 { 176 {
201 if (mga_vid_config.format==MGA_VID_FORMAT_YUY2) 177 if (mga_vid_config.format==MGA_VID_FORMAT_YUY2)
202 write_frame_yuy2(src[0]); 178 write_frame_yuy2(src[0]);
203 else
204 if (mga_vid_config.card_type == MGA_G200)
205 write_frame_g200(src[0], src[2], src[1]);
206 else
207 write_frame_g400(src[0], src[2], src[1]);
208
209 //flip_page();
210 return 0; 179 return 0;
211 } 180 }
212 181
213 static uint32_t 182 static uint32_t
214 query_format(uint32_t format) 183 query_format(uint32_t format)