summaryrefslogtreecommitdiffstats
path: root/libvo/mga_common.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-24 04:36:17 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-24 04:36:17 +0000
commite72b62f8cc189053efe7e42078d7fa0f04dd425e (patch)
tree5fa3c0644fde7f0ef4ccf88cfe0f5e7f5a28edd0 /libvo/mga_common.c
parent96edb007a565f7fc9a50f1ba64ae24e05f903fbc (diff)
downloadmpv-e72b62f8cc189053efe7e42078d7fa0f04dd425e.tar.bz2
mpv-e72b62f8cc189053efe7e42078d7fa0f04dd425e.tar.xz
grey+alpha rendering support (for .sub)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@203 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r--libvo/mga_common.c89
1 files changed, 29 insertions, 60 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 4fc5084d60..8779c68d19 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -7,64 +7,40 @@ static mga_vid_config_t mga_vid_config;
static uint8_t *vid_data, *frames[4];
static int f;
+static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ int x,y;
+ uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+
+ if (mga_vid_config.format==MGA_VID_FORMAT_YV12){
+
+ for(y=0;y<h;y++){
+ uint8_t *dst = vid_data + bespitch * (y0+y) + x0;
+ 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;
+ }
+ src+=stride;
+ srca+=stride;
+ }
-static void
-write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb)
-{
- uint8_t *dest;
- uint32_t bespitch,h,w;
+ } else {
+
+ for(y=0;y<h;y++){
+ uint8_t *dst = vid_data + 2*(bespitch * (y0+y) + x0);
+ 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;
+ }
+ src+=stride;
+ srca+=stride;
+ }
- dest = vid_data;
- bespitch = (mga_vid_config.src_width + 31) & ~31;
+ }
- for(h=0; h < mga_vid_config.src_height; h++)
- {
- memcpy(dest, y, mga_vid_config.src_width);
- y += mga_vid_config.src_width;
- dest += bespitch;
- }
-
- for(h=0; h < mga_vid_config.src_height/2; h++)
- {
- for(w=0; w < mga_vid_config.src_width/2; w++)
- {
- *dest++ = *cb++;
- *dest++ = *cr++;
- }
- dest += bespitch - mga_vid_config.src_width;
- }
}
-static void
-write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb)
-{
- uint8_t *dest;
- uint32_t bespitch,h;
-
- dest = vid_data;
- bespitch = (mga_vid_config.src_width + 31) & ~31;
-
- for(h=0; h < mga_vid_config.src_height; h++)
- {
- memcpy(dest, y, mga_vid_config.src_width);
- y += mga_vid_config.src_width;
- dest += bespitch;
- }
-
- for(h=0; h < mga_vid_config.src_height/2; h++)
- {
- memcpy(dest, cb, mga_vid_config.src_width/2);
- cb += mga_vid_config.src_width/2;
- dest += bespitch/2;
- }
-
- for(h=0; h < mga_vid_config.src_height/2; h++)
- {
- memcpy(dest, cr, mga_vid_config.src_width/2);
- cr += mga_vid_config.src_width/2;
- dest += bespitch/2;
- }
-}
//static void
//write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num)
@@ -200,13 +176,6 @@ draw_frame(uint8_t *src[])
{
if (mga_vid_config.format==MGA_VID_FORMAT_YUY2)
write_frame_yuy2(src[0]);
- else
- if (mga_vid_config.card_type == MGA_G200)
- write_frame_g200(src[0], src[2], src[1]);
- else
- write_frame_g400(src[0], src[2], src[1]);
-
- //flip_page();
return 0;
}