[Mplayer-cvslog] CVS: main/libvo vo_svga.c,1.11,1.12

Zoltan Mark Vician se7encode at users.sourceforge.net
Sat Apr 14 19:51:39 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv8762

Modified Files:
	vo_svga.c 
Log Message:

24/15bpp -> 32/16bpp added.

Index: vo_svga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_svga.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** vo_svga.c	2001/04/13 13:02:13	1.11
--- vo_svga.c	2001/04/14 17:51:37	1.12
***************
*** 3,6 ****
--- 3,8 ----
    by Zoltan Mark Vician <se7en at sch.bme.hu>
    Code started: Mon Apr  1 23:25:47 2001
+   
+   Uses HW acceleration if your card is supported by SVGAlib.
  */
  
***************
*** 18,21 ****
--- 20,25 ----
  #include "mmx.h"
  
+ extern void rgb15to16_mmx(char* s0,char* d0,int count);
+ 
  LIBVO_EXTERN(svga)
  
***************
*** 32,36 ****
  GraphicsContext *virt;
  
! static uint8_t *scalebuf = NULL, *yuvbuf = NULL;
  
  static uint32_t orig_w, orig_h, maxw, maxh; // Width, height
--- 36,40 ----
  GraphicsContext *virt;
  
! static uint8_t *scalebuf = NULL, *yuvbuf = NULL, *bppbuf = NULL;
  
  static uint32_t orig_w, orig_h, maxw, maxh; // Width, height
***************
*** 61,64 ****
--- 65,69 ----
  
  static uint8_t checked = 0;
+ static uint8_t bpp_conv = 0;
  
  static void checksupportedmodes() {
***************
*** 83,86 ****
--- 88,92 ----
      checksupportedmodes(); // Looking for available video modes
    }
+ 
    pformat = format;
    if (format == IMGFMT_YV12) bpp = 32;
***************
*** 89,95 ****
      switch (bpp) {
        case 32: vid_mode = 36; break;
!       case 24: vid_mode = 25; break;
        case 16: vid_mode = 24; break;
!       case 15: vid_mode = 23; break;
      }
    else
--- 95,101 ----
      switch (bpp) {
        case 32: vid_mode = 36; break;
!       case 24: vid_mode = bpp_conv ? 36 : 25; bpp = 32; break;
        case 16: vid_mode = 24; break;
!       case 15: vid_mode = bpp_conv ? 24 : 23; bpp = 16; break;
      }
    else
***************
*** 97,111 ****
        switch (bpp) {
          case 32: vid_mode = 35; break;
!         case 24: vid_mode = 22; break;
          case 16: vid_mode = 21; break;
!         case 15: vid_mode = 20; break;
        }
      else
        switch (bpp) {
          case 32: vid_mode = 34; break;
!         case 24: vid_mode = 19; break;
          case 16: vid_mode = 18; break;
!         case 15: vid_mode = 17; break;
        }
    if (vga_setmode(vid_mode) == -1){
      printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode);
--- 103,126 ----
        switch (bpp) {
          case 32: vid_mode = 35; break;
!         case 24: vid_mode = bpp_conv ? 35 : 22; bpp = 32; break;
          case 16: vid_mode = 21; break;
!         case 15: vid_mode = bpp_conv ? 21 : 20; bpp = 16; break;
        }
      else
        switch (bpp) {
          case 32: vid_mode = 34; break;
!         case 24: vid_mode = bpp_conv ? 34 : 19; bpp = 32; break;
          case 16: vid_mode = 18; break;
!         case 15: vid_mode = bpp_conv ? 18 : 17; bpp = 16; break;
        }
+   if (bpp_conv)
+     bppbuf = malloc(maxw * maxh * BYTESPERPIXEL);
+   if (!bppbuf) {
+     printf("vo_svga: Not enough memory for buffering!");
+     uninit();
+     return (1);
+   }
+ 
+   vga_setlinearaddressing();
    if (vga_setmode(vid_mode) == -1){
      printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode);
***************
*** 135,138 ****
--- 150,158 ----
        maxw = (uint32_t) (orig_w * scaling);
        scalebuf = malloc(maxw * maxh * BYTESPERPIXEL);
+       if (!scalebuf) {
+         printf("vo_svga: Not enough memory for buffering!");
+ 	uninit();
+ 	return (1);
+       }
      } else {
          maxw = WIDTH;
***************
*** 140,143 ****
--- 160,168 ----
          maxh = (uint32_t) (orig_h * scaling);
          scalebuf = malloc(maxw * maxh * BYTESPERPIXEL);
+         if (!scalebuf) {
+           printf("vo_svga: Not enough memory for buffering!");
+ 	  uninit();
+ 	  return (1);
+         }
        }
    } else {
***************
*** 145,149 ****
        maxh = orig_h;
      }
