[Mplayer-cvslog] CVS: main/libvo vo_sdl.c,1.34,1.35

Felix Buenemann atmosfear at users.sourceforge.net
Thu May 17 17:12:00 CEST 2001


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

Modified Files:
	vo_sdl.c 
Log Message:
Added ability to use direct surface blitting for BGR modes.
No depth/colorspace-conversion and no scaling, but 2 times faster.
(same speed as -vo x11 then)
Change SDL_DIRECT_BLIT from #undef to #define to test it.


Index: vo_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** vo_sdl.c	2001/05/13 16:38:33	1.34
--- vo_sdl.c	2001/05/17 15:11:58	1.35
***************
*** 95,98 ****
--- 95,103 ----
  #undef SDL_NOHWSURFACE
  
+ /* if defined, don't use depth/colorspace-conversions for rgb/bgr
+  * also no scaling done then, much faster (~2 times)!
+  */
+ #undef SDL_DIRECT_BLIT
+ 
  //#define BUGGY_SDL //defined by configure
  
***************
*** 229,234 ****
--- 234,257 ----
      			vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0)+1,2*priv->width);
  		break;
+ #ifdef SDL_DIRECT_BLIT		
  		case IMGFMT_RGB15:
  		case IMGFMT_BGR15:
+     			vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width);
+ 		break;
+ 		case IMGFMT_RGB16:
+ 		case IMGFMT_BGR16:
+     			vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width);
+ 		break;
+ 		case IMGFMT_RGB24:
+ 		case IMGFMT_BGR24:
+     			vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+3*(y0*priv->width+x0),3*priv->width);
+ 		break;
+ 		case IMGFMT_RGB32:
+ 		case IMGFMT_BGR32:
+     			vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+4*(y0*priv->width+x0),4*priv->width);
+ 		break;
+ #else		
+ 		case IMGFMT_RGB15:
+ 		case IMGFMT_BGR15:
      			vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+2*(y0*priv->width+x0),2*priv->width);
  		break;
***************
*** 245,248 ****
--- 268,272 ----
      			vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+4*(y0*priv->width+x0),4*priv->width);
  		break;
+ #endif		
    	}	
  }
***************
*** 779,782 ****
--- 803,809 ----
  	
  	if(priv->mode) {
+ #ifdef SDL_DIRECT_BLIT
+ 	if(verbose) printf("SDL: using direct surface blitting, no depth/colorspace-conversion/scaling possible.\n");
+ #endif		
  		priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel;
  		priv->stridePlaneRGB = width * priv->rgbsurface->format->BytesPerPixel;
***************
*** 846,849 ****
--- 873,896 ----
  	case IMGFMT_RGB32:
  	case IMGFMT_BGR32:
+ #ifdef SDL_DIRECT_BLIT		
+ 		/*if(SDL_MUSTLOCK(priv->surface)) {
+ 	    		if (SDL_LockSurface (priv->surface)) {
+ 				if(verbose) printf("SDL: Couldn't lock RGB surface\n");
+ 				return -1;
+ 	    		}
+ 		}*/
+ 		dst = (uint8_t *) priv->surface->pixels;
+ 	    	if(priv->flip) {
+ 	    		mysrc+=priv->framePlaneRGB;
+ 			for(i = 0; i < priv->height; i++) {
+ 				mysrc-=priv->stridePlaneRGB;
+ 				memcpy (dst, mysrc, priv->stridePlaneRGB);
+ 				dst+=priv->stridePlaneRGB;
+ 			}
+ 		}
+ 		else memcpy (dst, src[0], priv->framePlaneRGB);
+ 		/*if(SDL_MUSTLOCK(priv->surface)) 
+ 			SDL_UnlockSurface (priv->surface);*/
+ #else			
  		/*if(SDL_MUSTLOCK(priv->rgbsurface)) {
  	    		if (SDL_LockSurface (priv->rgbsurface)) {
***************
*** 864,867 ****
--- 911,915 ----
  		/*if(SDL_MUSTLOCK(priv->rgbsurface)) 
  			SDL_UnlockSurface (priv->rgbsurface);*/
+ #endif			
  		break;
  
***************
*** 1088,1091 ****
--- 1136,1140 ----
  	    case IMGFMT_RGB32:
  	    case IMGFMT_BGR32:
+ #ifndef SDL_DIRECT_BLIT	    
  	    	/* blit to the RGB surface */
  		blitconv = SDL_DisplayFormat(priv->rgbsurface);	
***************
*** 1093,1096 ****
--- 1142,1146 ----
  			printf("SDL: Blit failed: %s\n", SDL_GetError());
  		SDL_FreeSurface(blitconv);	
+ #endif		
  
  		/* update screen */


_______________________________________________
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