[Mplayer-cvslog] CVS: main/libvo vo_dga.c,1.13,1.14

Andreas Ackermann acki2 at users.sourceforge.net
Wed Apr 18 00:28:11 CEST 2001


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

Modified Files:
	vo_dga.c 
Log Message:
- now also supports OSD for YV12 (big speed penalty by having to build image
  in offscreen memory and then copying; 
- OSD still works just with doublebuffering enabled :-(


Index: vo_dga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dga.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** vo_dga.c	2001/04/17 20:51:58	1.13
--- vo_dga.c	2001/04/17 22:28:09	1.14
***************
*** 24,27 ****
--- 24,32 ----
   *
   * $Log$
+  * Revision 1.14  2001/04/17 22:28:09  acki2
+  * - now also supports OSD for YV12 (big speed penalty by having to build image
+  *   in offscreen memory and then copying;
+  * - OSD still works just with doublebuffering enabled :-(
+  *
   * Revision 1.13  2001/04/17 20:51:58  acki2
   * - query_format() now uses new return value concept
***************
*** 213,216 ****
--- 218,222 ----
  extern int       vo_dbpp;
  
+ static int       vo_dga_src_format;
  static int       vo_dga_width;           // bytes per line in framebuffer
  static int       vo_dga_vp_width;        // visible pixels per line in 
***************
*** 241,244 ****
--- 247,251 ----
  
  static unsigned char     *vo_dga_base;
+ static unsigned char     *vo_dga_yv12_base = NULL;
  static Display  *vo_dga_dpy;
  
***************
*** 265,287 ****
  
    char *d;
!   unsigned int offset = (y0*vo_dga_width+x0);
  
    d = (&((char *)vo_dga_base)[vo_dga_vp_offset + vo_dga_dbf_current * vo_dga_dbf_mem_offset]);
       
  
!     switch( HW_MODE.vdm_mplayer_depth ){
!         case 24: 
!           vo_draw_alpha_rgb24(w,h,src,srca,stride, d+3*offset , 3*vo_dga_width);
!           break;
!         case 32: 
!           vo_draw_alpha_rgb32(w,h,src,srca,stride, d+4*offset , 4*vo_dga_width); 
!           break;
!         case 15:
!           vo_draw_alpha_rgb15(w,h,src,srca,stride, d+2*offset , 2*vo_dga_width);
!           break;
!         case 16:        
!           vo_draw_alpha_rgb16(w,h,src,srca,stride, d+2*offset , 2*vo_dga_width);
!           break;
!     }
  }
  
--- 272,297 ----
  
    char *d;
!   unsigned int offset;
!   unsigned int buffer_stride;
  
+   offset = vo_dga_width * y0 +x0;
+   buffer_stride = vo_dga_width;
    d = (&((char *)vo_dga_base)[vo_dga_vp_offset + vo_dga_dbf_current * vo_dga_dbf_mem_offset]);
       
+   switch( HW_MODE.vdm_mplayer_depth ){
  
!   case 32: 
!     vo_draw_alpha_rgb32(w,h,src,srca,stride, d+4*offset , 4*buffer_stride); 
!     break;
!   case 24: 
!     vo_draw_alpha_rgb24(w,h,src,srca,stride, d+3*offset , 3*buffer_stride);
!     break;
!   case 15:
!     vo_draw_alpha_rgb15(w,h,src,srca,stride, d+2*offset , 2*buffer_stride);
!     break;
!   case 16:        
!     vo_draw_alpha_rgb16(w,h,src,srca,stride, d+2*offset , 2*buffer_stride);
!     break;
!   }
  }
  
***************
*** 302,306 ****
  __asm__ __volatile__( \
  " \
! xfer:                     \n\t\
                    movl %%edx, %%ecx \n\t \
                    cld\n\t \
--- 312,316 ----
  __asm__ __volatile__( \
  " \
! 1:                     \n\t\
                    movl %%edx, %%ecx \n\t \
                    cld\n\t \
***************
*** 309,313 ****
                    add %%eax, %%edi \n\t\
                    dec %%ebx \n\t\
!                   jnz xfer \n\t\
  " \
                    : \
--- 319,323 ----
                    add %%eax, %%edi \n\t\
                    dec %%ebx \n\t\
!                   jnz 1b \n\t\
  " \
                    : \
***************
*** 345,348 ****
--- 355,362 ----
  static void flip_page( void ){
  
+   if(vo_dga_src_format ==IMGFMT_YV12 ){
+        draw_frame( &vo_dga_yv12_base);
+   }
+ 
    vo_draw_text(vo_dga_src_width,vo_dga_src_height,draw_alpha);
    
***************
*** 367,375 ****
                              int w,int h,int x,int y )
  {
!   yuv2rgb( vo_dga_base + vo_dga_vp_offset + 
!           (vo_dga_width * y +x) * BYTESPP,
!            src[0], src[1], src[2],
!            w,h, vo_dga_width * BYTESPP,
!            stride[0],stride[1] );
    return 0;
  };
--- 381,397 ----
                              int w,int h,int x,int y )
  {
! 
!   // for osd, we need a separate buffer here ... :-()
! 
!     yuv2rgb( vo_dga_yv12_base + (vo_dga_src_width * y +x) * BYTESPP,
!          src[0], src[1], src[2],
!          w,h, vo_dga_src_width * BYTESPP,
!          stride[0],stride[1] );
! 
!   //  yuv2rgb( vo_dga_base + vo_dga_vp_offset + 
!   //        (vo_dga_width * y +x) * BYTESPP,
!   //         src[0], src[1], src[2],
!   //         w,h, vo_dga_width * BYTESPP,
!   //         stride[0],stride[1] );
    return 0;
  };
***************
*** 462,466 ****
   }
  
!  if( format==IMGFMT_YV12 ) return 1;
   
   if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && 
--- 484,488 ----
   }
  
!  if( format==IMGFMT_YV12 ) return 7;
   
   if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && 
***************
*** 481,484 ****
--- 503,508 ----
  
    if(vo_dga_is_running){	
+     if(vo_dga_yv12_base)free(vo_dga_yv12_base);
+     vo_dga_yv12_base = NULL;
      vo_dga_is_running = 0;
      vd_printf( VD_DBG, "vo_dga: in uninit\n");
***************
*** 606,610 ****
  
    if( vo_dga_is_running )return -1;
!   
    wanted_width = d_width;
    wanted_height = d_height;
--- 630,634 ----
  
    if( vo_dga_is_running )return -1;
!   vo_dga_src_format = format;  
    wanted_width = d_width;
    wanted_height = d_height;
***************
*** 639,642 ****
--- 663,675 ----
    } 
  
+   if(format ==IMGFMT_YV12 ){
+     vo_dga_yv12_base = malloc(wanted_width * wanted_height * BYTESPP);
+     if(vo_dga_yv12_base== NULL){
+       vd_printf(VD_ERR, "vo_dga: Not enough memory for offscreen YV12 buffer!\n");
+       return 1;
+     }
+   }
+ 
+ 
    vo_dga_vp_width = DisplayWidth( vo_dga_dpy, DefaultScreen(vo_dga_dpy));
    vo_dga_vp_height = DisplayHeight( vo_dga_dpy, DefaultScreen(vo_dga_dpy));
***************
*** 762,765 ****
--- 795,802 ----
  #endif
  #endif
+      if(vo_dga_yv12_base){
+        free(vo_dga_yv12_base);
+        vo_dga_yv12_base = NULL;
+      }
       return 1;
    }
***************
*** 849,853 ****
    vo_dga_dbf_current = 0;
    
!   if(format ==IMGFMT_YV12 )vo_dga_dbf_mem_offset = 0;
    // disable doublebuffering for YV12
  
--- 886,891 ----
    vo_dga_dbf_current = 0;
    
!   // if(format ==IMGFMT_YV12 )
!   //vo_dga_dbf_mem_offset = 0;
    // disable doublebuffering for YV12
  


_______________________________________________
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