-   
    x_pos = (WIDTH - maxw) / 2;
    y_pos = (HEIGHT - maxh) / 2;
--- 170,173 ----
***************
*** 152,155 ****
--- 176,184 ----
      yuv2rgb_init(bpp, MODE_RGB);
      yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL);
+     if (!yuvbuf) {
+       printf("vo_svga: Not enough memory for buffering!");
+       uninit();
+       return (1);
+     }
    }
  
***************
*** 162,186 ****
  
  static uint32_t query_format(uint32_t format) {
!     if (!checked)
!       checksupportedmodes(); // Looking for available video modes
!     switch (format) {
!       case IMGFMT_RGB32: 
!       case IMGFMT_BGR|32: {
! 	return (vid_modes[_640x480x16M32] | vid_modes[_800x600x16M32] | vid_modes[_1024x768x16M32]);
!       }
!       case IMGFMT_RGB24: 
!       case IMGFMT_BGR|24: {
! 	return (vid_modes[_640x480x16M] | vid_modes[_800x600x16M] | vid_modes[_1024x768x16M]);
!       }
!       case IMGFMT_RGB16: 
!       case IMGFMT_BGR|16: {
! 	return (vid_modes[_640x480x64K] | vid_modes[_800x600x64K] | vid_modes[_1024x768x64K]);
!       }
!       case IMGFMT_RGB15: 
!       case IMGFMT_BGR|15: {
! 	return (vid_modes[_640x480x32K] | vid_modes[_800x600x32K] | vid_modes[_1024x768x32K]);
        }
!       case IMGFMT_YV12: return (1);
      }
    return (0);
  }
--- 191,227 ----
  
  static uint32_t query_format(uint32_t format) {
!   uint8_t res = 0;
! 
!   if (!checked)
!     checksupportedmodes(); // Looking for available video modes
!   switch (format) {
!     case IMGFMT_RGB32: 
!     case IMGFMT_BGR|32: {
!       return (vid_modes[_640x480x16M32] | vid_modes[_800x600x16M32] | vid_modes[_1024x768x16M32]);
!     }
!     case IMGFMT_RGB24: 
!     case IMGFMT_BGR|24: {
!       res = vid_modes[_640x480x16M] | vid_modes[_800x600x16M] | vid_modes[_1024x768x16M];
!       if (!res) {
!         res = vid_modes[_640x480x16M32] | vid_modes[_800x600x16M32] | vid_modes[_1024x768x16M32];
! 	bpp_conv = 1;
!       }
!       return (res);
!     }
!     case IMGFMT_RGB16: 
!     case IMGFMT_BGR|16: {
!       return (vid_modes[_640x480x64K] | vid_modes[_800x600x64K] | vid_modes[_1024x768x64K]);
!     }
!     case IMGFMT_RGB15: 
!     case IMGFMT_BGR|15: {
!       res = vid_modes[_640x480x32K] | vid_modes[_800x600x32K] | vid_modes[_1024x768x32K];
!       if (!res) {
!         res = vid_modes[_640x480x64K] | vid_modes[_800x600x64K] | vid_modes[_1024x768x64K];
!         bpp_conv = 1;
        }
!       return (res);
      }
+     case IMGFMT_YV12: return (1);
+   }
    return (0);
  }
***************
*** 217,220 ****
--- 258,291 ----
      src[0] = scalebuf;
    }
+   if (bpp_conv) {
+     uint16_t *src = (uint16_t *) src[0];
+     uint16_t *dest = (uint16_t *) bppbuf;
+     uint16_t *end;
+     
+     switch(bpp) {
+       case 32:
+ 	end = src + (maxw * maxh * 2);
+         while (src < end) {
+ 	  *dest++ = *src++;
+ 	  (uint8_t *)dest = (uint8_t *)src;
+ 	  *(((uint8_t *)dest)+1) = 0;
+ 	  dest++;
+ 	  src++;
+ 	}
+       case 16:
+ #ifdef HAVE_MMX
+         rgb15to16_mmx(src[0],bppbuf,maxw * maxh * 2);
+ #else
+ 	register uint16_t srcdata;
+ 	
+ 	end = src + (maxw * maxh);
+ 	while (src < end) {
+ 	  srcdata = *src++;
+ 	  *dest++ = (srcdata & 0x1f) | ((srcdata & 0x7fe0) << 1);
+ 	}
+ #endif
+     }
+     src[0] = bppbuf;
+   }
    gl_putbox(x_pos, y_pos, maxw, maxh, src[0]);
  }
***************
*** 255,258 ****
--- 326,331 ----
    gl_freecontext(virt);
    vga_setmode(TEXT);
+   if (bppbuf)
+     free(bppbuf);
    if (scalebuf)
      free(scalebuf);


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list